Commit e8b788bd authored by 邓超's avatar 邓超

fix: 事件添加导入导出功能

parent 2eb39a36
Pipeline #67194 passed with stages
......@@ -24,6 +24,7 @@ import {
Input,
message,
Tag,
Upload,
} from 'antd';
import {
......@@ -37,6 +38,8 @@ import {
ApartmentOutlined,
DesktopOutlined,
FormOutlined,
ImportOutlined,
ExportOutlined,
} from '@ant-design/icons';
import {
GetCM_Event_LoadEventTable,
......@@ -44,6 +47,9 @@ import {
CM_Event_ReOrder,
GetCM_Event_LoadEventTypeTable,
CM_Event_EditBusinessType,
CheckImportEventConfig,
ImportEventConfig,
ExportEventConfig,
} from '@/services/standingBook/api';
import classnames from 'classnames';
import styles from './incident.less';
......@@ -79,6 +85,7 @@ const incident = () => {
const [keepIdValue, setKeepIdValue] = useState([]);
const [editBusinessVisible, setEditBusinessVisible] = useState(false);
const [addForm] = Form.useForm();
const [file, setFile] = useState(); // 上传文件信息
const columns = [
{
......@@ -256,6 +263,12 @@ const incident = () => {
<Tooltip title="编辑事件类型">
<EditTwoTone onClick={() => editEventType(record)} style={{ fontSize: '16px' }} />
</Tooltip>
<Tooltip title="导出事件">
<ExportOutlined
onClick={() => hadelExport(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
<Tooltip title="受理流程">
<ApartmentOutlined
onClick={() => process1(record)}
......@@ -366,6 +379,41 @@ const incident = () => {
}
});
}, []);
const beforeUpload = val => {
setFile(val);
const formData = new FormData();
formData.append('_files', val);
CheckImportEventConfig(formData).then(res => {
if (res.code === 0) {
Modal.confirm({
title: '提示',
icon: '',
content: <div style={{ whiteSpace: 'pre-wrap' }}>{res.data}</div>,
onOk() {
console.log('OK');
ImportEventConfig(formData).then(response => {
if (response.code === 0) {
message.success('导入成功');
} else {
message.error(response.msg);
}
});
},
okText: '确认',
cancelText: '取消',
});
} else {
message.error(res.msg);
}
});
return false;
};
// 导出
const hadelExport = record => {
window.location.href = ExportEventConfig({
eventTypeId: record.ID,
});
};
const formateArrDataA = (initialArr, name) => {
console.log(initialArr);
console.log(name);
......@@ -619,14 +667,21 @@ const incident = () => {
<FormOutlined className={styles.iconSize} onClick={editBusiness} />
</Tooltip>
</span>
<span style={{ float: 'right', marginRight: '10px' }}>
<span style={{ float: 'right', marginRight: '10px', marginTop: '10px' }}>
<Upload showUploadList={false} accept=".json" beforeUpload={beforeUpload}>
<Button style={{ marginLeft: '10px' }} type="primary" ghost>
<div style={{ display: 'flex', alignItems: 'center' }}>
<ImportOutlined style={{ marginRight: '5px' }} />
<div> 导入</div>
</div>
</Button>
</Upload>
<Button
icon={<OrderedListOutlined className={styles.icon} />}
onClick={sort}
style={{
marginLeft: '30px',
marginLeft: '10px',
verticalAlign: 'middle',
marginTop: '10px',
}}
>
调序
......
......@@ -3,8 +3,8 @@
* @Description:
* @Author: leizhe
* @Date: 2021-07-23 10:42:58
* @LastEditTime: 2022-08-17 10:11:11
* @LastEditors: leizhe
* @LastEditTime: 2023-02-08 17:02:25
* @LastEditors: dengchao 754083046@qq.com
*/
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
......@@ -102,3 +102,20 @@ export const GetEventExtendPage = query =>
// 删除事件辅助视图配置
export const CM_Event_RemoveEventExtendPage = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_RemoveEventExtendPage`, query);
// 事件导入检查
export const CheckImportEventConfig = query =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CheckImportEventConfig`, query, {
headers: {
'Content-Type': 'multipart/form-data;charset=UTF-8',
},
});
// 事件导入
export const ImportEventConfig = query =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/ImportEventConfig`, query, {
headers: {
'Content-Type': 'multipart/form-data;charset=UTF-8',
},
});
// 导出
export const ExportEventConfig = query =>
`${PUBLISH_SERVICE}/WorkOrderCenter/ExportEventConfig?eventTypeId=${query.eventTypeId}`;
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