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