From 56c45e1f4be85d6bbfb3a03437021c6742b32ad9 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 24 八月 2023 18:29:30 +0800 Subject: [PATCH] 前端代码打包 --- Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue | 80 +++++++++++++++++++++++++++++----------- 1 files changed, 58 insertions(+), 22 deletions(-) diff --git a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue index 4180372..88fa814 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" :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","text"], + 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'}, @@ -30,8 +34,8 @@ }, created() { this.getParams(); - console.log('referConfig:') - console.log(this.referConfig) + // console.log('referConfig:') + // console.log(this.referConfig) }, mounted() { if(!this.lazy){ @@ -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; } @@ -114,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; }, @@ -143,16 +149,46 @@ })) }); }, - 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) { + 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[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.$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:{ - } + watch:{} } </script> -- Gitblit v1.9.3