修改菜单选择父级菜单时的bug

This commit is contained in:
zsvg
2022-06-19 21:37:08 +08:00
parent 44b41e8fd5
commit d81ae9aa34
4 changed files with 22 additions and 14 deletions
+18 -10
View File
@@ -1,5 +1,5 @@
<template>
<el-dialog v-model='dialogVisible' title='弹框选择' draggable width='500px' :before-close='handleClose'>
<el-dialog v-model='dialogVisible' title='弹框选择' draggable width='500px'>
<el-card class='box-card' style='height: 500px;' body-style='height: 100%;overflow: auto'>
<template #header>
<div class='card-header'>
@@ -51,6 +51,7 @@ import { ElMessage } from 'element-plus';
const props = defineProps({
url: String,
maInit: Boolean,
});
interface Tree {
@@ -80,7 +81,8 @@ const filterNode = (value: string, data: Tree) => {
const state = reactive({
data: [] as any,
});
params:{},
}) as any;
const handleCommand = (command: string | number | object) => {
@@ -96,28 +98,34 @@ const handleCommand = (command: string | number | object) => {
ElMessage(`click on item ${command}`);
};
const handleClose=()=>{
}
// // 初始化表格数据
const initTreeData = async () => {
state.data = await request({
url: props.url,
method: 'get',
params:state.params
});
};
const dialogVisible = ref(false);
const openModal = async (id: string) => {
const openModal = async (data:any) => {
if(data&&data.params){
state.params=data.params;
}else{
state.params={}
}
if(data&&data.reload){
await initTreeData();
}
dialogVisible.value = true;
};
defineExpose({ openModal });
onMounted(() => {
initTreeData();
onMounted(async () => {
if(props.maInit==false){
await initTreeData();
}
});
const emits = defineEmits(['close']);
+1 -1
View File
@@ -62,7 +62,7 @@ const openModal = async (data: any) => {
form.value.parent = {id: data.pid, name: data.pname};
form.value.pid = data.pid;
}
console.log(form.value);
// console.log(form.value);
}
await catesInit();
state.show = true;
+1 -1
View File
@@ -20,7 +20,7 @@
{{ form.agbro }}
</el-form-item>
<el-form-item label='请求参数:' style="width: 100%;">
{{ form.params }}
{{ form.param }}
</el-form-item>
</el-form>
<template #footer>
+2 -2
View File
@@ -27,7 +27,7 @@
<el-col :span='12'>
<el-form-item label='上级菜单:'>
<el-input v-model='form.parna' readonly :suffix-icon='Search' @click='openParentModal'></el-input>
<ParentModal url='/sys/portal/menu/tree' ref='parentModal' @close='closeParentModal'/>
<ParentModal url='/sys/portal/menu/tree' :maInit="true" ref='parentModal' @close='closeParentModal'/>
</el-form-item>
</el-col>
</el-row>
@@ -199,7 +199,7 @@ onMounted(() => {
const parentModal = ref();
const openParentModal = () => {
parentModal.value.openModal();
parentModal.value.openModal({reload:true,params:{porid:state.form.porid}});
};
const closeParentModal = (node: any) => {