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 { 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 {
GetCM_Event_LoadEventTypeTable,
LoadEventFields,
......@@ -20,6 +20,7 @@ import caseImg from '@/assets/images/workOptions/工单.png';
import caseChooseImg from '@/assets/images/workOptions/工单发起选中.png';
import eventChooseImg from '@/assets/images/workOptions/事件选中.png';
import SelectField from './SelectField';
import AddAccount from './AddAccount';
const { Option } = Select;
const { Item } = Form;
......@@ -415,6 +416,7 @@ const AddModal = (props) => {
maxLength,
selectData,
rember1,
businessArr
} = props;
const [checkedList1, setCheckedList1] = useState([]);
......@@ -454,7 +456,12 @@ const AddModal = (props) => {
const [eventFlowId, setEventFlowId] = useState(0);
const [show, setShow] = useState('hidden');
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 tableData = useRef([]); // 通用事件回显的表格
const onSubmit = () => {
form.validateFields().then(validate => {
......@@ -480,7 +487,7 @@ const AddModal = (props) => {
notification.warning({ message: '提示', description: '事件权限必填' })
} else {
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 => {
if (res.msg === 'Ok') {
form.resetFields();
......@@ -500,7 +507,7 @@ const AddModal = (props) => {
if (obj.Roles == undefined) {
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') {
form.resetFields();
setValue('');
......@@ -525,6 +532,7 @@ const AddModal = (props) => {
getRole();
if (type === 'add') {
form.setFieldsValue({ BusinessType: rember1 });
tableData.current = []
setValue(1);
getEventData();
setSelectValue(selectData[0]);
......@@ -554,6 +562,7 @@ const AddModal = (props) => {
setReportType({ visibleCheck: Boolean(Reportable), ReportFromMobile, ReportFromWeb })
setOrder(res.data.root.Order);
form.setFieldsValue({ ...res.data.root });
tableData.current = res.data.root.SubEventInfo
if (res.data.root.ImageExpression) {
setImageUrl(`${window.location.origin}/civweb4/${res.data.root.ImageExpression}`);
setIm(res.data.root.ImageExpression);
......@@ -943,6 +952,54 @@ const AddModal = (props) => {
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 => {
setIsVisible(false);
let inputText = {};
......@@ -1176,6 +1233,24 @@ const AddModal = (props) => {
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 (
<Drawer
title={type === 'add' ? '添加事件' : '编辑事件'}
......@@ -1764,6 +1839,43 @@ const AddModal = (props) => {
</Item>
</Col>
</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>
)}
</Spin>
......@@ -1808,6 +1920,18 @@ const AddModal = (props) => {
formObj={formObj}
/>
<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>
);
};
......
......@@ -57,6 +57,7 @@ import AddModal from './AddModal';
import ProcessModal from './ProcessModal';
import SortModal from './SortModal';
import ViewModal from './ViewModal';
import { LoadEventFields } from '@/services/tablemanager/tablemanager';
const { Search } = Input;
......@@ -706,6 +707,7 @@ const incident = () => {
selectData={select}
callBackSubmit={onSubmit}
placement="right"
businessArr={keepIdValue.filter(item => item.businessType === '通用事件')}
/>
<SortModal
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