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

fix: '权限组件id匹配'

parent 08310f08
Pipeline #56825 waiting for manual action with stages
This diff is collapsed.
......@@ -153,4 +153,7 @@
}
}
}
.ant-empty-normal {
margin: auto;
}
}
......@@ -60,6 +60,7 @@ const AddModal = props => {
const [isVisibleRoles, setIsVisibleRoles] = useState(false);
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色']);
const [keepFiled, setKeepFiled] = useState([]);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -191,14 +192,27 @@ const AddModal = props => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setFiled1(formateArrDataA1(res.data, 'groupType'));
console.log(filed1);
console.log(filed1['角色']);
setKeepFiled(groupArr(res.data, 'groupType'));
setFf(filed1['角色']);
console.log(ff);
console.log(res.data);
}
});
};
const groupArr = (initialArr, name) => {
let list = {};
initialArr.data.map(i => {
let ar = [];
i.root.map(j => {
let ss = {};
ss.label = j.Name;
ss.value = j.ID.toString();
ar.push(ss);
// console.log(ss);
});
list[i.groupType] = ar;
});
return list;
};
const getFeedbackTable = () => {
CM_XWBPlan_feedbackTable().then(res => {
if (res.code === 0) {
......@@ -557,10 +571,10 @@ const AddModal = props => {
onCancel={() => setIsVisibleRoles(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
keepFiled={keepFiled}
/>
</Drawer>
);
......
......@@ -11,7 +11,6 @@ const ChangeAdd = props => {
isType,
visible,
newCheckedList,
filed1,
filed,
pickItem,
characterValue,
......@@ -44,7 +43,6 @@ const ChangeAdd = props => {
str: selectData.join(','),
pickItem,
stt: selectData,
filed22: filed1,
isType,
});
};
......
......@@ -39,6 +39,7 @@ const AddModal = props => {
const [nu1, setNu1] = useState([]);
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
const [keepFiled, setKeepFiled] = useState([]);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -86,11 +87,27 @@ const AddModal = props => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.code === 0) {
setNu1(res.data);
setFiled1(formateArrDataA1(res.data, 'groupType'));
// setFiled1(formateArrDataA1(res.data, 'groupType'));
setKeepFiled(groupArr(res.data, 'groupType'));
}
});
};
const groupArr = (initialArr, name) => {
let list = {};
initialArr.data.map(i => {
let ar = [];
i.root.map(j => {
let ss = {};
ss.label = j.Name;
ss.value = j.ID.toString();
ar.push(ss);
});
list[i.groupType] = ar;
});
return list;
};
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
......@@ -446,10 +463,10 @@ const AddModal = props => {
onCancel={() => setIsVisibleRoles(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
keepFiled={keepFiled}
/>
</Drawer>
);
......
......@@ -60,6 +60,7 @@ const AddFlowsModal = props => {
const [strr, setStrr] = useState('');
const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
const [keepFiled, setKeepFiled] = useState([]);
useEffect(() => {
getRole();
......@@ -268,7 +269,8 @@ const AddFlowsModal = props => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setNu1(res.data);
setFiled1(formateArrDataA1(res.data, 'groupType'));
// setFiled1(formateArrDataA1(res.data, 'groupType'));
setKeepFiled(groupArr(res.data, 'groupType'));
console.log(res.data);
}
});
......@@ -308,13 +310,33 @@ const AddFlowsModal = props => {
// }
console.log(a);
console.log(pp);
setFiled1(pp);
setKeepFiled(groupArr(nu1, 'group'));
// setFiled1(pp);
console.log(fileds);
setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds);
setVisible1(true);
};
const groupArr = (initialArr, name) => {
let list = {};
console.log(initialArr);
initialArr.data.map(i => {
console.log(i);
let ar = [];
i.root.map(j => {
let ss = {};
ss.label = j.Name;
ss.value = j.ID.toString();
ar.push(ss);
// console.log(ss);
});
list[i.groupType] = ar;
});
console.log(list);
return list;
};
const onOKk = prop => {
setVisible1(false);
let inputText = { ...inputValue };
......@@ -405,10 +427,10 @@ const AddFlowsModal = props => {
onCancel={() => setVisible1(false)}
callBackSubmit={onOKk}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
keepFiled={keepFiled}
/>
</Drawer>
);
......
......@@ -687,7 +687,7 @@ const AddModal = props => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setNu1(res.data);
setFiled1(formateArrDataA1(res.data, 'groupType'));
// setFiled1(formateArrDataA1(res.data, 'groupType'));
setKeepFiled(groupArr(res.data, 'groupType'));
}
});
......@@ -978,9 +978,9 @@ const AddModal = props => {
i.root.map(j => {
let ss = {};
ss.label = j.Name;
ss.value = j.ID;
ss.value = j.ID.toString();
ar.push(ss);
console.log(ss);
// console.log(ss);
});
list[i.groupType] = ar;
});
......@@ -988,70 +988,70 @@ const AddModal = props => {
return list;
};
const formateArrDataA1 = (initialArr, name) => {
console.log(initialArr);
let aa = [];
let a1 = [];
let a2;
let a3 = [];
initialArr.data.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);
// const formateArrDataA1 = (initialArr, name) => {
// console.log(initialArr);
// let aa = [];
// let a1 = [];
// let a2;
// let a3 = [];
// initialArr.data.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]);
}
}
}
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 '请传入正确格式的数组';
// }
// 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]);
// }
// }
// }
// for (let key in tempObj) {
// let arr = [];
// tempObj[key].map(item => {
// tempObj[key] = arr;
// arr.push(item.Name);
// });
// }
// return tempObj;
// };
const onChange1 = e => {
setEditable(e.target.checked);
......@@ -1177,15 +1177,15 @@ const AddModal = props => {
const pickFiled1 = fileds => {
console.log(nu1);
let pp = formateArrDataA1(nu1, 'group');
// let pp = formateArrDataA1(nu1, 'group');
setKeepFiled(groupArr(nu1, 'group'));
if (form.getFieldValue(fileds)) {
setFiled1(pp);
// setFiled1(pp);
setCheckedList1(form.getFieldValue(fileds).split(','));
setPickItem(fileds);
setIsVisible(true);
} else {
setFiled1(pp);
// setFiled1(pp);
setCheckedList1([]);
setPickItem(fileds);
setIsVisible(true);
......@@ -1787,11 +1787,10 @@ const AddModal = props => {
onCancel={onCancel}
callBackSubmit={onOK}
newCheckedList={checkedList1} // 单选框中的值
filed11={filed1} // 全部待选数据
pickItem={pickItem}
groupName={groupName} // 打开组件展示的分组名,用来首次获取数据
chooseGroupName={chooseGroupName} // 可选分组名
keepFiled={keepFiled}
keepFiled={keepFiled} // 分组数据
/>
<ChangeEdit
visible={isVisibleEdit}
......
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