Commit 275a8c80 authored by 皮倩雯's avatar 皮倩雯

修改事件权限交互

parent f12f5277
Pipeline #39826 passed with stages
in 29 minutes 12 seconds
...@@ -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.data.map(i => { initialArr.map(i => {
// console.log(i.groupType) // console.log(i.groupType)
a2 = i.groupType; a2 = i.groupType;
// console.log(a2) // console.log(a2)
......
...@@ -796,7 +796,7 @@ const AddModal = props => { ...@@ -796,7 +796,7 @@ const AddModal = props => {
let a1 = []; let a1 = [];
let a2; let a2;
let a3 = []; let a3 = [];
initialArr.data.map(i => { initialArr.map(i => {
// console.log(i.groupType) // console.log(i.groupType)
a2 = i.groupType; a2 = i.groupType;
// console.log(a2) // console.log(a2)
......
/* eslint-disable guard-for-in */
/* eslint-disable no-restricted-syntax */
/* eslint-disable camelcase */
/* eslint-disable react/jsx-no-undef */ /* eslint-disable react/jsx-no-undef */
/* eslint-disable valid-typeof */ /* eslint-disable valid-typeof */
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
...@@ -20,6 +23,7 @@ import { ...@@ -20,6 +23,7 @@ import {
Pagination, Pagination,
} from 'antd'; } from 'antd';
import DragTable from '@/components/DragTable/DragTable'; import DragTable from '@/components/DragTable/DragTable';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import Sortable from 'sortablejs'; import Sortable from 'sortablejs';
import { add } from 'lodash-es'; import { add } from 'lodash-es';
...@@ -61,6 +65,7 @@ const AddModal = props => { ...@@ -61,6 +65,7 @@ const AddModal = props => {
const [total, setTotal] = useState(); const [total, setTotal] = useState();
const [pageSize, setPageSize] = useState(10); const [pageSize, setPageSize] = useState(10);
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [roleValue, setRoleValue] = useState([]);
let objArr = []; let objArr = [];
const onChangeList = (list, index, title) => { const onChangeList = (list, index, title) => {
...@@ -400,6 +405,8 @@ const AddModal = props => { ...@@ -400,6 +405,8 @@ const AddModal = props => {
}; };
useEffect(() => { useEffect(() => {
// getRoles();
setRoleValue(filed1);
if (visible) { if (visible) {
setFlagg(1); setFlagg(1);
if (isType != '' && isType === 'add') { if (isType != '' && isType === 'add') {
...@@ -508,6 +515,74 @@ const AddModal = props => { ...@@ -508,6 +515,74 @@ const AddModal = props => {
// getData(username, page, pageSizes); // getData(username, page, pageSizes);
}; };
const getRoles = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
// setRoleValue(formateArrDataA1(res.data, 'groupType'));
console.log(formateArrDataA1(res.data, 'groupType'));
}
});
};
const formateArrDataA1 = (initialArr, name) => {
console.log(initialArr);
let aa = [];
let a1 = [];
let a2;
let a3 = [];
initialArr.data.map(i => {
a2 = i.groupType;
a1 = i.root;
a1.map(j => {
j.group = a2;
});
aa.push(i.root);
});
aa.map(p => {
p.map(o => {
a3.push(o);
});
});
console.log(a3);
// 判定传参是否符合规则
if (!(a3 instanceof Array)) {
return '请传入正确格式的数组';
}
if (!name) {
return '请传入对象属性';
}
// 先获取一下这个数组中有多少个"name"
let nameArr = [];
a3.map(i => {
if (nameArr.indexOf(i.group) === -1) {
nameArr.push(i.group);
}
});
console.log(nameArr);
// 新建一个包含多个list的结果对象
let tempObj = {};
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in a3) {
if (a3[j].group == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
tempObj[nameArr[k]].push(a3[j]);
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = [];
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.Name);
});
}
return tempObj;
};
const columns = [ const columns = [
{ {
title: '已选列表', title: '已选列表',
...@@ -655,7 +730,7 @@ const AddModal = props => { ...@@ -655,7 +730,7 @@ const AddModal = props => {
forceRender forceRender
getContainer={false} getContainer={false}
> >
<Search {/* <Search
style={{ style={{
width: 260, width: 260,
marginRight: '20px', marginRight: '20px',
...@@ -677,7 +752,7 @@ const AddModal = props => { ...@@ -677,7 +752,7 @@ const AddModal = props => {
// }} // }}
> >
重置 重置
</Button> </Button> */}
{visible && ( {visible && (
<div className={styles.listCard1}> <div className={styles.listCard1}>
<div className={styles.cardItem1}> <div className={styles.cardItem1}>
...@@ -698,14 +773,14 @@ const AddModal = props => { ...@@ -698,14 +773,14 @@ const AddModal = props => {
indeterminate={indeterminate[index]} indeterminate={indeterminate[index]}
onChange={onCheckAllChange} onChange={onCheckAllChange}
index={index} index={index}
checkvalue={filed1[item]} checkvalue={roleValue[item]}
checked={checkAll[index]} checked={checkAll[index]}
style={{ marginRight: '7px' }} style={{ marginRight: '7px' }}
/> />
{item} {item}
</Divider> </Divider>
<CheckboxGroup <CheckboxGroup
options={filed1[item]} options={roleValue[item]}
value={checkedList[index]} value={checkedList[index]}
onChange={e => onChangeList1(e, index, item)} onChange={e => onChangeList1(e, index, item)}
/> />
...@@ -730,7 +805,7 @@ const AddModal = props => { ...@@ -730,7 +805,7 @@ const AddModal = props => {
</div> </div>
</div> </div>
)} )}
<Pagination {/* <Pagination
total={total} total={total}
showTotal={item => `共 ${item} 条`} showTotal={item => `共 ${item} 条`}
defaultPageSize={pageSize} defaultPageSize={pageSize}
...@@ -740,7 +815,7 @@ const AddModal = props => { ...@@ -740,7 +815,7 @@ const AddModal = props => {
style={{ marginBottom: '10px' }} style={{ marginBottom: '10px' }}
size="small" size="small"
showQuickJumper showQuickJumper
/> /> */}
</Modal> </Modal>
); );
} }
......
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