| | |
| | | <template> |
| | | <el-dialog |
| | | class="command-page-view-dialog" |
| | | v-model="visible" |
| | | title="角色权限配置" |
| | | width="620px" |
| | | append-to-body |
| | | :close-on-click-modal="false" |
| | | destroy-on-close |
| | | @closed="handleClosed" |
| | | > |
| | | <el-tabs type="border-card"> |
| | | <el-tab-pane label="后台管理"> |
| | | <el-tree |
| | | ref="treeMenu" |
| | | :data="menuGrantList" |
| | | show-checkbox |
| | | node-key="id" |
| | | :default-checked-keys="menuTreeObj" |
| | | :props="treeProps" |
| | | /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="移动app"> |
| | | <el-tree |
| | | ref="treeMenuApp" |
| | | :data="menuGrantListApp" |
| | | show-checkbox |
| | | node-key="id" |
| | | :default-checked-keys="menuTreeObjApp" |
| | | :props="treeProps" |
| | | /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="新大屏菜单"> |
| | | <el-tree |
| | | ref="treeMenuWebNew" |
| | | :data="menuGrantListNew" |
| | | show-checkbox |
| | | node-key="id" |
| | | :default-checked-keys="menuTreeObjNew" |
| | | :props="treeProps" |
| | | /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="无人机管控"> |
| | | <el-tree |
| | | class="command-tree" |
| | | ref="droneControl" |
| | | :data="menuGrantListDroneControl" |
| | | show-checkbox |
| | |
| | | </el-tab-pane> |
| | | <el-tab-pane label="任务工单"> |
| | | <el-tree |
| | | class="command-tree" |
| | | ref="workRef" |
| | | :data="menuGrantListWord" |
| | | show-checkbox |
| | |
| | | :props="treeProps" |
| | | /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="大屏菜单"> |
| | | <el-tab-pane label="移动app"> |
| | | <el-tree |
| | | ref="treeMenuWebOld" |
| | | :data="menuGrantListOld" |
| | | class="command-tree" |
| | | ref="treeMenuApp" |
| | | :data="menuGrantListApp" |
| | | show-checkbox |
| | | node-key="id" |
| | | :default-checked-keys="menuTreeObjOld" |
| | | :default-checked-keys="menuTreeObjApp" |
| | | :props="treeProps" |
| | | /> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <template #footer> |
| | | <el-button @click="visible = false">取 消</el-button> |
| | | <el-button type="primary" @click="submit">确 定</el-button> |
| | | <el-button color="#2B2B4C" @click="visible = false">取消</el-button> |
| | | <el-button color="#284FE3" type="primary" @click="submit">确定</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | |
| | | label: 'title', |
| | | value: 'key', |
| | | } |
| | | const menuGrantList = ref([]) |
| | | const menuGrantListApp = ref([]) |
| | | const menuGrantListOld = ref([]) |
| | | const menuGrantListNew = ref([]) |
| | | const menuGrantListDroneControl = ref([]) |
| | | const menuGrantListWord = ref([]) |
| | | const menuTreeObj = ref([]) |
| | | const menuTreeObjApp = ref([]) |
| | | const menuTreeObjOld = ref([]) |
| | | const menuTreeObjNew = ref([]) |
| | | const droneControlMenuTreeObj = ref([]) |
| | | const menuTreeObjWork = ref([]) |
| | | |
| | | const treeMenu = ref(null) |
| | | const treeMenuApp = ref(null) |
| | | const treeMenuWebOld = ref(null) |
| | | const treeMenuWebNew = ref(null) |
| | | const workRef = ref(null) |
| | | const droneControl = ref(null) |
| | | |
| | |
| | | const route = useRoute() |
| | | |
| | | function resetState() { |
| | | menuGrantList.value = [] |
| | | menuGrantListApp.value = [] |
| | | menuGrantListOld.value = [] |
| | | menuGrantListNew.value = [] |
| | | menuGrantListDroneControl.value = [] |
| | | menuGrantListWord.value = [] |
| | | menuTreeObj.value = [] |
| | | menuTreeObjApp.value = [] |
| | | menuTreeObjOld.value = [] |
| | | menuTreeObjNew.value = [] |
| | | droneControlMenuTreeObj.value = [] |
| | | menuTreeObjWork.value = [] |
| | | } |
| | |
| | | visible.value = true |
| | | resetState() |
| | | await Promise.all([ |
| | | loadGrantTree(1, menuGrantList, menuTreeObj), |
| | | loadGrantTree(3, menuGrantListApp, menuTreeObjApp), |
| | | loadGrantTree(4, menuGrantListNew, menuTreeObjNew), |
| | | loadGrantTree(5, menuGrantListDroneControl, droneControlMenuTreeObj), |
| | | loadGrantTree(6, menuGrantListWord, menuTreeObjWork), |
| | | loadGrantTree(2, menuGrantListOld, menuTreeObjOld), |
| | | ]) |
| | | } |
| | | |
| | | function submit() { |
| | | const menuList = treeMenu.value?.getCheckedKeys?.() ?? [] |
| | | const menuListApp = treeMenuApp.value?.getCheckedKeys?.() ?? [] |
| | | const menuListWebNew = treeMenuWebNew.value?.getCheckedKeys?.() ?? [] |
| | | const menuListWebWork = workRef.value?.getCheckedKeys?.() ?? [] |
| | | const menuListDroneControl = droneControl.value?.getCheckedKeys?.() ?? [] |
| | | const menuListWebOld = treeMenuWebOld.value?.getCheckedKeys?.() ?? [] |
| | | grant( |
| | | [roleId.value], |
| | | [...menuList, ...menuListApp, ...menuListWebNew, ...menuListDroneControl, ...menuListWebOld, ...menuListWebWork], |
| | | [...menuListApp, ...menuListDroneControl, ...menuListWebWork], |
| | | [], |
| | | [] |
| | | ).then(() => { |