ソースを参照

处理表单组布局重复表单添加问题

lph 1 年間 前
コミット
0a376b887d

+ 33 - 0
zkqy-ui/src/views/system/formGroupMange/component/DragPosition.vue

@@ -62,6 +62,7 @@ import TopToolBar from "./TopToolBar.vue"; //右侧tab
 import { updateFormGroup } from "@/api/system/formGroup";
 import JSONViewer from "./JSONViewer.vue";
 import PreView from "./PreView.vue";
+import Result from "@/components/Crontab/result.vue";
 
 export default {
   name: "DragPosition",
@@ -249,9 +250,41 @@ export default {
     handleStart(type) {
       this.startType = type;
     },
+    checkIsRepeat(dfNickname) {
+      console.log(dfNickname, this.layoutData);
+      let res = {
+        result: false,
+      };
+      let checkDF = (list, res) => {
+        for (let i = 0; i < list.length; i++) {
+          let temp = list[i];
+          if (temp.type == "form") {
+            console.log(temp.dfNickname, dfNickname);
+            if (temp.dfNickname == dfNickname) {
+              res.result = true;
+            }
+          } else if (temp.type == "tabs" || temp.type == "grid") {
+            for (let k = 0; k < temp.columns.length; k++) {
+              checkDF(temp.columns[k].list, res);
+            }
+          }
+        }
+      };
+      checkDF(this.layoutData.list, res);
+      return res.result;
+    },
+    // 校验当前表单是否已存在
     handleListPush(item) {
       console.log(this.selectItem);
       console.log(item);
+      if (item.type == "form") {
+        let isRepeat = this.checkIsRepeat(item.dfNickname);
+        console.log("isRepeat", isRepeat);
+        if (isRepeat) {
+          this.$message.error("该表单已存在!");
+          return;
+        }
+      }
       // 生成key值
       // if (!this.selectItem?.key) {
       // 在没有选择表单时,将数据push到this.data.list

+ 1 - 1
zkqy-ui/src/views/system/formGroupMange/component/TopToolBar.vue

@@ -38,7 +38,7 @@
         type="text"
         size="medium"
         @click="$emit('showPreView')"
-        icon="el-icon-document"
+        icon="el-icon-picture-outline"
         round
       ></el-button>
     </el-tooltip>