From cbf80ccbad5e4092bb020cc02ddd811da4d12b70 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 29 十一月 2023 14:49:19 +0800
Subject: [PATCH] 标准表单逻辑处理

---
 Source/UBCS-WEB/src/components/FormTemplate/index.vue        |   34 +++++++++++------
 Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue |   31 +++++++++------
 2 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
index b8bfceb..5849e98 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
@@ -107,7 +107,10 @@
   data() {
     return {
       //骞翠唬鍙�
-      dataYearValue:null,
+      dataYearCode: {
+        type: "",
+        value: ""
+      },
       filteredObject: {},
       filteredArray: [],
       isSeriesType: {},
@@ -197,11 +200,11 @@
         this.$emit("isShow", newV)
       }
     },
-    dataYearValue:{
-      handler(newV){
-        if(newV){
-          this.$emit("dataYearValue",newV)
-        }
+    dataYearCode: {
+      deep:true,
+      immediate:true,
+      handler(newV) {
+        this.$emit("dataYearCode", newV)
       }
     }
   },
@@ -275,6 +278,7 @@
 
         let columnItem = {
           change: (val) => {
+            console.log(val)
             if (val.column.field === "drawingno") {
               this.codeattrsecValue = val.value;
               return;
@@ -287,11 +291,13 @@
                 this.isShow = false;
               }
             }
-            if(val.column.field === "releaseDate"){
-              if(val.value){
-                this.dataYearValue = val.column.valueFormat;
-              }else {
-                this.dataYearValue = null;
+            if (val.column.field === "releaseDate") {
+              if (val.value) {
+                this.dataYearCode.type = val.column.valueFormat;
+                this.dataYearCode.value = val.value;
+              } else {
+                this.dataYearCode.type = "";
+                this.dataYearCode.value = "";
               }
             }
           },
@@ -421,7 +427,8 @@
           format: formItem.dateFormate,
           keyAttr: formItem.keyAttr,
           value: (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) ||
-            (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null),
+            (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) ||
+            (formItem.secType == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null),
           placeholder: formItem.inputTip,
           comboxKey: formItem.comboxKey,
           tip: formItem.tooltips,
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index 2ad4a80..e0e0dc1 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -21,9 +21,9 @@
       :templateOid="templateOid"
       :type="type"
       data-key="masterForm"
+      @dataYearCode="dataYearHandler"
       @getFormData="getFormData"
       @isShow="isShowHandler"
-      @dataYearValue="dataYearHandler"
     ></FormTemplate>
     <div
       v-if="
@@ -346,23 +346,33 @@
     },
     //绯诲垪鍙疯鍒�
     isShowHandler(val) {
-      let that = this;
       this.isShowStatus = val;
 
-        this.secVOList.forEach(item => {
-          if (item.name === "绯诲垪鍙�") {
-            this.$set(item, "readOnly", val)
-          }
-        })
-      if(this.$refs.CodeApply.changeChildItem ){
+      this.secVOList.forEach(item => {
+        if (item.name === "绯诲垪鍙�") {
+          this.$set(item, "readOnly", val)
+        }
+      })
+      if (this.$refs.CodeApply) { // 娣诲姞涓�涓垽鏂鍙ワ紝妫�鏌ュ璞℃槸鍚︿负undefined
         this.$refs.CodeApply.changeChildItem(this.secVOList, this.TreeValue, this.type);
       }
     },
     //骞翠唬鍙�
-    dataYearHandler(val){
-      console.log("val",val)
+    dataYearHandler(val) {
+      const readOnlyValue = val && Object.values(val).every(value => value !== '');
 
-    },
+      this.secVOList.forEach(item => {
+        if (item.name === "骞翠唬鍙�") {
+          const year = readOnlyValue ? val.value.slice(0, 4) : item.codeDateValue;
+          this.codeApplyForm[item.oid] = year;
+          this.$set(item, "readOnly", readOnlyValue);
+        }
+      });
+
+      if (this.$refs.CodeApply) {
+        this.$refs.CodeApply.changeChildItem(this.secVOList, this.TreeValue, this.type);
+      }
+    },,
     //灞炴�х爜娈佃祴鍊�
     attrListForm(attrListForm) {
       this.attrList = attrListForm;
@@ -387,7 +397,7 @@
         return item;
       });
       //this.$refs.CodeApply.templateRender(this.secVOList,this.TreeValue);
-      this.$refs.CodeApply.changeChildItem(childItems,this.TreeValue,this.type);
+      this.$refs.CodeApply.changeChildItem(childItems, this.TreeValue, this.type);
     },
     resembleQuerySubmit() {
       this.activeName = "resembleQuery";

--
Gitblit v1.9.3