|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="siteManage-main roleInfoPage">
|
|
<div class="siteManage-main roleInfoPage">
|
|
<el-table
|
|
<el-table
|
|
- :data="tableData"
|
|
|
|
|
|
+ :data="menuData2"
|
|
border
|
|
border
|
|
stripe
|
|
stripe
|
|
:cell-style="cellStyle"
|
|
:cell-style="cellStyle"
|
|
@@ -22,6 +22,7 @@
|
|
:key="item.actionid"
|
|
:key="item.actionid"
|
|
v-model="item.checked"
|
|
v-model="item.checked"
|
|
:disabled="radio1 == 1 ? true : false"
|
|
:disabled="radio1 == 1 ? true : false"
|
|
|
|
+ @change="handleCheckedChange"
|
|
></el-checkbox>
|
|
></el-checkbox>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -47,142 +48,11 @@ import { ElMessage } from 'element-plus'
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'RoleInfoCom',
|
|
name: 'RoleInfoCom',
|
|
- props: ['menuData', 'objItem', 'radio1', 'checkedKeys'],
|
|
|
|
|
|
+ props: ['menuData', 'menuData2', 'objItem', 'radio1', 'checkedKeys'],
|
|
|
|
|
|
setup(props) {
|
|
setup(props) {
|
|
const saveArr = ref([])
|
|
const saveArr = ref([])
|
|
-
|
|
|
|
- const tableData = ref([
|
|
|
|
- {
|
|
|
|
- id: '1',
|
|
|
|
- menu: '告警管理',
|
|
|
|
- authority: [
|
|
|
|
- { id:'111',name: '查询', checked: true },
|
|
|
|
- { id:'112',name: '修改', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '2',
|
|
|
|
- menu: '站点管理',
|
|
|
|
- authority: [
|
|
|
|
- {id:'211',name: '查询', checked: true },
|
|
|
|
- {id:'212',name: '新增', checked: true },
|
|
|
|
- {id:'213', name: '修改', checked: true },
|
|
|
|
- {id:'214',name: '删除', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '3',
|
|
|
|
- menu: '台区管理',
|
|
|
|
- authority: [
|
|
|
|
- {id:'311', name: '查询', checked: true },
|
|
|
|
- {id:'312', name: '新增', checked: true },
|
|
|
|
- {id:'313', name: '修改', checked: true },
|
|
|
|
- {id:'314', name: '删除', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '4',
|
|
|
|
- menu: '设备管理',
|
|
|
|
- authority: [
|
|
|
|
- {id:'411', name: '查询', checked: true },
|
|
|
|
- {id:'412', name: '新增', checked: true },
|
|
|
|
- {id:'413', name: '修改', checked: true },
|
|
|
|
- {id:'414', name: '删除', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- {
|
|
|
|
- id: '5',
|
|
|
|
- menu: '数据管理',
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- id: '51',
|
|
|
|
- menu: '同比分析报表',
|
|
|
|
- authority: [{id:'511', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '52',
|
|
|
|
- menu: '环比分析报表',
|
|
|
|
- authority: [{ id:'521',name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '53',
|
|
|
|
- menu: '用能月报',
|
|
|
|
- authority: [{id:'531', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '54',
|
|
|
|
- menu: '需量分析',
|
|
|
|
- authority: [{id:'541', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '6',
|
|
|
|
- menu: '电能质量',
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- id: '61',
|
|
|
|
- menu: '谐波报表',
|
|
|
|
- authority: [{id:'611', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '62',
|
|
|
|
- menu: '实时监测',
|
|
|
|
- authority: [{id:'621', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '63',
|
|
|
|
- menu: '评估报告',
|
|
|
|
- authority: [{id:'631', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '64',
|
|
|
|
- menu: '三项不平衡分析',
|
|
|
|
- authority: [{id:'641', name: '查询', checked: true }],
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- {
|
|
|
|
- id: '7',
|
|
|
|
- menu: '计划停电',
|
|
|
|
- authority: [
|
|
|
|
- {id:'711', name: '查询', checked: true },
|
|
|
|
- {id:'712', name: '新增', checked: true },
|
|
|
|
- {id:'713', name: '修改', checked: true },
|
|
|
|
- {id:'714', name: '删除', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- {
|
|
|
|
- id: '8',
|
|
|
|
- menu: '系统管理',
|
|
|
|
- children: [
|
|
|
|
- {
|
|
|
|
- id: '81',
|
|
|
|
- menu: '用户管理',
|
|
|
|
- authority: [
|
|
|
|
- {id:'811', name: '查询', checked: true },
|
|
|
|
- {id:'812', name: '新增', checked: true },
|
|
|
|
- {id:'813', name: '修改', checked: true },
|
|
|
|
- {id:'814', name: '删除', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- id: '82',
|
|
|
|
- menu: '权限管理',
|
|
|
|
- authority: [
|
|
|
|
- {id:'821', name: '查询', checked: true },
|
|
|
|
- {id:'822', name: '新增', checked: true },
|
|
|
|
- {id:'823', name: '修改', checked: true },
|
|
|
|
- {id:'824', name: '删除', checked: true },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- ])
|
|
|
|
|
|
+ const checkedArr = ref([])
|
|
|
|
|
|
function cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
function cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
row, column, rowIndex
|
|
row, column, rowIndex
|
|
@@ -192,9 +62,11 @@ export default defineComponent({
|
|
}
|
|
}
|
|
|
|
|
|
function saveMenu() {
|
|
function saveMenu() {
|
|
|
|
+ console.log('checkedArr')
|
|
|
|
+ console.log(checkedArr.value)
|
|
api
|
|
api
|
|
.saveMenu({
|
|
.saveMenu({
|
|
- menuIds: saveArr.value,
|
|
|
|
|
|
+ menuIds: checkedArr.value,
|
|
roleId: props.radio1,
|
|
roleId: props.radio1,
|
|
roleKey: props.objItem.roleKey,
|
|
roleKey: props.objItem.roleKey,
|
|
roleName: props.objItem.roleName,
|
|
roleName: props.objItem.roleName,
|
|
@@ -215,7 +87,7 @@ export default defineComponent({
|
|
function getTreeData(data) {
|
|
function getTreeData(data) {
|
|
// 循环遍历json数据
|
|
// 循环遍历json数据
|
|
for (var i = 0; i < data.length; i++) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
- data[i]['disabled'] = true;
|
|
|
|
|
|
+ data[i]['disabled'] = true
|
|
if (!data[i].children) {
|
|
if (!data[i].children) {
|
|
// children若为空数组,则不作操作
|
|
// children若为空数组,则不作操作
|
|
} else {
|
|
} else {
|
|
@@ -225,14 +97,38 @@ export default defineComponent({
|
|
}
|
|
}
|
|
return data
|
|
return data
|
|
}
|
|
}
|
|
|
|
+ function handleCheckedChange() {
|
|
|
|
+ checkedArr.value = []
|
|
|
|
+ getCheckedArr()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 复选框选中的数组集合start
|
|
|
|
+ function getCheckedArr() {
|
|
|
|
+ props.menuData2.forEach(function (item) {
|
|
|
|
+ if (item.children) {
|
|
|
|
+ item.children.forEach(function (a) {
|
|
|
|
+ a.authority.forEach(function (i) {
|
|
|
|
+ if (i.checked) {
|
|
|
|
+ checkedArr.value.push(i.id)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ item.authority.forEach(function (i) {
|
|
|
|
+ if (i.checked) {
|
|
|
|
+ checkedArr.value.push(i.id)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ console.log('checkedArr.value')
|
|
|
|
+ console.log(checkedArr.value)
|
|
|
|
+ }
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- saveArr.value = props.checkedKeys
|
|
|
|
- //当为超级管理员禁止修改权限
|
|
|
|
- if (props.radio1 == 1) {
|
|
|
|
- getTreeData(props.menuData)
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ console.log('子组件中的menuData2')
|
|
|
|
+ console.log(props.menuData2)
|
|
|
|
+ getCheckedArr()
|
|
})
|
|
})
|
|
|
|
|
|
//监听变化
|
|
//监听变化
|
|
@@ -240,16 +136,18 @@ export default defineComponent({
|
|
() => props.radio1,
|
|
() => props.radio1,
|
|
(newVal) => {
|
|
(newVal) => {
|
|
newVal
|
|
newVal
|
|
|
|
+ // checkedArr.value=[]
|
|
}
|
|
}
|
|
)
|
|
)
|
|
|
|
|
|
return {
|
|
return {
|
|
- tableData,
|
|
|
|
cellStyle,
|
|
cellStyle,
|
|
saveMenu,
|
|
saveMenu,
|
|
saveArr,
|
|
saveArr,
|
|
|
|
+ getCheckedArr,
|
|
getTreeData,
|
|
getTreeData,
|
|
-
|
|
|
|
|
|
+ checkedArr,
|
|
|
|
+ handleCheckedChange,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
})
|
|
})
|