Browse Source

op端企业管理服务权限树修改

temp
duyufeng 2 months ago
parent
commit
029d665c0f
  1. 68
      hx-op/src/view/organizationManage/enterpriseManage/index.vue
  2. 3
      hx-op/src/view/systemManage/systemMenu/editSystemMenu.vue

68
hx-op/src/view/organizationManage/enterpriseManage/index.vue

@ -32,7 +32,7 @@
v-model:value="searchValue" v-model:value="searchValue"
style="margin-bottom: 8px" style="margin-bottom: 8px"
@search="onSearch" /> --> @search="onSearch" /> -->
<a-tree v-if="treeData?.length" v-model:checkedKeys="checkedKeys" v-bind="serverTree" /> <a-tree v-if="treeData?.length" v-model:checkedKeys="checkedKeys" v-bind="serverTree"/>
</ns-drawer> </ns-drawer>
<TreeAdd ref="treeAdd" @ok="handleOk" :info="currentBoundaryRecord" /> <TreeAdd ref="treeAdd" @ok="handleOk" :info="currentBoundaryRecord" />
@ -82,9 +82,10 @@
const comApi = computed(() => { const comApi = computed(() => {
return calMap[opType.value as keyof typeof calMap]; return calMap[opType.value as keyof typeof calMap];
}); });
// tablereloaddrawerclose // tablereloaddrawerclose
const fetch = (params, isReload = true) => { const fetch = (params, isReload = true) => {
console.log(params)
console.log(comApi.value)
http.post(comApi.value, params).then(() => { http.post(comApi.value, params).then(() => {
NsMessage.success('操作成功'); NsMessage.success('操作成功');
onClose(); onClose();
@ -197,10 +198,61 @@
// //
const getTree = (params) => { const getTree = (params) => {
return http.post(enterPrise.permissionTree, params).then((res) => { return http.post(enterPrise.permissionTree, params).then((res) => {
treeData.value = res.data?.data; // treeData.value = res.data?.data;
let dataTreeList = res.data?.data;
let getDataTreeList = dataTreeListReply(dataTreeList)
treeData.value = filterTreeData(getDataTreeList);
}); });
}; };
getTree({}); // hidden"
const dataTreeListReply =(data:any)=>{
return data.map(item => {
if (item.menus && item.menus.length > 0) {
return {
...item,
menus: dataTreeListReply(item.menus),
};
}
if (item.menus && item.menus.length == 0) {
item.hidden = true;
}
return item;
});
}
//menus
const filterTreeData = (data:any) => {
return data.map(item => {
//menus
if (item.menus && item.menus.length > 0) {
item.menus.map(itemchild=>{
if(itemchild.menus && itemchild.menus.length==0){
item.class = 'parentNodeArrowHide';
}
})
return {
...item,
menus: filterTreeData(item.menus),
};
}else{
if(item.hidden){
item.class = 'leafNodeHide';
}
}
return item;
})
//hidden
// return data.filter(item => !item.hidden).map(item => {
// if (item.menus) {
// return {
// ...item,
// menus: filterTreeData(item.menus),
// };
// }
// return item;
// });
}
getTree({})
// //
const getPermissionData = (params) => { const getPermissionData = (params) => {
@ -354,3 +406,11 @@
} }
} }
</style> </style>
<style>
.leafNodeHide{
display:none!important;
}
.parentNodeArrowHide .ant-tree-switcher{
visibility: hidden;
}
</style>

3
hx-op/src/view/systemManage/systemMenu/editSystemMenu.vue

@ -164,7 +164,6 @@
}; };
// //
const chanageMenuType = (e:any,typeMenu:any)=>{ const chanageMenuType = (e:any,typeMenu:any)=>{
console.log(e)
let currentType = null; let currentType = null;
if(e && e.target){ if(e && e.target){
currentType = e.target.value; currentType = e.target.value;
@ -246,8 +245,6 @@
if(menuRadioType.value==1){ if(menuRadioType.value==1){
params.pid = currentLineData.value?currentLineData.value.pid:"root";//pid,'root' params.pid = currentLineData.value?currentLineData.value.pid:"root";//pid,'root'
} }
console.log("1234567777")
console.log(menuRadioType.value)
if(addOrEditType.value==1){// if(addOrEditType.value==1){//
http.post(menuS.queryMenuPageAdd, params).then(() => { http.post(menuS.queryMenuPageAdd, params).then(() => {
NsMessage.success('操作成功'); NsMessage.success('操作成功');

Loading…
Cancel
Save