lchao 1 天之前
父节点
当前提交
e368c8edbd
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. 10 6
      monitor_ui/src/views/centerMonitor/LabelManagement/setLabel.vue

+ 10 - 6
monitor_ui/src/views/centerMonitor/LabelManagement/setLabel.vue

@@ -181,7 +181,7 @@ export default {
         type: undefined,
         sort: undefined,
         id: undefined,
-        parentId: undefined,
+        parentId: null,
         sbNotes: undefined
       },
       // 表单参数
@@ -271,7 +271,7 @@ export default {
     reset() {
       this.form = {
         id: undefined,
-        parentId: 0,
+        parentId: null,
         name: undefined,
         icon: undefined,
         orderNum: undefined
@@ -295,10 +295,9 @@ export default {
     handleAdd(row) {
       this.reset()
       this.getTreeselect()
-      if (row != null && row.id) {
-        this.form.parentId = row.id
-      } else {
-        this.form.parentId = 0
+      this.form.parentId = row?.id || 0;
+      if (row?.id) {
+        this.form.parentId = row.name;
       }
       this.open = true
       this.title = '添加菜单'
@@ -318,6 +317,11 @@ export default {
       getlabel(row.id).then(response => {
         this.form = response.data
         this.form.labelTypeList = this.form.labelTypeList.map(item => item.type)
+        if (row?.id) {
+          this.form.parentId = row.name;
+        } else {
+          this.form.parentId = 0;
+        }
         this.open = true
         this.title = '修改菜单'
       })