From c0e4323f851c5216d1b020bc4177a8566e77bfd2 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期四, 30 十一月 2023 18:32:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/components/FormTemplate/index.vue |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index 2ad4a80..2567d87 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="
@@ -250,9 +250,11 @@
   },
   methods: {
     openDialog() {
+      //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢�
       this.getFormTemplate();
-      if (this.type === "add") {
+      if (this.type === "add" || (this.type !== "add" && this.status === "amend")) {
         this.getCodeRule();
+        return;
       }
     },
     close() {
@@ -260,6 +262,7 @@
     },
     // 鎺ュ彛鑾峰彇琛ㄥ崟鏁版嵁
     getFormTemplate() {
+      //鏂板鍜屼慨鏀瑰叡鍚岃皟鐢�
       getFormTemplate({
         templateOid: this.templateOid,
         codeClassifyOid: this.codeClassifyOid,
@@ -277,6 +280,7 @@
             } else {
               this.showResembleQuery = false;
             }
+            //浼犻�掕〃鍗曚笂鏂瑰尯鍩熸暟鎹� 锛堟柊澧炲拰淇敼锛�
             this.$nextTick(() => {
               this.$refs.FormTemplate.templateRender(
                 res.data.formDefineVO.items
@@ -319,7 +323,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";
 
@@ -346,22 +350,32 @@
     },
     //绯诲垪鍙疯鍒�
     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) {
@@ -387,7 +401,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