fujunling
2023-06-05 ee07d050ac5e52ded8f0de0872085ef9b00790ee
Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -13,14 +13,22 @@
      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 && (showCodeApply || showResembleQuery)">
      <el-tabs v-model="activeName" type="border-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"
@@ -48,7 +56,10 @@
      <el-button @click="submit()" type="primary" :loading="submitBtnLoading"
        >确 定</el-button
      >
      <el-button @click="resembleQuerySubmit" type="primary" v-if="showResembleQuery"
      <el-button
        @click="resembleQuerySubmit"
        type="primary"
        v-if="showResembleQuery"
        >相似像查询</el-button
      >
    </div>
@@ -79,6 +90,7 @@
      type: String,
      default: "80%",
    },
    rowOid: ''
  },
  data() {
    return {
@@ -88,6 +100,7 @@
      resembleTableColumn: [],
      secVOList: [],
      form: {},
      activeName: "",
    };
  },
  created() {},
@@ -101,29 +114,25 @@
      },
    },
    showCodeApply() {
      if (this.type === "add") {
        if (this.hasResemble && this.secVOList.length === 0) {
          return false;
        }
      } else {
        return false;
      }
      // 测试数据展示
      // if (this.type === "add") {
      //   if (this.hasResemble && this.secVOList.length === 0) {
      //     return false;
      //   }
      // } else {
      //   return false;
      // }
      return true;
    },
    showResembleQuery() {
      return this.hasResemble;
    },
    activeName() {
      return (
        (this.showCodeApply && "codeApply") ||
        (this.showResembleQuery && "resembleQuery")
      );
    },
  },
  methods: {
    openDialog() {
      this.$nextTick(() => {
        this.$refs.FormTempalte.init();
        this.$refs.CodeApply.getCodeRule();
      });
    },
    close() {
@@ -138,6 +147,9 @@
        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;
@@ -145,12 +157,21 @@
    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) {
        const codeValidate = this.$refs.CodeApply.validate();
        console.log(formValidate, codeValidate);
        codeValidate = await this.$refs.CodeApply.validate();
      }
      this.$emit("submit", {
        form: this.form,
        flag: formValidate && codeValidate,
      });
    },
  },
};