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

修改事件权限交互

parent aec5ad02
Pipeline #39087 skipped with stages
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable camelcase */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './maintenance.less' import { Space, Table, Popconfirm, Tooltip, Button, notification } from 'antd';
import { import {
Space, CM_XWBPlan_DataList,
Table, CM_XWBPlan_RemovePlan,
Popconfirm, } from '@/services/maintenance/api';
Tooltip, import { EditTwoTone, DeleteOutlined, PlusOutlined } from '@ant-design/icons';
Button, import styles from './maintenance.less';
notification import AddModal from './AddModal';
} from 'antd';
import {CM_XWBPlan_DataList, CM_XWBPlan_RemovePlan} from '@/services/maintenance/api';
import {
EditTwoTone,
DeleteOutlined,
PlusOutlined
} from '@ant-design/icons';
import AddModal from './AddModal'
const maintenance = () => { const maintenance = () => {
const [addVisible, setAddVisible] = useState(false) const [addVisible, setAddVisible] = useState(false);
const [type, setType] = useState('') const [type, setType] = useState('');
const [formObj, setFormObj] = useState('') const [formObj, setFormObj] = useState('');
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [flag, setFlag] = useState(0); const [flag, setFlag] = useState(0);
const [tableData, setTableData] = useState([]) const [tableData, setTableData] = useState([]);
const columns = [ const columns = [
{ {
title: '业务名称', title: '业务名称',
dataIndex: 'businessName', dataIndex: 'businessName',
key: 'businessName', key: 'businessName',
width: 100, width: 100,
align:'center', align: 'center',
}, },
{ {
title: '业务类型', title: '业务类型',
dataIndex: 'businessType', dataIndex: 'businessType',
key: 'businessType', key: 'businessType',
width: 100, width: 100,
ellipsis: true, ellipsis: true,
align:'center', align: 'center',
}, },
{ {
title: '执行周期', title: '执行周期',
dataIndex: 'docycle', dataIndex: 'docycle',
key: 'docycle', key: 'docycle',
width: 100, width: 100,
align:'center', align: 'center',
}, },
{ {
title: '台账名称', title: '台账名称',
dataIndex: 'accountName', dataIndex: 'accountName',
key: 'accountName', key: 'accountName',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
align:'center', align: 'center',
}, },
{ {
title: '反馈名称', title: '反馈名称',
dataIndex: 'feedbackName', dataIndex: 'feedbackName',
key: 'feedbackName', key: 'feedbackName',
width: 200, width: 200,
align:'center', align: 'center',
}, },
{ {
title: '台账过滤条件', title: '台账过滤条件',
dataIndex: 'filterCondition', dataIndex: 'filterCondition',
key: 'filterCondition', key: 'filterCondition',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
align:'center', align: 'center',
}, },
{ {
title: '是否送审', title: '是否送审',
dataIndex: 'isSubmit', dataIndex: 'isSubmit',
key: 'isSubmit', key: 'isSubmit',
width: 100, width: 100,
align:'center', align: 'center',
}, },
{ {
title: '执行角色', title: '执行角色',
dataIndex: 'doRole', dataIndex: 'doRole',
key: 'doRole', key: 'doRole',
width: 200, width: 200,
ellipsis: true, ellipsis: true,
align:'center', align: 'center',
}, },
{ {
title: '预生成天数', title: '预生成天数',
dataIndex: 'produceDays', dataIndex: 'produceDays',
key: 'produceDays', key: 'produceDays',
width: 100, width: 100,
align:'center', align: 'center',
}, },
{ {
title: '在线任务量', title: '在线任务量',
dataIndex: 'onLines', dataIndex: 'onLines',
key: 'onLines', key: 'onLines',
width: 100, width: 100,
ellipsis: true, ellipsis: true,
align:'center', align: 'center',
}, },
{ {
title: '启停', title: '启停',
dataIndex: 'doNot', dataIndex: 'doNot',
key: 'doNot', key: 'doNot',
width: 100, width: 100,
align:'center', align: 'center',
}, },
{ {
title: '操作', title: '操作',
ellipsis: true, ellipsis: true,
key: 'action', key: 'action',
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => (
<Space> <Space>
<Tooltip title="修改"> <Tooltip title="修改">
<EditTwoTone <EditTwoTone
onClick={() => editEventType(record)} onClick={() => editEventType(record)}
style={{ fontSize: '16px' }} style={{ fontSize: '16px' }}
/> />
</Tooltip> </Tooltip>
<Tooltip title="删除"> <Tooltip title="删除">
<Popconfirm <Popconfirm
placement="bottomRight" placement="bottomRight"
title={ title={<p>是否确认删除?</p>}
<p> okText="确认"
是否确认删除? cancelText="取消"
</p> onConfirm={() => deleteEventType(record)}
} >
okText="确认" <DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
cancelText="取消" </Popconfirm>
onConfirm={() => deleteEventType(record)} </Tooltip>
> </Space>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} /> ),
</Popconfirm> },
</Tooltip> ];
</Space>
),
},
]
useEffect(()=>{ useEffect(() => {
setTreeLoading(true); setTreeLoading(true);
CM_XWBPlan_DataList().then(res=>{ CM_XWBPlan_DataList().then(res => {
setTreeLoading(false); setTreeLoading(false);
if(res.msg == 'Ok'){ if (res.msg === 'Ok') {
setTableData(res.data) setTableData(res.data);
} }
}) });
},[flag]) }, [flag]);
const add =()=>{ const add = () => {
setAddVisible(true) setAddVisible(true);
setType('add') setType('add');
} };
const editEventType =record=>{ const editEventType = record => {
setAddVisible(true) setAddVisible(true);
setType('edit') setType('edit');
setFormObj(record); setFormObj(record);
} };
const deleteEventType = record =>{ const deleteEventType = record => {
CM_XWBPlan_RemovePlan({planId:record.id}).then(res =>{ CM_XWBPlan_RemovePlan({ planId: record.id }).then(res => {
if (res.msg === '') { if (res.msg === '') {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '删除成功', description: '删除成功',
}); });
setFlag(flag + 1) setFlag(flag + 1);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg, description: res.msg,
}); });
} }
}) });
} };
const onSubmit =()=>{ const onSubmit = () => {
setAddVisible(false) setAddVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
} };
return ( return (
<div className={styles.maintenanceContainer}> <div className={styles.maintenanceContainer}>
<div className={styles.contentContainers}> <div className={styles.contentContainers}>
<div style={{ height: '50px', backgroundColor: 'white' }}> <div style={{ height: '50px', backgroundColor: 'white' }}>
<span style={{ float: 'right', marginRight: '10px' }}> <span style={{ float: 'right', marginRight: '10px' }}>
<Button icon={<PlusOutlined className={styles.icon} />} onClick={add} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '10px' }}> <Button
添加 icon={<PlusOutlined className={styles.icon} />}
</Button> onClick={add}
</span> style={{
</div> marginLeft: '30px',
<Table verticalAlign: 'middle',
// rowClassName={setRowClassName} marginTop: '10px',
size="small" }}
rowKey='ID' >
bordered 添加
loading={treeLoading} </Button>
onRow={record => { </span>
return {
onDoubleClick: event => { event.stopPropagation(); editEventType(record) }, //双击
};
}}
columns={columns}
dataSource={tableData}
scroll={{ y: 'calc(100vh - 215px)' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
{/* 添加事件 */}
<AddModal
visible={addVisible}
type={type}
onClose={() => setAddVisible(false)}
callBackSubmit={onSubmit}
formObj={formObj}
placement="right"
/>
</div>
</div> </div>
) <Table
// rowClassName={setRowClassName}
size="small"
rowKey="ID"
bordered
loading={treeLoading}
onRow={record => ({
onDoubleClick: event => {
event.stopPropagation();
editEventType(record);
}, // 双击
})}
columns={columns}
dataSource={tableData}
scroll={{ y: 'calc(100vh - 215px)', x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
{/* 添加事件 */}
<AddModal
visible={addVisible}
type={type}
onClose={() => setAddVisible(false)}
callBackSubmit={onSubmit}
formObj={formObj}
placement="right"
/>
</div>
</div>
);
}; };
export default maintenance export default maintenance;
\ No newline at end of file
/* eslint-disable indent */
/* eslint-disable react/jsx-no-duplicate-props */
/* eslint-disable no-shadow */
/* eslint-disable no-undef */
/* eslint-disable eqeqeq */
/* eslint-disable array-callback-return */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
/* eslint-disable camelcase */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Modal, Form, Input, notification, message, Row, Col, Select, Drawer, Space, Button } from 'antd'; import {
Modal,
Form,
Input,
notification,
message,
Row,
Col,
Select,
Drawer,
Space,
Button,
} from 'antd';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import ChangeAddFlows from './ChangeAddFlows' import ChangeAddFlows from './ChangeAddFlows';
import { CM_Event_ReloadFlows, CM_Event_LoadDepartmentAndRoles, CM_Event_AddEvenFlow, CM_Event_EditEvenFlow } from '@/services/standingBook/api'; import {
CM_Event_ReloadFlows,
CM_Event_LoadDepartmentAndRoles,
CM_Event_AddEvenFlow,
CM_Event_EditEvenFlow,
} from '@/services/standingBook/api';
import styles from './incident.less'; import styles from './incident.less';
const { Option } = Select; const { Option } = Select;
const AddFlowsModal = props => { const AddFlowsModal = props => {
const { callBackSubmit = () => { }, type, visible, onClose, formObj, obj, maxLength, record } = props; const {
const [form] = Form.useForm(); callBackSubmit = () => {},
const { Item } = Form; type,
visible,
onClose,
formObj,
obj,
maxLength,
record,
} = props;
const [form] = Form.useForm();
const { Item } = Form;
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据 const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [standingTable, setStandingTable] = useState([]); const [standingTable, setStandingTable] = useState([]);
const [visible1, setVisible1] = useState(false) const [visible1, setVisible1] = useState(false);
const [pickItem, setPickItem] = useState('') const [pickItem, setPickItem] = useState('');
const [checkedList1, setCheckedList1] = useState([]) const [checkedList1, setCheckedList1] = useState([]);
const [nu1, setNu1] = useState([]) const [nu1, setNu1] = useState([]);
const [inputValue, setInputValue] = useState({ Roles: '' }); const [inputValue, setInputValue] = useState({ Roles: '' });
const [selectValue, setSelectValue] = useState('') const [selectValue, setSelectValue] = useState('');
const [characterValue, setCharacterValue] = useState('') const [characterValue, setCharacterValue] = useState('');
const [Order, setOrder] = useState(''); // 弹窗类型 const [Order, setOrder] = useState(''); // 弹窗类型
const [strr, setStrr] = useState('') const [strr, setStrr] = useState('');
useEffect(() => {
useEffect(() => { console.log(formObj);
console.log(formObj) getRole();
getRole() console.log(obj);
console.log(obj) CM_Event_ReloadFlows({ eventTypeId: obj }).then(res => {
CM_Event_ReloadFlows({ eventTypeId: obj }).then(res => { if (res.msg === 'Ok') {
if (res.msg === 'Ok') { console.log(res.data);
console.log(res.data) let arr = formateArrDataA(res.data, 'System');
let arr = formateArrDataA(res.data, 'System') let newArr = [];
let newArr = [] Object.keys(arr).map((item, index) => {
Object.keys(arr).map((item, index) => { newArr.push(item);
newArr.push(item) });
}) console.log(newArr);
console.log(newArr) setStandingTable(newArr);
setStandingTable(newArr); }
} });
}) if (type === 'add') {
if (type === 'add') { setInputValue({ Roles: '' });
setInputValue({ Roles: '' }) setFiled1({});
setFiled1({}) form.resetFields();
form.resetFields(); } else if (type === 'edit') {
} else if (type === 'edit') { setStrr(record.FlowRoles);
setStrr(record.FlowRoles) console.log(record);
console.log(record) setInputValue({
setInputValue({ Roles: record.FlowRoles,
Roles: record.FlowRoles });
}) setSelectValue(record.FlowName);
setSelectValue(record.FlowName) console.log(selectValue);
console.log(selectValue) }
} }, [visible]);
const formateArrDataA = (initialArr, name) => {
}, [visible]) // 判定传参是否符合规则
const formateArrDataA = (initialArr, name) => { if (!(initialArr instanceof Array)) {
// 判定传参是否符合规则 return '请传入正确格式的数组';
if (!(initialArr instanceof Array)) { }
return '请传入正确格式的数组' if (!name) {
} return '请传入对象属性';
if (!name) { }
return '请传入对象属性' // 先获取一下这个数组中有多少个"name"
} let nameArr = [];
//先获取一下这个数组中有多少个"name" for (let i in initialArr) {
let nameArr = [] if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
for (let i in initialArr) { nameArr.push(initialArr[i][`${name}`]);
if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) { }
nameArr.push(initialArr[i][`${name}`]) }
} // 新建一个包含多个list的结果对象
} let tempObj = {};
//新建一个包含多个list的结果对象 // 根据不同的"name"生成多个数组
let tempObj = {} for (let k in nameArr) {
// 根据不同的"name"生成多个数组 for (let j in initialArr) {
for (let k in nameArr) { if (initialArr[j][`${name}`] == nameArr[k]) {
for (let j in initialArr) { // 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
if (initialArr[j][`${name}`] == nameArr[k]) { tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变 tempObj[nameArr[k]].push(initialArr[j]);
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) => { for (let keys in tempObj) {
let arr = [];
let aa = [] tempObj[keys].map((item, index) => {
let a1 = [] tempObj[keys] = arr;
let a2 item.key = index;
let a3 = [] arr.push(item);
initialArr.map(i => { });
// console.log(i.groupType) }
a2 = i.groupType return tempObj;
// console.log(a2) };
// console.log(i.root) const formateArrDataA1 = (initialArr, name) => {
a1 = i.root let aa = [];
a1.map(j => { let a1 = [];
j.group = a2 let a2;
// console.log(j) let a3 = [];
initialArr.map(i => {
}) // console.log(i.groupType)
aa.push(i.root) a2 = i.groupType;
}) // console.log(a2)
// console.log(aa) // console.log(i.root)
aa.map(p => { a1 = i.root;
// console.log(p) a1.map(j => {
p.map(o => { j.group = a2;
// console.log(o) // console.log(j)
a3.push(o) });
aa.push(i.root);
}) });
}) // console.log(aa)
console.log(a3) aa.map(p => {
// console.log(p)
p.map(o => {
// console.log(o)
a3.push(o);
});
});
console.log(a3);
// 判定传参是否符合规则 // 判定传参是否符合规则
if (!(a3 instanceof Array)) { if (!(a3 instanceof Array)) {
return '请传入正确格式的数组' 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 = () => { if (!name) {
callBackSubmit(); return '请传入对象属性';
// setLoading(true); }
let aa = form.getFieldsValue().FlowName // 先获取一下这个数组中有多少个"name"
console.log(aa) let nameArr = [];
console.log(inputValue) a3.map(i => {
console.log(strr) if (nameArr.indexOf(i.group) === -1) {
if (type == 'add') { nameArr.push(i.group);
let index = aa.lastIndexOf("\\"); }
aa = aa.substring(index + 1, aa.length); });
CM_Event_AddEvenFlow({ console.log(nameArr);
eventTypeId: formObj.ID, // 新建一个包含多个list的结果对象
flowName: aa, let tempObj = {};
roles: inputValue.Roles, // 根据不同的"name"生成多个数组
order: maxLength, for (let k in nameArr) {
}) for (let j in a3) {
.then(res => { if (a3[j].group == nameArr[k]) {
// setLoading(false); // 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
if (res.msg === 'Ok') { tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
form.resetFields(); tempObj[nameArr[k]].push(a3[j]);
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 == 'edit') {
CM_Event_EditEvenFlow({
eventTypeId: formObj.ID,
eventFlowId: record.ID,
roles: inputValue.Roles
})
.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);
});
} }
}
};
const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setNu1(res.data)
setFiled1(formateArrDataA1(res.data, 'groupType'))
console.log(res.data)
}
})
} }
const changeText = (e, type) => { console.log(tempObj);
let inputText = { ...inputValue } for (let key in tempObj) {
inputText[type] = e.target.value let arr = [];
setInputValue(inputText) tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.Name);
});
} }
const pickFiled1 = (fileds) => { return tempObj;
// setTypes('app') };
let pp = formateArrDataA1(nu1, 'group') const onSumbit = () => {
let ab = inputValue[fileds].split(',') callBackSubmit();
console.log(pp) // setLoading(true);
let arr = Object.keys(pp) let aa = form.getFieldsValue().FlowName;
let b = [] console.log(aa);
let a = [] console.log(inputValue);
arr.map((item, index) => { console.log(strr);
pp[item].map((i, j) => { if (type == 'add') {
b.push(i) let index = aa.lastIndexOf('\\');
}) aa = aa.substring(index + 1, aa.length);
CM_Event_AddEvenFlow({
eventTypeId: formObj.ID,
flowName: aa,
roles: inputValue.Roles,
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,
});
}
}) })
console.log(ab) .catch(error => {
ab.map((item, index) => { notification.error({
if (b.includes(item) == false) { message: '提示',
if(item == ''){ duration: 3,
a=[] description: '新增失败',
}else{ });
a.push(item) // setLoading(false);
} });
}
})
if(a.length >0){
pp.外部字段 = a
console.log(pp)
arr.push('外部字段')
}
console.log(a)
console.log(pp)
setFiled1(pp)
console.log(fileds)
setCharacterValue(inputValue[fileds])
setCheckedList1(inputValue[fileds].split(','))
setPickItem(fileds)
setVisible1(true)
} }
const onOKk = prop => { if (type == 'edit') {
let title = prop.title CM_Event_EditEvenFlow({
let selectData = prop.stt eventTypeId: formObj.ID,
let ff = prop.filed22 eventFlowId: record.ID,
let aa = [] roles: inputValue.Roles,
let bb = 0 })
title.map((item, index) => { .then(res => {
console.log(ff[item]) // setLoading(false);
aa=[] if (res.msg === '') {
selectData.map((item1, index1) => { form.resetFields();
console.log(item1) callBackSubmit();
if (ff[item].indexOf(item1) != -1) { notification.success({
aa.push(item1) message: '提示',
} duration: 3,
}) description: '编辑成功',
console.log(aa) });
if(aa.length == 0){ } else {
bb = 1
}
})
console.log(aa)
if (bb == 1) {
notification.error({ notification.error({
message: '提示', message: '提示',
description: '权限角色部门必须都选至少一项', 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') {
setNu1(res.data);
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')
let pp = formateArrDataA1(nu1, 'group');
let ab = inputValue[fileds].split(',');
console.log(pp);
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
console.log(ab);
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else { } else {
setVisible1(false) a.push(item);
let inputText = { ...inputValue }
inputText[prop.pickItem] = prop.str
console.log(prop.str)
console.log(inputText)
setStrr(prop.str)
setCheckedList1(prop.checkedList)
setInputValue(inputText)
} }
}
});
if (a.length > 0) {
pp.外部字段 = a;
console.log(pp);
arr.push('外部字段');
}
console.log(a);
console.log(pp);
setFiled1(pp);
console.log(fileds);
setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds);
setVisible1(true);
};
const onOKk = prop => {
let { title } = prop;
let selectData = prop.stt;
let ff = prop.filed22;
let aa = [];
let bb = 0;
title.map((item, index) => {
console.log(ff[item]);
aa = [];
selectData.map((item1, index1) => {
console.log(item1);
if (ff[item].indexOf(item1) != -1) {
aa.push(item1);
}
});
console.log(aa);
if (aa.length == 0) {
bb = 1;
}
});
console.log(aa);
if (bb == 1) {
notification.error({
message: '提示',
description: '权限角色部门必须都选至少一项',
});
} else {
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 ( };
<Drawer return (
title={type === 'add' ? '添加受理流程' : '编辑受理流程'} <Drawer
visible={visible} title={type === 'add' ? '添加受理流程' : '编辑受理流程'}
width='600px' visible={visible}
onClose={onClose} width="600px"
destroyOnClose onClose={onClose}
footer={ destroyOnClose
<Space> footer={
<Button onClick={onSumbit} type="primary"> <Space>
确定 <Button onClick={onSumbit} type="primary">
</Button> 确定
</Space> </Button>
} </Space>
> }
<Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}> >
<Row> <Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}>
<Col span={23}> <Row>
{type === 'edit' ? <Col span={23}>
<> {type === 'edit' ? (
<Item <>
label="受理流程" <Item label="受理流程" name="FlowName" labelCol={{ span: 4 }}>
name="FlowName" <Select
labelCol={{ span: 4 }} placeholder="选择受理流程"
> placeholder={selectValue}
<Select disabled
>
placeholder="选择受理流程" {standingTable
placeholder={selectValue} ? standingTable.map((item, index) => (
disabled <Option key={index} value={item}>
> {item}
{standingTable ? standingTable.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} </Option>
</Select> ))
</Item> : ''}
</> </Select>
: <> </Item>
<Item </>
label="受理流程" ) : (
name="FlowName" <>
labelCol={{ span: 4 }} <Item label="受理流程" name="FlowName" labelCol={{ span: 4 }}>
> <Select placeholder="选择受理流程">
<Select {standingTable
? standingTable.map((item, index) => (
placeholder="选择受理流程" <Option key={index} value={item}>
> {item}
{standingTable ? standingTable.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} </Option>
</Select> ))
</Item> : ''}
</> </Select>
} </Item>
</Col> </>
<Col span={23}> )}
<Item </Col>
label="受理权限" <Col span={23}>
name="Roles" <Item label="受理权限" name="Roles" labelCol={{ span: 4 }}>
labelCol={{ span: 4 }} <div className={styles.filed_listItem}>
> <Input
<div className={styles.filed_listItem} > style={{ width: '83%' }}
<Input style={{width:'83%'}}placeholder="请选择受理权限" onChange={(e) => changeText(e, 'Roles')} value={inputValue.Roles} allowClear /> placeholder="请选择受理权限"
<Button type="dashed" onClick={() => pickFiled1('Roles')} icon={<PlusOutlined style={{marginTop:'5px'}}/>} style={{ marginLeft: '0.5rem', width: '4rem' }} /> onChange={e => changeText(e, 'Roles')}
</div> value={inputValue.Roles}
</Item> allowClear
</Col> />
</Row> <Button
</Form> type="dashed"
<ChangeAddFlows onClick={() => pickFiled1('Roles')}
visible={visible1} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
onCancel={() => setVisible1(false)} style={{ marginLeft: '0.5rem', width: '4rem' }}
callBackSubmit={onOKk} />
newCheckedList={checkedList1} </div>
filed1={filed1} </Item>
pickItem={pickItem} </Col>
characterValue={characterValue} </Row>
formObj={formObj} </Form>
/> <ChangeAddFlows
</Drawer> visible={visible1}
) onCancel={() => setVisible1(false)}
} callBackSubmit={onOKk}
export default AddFlowsModal newCheckedList={checkedList1}
\ No newline at end of file filed1={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/>
</Drawer>
);
};
export default AddFlowsModal;
This source diff could not be displayed because it is too large. You can view the blob instead.
/* eslint-disable no-plusplus */
/* eslint-disable array-callback-return */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-shadow */
import React, { useState, useEffect, useCallback, useRef } from 'react'; import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Space, Divider, Radio, Checkbox, Button } from 'antd'; import { Form, Modal, Space, Divider, Radio, Checkbox, Button } from 'antd';
import styles from './incident.less';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import styles from './incident.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const ChangeAddFlows = props => { const ChangeAddFlows = props => {
const { callBackSubmit = () => { }, pickItem, visible, filed1, characterValue, newCheckedList } = props; const {
const [loading, setLoading] = useState(false); callBackSubmit = () => {},
const [value, setValue] = useState(''); pickItem,
const [checkValue, setCheckValue] = useState([]); visible,
const [form] = Form.useForm(); filed1,
const [title, setTitle] = useState([]) characterValue,
const { Item } = Form; newCheckedList,
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容 } = props;
const [indeterminate, setIndeterminate] = useState([]); const [loading, setLoading] = useState(false);
const [checkAll, setCheckAll] = useState([]); const [value, setValue] = useState('');
const [selectData, setSelectData] = useState([]) const [checkValue, setCheckValue] = useState([]);
let objArr = [] const [form] = Form.useForm();
const [title, setTitle] = useState([]);
const onChangeList1 = (list, index, title) => { const { Item } = Form;
const checkedListArr = [...checkedList] const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
checkedListArr[index] = list const [indeterminate, setIndeterminate] = useState([]);
setCheckedList(checkedListArr); const [checkAll, setCheckAll] = useState([]);
const indeterminateArr = [...indeterminate] const [selectData, setSelectData] = useState([]);
const checkAllArr = [...checkAll] let objArr = [];
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, stt: selectData, title: title, filed22: filed1 });
}
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(() => { const onChangeList1 = (list, index, title) => {
console.log(characterValue) const checkedListArr = [...checkedList];
console.log(pickItem) checkedListArr[index] = list;
console.log(filed1) setCheckedList(checkedListArr);
let arr = Object.keys(filed1) const indeterminateArr = [...indeterminate];
console.log(arr, 'arr') const checkAllArr = [...checkAll];
setTitle(arr) indeterminateArr[index] =
let checkArr = [] !!list.length && list.length < filed1[title].length;
let indeterminateArr = [] checkAllArr[index] = list.length === filed1[title].length;
let checkAllArr = [] setIndeterminate(indeterminateArr);
console.log(newCheckedList); setCheckAll(checkAllArr);
// let b = [] };
// let a = []
arr.map((item, index) => {
// filed1[item].map((i, j) => {
// b.push(i)
// })
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)
})
// newCheckedList.map((item, index) => {
// if (b.includes(item) == false) {
// if(item == ''){
// a=[]
// }else{
// a.push(item)
// }
// }
// })
// if(a.length >0){
// filed1.外部字段 = a
// console.log(filed1)
// arr.push('外部字段')
// }
// setTitle(arr)
// checkArr.push(a)
console.log(checkArr)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
draftSort()
const onSubmit = () => {
console.log(selectData.join(','));
console.log(pickItem);
console.log(checkedList);
callBackSubmit({
checkedList,
str: selectData.join(','),
pickItem,
stt: selectData,
title,
filed22: filed1,
});
};
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]);
}, [visible]); const selectAll = () => {
objArr = [];
checkedList.map(item => {
objArr = objArr.concat(item);
});
setSelectData(objArr);
};
//拖拽初始化及逻辑 useEffect(() => {
const draftSort = () => { console.log(characterValue);
let el = document.getElementById('doctor-drag-items'); console.log(pickItem);
if (el) { console.log(filed1);
let sortable = Sortable.create(el, { let arr = Object.keys(filed1);
animation: 100, //动画参数 console.log(arr, 'arr');
onEnd: function (evt) { //拖拽完毕之后发生,只需关注该事件 setTitle(arr);
let arr = []; let checkArr = [];
let len = evt.from.children.length; let indeterminateArr = [];
for (let i = 0; i < len; i++) { let checkAllArr = [];
arr.push(evt.from.children[i].getAttribute('drag-id')) console.log(newCheckedList);
} // let b = []
setSelectData(arr) // let a = []
} arr.map((item, index) => {
}); // filed1[item].map((i, j) => {
// b.push(i)
// })
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);
});
// newCheckedList.map((item, index) => {
// if (b.includes(item) == false) {
// if(item == ''){
// a=[]
// }else{
// a.push(item)
// }
} // }
// })
// if(a.length >0){
// filed1.外部字段 = a
// console.log(filed1)
// arr.push('外部字段')
// }
// setTitle(arr)
// checkArr.push(a)
console.log(checkArr);
setCheckedList(checkArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
draftSort();
}, [visible]);
return ( // 拖拽初始化及逻辑
<Modal const draftSort = () => {
title='部门或角色' let el = document.getElementById('doctor-drag-items');
bodyStyle={{ width: '100%', minHeight: '100px' }} if (el) {
width="700px" let sortable = Sortable.create(el, {
destroyOnClose animation: 100, // 动画参数
centered={true} onEnd(evt) {
cancelText="取消" // 拖拽完毕之后发生,只需关注该事件
okText="确认" let arr = [];
{...props} let len = evt.from.children.length;
onOk={() => onSubmit()} for (let i = 0; i < len; i++) {
forceRender={true} arr.push(evt.from.children[i].getAttribute('drag-id'));
getContainer={false} }
> setSelectData(arr);
{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> return (
</div> <Modal
title="部门或角色"
bodyStyle={{ width: '100%', minHeight: '100px' }}
width="1400px"
destroyOnClose
centered
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard1}>
<div
className={styles.cardItem1}
style={{ borderRight: '1px solid #99bbe8' }}
>
<Divider
orientation="left"
style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}
>
待选部门站点角色
</Divider>
<div className={styles.cardContent1}>
{title.map((item, index) => (
<div className={styles.cardItemData1} 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>
</Modal> {/* <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) => (
<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; export default ChangeAddFlows;
\ No newline at end of file
/* eslint-disable consistent-return */
/* eslint-disable no-shadow */
/* eslint-disable indent */
/* eslint-disable no-unused-expressions */
/* eslint-disable array-callback-return */
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import React, { useState, useEffect, useCallback, useRef } from 'react'; import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Form, Modal, Divider, Checkbox } from 'antd'; import { Form, Modal, Divider, Checkbox } from 'antd';
import styles from './incident.less';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import styles from './incident.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => { }, isType, pickItem, visible, filed, filed1, characterValue, newCheckedList, flag } = props; const {
const [loading, setLoading] = useState(false); callBackSubmit = () => {},
const [value, setValue] = useState(''); isType,
const [checkValue, setCheckValue] = useState([]); pickItem,
const [form] = Form.useForm(); visible,
const [title, setTitle] = useState([]) filed,
const { Item } = Form; filed1,
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容 characterValue,
const [indeterminate, setIndeterminate] = useState([]); newCheckedList,
const [checkAll, setCheckAll] = useState([]); flag,
const [selectData, setSelectData] = useState([]) } = props;
let objArr = [] const [loading, setLoading] = useState(false);
const [value, setValue] = useState('');
const onChangeList = (list, index, title) => { const [checkValue, setCheckValue] = useState([]);
const checkedListArr = [...checkedList] const [form] = Form.useForm();
checkedListArr[index] = list const [title, setTitle] = useState([]);
setCheckedList(checkedListArr); const { Item } = Form;
const indeterminateArr = [...indeterminate] const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
const checkAllArr = [...checkAll] const [indeterminate, setIndeterminate] = useState([]);
indeterminateArr[index] = !!list.length && list.length < filed[title].length const [checkAll, setCheckAll] = useState([]);
checkAllArr[index] = list.length === filed[title].length const [selectData, setSelectData] = useState([]);
setIndeterminate(indeterminateArr) let objArr = [];
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 = () => { const onChangeList = (list, index, title) => {
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(","), pickItem, stt: selectData, title: title, filed22: filed1, isType: isType }); const checkedListArr = [...checkedList];
} checkedListArr[index] = list;
const onCheckAllChange = e => { setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate] const indeterminateArr = [...indeterminate];
const checkAllArr = [...checkAll] const checkAllArr = [...checkAll];
const checkedListArr = [...checkedList] indeterminateArr[index] =
checkAllArr[e.target.index] = e.target.checked !!list.length && list.length < filed[title].length;
indeterminateArr[e.target.index] = false checkAllArr[index] = list.length === filed[title].length;
e.target.checked ? checkedListArr[e.target.index] = e.target.checkvalue : checkedListArr[e.target.index] = [] setIndeterminate(indeterminateArr);
setCheckedList(checkedListArr); setCheckAll(checkAllArr);
setIndeterminate(indeterminateArr); };
setCheckAll(checkAllArr); const onChangeList1 = (list, index, title) => {
}; const checkedListArr = [...checkedList];
useEffect(() => { checkedListArr[index] = list;
console.log(filed1) setCheckedList(checkedListArr);
selectAll() const indeterminateArr = [...indeterminate];
}, [checkedList]); const checkAllArr = [...checkAll];
indeterminateArr[index] =
!!list.length && list.length < filed1[title].length;
checkAllArr[index] = list.length === filed1[title].length;
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
};
const selectAll = () => { const onSubmit = () => {
objArr = [] isType === 'rule'
checkedList.map(item => { ? callBackSubmit(
objArr = objArr.concat(item) `${
}) value === '无' || value === '' ? '' : `${value},`
setSelectData(objArr) }${checkValue.join(',')}`,
} )
: callBackSubmit({
checkedList,
str: selectData.join(','),
pickItem,
stt: selectData,
title,
filed22: filed1,
isType,
});
};
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(() => {
console.log(filed1);
selectAll();
}, [checkedList]);
useEffect(() => { const selectAll = () => {
if (isType != '' && isType === 'add') { objArr = [];
console.log(filed) checkedList.map(item => {
let arr = Object.keys(filed) objArr = objArr.concat(item);
console.log(arr, 'arr') });
setTitle(arr) setSelectData(objArr);
let checkArr = [] };
let indeterminateArr = []
let checkAllArr = []
console.log(newCheckedList);
// let b = []
// let a = []
arr.map((item, index) => {
// filed[item].map((i, j) => {
// b.push(i)
// })
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)
})
// newCheckedList.map((item, index) => {
// if (b.includes(item) == false) {
// if(item == ''){
// a=[]
// }else{
// a.push(item)
// }
// }
// })
// if(a.length >0){
// filed.外部字段 = a
// console.log(filed)
// arr.push('外部字段')
// }
// setTitle(arr)
// checkArr.push(a)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
console.log(characterValue)
let newArr = characterValue.length ? characterValue.split(",") : []
console.log(newArr)
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);
// let b = []
// let a = []
arr.map((item, index) => {
// filed1[item].map((i, j) => {
// b.push(i)
// })
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)
})
// newCheckedList.map((item, index) => {
// if (b.includes(item) == false) {
// if(item == ''){
// a=[]
// }else{
// a.push(item)
// }
// }
// })
// if(a.length >0){
// filed1.外部字段 = a
// console.log(filed1)
// arr.push('外部字段')
// }
// setTitle(arr)
// checkArr.push(a)
setCheckedList(checkArr)
setIndeterminate(indeterminateArr)
setCheckAll(checkAllArr)
console.log(characterValue)
let newArr = characterValue.length ? characterValue.split(",") : []
console.log(newArr)
setSelectData(newArr)
draftSort()
}
}, [visible]); useEffect(() => {
if (isType != '' && isType === 'add') {
console.log(filed);
let arr = Object.keys(filed);
console.log(arr, 'arr');
setTitle(arr);
let checkArr = [];
let indeterminateArr = [];
let checkAllArr = [];
console.log(newCheckedList);
// let b = []
// let a = []
arr.map((item, index) => {
// filed[item].map((i, j) => {
// b.push(i)
// })
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);
});
// newCheckedList.map((item, index) => {
// if (b.includes(item) == false) {
// if(item == ''){
// a=[]
// }else{
// a.push(item)
// }
//拖拽初始化及逻辑 // }
const draftSort = () => { // })
let el = document.getElementById('doctor-drag-items'); // if(a.length >0){
if (el) { // filed.外部字段 = a
let sortable = Sortable.create(el, { // console.log(filed)
animation: 100, //动画参数 // arr.push('外部字段')
onEnd: function (evt) { //拖拽完毕之后发生,只需关注该事件 // }
let arr = []; // setTitle(arr)
let len = evt.from.children.length; // checkArr.push(a)
for (let i = 0; i < len; i++) { setCheckedList(checkArr);
arr.push(evt.from.children[i].getAttribute('drag-id')) setIndeterminate(indeterminateArr);
} setCheckAll(checkAllArr);
console.log(arr) console.log(characterValue);
setSelectData(arr) let newArr = characterValue.length ? characterValue.split(',') : [];
} console.log(newArr);
}); 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);
// let b = []
// let a = []
arr.map((item, index) => {
// filed1[item].map((i, j) => {
// b.push(i)
// })
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);
});
// newCheckedList.map((item, index) => {
// if (b.includes(item) == false) {
// if(item == ''){
// a=[]
// }else{
// a.push(item)
// }
// }
// })
// if(a.length >0){
// filed1.外部字段 = a
// console.log(filed1)
// arr.push('外部字段')
// }
// setTitle(arr)
// checkArr.push(a)
setCheckedList(checkArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
console.log(characterValue);
let newArr = characterValue.length ? characterValue.split(',') : [];
console.log(newArr);
setSelectData(newArr);
draftSort();
} }
if (isType != 'app') { }, [visible]);
return (
<Modal
title='字段集选择'
bodyStyle={{ width: '100%', minHeight: '100px' }}
width="700px"
destroyOnClose
centered={true}
cancelText="取消"
okText="确认"
{...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>
{flag === 0 ?
<>
<div className={styles.cardContent}>
<span style={{ color: 'red', fontSize: '1rem', marginLeft: '25px' }}>请先选择事件主表</span>
</div>
</> :
<>
{JSON.stringify(filed) == "{}" ?
<>
<div className={styles.cardContent}>
<span style={{ color: 'red', fontSize: '1rem', marginLeft: '25px' }}>表字段缺失请先配置表/字段</span>
</div>
</>
:
<>
<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' }}><Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed[item]} checked={checkAll[index]} style={{ marginRight: '7px' }}></Checkbox>{item}</Divider>
<CheckboxGroup options={filed[item]} value={checkedList[index]} onChange={(e) => onChangeList(e, index, item)} />
</div>
})}
</div>
</>
}
</>
} // eslint-disable-next-line spaced-comment
//拖拽初始化及逻辑
</div> const draftSort = () => {
<div className={styles.cardItem}> let el = document.getElementById('doctor-drag-items');
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>已选字段列表</Divider> if (el) {
<div className={styles.cardContent}> let sortable = Sortable.create(el, {
<div className={styles.doctorTable}> animation: 100, // 动画参数
<table> onEnd(evt) {
<thead> // 拖拽完毕之后发生,只需关注该事件
<tr> let arr = [];
<td>字段名</td> let len = evt.from.children.length;
</tr> for (let i = 0; i < len; i++) {
</thead> arr.push(evt.from.children[i].getAttribute('drag-id'));
<tbody id='doctor-drag-items'> }
{selectData && selectData.length > 0 ? console.log(arr);
selectData.map((item, index) => { setSelectData(arr);
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> if (isType != 'app') {
} return (
</tbody> <Modal
</table> title="字段集选择"
</div> bodyStyle={{ width: '100%', minHeight: '100px' }}
width="700px"
</div> destroyOnClose
</div> centered
</div> cancelText="取消"
) okText="确认"
{...props}
} onOk={() => onSubmit()}
</Modal> forceRender
); getContainer={false}
} else if (isType === 'app') { >
return ( {visible && (
<Modal <div className={styles.listCard}>
title='部门或角色' <div
bodyStyle={{ width: '100%', minHeight: '100px' }} className={styles.cardItem}
width="700px" style={{ borderRight: '1px solid #99bbe8' }}
style={{ top: '10px' }}
destroyOnClose
centered={true}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender={true}
getContainer={false}
> >
{visible && ( <Divider
<div className={styles.listCard}> orientation="left"
<div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}> style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}
<Divider orientation="left" style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}>待选部门角色站点</Divider> >
<div className={styles.cardContent}> 待选字段列表
{title.map((item, index) => { </Divider>
return <div className={styles.cardItemData} key={index}>
<Divider orientation="left" style={{ margin: '0 0 10px 0', color: '#15428b', borderTopColor: '#99bbe8' }}><Checkbox indeterminate={indeterminate[index]} onChange={onCheckAllChange} index={index} checkvalue={filed1[item]} checked={checkAll[index]} style={{ marginRight: '7px' }}></Checkbox>{item}</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>
)
} {flag === 0 ? (
</Modal> <>
); <div className={styles.cardContent}>
} <span
style={{
color: 'red',
fontSize: '1rem',
marginLeft: '25px',
}}
>
请先选择事件主表
</span>
</div>
</>
) : (
<>
{JSON.stringify(filed) == '{}' ? (
<>
<div className={styles.cardContent}>
<span
style={{
color: 'red',
fontSize: '1rem',
marginLeft: '25px',
}}
>
表字段缺失请先配置表/字段
</span>
</div>
</>
) : (
<>
<div className={styles.cardContent}>
{title.map((item, index) => (
<div className={styles.cardItemData} key={index}>
<Divider
orientation="left"
style={{
margin: '0 0 10px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
<Checkbox
indeterminate={indeterminate[index]}
onChange={onCheckAllChange}
index={index}
checkvalue={filed[item]}
checked={checkAll[index]}
style={{ marginRight: '7px' }}
/>
{item}
</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) => (
<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>
);
}
if (isType === 'app') {
return (
<Modal
title="部门或角色"
bodyStyle={{ width: '100%', minHeight: '100px' }}
width="1400px"
style={{ top: '10px' }}
destroyOnClose
centered
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard1}>
<div
className={styles.cardItem1}
// style={{ borderRight: '1px solid #99bbe8' }}
>
<Divider
orientation="left"
style={{ margin: '0 0 10px 0', backgroundColor: '#dfe8f6' }}
>
待选部门站点角色
</Divider>
<div className={styles.cardContent1}>
{title.map((item, index) => (
<div className={styles.cardItemData1} key={index}>
<Divider
orientation="left"
style={{
margin: '0 0 10px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
<Checkbox
indeterminate={indeterminate[index]}
onChange={onCheckAllChange}
index={index}
checkvalue={filed1[item]}
checked={checkAll[index]}
style={{ marginRight: '7px' }}
/>
{item}
</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) => (
<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; export default AddModal;
\ No newline at end of file
/* eslint-disable prettier/prettier */
/* eslint-disable eqeqeq */
/* eslint-disable no-shadow */
/* eslint-disable no-unused-vars */
/* eslint-disable array-callback-return */
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable camelcase */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import styles from './incident.less';
import { import {
Form, Form,
Card, Card,
Space, Space,
Table, Table,
Popconfirm, Popconfirm,
Spin, Spin,
Tooltip, Tooltip,
notification, notification,
Tree, Tree,
Button, Button,
} from 'antd'; } from 'antd';
import { import {
DoubleLeftOutlined, DoubleLeftOutlined,
DoubleRightOutlined, DoubleRightOutlined,
PlusSquareFilled, PlusSquareFilled,
RightOutlined, RightOutlined,
EditTwoTone, EditTwoTone,
DeleteOutlined, DeleteOutlined,
OrderedListOutlined, OrderedListOutlined,
ApartmentOutlined, ApartmentOutlined,
DesktopOutlined DesktopOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { GetCM_Event_LoadEventTable, CM_Event_RemoveEventTable, CM_Event_ReOrder, GetCM_Event_LoadEventTypeTable } from '@/services/standingBook/api'; import {
GetCM_Event_LoadEventTable,
CM_Event_RemoveEventTable,
CM_Event_ReOrder,
GetCM_Event_LoadEventTypeTable,
} from '@/services/standingBook/api';
import classnames from 'classnames'; import classnames from 'classnames';
import AddModal from './AddModal' import styles from './incident.less';
import ProcessModal from './ProcessModal' import AddModal from './AddModal';
import SortModal from './SortModal' import ProcessModal from './ProcessModal';
import ViewModal from './ViewModal' import SortModal from './SortModal';
import ViewModal from './ViewModal';
const incident = () => { const incident = () => {
const history = useHistory(); const history = useHistory();
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见 const [treeVisible, setTreeVisible] = useState(true); // 左边列表是否可见
const [treeData, setTreeData] = useState([]); // 事件表数据 const [treeData, setTreeData] = useState([]); // 事件表数据
const [tableData, setTableData] = useState([]); // 事件表 const [tableData, setTableData] = useState([]); // 事件表
const [addVisible, setAddvisible] = useState(false); const [addVisible, setAddvisible] = useState(false);
const [processVisible, setProcessVisible] = useState(false); const [processVisible, setProcessVisible] = useState(false);
const [sortVisible, setSortVisible] = useState(false); const [sortVisible, setSortVisible] = useState(false);
const [viewVisible, setViewVisible] = useState(false) const [viewVisible, setViewVisible] = useState(false);
const [isType, setIsType] = useState(''); // 弹窗类型 const [isType, setIsType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState(''); const [formObj, setFormObj] = useState('');
const [flag, setFlag] = useState(0); const [flag, setFlag] = useState(0);
const [title1, setTitle1] = useState('') const [title1, setTitle1] = useState('');
const [title2, setTitle2] = useState('') const [title2, setTitle2] = useState('');
const [select, setSelect] = useState('') const [select, setSelect] = useState('');
const [sortData, setSortData] = useState([]);
const [rember, setRember] = useState(0);
const [rember1, setRember1] = useState();
const [maxLength, setMaxLength] = useState(0);
const [pickItem, setPickItem] = useState('');
const [sortData, setSortData] = useState([]) const columns = [
const [rember, setRember] = useState(0) {
const [rember1, setRember1] = useState() title: '事件名称',
dataIndex: 'name',
key: 'name',
width: 150,
},
{
title: '事件主表',
dataIndex: 'tableName',
key: 'tableName',
width: 200,
ellipsis: true,
},
{
title: '编码',
dataIndex: 'code',
key: 'code',
width: 50,
},
{
title: '摘要字段',
dataIndex: 'summaryFields',
key: 'summaryFields',
width: 200,
ellipsis: true,
},
{
title: '权限',
dataIndex: 'roles',
key: 'roles',
width: 50,
},
{
title: '流程',
dataIndex: 'flowCount',
key: 'flowCount',
width: 50,
},
{
title: '上报',
dataIndex: 'reportable',
key: 'reportable',
width: 50,
},
{
title: '上报字段',
dataIndex: 'reportFields',
key: 'reportFields',
width: 100,
render: item => (
<span style={{ color: 'grey' }} key={item}>
{item}
</span>
),
},
{
title: '显示字段',
dataIndex: 'displayFields',
key: 'displayFields',
width: 100,
render: item => (
<span style={{ color: 'grey' }} key={item}>
{item}
</span>
),
},
const [maxLength, setMaxLength] = useState(0); {
const [pickItem, setPickItem] = useState(''); title: '编辑',
dataIndex: 'editable',
const columns = [ key: 'editable',
{ width: 50,
title: '事件名称', render: item => (
dataIndex: 'name', <span style={{ color: 'grey' }} key={item}>
key: 'name', {item}
width: 150, </span>
}, ),
{ },
title: '事件主表', {
dataIndex: 'tableName', title: '编辑字段',
key: 'tableName', dataIndex: 'editableFields',
width: 200, key: 'editableFields',
ellipsis: true, width: 100,
} render: item => (
, <div
{ ref={r => {
title: '编码', if (r) {
dataIndex: 'code', r.innerHTML = item;
key: 'code',
width: 50,
}
,
{
title: '摘要字段',
dataIndex: 'summaryFields',
key: 'summaryFields',
width: 200,
ellipsis: true
}
,
{
title: '权限',
dataIndex: 'roles',
key: 'roles',
width: 50,
}
,
{
title: '流程',
dataIndex: 'flowCount',
key: 'flowCount',
width: 50,
}
,
{
title: '上报',
dataIndex: 'reportable',
key: 'reportable',
width: 50,
}
,
{
title: '上报字段',
dataIndex: 'reportFields',
key: 'reportFields',
width: 100,
render: item => (
<span style={{ color: 'grey' }} key={item}>
{item}
</span>
),
}
,
{
title: '显示字段',
dataIndex: 'displayFields',
key: 'displayFields',
width: 100,
render: item => (
<span style={{ color: 'grey' }} key={item}>
{item}
</span>
),
}
,
{
title: '编辑',
dataIndex: 'editable',
key: 'editable',
width: 50,
render: item => (
<span style={{ color: 'grey' }} key={item}>
{item}
</span>
),
}
,
{
title: '编辑字段',
dataIndex: 'editableFields',
key: 'editableFields',
width: 100,
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
)
}
,
{
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',
align: '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>
<Tooltip title="受理流程">
<ApartmentOutlined
onClick={() => process1(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
<Tooltip title="辅助视图">
<DesktopOutlined
onClick={() => auxiliaryView1(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
</Space>
)
}
]
useEffect(() => {
setTreeLoading(true);
GetCM_Event_LoadEventTable().then(res => {
setTreeLoading(false);
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)
console.log(history.location.state)
if(history.location.state){
console.log(history)
console.log(history.location.state.rember)
setPickItem(newArr[history.location.state.rember])
setRember(history.location.state.rember)
setRember1(newArr[history.location.state.rember])
}else{
setPickItem(newArr[rember])
setRember1(newArr[0])
}
console.log(rember)
console.log(newArr[rember])
console.log(newArr, 'newArr');
setTreeData(newArr)
}
})
}, [flag])
useEffect(() => {
GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') {
let arr = []
res.data.map((item, index) => {
arr.push(item.text)
})
setSelect(arr)
}
})
}, [])
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 title: '上报方式',
arr.push(item) dataIndex: 'createMode',
}) key: 'createMode',
} width: 100,
return tempObj },
} // {
//添加事件 // title: '置顶条件',
const addIncident = () => { // dataIndex: 'topWhere',
setAddvisible(true) // key: 'topWhere',
setIsType('add') // width: 100,
} // render: item =>(
//修改事件类型 // <div
const editEventType = record => { // ref={r => {
setFormObj(record); // if (r) {
setIsType('edit'); // r.innerHTML = item;
setAddvisible(true); // }
} // }}
//删除事件类型 // />
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 sort = () => {
setSortVisible(true);
console.log(tableData)
console.log(pickItem)
console.log(tableData[pickItem])
setSortData(tableData[pickItem])
}
// const process = record => {
// setProcessVisible(true);
// setFormObj(record);
// setTitle1(record.name)
// } // }
const process1 = record =>{ // ,
history.push({ // {
pathname: '/platformCenter/bsmanger/incidentFlow', // title: '接口配置',
state: { formObj:record, title1:record.name, rember }, // dataIndex: 'interfaceConfig',
// key: 'interfaceConfig',
// width: 100,
// render: item =>(
// <div
// ref={r => {
// if (r) {
// r.innerHTML = item;
// }
// }}
// />
// )
// },
{
title: '操作',
key: 'action',
align: '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>
<Tooltip title="受理流程">
<ApartmentOutlined
onClick={() => process1(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
<Tooltip title="辅助视图">
<DesktopOutlined
onClick={() => auxiliaryView1(record)}
style={{ fontSize: '16px', color: '#1890FF' }}
/>
</Tooltip>
</Space>
),
},
];
useEffect(() => {
setTreeLoading(true);
GetCM_Event_LoadEventTable().then(res => {
setTreeLoading(false);
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);
}); });
} });
// const auxiliaryView = record => { console.log(newabb);
// setFormObj(record); newabb.map((item, index) => {
// setViewVisible(true) console.log(item);
// setTitle2(record.name) aa.push(item);
// } });
const auxiliaryView1 = record => { console.log(aa);
history.push({ aa.map((item, index) => {
pathname: '/platformCenter/bsmanger/incidentView', console.log(item);
state: { formObj:record, title2:record.name, rember }, item.map((item1, index) => {
console.log(item1);
zz.push({ ...item1 });
}); });
});
console.log(zz);
let arrr = formateArrDataA(zz, 'businessType');
console.log(arrr);
setTableData(arrr);
console.log(history.location.state);
if (history.location.state) {
console.log(history);
console.log(history.location.state.rember);
setPickItem(newArr[history.location.state.rember]);
setRember(history.location.state.rember);
setRember1(newArr[history.location.state.rember]);
} else {
setPickItem(newArr[rember]);
setRember1(newArr[0]);
}
console.log(rember);
console.log(newArr[rember]);
console.log(newArr, 'newArr');
setTreeData(newArr);
}
});
}, [flag]);
useEffect(() => {
GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') {
let arr = [];
res.data.map((item, index) => {
arr.push(item.text);
});
setSelect(arr);
}
});
}, []);
const formateArrDataA = (initialArr, name) => {
console.log(initialArr);
console.log(name);
// 判定传参是否符合规则
if (!(initialArr instanceof Array)) {
return '请传入正确格式的数组';
} }
const onSubmit = () => { if (!name) {
setAddvisible(false) return '请传入对象属性';
setFlag(flag + 1)
} }
const onOK = prop => { // 先获取一下这个数组中有多少个"name"
setSortVisible(false) let nameArr = [];
let aa = (prop.str).toString() for (let i in initialArr) {
console.log(aa) if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
CM_Event_ReOrder(aa).then(res => { nameArr.push(initialArr[i][`${name}`]);
if (res.msg === 'Ok') { }
notification.success({
message: '提示',
duration: 3,
description: '调整成功',
});
setFlag(flag + 1);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
} }
const onOK1 = () => { // 新建一个包含多个list的结果对象
setProcessVisible(false) let tempObj = {};
setFlag(flag + 1) // 根据不同的"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]);
}
}
} }
const onOK11 = () => { for (let keys in tempObj) {
setViewVisible(false) let arr = [];
tempObj[keys].map((item, index) => {
tempObj[keys] = arr;
item.key = index;
arr.push(item);
});
} }
return ( return tempObj;
<div className={styles.incidentContainer}> };
<div className={styles.contentContainers}> // 添加事件
{/*左侧事件树 */} const addIncident = () => {
<Spin spinning={treeLoading} tip="loading..."> setAddvisible(true);
<Card setIsType('add');
className={classnames({ };
[styles.orgContainer]: true, // 修改事件类型
[styles.orgContainerHide]: !treeVisible, const editEventType = record => {
})} setFormObj(record);
> setIsType('edit');
<div> setAddvisible(true);
<span };
style={{ // 删除事件类型
fontSize: '15px ', const deleteEventType = record => {
fontWeight: 'bold', 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 sort = () => {
setSortVisible(true);
console.log(tableData);
console.log(pickItem);
console.log(tableData[pickItem]);
setSortData(tableData[pickItem]);
};
// const process = record => {
// setProcessVisible(true);
// setFormObj(record);
// setTitle1(record.name)
}} // }
> const process1 = record => {
事件列表 history.push({
</span> pathname: '/platformCenter/bsmanger/incidentFlow',
<Tooltip title="添加事件类型"> state: { formObj: record, title1: record.name, rember },
<PlusSquareFilled });
onClick={() => addIncident()} };
style={{ // const auxiliaryView = record => {
color: '#1890FF', // setFormObj(record);
fontSize: '25px', // setViewVisible(true)
verticalAlign: 'middle', // setTitle2(record.name)
marginLeft: '58%' // }
}} const auxiliaryView1 = record => {
/> history.push({
</Tooltip> pathname: '/platformCenter/bsmanger/incidentView',
<hr style={{ width: '100%', color: '#eeecec' }} /> state: { formObj: record, title2: record.name, rember },
{ });
treeData.length > 0 && (treeData.map((item, index) => { };
return <div className={classnames({ const onSubmit = () => {
[styles.listItem]: true, setAddvisible(false);
[styles.pickItem]: item === pickItem, setFlag(flag + 1);
})} onClick={e => { setPickItem(item); setRember(index); setRember1(item) }} key={index}>{item}{tableData[item] ? tableData[item].length : ''}{item === pickItem ? <RightOutlined /> : ''} </div> };
}) const onOK = prop => {
)} setSortVisible(false);
</div> let aa = prop.str.toString();
<div className={styles.switcher}> console.log(aa);
{treeVisible && ( CM_Event_ReOrder(aa).then(res => {
<Tooltip title="隐藏机构列表"> if (res.msg === 'Ok') {
<DoubleLeftOutlined onClick={() => setTreeVisible(false)} /> notification.success({
</Tooltip> message: '提示',
)} duration: 3,
{!treeVisible && ( description: '调整成功',
<Tooltip title="显示机构列表"> });
<DoubleRightOutlined onClick={() => setTreeVisible(true)} /> setFlag(flag + 1);
</Tooltip> } else {
)} notification.error({
</div> message: '提示',
</Card> duration: 3,
</Spin> description: res.msg,
{/*右侧 */} });
<div }
});
};
const onOK1 = () => {
setProcessVisible(false);
setFlag(flag + 1);
};
const onOK11 = () => {
setViewVisible(false);
};
return (
<div className={styles.incidentContainer}>
<div className={styles.contentContainers}>
{/* 左侧事件树 */}
<Spin spinning={treeLoading} tip="loading...">
<Card
className={classnames({
[styles.orgContainer]: true,
[styles.orgContainerHide]: !treeVisible,
})}
>
<div>
<span
style={{
fontSize: '15px ',
fontWeight: 'bold',
}}
>
事件列表
</span>
<Tooltip title="添加事件类型">
<PlusSquareFilled
onClick={() => addIncident()}
style={{
color: '#1890FF',
fontSize: '25px',
verticalAlign: 'middle',
marginLeft: '58%',
}}
/>
</Tooltip>
<hr style={{ width: '100%', color: '#eeecec' }} />
{treeData.length > 0 &&
treeData.map((item, index) => (
<div
className={classnames({ className={classnames({
[styles.userContainer]: true, [styles.listItem]: true,
[styles.userContainerHide]: !treeVisible, [styles.pickItem]: item === pickItem,
})} })}
> onClick={e => {
<div style={{ height: '50px' }}> setPickItem(item);
<span style={{ float: 'right', marginRight: '10px' }}> setRember(index);
<Button icon={<OrderedListOutlined className={styles.icon} />} onClick={sort} style={{ marginLeft: '30px', verticalAlign: 'middle', marginTop: '10px' }}> setRember1(item);
调序 }}
</Button> key={index}
</span> >
</div> {item}{tableData[item] ? tableData[item].length : ''}{' '}
{item === pickItem ? <RightOutlined /> : ''}{' '}
<Table </div>
size="small" ))}
rowKey='ID' </div>
bordered <div className={styles.switcher}>
onRow={record => { {treeVisible && (
return { <Tooltip title="隐藏机构列表">
onDoubleClick: event => { event.stopPropagation(); editEventType(record) }, //双击 <DoubleLeftOutlined onClick={() => setTreeVisible(false)} />
}; </Tooltip>
}} )}
columns={columns} {!treeVisible && (
dataSource={tableData[pickItem]} <Tooltip title="显示机构列表">
scroll={{ y: 'calc(100vh - 155px)' }} <DoubleRightOutlined onClick={() => setTreeVisible(true)} />
pagination={{ </Tooltip>
showTotal: (total, range) => )}
`第${range[0]}-${range[1]} 条/共 ${total} 条`, </div>
pageSizeOptions: [10, 20, 50, 100], </Card>
defaultPageSize: 20, </Spin>
showQuickJumper: true, {/* 右侧 */}
showSizeChanger: true, <div
}} className={classnames({
/> [styles.userContainer]: true,
[styles.userContainerHide]: !treeVisible,
})}
>
<div style={{ height: '50px' }}>
<span style={{ float: 'right', marginRight: '10px' }}>
<Button
icon={<OrderedListOutlined className={styles.icon} />}
onClick={sort}
style={{
marginLeft: '30px',
verticalAlign: 'middle',
marginTop: '10px',
}}
>
调序
</Button>
</span>
</div>
</div> <Table
{/* Modal弹框 */} size="small"
{/* 添加事件 */} rowKey="ID"
<AddModal bordered
visible={addVisible} onRow={record => ({
type={isType} onDoubleClick: event => {
formObj={formObj} event.stopPropagation();
rember1={rember1} editEventType(record);
maxLength={maxLength} }, // 双击
onClose={() => setAddvisible(false)} })}
treeData={treeData} columns={columns}
selectData={select} dataSource={tableData[pickItem]}
callBackSubmit={onSubmit} scroll={{ y: 'calc(100vh - 155px)', x: 'max-content' }}
placement="right" pagination={{
/> showTotal: (total, range) =>
{/* <ProcessModal `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
}}
/>
</div>
{/* Modal弹框 */}
{/* 添加事件 */}
<AddModal
visible={addVisible}
type={isType}
formObj={formObj}
rember1={rember1}
maxLength={maxLength}
onClose={() => setAddvisible(false)}
treeData={treeData}
selectData={select}
callBackSubmit={onSubmit}
placement="right"
/>
{/* <ProcessModal
visible={processVisible} visible={processVisible}
formObj={formObj} formObj={formObj}
title1={title1} title1={title1}
...@@ -569,25 +580,24 @@ const incident = () => { ...@@ -569,25 +580,24 @@ const incident = () => {
onCancel={() => setProcessVisible(false)} onCancel={() => setProcessVisible(false)}
callBackSubmit={onOK1} callBackSubmit={onOK1}
/> */} /> */}
<SortModal <SortModal
title="调整顺序" title="调整顺序"
visible={sortVisible} visible={sortVisible}
sortData1={sortData} sortData1={sortData}
pickItem={pickItem} pickItem={pickItem}
onCancel={() => setSortVisible(false)} onCancel={() => setSortVisible(false)}
callBackSubmit={onOK} callBackSubmit={onOK}
/> />
{/* <ViewModal {/* <ViewModal
formObj={formObj} formObj={formObj}
visible={viewVisible} visible={viewVisible}
onCancel={() => setViewVisible(false)} onCancel={() => setViewVisible(false)}
title2={title2} title2={title2}
callBackSubmit={onOK11} callBackSubmit={onOK11}
/> */} /> */}
</div> </div>
</div> </div>
);
)
}; };
export default incident; export default incident;
\ No newline at end of file
.ant-modal-close-x { .ant-modal-close-x {
line-height: 35px; line-height: 35px;
} }
.ant-btn .anticon.anticon-plus > svg { .ant-btn .anticon.anticon-plus > svg {
margin-top:-5px; margin-top: -5px;
} }
.incidentContainer{ .incidentContainer {
.ant-card-body { .ant-card-body {
padding: 12px 24px 24px 24px; padding: 12px 24px 24px 24px;
}
.linkDrowp {
position: absolute;
left: 93.5%;
width: 1rem;
height: 100%;
display: flex;
align-items: center;
}
.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;
}
.ant-btn .anticon.anticon-plus > svg,
.ant-btn .anticon.anticon-minus > svg {
margin-top: -5px;
}
.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 - 166px);
overflow-x: hidden;
border: none;
} }
.orgContainer {
.linkDrowp{ height: calc(100vh - 74px);
width: 250px;
left: 0;
top: 0;
overflow-x: hidden;
margin-right: 10px;
position: relative;
transition-property: width, left;
transition-duration: 0.5s;
white-space: nowrap;
.ant-tree {
padding-top: 6px;
.ant-tree-switcher {
line-height: 1;
margin-right: 0px !important;
color: #1890ff;
.ant-tree-switcher-line-icon {
margin-left: 5px;
}
}
}
.switcher {
display: block;
position: absolute; position: absolute;
left: 93.5%; font-size: 18px;
width: 1rem; color: #1890ff !important;
height: 100%; top: 50%;
display: flex; right: 2px;
align-items: center; transform: translate(0%, -50%);
z-index: 1;
}
} }
.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;
.orgContainerHide {
// transform: translateX(-230px);
left: 0px;
top: 0;
width: 26px;
} }
.ant-btn .anticon.anticon-plus > svg, .ant-btn .anticon.anticon-minus > svg { .ant-popover-message-title {
margin-top: -5px; padding-left: 20px;
}
.pickItem{
background-color: #F5F6F9;
} }
.contentContainers{ .userContainer {
display: flex; height: calc(100vh - 74px) !important;
width: 100%; z-index: 999;
position: relative; min-width: 800px;
.ant-table.ant-table-bordered > .ant-table-container { background: white;
min-width: calc(100vw - 582px); width: 100%;
height: calc(100vh - 166px); position: relative;
overflow-x: hidden; transition: width 0.5s;
border: none; .title {
} margin: 16px 0 10px 16px;
.orgContainer{ display: inline-block;
height: calc(100vh - 74px); width: 270px;
width: 250px; cursor: pointer;
left: 0; overflow: hidden;
top: 0; text-overflow: ellipsis;
overflow-x: hidden; white-space: nowrap;
margin-right: 10px; }
position: relative; .ant-table-pagination {
transition-property:width,left; padding-right: 12px;
transition-duration: 0.5s; background: white;
white-space: nowrap; margin: 1px 0;
.ant-tree{ padding: 8px;
padding-top: 6px; padding-right: 20px;
.ant-tree-switcher{ }
line-height: 1; .ant-btn {
margin-right: 0px !important; margin: 0px 10px;
color:#1890FF; .ant-btn-primary {
.ant-tree-switcher-line-icon{ background: #50aefc;
margin-left: 5px;
}
}
}
.switcher{
display: block;
position: absolute;
font-size: 18px;
color: #1890FF!important;
top: 50%;
right: 2px;
transform: translate(0%,-50%);
z-index: 1;
}
}
.orgContainerHide{
// transform: translateX(-230px);
left: 0px;
top: 0;
width: 26px;
}
.ant-popover-message-title {
padding-left: 20px;
}
.userContainer{
height: calc(100vh - 74px) !important;
z-index: 999;
min-width: 800px;
background: white;
width: 100%;
position: relative;
transition: width 0.5s;
.title{
margin: 16px 0 10px 16px;
display: inline-block;
width: 270px;
cursor: pointer;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding: 8px;
padding-right: 20px;
}
.ant-btn{
margin: 0px 10px;
.ant-btn-primary{
background: #50aefc;
}
}
.ant-input-search-button{
margin-left: 0px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
background-color:#F6F9FE;
}
.ant-table-cell{
text-align:center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body{
height:calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle{
background: #cfe7fd;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
} }
}
.ant-input-search-button {
margin-left: 0px !important;
}
.ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
background-color: #f6f9fe;
}
.ant-table-cell {
text-align: center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body {
height: calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle {
background: #cfe7fd;
}
.ant-pagination {
z-index: 999;
border-top: 1px solid #f0eded;
}
} }
.icon{ }
margin-top: -5px !important; .icon {
vertical-align: text-bottom; margin-top: -5px !important;
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;
} }
}
.ant-modal-root .ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important;
min-width: 200px !important;
}
} }
.formData{ .listCard {
height: 38rem; display: flex;
justify-content: space-around;
width: 100%;
.cardItem {
padding: 0.5rem;
width: 50%;
}
.cardContent {
height: 30rem;
overflow-y: scroll; overflow-y: scroll;
.ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before{ width: 19rem;
display: none; }
} .cardItemData {
.formData_label{ padding: 1rem;
display: flex; border: 1px solid #b5b8c8;
align-items: center; margin-bottom: 1rem;
} overflow-x: hidden;
.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{ .listCard1 {
display: flex;
.cardItem1 {
padding: 0.5rem;
}
.cardContent1 {
height: 33rem;
overflow-y: scroll;
width: 1350px;
display: flex; display: flex;
.cardItem{ justify-content: space-around;
padding: 0.5rem; }
} .cardItemData1 {
.cardContent{ padding: 1rem;
height: 30rem; border: 1px solid #b5b8c8;
overflow-y: scroll; margin-bottom: 1rem;
width: 19rem; width: 33.3%;
} overflow-x: hidden;
.cardItemData{ }
padding: 1rem;
border: 1px solid #b5b8c8;
margin-bottom: 1rem;
overflow-x: hidden;
}
} }
.doctorTable { .doctorTable {
margin-bottom: 16px; margin-bottom: 16px;
table { table {
width: 100%; width: 100%;
td { td {
padding: 6px; padding: 6px;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
} }
thead { thead {
tr { tr {
font-weight: 600; font-weight: 600;
background: #FAFAFA; background: #fafafa;
}
} }
tbody{ }
tr:hover{ tbody {
background-color:#ededed ; tr:hover {
} background-color: #ededed;
} }
} }
} }
.ant-checkbox-group-item {
width: 260px;
} }
.ant-drawer-footer { .ant-drawer-footer {
display:flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.config{ .config {
display: flex;
padding: 1rem 0 0.5rem 0.5rem;
justify-content: space-between;
width: calc(100% - 10px);
.title {
font-size: 18px;
color: rgba(0, 114, 255, 1);
font-weight: bold;
}
.btn {
display: flex; display: flex;
padding: 1rem 0 0.5rem 0.5rem; justify-content: flex-end;
justify-content: space-between; width: 20rem;
width: calc(100% - 10px); }
.title{ .ant-btn {
font-size: 18px; display: flex;
color: rgba(0, 114, 255, 1); align-items: center;
font-weight: bold; margin-left: 20px;
} }
.btn{
display: flex;
justify-content: flex-end;
width: 20rem;
}
.ant-btn{
display: flex;
align-items: center;
margin-left: 20px;
}
} }
.containerBox { .containerBox {
width: 100vm; width: 100vm;
height: calc(100vh - 90px) ; height: calc(100vh - 90px);
background: #ffffff; background: #ffffff;
.ant-table.ant-table-small .ant-table-tbody .ant-table-wrapper:only-child .ant-table{ .ant-table.ant-table-small
margin-left: 0; .ant-table-tbody
} .ant-table-wrapper:only-child
.ant-table.ant-table-bordered > .ant-table-container{ .ant-table {
border: none; margin-left: 0;
} }
.clickRowStyle{ .ant-table.ant-table-bordered > .ant-table-container {
background: #cfe7fd; border: none;
} }
.ant-table-thead tr th{ .clickRowStyle {
font-weight: 600; background: #cfe7fd;
color:rgba(0,0,0,0.85); }
} .ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
}
.panda-pro-pages-platform-center-bsmanager-work-order-incident-filed_listItem {
display: flex;
} }
.panda-pro-pages-platform-center-bsmanager-work-order-incident-filed_listItem{
display:flex
}
\ No newline at end of file
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable camelcase */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, Table, Tooltip, notification, Space, Popconfirm, Spin, Button } from 'antd';
import { import {
PlusSquareFilled, Modal,
EditTwoTone, Table,
DeleteOutlined, Tooltip,
PlusSquareOutlined, notification,
RollbackOutlined Space,
Popconfirm,
Spin,
Button,
} from 'antd';
import {
PlusSquareFilled,
EditTwoTone,
DeleteOutlined,
PlusSquareOutlined,
RollbackOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import styles from './incident.less'; import styles from './incident.less';
import { GetCM_Event_LoadEvenFlows, CM_Event_RemoveEvenFlow } from '@/services/standingBook/api'; import {
import AddFlowsModal from './AddFlowsModal' GetCM_Event_LoadEvenFlows,
const incidentFlow = (props) => { CM_Event_RemoveEvenFlow,
const [tableData, setTableData] = useState([]) } from '@/services/standingBook/api';
const history = useHistory(); import AddFlowsModal from './AddFlowsModal';
const [addVisible, setAddVisible] = useState(false) const incidentFlow = props => {
const [treeLoading, setTreeLoading] = useState(false); const [tableData, setTableData] = useState([]);
const [isType, setIsType] = useState(''); // 弹窗类型 const history = useHistory();
const [record1, setRecord1] = useState('') const [addVisible, setAddVisible] = useState(false);
const [obj, setObj] = useState('') const [treeLoading, setTreeLoading] = useState(false);
const [flag, setFlag] = useState(0) const [isType, setIsType] = useState(''); // 弹窗类型
const [record1, setRecord1] = useState('');
const [obj, setObj] = useState('');
const columns = [ const [flag, setFlag] = useState(0);
{
title: () => (<span style={{ fontWeight: 'bold' }}>流程名称</span>),
dataIndex: 'FlowName',
key: 'FlowName',
width: 250,
ellipsis: true,
}
,
{
title: () => (<span style={{ fontWeight: 'bold' }}>受理权限</span>),
dataIndex: 'FlowRoles',
key: 'FlowRoles',
ellipsis: true,
},
{
title: () => (<span style={{ fontWeight: 'bold' }}>操作</span>),
key: 'action',
width: 150,
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>
)
} const columns = [
] {
title: () => <span style={{ fontWeight: 'bold' }}>流程名称</span>,
dataIndex: 'FlowName',
key: 'FlowName',
width: 250,
ellipsis: true,
},
{
title: () => <span style={{ fontWeight: 'bold' }}>受理权限</span>,
dataIndex: 'FlowRoles',
key: 'FlowRoles',
ellipsis: true,
},
{
title: () => <span style={{ fontWeight: 'bold' }}>操作</span>,
key: 'action',
width: 150,
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(() => { useEffect(() => {
console.log(props) console.log(props);
console.log(props.location.state.title1) console.log(props.location.state.title1);
setTreeLoading(true); setTreeLoading(true);
GetCM_Event_LoadEvenFlows({ eventTypeId: props.location.state.formObj.ID }).then(res => { GetCM_Event_LoadEvenFlows({
setTreeLoading(false); eventTypeId: props.location.state.formObj.ID,
if (res.msg === 'Ok') { }).then(res => {
console.log(res.data) setTreeLoading(false);
setTableData(res.data) if (res.msg === 'Ok') {
} console.log(res.data);
}) setTableData(res.data);
}, [flag]) }
const addIncident = () => { });
console.log(props.location.state.formObj.ID) }, [flag]);
setObj(props.location.state.formObj.ID) const addIncident = () => {
setAddVisible(true) console.log(props.location.state.formObj.ID);
setIsType('add') setObj(props.location.state.formObj.ID);
} setAddVisible(true);
const editEventType = record => { setIsType('add');
setObj(props.location.state.formObj.ID) };
setRecord1(record) const editEventType = record => {
setIsType('edit'); setObj(props.location.state.formObj.ID);
setAddVisible(true) setRecord1(record);
} setIsType('edit');
const back = () => { setAddVisible(true);
let rember = props.location.state.rember; };
history.push({ const back = () => {
pathname: '/platformCenter/bsmanger/incident', let { rember } = props.location.state;
state: { rember }, history.push({
pathname: '/platformCenter/bsmanger/incident',
state: { rember },
});
};
const deleteEventType = record => {
console.log(record);
CM_Event_RemoveEvenFlow({ eventFlowIds: record.ID }).then(res => {
if (res.msg === '') {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
}); });
}; setFlag(flag + 1);
const deleteEventType = record => { } else {
console.log(record) notification.error({
CM_Event_RemoveEvenFlow({ eventFlowIds: record.ID }).then(res => { message: '提示',
if (res.msg === '') { duration: 3,
notification.success({ description: res.msg,
message: '提示', });
duration: 3, }
description: '删除成功', });
};
}); const onOK = () => {
setFlag(flag + 1) setAddVisible(false);
} else { GetCM_Event_LoadEvenFlows({
notification.error({ eventTypeId: props.location.state.formObj.ID,
message: '提示', }).then(res => {
duration: 3, if (res.msg === 'Ok') {
description: res.msg, console.log(res.data);
}); setTableData(res.data);
} }
}) });
} };
const onOK = () => {
setAddVisible(false)
GetCM_Event_LoadEvenFlows({ eventTypeId: props.location.state.formObj.ID }).then(res => {
if (res.msg === 'Ok') {
console.log(res.data)
setTableData(res.data)
}
})
}
return (
<>
<Spin tip="loading..." spinning={treeLoading}>
<div className={styles.containerBox}>
<div className={styles.config}>
<div className={styles.title}>{`${props.location.state.title1}受理流程和权限`}</div>
<div className={styles.btn}>
<Button
type="primary"
icon={<PlusSquareOutlined />}
onClick={() => addIncident()}
>
新增
</Button>
<Button type="primary" icon={<RollbackOutlined />} onClick={()=>back()}>
返回
</Button>
</div>
</div>
<Table return (
size="small" <>
rowKey='ID' <Spin tip="loading..." spinning={treeLoading}>
bordered <div className={styles.containerBox}>
style={{ overflowY: 'scroll'}} <div className={styles.config}>
onRow={record => { <div className={styles.title}>{`${
return { props.location.state.title1
onDoubleClick: event => { event.stopPropagation(); editEventType(record); }, //双击 }受理流程和权限`}</div>
}; <div className={styles.btn}>
}} <Button
columns={columns} type="primary"
dataSource={tableData} icon={<PlusSquareOutlined />}
pagination={false} /> onClick={() => addIncident()}
</div> >
</Spin> 新增
<AddFlowsModal </Button>
visible={addVisible}
obj={obj}
formObj={props.location.state.formObj}
type={isType}
record={record1}
// maxLength={maxLength}
onClose={() => setAddVisible(false)}
callBackSubmit={onOK}
placement="right"
/>
</>
<Button
type="primary"
icon={<RollbackOutlined />}
onClick={() => back()}
>
返回
</Button>
</div>
</div>
) <Table
} size="small"
export default incidentFlow; rowKey="ID"
\ No newline at end of file bordered
style={{ overflowY: 'scroll' }}
onRow={record => ({
onDoubleClick: event => {
event.stopPropagation();
editEventType(record);
}, // 双击
})}
columns={columns}
dataSource={tableData}
pagination={false}
/>
</div>
</Spin>
<AddFlowsModal
visible={addVisible}
obj={obj}
formObj={props.location.state.formObj}
type={isType}
record={record1}
// maxLength={maxLength}
onClose={() => setAddVisible(false)}
callBackSubmit={onOK}
placement="right"
/>
</>
);
};
export default incidentFlow;
import React, { useEffect, useState } from 'react' /* eslint-disable array-callback-return */
/* eslint-disable no-shadow */
/* eslint-disable indent */
/* eslint-disable eqeqeq */
import React, { useEffect, useState } from 'react';
import { import {
// Tree, // Tree,
Table, Table,
Space, Space,
Input, Input,
Button, Button,
Select, Select,
Popconfirm, Popconfirm,
message, message,
Tooltip, Tooltip,
Spin Spin,
} from 'antd'; } from 'antd';
import { PlusCircleOutlined, EditTwoTone, DeleteOutlined, FundViewOutlined, FieldTimeOutlined } from '@ant-design/icons'; import {
PlusCircleOutlined,
EditTwoTone,
DeleteOutlined,
FundViewOutlined,
FieldTimeOutlined,
} from '@ant-design/icons';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import EditModal from './components/EditModal';
import VisibleRoleModal from './components/RolseSelect/VisibleRoleModal';
import {
GetMessageConfigList,
TestPush,
DeleteMessageConfig,
GetMsgTypeList,
DeleteIISAgentConfig,
} from '@/services/platform/messagemanage';
import styles from './ProjectManage.less';
const { Search } = Input; const { Search } = Input;
const { Option } = Select; const { Option } = Select;
import EditModal from './components/EditModal'
import VisibleRoleModal from './components/RolseSelect/VisibleRoleModal'
import { GetMessageConfigList, TestPush, DeleteMessageConfig, GetMsgTypeList, DeleteIISAgentConfig } from '@/services/platform/messagemanage'
import styles from './ProjectManage.less'
const ProjectManage = () => { const ProjectManage = () => {
const history = useHistory(); const history = useHistory();
const [visibleParams, setvisibleParams] = useState({ const [visibleParams, setvisibleParams] = useState({
addVisible: false, // 新增弹窗 addVisible: false, // 新增弹窗
delVisible: false, // 删除弹窗 delVisible: false, // 删除弹窗
editVisible: false, // 修改弹窗 editVisible: false, // 修改弹窗
spinLoading: false, // 加载弹窗 spinLoading: false, // 加载弹窗
btnLoading: false, btnLoading: false,
loading: false, loading: false,
checkBoxLoading: false, checkBoxLoading: false,
}); });
const [currentType, setCurrentType] = useState("全部") const [currentType, setCurrentType] = useState('全部');
const [currentName, setCurrentName] = useState("全部") const [currentName, setCurrentName] = useState('全部');
const [messageTypes, setMessageTypes] = useState([]) const [messageTypes, setMessageTypes] = useState([]);
const [currentTemplate, setCurrentTempalte] = useState({}); const [currentTemplate, setCurrentTempalte] = useState({});
const [flag, setFlag] = useState(0) const [flag, setFlag] = useState(0);
const [pageIndex, setPageIndex] = useState(0) const [pageIndex, setPageIndex] = useState(0);
const [pageSize, setPageSize] = useState(10) const [pageSize, setPageSize] = useState(10);
const [dataList, setDataList] = useState([]) const [dataList, setDataList] = useState([]);
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [value, setValue] = useState('') const [value, setValue] = useState('');
const columns = [ const columns = [
{ {
title: '方案名称', title: '方案名称',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
render: (text, record) => ( render: (text, record) => (
<div>{record.type == '定时推送' ? searchStyle(text) : <div style={{ display: 'flex', alignItems: 'center' }}> <div>
<Tooltip title={text} > {record.type === '定时推送' ? (
<FieldTimeOutlined searchStyle(text)
style={{ fontSize: '16px', color: '#1890FF', marginRight: '0.1rem' }} ) : (
/> <div style={{ display: 'flex', alignItems: 'center' }}>
</Tooltip> <Tooltip title={text}>
{searchStyle(text)} <FieldTimeOutlined
</div>} style={{
</div> fontSize: '16px',
color: '#1890FF',
), marginRight: '0.1rem',
}, }}
{ />
title: '方案类型', </Tooltip>
dataIndex: 'type', {searchStyle(text)}
key: 'type', </div>
}, )}
{ </div>
title: '推送方式', ),
dataIndex: 'send_pattern', },
key: 'send_pattern', {
}, title: '方案类型',
{ dataIndex: 'type',
title: '推送组', key: 'type',
dataIndex: 'receive_person', },
key: 'receive_person', {
}, title: '推送方式',
{ dataIndex: 'send_pattern',
title: '是否启用', key: 'send_pattern',
dataIndex: 'is_use', },
key: 'is_use', {
render: (text, record) => ( title: '推送组',
<div>{text === "0" ? "否" : "是"}</div> dataIndex: 'receive_person',
) key: 'receive_person',
}, },
{ {
title: '操作', title: '是否启用',
width: 250, dataIndex: 'is_use',
ellipsis: true, key: 'is_use',
render: (text, record) => ( render: (text, record) => <div>{text === '0' ? '否' : '是'}</div>,
<Space> },
<Tooltip title="测试"> {
<FundViewOutlined style={{ fontSize: '16px', color: '#1890FF' }} onClick={() => { title: '操作',
TestDesc(record); width: 250,
}} /> ellipsis: true,
</Tooltip> render: (text, record) => (
<Tooltip title="编辑"> <Space>
<EditTwoTone style={{ fontSize: '16px', color: '#e86060' }} onClick={() => { <Tooltip title="测试">
changeDesc(record); <FundViewOutlined
}}></EditTwoTone> style={{ fontSize: '16px', color: '#1890FF' }}
</Tooltip> onClick={() => {
TestDesc(record);
{ }}
record.name != "通用报警" />
&& record.name != "工单提醒" </Tooltip>
&& record.name != "系统通知" <Tooltip title="编辑">
&& (<div onClick={e => e.stopPropagation()}> <EditTwoTone
<Popconfirm style={{ fontSize: '16px', color: '#e86060' }}
title="是否删除方案?" onClick={() => {
okText="确认" changeDesc(record);
cancelText="取消" }}
onConfirm={() => { />
DeleteProject(record) </Tooltip>
}}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}></DeleteOutlined> {record.name != '通用报警' &&
</Popconfirm> record.name != '工单提醒' &&
</div>) record.name != '系统通知' && (
} <div onClick={e => e.stopPropagation()}>
</Space> <Popconfirm
), title="是否删除方案?"
}, okText="确认"
cancelText="取消"
onConfirm={() => {
DeleteProject(record);
}}
>
<DeleteOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Popconfirm>
</div>
)}
</Space>
),
},
];
]; // 模糊查询匹配的样式
const searchStyle = val => {
console.log(val);
console.log(value);
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(value, 'g'),
`<span style='color:red'>${value}</span>`,
);
} else {
n = val;
}
console.log(val);
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
// 模糊查询匹配的样式 const placeholder = '请输入方案名称';
const searchStyle = val => { const handleSearch = value => {
console.log(val) GetMessageList({ pageSize: 10, pageIndex: 0, search: value });
console.log(value) setShowSearchStyle(true);
let n; };
if (showSearchStyle) { const changeDesc = record => {
n = val.replace( setCurrentTempalte(record);
new RegExp(value, 'g'), history.push({
`<span style='color:red'>${value}</span>`, pathname: `/platformCenter/schemeDetail`,
); state: { template: record },
});
// handleShowModal("editVisible", true)
};
const TestDesc = record => {
if (record.ThemeName)
TestPush({
theme: record.ThemeName,
msgType: record.MsgType,
tousers: record.PushGroup,
pushPath: record.item.AgentConfig ? record.item.AgentConfig.Url : '',
msgTypeId: record.ID,
}).then(res => {
if (res.code === 0) {
message.success('测试推送成功');
} else { } else {
n = val; message.error(res.msg);
} }
console.log(val) });
return <div dangerouslySetInnerHTML={{ __html: n }} />; };
}; const DeleteProject = record => {
let agen = record.item.AgentConfig;
const placeholder = '请输入方案名称' let config = record.item.MessageConfig;
const handleSearch = (value) => { if (agen) {
GetMessageList({ pageSize: 10, pageIndex: 0, search: value }) DeleteIISAgentConfig({
setShowSearchStyle(true); agentName: config.MsgType,
} }).then(res => {
const changeDesc = (record) => { if (res === 0) {
setCurrentTempalte(record) DeleteMessageConfig({
history.push({ pathname: `/platformCenter/schemeDetail`, state: { template: record } }) id: config.ID,
// handleShowModal("editVisible", true) }).then(res3 => {
} if (res3.code === 0) {
const TestDesc = (record) => { message.success('删除方案成功');
if (record.ThemeName) setFlag(flag + 1);
TestPush({ }
theme: record.ThemeName, });
msgType: record.MsgType,
tousers: record.PushGroup,
pushPath: record.item.AgentConfig ? record.item.AgentConfig.Url : '',
msgTypeId: record.ID
}).then(
res => {
if (res.code === 0) {
message.success("测试推送成功")
} else {
message.error(res.msg)
}
}
)
}
const DeleteProject = (record) => {
let agen = record.item.AgentConfig
let config = record.item.MessageConfig
if (agen) {
DeleteIISAgentConfig({
agentName: config.MsgType
}).then(
res => {
if (res === 0) {
DeleteMessageConfig({
id: config.ID
}).then(
res3 => {
if (res3.code === 0) {
message.success("删除方案成功")
setFlag(flag + 1)
}
}
)
}
else {
message.error(res.msg)
}
}
)
} else { } else {
DeleteMessageConfig({ message.error(res.msg);
id: config.ID
}).then(
res3 => {
if (res3.code === 0) {
message.success("删除方案成功")
setFlag(flag + 1)
}
}
)
} }
});
} } else {
const handleReset = () => { DeleteMessageConfig({
setCurrentType("全部") id: config.ID,
setCurrentName("全部") }).then(res3 => {
GetMessageList({ pageSize: 10, pageIndex: 0 }) if (res3.code === 0) {
setShowSearchStyle(false); message.success('删除方案成功');
setValue('') setFlag(flag + 1);
}
// 弹出模态框
const handleShowModal = (key, value) => {
setvisibleParams({ ...visibleParams, [key]: value });
};
const editModal = () => {
handleShowModal("editVisbile", false)
setFlag(flag + 1)
}
const bddModal = () => {
handleShowModal("addVisbile", false)
setFlag(flag + 1)
}
const onAddClick = () => {
setCurrentTempalte({})
// handleShowModal("addVisible", true)
history.push({ pathname: `/platformCenter/schemeDetail`, state: { template: {} } })
}
const onTypeChange = (value) => {
if (value == "全部") {
setCurrentType("")
GetMessageList({ pageIndex: pageIndex, pageSize: 10 })
} else {
GetMessageList({ pageIndex: pageIndex, pageSize: 10, infoType: value, msgType: currentName == "全部" ? "" : currentName })
setCurrentType(value)
} }
});
} }
const onNameChange = (value) => { };
if (value == "全部") { const handleReset = () => {
setCurrentName("") setCurrentType('全部');
GetMessageList({ pageIndex: pageIndex, pageSize: 10 }) setCurrentName('全部');
} else { GetMessageList({ pageSize: 10, pageIndex: 0 });
GetMessageList({ pageIndex: pageIndex, pageSize: 10, msgType: value, infoType: currentType == "全部" ? "" : currentType }) setShowSearchStyle(false);
setCurrentName(value) setValue('');
} };
// 弹出模态框
const handleShowModal = (key, value) => {
setvisibleParams({ ...visibleParams, [key]: value });
};
const editModal = () => {
handleShowModal('editVisbile', false);
setFlag(flag + 1);
};
const bddModal = () => {
handleShowModal('addVisbile', false);
setFlag(flag + 1);
};
const onAddClick = () => {
setCurrentTempalte({});
// handleShowModal("addVisible", true)
history.push({
pathname: `/platformCenter/schemeDetail`,
state: { template: {} },
});
};
const onTypeChange = value => {
if (value == '全部') {
setCurrentType('');
GetMessageList({ pageIndex, pageSize: 10 });
} else {
GetMessageList({
pageIndex,
pageSize: 10,
infoType: value,
msgType: currentName == '全部' ? '' : currentName,
});
setCurrentType(value);
} }
};
const onNameChange = value => {
if (value == '全部') {
setCurrentName('');
GetMessageList({ pageIndex, pageSize: 10 });
} else {
GetMessageList({
pageIndex,
pageSize: 10,
msgType: value,
infoType: currentType == '全部' ? '' : currentType,
});
setCurrentName(value);
}
};
useEffect(() => { useEffect(() => {
setTreeLoading(true) setTreeLoading(true);
GetMsgTypeList().then( GetMsgTypeList().then(res => {
res => { setTreeLoading(false);
setTreeLoading(false) if (res.code === 0) {
if (res.code === 0) { setMessageTypes(res.data);
setMessageTypes(res.data) }
} });
} }, []);
) useEffect(() => {
}, []) GetMessageList({ pageIndex, pageSize: 10 });
useEffect(() => { }, [flag]);
GetMessageList({ pageIndex: pageIndex, pageSize: 10 })
}, [flag])
const GetMessageList = (params) => {
setTreeLoading(true)
GetMessageConfigList(params).then(
res => {
setTreeLoading(false)
let mesList = []
if (res.code === 0) {
res.data.MessageConfigModels.map((item) => {
mesList.push({
name: item.MessageConfig.MsgType,
type: item.MessageConfig.ThemeName,
send_pattern: item.MessageConfig.PushMode,
receive_person: item.MessageConfig.PushGroup,
is_use: item.MessageConfig.IsStarted,
...item.MessageConfig,
item: item
})
})
setDataList(mesList) const GetMessageList = params => {
} setTreeLoading(true);
} GetMessageConfigList(params).then(res => {
) setTreeLoading(false);
} let mesList = [];
if (res.code === 0) {
res.data.MessageConfigModels.map(item => {
mesList.push({
name: item.MessageConfig.MsgType,
type: item.MessageConfig.ThemeName,
send_pattern: item.MessageConfig.PushMode,
receive_person: item.MessageConfig.PushGroup,
is_use: item.MessageConfig.IsStarted,
...item.MessageConfig,
item,
});
});
const handleChange = e =>{ setDataList(mesList);
setValue(e.target.value) }
} });
};
const pagenation = { const handleChange = e => {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, setValue(e.target.value);
pageSizeOptions: [10, 20, 50, 100], };
defaultPageSize: 10,
showQuickJumper: true,
showSizeChanger: true,
};
return (
<div className={styles.project_container}>
<Spin tip="loading..." spinning={treeLoading}>
<div className={styles.operate_bar}>
<div className={styles.template_type}>
<div className={styles.title}>方案类型</div>
<Select placeholder="请选择方案类型!" defaultValue={currentType} style={{ width: "150px" }} onChange={onTypeChange}>
<Option value="全部">全部</Option>
<Option value="监控报警">监控报警</Option>
<Option value="工单办理">工单办理</Option>
<Option value="平台公告">平台公告</Option>
<Option value="定时推送">定时推送</Option>
</Select>
</div>
<div className={styles.template_type}>
<div className={styles.title}>方案名称</div>
<Select placeholder="请选择方案名称!" defaultValue={currentName} style={{ width: "150px" }} onChange={onNameChange}>
<Option value="全部">全部</Option>
{
messageTypes.map((item, idx) => {
return (
<Option key={idx} value={item.MsgType}>{item.MsgType}</Option>
)
})
}
</Select>
</div>
<div className={styles.fast_search}>
<div className={styles.title}>快速检索</div>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
onChange={e=>{handleChange(e)}}
enterButton
style={{ width: "300px" }}
value={value}
/>
</div>
<Button type="primary" onClick={handleReset}>重置</Button>
<Button type="primary" style={{ marginLeft: "10px" }} icon={<PlusCircleOutlined />} onClick={onAddClick}><span style={{ marginTop: "-3px" }}>新增</span></Button>
</div> const pagenation = {
<div className={styles.list_view}> showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
<Table pageSizeOptions: [10, 20, 50, 100],
bordered defaultPageSize: 10,
columns={columns} showQuickJumper: true,
dataSource={dataList} showSizeChanger: true,
pagination={pagenation} };
rowKey='ID' return (
/> <div className={styles.project_container}>
</div> <Spin tip="loading..." spinning={treeLoading}>
<EditModal <div className={styles.operate_bar}>
visible={visibleParams.editVisible} <div className={styles.template_type}>
template={currentTemplate} <div className={styles.title}>方案类型</div>
onCancel={() => handleShowModal('editVisible', false)} <Select
confirmModal={editModal} placeholder="请选择方案类型!"
/> value={currentType}
<EditModal style={{ width: '150px' }}
visible={visibleParams.addVisible} onChange={onTypeChange}
template={{}} >
onCancel={() => handleShowModal('addVisible', false)} <Option value="全部">全部</Option>
confirmModal={bddModal} <Option value="监控报警">监控报警</Option>
/> <Option value="工单办理">工单办理</Option>
</Spin> <Option value="平台公告">平台公告</Option>
<Option value="定时推送">定时推送</Option>
</Select>
</div>
<div className={styles.template_type}>
<div className={styles.title}>方案名称</div>
<Select
placeholder="请选择方案名称!"
value={currentName}
style={{ width: '150px' }}
onChange={onNameChange}
>
<Option value="全部">全部</Option>
{messageTypes.map((item, idx) => (
<Option key={idx} value={item.MsgType}>
{item.MsgType}
</Option>
))}
</Select>
</div>
<div className={styles.fast_search}>
<div className={styles.title}>快速检索</div>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
onChange={e => {
handleChange(e);
}}
enterButton
style={{ width: '300px' }}
value={value}
/>
</div>
<Button type="primary" onClick={handleReset}>
重置
</Button>
<Button
type="primary"
style={{ marginLeft: '10px' }}
icon={<PlusCircleOutlined />}
onClick={onAddClick}
>
<span style={{ marginTop: '-3px' }}>新增</span>
</Button>
</div>
<div className={styles.list_view}>
<Table
bordered
columns={columns}
dataSource={dataList}
pagination={pagenation}
rowKey="ID"
/>
</div> </div>
) <EditModal
} visible={visibleParams.editVisible}
export default ProjectManage; template={currentTemplate}
\ No newline at end of file onCancel={() => handleShowModal('editVisible', false)}
confirmModal={editModal}
/>
<EditModal
visible={visibleParams.addVisible}
template={{}}
onCancel={() => handleShowModal('addVisible', false)}
confirmModal={bddModal}
/>
</Spin>
</div>
);
};
export default ProjectManage;
import React, { useEffect, useState } from 'react' /* eslint-disable array-callback-return */
/* eslint-disable eqeqeq */
/* eslint-disable no-shadow */
/* eslint-disable spaced-comment */
/* eslint-disable import/first */
import React, { useEffect, useState } from 'react';
import { import {
// Tree, // Tree,
Table, Table,
Space, Space,
Input, Input,
Button, Button,
Select, Select,
Popconfirm, Popconfirm,
message, message,
Tooltip, Tooltip,
notification, notification,
Spin Spin,
} from 'antd'; } from 'antd';
import { PlusCircleOutlined, EditTwoTone, DeleteOutlined } from '@ant-design/icons'; import {
PlusCircleOutlined,
EditTwoTone,
DeleteOutlined,
} from '@ant-design/icons';
const { Search } = Input; const { Search } = Input;
const { Option } = Select; const { Option } = Select;
import EditModal from './components/EditModal' import EditModal from './components/EditModal';
import AddModal from './components/AddModal' import AddModal from './components/AddModal';
import { GetMessageTemplate, UpdateMessageTemplate, DeleteMessageTemplate, InsertMessageTemplate, GetThirdpartyTemplates } from '@/services/platform/messagemanage' import {
import styles from './TemplateManage.less' GetMessageTemplate,
UpdateMessageTemplate,
DeleteMessageTemplate,
InsertMessageTemplate,
GetThirdpartyTemplates,
} from '@/services/platform/messagemanage';
import styles from './TemplateManage.less';
const TemplateManage = () => { const TemplateManage = () => {
const [visibleParams, setvisibleParams] = useState({
addVisible: false, // 新增弹窗
delVisible: false, // 删除弹窗
editVisible: false, // 修改弹窗
spinLoading: false, // 加载弹窗
btnLoading: false,
loading: false,
checkBoxLoading: false,
});
const [currentTemplate, setCurrentTempalte] = useState({});
const [data, setData] = useState([]);
const [flag, setFlag] = useState(0);
const [option, setOption] = useState([]); // 下拉列表数据
const [treeLoading, setTreeLoading] = useState(false);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [value, setValue] = useState('');
const [currentType, setCurrentType] = useState('全部');
const [visibleParams, setvisibleParams] = useState({ useEffect(() => {
addVisible: false, // 新增弹窗 getTemplateList();
delVisible: false, // 删除弹窗 selectFocus();
editVisible: false, // 修改弹窗 }, [flag]);
spinLoading: false, // 加载弹窗
btnLoading: false,
loading: false,
checkBoxLoading: false,
});
const [currentTemplate, setCurrentTempalte] = useState({});
const [data, setData] = useState([])
const [flag, setFlag] = useState(0)
const [option, setOption] = useState([]); // 下拉列表数据
const [treeLoading, setTreeLoading] = useState(false);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [value, setValue] = useState('')
useEffect(() => {
getTemplateList()
selectFocus()
}, [flag])
const getTemplateList = (obj) => {
setTreeLoading(true)
GetMessageTemplate(obj).then(
res => {
setTreeLoading(false)
let list = []
if (res.code === 0) {
res.data.map((item, index) => {
list.push({
key: item.Id,
Id: item.Id,
name: item.LikeName,
type: item.Type,
third_name: item.Name,
third_id: item.No,
template_params2: item.ParsingParams,//模板参数2.0
template_params1: item.TParameters,//模板参数1.0
analysis_params: item.ParsingRules,//模板解析
desc: item.ParsingDescription,//模板参数说明
weixin: item.WorkWeiXinId//企业微信ID
})
})
setData(list)
}
}
).catch(e=>{
setTreeLoading(false)
})
}
const selectFocus = (obj) => { const getTemplateList = obj => {
GetThirdpartyTemplates(obj).then(res => { setTreeLoading(true);
if (res.msg === "Ok") { GetMessageTemplate(obj)
console.log(res.data) .then(res => {
setOption(res.data); setTreeLoading(false);
} else { let list = [];
notification.error({ if (res.code === 0) {
message: '提示', res.data.map((item, index) => {
duration: 15, list.push({
description: res.message, key: item.Id,
}); Id: item.Id,
} name: item.LikeName,
}) type: item.Type,
.catch(err => { third_name: item.Name,
console.error(err); third_id: item.No,
template_params2: item.ParsingParams, //模板参数2.0
template_params1: item.TParameters, //模板参数1.0
analysis_params: item.ParsingRules, //模板解析
desc: item.ParsingDescription, //模板参数说明
weixin: item.WorkWeiXinId, //企业微信ID
}); });
}; });
setData(list);
const columns = [ }
{ })
title: '编号', .catch(e => {
dataIndex: 'Id', setTreeLoading(false);
key: 'Id', });
align: 'center', };
width: 80,
render: text => <a>{text}</a>,
},
{
title: '模板名称',
dataIndex: 'name',
key: 'name',
align: 'center',
render: item => searchStyle(item),
},
{
title: '模板类型',
dataIndex: 'type',
key: 'type',
align: 'center',
},
{
title: '第三方模板名称',
dataIndex: 'third_name',
key: 'third_name',
align: 'center',
},
{
title: '企业微信ID',
dataIndex: 'weixin',
key: 'weixin',
align: 'center',
},
{
title: '第三方模版编号',
dataIndex: 'third_id',
key: 'third_id',
align: 'center',
},
{
title: '模板参数1.0',
dataIndex: 'template_params1',
key: 'template_params1',
align: 'center',
},
{
title: '模板参数2.0',
dataIndex: 'template_params2',
key: 'template_params2',
align: 'center',
},
{
title: '模板参数说明',
dataIndex: 'desc',
key: 'desc',
align: 'center',
},
{
title: '解析规则',
dataIndex: 'analysis_params',
key: 'analysis_params',
align: 'center',
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
width: 150,
ellipsis: true,
render: (text, record) => (
<Space>
<Tooltip title="编辑">
<EditTwoTone
type="primary"
size="small"
onClick={() => {
changeDesc(record);
}}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<Tooltip title="删除">
<div onClick={e => e.stopPropagation()}>
<Popconfirm
placement="bottomRight"
title="是否删除该模板?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delTemplate(record);
}}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</div>
</Tooltip>
</Space>
),
},
];
// 模糊查询匹配的样式 const selectFocus = obj => {
const searchStyle = val => { GetThirdpartyTemplates(obj)
let n; .then(res => {
if (showSearchStyle) { if (res.msg === 'Ok') {
n = val.replace( console.log(res.data);
new RegExp(value, 'g'), setOption(res.data);
`<span style='color:red'>${value}</span>`,
);
} else { } else {
n = val; notification.error({
message: '提示',
duration: 15,
description: res.message,
});
} }
console.log(n) })
return <div dangerouslySetInnerHTML={{ __html: n }} />; .catch(err => {
}; console.error(err);
});
};
const placeholder = '请输入模板名称' const columns = [
const handleSearch = (value) => { {
setValue(value) title: '编号',
getTemplateList({ queryInfo: value }) dataIndex: 'Id',
setShowSearchStyle(true); key: 'Id',
} align: 'center',
const handleReset = () => { width: 80,
getTemplateList() render: text => <a>{text}</a>,
setValue('') },
setShowSearchStyle(false); {
title: '模板名称',
dataIndex: 'name',
key: 'name',
align: 'center',
render: item => searchStyle(item),
},
{
title: '模板类型',
dataIndex: 'type',
key: 'type',
align: 'center',
},
{
title: '第三方模板名称',
dataIndex: 'third_name',
key: 'third_name',
align: 'center',
},
{
title: '企业微信ID',
dataIndex: 'weixin',
key: 'weixin',
align: 'center',
},
{
title: '第三方模版编号',
dataIndex: 'third_id',
key: 'third_id',
align: 'center',
},
{
title: '模板参数1.0',
dataIndex: 'template_params1',
key: 'template_params1',
align: 'center',
},
{
title: '模板参数2.0',
dataIndex: 'template_params2',
key: 'template_params2',
align: 'center',
},
{
title: '模板参数说明',
dataIndex: 'desc',
key: 'desc',
align: 'center',
},
{
title: '解析规则',
dataIndex: 'analysis_params',
key: 'analysis_params',
align: 'center',
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
align: 'center',
width: 150,
ellipsis: true,
render: (text, record) => (
<Space>
<Tooltip title="编辑">
<EditTwoTone
type="primary"
size="small"
onClick={() => {
changeDesc(record);
}}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<Tooltip title="删除">
<div onClick={e => e.stopPropagation()}>
<Popconfirm
placement="bottomRight"
title="是否删除该模板?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delTemplate(record);
}}
>
<DeleteOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Popconfirm>
</div>
</Tooltip>
</Space>
),
},
];
// 模糊查询匹配的样式
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(value, 'g'),
`<span style='color:red'>${value}</span>`,
);
} else {
n = val;
} }
const handleChange = e =>{ console.log(n);
setValue(e.target.value) return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
const placeholder = '请输入模板名称';
const handleSearch = value => {
setValue(value);
getTemplateList({ queryInfo: value });
setShowSearchStyle(true);
};
const handleReset = () => {
setCurrentType('全部');
getTemplateList();
setValue('');
setShowSearchStyle(false);
};
const handleChange = e => {
setValue(e.target.value);
};
const handleSelectType = value => {
if (value === '全部') {
setCurrentType('');
getTemplateList();
} else {
getTemplateList({ tempType: value });
setCurrentType(value);
} }
const handleSelectType = (value) => { };
if (value === '全部') { const changeDesc = record => {
getTemplateList() setCurrentTempalte(record);
handleShowModal('editVisible', true);
};
const AddTemplate = () => {
handleShowModal('addVisible', true);
};
const delTemplate = record => {
DeleteMessageTemplate({
id: record.Id,
}).then(res => {
if (res.code === 0) {
message.success('模板删除成功!');
setFlag(flag + 1);
} else {
message.warn('模板删除失败!');
}
});
};
// 弹出模态框
const handleShowModal = (key, value) => {
setvisibleParams({ ...visibleParams, [key]: value });
};
//编辑
const editModal = () => {
handleShowModal('editVisible', false);
};
const onSubmit = result => {
if (result.type == '企业微信') {
UpdateMessageTemplate({
Id: result.Id,
Type: result.type,
LikeName: result.name,
Name: result.third_name,
ParsingRules: result.analysis_params,
ParsingDescription: result.desc,
TParameters: result.params,
ParsingParams: result.param1,
WorkWeiXinId: result.weixin,
}).then(res => {
if (res.code === 0) {
message.success('模板保存成功!');
handleShowModal('editVisible', false);
setFlag(flag + 1);
} else { } else {
getTemplateList({ tempType: value }) message.warn('模板保存失败!');
} }
} });
const changeDesc = (record) => { } else {
setCurrentTempalte(record) UpdateMessageTemplate({
handleShowModal("editVisible", true) Id: result.Id,
} Type: result.type,
const AddTemplate = () => { LikeName: result.name,
handleShowModal("addVisible", true) Name: result.third_name,
} No: result.third_id,
const delTemplate = (record) => { ParsingRules: result.analysis_params,
DeleteMessageTemplate({ ParsingDescription: result.desc,
id: record.Id TParameters: result.params,
}).then( ParsingParams: result.param1,
res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
message.success("模板删除成功!") message.success('模板保存成功!');
setFlag(flag + 1) handleShowModal('editVisible', false);
} else { setFlag(flag + 1);
message.warn("模板删除失败!") } else {
} message.warn('模板保存失败!');
}
)
}
// 弹出模态框
const handleShowModal = (key, value) => {
setvisibleParams({ ...visibleParams, [key]: value });
};
//编辑
const editModal = () => {
handleShowModal("editVisible", false)
}
const onSubmit = (result) => {
if(result.type == '企业微信'){
UpdateMessageTemplate({
Id: result.Id,
Type: result.type,
LikeName: result.name,
Name: result.third_name,
ParsingRules: result.analysis_params,
ParsingDescription: result.desc,
TParameters: result.params,
ParsingParams: result.param1,
WorkWeiXinId: result.weixin
}).then(
res => {
if (res.code === 0) {
message.success("模板保存成功!")
handleShowModal("editVisible", false)
setFlag(flag + 1)
} else {
message.warn("模板保存失败!")
}
}
)
}else{
UpdateMessageTemplate({
Id: result.Id,
Type: result.type,
LikeName: result.name,
Name: result.third_name,
No: result.third_id,
ParsingRules: result.analysis_params,
ParsingDescription: result.desc,
TParameters: result.params,
ParsingParams: result.param1,
}).then(
res => {
if (res.code === 0) {
message.success("模板保存成功!")
handleShowModal("editVisible", false)
setFlag(flag + 1)
} else {
message.warn("模板保存失败!")
}
}
)
} }
});
} }
//新增 };
const addModal = () => { //新增
handleShowModal("editVisible", false) const addModal = () => {
} handleShowModal('editVisible', false);
const onAddSubmit = (result) => { };
if(result.type == '企业微信'){ const onAddSubmit = result => {
InsertMessageTemplate({ if (result.type == '企业微信') {
Type: result.type, InsertMessageTemplate({
LikeName: result.name, Type: result.type,
Name: result.third_name, LikeName: result.name,
ParsingRules: result.analysis_params, Name: result.third_name,
ParsingDescription: result.desc, ParsingRules: result.analysis_params,
TParameters: result.params, ParsingDescription: result.desc,
ParsingParams: result.param1, TParameters: result.params,
WorkWeiXinId: result.weixin ParsingParams: result.param1,
}).then( WorkWeiXinId: result.weixin,
res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
message.success("模板添加成功!") message.success('模板添加成功!');
handleShowModal("addVisible", false) handleShowModal('addVisible', false);
setFlag(flag + 1) setFlag(flag + 1);
} else { } else {
message.warn("模板添加失败!") message.warn('模板添加失败!');
} }
} });
) } else {
}else{ InsertMessageTemplate({
InsertMessageTemplate({ Type: result.type,
Type: result.type, LikeName: result.name,
LikeName: result.name, Name: result.third_name,
Name: result.third_name, No: result.third_id,
No: result.third_id, ParsingRules: result.analysis_params,
ParsingRules: result.analysis_params, ParsingDescription: result.desc,
ParsingDescription: result.desc, TParameters: result.params,
TParameters: result.params, ParsingParams: result.param1,
ParsingParams: result.param1, }).then(res => {
}).then( if (res.code === 0) {
res => { message.success('模板添加成功!');
if (res.code === 0) { handleShowModal('addVisible', false);
message.success("模板添加成功!") setFlag(flag + 1);
handleShowModal("addVisible", false) } else {
setFlag(flag + 1) message.warn('模板添加失败!');
} else {
message.warn("模板添加失败!")
}
}
)
} }
});
} }
};
const pagenation = { const pagenation = {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100], pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: '10', defaultPageSize: '10',
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
}; };
return ( return (
<div className={styles.template_container}> <div className={styles.template_container}>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div className={styles.operate_bar}> <div className={styles.operate_bar}>
<div className={styles.template_type}> <div className={styles.template_type}>
<div className={styles.title}>模板类型</div> <div className={styles.title}>模板类型</div>
<Select placeholder="请选择是否!" defaultValue="全部" style={{ width: "150px" }} onChange={handleSelectType} className={styles.select}> <Select
<Option value="全部">全部</Option> placeholder="请选择是否!"
<Option value="公众号">公众号</Option> value={currentType}
<Option value="短信">短信</Option> style={{ width: '150px' }}
<Option value="APP">APP</Option> onChange={handleSelectType}
<Option value="WEB">WEB</Option> className={styles.select}
<Option value="企业微信">企业微信</Option> >
</Select> <Option value="全部">全部</Option>
</div> <Option value="公众号">公众号</Option>
<div className={styles.fast_search}> <Option value="短信">短信</Option>
<div className={styles.title}>快速检索</div> <Option value="APP">APP</Option>
<Search <Option value="WEB">WEB</Option>
allowClear <Option value="企业微信">企业微信</Option>
placeholder={placeholder} </Select>
onSearch={handleSearch} </div>
onChange={e => handleChange(e)} <div className={styles.fast_search}>
enterButton <div className={styles.title}>快速检索</div>
style={{ width: "300px" }} <Search
value={value} allowClear
/> placeholder={placeholder}
</div> onSearch={handleSearch}
<Button type="primary" onClick={handleReset}>重置</Button> onChange={e => handleChange(e)}
enterButton
<Button type="primary" style={{ marginLeft: "10px" }} icon={<PlusCircleOutlined style={{ verticalAlign: "middle" }} />} onClick={AddTemplate}><span style={{ marginTop: "-3px" }}>新增</span></Button> style={{ width: '300px' }}
value={value}
/>
</div>
<Button type="primary" onClick={handleReset}>
重置
</Button>
</div> <Button
<div className={styles.list_view}> type="primary"
<Table style={{ marginLeft: '10px' }}
columns={columns} icon={<PlusCircleOutlined style={{ verticalAlign: 'middle' }} />}
dataSource={data} onClick={AddTemplate}
bordered >
pagination={pagenation} <span style={{ marginTop: '-3px' }}>新增</span>
scroll={{ y: '500px' }} </Button>
/> </div>
</div> <div className={styles.list_view}>
<EditModal <Table
visible={visibleParams.editVisible} columns={columns}
template={currentTemplate} dataSource={data}
onCancel={() => handleShowModal('editVisible', false)} bordered
option={option} pagination={pagenation}
confirmModal={editModal} scroll={{ y: '500px' }}
onSubmit={onSubmit} />
/>
<AddModal
visible={visibleParams.addVisible}
template={currentTemplate}
onCancel={() => handleShowModal('addVisible', false)}
option={option}
confirmModal={addModal}
onSubmit={onAddSubmit}
/>
</Spin>
</div> </div>
) <EditModal
} visible={visibleParams.editVisible}
export default TemplateManage; template={currentTemplate}
\ No newline at end of file onCancel={() => handleShowModal('editVisible', false)}
option={option}
confirmModal={editModal}
onSubmit={onSubmit}
/>
<AddModal
visible={visibleParams.addVisible}
template={currentTemplate}
onCancel={() => handleShowModal('addVisible', false)}
option={option}
confirmModal={addModal}
onSubmit={onAddSubmit}
/>
</Spin>
</div>
);
};
export default TemplateManage;
.redText {
.redText{ color: red;
color: red; cursor: pointer;
cursor: pointer;
} }
.ant-layout{ .ant-layout {
overflow: auto; overflow: auto;
.ant-layout-content{ .ant-layout-content {
margin:12px !important; margin: 12px !important;
} }
} }
.ant-btn > .anticon + span, .ant-btn > span + .anticon { .ant-btn > .anticon + span,
margin-left: 8px; .ant-btn > span + .anticon {
vertical-align: middle; margin-left: 8px;
vertical-align: middle;
} }
.siteTitle{ .siteTitle {
font-size: 16px; font-size: 16px;
margin: 0 0 6px 0; margin: 0 0 6px 0;
user-select: none; user-select: none;
padding: 3px; padding: 3px;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
} }
.userManageContainer{ .userManageContainer {
.ant-card-body{ .ant-card-body {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
}
.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;
}
.ant-form-item {
vertical-align: top;
}
.ant-form-item-label > label {
align-items: middle;
}
.ant-modal-body {
padding-bottom: 0px;
padding-right: 40px;
padding-left: 40px;
.ant-form {
width: 90%;
} }
.listItem{ }
display: flex; .anticon svg {
justify-content: space-between; margin-top: -3px;
font-size: 14px; }
font-weight: 400; .ant-popover-message {
color: #414E65; position: relative;
cursor: pointer; padding: 0px 0 0px;
line-height: 28px; color: rgba(0, 0, 0, 0.85);
align-items: center; font-size: 14px;
padding: 8px 14px; }
.ant-tree-treenode {
width: 100% !important;
.ant-tree-node-content-wrapper {
display: inline-block;
width: 100%;
} }
.pickItem{
background-color: #F5F6F9; .iconWraper1 {
float: right;
span {
display: none;
}
} }
.ant-form-item { }
vertical-align: top; .ant-tree-treenode:hover {
.iconWraper1 > span {
margin-left: 12px;
font-size: 18px;
display: inline-block;
} }
.ant-form-item-label > label { }
align-items:middle; .ant-radio-group {
margin: 0px !important;
}
.contentContainers {
display: flex;
width: 100%;
position: relative;
.ant-table.ant-table-bordered > .ant-table-container {
min-width: calc(100vw - 582px);
height: calc(100vh - 120px);
overflow-x: hidden;
border: none;
} }
.ant-modal-body{ .orgContainer {
padding-bottom:0px; height: calc(100vh - 74px);
padding-right:40px; width: 240px;
padding-left:40px; left: 0;
.ant-form{ top: 0;
width: 90%; overflow-x: hidden;
margin-right: 10px;
position: relative;
transition-property: width, left;
transition-duration: 0.5s;
white-space: nowrap;
.ant-tree {
padding-top: 6px;
.ant-tree-switcher {
line-height: 1;
margin-right: 0px !important;
color: #1890ff;
.ant-tree-switcher-line-icon {
margin-left: 5px;
}
} }
}
.switcher {
display: block;
position: absolute;
font-size: 18px;
color: #1890ff !important;
top: 50%;
right: 2px;
transform: translate(0%, -50%);
z-index: 1;
}
} }
.anticon svg {
margin-top: -3px;
}
.ant-popover-message {
position: relative;
padding: 0px 0 0px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
}
.ant-tree-treenode{
width: 100% !important;
.ant-tree-node-content-wrapper{
display: inline-block;
width: 100%;
}
.iconWraper1{ .orgContainerHide {
float: right; // transform: translateX(-230px);
span{ left: 0px;
display: none; top: 0;
} width: 26px;
}
}
.ant-tree-treenode:hover{
.iconWraper1>span{
margin-left: 12px;
font-size: 18px;
display: inline-block;
}
} }
.ant-radio-group { .ant-popover-message-title {
margin: 0px !important; padding-left: 20px;
} }
.contentContainers{ .userContainer {
display: flex; height: calc(100vh - 74px) !important;
width: 100%; z-index: 999;
position: relative; min-width: 800px;
.ant-table.ant-table-bordered > .ant-table-container { background: white;
min-width: calc(100vw - 582px); width: 100%;
height: calc(100vh - 120px); position: relative;
overflow-x: hidden; transition: width 0.5s;
border: none; .title {
} margin: 16px 0 10px 16px;
.orgContainer{ display: inline-block;
height: calc(100vh - 74px); width: 270px;
width: 240px; cursor: pointer;
left: 0; overflow: hidden;
top: 0; text-overflow: ellipsis;
overflow-x: hidden; white-space: nowrap;
margin-right: 10px; }
position: relative; .ant-table-pagination {
transition-property:width,left; padding-right: 12px;
transition-duration: 0.5s; background: white;
white-space: nowrap; margin: 1px 0;
.ant-tree{ padding: 8px;
padding-top: 6px; padding-right: 20px;
.ant-tree-switcher{ }
line-height: 1; .ant-btn {
margin-right: 0px !important; margin: 0px 10px;
color:#1890FF; .ant-btn-primary {
.ant-tree-switcher-line-icon{ background: #50aefc;
margin-left: 5px;
}
}
}
.switcher{
display: block;
position: absolute;
font-size: 18px;
color: #1890FF!important;
top: 50%;
right: 2px;
transform: translate(0%,-50%);
z-index: 1;
}
}
.orgContainerHide{
// transform: translateX(-230px);
left: 0px;
top: 0;
width: 26px;
}
.ant-popover-message-title {
padding-left: 20px;
}
.userContainer{
height: calc(100vh - 74px) !important;
z-index: 999;
min-width: 800px;
background: white;
width: 100%;
position: relative;
transition: width 0.5s;
.title{
margin: 16px 0 10px 16px;
display: inline-block;
width: 270px;
cursor: pointer;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding: 8px;
padding-right: 20px;
}
.ant-btn{
margin: 0px 10px;
.ant-btn-primary{
background: #50aefc;
}
}
.ant-input-search-button{
margin-left: 0px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-cell{
text-align:center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body{
height:calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle{
background: #cfe7fd;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
} }
}
.ant-input-search-button {
margin-left: 0px !important;
}
.ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
.ant-table-cell {
text-align: center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body {
height: calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle {
background: #cfe7fd;
}
.ant-pagination {
z-index: 999;
border-top: 1px solid #f0eded;
}
} }
}
} }
.ant-modal-root{ .ant-modal-root {
.ant-tree-switcher{ .ant-tree-switcher {
line-height: 1; line-height: 1;
color:#1890FF; color: #1890ff;
margin-right: 0px !important; margin-right: 0px !important;
} }
.ant-checkbox-group .ant-checkbox-group-item { .ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important; margin-right: 0px !important;
min-width: 270px !important; min-width: 200px !important;
} }
.ant-tree-list-holder{ .ant-tree-list-holder {
overflow: auto; overflow: auto;
overflow-x:hidden; overflow-x: hidden;
height: 40vh; height: 40vh;
} }
.ant-tabs-content-holder{ .ant-tabs-content-holder {
overflow: auto; overflow: auto;
height: 50vh; height: 50vh;
} }
} }
.ant-modal-content{ .ant-modal-content {
border-radius: 5px; border-radius: 5px;
}
.ant-modal-header{
border-radius: 5px 5px 0 0;
padding: 28px 40px;
} }
.ant-modal-close{ .ant-modal-header {
top:14px; border-radius: 5px 5px 0 0;
right:20px; padding: 28px 40px;
} }
.ant-modal-footer{ .ant-modal-close {
border:none; top: 14px;
padding: 28px 40px; right: 20px;
}
.ant-modal-footer {
border: none;
padding: 28px 40px;
} }
.ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) { .ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
margin-bottom: 0; margin-bottom: 0;
margin-left: 15px; margin-left: 15px;
} }
// .ant-form-horizontal .ant-form-item-control { // .ant-form-horizontal .ant-form-item-control {
// margin-left: 10px; // margin-left: 10px;
// } // }
.linkDrowp{ .linkDrowp {
position: absolute; position: absolute;
top: 0; top: 0;
left: 94.6%; left: 94.6%;
width: 1rem; width: 1rem;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
}
.title {
display: flex;
align-items: center;
width: 100%;
} }
.title{ .tip {
display: none;
}
.fs {
font-size: 18px;
margin-left: 10px;
}
.title:hover {
.tip {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end;
width: 100%; width: 100%;
} }
.tip{ }
display: none; .titleText {
} width: 12rem;
.fs{ overflow: hidden;
font-size: 18px; white-space: nowrap;
margin-left: 10px; text-overflow: ellipsis;
} }
.title:hover{ .ant-popover-inner {
.tip{ border-radius: 10px;
display: flex; background-color: rgba(255, 255, 255, 0.788);
align-items: center; }
justify-content: flex-end; .ant-popover-inner-content {
width: 100%; padding: 10px 10px;
} }
.ant-popover-message > .anticon {
top: 7.0005px;
}
.listCard {
display: flex;
.cardItem {
padding: 0.5rem;
} }
.titleText{ .cardContent {
width: 12rem; height: 30rem;
overflow:hidden; overflow-y: scroll;
white-space:nowrap; width: 19.5rem;
text-overflow:ellipsis;
} }
.ant-popover-inner { .cardItemData {
border-radius: 10px; padding: 1rem;
background-color: rgba(255, 255, 255, 0.788); border: 1px solid #b5b8c8;
margin-bottom: 1rem;
} }
.ant-popover-inner-content {
padding: 10px 10px;
} }
.sortable-ghost {
border-bottom: 2px dashed #1890ff;
.ant-popover-message > .anticon {
top: 7.0005px
} }
.listCard{
display: flex; .doctorTable {
.cardItem{ margin-bottom: 16px;
padding: 0.5rem; table {
width: 100%;
td {
padding: 6px;
border: 1px solid #e8e8e8;
} }
.cardContent{ thead {
height: 30rem; tr {
overflow-y: scroll; font-weight: 600;
width: 19.5rem; background: #fafafa;
}
} }
.cardItemData{ tbody {
padding: 1rem; tr:hover {
border: 1px solid #b5b8c8; background-color: #ededed;
margin-bottom: 1rem; }
} }
}
} }
.sortable-ghost { .formData {
border-bottom: 2px dashed #1890ff; height: calc(100vh - 170px);
overflow-y: scroll;
padding-right: 20px;
.ant-form-item-label
> label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
display: none;
} }
.formData_label {
.doctorTable { display: flex;
margin-bottom: 16px; align-items: center;
table {
width: 100%;
td {
padding: 6px;
border: 1px solid #e8e8e8;
}
thead {
tr {
font-weight: 600;
background: #FAFAFA;
}
}
tbody{
tr:hover{
background-color:#ededed ;
}
}
}
} }
.formData{ .filed_listItem {
height: calc(100vh - 170px); display: flex;
overflow-y: scroll; height: 3.6rem;
padding-right: 20px; .ant-btn-icon-only {
.ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before{ width: 32px;
display: none; height: 32px;
} /* padding: 2.4px 0; */
.formData_label{ font-size: 16px;
display: flex; border-radius: 2px;
align-items: center; vertical-align: -1px;
} display: flex;
.filed_listItem{ align-items: center;
display: flex; justify-content: center;
height: 3.6rem;
.ant-btn-icon-only {
width: 32px;
height: 32px;
/* padding: 2.4px 0; */
font-size: 16px;
border-radius: 2px;
vertical-align: -1px;
display: flex;
align-items: center;
justify-content: center;
}
} }
}
} }
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable default-case */
/* eslint-disable react/jsx-no-undef */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
Row, Row,
...@@ -404,7 +407,7 @@ const videoManager = () => { ...@@ -404,7 +407,7 @@ const videoManager = () => {
rowKey={record => record.Id} rowKey={record => record.Id}
columns={columns} columns={columns}
dataSource={tableData} dataSource={tableData}
scroll={{ y: 'calc(100vh - 210px)' }} scroll={{ y: 'calc(100vh - 210px)', x: 'max-content' }}
onRow={record => ({ onRow={record => ({
onDoubleClick: event => { onDoubleClick: event => {
event.stopPropagation(); event.stopPropagation();
......
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
line-height: 1; line-height: 1;
} }
.ant-dropdown-menu-item>.anticon:first-child { .ant-dropdown-menu-item > .anticon:first-child {
vertical-align: 0.15em !important; vertical-align: 0.15em !important;
} }
.ant-table-tbody { .ant-table-tbody {
.ant-table-row:hover>td { .ant-table-row:hover > td {
background: #aed8fa !important; background: #aed8fa !important;
} }
} }
...@@ -87,10 +87,10 @@ ...@@ -87,10 +87,10 @@
} }
.siteManageContainer { .siteManageContainer {
.ant-card-body{ .ant-card-body {
padding: 15px; padding: 15px;
} }
.ant-spin-container{ .ant-spin-container {
overflow-y: scroll; overflow-y: scroll;
height: calc(100vh - 410px); height: calc(100vh - 410px);
} }
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
} }
.ant-tree-treenode:hover { .ant-tree-treenode:hover {
.iconWraper1>span { .iconWraper1 > span {
margin-left: 12px; margin-left: 12px;
font-size: 18px; font-size: 18px;
display: inline-block; display: inline-block;
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
.ant-tree-switcher { .ant-tree-switcher {
line-height: 1; line-height: 1;
margin-right: 0px !important; margin-right: 0px !important;
color: #1890FF; color: #1890ff;
.ant-tree-switcher-line-icon { .ant-tree-switcher-line-icon {
margin-left: 5px; margin-left: 5px;
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
display: block; display: block;
position: absolute; position: absolute;
font-size: 18px; font-size: 18px;
color: #1890FF !important; color: #1890ff !important;
top: 45%; top: 45%;
right: 2px; right: 2px;
transform: translate(0%, -50%); transform: translate(0%, -50%);
...@@ -238,7 +238,6 @@ ...@@ -238,7 +238,6 @@
} }
} }
//机构编辑面板 //机构编辑面板
.boxR { .boxR {
width: 100%; width: 100%;
...@@ -250,11 +249,9 @@ ...@@ -250,11 +249,9 @@
min-height: calc(100vh - 210px); min-height: calc(100vh - 210px);
max-height: calc(100vh - 210px); max-height: calc(100vh - 210px);
min-width: 600px; min-width: 600px;
} }
.siteCheckbox .ant-collapse-content > .ant-collapse-content-box {
.siteCheckbox .ant-collapse-content>.ant-collapse-content-box {
padding: 16px 16px 0; padding: 16px 16px 0;
} }
...@@ -269,7 +266,7 @@ ...@@ -269,7 +266,7 @@
.siteListTitle { .siteListTitle {
width: 199px; width: 199px;
// margin:0 0 15px 0; // margin:0 0 15px 0;
padding: 0 0 0 15px; padding: 0 0 0 15px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -301,8 +298,8 @@ ...@@ -301,8 +298,8 @@
overflow: auto; overflow: auto;
} }
.sitePanel .ant-checkbox-wrapper+.ant-checkbox-wrapper { .sitePanel .ant-checkbox-wrapper + .ant-checkbox-wrapper {
margin: 0 margin: 0;
} }
.siteIcon { .siteIcon {
...@@ -315,7 +312,7 @@ ...@@ -315,7 +312,7 @@
} }
.siteColor { .siteColor {
color: #f00 color: #f00;
} }
.siteCommit { .siteCommit {
...@@ -326,7 +323,7 @@ ...@@ -326,7 +323,7 @@
border: 1px solid #f5f5f5; border: 1px solid #f5f5f5;
max-height: 120px; max-height: 120px;
overflow: auto; overflow: auto;
margin-bottom:20px; margin-bottom: 20px;
.siteSelectUl { .siteSelectUl {
margin: 0; margin: 0;
...@@ -338,9 +335,10 @@ ...@@ -338,9 +335,10 @@
li { li {
height: 35px; height: 35px;
line-height: 35px; line-height: 35px;
background: rgba(24, 144, 255, 0.16) url('../../../assets/images/icons/close.png') no-repeat 170px; background: rgba(24, 144, 255, 0.16)
url('../../../assets/images/icons/close.png') no-repeat 170px;
background-size: 20px; background-size: 20px;
background-position:center right; background-position: center right;
margin: 0 10px 10px 0; margin: 0 10px 10px 0;
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
...@@ -352,8 +350,6 @@ ...@@ -352,8 +350,6 @@
} }
.siteline { .siteline {
} }
.siteBtn { .siteBtn {
...@@ -367,13 +363,13 @@ ...@@ -367,13 +363,13 @@
.ant-modal-root { .ant-modal-root {
.ant-tree-switcher { .ant-tree-switcher {
line-height: 1; line-height: 1;
color: #1890FF; color: #1890ff;
margin-right: 0px !important; margin-right: 0px !important;
} }
.ant-checkbox-group .ant-checkbox-group-item { .ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important; margin-right: 0px !important;
min-width: 270px !important; min-width: 200px !important;
} }
.ant-tree-list-holder { .ant-tree-list-holder {
...@@ -387,35 +383,35 @@ ...@@ -387,35 +383,35 @@
height: 50vh; height: 50vh;
} }
} }
.title{ .title {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: 100%;
} }
.tip{ .tip {
display: none; display: none;
} }
.title:hover{ .title:hover {
.tip{ .tip {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
width: 100%; width: 100%;
} }
} }
.titleText{ .titleText {
width: 12rem; width: 12rem;
overflow:hidden; overflow: hidden;
white-space:nowrap; white-space: nowrap;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
.fs{ .fs {
font-size: 18px; font-size: 18px;
margin-left: 10px; margin-left: 10px;
} }
.titleTop{ .titleTop {
width: 12rem; width: 12rem;
overflow:hidden; overflow: hidden;
white-space:nowrap; white-space: nowrap;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ const EditOrgModal = props => { ...@@ -31,7 +31,7 @@ const EditOrgModal = props => {
'', '',
) )
.then(res => { .then(res => {
if (res.msg==='') { if (res.code === 0) {
onCancel(); onCancel();
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
...@@ -44,7 +44,7 @@ const EditOrgModal = props => { ...@@ -44,7 +44,7 @@ const EditOrgModal = props => {
} else { } else {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
description: res.message, description: res.msg,
}); });
} }
}) })
......
/* eslint-disable eqeqeq */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
// Tree, // Tree,
...@@ -47,6 +48,7 @@ import { ...@@ -47,6 +48,7 @@ import {
getOneOUUserListNew, getOneOUUserListNew,
getUserRelationList, getUserRelationList,
getUserTree, getUserTree,
// eslint-disable-next-line import/named
deleteUser as postDeleteUser, deleteUser as postDeleteUser,
setUserState as postSetUserState, setUserState as postSetUserState,
multiDeleteUsers, multiDeleteUsers,
...@@ -56,16 +58,10 @@ import { ...@@ -56,16 +58,10 @@ import {
GetOUTreeNew, GetOUTreeNew,
GetUserRelationListNew, GetUserRelationListNew,
GetUserByKeyNew, GetUserByKeyNew,
AddUserNew,
AddOUNew,
EditOneOUInfoNew,
EditUserNew,
UserStateOUNew, UserStateOUNew,
DeleteOUNew,
SetUserRelationListNew,
JumpToAnotherOUNew, JumpToAnotherOUNew,
DeleteUserNew, DeleteUserNew,
loadAllUserRole loadAllUserRole,
} from '@/services/userCenter/userManage/api'; } from '@/services/userCenter/userManage/api';
import { AddUserAuthSetting, GetUserAuthSet } from '@/services/database/api'; import { AddUserAuthSetting, GetUserAuthSet } from '@/services/database/api';
import Tree from '@/components/ExpendableTree'; import Tree from '@/components/ExpendableTree';
...@@ -134,9 +130,9 @@ const UserManage = () => { ...@@ -134,9 +130,9 @@ const UserManage = () => {
const [newOrgID, setNewOrgID] = useState(); // 更改机构新选择的ID const [newOrgID, setNewOrgID] = useState(); // 更改机构新选择的ID
const [currentUser, setCurrentUser] = useState({}); // 当前用户 const [currentUser, setCurrentUser] = useState({}); // 当前用户
const [mult, setMult] = useState('')//判断是否是批量关联 const [mult, setMult] = useState(''); // 判断是否是批量关联
const [multiRoleList, setMultiRoleList] = useState([]) const [multiRoleList, setMultiRoleList] = useState([]);
const [multistationList, setMultiStationList] = useState([]) const [multistationList, setMultiStationList] = useState([]);
const [userIDs, setUserIDs] = useState(''); // 批量删除的用户 const [userIDs, setUserIDs] = useState(''); // 批量删除的用户
const [orgIDs, setOrgIDs] = useState(''); // 批量操作的机构 const [orgIDs, setOrgIDs] = useState(''); // 批量操作的机构
const [multiDelete, setMultiDelete] = useState(false); // 是否批量删除用户 const [multiDelete, setMultiDelete] = useState(false); // 是否批量删除用户
...@@ -391,7 +387,7 @@ const UserManage = () => { ...@@ -391,7 +387,7 @@ const UserManage = () => {
selectedRowKeys, selectedRowKeys,
onChange: (RowKeys, Rows) => { onChange: (RowKeys, Rows) => {
setSelectedRowKeys(RowKeys); setSelectedRowKeys(RowKeys);
getCheckList(RowKeys) getCheckList(RowKeys);
setUserIDs(RowKeys.toString()); // 数组转字符串,逗号连接 setUserIDs(RowKeys.toString()); // 数组转字符串,逗号连接
setOrgIDs(Rows.map(item => item.OUID).toString()); setOrgIDs(Rows.map(item => item.OUID).toString());
// 选中行数大于0时设置批量操作可行 // 选中行数大于0时设置批量操作可行
...@@ -414,7 +410,7 @@ const UserManage = () => { ...@@ -414,7 +410,7 @@ const UserManage = () => {
<span className={styles.titleText}>{org.text}</span> <span className={styles.titleText}>{org.text}</span>
<span className={styles.tip1}> <span className={styles.tip1}>
<Tooltip title="" className={styles.fs1}> <Tooltip title="" className={styles.fs1}>
<Dropdown overlay={orgButtonMenu} > <Dropdown overlay={orgButtonMenu}>
<PlusOutlined <PlusOutlined
style={{ marginLeft: 20 }} style={{ marginLeft: 20 }}
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
...@@ -427,7 +423,7 @@ const UserManage = () => { ...@@ -427,7 +423,7 @@ const UserManage = () => {
</Dropdown> </Dropdown>
</Tooltip> </Tooltip>
<Dropdown overlay={orgButtonMenu1} > <Dropdown overlay={orgButtonMenu1}>
<EllipsisOutlined <EllipsisOutlined
style={{ marginLeft: 10, fontSize: '20px' }} style={{ marginLeft: 10, fontSize: '20px' }}
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
...@@ -533,10 +529,10 @@ const UserManage = () => { ...@@ -533,10 +529,10 @@ const UserManage = () => {
const onSelect = (props, e) => { const onSelect = (props, e) => {
console.log(e); console.log(e);
console.log(props); console.log(props);
console.log(props[0]) console.log(props[0]);
console.log(props[0].id) console.log(props[0].id);
if(props[0].id!=undefined){ if (props[0].id !== undefined) {
props[0]=props[0].id props[0] = props[0].id;
} }
setKeep1(props); setKeep1(props);
console.log(keep1); console.log(keep1);
...@@ -563,11 +559,10 @@ const UserManage = () => { ...@@ -563,11 +559,10 @@ const UserManage = () => {
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
console.log(res); console.log(res);
if(res.code.MapRange!=null){ if (res.code.MapRange != null) {
setCurrentOrgArea(res.data.MapRange); setCurrentOrgArea(res.data.MapRange);
setCurrentOrgDistinct(res.data.AreeName); setCurrentOrgDistinct(res.data.AreeName);
} }
} }
}); });
setOrgID(props[0] || currentSelectOrg); setOrgID(props[0] || currentSelectOrg);
...@@ -689,7 +684,7 @@ const UserManage = () => { ...@@ -689,7 +684,7 @@ const UserManage = () => {
/** ***用户批量操作****** */ /** ***用户批量操作****** */
// 关联角色 // 关联角色
const relateRoles = () => { const relateRoles = () => {
setMult('Yes') setMult('Yes');
getEmptyRoleList(); getEmptyRoleList();
// getCheckList() // getCheckList()
setRoleVisible(true); setRoleVisible(true);
...@@ -710,9 +705,9 @@ const UserManage = () => { ...@@ -710,9 +705,9 @@ const UserManage = () => {
// 关联角色 // 关联角色
const relateRole = record => { const relateRole = record => {
// getEmptyRoleList(record.userID); // getEmptyRoleList(record.userID);
setMult('No') setMult('No');
console.log(record) console.log(record);
getRoleList(record) getRoleList(record);
setRoleVisible(true); setRoleVisible(true);
setCurrentUser(record); setCurrentUser(record);
setSelectColor(record); setSelectColor(record);
...@@ -823,7 +818,7 @@ const UserManage = () => { ...@@ -823,7 +818,7 @@ const UserManage = () => {
GetUserAuthSet({ GetUserAuthSet({
UserId: record.userID, UserId: record.userID,
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code === 0) {
setSelctValue(res.data); setSelctValue(res.data);
console.log(res.data); console.log(res.data);
} }
...@@ -917,16 +912,16 @@ const UserManage = () => { ...@@ -917,16 +912,16 @@ const UserManage = () => {
// }); // });
GetUserRelationListNew({ userID: e.userID }) GetUserRelationListNew({ userID: e.userID })
.then(res => { .then(res => {
console.log(111) console.log(111);
if (res.code === 0) { if (res.code === 0) {
const { roleList, stationList } = res.data; const { roleList, stationList } = res.data;
console.log(roleList) console.log(roleList);
setRolelist(roleList); setRolelist(roleList);
setStationlist(stationList); setStationlist(stationList);
setLoading(false); setLoading(false);
} else { } else {
console.log(res) console.log(res);
setLoading(false); setLoading(false);
} }
}) })
...@@ -958,16 +953,16 @@ const UserManage = () => { ...@@ -958,16 +953,16 @@ const UserManage = () => {
// setTableLoading(false); // setTableLoading(false);
// message.error(err); // message.error(err);
// }); // });
GetUserRelationListNew({ userID: 0}) GetUserRelationListNew({ userID: 0 })
.then(res => { .then(res => {
console.log(222) console.log(222);
if (res.code === 0) { if (res.code === 0) {
const { roleList, stationList } = res.data; const { roleList, stationList } = res.data;
setRolelist(roleList); setRolelist(roleList);
setStationlist(stationList); setStationlist(stationList);
setLoading(false); setLoading(false);
} else { } else {
console.log(res.msg) console.log(res.msg);
setLoading(false); setLoading(false);
} }
}) })
...@@ -978,29 +973,30 @@ const UserManage = () => { ...@@ -978,29 +973,30 @@ const UserManage = () => {
}); });
}; };
const getCheckList = e =>{ const getCheckList = e => {
let aa = [] let aa = [];
let bb = [] let bb = [];
loadAllUserRole(e).then(res =>{ loadAllUserRole(e).then(res => {
if(res.code === 0){ if (res.code === 0) {
if(res.data.roleList != undefined){ if (res.data.roleList !== undefined) {
Object.keys(res.data.roleList).map((item,index)=>{ // eslint-disable-next-line array-callback-return
aa.push(item) Object.keys(res.data.roleList).map((item, index) => {
}) aa.push(item);
});
} }
if(res.data.siteList != undefined){ if (res.data.siteList !== undefined) {
Object.keys(res.data.siteList).map((item1,index1)=>{ // eslint-disable-next-line array-callback-return
bb.push(item1) Object.keys(res.data.siteList).map((item1, index1) => {
}) bb.push(item1);
});
} }
console.log(aa) console.log(aa);
console.log(bb) console.log(bb);
setMultiRoleList(aa) setMultiRoleList(aa);
setMultiStationList(bb) setMultiStationList(bb);
} }
});
}) };
}
// 提交-更改机构 // 提交-更改机构
const submitChangeOrg = () => { const submitChangeOrg = () => {
// addToOrg(currentUser.userID, currentUser.OUID, newOrgID) // addToOrg(currentUser.userID, currentUser.OUID, newOrgID)
...@@ -1246,33 +1242,31 @@ const UserManage = () => { ...@@ -1246,33 +1242,31 @@ const UserManage = () => {
setTreeLoading(true); setTreeLoading(true);
console.log(extent); console.log(extent);
console.log(areaName); console.log(areaName);
console.log(flag) console.log(flag);
console.log(currentSelectOrg1); console.log(currentSelectOrg1);
if(flag == 0){ if (flag === 0) {
setTreeLoading(false); setTreeLoading(false);
notification.warn({ notification.warn({
message: '提交失败', message: '提交失败',
description: '请框选范围', description: '请框选范围',
}); });
}else{ } else if (extent) {
if (extent) { setOrgArea({
setOrgArea({ OUID: currentSelectOrg1,
OUID: currentSelectOrg1, areaName,
areaName, extent,
extent, }).then(res => {
}).then(res => { if (res.msg === '') {
if (res.msg === '') { setTreeLoading(false);
setTreeLoading(false); setEditOrgExtentVisible(false);
setEditOrgExtentVisible(false); setSaveExtentFlag(saveExtentFlag + 1);
setSaveExtentFlag(saveExtentFlag + 1); message.success('机构范围设置成功!');
message.success('机构范围设置成功!'); } else {
} else { setTreeLoading(false);
setTreeLoading(false); setEditOrgExtentVisible(false);
setEditOrgExtentVisible(false); message.warn(res.Message);
message.warn(res.Message); }
} });
});
}
} }
}; };
...@@ -1467,7 +1461,7 @@ const UserManage = () => { ...@@ -1467,7 +1461,7 @@ const UserManage = () => {
visible={userVisible} visible={userVisible}
orgID={orgID} orgID={orgID}
onCancel={kee} onCancel={kee}
onSelect={()=>onSelect([orgID])} onSelect={() => onSelect([orgID])}
/> />
{/* 添加下级机构 */} {/* 添加下级机构 */}
<AddSubOrgModal <AddSubOrgModal
...@@ -1491,7 +1485,7 @@ const UserManage = () => { ...@@ -1491,7 +1485,7 @@ const UserManage = () => {
/> />
{/* 删除机构 */} {/* 删除机构 */}
<DeleteOrgModal <DeleteOrgModal
title='删除机构' title="删除机构"
visible={deleteOrgVisible} visible={deleteOrgVisible}
orgTitle={orgTitle1} orgTitle={orgTitle1}
orgID={orgID} orgID={orgID}
......
:global{ :global {
::-webkit-scrollbar { ::-webkit-scrollbar {
height: 6px;//x轴滚动条粗细 height: 6px; //x轴滚动条粗细
width:6px;//y轴滚动条粗细 width: 6px; //y轴滚动条粗细
border-bottom: 2px solid white; border-bottom: 2px solid white;
} }
//滚动条里面的小方块,能上下左右移动(取决于是垂直滚动条还是水平滚动条) //滚动条里面的小方块,能上下左右移动(取决于是垂直滚动条还是水平滚动条)
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
border-radius: 10px; border-radius: 10px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1); box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
background: rgba(74, 74, 75, 0.3); background: rgba(74, 74, 75, 0.3);
margin-bottom: 10px; margin-bottom: 10px;
} }
//滚动条的轨道(里面装有thumb)滚动槽 //滚动条的轨道(里面装有thumb)滚动槽
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
box-shadow: 0; box-shadow: 0;
border-radius: 0; border-radius: 0;
background: white;//滚动槽背景色 background: white; //滚动槽背景色
border-radius: 10px;//滚动条边框半径设置 border-radius: 10px; //滚动条边框半径设置
} }
.ant-tree-node-content-wrapper{ .ant-tree-node-content-wrapper {
width:100%; width: 100%;
overflow: hidden !important; overflow: hidden !important;
.ant-tree-title{ .ant-tree-title {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
display: flex !important; display: flex !important;
justify-content: space-between; justify-content: space-between;
}
}
.ant-pagination-prev,.ant-pagination-next{
line-height: 8px !important;
}
.ant-input-search-button{
line-height: 1;
}
.ant-dropdown-menu-item > .anticon:first-child {
vertical-align: 0.15em !important;
}
.ant-table-tbody{
.ant-table-row:hover>td{
background: #aed8fa !important;
}
}
.ant-modal-close-icon {
vertical-align: 0.3em;
}
.ant-notification-close-icon{
vertical-align: 0.2em;
}
.ant-tree-switcher-icon svg{
font-size: 14px;
color: #767777 !important;
} }
.ant-card-body { }
padding: 12px 24px 24px 10px; .ant-pagination-prev,
.ant-pagination-next {
line-height: 8px !important;
}
.ant-input-search-button {
line-height: 1;
}
.ant-dropdown-menu-item > .anticon:first-child {
vertical-align: 0.15em !important;
}
.ant-table-tbody {
.ant-table-row:hover > td {
background: #aed8fa !important;
} }
}
.ant-modal-close-icon {
vertical-align: 0.3em;
}
.ant-notification-close-icon {
vertical-align: 0.2em;
}
.ant-tree-switcher-icon svg {
font-size: 14px;
color: #767777 !important;
}
.ant-card-body {
padding: 12px 24px 24px 10px;
}
} }
.redText{ .redText {
color: red; color: red;
cursor: pointer; cursor: pointer;
} }
.ant-layout{ .ant-layout {
overflow: auto; overflow: auto;
.ant-layout-content{ .ant-layout-content {
margin:12px !important; margin: 12px !important;
} }
} }
.ant-btn > .anticon + span, .ant-btn > span + .anticon { .ant-btn > .anticon + span,
margin-left: 8px; .ant-btn > span + .anticon {
vertical-align: middle; margin-left: 8px;
vertical-align: middle;
} }
.siteTitle{ .siteTitle {
font-size: 16px; font-size: 16px;
margin: 0 0 6px 0; margin: 0 0 6px 0;
user-select: none; user-select: none;
padding: 3px; padding: 3px;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
} }
.userManageContainer{ .userManageContainer {
.ant-modal-footer{ .ant-modal-footer {
border:none; border: none;
padding: 28px 40px; padding: 28px 40px;
} }
.ant-form-item { .ant-form-item {
vertical-align: top; vertical-align: top;
}
.ant-form-item-label > label {
align-items: middle;
}
.ant-modal-body {
padding-bottom: 0px;
padding-right: 40px;
padding-left: 40px;
.ant-form {
width: 90%;
} }
.ant-form-item-label > label { }
align-items:middle; .anticon svg {
margin-top: -3px;
}
.ant-popover-message {
position: relative;
padding: 0px 0 0px;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
}
.ant-tree-treenode {
width: 100% !important;
.ant-tree-node-content-wrapper {
display: inline-block;
width: 100%;
} }
.ant-modal-body{
padding-bottom:0px; .iconWraper1 {
padding-right:40px; float: right;
padding-left:40px; span {
.ant-form{ display: none;
width: 90%; }
}
} }
.anticon svg { }
margin-top: -3px; .ant-tree-treenode:hover {
.iconWraper1 > span {
margin-left: 12px;
font-size: 18px;
display: inline-block;
} }
.ant-popover-message { }
position: relative; .ant-radio-group {
padding: 0px 0 0px; margin: 0px !important;
color: rgba(0, 0, 0, 0.85); }
font-size: 14px; .contentContainer {
display: flex;
width: 100%;
position: relative;
.ant-table.ant-table-bordered > .ant-table-container {
min-width: calc(100vw - 582px);
} }
.ant-tree-treenode{ .orgContainer {
width: 100% !important; height: calc(100vh - 74px);
.ant-tree-node-content-wrapper{ width: 340px;
display: inline-block; left: 0;
width: 100%; top: 0;
overflow-x: hidden;
margin-right: 10px;
position: relative;
transition-property: width, left;
transition-duration: 0.5s;
white-space: nowrap;
.ant-tree {
padding-top: 6px;
.ant-tree-switcher {
line-height: 1;
margin-right: 0px !important;
color: #1890ff;
.ant-tree-switcher-line-icon {
margin-left: 5px;
}
} }
}
.switcher {
display: block;
position: absolute;
font-size: 18px;
color: #1890ff !important;
top: 50%;
right: 2px;
transform: translate(0%, -50%);
z-index: 1;
}
}
.iconWraper1{ .orgContainerHide {
float: right; // transform: translateX(-230px);
span{ left: 0px;
display: none; top: 0;
} width: 26px;
}
} }
.ant-tree-treenode:hover{ .ant-popover-message-title {
.iconWraper1>span{ padding-left: 20px;
margin-left: 12px; }
font-size: 18px; .title1 {
display: inline-block; display: flex;
} align-items: center;
width: 100%;
} }
.ant-radio-group { .tip1 {
margin: 0px !important; display: none;
} }
.contentContainer{ .fs1 {
font-size: 18px;
margin-left: 10px;
}
.title1:hover {
.tip1 {
display: flex; display: flex;
align-items: center;
justify-content: flex-end;
width: 100%; width: 100%;
position: relative; }
.ant-table.ant-table-bordered > .ant-table-container { }
min-width: calc(100vw - 582px); .titleText {
} width: 12rem;
.orgContainer{ overflow: hidden;
height: calc(100vh - 74px); white-space: nowrap;
width: 340px; text-overflow: ellipsis;
left: 0; }
top: 0; .userContainer {
overflow-x: hidden; height: calc(100vh - 74px) !important;
margin-right: 10px; z-index: 999;
position: relative; min-width: 800px;
transition-property:width,left; background: white;
transition-duration: 0.5s; width: 100%;
white-space: nowrap; position: relative;
.ant-tree{ transition: width 0.5s;
padding-top: 6px; .title {
.ant-tree-switcher{ margin: 16px 0 10px 16px;
line-height: 1; display: inline-block;
margin-right: 0px !important; // width: 270px;
color:#1890FF; cursor: pointer;
.ant-tree-switcher-line-icon{ overflow: hidden;
margin-left: 5px; text-overflow: ellipsis;
} white-space: nowrap;
} }
} .ant-table-pagination {
.switcher{ padding-right: 12px;
display: block; background: white;
position: absolute; margin: 1px 0;
font-size: 18px; padding: 8px;
color: #1890FF!important; padding-right: 20px;
top: 50%; }
right: 2px; .ant-btn {
transform: translate(0%,-50%); margin: 0px 10px;
z-index: 1; .ant-btn-primary {
} background: #50aefc;
}
.orgContainerHide{
// transform: translateX(-230px);
left: 0px;
top: 0;
width: 26px;
}
.ant-popover-message-title {
padding-left: 20px;
}
.title1{
display: flex;
align-items: center;
width: 100%;
}
.tip1{
display: none;
}
.fs1{
font-size: 18px;
margin-left: 10px;
}
.title1:hover{
.tip1{
display: flex;
align-items: center;
justify-content: flex-end;
width: 100%;
}
}
.titleText{
width: 12rem;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
}
.userContainer{
height: calc(100vh - 74px) !important;
z-index: 999;
min-width: 800px;
background: white;
width: 100%;
position: relative;
transition: width 0.5s;
.title{
margin: 16px 0 10px 16px;
display: inline-block;
// width: 270px;
cursor: pointer;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding: 8px;
padding-right: 20px;
}
.ant-btn{
margin: 0px 10px;
.ant-btn-primary{
background: #50aefc;
}
}
.ant-input-search-button{
margin-left: 0px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-cell{
text-align:center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body{
height:calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle{
background: #cfe7fd;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
} }
}
.ant-input-search-button {
margin-left: 0px !important;
}
.ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
.ant-table-cell {
text-align: center;
overflow: hidden;
// text-overflow:ellipsis;
white-space: nowrap;
}
.ant-table-body {
height: calc(100vh - 210px);
border-right: white;
overflow: auto !important;
}
.clickRowStyle {
background: #cfe7fd;
}
.ant-pagination {
z-index: 999;
border-top: 1px solid #f0eded;
}
} }
} }
.ant-modal-root{ .ant-modal-root {
.ant-tree-switcher{ .ant-tree-switcher {
line-height: 1; line-height: 1;
color:#1890FF; color: #1890ff;
margin-right: 0px !important; margin-right: 0px !important;
} }
.ant-checkbox-group .ant-checkbox-group-item { .ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important; margin-right: 0px !important;
min-width: 270px !important; min-width: 200px !important;
} }
.ant-tree-list-holder{ .ant-tree-list-holder {
overflow: auto; overflow: auto;
overflow-x:hidden; overflow-x: hidden;
height: 40vh; height: 40vh;
} }
.ant-tabs-content-holder{ .ant-tabs-content-holder {
overflow: auto; overflow: auto;
height: 50vh; height: 50vh;
} }
}
} }
.ant-modal-content{ .ant-modal-content {
border-radius: 5px; border-radius: 5px;
} }
.ant-modal-header{ .ant-modal-header {
border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0;
padding: 28px 40px; padding: 28px 40px;
} }
.ant-modal-close{ .ant-modal-close {
top:14px; top: 14px;
right:20px; right: 20px;
} }
.ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) { .ant-modal-footer .ant-btn + .ant-btn:not(.ant-dropdown-trigger) {
margin-bottom: 0; margin-bottom: 0;
margin-left: 15px; margin-left: 15px;
} }
// .ant-form-horizontal .ant-form-item-control { // .ant-form-horizontal .ant-form-item-control {
// margin-left: 10px; // margin-left: 10px;
// } // }
.ant-popover-inner { .ant-popover-inner {
border-radius: 10px; border-radius: 10px;
background-color: rgba(255, 255, 255, 0.788); background-color: rgba(255, 255, 255, 0.788);
}
} .ant-popover-inner-content {
.ant-popover-inner-content { padding: 10px 10px;
padding: 10px 10px;
} }
.ant-popover-message > .anticon {
.ant-popover-message > .anticon { top: 7.0005px;
top: 7.0005px
} }
// .ant-tree { // .ant-tree {
// overflow-y: scroll; // overflow-y: scroll;
// height: calc(100vh - 150px); // height: calc(100vh - 150px);
// } // }
/* eslint-disable array-callback-return */
/* eslint-disable no-plusplus */
/* eslint-disable consistent-return */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { notification, Tooltip, Modal, Spin, Empty } from 'antd'; import { notification, Tooltip, Modal, Spin, Empty } from 'antd';
import Tree from '@/components/ExpendableTree'; import Tree from '@/components/ExpendableTree';
...@@ -396,6 +399,7 @@ const MiniMenu = props => { ...@@ -396,6 +399,7 @@ const MiniMenu = props => {
}; };
// 树的拖动 // 树的拖动
const handleDrop = infos => { const handleDrop = infos => {
console.log(infos);
const dropKey = infos.node.key; const dropKey = infos.node.key;
const dragKey = infos.dragNode.key; const dragKey = infos.dragNode.key;
const dropPos = infos.node.pos.split('-'); const dropPos = infos.node.pos.split('-');
......
/* eslint-disable import/no-unresolved */
import React from 'react'; import React from 'react';
import { import {
DatabaseOutlined, DatabaseOutlined,
......
...@@ -100,7 +100,7 @@ export const addToOrgs = (userIDs, orgIDs, newOrgID) => ...@@ -100,7 +100,7 @@ export const addToOrgs = (userIDs, orgIDs, newOrgID) =>
export const updateUserPassword = params => export const updateUserPassword = params =>
post(`${PUBLISH_SERVICE}/UserCenter/UpdateUserPassword`, params); post(`${PUBLISH_SERVICE}/UserCenter/UpdateUserPassword`, params);
//批量获取用户角色和机构 // 批量获取用户角色和机构
export const loadAllUserRole = params => export const loadAllUserRole = params =>
post(`${PUBLISH_SERVICE}/UserCenter/LoadAllUserRole`, params); post(`${PUBLISH_SERVICE}/UserCenter/LoadAllUserRole`, params);
...@@ -143,7 +143,7 @@ export const setUserRelation = (userID, roleList = [], stationList) => ...@@ -143,7 +143,7 @@ export const setUserRelation = (userID, roleList = [], stationList) =>
}, },
); );
export const SetUserRelationList = (userID, roleList = [], stationList) => export const SetUserRelationList = (userID, roleList = [], stationList) =>
post(`${PUBLISH_SERVICE}/UserCenter/SetUserRelationList`,{ post(`${PUBLISH_SERVICE}/UserCenter/SetUserRelationList`, {
userID, userID,
roleList: roleList.length ? `${roleList.join(',')},` : '', roleList: roleList.length ? `${roleList.join(',')},` : '',
stationList: stationList.length ? `${stationList.join(',')},` : '', stationList: stationList.length ? `${stationList.join(',')},` : '',
......
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