Commit ad9e7c79 authored by 涂伟's avatar 涂伟

fix: '消息推送推送人选择显示bug修复'

parent 9ea6b940
Pipeline #88439 passed with stages
......@@ -13,16 +13,33 @@ const RoleModal = porps => {
let hasCheckList = selectValue ? selectValue.split(',') : [];
RoleGroupList().then(res => {
if (res.code === 0) {
let roleListData = res.data.roleList;
let roleListData = JSON.parse(JSON.stringify(res.data.roleList));
// 给子角色分类放到外面来
roleListData.forEach((item, index) => {
if (item.child.length > 0) {
item.child.forEach((val, i) => {
// roleListData.forEach((item, index) => {
// if (item.child.length > 0) {
// item.child.forEach((val, i) => {
// val.visibleTitle = `${item.visibleTitle}(${val.visibleTitle})`;
// roleListData.splice(index + 1 + i, 0, val);
// });
// }
// });
// 假设 roleListData 是您的原始数组
let newRoleListData = []; // 创建新数组来存放最终的结果
roleListData.forEach((item) => {
newRoleListData.push(item); // 将当前父元素添加到新数组中
if (item.child && item.child.length > 0) {
item.child.forEach((val) => {
val.visibleTitle = `${item.visibleTitle}(${val.visibleTitle})`;
roleListData.splice(index + 1 + i, 0, val);
newRoleListData.push(val); // 将子元素添加到新数组中,紧跟在父元素之后
});
}
});
// 此时 newRoleListData 就是按照您要求的顺序排列的数组
roleListData = newRoleListData;
console.log(roleListData, 'roleListData');
let list = roleListData.map(item => {
let 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