From 9b4433fddf5b401edb0aace8a404ac733b122702 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期四, 03 四月 2025 14:35:02 +0800
Subject: [PATCH] 添加非密字段显示

---
 Source/UBCS-WEB/src/components/FormTemplate/index.vue |  247 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 167 insertions(+), 80 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index e0e0dc1..d8ea149 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -17,6 +17,7 @@
       :TreeValue="TreeValue"
       :eventList="eventList"
       :rowOid="rowOid"
+      :selectRow="selectRow"
       :status="status"
       :templateOid="templateOid"
       :type="type"
@@ -38,8 +39,10 @@
         <el-tab-pane v-if="showCodeApply" label="鐮佸�肩敵璇�" name="codeApply">
           <FormTemplate
             key="codeApplyForm" ref="CodeApply"
+            :selectRow="selectRow"
             :selfColumnConfig="selfColumnConfig"
             :selfColumnType="selfColumnType"
+            :status="status"
             :type="type"
             data-key="codeApplyForm"
             secDTOListv-bind="$attrs"
@@ -139,6 +142,10 @@
       type: Object,
       default: () => ({}),
     },
+    selectRow: {
+      type: Array,
+      default: []
+    }
   },
   data() {
     return {
@@ -241,18 +248,14 @@
       },
     },
   },
-  watch: {
-    codeApplyForm: {
-      handler(newval, oldval) {
-        // console.log('newval',newval)
-      }
-    }
-  },
+  watch: {},
   methods: {
     openDialog() {
+      //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢�(鏈夋敼鍔� 涓嶉渶瑕佸湪浣跨敤edit锛屾柟娉曟病浠�涔堝奖鍝�)
       this.getFormTemplate();
       if (this.type === "add") {
         this.getCodeRule();
+        return;
       }
     },
     close() {
@@ -260,6 +263,7 @@
     },
     // 鎺ュ彛鑾峰彇琛ㄥ崟鏁版嵁
     getFormTemplate() {
+      //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢�
       getFormTemplate({
         templateOid: this.templateOid,
         codeClassifyOid: this.codeClassifyOid,
@@ -277,6 +281,7 @@
             } else {
               this.showResembleQuery = false;
             }
+            //浼犻�掕〃鍗曚笂鏂瑰尯鍩熸暟鎹� 锛堟柊澧炲拰淇敼锛�
             this.$nextTick(() => {
               this.$refs.FormTemplate.templateRender(
                 res.data.formDefineVO.items
@@ -319,7 +324,7 @@
           that.secVOList = (res.data.data.secVOList || []).filter((item) =>
             typeList.includes(item.secType)
           );
-          if (that.secVOList.length > 0 && that.type === "add") {
+          if (that.secVOList.length > 0 && that.type === "add" || (that.type !== "add" && that.status === "amend")) {
             that.showCodeApply = true;
             that.activeName = "codeApply";
 
@@ -354,7 +359,7 @@
         }
       })
       if (this.$refs.CodeApply) { // 娣诲姞涓�涓垽鏂鍙ワ紝妫�鏌ュ璞℃槸鍚︿负undefined
-        this.$refs.CodeApply.changeChildItem(this.secVOList, this.TreeValue, this.type);
+        this.$refs.CodeApply.changeStatusItem(this.secVOList, this.TreeValue, this.type);
       }
     },
     //骞翠唬鍙�
@@ -370,9 +375,9 @@
       });
 
       if (this.$refs.CodeApply) {
-        this.$refs.CodeApply.changeChildItem(this.secVOList, this.TreeValue, this.type);
+        this.$refs.CodeApply.changeStatusItem(this.secVOList, this.TreeValue, this.type);
       }
-    },,
+    },
     //灞炴�х爜娈佃祴鍊�
     attrListForm(attrListForm) {
       this.attrList = attrListForm;
@@ -409,78 +414,160 @@
       }
     },
     async submit() {
-      // 杩涜琛ㄥ崟鏍¢獙
-      const formValidate = await this.$refs.FormTemplate.validate();
-      if (!formValidate) return;
-      let codeValidate = true;
-      // 杩涜鐮佸�肩敵璇锋牎楠�
-      // if (this.showCodeApply) {
-      //   codeValidate = await this.$refs.CodeApply.validate();
-      //   if (!codeValidate) {
-      //     this.activeName = "codeApply";
-      //     return false;
-      //   }
-      // }
-      let resembleQueryList = [];
-      if (this.showResembleQuery && this.$refs.resembleQueryRef) {
-        // 杩涜鐩镐技椤规煡璇�
-        resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery(
+      if (this.status) {
+        // 杩涜琛ㄥ崟鏍¢獙
+        const formValidate = await this.$refs.FormTemplate.validate();
+        if (!formValidate) return;
+        let resembleQueryList = [];
+        if (this.showResembleQuery && this.$refs.resembleQueryRef) {
+          // 杩涜鐩镐技椤规煡璇�
+          resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery(
+            this.form
+          );
+        }
+        if (resembleQueryList.length > 0) {
+          await this.$confirm(
+            `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋,
+            "闇�瑕佹偍纭",
+            {
+              confirmButtonText: "纭畾",
+              cancelButtonText: "鍙栨秷",
+              type: "warning",
+            }
+          );
+        }
+        // 鎺掗櫎涓�浜涘瓧娈�
+        const noData = [
+          "jiliangdwname",
+          "materialtypeText",
+          "morengongysname",
+          "$caigouwl",
+          "$xiaoshouwl",
+          "$shifoupihaoguanli",
+          "lcstatus_text",
+          "hesuanfenleiname",
+          "$kucunwl",
+          "lastmodifier"
+        ];
+
+        let resForm = {};
+        const {defaultValue, formValue} = this.getDefaultValueAndFormValues(
           this.form
         );
-      }
-      if (resembleQueryList.length > 0) {
-        await this.$confirm(
-          `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋,
-          "闇�瑕佹偍纭",
-          {
-            confirmButtonText: "纭畾",
-            cancelButtonText: "鍙栨秷",
-            type: "warning",
-          }
-        );
-      }
-      // 鎺掗櫎涓�浜涘瓧娈�
-      const noData = [
-        "jiliangdwname",
-        "materialtypeText",
-        "morengongysname",
-        "$caigouwl",
-        "$xiaoshouwl",
-        "$shifoupihaoguanli",
-        "lcstatus_text",
-        "hesuanfenleiname",
-        "$kucunwl",
-        "oldcode",
-        "lastmodifier"
-      ];
-      let resForm = {};
-      const {defaultValue, formValue} = this.getDefaultValueAndFormValues(
-        this.form
-      );
-      noData.forEach((item) => {
-        this.$delete(formValue, item);
-      });
-      const keys = Object.keys(formValue);
-      keys.forEach((item, index) => {
-        keys.forEach((itm, idx) => {
-          if ((item === ('$' + itm)) && idx !== index) {
-            this.$delete(formValue, keys[index]);
-          }
-        })
-      });
+        noData.forEach((item) => {
+          this.$delete(formValue, item);
+        });
+        const keys = Object.keys(formValue);
+        keys.forEach((item, index) => {
+          keys.forEach((itm, idx) => {
+            if ((item === ('$' + itm)) && idx !== index) {
+              this.$delete(formValue, keys[index]);
+            }
+          })
+        });
 
-      resForm.data = formValue;
-      resForm = Object.assign({}, resForm, defaultValue);
-      resForm.secDTOList = this.secVOList.map((item) => {
-        return {
-          secOid: item.oid,
-          secValue: this.codeApplyForm[item.oid],
+        resForm.data = formValue;
+        resForm.data = Object.assign({}, resForm.data, defaultValue);
+        resForm.secDTOList = this.secVOList.map((item) => {
+          return {
+            secOid: item.oid,
+            secValue: this.codeApplyForm[item.oid],
+          };
+        });
+        //鏍囧噯鐗瑰畾瀛楁鏄犲皠
+        const mappings = {
+          codeStandardEditType: 'operationType',
+          reviseSeries: 'series',
+          oldcode: 'oldCode',
+          releaseDate: 'releaseTime',
+          isSeries: 'isEditseries'
         };
-      });
-      resForm.codeClassifyOid = this.codeClassifyOid;
-      resForm.codeRuleOid = this.codeRuleOid;
-      resForm.templateOid = this.templateOid;
-      this.$emit("submit", resForm);
+
+        for (const key in mappings) {
+          if (formValue[key]) {
+            resForm[mappings[key]] = formValue[key];
+          }
+        }
+        //
+        resForm.codeClassifyOid = this.codeClassifyOid;
+        resForm.codeRuleOid = this.codeRuleOid;
+        resForm.templateOid = this.templateOid;
+        this.$emit("submit", resForm);
+      } else {
+        // 杩涜琛ㄥ崟鏍¢獙
+        const formValidate = await this.$refs.FormTemplate.validate();
+        if (!formValidate) return;
+        let codeValidate = true;
+        // 杩涜鐮佸�肩敵璇锋牎楠�
+        // if (this.showCodeApply) {
+        //   codeValidate = await this.$refs.CodeApply.validate();
+        //   if (!codeValidate) {
+        //     this.activeName = "codeApply";
+        //     return false;
+        //   }
+        // }
+        let resembleQueryList = [];
+        if (this.showResembleQuery && this.$refs.resembleQueryRef) {
+          // 杩涜鐩镐技椤规煡璇�
+          resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery(
+            this.form
+          );
+        }
+        if (resembleQueryList.length > 0) {
+          await this.$confirm(
+            `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋,
+            "闇�瑕佹偍纭",
+            {
+              confirmButtonText: "纭畾",
+              cancelButtonText: "鍙栨秷",
+              type: "warning",
+            }
+          );
+        }
+        // 鎺掗櫎涓�浜涘瓧娈�
+        const noData = [
+          "jiliangdwname",
+          "materialtypeText",
+          "morengongysname",
+          "$caigouwl",
+          "$xiaoshouwl",
+          "$shifoupihaoguanli",
+          "lcstatus_text",
+          "hesuanfenleiname",
+          "$kucunwl",
+          "oldcode",
+          "lastmodifier"
+        ];
+
+        let resForm = {};
+        const {defaultValue, formValue} = this.getDefaultValueAndFormValues(
+          this.form
+        );
+        noData.forEach((item) => {
+          this.$delete(formValue, item);
+        });
+        const keys = Object.keys(formValue);
+        keys.forEach((item, index) => {
+          keys.forEach((itm, idx) => {
+            if ((item === ('$' + itm)) && idx !== index) {
+              this.$delete(formValue, keys[index]);
+            }
+          })
+        });
+
+        resForm.data = formValue;
+        resForm = Object.assign({}, resForm, defaultValue);
+        resForm.secDTOList = this.secVOList.map((item) => {
+          return {
+            secOid: item.oid,
+            secValue: this.codeApplyForm[item.oid],
+          };
+        });
+        resForm.codeClassifyOid = this.codeClassifyOid;
+        resForm.codeRuleOid = this.codeRuleOid;
+        resForm.templateOid = this.templateOid;
+        this.$emit("submit", resForm);
+      }
     },
     getDefaultValueAndFormValues(form) {
       let defaultValue = {};
@@ -552,7 +639,7 @@
         };
       } else if (item.secType == "coderefersec") {
         //寮曠敤鐮佹
-        params = JSON.parse(item.referValueInfo);
+        params = JSON.parse(item.referValueInfo || item.referConfig);
       }
       return params;
     },

--
Gitblit v1.9.3