From abf8822cfc6fe397d1f7216620f8ba5d3b4d0aab Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 12 十二月 2023 10:49:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue |  251 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 194 insertions(+), 57 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
index b633a29..73d8a17 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
@@ -1,5 +1,3 @@
-<!-- eslint-disable vue/valid-v-for -->
-<!-- eslint-disable vue/require-v-for-key -->
 <template>
   <div>
     <avue-form
@@ -75,7 +73,7 @@
     // 琛ㄥ崟绫诲瀷锛坅dd, edit, detail锛�
     type: {
       type: String,
-      default: "",
+      default: "add",
     },
     // 鑷畾涔夎〃鍗曠被鍨�
     selfColumnType: {
@@ -103,9 +101,19 @@
       type: String,
       default: "",
     },
+    selectRow: {
+      type: Array,
+      default: []
+    }
   },
   data() {
     return {
+      selectValue: "",
+      //骞翠唬鍙�
+      dataYearCode: {
+        type: "",
+        value: ""
+      },
       filteredObject: {},
       filteredArray: [],
       isSeriesType: {},
@@ -139,7 +147,7 @@
       // 琛ㄥ崟灞炴��
       attributes: [],
       slotColumnList: [],
-      isShow:null,
+      isShow: "",
     };
   },
   mounted() {
@@ -170,12 +178,6 @@
       immediate: true,
       handler(newV) {
         this.$emit("getFormData", newV);
-        // console.log("filteredObject",this.filteredObject)
-        if (this.filteredObject.label === "绯诲垪鍙�") {
-          if (newV.isSeries === "false") {
-            this.filteredObject.disabled = true;
-          }
-        }
       },
     },
     attrList: {
@@ -184,15 +186,6 @@
       handler(newVal, oldVal) {
         if (newVal) {
           this.$emit("attrList", newVal)
-        }
-      }
-    },
-    isSeriesType: {
-      deep: true,
-      immediate: true,
-      handler(newVal, oldVal) {
-        if (newVal) {
-          this.$emit("isSeriesType", newVal)
         }
       }
     },
@@ -205,11 +198,31 @@
       deep: true,
       immediate: true
     },
+    isShow: {
+      handler(newV) {
+        this.$emit("isShow", newV)
+      }
+    },
+    dataYearCode: {
+      deep: true,
+      immediate: true,
+      handler(newV) {
+        this.$emit("dataYearCode", newV)
+      }
+    },
+    selectRow: {
+      handler(newval) {
+        // console.log(newval);
+        let ids = newval.map(item => item.id);
+        this.selectValue = ids.join(",");
+      },
+      deep: true,
+      immediate: true
+    }
   },
   methods: {
     // 娓叉煋琛ㄥ崟妯℃澘
     templateRender(formItemList, TreeValue) {
-      // debugger
       if (this.eventList) {
         this.eventFlag = this.eventList.some(item => {
           if (item.classifyInvokeEditFlag === 'true') {
@@ -224,18 +237,12 @@
       let dictKeys = [];
       let slotColumnList = [];
       formItemList.forEach((formItem) => {
-        console.log('formItem',formItem);
         formItem = this.resetFormConfig(formItem);
         //灞炴�х爜娈佃鍒�
         if (formItem.secType === "codeattrsec") {
           this.attrList.push(formItem);
         }
-        //绯诲垪鍙疯鍒�
-        if (formItem.label === "绯诲垪鍙�") {
-          this.isSeriesType = formItem;
-          // console.log("绯诲垪鍙�",formItem)
-        }
-        //鏇存敼鏂瑰紡瑙勫垯
+        //鏇存敼鏂瑰紡
         if (formItem.field === "codeStandardEditType") {
           if (this.status === "amend") {
             formItem.readOnly = true;
@@ -250,6 +257,7 @@
           });
           return;
         }
+
         if (
           formItem.type === "combox" &&
           formItem.comboxKey &&
@@ -281,23 +289,29 @@
           formItem.fieldMap[formItem.field + 'id'] = 'id'
         }
 
-
         let columnItem = {
           change: (val) => {
-            // console.log(val)
             if (val.column.field === "drawingno") {
               this.codeattrsecValue = val.value;
               return;
             }
-            ;
-            if (val.column.field === "isSeries") {
+            //淇涓�-绯诲垪鍙�
+            if (val.column.field === "reviseSeries") {
               if (val.value === "false") {
                 this.isShow = true;
-              }else {
+              } else {
                 this.isShow = false;
               }
             }
-
+            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 = "";
+              }
+            }
           },
           dataKey: formItem.dataKey || formItem.field,
           label: formItem.text,
@@ -309,7 +323,7 @@
           type: this.columnType[formItem.type],
           dicData: this.getDataList(formItem.type, formItem.data),
           disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false) ||
-            (this.isShow && formItem.label === "绯诲垪鍙�" ? true : false),
+            ((formItem.name === "绯诲垪鍙�" && this.status && (formItem.field === "reviseSeries" && formItem.value == 'false') ? true : false)),
           prepend: this.preOrSufFixShow("text", formItem.prefix),
           append: this.preOrSufFixShow("text", formItem.suffix),
           prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
@@ -317,15 +331,15 @@
           valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
           format: formItem.dateFormate,
           keyAttr: formItem.keyAttr,
-          value: (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) ||
+          value: formItem.defaultValue || (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 == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) ||
-            (formItem.field === "isSeries" ? "true" : null),
+            (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) ||
+            //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹�
+            (this.status === "amend" ? (this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)) : null),
           placeholder: formItem.inputTip,
           comboxKey: formItem.comboxKey,
           tip: formItem.tooltips,
-          // hidden:formItem.secType && formItem.codeValueApplyStatus == 3 ? true : false,
-          // readonly:formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ?true : false ,
           display: !formItem.hidden,
           maxlength: formItem.maxlength,
           filterable: true,
@@ -364,7 +378,6 @@
           },
         };
         this.filteredObject = columnItem
-        // console.log("columnItem", columnItem)
         slotColumnList.push(columnItem);
         if (group.length === 0) {
           column.push(columnItem);
@@ -373,9 +386,7 @@
         }
       });
 
-      // this.filteredArray = column.filter(obj => obj.label === "绯诲垪鍙�");
       this.slotColumnList = slotColumnList;
-      // console.log(slotColumnList)
       this.$set(this.option, "column", column);
       this.$set(this.option, "group", group);
       this.updateIndex++;
@@ -387,9 +398,12 @@
       this.getFormDetail();
     },
     //淇敼绾ц仈椤�
-    changeChildItem(items, TreeValue) {
+    changeChildItem(items, TreeValue, type) {
+      type = type || "add";
       let column = this.option.column;
       let group = this.option.group;
+      // let column = [];
+      // let group = [];
       let that = this;
       items.forEach((item) => {
         let formItem = this.resetFormConfig(item);
@@ -412,9 +426,6 @@
           formItem.fieldMap[formItem.field + 'id'] = 'id'
         }
         let columnItem = {
-          change: (val) => {
-            // console.log('1', val)
-          },
           label: formItem.text,
           labelslot: true,
           prop: this.$utilFunc.isValuableObj(formItem.referConfig)
@@ -423,7 +434,8 @@
           field: formItem.field,
           type: this.columnType[formItem.type],
           dicData: this.getDataList(formItem.type, formItem.data),
-          disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false),
+          disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false) ||
+            (this.status ? (formItem.field === "reviseSeries" ? (formItem.value == 'false' ? true : false) : false) : false),
           prepend: this.preOrSufFixShow("text", formItem.prefix),
           append: this.preOrSufFixShow("text", formItem.suffix),
           prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
@@ -431,13 +443,15 @@
           valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
           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),
+          value: formItem.defaultValue || (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 == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) ||
+            (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) ||
+            //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹�
+            (this.status === "amend" ? (this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)) : null),
           placeholder: formItem.inputTip,
           comboxKey: formItem.comboxKey,
           tip: formItem.tooltips,
-          // hidden:formItem.secType && formItem.codeValueApplyStatus == 3 ? true : false,
-          // readonly:formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ?true : false ,
           display: !formItem.hidden,
           maxlength: formItem.maxlength,
           filterable: true,
@@ -475,7 +489,126 @@
             value: "key",
           },
         };
-
+        if (group.length === 0) {
+          that.slotColumnList.forEach((colItem, index) => {
+            if (colItem.field == columnItem.field) {
+              that.slotColumnList[index] = columnItem;
+              column[index] = columnItem;
+              return;
+            }
+          })
+        } else {
+          that.slotColumnList.forEach((colItem, index) => {
+            if (colItem.field == columnItem.field) {
+              that.slotColumnList[index] = columnItem;
+              return;
+            }
+          })
+          group.forEach((groupItem, index) => {
+            groupItem.column.forEach((colItem, colIndex) => {
+              if (colItem.field == columnItem.field) {
+                group[index].column[colIndex] = columnItem;
+                return;
+              }
+            })
+          });
+        }
+      });
+      that.$set(that.option, "column", column);
+      that.$set(that.option, "group", group);
+    },
+    //鏍囧噯-淇
+    changeStatusItem(items, TreeValue, type) {
+      type = type || "add";
+      // let column = this.option.column;
+      // let group = this.option.group;
+      let column = [];
+      let group = [];
+      let that = this;
+      items.forEach((item) => {
+        let formItem = this.resetFormConfig(item);
+        if (formItem.field == "lcstatus") {
+          formItem.field = formItem.field + "_text";
+          formItem.readOnly = true;
+        }
+        // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰
+        let message = "璇烽�夋嫨";
+        let trigger = "change";
+        if (formItem.type === "text") {
+          message = "璇疯緭鍏�";
+          trigger = "blur";
+        }
+        let fieldMapKey = ''
+        if (formItem.type == "refer" && !formItem.fieldMap) {
+          fieldMapKey = formItem.field + 'Id'
+          formItem.fieldMap = {}
+          formItem.fieldMap[fieldMapKey] = 'id'
+          formItem.fieldMap[formItem.field + 'id'] = 'id'
+        }
+        let columnItem = {
+          label: formItem.text,
+          labelslot: true,
+          prop: this.$utilFunc.isValuableObj(formItem.referConfig)
+            ? formItem.showField || formItem.field
+            : formItem.field,
+          field: formItem.field,
+          type: this.columnType[formItem.type],
+          dicData: this.getDataList(formItem.type, formItem.data),
+          disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false) ||
+            (this.status ? (formItem.field === "reviseSeries" ? (formItem.value == 'false' ? true : false) : false) : false),
+          prepend: this.preOrSufFixShow("text", formItem.prefix),
+          append: this.preOrSufFixShow("text", formItem.suffix),
+          prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
+          suffixIcon: this.preOrSufFixShow("icon", formItem.suffix),
+          valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
+          format: formItem.dateFormate,
+          keyAttr: formItem.keyAttr,
+          value: formItem.defaultValue || (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 == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) ||
+            (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) ||
+            //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹�
+            (this.status === "amend" ? (this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)) : null),
+          placeholder: formItem.inputTip,
+          comboxKey: formItem.comboxKey,
+          tip: formItem.tooltips,
+          display: !formItem.hidden,
+          maxlength: formItem.maxlength,
+          filterable: true,
+          referConfig:
+            formItem.type == "refer"
+              ? {
+                title: formItem.text,
+                showField: formItem.showField || formItem.field,
+                field: formItem.field,
+                fieldMap: formItem.fieldMap || {},
+                placeholder: formItem.inputTip,
+                options: formItem.referConfig
+              }
+              : {},
+          span: formItem.span
+            ? formItem.span
+            : formItem.type === "textarea"
+              ? 24
+              : this.localTrendsSpan,
+          rules: [
+            {
+              required: formItem.required,
+              message: `${message}${formItem.text}`,
+              trigger,
+            },
+            {
+              // 濡傛灉娌℃湁姝e垯鍒欏尮閰嶄换浣曞瓧绗�
+              pattern: formItem.verify ? formItem.verify : /[\s\S.]*/g,
+              message: formItem.tooltips,
+              trigger,
+            },
+          ],
+          props: {
+            label: "value",
+            value: "key",
+          },
+        };
         if (group.length === 0) {
           that.slotColumnList.forEach((colItem, index) => {
             if (colItem.field == columnItem.field) {
@@ -605,12 +738,16 @@
     // 鑾峰彇琛ㄥ崟璇︽儏鏁版嵁
     getFormDetail() {
       if (this.type === "add") return;
-      getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then(
-        (res) => {
-          this.form = Object.assign(this.form, res.data.data[0]);
-          this.loading = false;
-        }
-      );
+      if (this.templateOid) {
+        getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then(
+          (res) => {
+            this.form = Object.assign(this.form, res.data.data[0]);
+            this.loading = false;
+          }
+        );
+        return;
+      }
+
     },
     setReferValue(data) {
       if (data.field) {

--
Gitblit v1.9.3