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 | 40 ++++++++++++++++++++++++++++------------ 1 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue index a5b8918..ca5372d 100644 --- a/Source/UBCS-WEB/src/views/code/code.vue +++ b/Source/UBCS-WEB/src/views/code/code.vue @@ -779,6 +779,7 @@ ref="referConfigFormDialog" @echoReferConfig="echoReferConfig"> </refer-config-form-dialog> + <!-- 绗簩灞傚璇濇,鐩存帴閫夋嫨鍙傜収閰嶇疆crud缁勪欢 --> <refer-config-crud-dialog ref="referConfigCrudDialog" @@ -1112,17 +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.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; }, /** 鐖跺垎绫婚�夋嫨瀵硅瘽妗嗭紝绗簩灞傚祵濂楀璇濇锛屽強鍏剁浉鍏虫柟娉� */ @@ -1649,7 +1651,7 @@ this.addBasicCodeSettingBox = true; }, // 鏂板鍩虹鐮佹 - saveOrEditBasicCode(){ + async saveOrEditBasicCode(){ if(this.selectionList[0].oid == null || this.selectionList[0].oid == ''){ this.$message.warning('缂哄け蹇呰鍙傛暟锛岃閲嶆柊閫夋嫨缂栫爜瑙勫垯鍚庡啀璇�!'); return; @@ -1657,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: "鎿嶄綔鎴愬姛!" @@ -1671,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 @@ -1958,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; @@ -1972,7 +1981,7 @@ return; } upOrderNum(row.oid).then(() => { - this.loadBasic({"oid":codeRuleOid}); + this.loadBasic(this.selectionList[0]); this.$message({ type: "success", message: "鎿嶄綔鎴愬姛!" @@ -2589,6 +2598,7 @@ referBtmId: row!=null&&row.referBtmId != '' ? row.referBtmId:'', //鍙傜収寮曠敤鐨勪笟鍔$被鍨嬶紝鐨刬d referBtmName: row!=null&&row.referBtmName != '' ? row.referBtmName:'', //鍙傜収寮曠敤鐨勪笟鍔$被鍨� referConfig: row!=null&&row.referConfig != '' ? row.referConfig:'', //鍙傜収閰嶇疆 + referValueInfo: row!=null&&row.referValueInfo != '' ? row.referValueInfo:'', //鍙傜収閰嶇疆 }); }else if(this.form.secType==='codedatesec'){ //鏃ユ湡鐮佹 @@ -2642,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