From 25da36be2318c1247592dce7d499d0b985c80fe0 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 03 十二月 2023 23:07:03 +0800
Subject: [PATCH] 历史数据导入时,赋默认值报空指针异常bug修复

---
 Source/UBCS-WEB/src/views/code/code.vue |   87 +++++++++++++++++++++++--------------------
 1 files changed, 47 insertions(+), 40 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index 7621a97..9455958 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -669,12 +669,12 @@
                 :disabled="basicSecOnlyRead"
                 style="margin-right: 20px"
               ></el-switch>
-              <el-input-number
+              <!-- <el-input-number
                 v-show="form.serialDependFlag"
                 v-model="form.serialDependOrder"
                 :readonly="basicSecOnlyRead"
                 controls-position="right"
-              ></el-input-number>
+              ></el-input-number> -->
             </el-form-item>
 
             <el-form-item :label-width="leftFormLabelWidth" label="鏄惁涓虹┖:">
@@ -886,14 +886,10 @@
                         :referConfig="this.referConfig || {}"
                         :display="true"
                         :value="form.customCodeSerialClass"
-                        :text="form.customCodeSerialClass"
+                        :text="form.customCodeSerialClassText"
+                        :serialType="form.serialType"
                         @setReferValue="setReferValue"
                       ></vciWebRefer>
-<!--                                    <el-input-->
-<!--                                      v-model="form.customCodeSerialClass"-->
-<!--                                      :readonly="basicSecOnlyRead"-->
-<!--                                      @focus="streamFocusHandler"-->
-<!--                                    ></el-input>-->
                   </template>
 
 
@@ -1367,15 +1363,17 @@
       },
       referConfig:{
         title: '鑷畾涔夋祦姘村弬鐓�',
-        showField: 'customCodeSerialClass',
+        showField: 'customCodeSerialClassText',
         field: 'customCodeSerialClass',
-        fieldMap:  {},
+        fieldMap:  {
+          serialType:"serialType"
+        },
         placeholder:'璇烽�夋嫨鑷畾涔夋祦姘�',
         options:   {
           // 璁剧疆榛樿鐨勫睘鎬�
           url: 'api/ubcs-code/codeSerialAlgorithmController/gridCodeSerialAlgorithm',
+          textField:'name',
           valueField:'classFullName',
-          textField:'classFullName',
           isMuti: false,
           type: "grid",
           method: 'get',
@@ -1388,6 +1386,7 @@
               {title: '绠楁硶缂栧彿', field: 'id', width: 200},
               {title: '绠楁硶鍚嶇О', field: 'name', width: 150},
               {title: '绫诲叏璺緞', field: 'classFullName', width: 300},
+              {title: '绫诲瀷', field: 'serialType', width: 300},
               {title: '鎻忚堪', field: 'description'}
             ],
             queryColumns: [
@@ -1620,7 +1619,7 @@
         secType: "codefixedsec", //鐮佹绫诲瀷
         description: "", //鎻忚堪
         serialDependFlag: false, //鏄惁娴佹按渚濊禆
-        serialDependOrder: "", //娴佹按渚濊禆椤哄簭
+        //serialDependOrder: "", //娴佹按渚濊禆椤哄簭
         nullableFlag: false, //鏄惁涓虹┖
         prefixCode: "", //鍓嶇紑
         suffixCode: "", //鍚庣紑
@@ -1717,7 +1716,12 @@
   methods: {
     //鑷畾涔夋祦姘村け鐒�
     setReferValue(data){
-      console.log(data)
+      if(data.field){
+        this.form[data.field] = data.value || "";
+        this.form[data.showField] = data.text || "";
+        this.form.serialType = data.rawData[0].serialType || "";
+
+      }
     },
     /** 杞Щ瑙勫垯鎵�鏈夎�呭璇濇 */
     escapeOwner() {
@@ -1777,7 +1781,7 @@
       //杞崲鎴怞SON瀛楃涓茶繘琛岀埗缁勪欢鍥炴樉
       let submitFormJson = JSON.stringify(content);
       this.form.referConfig = submitFormJson || "";
-      debugger;
+      // debugger;
     },
     /** 寮曠敤鐮佹涓恒�愬弬鐓у紩鐢ㄧ殑涓氬姟绫诲瀷銆戦�夊彇鍊间箣鍚庣殑鍐呭鍥炴樉鏃惰皟鐢� */
     echoReferBtmType(content) {
@@ -2522,8 +2526,7 @@
                 this.releadDisabled = false;
               });
             }
-          })
-          .catch((error) => {
+          }).catch((error) => {
             this.releadDisabled = false;
           });
         this.releadDisabled = false;
@@ -2776,12 +2779,11 @@
       }
       //console.log(this.form);
       //涓篺orm缁戝畾鍊�
-      this.changeSectypeFormItems(condition == "add" ? null : row);
+      this.changeSectypeFormItems(condition == "add" ? null:row);
       this.addBasicCodeSettingBox = true;
     },
     /** 鏂板鍩虹鐮佹*/
     async saveOrEditBasicCode() {
-      this.isLoadingSecCodeAddBtn = true;
       if (
         this.selectionList[0].oid == null ||
         this.selectionList[0].oid == ""
@@ -2789,25 +2791,28 @@
         this.$message.warning("缂哄け蹇呰鍙傛暟锛岃閲嶆柊閫夋嫨缂栫爜瑙勫垯鍚庡啀璇�!");
         return;
       }
+      if (!this.checkForm()) {
+        return;
+      }
+      this.isLoadingSecCodeAddBtn = true;
       this.form.pkCodeRule = this.selectionList[0].oid;
       if (this.form.oid == "" || this.form.oid == null) {
-        if (this.checkForm()) {
-          await addSave(this.form).then(
-            () => {
-              this.$message({
-                type: "success",
-                message: "鎿嶄綔鎴愬姛!",
-              });
-              // 鍏抽棴瀵硅瘽妗�
-              this.addBasicCodeSettingBox = false;
-              // 鐐瑰嚮鏂板鍩虹鐮佹,鍏抽棴绐楀彛涔嬪悗瑙﹀彂閲嶆柊鍔犺浇
-              this.loadBasic(this.selectionList[0]);
-            },
-            (error) => {
-              window.console.log(error);
-            }
-          );
-        }
+        await addSave(this.form).then(
+          () => {
+            this.$message({
+              type: "success",
+              message: "鎿嶄綔鎴愬姛!",
+            });
+            console.log(this.form)
+            // 鍏抽棴瀵硅瘽妗�
+            this.addBasicCodeSettingBox = false;
+            // 鐐瑰嚮鏂板鍩虹鐮佹,鍏抽棴绐楀彛涔嬪悗瑙﹀彂閲嶆柊鍔犺浇
+            this.loadBasic(this.selectionList[0]);
+          },
+          (error) => {
+            window.console.log(error);
+          }
+        );
       } else {
         // 鍙兘鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩細鍙戠敓鏀瑰彉鎵�浠ヨ繖鍎跨洿鎺ュreferConfig鐨刯son杩涜鏀瑰彉
         if (
@@ -2821,7 +2826,7 @@
           // let referValueInfo = JSON.parse(this.form.referValueInfo);
           // referValueInfo.referType = this.form.referBtmId;
         }
-        let oldBasicSec = this.selectionBasicList.at(-1);
+        let oldBasicSec = this.selectionBasicList.slice(-1)[0];
         let secType = this.form.secType;
         Vue.set(this.form, 'isClearValue', false);
         if ((oldBasicSec.secType == "codefixedsec" || oldBasicSec.secType === "codeclassifysec") && oldBasicSec.secType != secType) {
@@ -3062,7 +3067,7 @@
       if (!this.tipsMessage(this.selectionBasicList)) {
         return;
       }
-      if (this.selectionList.at(-1).lcStatus != "Editing") {
+      if (this.selectionList.slice(-1)[0].lcStatus != "Editing") {
         this.$message.warning('缂栫爜瑙勫垯鐘舵�佷笉鏄�"缂栬緫涓�"锛屼笉鍏佽鍒犻櫎鐮佹!');
         return;
       }
@@ -3208,7 +3213,7 @@
     },
     /** 鍩虹鐮佹鍒锋柊鏃舵煡璇�*/
     refreshChangeBasicSec() {
-      this.loadBasic(this.selectionList.at(-1));
+      this.loadBasic(this.selectionList.slice(-1)[0]);
     },
     /** 鎿嶄綔鍩虹鐮佹涓悳绱㈡竻绌虹瓑鎸夐挳鐨勬樉绀�/闅愯棌*/
     hideBasicTable(hideBoolean) {
@@ -3284,6 +3289,7 @@
     },
     /** 鐮佹绫诲瀷鏀瑰彉鏃讹紝澧炲姞瀵瑰簲鐨刦orm琛ㄥ崟涓殑灞炴��*/
     changeSectypeFormItems(row) {
+      //console.log(row)
       if (
         func.isEmpty(this.enumParam.secTypeList) ||
         this.enumParam.secTypeList.length == 0
@@ -3297,13 +3303,14 @@
         secType: row != null ? row.secType : this.form.secType, //鐮佹绫诲瀷
         description: row != null ? row.description : this.form.description, //鎻忚堪
         serialDependFlag: this.isNullJsonBoolean(row, this.form, 'serialDependFlag'), //鏄惁娴佹按渚濊禆
-        serialDependOrder: row != null ? row.serialDependOrder : this.form.serialDependOrder, //娴佹按渚濊禆椤哄簭
+        //serialDependOrder: row != null ? row.serialDependOrder : this.form.serialDependOrder, //娴佹按渚濊禆椤哄簭
         nullableFlag: this.isNullJsonBoolean(row, this.form, 'nullableFlag'), //鏄惁涓虹┖
         displayFlag: this.isNullJsonBoolean(row, this.form, 'displayFlag'),
         componentCodeFlag: this.isNullJsonBoolean(row, this.form, 'componentCodeFlag'), //鏄惁鍙備笌缂栫爜
         pkCodeRule: row != null ? row.pkCodeRule : this.form.pkCodeRule, //鎵�灞炵紪鐮佽鍒�
         prefixCode: row != null ? row.prefixCode : this.form.prefixCode, //鍓嶇紑
         suffixCode: row != null ? row.suffixCode : this.form.suffixCode, //鍚庣紑
+        // customCodeSerialClass: row != null ? row.customCodeSerialClass : this.form.customCodeSerialClass
       };
       if (this.form.secType === "codefixedsec") {
         //鍥哄畾鐮佹
@@ -3664,7 +3671,7 @@
 
 .right {
   /* float: right; */
-  margin-right: 2vw;
+  /* margin-right: 1vw; */
   height: 100%;
   width: auto;
 }

--
Gitblit v1.9.3