浏览代码

修改表格管理在路由删除情况下的修改逻辑

lph 1 年之前
父节点
当前提交
9e57bf02fa
共有 1 个文件被更改,包括 28 次插入2 次删除
  1. 28 2
      zkqy-ui/src/views/tableMange/index.vue

+ 28 - 2
zkqy-ui/src/views/tableMange/index.vue

@@ -738,6 +738,7 @@ export default {
   components: { Queryfrom, Treeselect, StyleFormPanel, DataFilterPanel },
   data() {
     return {
+      isNeedNewMenu: false, //是否需要新菜单
       filterDataEcho: "", //数据过滤回显数据
       staictitle: "添加统计数据字段",
       isInputInvalid: false,
@@ -1594,7 +1595,8 @@ export default {
           // 表单
           let result;
           // if (this.tId && this.menuId) {
-          if (this.menuId) {
+          if (this.menuId && !this.isNeedNewMenu) {
+            //原菜单存在,仅需要修改菜单数据
             let payLoad = {
               menuId: this.menuId,
               menuName: this.formData.menuName,
@@ -1610,6 +1612,29 @@ export default {
               tenantId: this.tenantId,
             };
             result = await updateMenu(payLoad);
+          } else if (this.isNeedNewMenu) {
+            console.log(111);
+            //给旧表格新增菜单
+            let tableKeyObj = {
+              tableKey: this.editData.tableKey,
+            };
+            let payLoad = {
+              component: "tablelist/commonTable/listInfo",
+              icon: "",
+              isCache: "0",
+              isFrame: "1",
+              menuName: this.formData.menuName,
+              // menuId: this.formData.routePath,
+              menuType: "C",
+              orderNum: this.menuOrderNum,
+              parentId: this.formData.routePath,
+              path: this.uuid,
+              query: JSON.stringify(tableKeyObj),
+              status: "0",
+              visible: "0",
+              tenantId: this.tenantId,
+            };
+            result = await addMenu(payLoad);
           } else {
             let tableKeyObj = {
               tableKey: this.uuid,
@@ -1813,12 +1838,13 @@ export default {
 
         if (!this.formData.routePath) {
           this.$message.warning("该表格菜单路由已经删除,请重新配置");
+          this.isNeedNewMenu = true;
         }
         // this.formData.routePath
         this.editData = res.data;
         let val = await getParticMenu(res.data.tableKey);
         if (val.code == 200) {
-          this.menuId = val.data.menuId;
+          this.menuId = val.data?.menuId;
         }
       } else {
         this.$message.error("数据回显失败");