Commit a0a3f671 by zhaochengxiang

多个资产生成工作簿

parent 6549fc48
......@@ -79,6 +79,10 @@ export function* getDataAssetDetail(payload) {
return yield call(service.getDataAssetDetail, payload);
}
export function* listDataAssetDetails(payload) {
return yield call(service.listDataAssetDetails, payload);
}
export function* listDataAssetsByPage(payload) {
return yield call(service.listDataAssetsByPage, payload);
}
......
......@@ -72,6 +72,10 @@ export function getDataAssetDetail(payload) {
return GetJSON("/dataassetmanager/dataAssetApi/getDataAssetDetail", payload);
}
export function listDataAssetDetails(payload) {
return PostJSON("/dataassetmanager/dataAssetApi/listDataAssetDetails", payload);
}
export function listDataAssetsByPage(payload) {
return GetJSON("/dataassetmanager/dataAssetApi/listDataAssetsByPage", payload);
}
......
......@@ -969,9 +969,7 @@ const AssetTable = (props) => {
const onReportAnalyseClick = (val) => {
if ((checkedKeys||[]).length === 0) {
showMessage('warn', '请先选择一个资产');
} else if ((checkedKeys||[]).length > 1) {
showMessage('warn', '只能选择一个资产');
showMessage('warn', '请先选择资产');
} else {
setReport(val);
setWorksheetModalVisible(true);
......@@ -1251,7 +1249,7 @@ const AssetTable = (props) => {
<WorksheetModal
report={currentReport}
visible={worksheetModalVisible}
id={(checkedKeys||[]).length>0?checkedKeys[0]:''}
ids={checkedKeys}
onCancel={() => {
setWorksheetModalVisible(false);
}}
......
import React, { useEffect, useState } from 'react';
import { Modal, Form, Button, Space, Input, Checkbox, Row, Col, Typography, Spin, InputNumber } from 'antd';
import { Modal, Form, Button, Space, Input, Checkbox, Row, Col, Typography, Spin, InputNumber, Divider } from 'antd';
import { dispatch } from '../../../../model';
import { showMessage } from '../../../../util';
const WorksheetModal = (props) => {
const { onCancel, visible, id, report } = props;
const { onCancel, visible, ids, report } = props;
const [loading, setLoading] = useState(false);
const [asset, setAsset] = useState();
const [assets, setAssets] = useState();
const [ form ] = Form.useForm();
useEffect(() => {
if (visible && id) {
getAsset()
if (visible && (ids??[]).length>0) {
getAssets()
}
}, [visible, id])
}, [visible, ids])
const getAsset = () => {
const getAssets = () => {
setLoading(true)
dispatch({
type: 'assetmanage.getDataAssetDetail',
type: 'assetmanage.listDataAssetDetails',
payload: {
dataAssetId: id,
data: ids
},
callback: data => {
setLoading(false)
setAsset(data)
form?.setFieldsValue(data)
setLoading(false);
setAssets(data);
const newFiledsValue = {};
(data??[]).forEach(item => {
newFiledsValue[`limit-${item.id}`] = 10000;
newFiledsValue[`columns-${item.id}`] = item.columns;
});
form?.setFieldsValue(newFiledsValue);
},
error: () => {
setLoading(false)
......@@ -44,10 +49,14 @@ const WorksheetModal = (props) => {
type: 'assetmanage.saveWorkbookByType',
payload: {
data: {
dataAssetId:id,
metadataTableId: asset?.metadataId,
name: row.name,
type: report?.code,
...row,
dataAssetList: (assets??[]).map(item => ({
dataAssetId: item.id,
metadataTableId: item.metadataId,
limit: row[`limit-${item.id}`],
columns: row[`columns-${item.id}`],
}))
}
},
callback: data => {
......@@ -73,7 +82,7 @@ const WorksheetModal = (props) => {
const reset = () => {
setLoading(false);
setAsset();
setAssets();
form?.resetFields();
}
......@@ -90,10 +99,11 @@ const WorksheetModal = (props) => {
return (
<Modal
forceRender
centered destroyOnClose
title={`${report?.name}工作簿信息`}
visible={ visible }
width={ 800 }
bodyStyle={{ padding: '15px', overflowX: 'auto', maxHeight: '80vh' }}
onCancel={() => {
reset();
onCancel && onCancel();
......@@ -114,25 +124,41 @@ const WorksheetModal = (props) => {
label="名称"
name="name"
rules={[{ required: true, message: '请填写工作簿名称!' }]}
style={{ marginBottom: 15 }}
>
<Input />
</Form.Item>
{
(assets??[]).map(item => <>
<Divider style={{ marginTop: 0, marginBottom: 15 }} />
<Row>
<Col span={(report?.code==='SpreadJS')?12:24}>
<Form.Item label="库表" labelCol={{ span: (report?.code==='SpreadJS')?8:4 }} style={{ marginBottom: 15 }}>{item.dataAssetCnName}</Form.Item>
</Col>
<Col span={12}>
{
(report?.code === 'SpreadJS') && <Form.Item
label="最大加载行数"
name="limit"
labelCol={{ span: 8 }}
name={`limit-${item.id}`}
rules={[{ required: true, message: '请选择最大加载行数!' }]}
style={{ marginBottom: 15 }}
>
<InputNumber min={0} />
</Form.Item>
}
</Col>
</Row>
<Form.Item
label="字段"
name="columns"
name={`columns-${item.id}`}
rules={[{ required: true, message: '请选择字段!' }]}
style={{ marginBottom: 15 }}
>
<ColumnsItem data={asset?.columns} />
<ColumnsItem data={item?.columns} />
</Form.Item>
</>)
}
</Form>
</Spin>
</Modal>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment