From e146bc181625aee75624f8364654721cfd886254 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 30 六月 2023 17:39:53 +0800
Subject: [PATCH] 修改部分空指针报错

---
 Source/UBCS-WEB/src/views/code/code.vue |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue
index 9962d0a..ca5372d 100644
--- a/Source/UBCS-WEB/src/views/code/code.vue
+++ b/Source/UBCS-WEB/src/views/code/code.vue
@@ -1113,18 +1113,18 @@
         /* 寮曠敤鐮佹鍙傜収閰嶇疆,瀛愮粍浠跺~瀹屽弬鐓ч厤缃箣鍚庡唴瀹瑰洖鏄炬椂璋冪敤 */
         echoReferConfig(content){
           // console.log(content.referTypeName);
-          this.form.referBtmId = content.referType;
-          this.form.referBtmName = content.referTypeName;
+          this.form.referBtmId = content.referType || '';
+          this.form.referBtmName = content.referTypeName || content.referType;
           //杞崲鎴怞SON瀛楃涓茶繘琛岀埗缁勪欢鍥炴樉
           let submitFormJson = JSON.stringify(content);
-          this.form.referConfig = submitFormJson;
-          this.form.referValueInfo = submitFormJson;
+          this.form.referConfig = submitFormJson || '';
+          this.form.referValueInfo = submitFormJson || '';
         },
         /** 寮曠敤鐮佹涓恒�愬弬鐓у紩鐢ㄧ殑涓氬姟绫诲瀷銆戦�夊彇鍊间箣鍚庣殑鍐呭鍥炴樉鏃惰皟鐢� */
         echoReferBtmType(content){
           // 瀹炵幇鍥炴樉
-          this.form.referBtmId = content.id;
-          this.form.referBtmName = content.name;
+          this.form.referBtmId = content.id || '';
+          this.form.referBtmName = content.name || content.id;
         },
         
         /** 鐖跺垎绫婚�夋嫨瀵硅瘽妗嗭紝绗簩灞傚祵濂楀璇濇锛屽強鍏剁浉鍏虫柟娉� */ 
@@ -1651,7 +1651,7 @@
           this.addBasicCodeSettingBox = true;
         },
         // 鏂板鍩虹鐮佹
-        saveOrEditBasicCode(){
+        async saveOrEditBasicCode(){
           if(this.selectionList[0].oid == null ||  this.selectionList[0].oid == ''){
             this.$message.warning('缂哄け蹇呰鍙傛暟锛岃閲嶆柊閫夋嫨缂栫爜瑙勫垯鍚庡啀璇�!');
             return;
@@ -1659,7 +1659,7 @@
           this.form.pkCodeRule = this.selectionList[0].oid;
           if(this.form.oid == '' || this.form.oid == null){
             if(this.checkForm()){
-              addSave(this.form).then(() => {
+              await addSave(this.form).then(() => {
                 this.$message({
                   type: "success",
                   message: "鎿嶄綔鎴愬姛!"
@@ -1673,6 +1673,15 @@
             // 鐐瑰嚮鏂板鍩虹鐮佹,鍏抽棴绐楀彛涔嬪悗瑙﹀彂閲嶆柊鍔犺浇
             this.loadBasic(this.selectionList[0]);
           }else{
+            // 鍙兘鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩細鍙戠敓鏀瑰彉鎵�浠ヨ繖鍎跨洿鎺ュreferConfig鐨刯son杩涜鏀瑰彉
+            let referConfig = JSON.parse(this.form.referConfig);
+            referConfig.referType = this.form.referBtmId;
+            referConfig.referTypeName = this.form.referBtmName;
+            this.form.referConfig = JSON.stringify(referConfig);
+
+            let referValueInfo = JSON.parse(this.form.referValueInfo);
+            referValueInfo.referType = this.form.referBtmId;
+            this.form.referValueInfo = JSON.stringify(referValueInfo);
             editSave(this.form).then(() => {
                // 鍏抽棴瀵硅瘽妗�
               this.addBasicCodeSettingBox = false
@@ -1960,11 +1969,9 @@
         },
         // 涓婄Щ涓嬬Щ鍩虹鐮佹
         upOrderNum(row){
-          //console.log(row.oid);
           if(!this.tipsMessage(this.selectionList)){
             return;
           }
-          let codeRuleOid = this.selectionList[0].oid;
           if (this.selectionList[0].lcStatus != 'Editing') {
             this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!");
             return; 
@@ -1974,7 +1981,7 @@
             return;        
           }
           upOrderNum(row.oid).then(() => {
-            this.loadBasic({"oid":codeRuleOid});
+            this.loadBasic(this.selectionList[0]);
             this.$message({
               type: "success",
               message: "鎿嶄綔鎴愬姛!"
@@ -2645,7 +2652,13 @@
           this.enumParam.codeFillType = this.getLocalStorageEnum("codeFillType");
         },
         loadCodeFillSeparator(){
-          this.enumParam.codeFillSeparator = this.getLocalStorageEnum("codeFillSeparator");
+          let enumCach = JSON.parse(localStorage.getItem("codeFillSeparator"));
+          if(enumCach == null) {
+            getDictionary("codeFillSeparator").then(res=>{
+              this.enumParam.codeFillSeparator = res.data.data;
+              localStorage.setItem(key,JSON.stringify(res.data.data));
+            })
+          }
         },
         loadCodeLevelType(){
           this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType");

--
Gitblit v1.9.3