From 93e2df19d543dbf2cd806ab205efd20be9f71111 Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期二, 06 六月 2023 16:48:00 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs

---
 Source/UBCS-WEB/src/components/FormTemplate/index.vue |   81 ++++++++++++++++++++++++++++------------
 1 files changed, 56 insertions(+), 25 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index 23edc8f..f99d7b4 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -13,16 +13,28 @@
       v-bind="$attrs"
       :visible="visible"
       :type="type"
+      :rowOid="rowOid"
       v-if="dialogVisible"
       ref="FormTempalte"
       @getFormTemplateEnd="getFormTemplate"
       @getFormData="getFormData"
     ></FormTempalte>
 
-    <div class="tab_box" v-if="type !== 'detail' && dialogVisible">
-      <el-tabs v-model="activeName" type="card">
+    <div
+      class="tab_box"
+      v-if="
+        type !== 'detail' &&
+        dialogVisible &&
+        (showCodeApply || showResembleQuery)
+      "
+    >
+      <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
         <el-tab-pane label="鐮佸�肩敵璇�" name="codeApply" v-if="showCodeApply">
-          <CodeApply ref="CodeApply" v-bind="$attrs" @getCodeRuleOid="getCodeRuleOid"></CodeApply>
+          <CodeApply
+            ref="CodeApply"
+            v-bind="$attrs"
+            @getCodeRuleOid="getCodeRuleOid"
+          ></CodeApply>
         </el-tab-pane>
         <el-tab-pane
           label="鐩镐技椤规煡璇�"
@@ -35,17 +47,19 @@
             :hasResemble="this.hasResemble"
             :column="this.resembleTableColumn"
             :form="this.form"
-            :codeRuleOid="codeRuleOid"
           ></ResembleQuery>
         </el-tab-pane>
       </el-tabs>
     </div>
     <div class="avue-dialog__footer" v-if="type !== 'detail'">
       <el-button @click="close()">鍙� 娑�</el-button>
-      <el-button @click="close()" type="primary" :loading="submitBtnLoading"
+      <el-button @click="submit()" type="primary" :loading="submitBtnLoading"
         >纭� 瀹�</el-button
       >
-      <el-button @click="resembleQuerySubmit" type="primary" v-if="hasResemble"
+      <el-button
+        @click="resembleQuerySubmit"
+        type="primary"
+        v-if="showResembleQuery"
         >鐩镐技鍍忔煡璇�</el-button
       >
     </div>
@@ -70,12 +84,13 @@
     },
     title: {
       type: String,
-      default: "琛ㄥ崟妯℃澘",
+      default: "缂栫爜鐢宠",
     },
     width: {
       type: String,
       default: "80%",
     },
+    rowOid: ''
   },
   data() {
     return {
@@ -84,9 +99,8 @@
       hasResemble: false,
       resembleTableColumn: [],
       secVOList: [],
-      activeName: "resembleQuery",
-      codeRuleOid: '',
-      form: {}
+      form: {},
+      activeName: "",
     };
   },
   created() {},
@@ -100,15 +114,14 @@
       },
     },
     showCodeApply() {
-      if (this.type === "add") {
-        if (this.hasResemble && this.secVOList.length === 0) {
-          return false;
-        }
-      } else {
-        if (this.hasResemble) {
-          return false;
-        }
-      }
+      // 娴嬭瘯鏁版嵁灞曠ず
+      // if (this.type === "add") {
+      //   if (this.hasResemble && this.secVOList.length === 0) {
+      //     return false;
+      //   }
+      // } else {
+      //   return false;
+      // }
       return true;
     },
     showResembleQuery() {
@@ -118,16 +131,15 @@
   methods: {
     openDialog() {
       this.$nextTick(() => {
-        this.$refs.FormTempalte.init()
-        this.$refs.CodeApply.getCodeRule()
-      })
+        this.$refs.FormTempalte.init();
+        this.$refs.CodeApply.getCodeRule();
+      });
     },
     close() {
       this.dialogVisible = false;
     },
     getCodeRuleOid(data) {
-      this.codeRuleOid = data.oid
-      this.secVOList = data.secVOList
+      this.secVOList = data.secVOList;
     },
     getFormTemplate(data) {
       this.hasResemble =
@@ -135,13 +147,32 @@
         data.resembleTableVO.cols &&
         data.resembleTableVO.cols.length > 0;
       this.resembleTableColumn = data.resembleTableVO.cols || [];
+      this.activeName =
+        (this.showCodeApply && "codeApply") ||
+        (this.showResembleQuery && "resembleQuery");
     },
     getFormData(form) {
-      this.form = form
+      this.form = form;
     },
     resembleQuerySubmit() {
       this.$refs.resembleQueryRef.resembleQuery(this.form);
     },
+    handleClick() {
+      if (this.activeName === 'resembleQuery') {
+        this.resembleQuerySubmit()
+      }
+    },
+    async submit() {
+      const formValidate = await this.$refs.FormTempalte.validate();
+      let codeValidate = true;
+      if (this.showCodeApply) {
+        codeValidate = await this.$refs.CodeApply.validate();
+      }
+      this.$emit("submit", {
+        form: this.form,
+        flag: formValidate && codeValidate,
+      });
+    },
   },
 };
 </script>

--
Gitblit v1.9.3