Commit fbc76097 authored by 皮倩雯's avatar 皮倩雯

事件管理模块

parent e3a32324
......@@ -183,7 +183,7 @@ const LoginLog = () => {
bordered
columns={columns}
dataSource={data0}
scroll={{ x: 'max-content', y: 'calc(100vh - 208px)' }}
scroll={{ x: 'max-content', y: 'calc(100vh - 230px)' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
......
......@@ -18,7 +18,7 @@
background-color:#F6F9FE;
}
.ant-table-body{
height:calc(100vh - 208px);
height:calc(100vh - 230px);
border-right: white;
overflow: auto !important;
}
......
import React, { useState, useEffect } from 'react';
import { Modal, Form, Input, notification, message, Row, Col, Select, Checkbox, Radio, Button } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import ChangeAddFlows from './ChangeAddFlows'
import { CM_Event_ReloadFlows, CM_Event_LoadDepartmentAndRoles, CM_Event_AddEvenFlow, CM_Event_EditEvenFlow } from '@/services/standingBook/api';
import styles from './incident.less';
const AddFlowsModal = props => {
const { callBackSubmit = () => { }, type, visible, onCancel, formObj, obj, maxLength, record } = props;
const [form] = Form.useForm();
const { Item } = Form;
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [standingTable, setStandingTable] = useState([]);
const [visible1, setVisible1] = useState(false)
const [pickItem, setPickItem] = useState('')
const [checkedList1, setCheckedList1] = useState([])
const [inputValue, setInputValue] = useState({ Roles: '' });
const [characterValue, setCharacterValue] = useState('')
const [Order, setOrder] = useState(''); // 弹窗类型
const [strr, setStrr] = useState('')
useEffect(() => {
getRole()
CM_Event_ReloadFlows({ eventTypeId: obj }).then(res => {
if (res.msg === 'Ok') {
console.log(res.data)
let arr = formateArrDataA(res.data, 'System')
let newArr = []
Object.keys(arr).map((item, index) => {
newArr.push(item)
})
console.log(newArr)
setStandingTable(newArr);
}
})
if (type === 'add') {
setInputValue({ Roles: '' })
setFiled1({})
form.resetFields();
}else if(type==='edit'){
setInputValue({
Roles:record.FlowRoles
})
}
}, [visible])
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
for (let keys in tempObj) {
let arr = []
tempObj[keys].map((item, index) => {
tempObj[keys] = arr;
item.key = index
arr.push(item)
})
}
return tempObj
}
const formateArrDataA1 = (initialArr, name) => {
let aa = []
let a1 = []
let a2
let a3 = []
initialArr.map(i => {
// console.log(i.groupType)
a2 = i.groupType
// console.log(a2)
// console.log(i.root)
a1 = i.root
a1.map(j => {
j.group = a2
// console.log(j)
})
aa.push(i.root)
})
// console.log(aa)
aa.map(p => {
// console.log(p)
p.map(o => {
// console.log(o)
a3.push(o)
})
})
console.log(a3)
// 判定传参是否符合规则
if (!(a3 instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
a3.map(i => {
if (nameArr.indexOf(i.group) === -1) {
nameArr.push(i.group)
}
})
console.log(nameArr)
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in a3) {
if (a3[j].group == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(a3[j])
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.Name)
})
}
return tempObj
}
const onSumbit = () => {
callBackSubmit();
// setLoading(true);
let aa = form.getFieldsValue().FlowName
console.log(aa)
console.log(inputValue)
console.log(strr)
if (type == 'edit') {
CM_Event_EditEvenFlow({
eventTypeId: formObj.ID,
eventFlowId: record.ID,
roles: strr,
})
.then(res => {
// setLoading(false);
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(error => {
notification.error({
message: '提示',
duration: 3,
description: '编辑失败',
});
setLoading(false);
});
}
if (type == 'add') {
CM_Event_AddEvenFlow({
eventTypeId: formObj.ID,
flowName: aa,
roles: strr,
order: maxLength,
})
.then(res => {
// setLoading(false);
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(error => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
// setLoading(false);
});
}
};
const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setFiled1(formateArrDataA1(res.data, 'groupType'))
console.log(res.data)
}
})
}
const changeText = (e, type) => {
let inputText = { ...inputValue }
inputText[type] = e.target.value
setInputValue(inputText)
}
const pickFiled1 = (fileds) => {
// setTypes('app')
console.log(fileds)
setCharacterValue(inputValue[fileds])
setCheckedList1(inputValue[fileds].split(','))
setPickItem(fileds)
setVisible1(true)
}
const onOKk = prop => {
setVisible1(false)
let inputText = { ...inputValue }
inputText[prop.pickItem] = prop.str
console.log(prop.str)
console.log(inputText)
setStrr(prop.str)
setCheckedList1(prop.checkedList)
setInputValue(inputText)
}
return (
<Modal
title={type === 'add' ? '添加受理流程' : '编辑受理流程'}
visible={visible}
onCancel={onCancel}
width='800px'
onOk={onSumbit}
okText="确认"
cancelText="取消"
>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '8rem', overflowY: 'scroll' }}>
<Row>
<Col span={24}>
<Item
label="受理流程"
name="FlowName"
labelCol={{ span: 4 }}
>
<Select
style={{ width: '580px' }}
placeholder="选择受理流程"
>
{standingTable ? standingTable.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
</Select>
</Item>
</Col>
<Col span={24}>
<Item
label="受理权限"
name="Roles"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择受理权限" onChange={(e) => changeText(e, 'Roles')} value={inputValue.Roles} allowClear />
<Button type="dashed" onClick={() => pickFiled1('Roles')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
</Row>
</Form>
<ChangeAddFlows
visible={visible1}
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1}
filed1={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/>
</Modal>
)
}
export default AddFlowsModal
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, notification, message, Row, Col, Select, Checkbox, Radio, Button } from 'antd';
import { GetCM_Event_LoadEventTypeTable, LoadEventFields, CM_Event_LoadDepartmentAndRoles, CM_Event_EditEventTable, GetCM_Event_QueryEventType, CM_Event_AddEventTable } from '@/services/standingBook/api'
import styles from './incident.less';
import ChangeAdd from './changeAdd'
import { PlusOutlined } from '@ant-design/icons'
import { set } from 'immutable';
import { getRoleGroup } from '@/services/userCenter/roleManage/api';
const { Option } = Select;
const AddModal = props => {
const [inputValue, setInputValue] = useState({ SummaryFields: '', ReportFields: '', DisplayFields: '', EditableFields: '', TransitFields: '', Roles: '', RelatedEventFields: '', pictureFields: '' });
const { callBackSubmit = () => { }, visible, type, formObj, treeData, maxLength } = props;
const CheckboxGroup = Checkbox.Group;
const defaultCheckedList = ['前端', '手持']
// const plainOptions = ['前端', '手持']
const [checkedList, setCheckedList] = useState(defaultCheckedList);
const [checkedList1, setCheckedList1] = useState([])
const [checkedList2, setCheckedList2] = useState([])
const [checkedList3, setCheckedList3] = useState([])
const [checkedList4, setCheckedList4] = useState([])
const [editable, setEditable] = useState(false)
const [ReportFromMobile, setReportFromMobile] = useState(false)
const [ReportFromWeb, setReportFromWeb] = useState(false)
const [indeterminate, setIndeterminate] = useState(true);
const [checkAll, setCheckAll] = useState(true);
const [pickItem, setPickItem] = useState('')
const [prefixName, setPrefixName] = useState('')
const [standingTable, setStandingTable] = useState([]);
const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [value, setValue] = useState(0);//单选
const [types, setTypes] = useState(''); // 弹窗类型
const [Order, setOrder] = useState(''); // 弹窗类型
const [Type, setType] = useState('')
const [isVisible, setIsVisible] = useState(false); // 弹窗
const [characterValue, setCharacterValue] = useState('')
const [form] = Form.useForm();
const { Item } = Form;
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
// setLoading(true);
let obj = form.getFieldsValue();
// console.log(obj.Reportable)
console.log(obj)
console.log(obj.Editable)
console.log(obj.CreateMode)
console.log(obj.ReportFromWeb)
console.log(inputValue)
if (obj.CreateMode === 0 || 1) {
obj.CreateMode = obj.CreateMode.toString()
}
if (checkedList2 != true) {
obj.Editable = false
} else {
obj.Editable = checkedList2
}
if (checkedList3 === true && checkedList4 === true) {
obj.Reportable = '均可'
obj.ReportFromMobile = '手持'
obj.ReportFromWeb = '前端'
// inputValue.Reportable = '均可'
// inputValue.ReportFromMobile = '手持'
// inputValue.ReportFromWeb = '前端'
} else if (checkedList3 === true) {
obj.Reportable = '前端'
obj.ReportFromMobile = ''
obj.ReportFromWeb = '前端'
// inputValue.Reportable = '前端'
// inputValue.ReportFromMobile = ''
// inputValue.ReportFromWeb = '前端'
} else if (checkedList4 === true) {
obj.Reportable = '手持'
obj.ReportFromMobile = '手持'
obj.ReportFromWeb = ''
// inputValue.Reportable = '手持'
// inputValue.ReportFromMobile = '手持'
// inputValue.ReportFromWeb = ''
} else {
obj.Reportable = '否'
obj.ReportFromMobile = ''
obj.ReportFromWeb = ''
// inputValue.Reportable = ''
// inputValue.ReportFromMobile = ''
// inputValue.ReportFromWeb = ''
}
console.log(type)
console.log(obj)
console.log(inputValue)
console.log({ ...inputValue })
console.log({ ...obj })
console.log(inputValue)
if((obj.Reportable !== '否')&&(inputValue.Roles === '')){
notification.warning({
message: '提示',
description: '当允许客户端上报时需选择事件权限',
})
}else{
let data = type == 'add' ? { ...obj, ...inputValue, Order: maxLength } : { ...obj, Order, ID: formObj.ID }
if (type == 'edit') {
CM_Event_EditEventTable(data)
.then(res => {
// setLoading(false);
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(error => {
notification.error({
message: '提示',
duration: 3,
description: '编辑失败',
});
setLoading(false);
});
}
if (type == 'add') {
CM_Event_AddEventTable(data)
.then(res => {
// setLoading(false);
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(error => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
});
}
}
}
});
};
useEffect(() => {
getEventData()
getRole()
if (type === 'add') {
setInputValue({ SummaryFields: '', ReportFields: '', DisplayFields: '', EditableFields: '', TransitFields: '', Roles: '', RelatedEventFields: '', pictureFields: '' })
setFiled({})
setFiled1({})
form.resetFields();
setEditable(false)
setReportFromMobile(false)
setReportFromWeb(false)
} else if (type === 'edit') {
GetCM_Event_QueryEventType({ eventTypeId: formObj.ID }).then(res => {
res.data.root && form.setFieldsValue({ ...res.data.root });
console.log(res.data.root)
setEditable(res.data.root.Editable)
setReportFromMobile(res.data.root.ReportFromMobile)
setReportFromWeb(res.data.root.ReportFromWeb)
setInputValue({ ...res.data.root })
setOrder(res.data.root.Order)
setType(res.data.root.BusinessType)
changTable(res.data.root.TableName)
})
}
}, [visible])
const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setFiled1(formateArrDataA1(res.data, 'groupType'))
console.log(res.data)
}
})
}
const getEventData = () => {
setType('')
GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') {
console.log(res.data)
setStandingTable(res.data)
}
})
}
const changTable = (value) => {
LoadEventFields({ eventTableName: value, distinctFields: '' }).then(res => {
if (res.data.root && res.data.root.length) {
setFiled(formateArrDataA(res.data.root, 'group'))
console.log(res.data.root)
}
})
}
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
console.log(nameArr)
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
console.log(tempObj)
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.fieldName)
})
}
return tempObj
}
const formateArrDataA1 = (initialArr, name) => {
let aa = []
let a1 = []
let a2
let a3 = []
initialArr.map(i => {
// console.log(i.groupType)
a2 = i.groupType
// console.log(a2)
// console.log(i.root)
a1 = i.root
a1.map(j => {
j.group = a2
// console.log(j)
})
aa.push(i.root)
})
// console.log(aa)
aa.map(p => {
// console.log(p)
p.map(o => {
// console.log(o)
a3.push(o)
})
})
console.log(a3)
// 判定传参是否符合规则
if (!(a3 instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
a3.map(i => {
if (nameArr.indexOf(i.group) === -1) {
nameArr.push(i.group)
}
})
console.log(nameArr)
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in a3) {
if (a3[j].group == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(a3[j])
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.Name)
})
}
return tempObj
}
const onChange = list => {
console.log(list)
setCheckedList(list);
setIndeterminate(!!list.length && list.length < ['前端', '手持'].length);
setCheckAll(list.length === ['前端', '手持'].length);
};
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? ['前端', '手持'] : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
const onChange1 = e => {
console.log(e.target.checked)
setEditable(e.target.checked)
setCheckedList2(e.target.checked);//true
}
const onChange2 = e => {
console.log(e.target.value)
setValue(e.target.value);
}
const onChange3 = e => {
console.log(e.target.checked)
setReportFromWeb(e.target.checked)
setCheckedList3(e.target.checked);//true
}
const onChange4 = e => {
console.log(e.target.checked)
setReportFromMobile(e.target.checked)
setCheckedList4(e.target.checked);//true
}
const changeData = () => {
}
const onOK = prop => {
setIsVisible(false)
let inputText = { ...inputValue }
inputText[prop.pickItem] = prop.str
setCheckedList1(prop.checkedList)
setInputValue(inputText)
}
const pickFiled = (fileds) => {
setTypes('add')
setCharacterValue(inputValue[fileds])
setCheckedList1(inputValue[fileds].split(','))
setPickItem(fileds)
setIsVisible(true)
}
const pickFiled1 = (fileds) => {
setTypes('app')
setCharacterValue(inputValue[fileds])
setCheckedList1(inputValue[fileds].split(','))
setPickItem(fileds)
setIsVisible(true)
}
const changeText = (e, type) => {
let inputText = { ...inputValue }
inputText[type] = e.target.value
setInputValue(inputText)
}
const prefix = (e) => {
setPrefixName(changPrefix(e.target.value))
console.log(prefixName)
form.setFieldsValue({ Code: prefixName })
}
const changPrefix = (item) => {
let aa = item.slice(0, 2)
return (aa)
}
return (
<Modal
title={type === 'add' ? '添加事件类型' : '编辑事件类型'}
maskClosable={false}
width="800px"
destroyOnClose
okText="确认"
cancelText="取消"
{...props}
onOk={() => onSubmit()}
// confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '38rem', overflowY: 'scroll' }}>
<Row>
<Col span={13}>
<Item
label="事件名称"
name="Name"
rules={[
{
required: true,
message: '请输入事件名称',
},
]}
>
<Input style={{ width: '17rem' }} onChange={prefix} placeholder="请输入事件名称" />
</Item>
</Col>
<Col span={11}>
<Item
label="编码前缀"
name="Code"
rules={[
{
required: true,
message: '请输入编码前缀',
},
]}
>
<Input style={{ width: '12rem' }} value={prefixName} placeholder="请输入编码前缀" />
</Item>
</Col>
<Col span={23}>
<Item
label="业务类型"
name="BusinessType"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择业务类型',
},
]}
>
<Select
style={{ width: '580px' }}
placeholder="选择业务类型"
>
{treeData ? treeData.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
</Select>
</Item>
</Col>
<Col span={23}>
<Item
label="事件主表"
name="TableName"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择事件主表',
},
]}
>
<Select
style={{ width: '580px' }}
placeholder="选择事件主表"
onChange={changTable}
>
{standingTable ? standingTable.map((item, index) => { return <Option key={index} value={item.text}>{item.text}</Option> }) : ''}
</Select>
</Item>
</Col>
<Col span={4}>
<Item></Item>
</Col>
<Col span={20}>
<Item><span>客户端上报和配单(需配置事件权限、受理流程)</span></Item>
</Col>
<Col span={4}>
<Item>
</Item>
</Col>
<Col span={4}>
{/* <Item
name="Reportable"
>
<Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
客户端上报和配单(需配置事件权限、受理流程)
</Checkbox>
<CheckboxGroup value={checkedList} onChange={onChange}/>
<CheckboxGroup value={checkedList} onChange={onChange}>
<Checkbox value={'前端'}>前端</Checkbox>
<Checkbox value={'手持'}>手持</Checkbox>
</CheckboxGroup>
</Item>
*/}
{/* <Item
name="Reportable"
> */}
{/* <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
客户端上报和配单(需配置事件权限、受理流程)
</Checkbox> */}
<Item
name="ReportFromWeb"
>
<Checkbox onChange={onChange3} checked={ReportFromWeb} >前端</Checkbox>
</Item>
</Col>
<Col span={16}>
<Item
name="ReportFromMobile"
>
<Checkbox onChange={onChange4} checked={ReportFromMobile}>手持</Checkbox>
</Item>
{/* </Item> */}
</Col>
<Col span={4}>
<Item>
</Item>
</Col>
<Col span={20}>
<Item
name="Editable"
>
<Checkbox onChange={onChange1} checked={editable} >上报后可以编辑(需配置编辑字段)</Checkbox>
</Item>
</Col>
<Col span={23}>
<Item
label="上报方式"
name="CreateMode"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择上报方式',
},
]}
>
<Radio.Group onChange={onChange2} value={value}>
<Radio value={0} style={{ marginLeft: '5px' }}>仅上报</Radio>
<Radio value={1} style={{ marginLeft: '185px' }}>工单分派</Radio>
</Radio.Group>
</Item>
</Col>
<Col span={24}>
<Item
label="摘要字段"
name="SummaryFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择摘要字段" onChange={(e) => changeText(e, 'SummaryFields')} value={inputValue.SummaryFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('SummaryFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="上报字段"
name="ReportFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择上报字段" onChange={(e) => changeText(e, 'ReportFields')} value={inputValue.ReportFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('ReportFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="显示字段"
name="DisplayFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择显示字段" onChange={(e) => changeText(e, 'DisplayFields')} value={inputValue.DisplayFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('DisplayFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="编辑字段"
name="EditableFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择编辑字段" onChange={(e) => changeText(e, 'EditableFields')} value={inputValue.EditableFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('EditableFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="转单字段"
name="TransitFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择转单字段" onChange={(e) => changeText(e, 'TransitFields')} value={inputValue.TransitFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('TransitFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="事件权限"
name="Roles"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择事件权限" onChange={(e) => changeText(e, 'Roles')} value={inputValue.Roles} allowClear />
<Button type="dashed" onClick={() => pickFiled1('Roles')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="置顶条件"
name="TopWhere"
labelCol={{ span: 4 }}
>
<Input style={{ width: '500px' }} placeholder="请输入置顶条件" allowClear />
</Item>
</Col>
<Col span={24}>
<Item
label="上报视图"
name="ReportPage"
labelCol={{ span: 4 }}
>
<Input style={{ width: '500px' }} placeholder="请输入上报视图" allowClear />
</Item>
</Col>
<Col span={24}>
<Item
label="处理视图"
name="DealPage"
labelCol={{ span: 4 }}
>
<Input style={{ width: '500px' }} placeholder="请输入处理视图" allowClear />
</Item>
</Col>
<Col span={24}>
<Item
label="关联事件"
name="RelatedEvents"
labelCol={{ span: 4 }}
>
<Input style={{ width: '500px' }} placeholder="请输入关联事件" allowClear />
</Item>
</Col>
<Col span={24}>
<Item
label="关联字段"
name="RelatedEventFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择关联字段" onChange={(e) => changeText(e, 'RelatedEventFields')} value={inputValue.RelatedEventFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('RelatedEventFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
<Col span={24}>
<Item
label="接口配置"
name="InterfaceConfig"
labelCol={{ span: 4 }}
>
<Input style={{ width: '500px' }} placeholder="请输入接口配置" />
</Item>
</Col>
<Col span={24}>
<Item
label="图片表达"
name="ImageExpression"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem} >
<Input style={{ width: '500px' }} placeholder="请选择图片表达" onChange={(e) => changeText(e, 'pictureFields')} value={inputValue.pictureFields} allowClear />
<Button type="dashed" onClick={() => pickFiled('pictureFields')} icon={<PlusOutlined />} style={{ marginLeft: '0.5rem', height: '100%', width: '3.5rem' }} />
</div>
</Item>
</Col>
</Row>
</Form>
<ChangeAdd
visible={isVisible}
onCancel={() => setIsVisible(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1}
isType={types}
filed={filed}
filed1={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/>
</Modal>
);
};
export default AddModal;
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, notification, Row, Col} from 'antd';
import { CM_Event_OperateEventExtendPage, GetEventExtendPage} from '@/services/standingBook/api';
import { IdcardTwoTone } from '@ant-design/icons';
const AddViewModal = props => {
const { callBackSubmit = () => { }, visible, onCancel, maxLength, title2, obj, type } = props;
const [id, setId]= useState('')
const [form] = Form.useForm();
const { Item } = Form;
const { TextArea } = Input;
const onSubmit = () => {
let aa = title2;
let bb = form.getFieldsValue().WebLabel;
let cc = form.getFieldsValue().WebPage;
let dd = form.getFieldsValue().WebParam;
let ee = form.getFieldsValue().MobileLabel;
let ff = form.getFieldsValue().MobilePage;
let gg = form.getFieldsValue().MobileParam;
if(type=='edit'){
CM_Event_OperateEventExtendPage({
ID: id,
EventName: aa,
WebLabel: bb,
WebPage: cc,
WebParam: dd,
MobileLabel: ee,
MobilePage: ff,
MobileParam: gg,
}).then(res => {
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}else{
CM_Event_OperateEventExtendPage({
ID: 0,
EventName: aa,
WebLabel: bb,
WebPage: cc,
WebParam: dd,
MobileLabel: ee,
MobilePage: ff,
MobileParam: gg,
}).then(res => {
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '添加成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
}
useEffect(() => {
console.log(type)
if(type==='edit'){
GetEventExtendPage({eventExtendPageId:obj}).then(res=>{
console.log(res.data)
form.setFieldsValue({...res.data})
setId(res.data.ID)
})
}else if(type==='add'){
form.resetFields();
}
}, [visible])
return (
<Modal
visible={visible}
onCancel={onCancel}
title={type=='edit' ? '编辑事件辅助视图配置':'添加事件辅助视图配置'}
onOk={() => onSubmit()}
>
<Form form={form} labelCol={{ span: 7 }} style={{ height: '23rem', overflowY: 'scroll' }}>
<Row>
<Col span={23}>
<Item
label="前端标签"
name="WebLabel"
>
<Input style={{ width: '17rem' }} placeholder="请输入前端标签" />
</Item>
</Col>
<Col span={23}>
<Item
label="前端视图"
name="WebPage"
>
<Input style={{ width: '17rem' }} placeholder="请输入前端视图" />
</Item>
</Col>
<Col span={23}>
<Item
label="视图参数"
name="WebParam"
>
<Input style={{ width: '17rem' }} placeholder="请输入视图参数" />
</Item>
</Col>
<Col span={23}>
<Item
label="手持标签"
name="MobileLabel"
>
<Input style={{ width: '17rem' }} placeholder="请输入手持标签" />
</Item>
</Col>
<Col span={23}>
<Item
label="手持视图"
name="MobilePage"
>
<Input style={{ width: '17rem' }} placeholder="请输入手持视图" />
</Item>
</Col>
<Col span={23}>
<Item
label="手持参数"
name="MobileParam"
>
<TextArea style={{ width: '17rem' }} placeholder="请输入手持参数" />
</Item>
</Col>
</Row>
</Form>
</Modal>
)
}
export default AddViewModal;
\ No newline at end of file
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Space, Divider, Radio, Checkbox } from 'antd';
import styles from './incident.less';
import Sortable from 'sortablejs';
const CheckboxGroup = Checkbox.Group;
const ChangeAddFlows = props =>{
const { callBackSubmit = () => { }, pickItem, visible, filed1, characterValue, newCheckedList } = props;
const [loading, setLoading] = useState(false);
const [value, setValue] = useState('');
const [checkValue, setCheckValue] = useState([]);
const [form] = Form.useForm();
const [title, setTitle] = useState([])
const { Item } = Form;
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容
const [indeterminate, setIndeterminate] = useState([]);
const [checkAll, setCheckAll] = useState([]);
const [selectData, setSelectData] = useState([])
let objArr = []
const onChangeList1 = (list, index, title) => {
const checkedListArr = [...checkedList]
checkedListArr[index] = list
setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
indeterminateArr[index] = !!list.length && list.length < filed1[title].length
checkAllArr[index] = list.length === filed1[title].length
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr);
};
const onSubmit = () => {
console.log(selectData.join(","))
console.log(pickItem)
console.log(checkedList)
callBackSubmit({ checkedList, str: selectData.join(","), pickItem });
}
const onCheckAllChange = e => {
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
const checkedListArr = [...checkedList]
checkAllArr[e.target.index] = e.target.checked
indeterminateArr[e.target.index] = false
e.target.checked ? checkedListArr[e.target.index] = e.target.checkvalue : checkedListArr[e.target.index] = []
setCheckedList(checkedListArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
};
useEffect(() => {
selectAll()
}, [checkedList]);
const selectAll = () => {
objArr = []
checkedList.map(item => {
objArr = objArr.concat(item)
})
setSelectData(objArr)
}
useEffect(() => {
console.log(characterValue)
console.log(pickItem)
console.log(filed1)
let arr = Object.keys(filed1)
console.log(arr, 'arr')
setTitle(arr)
let checkArr = []
let indeterminateArr = []
let checkAllArr = []
console.log(newCheckedList);
arr.map((item, index) => {
checkArr[index] = []
newCheckedList.map(checkItem => {
if (filed1[item].includes(checkItem)) {
checkArr[index].push(checkItem)
}
})
indeterminateArr.push(!!checkArr[index].length && checkArr[index].length < filed1[item].length)
checkAllArr.push(checkArr[index].length === filed1[item].length)
})
console.log(checkArr)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
draftSort()
}, [visible]);
//拖拽初始化及逻辑
const draftSort = () => {
let el = document.getElementById('doctor-drag-items');
if (el) {
let sortable = Sortable.create(el, {
animation: 100, //动画参数
onEnd: function (evt) { //拖拽完毕之后发生,只需关注该事件
let arr = [];
let len = evt.from.children.length;
for (let i = 0; i < len; i++) {
arr.push(evt.from.children[i].getAttribute('drag-id'))
}
setSelectData(arr)
}
});
}
}
return (
<Modal
title='部门或角色'
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="700px"
destroyOnClose
centered={true}
maskClosable={false}
onOk={onSubmit}
okText="确认"
cancelText="取消"
{...props}
onOk={() => onSubmit()}
forceRender={true}
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>待选字段列表</Divider>
<div className={styles.cardContent}>
{title.map((item, index) => {
return <div className={styles.cardItemData} key={index}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>{item} <Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed1[item]} checked={checkAll[index]}> </Checkbox></Divider>
<CheckboxGroup options={filed1[item]} value={checkedList[index]} onChange={(e) => onChangeList1(e, index, item)} /></div>
})}
</div>
</div>
<div className={styles.cardItem}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>已选字段列表</Divider>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<table>
<thead>
<tr>
<td>字段名</td>
</tr>
</thead>
<tbody id='doctor-drag-items'>
{selectData && selectData.length > 0 ?
selectData.map((item, index) => {
return <tr drag-id={item} key={index} style={{ cursor: 'move' }}>
<td><span title={item}>{item}</span></td>
</tr>
})
: <tr><td colSpan='10' style={{ textAlign: 'center' }}>暂无数据</td></tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
)
}
</Modal>
)
};
export default ChangeAddFlows;
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Form, Modal, Table, Input, Select, Tooltip, Button, notification, Image, Menu, Dropdown, Space, Popconfirm } from 'antd';
import {
DoubleLeftOutlined,
DoubleRightOutlined,
PlusSquareFilled,
RightOutlined,
EditTwoTone,
DeleteOutlined,
OrderedListOutlined,
ApartmentOutlined,
DesktopOutlined
} from '@ant-design/icons';
import styles from './incident.less';
import { GetCM_Event_LoadEvenFlows, CM_Event_RemoveEvenFlow } from '@/services/standingBook/api';
import AddFlowsModal from './AddFlowsModal'
const ProcessModal = props => {
const { callBackSubmit = () => { }, title1, visible, onCancel, formObj, maxLength} = props;
const [tableData, setTableData] = useState([])
const [addVisible, setAddVisible] = useState(false)
const [isType, setIsType] = useState(''); // 弹窗类型
const [record1, setRecord1] = useState('')
const [obj, setObj] = useState('')
const columns = [
{
title: '流程名称',
dataIndex: 'FlowName',
key: 'FlowName',
width: 150,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
}
,
{
title: '受理权限',
dataIndex: 'FlowRoles',
key: 'FlowRoles',
width: 500,
ellipsis: true,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
},
{
title: '操作',
key: 'action',
aligin: 'center',
render: record => (
<Space size="middle">
<Tooltip title="编辑用户">
<EditTwoTone
onClick={() => editEventType(record)}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<Tooltip title="删除">
<Popconfirm
placement="bottomRight"
title={
<p>
即将删除事件流程,是否确认删除?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => deleteEventType(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
)
}
]
useEffect(() => {
GetCM_Event_LoadEvenFlows({ eventTypeId: formObj.ID }).then(res => {
if (res.msg === 'Ok') {
console.log(res.data)
setTableData(res.data)
}
})
},[visible])
const addIncident = () => {
console.log(formObj.ID)
setObj(formObj.ID)
setAddVisible(true)
setIsType('add')
}
const editEventType = record => {
setObj(formObj.ID)
setRecord1(record)
setIsType('edit');
setAddVisible(true)
}
const deleteEventType = record => {
console.log(record)
CM_Event_RemoveEvenFlow({ eventFlowIds: record.ID }).then(res=>{
if (res.msg === '') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
GetCM_Event_LoadEvenFlows({ eventTypeId: formObj.ID }).then(res => {
if (res.msg === 'Ok') {
console.log(res.data)
setTableData(res.data)
}
})
}
const onOK = () => {
setAddVisible(false)
GetCM_Event_LoadEvenFlows({ eventTypeId: formObj.ID }).then(res => {
if (res.msg === 'Ok') {
console.log(res.data)
setTableData(res.data)
}
})
}
const onSumbit = () => {
callBackSubmit()
}
return (
<Modal
title={`${title1}受理流程和权限`}
visible={visible}
width="800px"
onCancel={onCancel}
onOk={onSumbit}
>
<Tooltip title="添加事件类型">
<PlusSquareFilled
onClick={() => addIncident()}
style={{
color: '#1890FF',
fontSize: '25px',
verticalAlign: 'middle',
}}
/>
</Tooltip>
<Table
size="small"
rowKey='ID'
bordered
onRow={record => {
return {
onDoubleClick: event => {event.stopPropagation(); editEventType(record)}, //双击
};
}}
columns={columns}
dataSource={tableData}
scroll={{ x: 'max-content', y: 'calc(100vh - 150px)' }}
/>
<AddFlowsModal
visible={addVisible}
obj={obj}
formObj={formObj}
type={isType}
record={record1}
maxLength={maxLength}
onCancel={() => setAddVisible(false)}
callBackSubmit={onOK}
/>
</Modal>
)
}
export default ProcessModal;
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Modal } from 'antd';
import styles from './incident.less';
import Sortable from 'sortablejs';
const SortModal = props => {
const {callBackSubmit = () => { }, title, visible, onCancel, sortData1 } = props;
const [drag, setDrag] = useState([])
useEffect(()=>{
draftSort()
},[visible])
const onSumbit = () => {
callBackSubmit({str: drag});
}
//拖拽初始化及逻辑
const draftSort = () => {
let el = document.getElementById('doctor-drag-items');
if (el) {
let sortable = Sortable.create(el, {
animation: 100, //动画参数
onEnd: function (evt) { //拖拽完毕之后发生,只需关注该事件
let arr = [];
let len = evt.from.children.length;
for (let i = 0; i < len; i++) {
console.log(i)
arr.push(evt.from.children[i].getAttribute('drag-id'))
}
console.log(arr)
setDrag(arr)
}
});
}
}
return (
<Modal
title={title}
visible={visible}
onCancel={onCancel}
onOk={onSumbit}
okText="确认"
cancelText="取消"
>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<table>
<thead>
<tr>
<td>事件名称</td>
</tr>
</thead>
<tbody id='doctor-drag-items'>
{
sortData1.map((item, index) => {
return <tr drag-id={item.ID} key={item.ID} style={{ cursor: 'move' }}>
<td><span title={item.name}>{item.name}</span></td>
</tr>
})
}
</tbody>
</table>
</div>
</div>
</Modal>
)
}
export default SortModal;
\ No newline at end of file
import React, { useEffect, useState } from 'react';
import { Form, Modal, Table, Input, Select, Tooltip, Button, notification, Image, Menu, Dropdown, Space, Popconfirm } from 'antd';
import { CM_Event_ReloadEventExtendPages, CM_Event_RemoveEventExtendPage } from '@/services/standingBook/api';
import {
PlusSquareFilled,
EditTwoTone,
DeleteOutlined,
} from '@ant-design/icons';
import AddViewModal from './AddViewModal'
import { set } from 'immutable';
const ViewModal = props => {
const { callBackSubmit = () => { }, visible, onCancel, formObj, title2} = props;
const [tableData, setTableData] = useState([])
const [addViewVisible, setAddViewVisible] = useState(false)
const [flag,setFlag] = useState(0)
const [obj,setObj] = useState('')
const [type,setType] = useState('')
const columns = [
{
title: '视图标签',
dataIndex: 'WebLabel',
key: 'WebLabel',
width: 150,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
}
,
{
title: '视图模块',
dataIndex: 'WebPage',
key: 'WebPage',
width: 150,
ellipsis: true,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
},
{
title: '视图参数',
dataIndex: 'WebParam',
key: 'WebParam',
width: 150,
ellipsis: true,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
},
,
{
title: '手持视图标签',
dataIndex: 'MobileLabel',
key: 'MobileLabel',
width: 150,
ellipsis: true,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
},
{
title: '手持视图模块',
dataIndex: 'MobilePage',
key: 'MobilePage',
width: 150,
ellipsis: true,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
},
,
{
title: '手持视图参数',
dataIndex: 'MobileParam',
key: 'MobileParam',
width: 150,
ellipsis: true,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
},
{
title: '操作',
key: 'action',
aligin: 'center',
width: 150,
render: record => (
<Space size="middle">
<Tooltip title="编辑用户">
<EditTwoTone
onClick={() => editView(record)}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<Tooltip title="删除">
<Popconfirm
placement="bottomRight"
title={
<p>
即将删除事件处理流程,是否确认删除?
</p>
}
okText="确认"
cancelText="取消"
onConfirm={() => deleteView(record)}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</Space>
)
}
]
useEffect(()=>{
console.log(formObj)
CM_Event_ReloadEventExtendPages({eventName:formObj.name}).then(res=>{
if (res.msg === 'Ok'||res.msg==='') {
console.log(res.data)
setTableData(res.data)
}
})
},[visible,flag])
const onSumbit =()=>{
}
const addView=()=>{
setType('add')
setAddViewVisible(true)
}
const editView = record =>{
setType('edit')
setAddViewVisible(true)
setObj(record.ID)
}
const deleteView= record =>{
console.log(record)
CM_Event_RemoveEventExtendPage({eventExtendId:record.ID}).then(res=>{
if (res.msg === '') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
const okk =()=>{
setAddViewVisible(false)
setFlag(flag+1)
}
return(
<Modal
title={`${title2}的辅助视图`}
visible={visible}
onCancel={onCancel}
width="1300px"
onOk={onSumbit}
>
<Tooltip title="添加">
<PlusSquareFilled
onClick={() => addView()}
style={{
color: '#1890FF',
fontSize: '25px',
verticalAlign: 'middle',
}}
/>
</Tooltip>
<Table
size="small"
rowKey='ID'
bordered
onRow={record => {
return {
onDoubleClick: event => {event.stopPropagation(); editView(record)}, //双击
};
}}
columns={columns}
dataSource={tableData}
scroll={{ x: 'max-content', y: 'calc(100vh - 150px)' }}
/>
<AddViewModal
visible={addViewVisible}
title="事件辅助视图配置"
onCancel={()=>setAddViewVisible(false)}
title2={title2}
callBackSubmit={okk}
obj={obj}
type={type}
/>
</Modal>
)
}
export default ViewModal;
\ No newline at end of file
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Space, Divider, Radio, Checkbox } from 'antd';
import styles from './incident.less';
import Sortable from 'sortablejs';
const CheckboxGroup = Checkbox.Group;
const AddModal = props => {
const { callBackSubmit = () => { }, isType, pickItem, visible, filed, filed1, characterValue, newCheckedList } = props;
const [loading, setLoading] = useState(false);
const [value, setValue] = useState('');
const [checkValue, setCheckValue] = useState([]);
const [form] = Form.useForm();
const [title, setTitle] = useState([])
const { Item } = Form;
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容
const [indeterminate, setIndeterminate] = useState([]);
const [checkAll, setCheckAll] = useState([]);
const [selectData, setSelectData] = useState([])
let objArr = []
const onChangeList = (list, index, title) => {
const checkedListArr = [...checkedList]
checkedListArr[index] = list
setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
indeterminateArr[index] = !!list.length && list.length < filed[title].length
checkAllArr[index] = list.length === filed[title].length
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr);
};
const onChangeList1 = (list, index, title) => {
const checkedListArr = [...checkedList]
checkedListArr[index] = list
setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
indeterminateArr[index] = !!list.length && list.length < filed1[title].length
checkAllArr[index] = list.length === filed1[title].length
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr);
};
const onSubmit = () => {
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(","), pickItem });
}
const onCheckAllChange = e => {
const indeterminateArr = [...indeterminate]
const checkAllArr = [...checkAll]
const checkedListArr = [...checkedList]
checkAllArr[e.target.index] = e.target.checked
indeterminateArr[e.target.index] = false
e.target.checked ? checkedListArr[e.target.index] = e.target.checkvalue : checkedListArr[e.target.index] = []
setCheckedList(checkedListArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
};
useEffect(() => {
selectAll()
}, [checkedList]);
const selectAll = () => {
objArr = []
checkedList.map(item => {
objArr = objArr.concat(item)
})
setSelectData(objArr)
}
useEffect(() => {
if (isType != ''&&isType==='add') {
let arr = Object.keys(filed)
console.log(arr, 'arr')
setTitle(arr)
let checkArr = []
let indeterminateArr = []
let checkAllArr = []
console.log(newCheckedList);
arr.map((item, index) => {
checkArr[index] = []
newCheckedList.map(checkItem => {
if (filed[item].includes(checkItem)) {
checkArr[index].push(checkItem)
}
})
indeterminateArr.push(!!checkArr[index].length && checkArr[index].length < filed[item].length)
checkAllArr.push(checkArr[index].length === filed[item].length)
})
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
draftSort()
}else if(isType==='app'){
console.log(filed1)
let arr = Object.keys(filed1)
console.log(arr, 'arr')
setTitle(arr)
let checkArr = []
let indeterminateArr = []
let checkAllArr = []
console.log(newCheckedList);
arr.map((item, index) => {
checkArr[index] = []
newCheckedList.map(checkItem => {
if (filed1[item].includes(checkItem)) {
checkArr[index].push(checkItem)
}
})
indeterminateArr.push(!!checkArr[index].length && checkArr[index].length < filed1[item].length)
checkAllArr.push(checkArr[index].length === filed1[item].length)
})
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
draftSort()
}
}, [visible]);
//拖拽初始化及逻辑
const draftSort = () => {
let el = document.getElementById('doctor-drag-items');
if (el) {
let sortable = Sortable.create(el, {
animation: 100, //动画参数
onEnd: function (evt) { //拖拽完毕之后发生,只需关注该事件
let arr = [];
let len = evt.from.children.length;
for (let i = 0; i < len; i++) {
arr.push(evt.from.children[i].getAttribute('drag-id'))
}
setSelectData(arr)
}
});
}
}
if(isType != 'app'){
return (
<Modal
title={isType === 'app' ? '部门或角色' : '字段集选择'}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="700px"
destroyOnClose
centered={true}
maskClosable={false}
onOk={onSubmit}
okText="确认"
cancelText="取消"
{...props}
onOk={() => onSubmit()}
forceRender={true}
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>待选字段列表</Divider>
<div className={styles.cardContent}>
{title.map((item, index) => {
return <div className={styles.cardItemData} key={index}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>{item} <Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed[item]} checked={checkAll[index]}> </Checkbox></Divider>
<CheckboxGroup options={filed[item]} value={checkedList[index]} onChange={(e) => onChangeList(e, index, item)} /></div>
})}
</div>
</div>
<div className={styles.cardItem}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>已选字段列表</Divider>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<table>
<thead>
<tr>
<td>字段名</td>
</tr>
</thead>
<tbody id='doctor-drag-items'>
{selectData && selectData.length > 0 ?
selectData.map((item, index) => {
return <tr drag-id={item} key={index} style={{ cursor: 'move' }}>
<td><span title={item}>{item}</span></td>
</tr>
})
: <tr><td colSpan='10' style={{ textAlign: 'center' }}>暂无数据</td></tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
)
}
</Modal>
);
}else if(isType ==='app'){
return (
<Modal
title={isType === 'app' ? '部门或角色' : '字段集选择'}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="700px"
destroyOnClose
centered={true}
maskClosable={false}
onOk={onSubmit}
okText="确认"
cancelText="取消"
{...props}
onOk={() => onSubmit()}
forceRender={true}
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>待选字段列表</Divider>
<div className={styles.cardContent}>
{title.map((item, index) => {
return <div className={styles.cardItemData} key={index}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>{item} <Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed1[item]} checked={checkAll[index]}> </Checkbox></Divider>
<CheckboxGroup options={filed1[item]} value={checkedList[index]} onChange={(e) => onChangeList1(e, index, item)} /></div>
})}
</div>
</div>
<div className={styles.cardItem}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>已选字段列表</Divider>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<table>
<thead>
<tr>
<td>字段名</td>
</tr>
</thead>
<tbody id='doctor-drag-items'>
{selectData && selectData.length > 0 ?
selectData.map((item, index) => {
return <tr drag-id={item} key={index} style={{ cursor: 'move' }}>
<td><span title={item}>{item}</span></td>
</tr>
})
: <tr><td colSpan='10' style={{ textAlign: 'center' }}>暂无数据</td></tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>
)
}
</Modal>
);
}
};
export default AddModal;
\ No newline at end of file
......@@ -24,97 +24,201 @@ import {
ApartmentOutlined,
DesktopOutlined
} from '@ant-design/icons';
import {GetCM_Event_LoadEventTable, CM_Event_RemoveEventTable, CM_Event_ReOrder} from '@/services/standingBook/api';
import classnames from 'classnames';
import AddModal from './AddModal'
import ProcessModal from './ProcessModal'
import SortModal from './SortModal'
import ViewModal from './ViewModal'
const incident = () => {
const [treeLoading, setTreeLoading] = useState(false);
const [tableLoading, setTableLoading] = useState(false);
const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见
const [treeData, setTreeData] = useState([]); // 事件表数据
const [tableData, setTableData] = useState([]); // 事件表
const [addVisible, setAddvisible] = useState(false);
const [processVisible, setProcessVisible] = useState(false);
const [sortVisible, setSortVisible] = useState(false);
const [viewVisible, setViewVisible] = useState(false)
const [isType, setIsType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState('');
const [flag, setFlag] = useState(0);
const [title1, setTitle1] = useState('')
const [title2, setTitle2] = useState('')
const [sortData,setSortData] = useState([])
const [maxLength, setMaxLength] = useState(0);
const [pickItem, setPickItem] = useState('');
// const setRowClassName = record =>
// record.userID === selectColor.userID ? styles.clickRowStyle : '';
const columns = [
{
title: '事件名称',
dataIndex: 'name',
key: 'name',
width: 150,
},
{
title: '事件主表'
title: '事件主表',
dataIndex: 'tableName',
key: 'tableName',
width: 150,
ellipsis: true,
textWrap: 'word-break'
}
,
{
title: '编码'
title: '编码',
dataIndex: 'code',
key: 'code',
width: 50,
}
,
{
title: '摘要字段'
title: '摘要字段',
dataIndex: 'summaryFields',
key: 'summaryFields',
width: 100,
ellipsis: true
}
,
{
title: '权限'
title: '权限',
dataIndex: 'roles',
key: 'roles',
width: 50,
}
,
{
title: '流程'
title: '流程',
dataIndex: 'flowCount',
key: 'flowCount',
width: 50,
}
,
{
title: '上报'
title: '上报',
dataIndex: 'reportable',
key: 'reportable',
width: 50,
}
,
{
title: '上报字段'
title: '上报字段',
dataIndex: 'reportPage',
key: 'reportPage',
width: 100,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
,
{
title: '显示字段'
}}
/>
),
}
,
{
title: '编辑',
render: record => {
if (!record) {
return '-';
title: '显示字段',
dataIndex: 'displayFields',
key: 'displayFields',
width: 100,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
return record;
},
}}
/>
),
}
,
{
title: '编辑字段'
title: '编辑',
dataIndex: 'editable',
key: 'editable',
width: 50,
render: item =>(
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
,
{
title: '上报方式'
}}
/>
)
}
,
{
title: '置顶条件',
render: record => {
if (!record) {
return '-';
title: '编辑字段',
dataIndex: 'editableFields',
key: 'editableFields',
width: 100,
render: item =>(
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
return record;
},
}}
/>
)
}
,
{
title: '接口配置',
render: record => {
if (!record) {
return '-';
}
return record;
},
title: '上报方式',
dataIndex: 'createMode',
key: 'createMode',
width: 100,
}
,
// {
// title: '置顶条件',
// dataIndex: 'topWhere',
// key: 'topWhere',
// width: 100,
// render: item =>(
// <div
// ref={r => {
// if (r) {
// r.innerHTML = item;
// }
// }}
// />
// )
// }
// ,
// {
// title: '接口配置',
// dataIndex: 'interfaceConfig',
// key: 'interfaceConfig',
// width: 100,
// render: item =>(
// <div
// ref={r => {
// if (r) {
// r.innerHTML = item;
// }
// }}
// />
// )
// },
{
title: '操作',
key: 'action',
aligin: 'center',
render: record => {
render: record => (
<Space size="middle">
<Tooltip title="编辑用户">
<EditTwoTone
onClick={() => editEventType(record)}
......@@ -126,11 +230,7 @@ const incident = () => {
placement="bottomRight"
title={
<p>
即将删除事件类型{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
,是否确认删除?
即将删除事件类型表,是否确认删除?
</p>
}
okText="确认"
......@@ -140,34 +240,187 @@ const incident = () => {
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
<Tooltip title="受理流程">
<ApartmentOutlined
onClick={() => process(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
<Tooltip title="辅助视图">
<DesktopOutlined
onClick={() => auxiliaryView(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
</Space>
}
)
}
]
useEffect(()=>{
GetCM_Event_LoadEventTable().then(res =>{
if(res.msg==='Ok'){
console.log(res.data)
// setMaxLength(res.data.root.length + 1)
let arr = formateArrDataA(res.data, 'businessType')
console.log(arr)
let newArr = []
let newapp = []
let newabb = []
let aa= []
let zz = []
Object.keys(arr).map((item, index) => {
newArr.push(item)
})
console.log(arr)
Object.values(arr).map((item, index) => {
newapp.push(item)
})
console.log(newapp)
newapp.map((item, index)=>{
console.log(item)
item.map((item1, index)=>{
newabb.push(item1.root)
console.log(item1.root)
})
})
console.log(newabb)
newabb.map((item, index)=>{
console.log(item)
aa.push(item)
})
console.log(aa)
aa.map((item, index)=>{
console.log(item)
item.map((item1, index)=>{
console.log(item1)
zz.push({...item1})
})
})
console.log(zz)
let arrr = formateArrDataA(zz, 'businessType')
console.log(arrr)
setTableData(arrr)
setPickItem(newArr[0])
console.log(newArr, 'newArr');
setTreeData(newArr)
}
})
},[flag])
const formateArrDataA = (initialArr, name) => {
console.log(initialArr)
console.log(name)
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
}
//先获取一下这个数组中有多少个"name"
let nameArr = []
for (let i in initialArr) {
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
nameArr.push(initialArr[i][`${name}`])
}
}
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(initialArr[j])
}
}
}
for (let keys in tempObj) {
let arr = []
tempObj[keys].map((item, index) => {
tempObj[keys] = arr;
item.key = index
arr.push(item)
})
}
return tempObj
}
//添加事件
const addIncident = () => {
setAddvisible(true)
setIsType('add')
}
//修改事件类型
const editEventType = () =>{
const editEventType = record => {
setFormObj(record);
setIsType('edit');
setAddvisible(true);
}
//删除事件类型
const deleteEventType = () =>{
const deleteEventType = record => {
CM_Event_RemoveEventTable(record.ID).then(res =>{
if (res.msg === '') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
const onSelect = () => {
})
}
const sort = () => {
setSortVisible(true);
console.log(tableData)
console.log(pickItem)
console.log(tableData[pickItem])
setSortData(tableData[pickItem])
}
const process = () => {
const process = record => {
setProcessVisible(true);
setFormObj(record);
setTitle1(record.name)
}
const auxiliaryView = () => {
const auxiliaryView = record => {
setFormObj(record);
setViewVisible(true)
setTitle2(record.name)
}
const onSubmit =()=>{
setAddvisible(false)
setFlag(flag + 1)
}
const onOK = prop =>{
setSortVisible(false)
let aa= (prop.str).toString()
console.log(aa)
CM_Event_ReOrder(aa).then(res =>{
if (res.msg === 'Ok') {
notification.success({
message: '提示',
duration: 3,
description: '调整成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
const onOK1 =()=>{
setProcessVisible(false)
}
return (
<div className={styles.incidentContainer}>
......@@ -185,7 +438,7 @@ const incident = () => {
style={{
fontSize: '15px ',
fontWeight: 'bold',
marginLeft: '15px'
}}
>
事件列表
......@@ -197,20 +450,19 @@ const incident = () => {
color: '#1890FF',
fontSize: '25px',
verticalAlign: 'middle',
marginLeft: '60%'
marginLeft: '58%'
}}
/>
</Tooltip>
<hr style={{ width: '95%', color: '#eeecec', marginLeft: '15px' }} />
<Tree
onSelect={onSelect}
height={
treeData.length && treeData.length > 30
? treeData.length * 15 + 30
: 1000
}
/>
<hr style={{ width: '100%', color: '#eeecec' }} />
{
treeData.length>0 && (treeData.map((item, index) => {
return <div className={classnames({
[styles.listItem]: true,
[styles.pickItem]: item === pickItem,
})} onClick={e => setPickItem(item)} key={index}>{item}{tableData[item] ? tableData[item].length : ''}{item === pickItem ? <RightOutlined /> : ''} </div>
})
)}
</div>
<div className={styles.switcher}>
{treeVisible && (
......@@ -238,23 +490,23 @@ const incident = () => {
<Button icon={<OrderedListOutlined className={styles.icon} />} onClick={sort} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '10px' }}>
调序
</Button>
<Button icon={<ApartmentOutlined className={styles.icon} />} onClick={process} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '10px' }}>
受理流程
</Button>
<Button icon={<DesktopOutlined className={styles.icon} />} onClick={auxiliaryView} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '10px' }}>
辅助视图
</Button>
</span>
</div>
<Table
// rowClassName={setRowClassName}
size="small"
// rowKey={}
rowKey='ID'
bordered
onRow={record => {
return {
onDoubleClick: event => {event.stopPropagation(); editEventType(record)}, //双击
};
}}
columns={columns}
dataSource={tableData}
dataSource={tableData[pickItem]}
loading={tableLoading}
scroll={{ x: 'max-content', y: 'calc(100vh - 210px)' }}
scroll={{ x: 'max-content', y: 'calc(100vh - 155px)' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
......@@ -264,9 +516,44 @@ const incident = () => {
showSizeChanger: true,
}}
/>
</div>
{/* Modal弹框 */}
{/* 添加事件 */}
<AddModal
visible={addVisible}
type={isType}
formObj={formObj}
maxLength={maxLength}
onCancel={() => setAddvisible(false)}
treeData={treeData}
callBackSubmit={onSubmit}
/>
<ProcessModal
visible={processVisible}
formObj={formObj}
title1={title1}
maxLength={maxLength}
onCancel={() => setProcessVisible(false)}
callBackSubmit={onOK1}
/>
<SortModal
title="调整顺序"
visible={sortVisible}
sortData1={sortData}
pickItem={pickItem}
onCancel={() => setSortVisible(false)}
callBackSubmit={onOK}
/>
<ViewModal
formObj={formObj}
visible={viewVisible}
onCancel={() => setViewVisible(false)}
title2={title2}
/>
</div>
</div>
)
};
......
.incidentContainer{
.ant-card-body {
padding: 12px 24px 24px 24px;
}
.listItem{
display: flex;
justify-content: space-between;
font-size: 14px;
font-weight: 400;
color: #414E65;
cursor: pointer;
line-height: 28px;
align-items: center;
padding: 8px 14px;
}
.pickItem{
background-color: #F5F6F9;
}
.contentContainers{
display: flex;
width: 100%;
position: relative;
.ant-table.ant-table-bordered > .ant-table-container {
min-width: calc(100vw - 582px);
height: calc(100vh - 120px);
height: calc(100vh - 166px);
overflow-x: hidden;
border: none;
}
.orgContainer{
height: calc(100vh - 74px);
width: 280px;
width: 250px;
left: 0;
top: 0;
overflow-x: hidden;
......@@ -116,3 +133,66 @@
vertical-align: text-bottom;
}
}
.formData{
height: 38rem;
overflow-y: scroll;
.ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before{
display: none;
}
.formData_label{
display: flex;
align-items: center;
}
.filed_listItem{
display: flex;
height: 3.6rem;
.ant-btn-icon-only {
width: 32px;
height: 32px;
/* padding: 2.4px 0; */
font-size: 16px;
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.listCard{
display: flex;
.cardItem{
padding: 0.5rem;
}
.cardContent{
height: 30rem;
overflow-y: scroll;
width: 19.5rem;
}
.cardItemData{
padding: 1rem;
border: 1px solid #b5b8c8;
margin-bottom: 1rem;
}
}
.doctorTable {
margin-bottom: 16px;
table {
width: 100%;
td {
padding: 6px;
border: 1px solid #e8e8e8;
}
thead {
tr {
font-weight: 600;
background: #FAFAFA;
}
}
tbody{
tr:hover{
background-color:#ededed ;
}
}
}
}
\ No newline at end of file
......@@ -60,6 +60,9 @@ const AddModal = props => {
useEffect(() => {
if (isType != '') {
let arr = Object.keys(filed)
console.log(arr)
console.log(newCheckedList)
console.log(characterValue)
setTitle(arr)
let checkArr = []
let indeterminateArr = []
......@@ -74,6 +77,7 @@ const AddModal = props => {
indeterminateArr.push(!!checkArr[index].length && checkArr[index].length < filed[item].length)
checkAllArr.push(checkArr[index].length === filed[item].length)
})
console.log(checkArr)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
......
......@@ -147,6 +147,7 @@ const AddModal = props => {
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
console.log(initialArr)
for (let k in nameArr) {
for (let j in initialArr) {
if (initialArr[j][`${name}`] == nameArr[k]) {
......@@ -156,6 +157,7 @@ const AddModal = props => {
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
......
......@@ -154,12 +154,14 @@ const standingBook = props => {
GetCM_Ledger_LoadLedgers().then(res => {
setTreeLoading(false);
if (res.msg === 'Ok' && res.data.root) {
console.log(res.data.root)
setMaxLength(res.data.root.length + 1)
let arr = formateArrDataA(res.data.root, 'type')
let newArr = []
Object.keys(arr).map((item, index) => {
newArr.push(item)
})
console.log(arr)
setAllData(arr);
setPickItem(newArr[0])
console.log(newArr, 'newArr');
......@@ -169,6 +171,8 @@ const standingBook = props => {
}, [flag]);
const formateArrDataA = (initialArr, name) => {
console.log(initialArr)
console.log(name)
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组'
......
......@@ -472,6 +472,7 @@ const UserManage = () => {
.then(newres => {
if (newres.code === 0) {
let res = newres.data;
console.log(res)
setTreeLoading(false);
setTreeData(res);
setTreeDataCopy(res);
......
/*
* @Description:
* @Author: leizhe
* @Date: 2021-07-23 10:42:58
* @LastEditTime: 2021-09-01 10:50:55
* @LastEditors: leizhe
*/
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
// 加载台账
......@@ -20,3 +27,76 @@ post(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCMLedger_OperateLedger`, data);
// 删除台账
export const CM_Ledger_RmoveLedger = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Ledger_RmoveLedger`, query);
// 加载事件
export const GetCM_Event_LoadEventTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Event_LoadEventTable`, query);
// 加载事件主表
export const GetCM_Event_LoadEventTypeTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Event_LoadEventTypeTable`, query);
//根据触发事件加载字段
export const LoadEventFields = query =>
get(`${PUBLISH_SERVICE}/CaseManage/LoadEventFields`, query);
// 加载事件权限部门角色
export const CM_Event_LoadDepartmentAndRoles = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_LoadDepartmentAndRoles`, query);
// 修改事件类型
export const CM_Event_EditEventTable = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_EditEventTable`, data);
// 加载事件权限部门角色
export const GetCM_Event_QueryEventType = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Event_QueryEventType`, query);
// 添加事件类型表
export const CM_Event_AddEventTable = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_AddEventTable`, data);
// 删除事件类型表
export const CM_Event_RemoveEventTable = eventTypeIDs =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_RemoveEventTable?eventTypeIDs=${eventTypeIDs}`);
// 事件类型调序
export const CM_Event_ReOrder = eventTypeIDs =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_ReOrder?eventTypeIDs=${eventTypeIDs}`);
// 点击受理流程之后加载受理流程和权限,显示字段为FlowName,FlowRoles
export const GetCM_Event_LoadEvenFlows = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Event_LoadEvenFlows`, query);
// 点击添加之后加载受理流程集
export const CM_Event_ReloadFlows = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_ReloadFlows`, query);
// 添加受理流程
export const CM_Event_AddEvenFlow = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_AddEvenFlow`, query);
// 编辑受理流程
export const CM_Event_EditEvenFlow = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_EditEvenFlow`, query);
// 删除受理流程
export const CM_Event_RemoveEvenFlow = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_RemoveEvenFlow`, query);
// 加载事件辅助视图配置信息
export const CM_Event_ReloadEventExtendPages = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_ReloadEventExtendPages`, query);
// 添加或修改事件辅助视图配置
export const CM_Event_OperateEventExtendPage = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_OperateEventExtendPage`, data);
// 查询事件辅助视图配置信息
export const GetEventExtendPage = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetEventExtendPage`, query);
// 删除事件辅助视图配置
export const CM_Event_RemoveEventExtendPage = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_RemoveEventExtendPage`, query);
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