Commit d1aac0ea authored by 涂伟's avatar 涂伟

feat: '事件配置新增通用事件配置'

parent 069be2a3
.AddAccount{
:global {
.ant-row {
width: 520px !important;
}
}
}
\ No newline at end of file
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { Drawer, Form, Input, notification, Space, Row, Col, Select, Checkbox, Button, Tooltip, Image, Switch, Spin } from 'antd'; import { Drawer, Table, Form, Input, notification, Space, Row, Col, Select, Checkbox, Button, Tooltip, Image, Switch, Spin } from 'antd';
import { import {
GetCM_Event_LoadEventTypeTable, GetCM_Event_LoadEventTypeTable,
LoadEventFields, LoadEventFields,
...@@ -20,6 +20,7 @@ import caseImg from '@/assets/images/workOptions/工单.png'; ...@@ -20,6 +20,7 @@ import caseImg from '@/assets/images/workOptions/工单.png';
import caseChooseImg from '@/assets/images/workOptions/工单发起选中.png'; import caseChooseImg from '@/assets/images/workOptions/工单发起选中.png';
import eventChooseImg from '@/assets/images/workOptions/事件选中.png'; import eventChooseImg from '@/assets/images/workOptions/事件选中.png';
import SelectField from './SelectField'; import SelectField from './SelectField';
import AddAccount from './AddAccount';
const { Option } = Select; const { Option } = Select;
const { Item } = Form; const { Item } = Form;
...@@ -415,6 +416,7 @@ const AddModal = (props) => { ...@@ -415,6 +416,7 @@ const AddModal = (props) => {
maxLength, maxLength,
selectData, selectData,
rember1, rember1,
businessArr
} = props; } = props;
const [checkedList1, setCheckedList1] = useState([]); const [checkedList1, setCheckedList1] = useState([]);
...@@ -454,7 +456,12 @@ const AddModal = (props) => { ...@@ -454,7 +456,12 @@ const AddModal = (props) => {
const [eventFlowId, setEventFlowId] = useState(0); const [eventFlowId, setEventFlowId] = useState(0);
const [show, setShow] = useState('hidden'); const [show, setShow] = useState('hidden');
const [initWay, setInitWay] = useState(); // 初始上报方式 const [initWay, setInitWay] = useState(); // 初始上报方式
const [viewModal, setViewModal] = useState(false);
const [index, setIndex] = useState(0)
const [modalType, setModalType] = useState('');
const [viewMsg, setviewMsg] = useState({}); // 保存编辑的信息
const selectFieldRef = useRef(null) const selectFieldRef = useRef(null)
const tableData = useRef([]); // 通用事件回显的表格
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
...@@ -480,7 +487,7 @@ const AddModal = (props) => { ...@@ -480,7 +487,7 @@ const AddModal = (props) => {
notification.warning({ message: '提示', description: '事件权限必填' }) notification.warning({ message: '提示', description: '事件权限必填' })
} else { } else {
if (type == 'edit') { if (type == 'edit') {
CM_Event_EditEventTable({ ID: formObj.ID, ...obj, Order, EventFlowId: eventFlowId, }) CM_Event_EditEventTable({ ID: formObj.ID, ...obj, Order, EventFlowId: eventFlowId, SubEventInfo: tableData.current })
.then(res => { .then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
form.resetFields(); form.resetFields();
...@@ -500,7 +507,7 @@ const AddModal = (props) => { ...@@ -500,7 +507,7 @@ const AddModal = (props) => {
if (obj.Roles == undefined) { if (obj.Roles == undefined) {
obj.Roles = ''; obj.Roles = '';
} }
CM_Event_AddEventTable({ ...obj, Order: maxLength }).then(res => { CM_Event_AddEventTable({ ...obj, Order: maxLength, SubEventInfo: tableData.current }).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
form.resetFields(); form.resetFields();
setValue(''); setValue('');
...@@ -525,6 +532,7 @@ const AddModal = (props) => { ...@@ -525,6 +532,7 @@ const AddModal = (props) => {
getRole(); getRole();
if (type === 'add') { if (type === 'add') {
form.setFieldsValue({ BusinessType: rember1 }); form.setFieldsValue({ BusinessType: rember1 });
tableData.current = []
setValue(1); setValue(1);
getEventData(); getEventData();
setSelectValue(selectData[0]); setSelectValue(selectData[0]);
...@@ -554,6 +562,7 @@ const AddModal = (props) => { ...@@ -554,6 +562,7 @@ const AddModal = (props) => {
setReportType({ visibleCheck: Boolean(Reportable), ReportFromMobile, ReportFromWeb }) setReportType({ visibleCheck: Boolean(Reportable), ReportFromMobile, ReportFromWeb })
setOrder(res.data.root.Order); setOrder(res.data.root.Order);
form.setFieldsValue({ ...res.data.root }); form.setFieldsValue({ ...res.data.root });
tableData.current = res.data.root.SubEventInfo
if (res.data.root.ImageExpression) { if (res.data.root.ImageExpression) {
setImageUrl(`${window.location.origin}/civweb4/${res.data.root.ImageExpression}`); setImageUrl(`${window.location.origin}/civweb4/${res.data.root.ImageExpression}`);
setIm(res.data.root.ImageExpression); setIm(res.data.root.ImageExpression);
...@@ -943,6 +952,54 @@ const AddModal = (props) => { ...@@ -943,6 +952,54 @@ const AddModal = (props) => {
setReportType({ ...reportType, ...values }) setReportType({ ...reportType, ...values })
} }
// 定义表格
const columns = [
{
title: '事件名称',
dataIndex: 'SubFlowEventName',
align: 'center',
render: (text, record) => {
if (text === '(未配置)' || text === '(无)') {
return <span style={{ color: 'grey' }}>{text}</span>;
}
return <span>{text || record.WebPage}</span>;
},
},
// {
// title: '源字段',
// dataIndex: 'Fields',
// align: 'center',
// render: (text, record) => {
// if (text === '(未配置)' || text === '(无)') {
// return <span style={{ color: 'grey' }}>{text}</span>;
// }
// return <span>{text || record.WebPage}</span>;
// },
// },
{
title: '操作',
align: 'center',
ellipsis: true,
render: record => (
<>
<Space>
<DeleteOutlined
onClick={() => delRow(record)}
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Space>
</>
),
},
];
const delRow = record => {
let list = JSON.parse(JSON.stringify(tableData.current));
list = list.filter(item => item.SubFlowEventConfigID !== record.SubFlowEventConfigID);
tableData.current = list;
setFlag(flag + 1)
};
const onOK = prop => { const onOK = prop => {
setIsVisible(false); setIsVisible(false);
let inputText = {}; let inputText = {};
...@@ -1176,6 +1233,24 @@ const AddModal = (props) => { ...@@ -1176,6 +1233,24 @@ const AddModal = (props) => {
setShow('hidden'); setShow('hidden');
}; };
const saveView = (val, type) => {
let list = JSON.parse(JSON.stringify(tableData.current));
if (type === 'add') {
list.push({ ...val });
} else {
list[index] = val
}
tableData.current = list;
// nodeChage('AccountFlowNodeBackfillConfigs', tableData.current);
setViewModal(false);
};
const toEdit = val => {
setViewModal(true);
setModalType('edit');
setviewMsg(val);
};
return ( return (
<Drawer <Drawer
title={type === 'add' ? '添加事件' : '编辑事件'} title={type === 'add' ? '添加事件' : '编辑事件'}
...@@ -1764,6 +1839,43 @@ const AddModal = (props) => { ...@@ -1764,6 +1839,43 @@ const AddModal = (props) => {
</Item> </Item>
</Col> </Col>
</Row> </Row>
<Row>
<Col span={24}>
<Item
label="通用事件"
name="usualEvent"
// style={{ height: '112px' }}
labelCol={{ span: 5 }}
>
<Button
type="primary"
onClick={() => {
setViewModal(true);
setModalType('add');
}}
style={{ display: 'flex', alignItems: 'center' }}
icon={<PlusOutlined />}
>
新增通用事件
</Button>
<Table
dataSource={tableData.current}
columns={columns}
rowKey={record => record.key}
bordered
size="small"
scroll={{ y: 'calc(100vh - 630px)' }}
onRow={(record, index) => ({
onDoubleClick: () => {
setIndex(index)
toEdit(record, index);
},
})}
pagination={false}
/>
</Item>
</Col>
</Row>
</Form> </Form>
)} )}
</Spin> </Spin>
...@@ -1808,6 +1920,18 @@ const AddModal = (props) => { ...@@ -1808,6 +1920,18 @@ const AddModal = (props) => {
formObj={formObj} formObj={formObj}
/> />
<SelectField ref={selectFieldRef} filed={filed} filedArray={nu} submit={submitField} /> <SelectField ref={selectFieldRef} filed={filed} filedArray={nu} submit={submitField} />
<AddAccount
tableName={form.getFieldValue('TableName')}
eventNames={businessArr.length ? businessArr[0].root : []}
tableData={tableData.current}
visible={viewModal}
msg={viewMsg}
modalType={modalType}
handleCancel={() => setViewModal(false)}
onSubumit={saveView}
// tableField={tableField}
addIndex={tableData.current && tableData.current.length}
/>
</Drawer> </Drawer>
); );
}; };
......
...@@ -57,6 +57,7 @@ import AddModal from './AddModal'; ...@@ -57,6 +57,7 @@ import AddModal from './AddModal';
import ProcessModal from './ProcessModal'; import ProcessModal from './ProcessModal';
import SortModal from './SortModal'; import SortModal from './SortModal';
import ViewModal from './ViewModal'; import ViewModal from './ViewModal';
import { LoadEventFields } from '@/services/tablemanager/tablemanager';
const { Search } = Input; const { Search } = Input;
...@@ -706,6 +707,7 @@ const incident = () => { ...@@ -706,6 +707,7 @@ const incident = () => {
selectData={select} selectData={select}
callBackSubmit={onSubmit} callBackSubmit={onSubmit}
placement="right" placement="right"
businessArr={keepIdValue.filter(item => item.businessType === '通用事件')}
/> />
<SortModal <SortModal
title="调整顺序" title="调整顺序"
......
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