| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="项目名"> |
| | | <el-select v-model="ruleForm.projectId" controls-position="right" placeholder="请输入排序" class="w100"> |
| | | <el-select @change="handelMenu" v-model="ruleForm.projectId" controls-position="right" placeholder="请输入排序" class="w100"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="item.key" |
| | |
| | | }, |
| | | menuData: [], // 上级菜单数据 |
| | | projectList:[ |
| | | {id:'1',name:'基础数据权限管理系统',key:0}, |
| | | {id:'2',name:'系统1',key:1}, |
| | | {id:'3',name:'系统2',key:2}, |
| | | {id:'4',name:'系统3',key:3}, |
| | | {id:'5',name:'系统4',key:4}, |
| | | {id:'6',name:'应急管理系统',key:5}, |
| | | {id:'7',name:'目标责任管理系统',key:6}, |
| | | {id:'8',name:'事故管理系统',key:7}, |
| | | {id:'9',name:'设备综合管控系统',key:8}, |
| | | ], |
| | | }); |
| | | // 获取 vuex 中的路由 |
| | |
| | | return arr; |
| | | }; |
| | | // 打开弹窗 |
| | | const openDialog = (type:string,value:any) => { |
| | | const openDialog = (type:string,value:any,projectList: any,projectId:string) => { |
| | | state.projectList = JSON.parse(JSON.stringify(projectList)) |
| | | state.isShowDialog = true; |
| | | if(type === '新增菜单'){ |
| | | if(type === '新增'){ |
| | | state.buttonName = '新增' |
| | | state.title = '新增菜单' |
| | | state.ruleForm = { |
| | | projectId:'', |
| | | projectId:projectId, |
| | | parentId:0, |
| | | menuSuperior: [], |
| | | menuType: 'menu', |
| | |
| | | state.buttonName = '修改' |
| | | state.title = '修改菜单' |
| | | state.ruleForm = JSON.parse(JSON.stringify(value)) |
| | | state.ruleForm.projectId = projectId.toString() |
| | | } |
| | | handelMenu() |
| | | }; |
| | | // 关闭弹窗 |
| | | const closeDialog = () => { |
| | |
| | | // setBackEndControlRefreshRoutes() // 刷新菜单,未进行后端接口测试 |
| | | }; |
| | | |
| | | const show = () => { |
| | | console.log(JSON.parse(JSON.stringify(state.ruleForm.menuSuperior))); |
| | | const handelMenu = async () => { |
| | | let res = await useMenuApi().getMenuAdmin(state.ruleForm.projectId) |
| | | state.menuData = JSON.parse(JSON.stringify(getMenuList(res.data.data))) |
| | | } |
| | | // 页面加载时 |
| | | onMounted(async () => { |
| | | let res = await useMenuApi().getMenuAdmin(Session.get('projectId')) |
| | | state.menuData = JSON.parse(JSON.stringify(getMenuList(res.data.data))) |
| | | // let res = await useMenuApi().getMenuAdmin(Session.get('projectId')) |
| | | // state.menuData = JSON.parse(JSON.stringify(getMenuList(res.data.data))) |
| | | }); |
| | | return { |
| | | openDialog, |
| | | closeDialog, |
| | | onCancel, |
| | | onSubmit, |
| | | handelMenu, |
| | | ...toRefs(state), |
| | | }; |
| | | }, |