Browse Source

基础信息设置增加高新区域级联选择

ljb 9 months ago
parent
commit
e9e22c5c3d

File diff suppressed because it is too large
+ 1032 - 0
src/config/dict.js


+ 26 - 3
src/views/basic-resource/comp-basic-info/components/comp-info-table.vue

@@ -38,7 +38,9 @@
         </tr>
         <tr>
           <td class="label">高新领域</td>
-          <td></td>
+          <td>
+            <avue-cascader v-model="form.highTechFields" :dic="HIGH_TECH_FIELDS" size="small" style="width: 100%;"></avue-cascader>
+          </td>
           <td class="label">其他说明</td>
           <td>
             <input v-model="form.remark" style="width: 100%; border: none;" />
@@ -61,6 +63,7 @@
 
 <script>
 import { getEnterpriseInfo, saveOrUpdateEnterInfo, getLastYearEnterInfo } from "@/api/basicResource/compInfoSetting";
+import {  HIGH_TECH_FIELDS } from "@/config/dict";
 
 export default {
   props: {
@@ -68,6 +71,7 @@ export default {
   },
   data() {
     return {
+      HIGH_TECH_FIELDS,
       loading: false,
       form: {}
     }
@@ -81,12 +85,26 @@ export default {
     this.getEnterpriseInfoFunc(this.yearAndMonth);
   },
   methods: {
+    initFormData(data) {
+      this.form = { ...data };
+      let highTechFields = [];
+      if (this.form.highTechDomainL1) {
+        highTechFields[0] = Number(this.form.highTechDomainL1);
+      }
+      if (this.form.highTechDomainL2) {
+        highTechFields[1] = Number(this.form.highTechDomainL2);
+      }
+      if (this.form.highTechDomainL3) {
+        highTechFields[2] = Number(this.form.highTechDomainL3);
+      }
+      this.form.highTechFields = highTechFields;
+    },
     getEnterpriseInfoFunc(yearAndMonth) {
       this.loading = true;
       getEnterpriseInfo(yearAndMonth).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
-          this.form = data.data;
+          this.initFormData(data.data);
         }
       }).catch(() => {
         this.loading = false;
@@ -94,6 +112,11 @@ export default {
     },
     handleSaveBtn() {
       const params = { ...this.form, yearAndMonth: this.yearAndMonth };
+      if (params.highTechFields && params.highTechFields.length) {
+        params.highTechDomainL1 = params.highTechFields[0];
+        params.highTechDomainL2 = params.highTechFields[1];
+        params.highTechDomainL3 = params.highTechFields[2];
+      }
       saveOrUpdateEnterInfo(params).then(({ data }) => {
         if (data.code == 200) {
           this.$message.success("保存成功!")
@@ -107,7 +130,7 @@ export default {
       getLastYearEnterInfo({ yearAndMonth: this.yearAndMonth }).then(({ data }) => {
         this.loading = false;
         if (data.code == 200) {
-          this.form = data.data;
+          this.initFormData(data.data);
         }
       }).catch(() => {
         this.loading = false;