From eab19be5f39c7fb5f528be1340206fe789426552 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 08 九月 2023 16:57:11 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue | 76 ++++++++++++++++++++++++++++++------- 1 files changed, 61 insertions(+), 15 deletions(-) diff --git a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue index fb1830b..3000eba 100644 --- a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue +++ b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue @@ -1,27 +1,32 @@ <template> - <avue-input-tree :props="props" :lazy="lazy" :tree-load="treeLoad" :leaf-only="!referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree> + <avue-input-tree ref="referTree" :props="props" :disabled="disabled" :lazy="lazy" :tree-load="treeLoad" :node-click="nodeClick" :checked="checked" :leaf-only="referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="title" :dic="treeData"></avue-input-tree> </template> <script> import {getTree,getLazyTree} from "@/api/refer/tree"; +import {validatenull} from "@/util/validate"; export default { name: "vciWebReferTree", - props:["referConfig","value"], + props:["referConfig","value","text","title","disabled"], data() { return { options: this.referConfig.options, lazy: this.referConfig.options.loadType == 'node', - isMuti: this.referConfig.isMuti, - placeholder: this.referConfig.placeholder || '璇烽�夋嫨鍐呭', + isMuti:("true" == this.referConfig.options.isMuti || this.referConfig.options.isMuti == true || this.referConfig.options.muti == true) ? true : false, props: { - value: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', - label: this.referConfig.textField || this.referConfig.options.textField || "name" - //value:"value", - //label:"title" + value: 'oid', + label: "name" }, - treeUrl: this.referConfig.options.url || '',//'/api/ubcs-code/codeClassify/treeCodeClassify', + config:{ + valueField: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', + textField:this.referConfig.textField || this.referConfig.options.textField || "name", + textSep:this.referConfig.textSep || ' ' + }, + treeUrl: this.referConfig.options.url || '/api/ubcs-code/mdmEngineController/defaultReferTree', treeData: [], + selectionList: [], + currentNode:{}, params: {}, loadType: {'all': 'all', 'node': 'node'}, copyParam: ['btmType', 'lnType', 'toBtmType', 'textField', 'valueField', 'parentFieldName', 'parentValue', 'sort', 'order', 'isDirection', 'whereSql', 'isMuti', 'queryScheme', 'isQueryAllColumn', 'queryColumn', 'split', 'loadType', 'onlyLeaf', 'onlyLeafText', 'parentUsedField'] @@ -29,6 +34,8 @@ }, created() { this.getParams(); + // console.log('referConfig:') + // console.log(this.referConfig) }, mounted() { if(!this.lazy){ @@ -39,10 +46,10 @@ } } }, + computed:{}, methods: { getParams:function (){ var queryParams = {}; - debugger; if(this.options.extraParams){ queryParams = this.options.extraParams; } @@ -54,10 +61,10 @@ } } queryParams['referBo'] = this.options['referBo'] || this.options['referType']; + queryParams['referType']= queryParams['referBo'] queryParams['selectAllLevel'] = (this.options.loadType == this.loadType.all?true:false);//true鏃跺悗鍙颁細鎶ラ敊 - if(queryParams.isMuti =="true"){ - queryParams.muti =true; - } + + queryParams.muti =this.isMuti; if(queryParams.isQueryAllColumn =="true"){ queryParams.isQueryAllColumn = true; } @@ -112,6 +119,7 @@ queryParams['replaceMap["' + key + '"]'] = this.options.replaceParams[key];//鏂扮殑鏂瑰紡 } } + queryParams['parentValue']='\\IN(SELECT oid from PL_CODE_CLASSIFY where id =\'hesuanfenlei\')' this.params=queryParams; }, @@ -140,9 +148,47 @@ } })) }); + }, + nodeClick(data, node, nodeComp){ + if(!this.isMuti) { + this.setValue({checkedNodes:[data]}) + } + }, + checked(checkedNode, checkedData) { + this.setValue(checkedData) + }, + setValue:function (checkedData){ + var value = []; + var text = []; + const textSep =this.config.textSep; + for(var j =0;j<checkedData.checkedNodes.length;j++){ + const item=checkedData.checkedNodes[j]; + var v=this.config.valueField.indexOf("attribute.")>=0?(item.attributes[this.config.valueField.replace("attribute.","")] || item.attributes.data[this.config.valueField.replace("attribute.","")]):(item.attributes[this.config.valueField] || item[this.config.valueField] || item.attributes.data[this.config.valueField]) + value.push(v); + var tempRaw = []; + var textFieldArray = this.config.textField.split(","); + for (var i = 0; i < textFieldArray.length; i++) {//鏄剧ず鐨勫瓧娈靛彲鑳芥湁澶氫釜 + if (!validatenull(textFieldArray[i])) { + var t=textFieldArray[i].indexOf("attribute.")>=0?(item.attributes[textFieldArray[i].replace("attribute.","")] ||item.attributes.data[textFieldArray[i].replace("attribute.","")]):(item.attributes[textFieldArray[i]] || item[textFieldArray[i]] || item.attributes.data[textFieldArray[i]]) + tempRaw.push(t); + } + } + text.push(tempRaw.join(textSep)); + } + this.value = value.join(','); + this.text = text.join(',') + this.$emit("setValue", { + field: this.referConfig.field, + showField: this.referConfig.showField, + value: this.value, + text: this.text || '', + isTreeMuti:this.isMuti, + rawData: checkedData.checkedNodes, + fieldMap:this.referConfig.fieldMap + }); } - - } + }, + watch:{} } </script> -- Gitblit v1.9.3