From 1e55c3660b531d9463a564eddb71a16e0e920dfa Mon Sep 17 00:00:00 2001
From: fujunling <2984387807@qq.com>
Date: 星期二, 20 六月 2023 16:36:29 +0800
Subject: [PATCH] 编码申请

---
 Source/UBCS-WEB/src/components/FormTemplate/index.vue |  260 ++++++++++++++++-----------------------------------
 1 files changed, 84 insertions(+), 176 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index a908408..b6946b6 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -3,9 +3,8 @@
     :visible.sync="dialogVisible"
     v-if="dialogVisible"
     v-dialogDrag
-    top="0vh"
+    top="5vh"
     :title="title"
-    class="avue-dialog avue-dialog--top"
     :width="width"
     append-to-body
     @opened="openDialog"
@@ -37,7 +36,7 @@
             :selfColumnType="selfColumnType"
             :selfColumnConfig="selfColumnConfig"
             ref="CodeApply"
-            @getFormData="getFormData"
+            @getFormData="getCodeApplyFormData"
             @referConfigDataUpdate="referConfigDataUpdate"
           ></FormTempalte>
         </el-tab-pane>
@@ -119,6 +118,7 @@
       resembleTableColumn: [],
       secVOList: [],
       form: {},
+      codeApplyForm: {},
       activeName: "codeApply",
       showCodeApply: true,
       showResembleQuery: true,
@@ -154,6 +154,38 @@
           },
         },
       },
+      defaultKeys: [
+        "oid",
+        "id",
+        "name",
+        "description",
+        "revisionoid",
+        "nameoid",
+        "btmname",
+        "lastr",
+        "firstr",
+        "lastv",
+        "firstv",
+        "creator",
+        "createtime",
+        "lastModifier",
+        "lastmodifytime",
+        "revisionrule",
+        "revisionseq",
+        "revisionvalue",
+        "versionrule",
+        "versionseq",
+        "versionvalue",
+        "lcstatus",
+        "ts",
+        "owner",
+        "checkinby",
+        "checkintime",
+        "checkoutby",
+        "checkouttime",
+        "copyfromversion",
+        "secretgrade",
+      ],
     };
   },
   created() {},
@@ -199,7 +231,6 @@
         })
         .catch((err) => {
           this.loading = false;
-          console.log(err);
         });
     },
     // 鑾峰彇鐮佸�肩敵璇锋暟鎹�
@@ -212,172 +243,9 @@
             "codevariablesec",
             "coderefersec",
           ];
-
-          this.secVOList = [
-            {
-              btmname: "codebasicsec",
-              checkInBy: "",
-              checkInTime: null,
-              checkOutBy: "",
-              checkOutTime: null,
-              codeDateFormatStr: "",
-              codeFillFlag: "",
-              codeFillLength: "",
-              codeFillLimit: 0,
-              codeFillSeparator: "",
-              codeFillType: "",
-              codeFillTypeText: "",
-              codeGetValueType: "",
-              codeGetValueTypeText: "",
-              codeLevelType: "",
-              codeLevelTypeText: "",
-              codeLevelValue: 0,
-              codeSecLength: "10",
-              codeSecLengthType: "code_sec_length_variable",
-              codeSecLengthTypeText: "",
-              componentCodeFlag: "false",
-              copyFromVersion: "",
-              createTime: "2023-06-06 14:10:27.000",
-              creator: "1",
-              customCodeSerialClass: "",
-              data: null,
-              description: "",
-              displayFlag: "false",
-              filterSql: "",
-              firstR: "1",
-              firstV: "1",
-              fixedValueVOList: null,
-              getValueClass: "",
-              id: "0001",
-              lastModifier: "1",
-              lastModifyTime: "2023-06-06 14:10:27.000",
-              lastR: "1",
-              lastV: "1",
-              lcStatus: "Exist",
-              lcStatusText: "瀛樺湪",
-              lctid: "defaultLC",
-              matchClassifyValueFlag: "false",
-              name: "鍒嗙被鐮佹鐖�",
-              nameOid: "C2998D32-E89E-6D41-0782-88E97E9EC65B",
-              nullableFlag: "false",
-              oid: "1668926002119708672",
-              orderNum: 1,
-              owner: "1",
-              parentClassifySecOid: "",
-              parentClassifySecText: "",
-              pkCodeRule: "B4766355-E4E1-490A-833B-D5AB73E9B877",
-              referAttributeId: "",
-              referAttributeName: "",
-              referBtmId: "",
-              referBtmName: "",
-              referCodeClassifyOid: "",
-              referCodeClassifyOidName: "",
-              referConfig: "",
-              referValueInfo: "",
-              revisionOid: "F0049108-6AAE-EAAD-BC76-E6714C2B8F2A",
-              revisionRule: "",
-              revisionSeq: 1,
-              revisionValue: "",
-              secretGrade: null,
-              secretGradeText: "",
-              sectype: "codeclassifysec",
-              sectypeText: "鍒嗙被鐮佹",
-              serialDependFlag: "false",
-              serialDependOrder: 0,
-              serialStart: "",
-              serialStep: 0,
-              ts: "2023-06-06 14:10:27.716",
-              valueCutLength: 0,
-              valueCutType: "",
-              valueCutTypeText: "",
-              versionRule: "0",
-              versionSeq: 1,
-              versionValue: "1",
-            },
-            {
-              btmname: "codebasicsec",
-              checkInBy: "",
-              checkInTime: null,
-              checkOutBy: "",
-              checkOutTime: null,
-              codeDateFormatStr: "",
-              codeFillFlag: "",
-              codeFillLength: "",
-              codeFillLimit: 0,
-              codeFillSeparator: "",
-              codeFillType: "",
-              codeFillTypeText: "",
-              codeGetValueType: "",
-              codeGetValueTypeText: "",
-              codeLevelType: "",
-              codeLevelTypeText: "",
-              codeLevelValue: 0,
-              codeSecLength: "10",
-              codeSecLengthType: "code_sec_length_variable",
-              codeSecLengthTypeText: "",
-              componentCodeFlag: "false",
-              copyFromVersion: "",
-              createTime: "2023-06-06 14:10:50.000",
-              creator: "1",
-              customCodeSerialClass: "",
-              data: null,
-              description: "",
-              displayFlag: "false",
-              filterSql: "",
-              firstR: "1",
-              firstV: "1",
-              fixedValueVOList: null,
-              getValueClass: "",
-              id: "000101",
-              lastModifier: "1",
-              lastModifyTime: "2023-06-06 14:10:50.000",
-              lastR: "1",
-              lastV: "1",
-              lcStatus: "Exist",
-              lcStatusText: "瀛樺湪",
-              lctid: "defaultLC",
-              matchClassifyValueFlag: "false",
-              name: "鍒嗙被鐮佹瀛�",
-              nameOid: "1FDB20E3-9F68-A5B0-D097-2142EA054F9B",
-              nullableFlag: "false",
-              oid: "00AD9FE0-A31D-7962-10DF-DC6115EF80A5",
-              orderNum: 2,
-              owner: "1",
-              parentClassifySecOid: "1668926002119708672",
-              parentClassifySecText: "鍒嗙被鐮佹",
-              pkCodeRule: "B4766355-E4E1-490A-833B-D5AB73E9B877",
-              referAttributeId: "",
-              referAttributeName: "",
-              referBtmId: "",
-              referBtmName: "",
-              referCodeClassifyOid: "",
-              referCodeClassifyOidName: "",
-              referConfig: "",
-              referValueInfo: "",
-              revisionOid: "95183EF9-C9AD-2941-1C99-9E9024330D40",
-              revisionRule: "",
-              revisionSeq: 1,
-              revisionValue: "",
-              secretGrade: null,
-              secretGradeText: "",
-              sectype: "codeclassifysec",
-              sectypeText: "鍒嗙被鐮佹",
-              serialDependFlag: "false",
-              serialDependOrder: 0,
-              serialStart: "",
-              serialStep: 0,
-              ts: "2023-06-06 14:10:50.084",
-              valueCutLength: 0,
-              valueCutType: "",
-              valueCutTypeText: "",
-              versionRule: "0",
-              versionSeq: 1,
-              versionValue: "1",
-            },
-          ];
-          // this.secVOList = (res.data.data.secVOList || []).filter((item) =>
-          //   typeList.includes(item)
-          // );
+          this.secVOList = (res.data.data.secVOList || []).filter((item) =>
+            typeList.includes(item)
+          );
           this.$nextTick(() => {
             if (this.secVOList.length > 0 && this.type === "add") {
               this.showCodeApply = true;
@@ -393,6 +261,9 @@
     getFormData(form) {
       this.form = form;
     },
+    getCodeApplyFormData(codeApplyForm) {
+      this.codeApplyForm = codeApplyForm;
+    },
     // 鍙傜収缁勪欢鏁版嵁鍙樻洿
     referConfigDataUpdate(data) {
       const { field } = data;
@@ -401,8 +272,9 @@
           this.$refs.CodeApply.form[item.oid] = undefined;
           this.$refs.CodeApply.form[item.name] = undefined;
         }
+        return item;
       });
-      this.$refs.CodeApply.templateRender();
+      this.$refs.CodeApply.templateRender(this.secVOList);
     },
     resembleQuerySubmit() {
       this.activeName = "resembleQuery";
@@ -420,7 +292,8 @@
       let codeValidate = true;
       // 杩涜鐮佸�肩敵璇锋牎楠�
       if (this.showCodeApply) {
-        codeValidate = await this.$refs.codeApply.validate();
+        codeValidate = await this.$refs.CodeApply.validate();
+        console.log(9999);
         if (!codeValidate) return;
       }
       // 杩涜鐩镐技椤规煡璇�
@@ -428,7 +301,20 @@
         this.form
       );
       if (resembleQueryList.length === 0) {
-        this.$emit("submit", this.form);
+        let resForm = {}
+        const { defaultValue, formValue } = this.getDefaultValueAndFormValues(this.form)
+        resForm.data = formValue
+        resForm = Object.assign({}, resForm, defaultValue)
+        resForm.secDTOList = []
+        for (const key in this.codeApplyForm) {
+        if (Object.hasOwnProperty.call(this.codeApplyForm, key)) {
+          const value = this.codeApplyForm[key];
+          if (value) {
+            resForm.secDTOList.push({[key]: value})
+          }
+        }
+      }
+        this.$emit("submit", resForm);
       } else {
         this.$confirm(
           `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋,
@@ -444,6 +330,24 @@
           })
           .catch(() => {});
       }
+    },
+    getDefaultValueAndFormValues(form) {
+      let defaultValue = {};
+      let formValue = {};
+      for (const key in form) {
+        if (Object.hasOwnProperty.call(form, key)) {
+          const element = form[key];
+          if (this.defaultKeys.includes(key)) {
+            defaultValue[key] = element;
+          } else {
+            formValue[key] = element;
+          }
+        }
+      }
+      return {
+        defaultValue,
+        formValue,
+      };
     },
     getType(item) {
       return this.selfColumnType[item.sectype];
@@ -489,16 +393,20 @@
           url: "api/ubcs-code/ubcs-code/mdmEngineController/listCodeClassifyValueBySecOid",
           extraParams: {
             classifySecOid: item.oid,
-            parentClassifyValueOid: "",
+            parentClassifyValueOid: item.parentClassifySecOid
+              ? this.codeApplyForm[item.parentClassifySecOid]
+              : "",
           },
         };
+      } else if (item.sectype == "coderefersec") {
+        params = JSON.parse(item.referValueInfo);
       }
-      return item.referConfig || params;
+      return params;
     },
     getDisabled(item) {
       if (item.sectype === "codeclassifysec") {
         if (item.parentClassifySecOid) {
-          if (!this.form[item.parentClassifySecOid]) {
+          if (!this.codeApplyForm[item.parentClassifySecOid]) {
             return true;
           } else {
             return false;

--
Gitblit v1.9.3