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

事件权限交互重构

parent 2565e509
...@@ -130,7 +130,7 @@ const AddFlowsModal = props => { ...@@ -130,7 +130,7 @@ const AddFlowsModal = props => {
let a1 = []; let a1 = [];
let a2; let a2;
let a3 = []; let a3 = [];
initialArr.map(i => { initialArr.data.map(i => {
// console.log(i.groupType) // console.log(i.groupType)
a2 = i.groupType; a2 = i.groupType;
// console.log(a2) // console.log(a2)
......
...@@ -46,6 +46,7 @@ import { ...@@ -46,6 +46,7 @@ import {
} from '@/services/standingBook/api'; } from '@/services/standingBook/api';
import styles from './incident.less'; import styles from './incident.less';
import ChangeAdd from './changeAdd'; import ChangeAdd from './changeAdd';
import ChangeEdit from './changeEdit';
import ChangeImage from './ChangeImage'; import ChangeImage from './ChangeImage';
import ModalDrag from '../maintenance/ModalDrag'; import ModalDrag from '../maintenance/ModalDrag';
import { PlusOutlined, DownOutlined } from '@ant-design/icons'; import { PlusOutlined, DownOutlined } from '@ant-design/icons';
...@@ -491,7 +492,8 @@ const AddModal = props => { ...@@ -491,7 +492,8 @@ const AddModal = props => {
const [Type1, setType1] = useState(''); const [Type1, setType1] = useState('');
const [number, setNumber] = useState(''); const [number, setNumber] = useState('');
const [isVisible, setIsVisible] = useState(false); // 弹窗 const [isVisible, setIsVisible] = useState(false); // 事件权限弹窗
const [isVisibleEdit, setIsVisibleEdit] = useState(false); // 字段弹框
const [isVisible1, setIsVisible1] = useState(false); // 弹窗 const [isVisible1, setIsVisible1] = useState(false); // 弹窗
const [characterValue, setCharacterValue] = useState(''); const [characterValue, setCharacterValue] = useState('');
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -796,7 +798,7 @@ const AddModal = props => { ...@@ -796,7 +798,7 @@ const AddModal = props => {
let a1 = []; let a1 = [];
let a2; let a2;
let a3 = []; let a3 = [];
initialArr.map(i => { initialArr.data.map(i => {
// console.log(i.groupType) // console.log(i.groupType)
a2 = i.groupType; a2 = i.groupType;
// console.log(a2) // console.log(a2)
...@@ -892,53 +894,68 @@ const AddModal = props => { ...@@ -892,53 +894,68 @@ const AddModal = props => {
console.log(prop.stt); console.log(prop.stt);
console.log(prop.filed22); console.log(prop.filed22);
console.log(prop.title); console.log(prop.title);
if (prop.isType == 'app') {
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 (item == '外部字段' && aa.length == 0) {
bb = 0;
} else {
// eslint-disable-next-line no-lonely-if
if (aa.length == 0) {
bb = 1;
}
}
});
console.log(aa);
if (bb == 1) {
notification.error({
message: '提示',
description: '部门站点角色必须都选至少一项',
});
} else {
setIsVisible(false); setIsVisible(false);
let inputText = { ...inputValue }; let inputText = { ...inputValue };
console.log(inputText);
console.log(prop.str);
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.checkedList); setCheckedList1(prop.stt);
setInputValue(inputText); setInputValue(inputText);
} // if (prop.isType == 'app') {
} else { // let title = prop.title;
setIsVisible(false); // 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 (item == '外部字段' && aa.length == 0) {
// bb = 0;
// } else {
// // eslint-disable-next-line no-lonely-if
// if (aa.length == 0) {
// bb = 1;
// }
// }
// });
// console.log(aa);
// if (bb == 1) {
// notification.error({
// message: '提示',
// description: '部门站点角色必须都选至少一项',
// });
// } else {
// setIsVisible(false);
// let inputText = { ...inputValue };
// console.log(inputText);
// console.log(prop.str);
// inputText[prop.pickItem] = prop.str;
// setCheckedList1(prop.stt);
// setInputValue(inputText);
// }
// } else {
// setIsVisible(false);
// let inputText = { ...inputValue };
// inputText[prop.pickItem] = prop.str;
// setCheckedList1(prop.stt);
// setInputValue(inputText);
// }
};
const onOK1 = prop => {
console.log(prop.isType);
console.log(prop.stt);
console.log(prop.title);
setIsVisibleEdit(false);
let inputText = { ...inputValue }; let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.checkedList); setCheckedList1(prop.stt);
setInputValue(inputText); setInputValue(inputText);
}
}; };
const oKK = prop => { const oKK = prop => {
setIsVisible1(false); setIsVisible1(false);
...@@ -977,7 +994,7 @@ const AddModal = props => { ...@@ -977,7 +994,7 @@ const AddModal = props => {
setCharacterValue(inputValue[fileds]); setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(',')); setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds); setPickItem(fileds);
setIsVisible(true); setIsVisibleEdit(true);
}; };
const pickFiled1 = fileds => { const pickFiled1 = fileds => {
let pp = formateArrDataA1(nu1, 'group'); let pp = formateArrDataA1(nu1, 'group');
...@@ -1092,6 +1109,9 @@ const AddModal = props => { ...@@ -1092,6 +1109,9 @@ const AddModal = props => {
const onCancel = () => { const onCancel = () => {
setIsVisible(false); setIsVisible(false);
}; };
const onCancel11 = () => {
setIsVisibleEdit(false);
};
const onCancel1 = () => { const onCancel1 = () => {
setIsVisible1(false); setIsVisible1(false);
}; };
...@@ -1632,7 +1652,19 @@ const AddModal = props => { ...@@ -1632,7 +1652,19 @@ const AddModal = props => {
isType={types} isType={types}
filed={filed} filed={filed}
flag={flag} flag={flag}
filed1={filed1} filed11={filed1}
pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/>
<ChangeEdit
visible={isVisibleEdit}
onCancel={onCancel11}
callBackSubmit={onOK1}
newCheckedList={checkedList1}
filed={filed}
flag={flag}
filed11={filed1}
pickItem={pickItem} pickItem={pickItem}
characterValue={characterValue} characterValue={characterValue}
formObj={formObj} formObj={formObj}
......
/* eslint-disable no-cond-assign */
/* eslint-disable react/no-array-index-key */
/* eslint-disable no-undef */
/* eslint-disable guard-for-in */ /* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */ /* eslint-disable no-restricted-syntax */
/* eslint-disable camelcase */ /* eslint-disable camelcase */
...@@ -12,266 +15,90 @@ ...@@ -12,266 +15,90 @@
/* eslint-disable eqeqeq */ /* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */ /* eslint-disable no-plusplus */
import React, { useState, useEffect, useCallback, useRef } from 'react'; import React, { useState, useEffect, useCallback, useRef } from 'react';
import { import { Form, Modal, Checkbox, Tabs, Input, Button, Pagination } from 'antd';
Form,
Modal,
Divider,
Checkbox,
Tabs,
Input,
Button,
Pagination,
} from 'antd';
import DragTable from '@/components/DragTable/DragTable';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import Sortable from 'sortablejs';
import { add } from 'lodash-es';
import { string } from 'prop-types';
import { setServiceType } from '@/services/webConfig/api';
import { ContinuousLegend } from '@antv/g2/lib/dependents';
import { ConsoleSqlOutlined } from '@ant-design/icons';
import styles from './incident.less'; import styles from './incident.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const { TabPane } = Tabs; const { TabPane } = Tabs;
const AddModal = props => { const ChangeAdd = props => {
const usePrevious = value => {
const ref = useRef();
useEffect(() => {
ref.current = value;
});
return ref.current;
};
const { const {
callBackSubmit = () => {}, callBackSubmit = () => {},
isType, isType,
pickItem, pickItem,
visible, visible,
filed, filed11,
filed1,
characterValue,
newCheckedList, newCheckedList,
flag,
} = props; } = props;
const [loading, setLoading] = useState(false);
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [checkValue, setCheckValue] = useState([]); const [checkValue, setCheckValue] = useState([]);
const [form] = Form.useForm();
const [title, setTitle] = useState([]); const [title, setTitle] = useState([]);
const { Item } = Form; const [checkedList, setCheckedList] = useState([]); // 选中复选框内容
const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
const [indeterminate, setIndeterminate] = useState([]);
const [checkAll, setCheckAll] = useState([]);
const [selectData, setSelectData] = useState([]);
const [arrValue, setArrValue] = useState([]);
const [data, setData] = useState([]);
const [flagg, setFlagg] = useState(0); const [flagg, setFlagg] = useState(0);
const [type, setType] = useState(); // 是否全选 const [type, setType] = useState(); // 是否全选
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
const { Search } = Input; const { Search } = Input;
const [total, setTotal] = useState(); const [total, setTotal] = useState();
const [pageSize, setPageSize] = useState(10); const [pageSize, setPageSize] = useState(42);
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [roleValue, setRoleValue] = useState([]); const [roleValue, setRoleValue] = useState([]);
let objArr = []; const [checkDataRole, setCheckDataRole] = useState([]);
const [checkDataPm, setCheckDataPm] = useState([]);
const onChangeList = (list, index, title) => { const [checkDataSite, setCheckDataSite] = useState([]);
const checkedListArr = [...checkedList]; const [filed1, setFiled1] = useState([]); // 角色全部数据
checkedListArr[index] = list; const [saveCheckValue, setSaveCheckValue] = useState([]); // 保存选中值
// 将第一次打开回显数据先存成数组 const [isCheck, setIsCheck] = useState(0); // 是否点击了角色复选框下的
let oldArr = []; const [isCheck1, setIsCheck1] = useState(0); // 是否点击了部门复选框下的
let addArr = []; const [isCheck2, setIsCheck2] = useState(0); // 是否点击了站点复选框下的
let newArr = []; const [keepOption1, setKeepOption1] = useState([]); // 保存了获取的部门列表数据
// if (flagg == 0) { const [keepOption2, setKeepOption2] = useState([]); // 保存了获取的站点列表数据
arrValue.map((item, index) => { const [keepTabKey, setKeepTabKey] = useState(0);
oldArr = oldArr.concat(item); const [searchFlag, setSearchFlag] = useState(0);
}); const [keepSearchList, setkeepSearchList] = useState([]); // 保存搜索后出现的选中列表
const [list, setList] = useState([]);
const [listPm, setListPm] = useState([]);
const [listSite, setListSite] = useState([]);
const prevAmount = usePrevious({ list });
const prevAmountPm = usePrevious({ checkDataPm });
const prevAmountSite = usePrevious({ listSite });
console.log(oldArr); const onSubmit = () => {
// 将第一次打开回显数据存入已选择数组里 // 没有勾选部门下的选项
oldArr.map(item => { if (saveCheckValue[1] == undefined) {
newArr.push(item); let data = [];
}); newCheckedList.map(checkItem => {
console.log(newArr); if (keepOption1.includes(checkItem)) {
// 获取本次新增数据后的数组 data.push(checkItem);
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(checkedListArr);
console.log(objArr); // 本次增加数据后数组
console.log(arrValue); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (arrValue.indexOf(item1) == -1) {
addArr.push(item1);
}
});
// } else {
// arrValue.map((item, index) => {
// oldArr = oldArr.concat(item);
// });
// console.log(oldArr);
// // 将第一次打开回显数据存入已选择数组里
// oldArr.map(item => {
// newArr.push(item);
// });
// console.log(newArr);
// // 获取本次新增数据后的数组
// let objArr = [];
// checkedListArr.map(item => {
// objArr = objArr.concat(item);
// });
// console.log(objArr); // 本次增加数据后数组
// console.log(oldArr); // 上次数组
// // 获取新增数据
// objArr.map((item1, index1) => {
// if (oldArr.indexOf(item1) == -1) {
// addArr.push(item1);
// }
// });
// }
// 将每次新增数据从尾部写入已选择数组里
console.log(addArr);
if (addArr.length != 0) {
addArr.map(item => {
newArr.push(item);
});
}
console.log(newArr);
// 保存此次所有数据顺序
setArrValue(newArr);
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);
setFlagg(0);
};
const onChangeList1 = (list, index, title) => {
const checkedListArr = [...checkedList];
checkedListArr[index] = list;
// 将第一次打开回显数据先存成数组
let oldArr = [];
let addArr = [];
let newArr = [];
if (flagg == 0) {
arrValue.map((item, index) => {
oldArr = oldArr.concat(item);
});
console.log(oldArr);
// 将第一次打开回显数据存入已选择数组里
oldArr.map(item => {
newArr.push(item);
});
console.log(newArr);
// 获取本次新增数据后的数组
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(objArr); // 本次增加数据后数组
console.log(arrValue); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (arrValue.indexOf(item1) == -1) {
addArr.push(item1);
}
});
} else {
arrValue.map((item, index) => {
oldArr = oldArr.concat(item);
});
console.log(oldArr);
// 将第一次打开回显数据存入已选择数组里
oldArr.map(item => {
newArr.push(item);
});
console.log(newArr);
// 获取本次新增数据后的数组
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(objArr); // 本次增加数据后数组
console.log(oldArr); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (oldArr.indexOf(item1) == -1) {
addArr.push(item1);
}
});
} }
// 将每次新增数据从尾部写入已选择数组里
console.log(addArr);
if (addArr.length != 0) {
addArr.map(item => {
newArr.push(item);
}); });
console.log(data);
saveCheckValue[1] = data;
} }
console.log(newArr); console.log(saveCheckValue);
// 保存此次所有数据顺序 // 没有勾选站点下的选项
setArrValue(newArr); if (saveCheckValue[2] == undefined) {
setCheckedList(checkedListArr); let data = [];
console.log(checkedListArr); newCheckedList.map(checkItem => {
// setSelectData(checkedListArr); if (keepOption2.includes(checkItem)) {
const indeterminateArr = [...indeterminate]; data.push(checkItem);
const checkAllArr = [...checkAll];
indeterminateArr[index] =
!!list.length && list.length < filed1[title].length;
checkAllArr[index] = list.length === filed1[title].length;
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
setFlagg(0);
};
const onSubmit1 = () => {
console.log(selectData);
let aRR = [];
selectData.map(item => {
console.log(typeof item);
if (typeof item == 'string') {
console.log(1111);
aRR = selectData;
} else {
aRR.push(item.name);
} }
}); });
console.log(aRR); console.log(data);
let newArr = selectData.map(item => item.name); saveCheckValue[2] = data;
isType === 'rule'
? callBackSubmit(
`${
value === '无' || value === '' ? '' : `${value},`
}${checkValue.join(',')}`,
)
: callBackSubmit({
checkedList,
str: aRR.join(','),
pickItem,
stt: aRR,
title,
filed22: filed1,
isType,
});
};
const onSubmit = () => {
console.log(selectData);
let aRR = [];
selectData.map(item => {
console.log(typeof item);
if (typeof item == 'string') {
aRR = selectData;
} else {
console.log(112212);
console.log(item.name);
aRR.push(item.name);
console.log(63467246);
console.log(aRR);
} }
console.log(newCheckedList);
console.log(saveCheckValue);
let data = [];
saveCheckValue.map((item, index) => {
data = data.concat(item);
}); });
console.log(aRR);
isType === 'rule' isType === 'rule'
? callBackSubmit( ? callBackSubmit(
`${ `${
...@@ -279,238 +106,118 @@ const AddModal = props => { ...@@ -279,238 +106,118 @@ const AddModal = props => {
}${checkValue.join(',')}`, }${checkValue.join(',')}`,
) )
: callBackSubmit({ : callBackSubmit({
checkedList, saveCheckValue,
str: aRR.join(','), str: data.join(','),
pickItem, pickItem,
stt: aRR, stt: data,
title, title,
filed22: filed1, filed22: filed1,
isType, isType,
}); });
}; setIsCheck(0);
const onCheckAllChange1 = e => { setIsCheck1(0);
setData(1); setIsCheck2(0);
const indeterminateArr = [...indeterminate]; setList([]);
const checkAllArr = [...checkAll]; setSearchWord('');
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] = []);
setType(e.target.checked);
setCheckedList(checkedListArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
}; };
const onCheckAllChange = e => { // const onCheckAllChange = e => {
setData(1); // setData(1);
const indeterminateArr = [...indeterminate]; // const indeterminateArr = [...indeterminate];
const checkAllArr = [...checkAll]; // const checkAllArr = [...checkAll];
const checkedListArr = [...checkedList]; // const checkedListArr = [...checkedList];
checkAllArr[e.target.index] = e.target.checked; // checkAllArr[e.target.index] = e.target.checked;
indeterminateArr[e.target.index] = false; // indeterminateArr[e.target.index] = false;
e.target.checked // e.target.checked
? (checkedListArr[e.target.index] = e.target.checkvalue) // ? (checkedListArr[e.target.index] = e.target.checkvalue)
: (checkedListArr[e.target.index] = []); // : (checkedListArr[e.target.index] = []);
setCheckedList(checkedListArr); // setCheckedList(checkedListArr);
setType(e.target.checked); // setType(e.target.checked);
setIndeterminate(indeterminateArr); // setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr); // setCheckAll(checkAllArr);
}; // };
useEffect(() => {
// 不是第一次
if (flagg == 0) {
selectAll();
}
// 是否是全选
if (data == 1) {
selectAll();
}
setData(0);
}, [checkedList]);
const selectAll = () => {
objArr = [];
let lastArr = [];
// 处理未排序的勾选数据扁平化
checkedList.map(item => {
objArr = objArr.concat(item);
});
console.log(arrValue);
console.log(objArr);
// 判断是否操作全部勾选的复选框
if (data == 1) {
// 处理上次选中改变顺序后的数据扁平化
let newArr = [];
arrValue.map(item => {
if (item.name == undefined) {
newArr = arrValue;
} else {
newArr = arrValue.map(item => item.name);
}
});
console.log(newArr);
// 判断是否为全选
if (type == false) {
// 判断上次有顺序的数据是否包含这次未排序已选列表数据
newArr.map(item => {
if (objArr.indexOf(item) != -1) {
lastArr.push(item);
}
});
let newArr1 = lastArr.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(lastArr);
console.log(newArr1);
setSelectData(newArr1);
setArrValue(lastArr);
} else {
// 全选状态时
let addArr = [];
objArr.map(item => {
if (newArr.indexOf(item) == -1) {
addArr.push(item);
}
});
console.log(addArr);
addArr.map(item => {
newArr.push(item);
});
console.log(newArr);
let newArr1 = newArr.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(newArr1);
setSelectData(newArr1);
setArrValue(newArr);
}
} else {
// 判断扁平处理后的选中未排序列表数据是否存在于上次已选数组中
arrValue.map(item => {
if (objArr.indexOf(item) != -1) {
lastArr.push(item);
}
});
let newArr1 = lastArr.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(lastArr);
console.log(newArr1);
setSelectData(newArr1);
setArrValue(lastArr);
}
};
useEffect(() => { useEffect(() => {
console.log(filed11);
setKeepOption1(filed11['部门']);
setKeepOption2(filed11['站点']);
getRoles('角色', '', pageSize, 1);
setRoleValue(filed1); setRoleValue(filed1);
if (visible) {
setFlagg(1); setFlagg(1);
if (isType != '' && isType === 'add') {
let arr = Object.keys(filed);
console.log(arr, 'arr');
setTitle(arr);
let checkArr = [];
let indeterminateArr = [];
let checkAllArr = [];
console.log(newCheckedList);
arr.map((item, index) => {
checkArr[index] = [];
newCheckedList.map(checkItem => {
if (filed[item].includes(checkItem)) {
checkArr[index].push(checkItem);
}
});
indeterminateArr.push(
!!checkArr[index].length &&
checkArr[index].length < filed[item].length,
);
checkAllArr.push(checkArr[index].length === filed[item].length);
});
console.log(checkArr);
console.log(indeterminateArr);
console.log(checkAllArr);
setCheckedList(checkArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
console.log(characterValue);
let newArr = characterValue.length ? characterValue.split(',') : [];
console.log(newArr);
let newArr1 = newCheckedList.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(newArr1);
setSelectData(newArr1);
setArrValue(newArr1);
} else if (isType === 'app') {
console.log(filed1); console.log(filed1);
let arr = Object.keys(filed1); let arr = Object.keys(filed1);
console.log(arr, 'arr'); console.log(arr, 'arr');
setTitle(arr); setTitle(arr);
let checkArr = []; let checkArr = [];
let indeterminateArr = []; console.log(newCheckedList); // 已选中数组
let checkAllArr = []; // arr.map((item, index) => {
console.log(newCheckedList); // checkArr[index] = [];
arr.map((item, index) => { // newCheckedList.map(checkItem => {
checkArr[index] = []; // if (filed1[item].includes(checkItem)) {
// checkArr[index].push(checkItem);
// }
// });
// });
// console.log(characterValue);
// let newArr = characterValue.length ? characterValue.split(',') : [];
// console.log(newArr);
// let newArr1 = newCheckedList.map(item => ({ name: item }));
// if (newArr1.length === 1 && newArr1[0].name === '') {
// newArr1 = [];
// }
// console.log(newArr1);
let listdata = [];
newCheckedList.map(checkItem => { newCheckedList.map(checkItem => {
if (filed1[item].includes(checkItem)) { if (filed11['角色'].includes(checkItem)) {
checkArr[index].push(checkItem); listdata.push(checkItem);
} }
}); });
indeterminateArr.push( setCheckDataRole(listdata);
!!checkArr[index].length && checkArr[0] = listdata;
checkArr[index].length < filed1[item].length, console.log(listdata); // 按对象数组格式
); setSaveCheckValue(checkArr);
checkAllArr.push(checkArr[index].length === filed1[item].length);
});
setCheckedList(checkArr); setCheckedList(checkArr);
setIndeterminate(indeterminateArr); let pmdata = [];
setCheckAll(checkAllArr); newCheckedList.map(checkItem => {
console.log(characterValue); if (filed11['部门'].includes(checkItem)) {
let newArr = characterValue.length ? characterValue.split(',') : []; pmdata.push(checkItem);
console.log(newArr);
let newArr1 = newCheckedList.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(newArr1);
setSelectData(newArr1);
setArrValue(newArr1);
} }
} else { });
setSelectData([]); console.log(pmdata);
setArrValue([]); setCheckDataPm(pmdata);
let sitedata = [];
newCheckedList.map(checkItem => {
if (filed11['站点'].includes(checkItem)) {
sitedata.push(checkItem);
} }
});
console.log(sitedata);
setCheckDataSite(sitedata);
}, [visible]); }, [visible]);
// useEffect(() => { const submitSearchUser = () => {
// setCurrentPage(1); console.log(keepTabKey);
// }, [visible]); if (searchWord != '') {
const dragCallBack = arr => { setSearchFlag(1);
console.log(arr);
if (arr) {
console.log(111);
setSelectData(arr);
let newArr = [];
arr.map(item => {
newArr.push(item.name);
});
console.log(newArr);
setArrValue(newArr);
} }
};
const submitSearchUser = () => {}; if (keepTabKey == 0) {
sreachRoles('角色', searchWord, pageSize, 1);
}
if (keepTabKey == 1) {
sreachRoles('部门', searchWord, pageSize, 1);
}
if (keepTabKey == 2) {
sreachRoles('站点', searchWord, pageSize, 1);
}
};
// 获取搜索框的值 // 获取搜索框的值
const handleSearch = e => { const handleSearch = e => {
if (e.target.value == '') {
setSearchFlag(0);
}
setSearchWord(e.target.value); setSearchWord(e.target.value);
}; };
...@@ -519,19 +226,148 @@ const AddModal = props => { ...@@ -519,19 +226,148 @@ const AddModal = props => {
// 分页时清空复选框 // 分页时清空复选框
setCurrentPage(page); setCurrentPage(page);
setPageSize(pageSizes); setPageSize(pageSizes);
// let username = form.getFieldValue('username'); if (keepTabKey == 0) {
// getData(username, page, pageSizes); getRoles('角色', '', pageSizes, page);
}
if (keepTabKey == 1) {
getRoles('部门', '', pageSizes, page);
}
if (keepTabKey == 2) {
getRoles('站点', '', pageSizes, page);
}
};
// 搜索时获取数据
const sreachRoles = (type, keywords, pageSizes, pageIndex) => {
console.log(type);
CM_Event_LoadDepartmentAndRoles({
type,
keywords,
pageSize: pageSizes,
pageIndex,
}).then(res => {
if (res.msg === 'Ok') {
console.log(formateArrDataA1(res.data, 'groupType'));
setRoleValue(formateArrDataA1(res.data, 'groupType'));
setFiled1(formateArrDataA1(res.data, 'groupType'));
console.log(checkedList);
console.log(checkDataRole);
let data = [];
if (type == '角色') {
checkDataRole.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
}
if (type == '部门') {
checkDataPm.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
// setListPm(data);
}
if (type == '站点') {
checkDataSite.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
}
setkeepSearchList(data);
}
});
}; };
const getRoles = () => { // 重置
CM_Event_LoadDepartmentAndRoles().then(res => { const onReset = () => {
setSearchFlag(0);
// setListPm([]);
if (keepTabKey == 0) {
getRoles('角色', '', pageSize, 1);
}
if (keepTabKey == 1) {
getRoles('部门', '', pageSize, 1);
}
if (keepTabKey == 2) {
getRoles('站点', '', pageSize, 1);
}
setCurrentPage(1);
setSearchWord('');
};
const getRoles = (type, keywords, pageSizes, pageIndex) => {
console.log(type);
console.log(keywords);
CM_Event_LoadDepartmentAndRoles({
type,
keywords,
pageSize: pageSizes,
pageIndex,
}).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
// setRoleValue(formateArrDataA1(res.data, 'groupType')); setTotal(res.data.count);
console.log(formateArrDataA1(res.data, 'groupType')); console.log(formateArrDataA1(res.data, 'groupType'));
setRoleValue(formateArrDataA1(res.data, 'groupType'));
setFiled1(formateArrDataA1(res.data, 'groupType'));
} }
}); });
}; };
useEffect(() => {
let arr = Object.keys(filed1);
setTitle(arr);
let checkArr = [];
console.log(saveCheckValue);
console.log(newCheckedList); // 已选中数组
let data = [];
saveCheckValue.map((item, index) => {
data = data.concat(item);
});
arr.forEach(item => {
if (item == '角色') {
checkArr[0] = [];
console.log(filed1);
checkDataRole.map(checkItem => {
if (filed1['角色'].includes(checkItem)) {
checkArr[0].push(checkItem);
}
});
// setCheckDataRole(checkArr[0]);
console.log(arr);
console.log(checkArr); // 按对象数组格式
setCheckedList(checkArr);
} else if (item == '部门') {
checkArr[1] = [];
checkDataPm.map(checkItem => {
if (filed1['部门'].includes(checkItem)) {
checkArr[1].push(checkItem);
}
});
// setCheckDataPm(checkArr[1]);
console.log(checkArr); // 按对象数组格式
setCheckedList(checkArr);
} else if (item == '站点') {
checkArr[2] = [];
console.log(checkDataSite);
checkDataSite.map(checkItem => {
if (filed1['站点'].includes(checkItem)) {
checkArr[2].push(checkItem);
}
});
// setCheckDataSite(checkArr[2]);
console.log(checkArr); // 按对象数组格式
setCheckedList(checkArr);
}
});
}, [filed1]);
const formateArrDataA1 = (initialArr, name) => { const formateArrDataA1 = (initialArr, name) => {
console.log(initialArr); console.log(initialArr);
let aa = []; let aa = [];
...@@ -591,140 +427,133 @@ const AddModal = props => { ...@@ -591,140 +427,133 @@ const AddModal = props => {
return tempObj; return tempObj;
}; };
const columns = [ useEffect(() => {
{ let checkedListArr = [...saveCheckValue];
title: '已选列表', setIsCheck(1);
dataIndex: 'name', let data = checkDataRole;
width: 150, let DataValue = [];
key: 'name', checkDataRole.forEach(item => {
}, if (roleValue['角色'].indexOf(item) != -1) {
]; DataValue.push(item);
}
});
console.log(DataValue);
// del
if (DataValue.length > list.length) {
DataValue.forEach(item => {
if (list.indexOf(item) == -1) {
data.splice(data.findIndex(ele => ele === item), 1);
}
});
} else {
// add
list.forEach(item => {
if (data.indexOf(item) == -1) {
data.push(item);
}
});
}
checkedListArr[0] = data;
setCheckDataRole(data);
setSaveCheckValue(checkedListArr);
setCheckedList(checkedListArr);
}, [list]);
useEffect(() => {
let checkedListArr = [...saveCheckValue];
setIsCheck(1);
setIsCheck1(1);
let data = checkDataPm;
let DataValue = [];
checkDataPm.forEach(item => {
if (roleValue['部门'].indexOf(item) != -1) {
DataValue.push(item);
}
});
console.log(DataValue);
// del
if (DataValue.length > listPm.length) {
DataValue.forEach(item => {
if (listPm.indexOf(item) == -1) {
data.splice(data.findIndex(ele => ele === item), 1);
}
});
} else {
// add
listPm.forEach(item => {
if (data.indexOf(item) == -1) {
data.push(item);
}
});
}
checkedListArr[1] = data;
setCheckDataPm(data);
setSaveCheckValue(checkedListArr);
setCheckedList(checkedListArr);
}, [listPm]);
useEffect(() => {
setIsCheck(1);
const checkedListArr = [...saveCheckValue];
setIsCheck(1);
let data = checkDataSite;
let DataValue = [];
checkDataSite.forEach(item => {
if (roleValue['站点'].indexOf(item) != -1) {
DataValue.push(item);
}
});
console.log(DataValue);
// del
if (DataValue.length > listSite.length) {
DataValue.forEach(item => {
if (listSite.indexOf(item) == -1) {
data.splice(data.findIndex(ele => ele === item), 1);
}
});
} else {
// add
listSite.forEach(item => {
if (data.indexOf(item) == -1) {
data.push(item);
}
});
}
checkedListArr[2] = data;
setCheckDataSite(data);
setSaveCheckValue(checkedListArr);
setCheckedList(checkedListArr);
}, [listSite]);
const handleParChange = key => { const handleParChange = key => {
setSearchFlag(0);
setCurrentPage(1);
console.log(key); console.log(key);
setKeepTabKey(key);
let value; let value;
if (key == 0) { if (key == 0) {
value = '角色'; value = '角色';
getRoles('角色', '', pageSize, 1);
} }
if (key == 1) { if (key == 1) {
value = '部门'; value = '部门';
getRoles('部门', '', pageSize, 1);
} }
if (key == 2) { if (key == 2) {
value = '站点'; value = '站点';
getRoles('站点', '', pageSize, 1);
} }
console.log(value); console.log(value);
// getRoles();
}; };
if (isType != 'app') {
return ( const onChangeListNew = list => {
<Modal setList(list);
title="字段集选择" };
bodyStyle={{ width: '100%', minHeight: '100px' }} const onChangeListNew1 = list => {
width="750px" setListPm(list);
destroyOnClose };
centered const onChangeListNew2 = list => {
cancelText="取消" setListSite(list);
okText="确认" };
{...props}
onOk={() => onSubmit1()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div
className={styles.cardItem}
style={{ borderRight: '1px solid #99bbe8' }}
>
{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={onCheckAllChange1}
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}>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<DragTable
bordered
style={{ marginBottom: '10px' }}
rowKey={record => record.name}
columns={columns}
dataSource={selectData}
pagination={false}
size="small"
dragCallBack={dragCallBack}
ItemTypes="stadingOrder"
/>
</div>
</div>
</div>
</div>
)}
</Modal>
);
}
if (isType === 'app') {
return ( return (
<Modal <Modal
title="权限选择" title="权限选择"
...@@ -740,7 +569,7 @@ const AddModal = props => { ...@@ -740,7 +569,7 @@ const AddModal = props => {
forceRender forceRender
getContainer={false} getContainer={false}
> >
{/* <Search <Search
style={{ style={{
width: 260, width: 260,
marginRight: '20px', marginRight: '20px',
...@@ -752,17 +581,9 @@ const AddModal = props => { ...@@ -752,17 +581,9 @@ const AddModal = props => {
enterButton enterButton
value={searchWord} value={searchWord}
/> />
<Button <Button type="primary" htmlType="submit" onClick={onReset}>
type="primary"
htmlType="submit"
// onClick={() => {
// setCurrentPage(1);
// getData('', 1, pageSize);
// form.setFieldsValue({ username: '' });
// }}
>
重置 重置
</Button> */} </Button>
{visible && ( {visible && (
<div className={styles.listCard1}> <div className={styles.listCard1}>
<div className={styles.cardItem1}> <div className={styles.cardItem1}>
...@@ -772,54 +593,81 @@ const AddModal = props => { ...@@ -772,54 +593,81 @@ const AddModal = props => {
className={styles.tab} className={styles.tab}
onChange={handleParChange} onChange={handleParChange}
> >
{title.map((item, index) => ( <TabPane tab="角色" key="0">
<TabPane tab={item} key={index}> <div className={styles.cardItemData1}>
<div className={styles.cardItemData1} key={index}> <CheckboxGroup
<Divider options={roleValue['角色']}
orientation="left" value={checkedList[0]}
style={{ onChange={onChangeListNew}
margin: '0 0 10px -10px',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
<Checkbox
indeterminate={indeterminate[index]}
onChange={onCheckAllChange}
index={index}
checkvalue={roleValue[item]}
checked={checkAll[index]}
style={{ marginRight: '7px' }}
/> />
{item} </div>
</Divider> </TabPane>
<TabPane tab="部门" key="1">
<div className={styles.cardItemData1}>
<CheckboxGroup <CheckboxGroup
options={roleValue[item]} options={roleValue['部门']}
value={checkedList[index]} value={checkedList[1]}
onChange={e => onChangeList1(e, index, item)} onChange={onChangeListNew1}
/>
</div>
</TabPane>
<TabPane tab="站点" key="2">
<div className={styles.cardItemData1}>
<CheckboxGroup
options={roleValue['站点']}
value={checkedList[2]}
onChange={onChangeListNew2}
/> />
</div> </div>
</TabPane> </TabPane>
))}
</Tabs> </Tabs>
</div> </div>
</div> </div>
<div className={styles.cardItem11}> <div className={styles.cardItem11}>
<DragTable <div className={styles.cardContent1}>
bordered <Tabs defaultActiveKey="0" className={styles.tab}>
style={{ marginBottom: '10px' }} <TabPane tab="角色" key="0">
rowKey={record => record.name} {checkDataRole.map((item, index) => (
columns={columns} <div
dataSource={selectData} key={index}
pagination={false} style={{
size="small" marginBottom: '5px',
dragCallBack={dragCallBack} }}
ItemTypes="stadingOrder" >
/> {item}
</div>
))}
</TabPane>
<TabPane tab="部门" key="1">
{checkDataPm.map((item, index) => (
<div
key={index}
style={{
marginBottom: '5px',
}}
>
{item}
</div>
))}
</TabPane>
<TabPane tab="站点" key="2">
{checkDataSite.map((item, index) => (
<div
key={index}
style={{
marginBottom: '5px',
}}
>
{item}
</div>
))}
</TabPane>
</Tabs>
</div>
</div> </div>
</div> </div>
)} )}
{/* <Pagination <Pagination
total={total} total={total}
showTotal={item => `共 ${item} 条`} showTotal={item => `共 ${item} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
...@@ -829,9 +677,9 @@ const AddModal = props => { ...@@ -829,9 +677,9 @@ const AddModal = props => {
style={{ marginBottom: '10px' }} style={{ marginBottom: '10px' }}
size="small" size="small"
showQuickJumper showQuickJumper
/> */} />
</Modal> </Modal>
); );
}
}; };
export default AddModal;
export default ChangeAdd;
/* eslint-disable no-undef */
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
/* eslint-disable camelcase */
/* eslint-disable react/jsx-no-undef */
/* eslint-disable valid-typeof */
/* eslint-disable no-unused-vars */
/* 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, Tabs } from 'antd';
import DragTable from '@/components/DragTable/DragTable';
import styles from './incident.less';
const CheckboxGroup = Checkbox.Group;
const EditModal = props => {
const {
callBackSubmit = () => {},
pickItem,
visible,
filed,
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([]);
const [arrValue, setArrValue] = useState([]);
const [data, setData] = useState([]);
const [flagg, setFlagg] = useState(0);
const [type, setType] = useState(); // 是否全选
let objArr = [];
const onChangeList = (list, index, title) => {
const checkedListArr = [...checkedList];
checkedListArr[index] = list;
// 将第一次打开回显数据先存成数组
let oldArr = [];
let addArr = [];
let newArr = [];
// if (flagg == 0) {
arrValue.map((item, index) => {
oldArr = oldArr.concat(item);
});
console.log(oldArr);
// 将第一次打开回显数据存入已选择数组里
oldArr.map(item => {
newArr.push(item);
});
console.log(newArr);
// 获取本次新增数据后的数组
let objArr = [];
checkedListArr.map(item => {
objArr = objArr.concat(item);
});
console.log(checkedListArr);
console.log(objArr); // 本次增加数据后数组
console.log(arrValue); // 上次数组
// 获取新增数据
objArr.map((item1, index1) => {
if (arrValue.indexOf(item1) == -1) {
addArr.push(item1);
}
});
// 将每次新增数据从尾部写入已选择数组里
console.log(addArr);
if (addArr.length != 0) {
addArr.map(item => {
newArr.push(item);
});
}
console.log(newArr);
// 保存此次所有数据顺序
setArrValue(newArr);
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);
setFlagg(0);
};
const onSubmit1 = () => {
console.log(selectData);
let aRR = [];
selectData.map(item => {
console.log(typeof item);
if (typeof item == 'string') {
console.log(1111);
aRR = selectData;
} else {
aRR.push(item.name);
}
});
console.log(aRR);
let newArr = selectData.map(item => item.name);
callBackSubmit({
checkedList,
str: aRR.join(','),
pickItem,
stt: aRR,
title,
});
};
const onCheckAllChange1 = e => {
setData(1);
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] = []);
setType(e.target.checked);
console.log(checkedListArr);
setCheckedList(checkedListArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
};
useEffect(() => {
console.log(flagg);
// 不是第一次
if (flagg == 0) {
console.log(12121);
selectAll();
}
// 是否是全选
if (data == 1) {
selectAll();
}
setData(0);
}, [checkedList]);
const selectAll = () => {
objArr = [];
let lastArr = [];
// 处理未排序的勾选数据扁平化
checkedList.map(item => {
objArr = objArr.concat(item);
});
console.log(arrValue);
console.log(objArr);
// 判断是否操作全部勾选的复选框
if (data == 1) {
// 处理上次选中改变顺序后的数据扁平化
let newArr = [];
arrValue.map(item => {
if (item.name == undefined) {
newArr = arrValue;
} else {
newArr = arrValue.map(item => item.name);
}
});
console.log(newArr);
// 判断是否为全选
if (type == false) {
// 判断上次有顺序的数据是否包含这次未排序已选列表数据
newArr.map(item => {
if (objArr.indexOf(item) != -1) {
lastArr.push(item);
}
});
let newArr1 = lastArr.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(lastArr);
console.log(newArr1);
setSelectData(newArr1);
setArrValue(lastArr);
} else {
// 全选状态时
let addArr = [];
objArr.map(item => {
if (newArr.indexOf(item) == -1) {
addArr.push(item);
}
});
console.log(addArr);
addArr.map(item => {
newArr.push(item);
});
console.log(newArr);
let newArr1 = newArr.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(newArr1);
setSelectData(newArr1);
setArrValue(newArr);
}
} else {
// 判断扁平处理后的选中未排序列表数据是否存在于上次已选数组中
arrValue.map(item => {
if (objArr.indexOf(item) != -1) {
lastArr.push(item);
}
});
let newArr1 = lastArr.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(lastArr);
console.log(newArr1);
setSelectData(newArr1);
setArrValue(lastArr);
}
};
useEffect(() => {
if (visible) {
setFlagg(1);
let arr = Object.keys(filed);
console.log(arr, 'arr');
setTitle(arr);
let checkArr = [];
let indeterminateArr = [];
let checkAllArr = [];
console.log(newCheckedList);
arr.map((item, index) => {
checkArr[index] = [];
newCheckedList.map(checkItem => {
if (filed[item].includes(checkItem)) {
checkArr[index].push(checkItem);
}
});
indeterminateArr.push(
!!checkArr[index].length &&
checkArr[index].length < filed[item].length,
);
checkAllArr.push(checkArr[index].length === filed[item].length);
});
console.log(checkArr);
console.log(indeterminateArr);
console.log(checkAllArr);
setCheckedList(checkArr);
setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr);
console.log(characterValue);
let newArr = characterValue.length ? characterValue.split(',') : [];
console.log(newArr);
let newArr1 = newCheckedList.map(item => ({ name: item }));
if (newArr1.length === 1 && newArr1[0].name === '') {
newArr1 = [];
}
console.log(newArr1);
setSelectData(newArr1);
setArrValue(newArr1);
}
}, [visible]);
const dragCallBack = arr => {
console.log(arr);
if (arr) {
setSelectData(arr);
let newArr = [];
arr.map(item => {
newArr.push(item.name);
});
setArrValue(newArr);
}
};
const columns = [
{
title: '已选列表',
dataIndex: 'name',
width: 150,
key: 'name',
},
];
return (
<Modal
title="字段集选择"
bodyStyle={{ width: '100%', minHeight: '100px' }}
width="750px"
destroyOnClose
centered
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit1()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div
className={styles.cardItem}
style={{ borderRight: '1px solid #99bbe8' }}
>
{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={onCheckAllChange1}
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}>
<div className={styles.cardContent}>
<div className={styles.doctorTable}>
<DragTable
bordered
style={{ marginBottom: '10px' }}
rowKey={record => record.name}
columns={columns}
dataSource={selectData}
pagination={false}
size="small"
dragCallBack={dragCallBack}
ItemTypes="stadingOrder"
/>
</div>
</div>
</div>
</div>
)}
</Modal>
);
};
export default EditModal;
...@@ -219,11 +219,9 @@ ...@@ -219,11 +219,9 @@
width: 70%; width: 70%;
} }
.cardItem11 { .cardItem11 {
padding: 0rem 0.5rem; border: 1px solid #b5b8c8;
padding: 0.5rem;
width: 30%; width: 30%;
height: 34.5rem;
overflow-y: scroll;
overflow-x: scroll;
} }
.cardContent1 { .cardContent1 {
height: 33rem; height: 33rem;
......
...@@ -28,6 +28,7 @@ const CardCheck = props => { ...@@ -28,6 +28,7 @@ const CardCheck = props => {
useEffect(() => { useEffect(() => {
if (prevAmount) { if (prevAmount) {
let newCheckList = [...checkList]; let newCheckList = [...checkList];
console.log(newCheckList);
// 当前选中的 // 当前选中的
let currentArr = checkedList; let currentArr = checkedList;
// 上一次选中的 // 上一次选中的
......
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