From a17f731ee4bcad459c184be5a7c3de6c3619443b Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 07 六月 2023 19:47:03 +0800 Subject: [PATCH] 代码整合 --- Source/UBCS-WEB/src/views/code/code.vue | 115 +++++++++++++++++++++++++++++++++------------------------ 1 files changed, 67 insertions(+), 48 deletions(-) diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue index aaeef02..9016174 100644 --- a/Source/UBCS-WEB/src/views/code/code.vue +++ b/Source/UBCS-WEB/src/views/code/code.vue @@ -1069,6 +1069,7 @@ ref: 'advancedQuery', advancedQuerySettingBox: false, options: [], + currentOpen: '', //褰撳墠鎵撳紑楂樼骇鏌ヨ鐨勭獥鍙f槸 //conditionMapParams: {}, }, @@ -1092,9 +1093,16 @@ /** 楂樼骇鏌ヨ瀵硅瘽妗嗙粍浠�,缁勪欢杩斿洖鐨勫�兼槸condtionMap[field]褰㈠紡鐨勬煡璇㈡潯浠讹紝淇濈暀浜嗗拰涔嬪墠涓�鏍风殑鏂瑰紡 */ echoSeniorContionMap(conditionMaps){ - // console.log(conditionMaps); - this.query = conditionMaps; - this.onLoad(this.page); + //console.log(conditionMaps); + if(JSON.stringify(conditionMaps)!='{}'){ + if(this.advancedQueryParam.currentOpen =='codeRule'){ + this.query = conditionMaps; + this.onLoad(this.page); + }else{ + this.sendGridCodeBasicSec(conditionMaps,true); + } + //console.log(conditionMaps); + } }, /* 鍏紡缂栬緫妗嗗唴瀹规敼鍙�,瀛愮粍浠剁紪杈戝畬鍏紡涔嬪悗鍐呭鍥炴樉鏃惰皟鐢� */ @@ -1165,12 +1173,17 @@ refreshParentClassifyDataChange() { this.parentClassifyOnLoad(this.parentClsfyParams.parentClassifyDataPage, this.parentClsfyParams.parentClassifyQuery); }, + // TODO:寰呬慨鏀� parentClassifyOnLoad(page, params = {}) { let parentClsParam = this.parentClsfyParams; parentClsParam.classifyDialogLoading = true; let oid = this.selectionList.length==0 ? this.form.pkCodeRule:this.selectionList[0].oid; - Object.assign(params,{pkCodeRule:oid}) - refDataGridClassifySec(page.currentPage, page.pageSize, Object.assign(params, parentClsParam.parentClassifyQuery)).then(res => { + let conditionMaps = this.paramsToConditionMa({"pkCodeRule":oid}); + refDataGridClassifySec( + page.currentPage, + page.pageSize, + conditionMaps + ).then(res => { //console.log(res.data); const data = res.data.data; parentClsParam.parentClassifyDataPage.total = data.total; @@ -1192,16 +1205,15 @@ let attrParam = this.selectAttrParams; //console.log(this.currentSelectTreeData); attrParam.selectAttrOptionLoading = true; - let param = {}; - // 澶氫釜conditionMap杩欐牱浼犲弬 + let conditionMaps = {}; if(attrParam.selectAttrQeury){ - Object.keys(attrParam.selectAttrQeury).forEach(key=>{ - param['conditionMap['+key+']'] = attrParam.selectAttrQeury[key]; - }); + Object.keys(attrParam.selectAttrQeury).forEach(key=>{ + conditionMaps['conditionMap['+key+']'] = attrParam.selectAttrQeury[key]; + }); } - param['conditionMap[codeClassifyOid]'] = this.currentSelectTreeData.oid; - param['conditionMap[btmTypeOid]'] = this.currentSelectTreeData.btmTypeOid; - listClassifyLinkAttr(param).then(res=>{ + conditionMaps['conditionMap[codeClassifyOid]'] = this.currentSelectTreeData.oid; + conditionMaps['conditionMap[btmTypeOid]'] = this.currentSelectTreeData.btmTypeOid; + listClassifyLinkAttr(conditionMaps).then(res=>{ //console.log(res.data.data); attrParam.selectAttrData = res.data.data; attrParam.selectAttrOptionLoading = false; @@ -1887,15 +1899,25 @@ //瀛樺偍褰撳墠鍏宠仈鐨勭紪鐮佽鍒欑浉鍏充俊鎭� this.currentCodeRuleOid = row.oid; this.currentRuleLcStatus = row.lcStatus; - this.sendGridCodeBasicSec({"pkCodeRule":row.oid}); + this.sendGridCodeBasicSec({"pkCodeRule_equal":row.oid},false); }, // 鍙戦�佸姞杞藉熀纭�鐮佹鐨勮姹� - sendGridCodeBasicSec(condition){ + sendGridCodeBasicSec(condition,isAdancedQuery/** 鏄惁楂樼骇鏌ヨ */){ // 濡傛灉褰撳墠鍩虹鐮佹琛ㄤ腑鐨勬悳绱㈡寜閽闅愯棌锛屽氨闇�瑕佸湪姝ゅ紑鍚� if(this.selectionList.length>=0 && !this.$refs.crudBasic.option.column[0].search){ this.hideBasicTable(true); } - gridCodeBasicSec(1, -1, condition).then(res => { + let conditionMaps = {}; + if(condition && !isAdancedQuery){ + Object.keys(condition).forEach(key=>{ + conditionMaps['conditionMap[t.'+key+']'] = condition[key]; + }); + } + if(isAdancedQuery){ + condition['conditionMap[t.pkCodeRule_equal]'] = this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' + ? this.selectionList[0].oid:this.currentCodeRuleOid; + } + gridCodeBasicSec(1, -1,isAdancedQuery ? condition:conditionMaps).then(res => { const data = res.data.data; if(this.cloneSettingBox){ this.cloneData = data.records; @@ -1923,11 +1945,11 @@ }, basicSearchChange(params, done){ //console.log(this.$refs.crudBasic); - this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule":this.selectionList[this.selectionList.length-1].oid})); + this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule_equal":this.selectionList[this.selectionList.length-1].oid}),false); done(); }, basicSearchReset(){ - this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid}); + this.sendGridCodeBasicSec({"pkCodeRule_equal":this.selectionList[this.selectionList.length-1].oid},false); }, // 涓婄Щ涓嬬Щ鍩虹鐮佹 upOrderNum(row){ @@ -2032,7 +2054,7 @@ title: '鐘舵��', fieldType: 'combox', queryField: 'lcStatus', - comboxKey: 'Eummaterialtype', + comboxKey: 'codeSearchLCStatus', } ] }else { @@ -2041,26 +2063,27 @@ data: [], title: '鐮佹缂栧彿', fieldType: 'text', - queryField: 'id', + queryField: 't.id', },{ data: [], title: '鐮佹鍚嶇О', fieldType: 'text', - queryField: 'name', + queryField: 't.name', },{ data: [], title: '鎻忚堪', fieldType: 'text', - queryField: 'description', + queryField: 't.description', },{ data: [], title: '鐮佹绫诲瀷', fieldType: 'combox', - queryField: 'secType', + queryField: 't.secType', comboxKey: 'codeSecType', } ] } + this.advancedQueryParam.currentOpen = condition; this.advancedQueryParam.advancedQuerySettingBox = true; }, // 鏌ヨ浣跨敤鑼冨洿 @@ -2333,11 +2356,10 @@ this.page.currentPage = 1; // 澶氫釜conditionMap杩欐牱浼犲弬锛屽揩閫熸煡璇㈤粯璁ら噰鐢ㄦā绯婃煡璇� if(params){ - Object.keys(params).forEach(key=>{ - this.query['conditionMap['+key+'_like]'] = params[key]; - }); + Object.keys(params).forEach(key=>{ + this.query['conditionMap['+key+'_like]'] = params[key]; + }); } - console.log(this.query); this.onLoad(this.page); done(); }, @@ -2599,42 +2621,39 @@ } // console.log(this.form); }, + // 绗竴娆¤姹傜殑鏋氫妇鏁版嵁鏀剧紦瀛� + getLocalStorageEnum(key){ + let enumCach = JSON.parse(localStorage.getItem(key)); + if(enumCach == null) { + getDictionary({code: key}).then(res=>{ + enumCach = res.data.data; + localStorage.setItem(key,JSON.stringify(res.data.data)); + }) + } + return enumCach; + }, //鏋氫妇鍜屽彲杈撳彲閫夊唴瀹规煡璇� loadCodeSecType(){ - getDictionary({code: "codeSecType"}).then(res=>{ - this.enumParam.secTypeList = res.data.data; - }) + this.enumParam.secTypeList = this.getLocalStorageEnum("codeSecType"); this.loadCodeSecLength(); }, loadCodeSecLength(){ - getDictionary({code: "codeSecLength"}).then(res=>{ - this.enumParam.codeSecLengthType = res.data.data; - }) + this.enumParam.codeSecLengthType = this.getLocalStorageEnum("codeSecLength"); }, loadCodeFillType(){ - getDictionary({code: "codeFillType"}).then(res=>{ - this.enumParam.codeFillType = res.data.data; - }) + this.enumParam.codeFillType = this.getLocalStorageEnum("codeFillType"); }, loadCodeFillSeparator(){ - getDictionary({code: "codeFillSeparator"}).then(res=>{ - this.enumParam.codeFillSeparator = res.data.data; - }) + this.enumParam.codeFillSeparator = this.getLocalStorageEnum("codeFillSeparator"); }, loadCodeLevelType(){ - getDictionary({code: "codeLevelType"}).then(res=>{ - this.enumParam.codeLevelType = res.data.data; - }) + this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType"); }, loadCodeCutType(){ - getDictionary({code: "codeCutType"}).then(res=>{ - this.enumParam.codeCutType = res.data.data; - }) + this.enumParam.codeCutType = this.getLocalStorageEnum("codeCutType"); }, loadCodeGetValueType(){ - getDictionary({code: "codeGetValueType"}).then(res=>{ - this.enumParam.codeGetValueType = res.data.data; - }) + this.enumParam.codeGetValueType = this.getLocalStorageEnum("codeGetValueType"); }, } -- Gitblit v1.9.3