From 3f5ffa69d5316c17a37de310bdea027523186064 Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期一, 12 六月 2023 17:32:12 +0800 Subject: [PATCH] 修改参照组件 --- Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue | 83 ++++++++++++++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 18 deletions(-) diff --git a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue index 4180372..d5f82cb 100644 --- a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue +++ b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue @@ -1,27 +1,31 @@ <template> - <avue-input-tree ref="referTree" :props="props" :lazy="lazy" :tree-load="treeLoad" :node-click="nodeClick" :leaf-only="!referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree> + <avue-input-tree ref="referTree" :props="props" :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","text"], + props:["referConfig","value","text","title"], 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'}, @@ -42,6 +46,7 @@ } } }, + computed:{}, methods: { getParams:function (){ var queryParams = {}; @@ -56,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; } @@ -143,12 +148,54 @@ })) }); }, - nodeClick(data){ - //涓嶈鐢╳atch鐩戝惉value鍊硷紝浼氭壘涓嶅埌text - this.value=data[this.props.value]; - this.text=data[this.props.label]; - this.currentNode=data; - this.$emit("setValue", {field:this.referConfig.field,showField:this.referConfig.showField,value:this.value,text:this.text,rawData:this.currentNode}); + nodeClick(data, node, nodeComp){ + if(!this.isMuti) { + //涓嶈鐢╳atch鐩戝惉value鍊硷紝浼氭壘涓嶅埌text + this.value = data[this.config.valueField]; + this.text = data[this.config.textField]; + this.currentNode = data; + this.$emit("setValue", { + field: this.referConfig.field, + showField: this.referConfig.showField, + value: this.value, + text: this.text, + rawData: [this.currentNode] + }); + } + }, + checked:(checkedNode, checkedData)=> { + debugger; + /* + * this鐢ㄦ椂濮嬬粓瑕佹姤閿欙紝鍙兘鍏堟敞閲� + 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[this.config.valueField] || item[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[textFieldArray[i]] || item[textFieldArray[i]]) + tempRaw.push(t); + } + } + text.push(tempRaw.join(textSep)); + } + this.value = value.join(','); + this.text = text.join(',')*/ + + this.value=checkedData.checkedKeys; + this.$emit("setValue", { + field: this.referConfig.field, + showField: this.referConfig.showField, + value: this.value, + text: this.text, + isTreeMuti:true, + rawData: checkedData.checkedNodes + }); } }, watch:{ -- Gitblit v1.9.3