From 1d5845e4b98f9c69833e54ef69253d85d0c69fe8 Mon Sep 17 00:00:00 2001 From: yuxc <653031404@qq.com> Date: 星期五, 09 六月 2023 15:10:59 +0800 Subject: [PATCH] 1、对MDM服务的接口测试更改。 2、增加sys的菜单接口用于通过业务类型获取相关的界面按钮。 --- Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue | 130 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 115 insertions(+), 15 deletions(-) diff --git a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue index d506c66..4180372 100644 --- a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue +++ b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue @@ -1,5 +1,5 @@ <template> - <avue-input-tree :props="props" :lazy="lazy" :tree-load="treeLoad" :leaf-only="!options.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" :leaf-only="!referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="placeholder" :dic="treeData"></avue-input-tree> </template> <script> @@ -7,42 +7,134 @@ export default { name: "vciWebReferTree", - props:["options","value"], + props:["referConfig","value","text"], data() { return { - lazy:this.options.loadType == 'node', - isMuti:this.options.muti, - placeholder:'璇烽�夋嫨鍐呭', + options: this.referConfig.options, + lazy: this.referConfig.options.loadType == 'node', + isMuti: this.referConfig.isMuti, + placeholder: this.referConfig.placeholder || '璇烽�夋嫨鍐呭', props: { - value:this.options.valueField || 'oid', - label:this.options.textField || "name" + value: this.referConfig.valueField || this.referConfig.options.valueField || 'oid', + label: this.referConfig.textField || this.referConfig.options.textField || "name" //value:"value", //label:"title" }, - treeData:[], - params:{} - }; + treeUrl: this.referConfig.options.url || '/api/ubcs-code/codeClassify/treeCodeClassify', + treeData: [], + 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'] + } }, created() { this.getParams(); + console.log('referConfig:') + console.log(this.referConfig) }, mounted() { if(!this.lazy){ - this.getTree() + if(this.options.data){//濡傛灉鏄浐瀹氭暟鎹殑鎯呭喌涓� + this.treeData=this.options.data + }else{ + this.getTree() + } } }, methods: { getParams:function (){ + var queryParams = {}; + if(this.options.extraParams){ + queryParams = this.options.extraParams; + } + for(var i= 0 ; i < this.copyParam.length ; i ++){ + if(this.copyParam[i] == "btmType") { + queryParams[this.copyParam[i]] = this.options['referBo'] || this.options['referType']; + }else if(this.copyParam[i] in this.options){ + queryParams[this.copyParam[i]] = this.options[this.copyParam[i]]; + } + } + queryParams['referBo'] = this.options['referBo'] || this.options['referType']; + queryParams['selectAllLevel'] = (this.options.loadType == this.loadType.all?true:false);//true鏃跺悗鍙颁細鎶ラ敊 + if(queryParams.isMuti =="true"){ + queryParams.muti =true; + } + if(queryParams.isQueryAllColumn =="true"){ + queryParams.isQueryAllColumn = true; + } + if(this.options.useFormKey && this.options.formValues){ + //浣跨敤琛ㄥ崟涓婄殑瀛楁鏉ヨ繃婊� + queryParams['conditionMap["' + (this.options.paramForFormKey?this.options.paramForFormKey:this.options.useFormKey) + '"]'] = this.options.formValues[this.options.useFormKey]; + } + if (!this.options.loadType) { + this.options.loadType = this.loadType.node; + } + queryParams['queryAllLevel'] = this.options.loadType == this.loadType.node? false : true;//榛樿閫愮骇灞曞紑 + queryParams['loadType'] = this.options.loadType; + queryParams['multipleSelect'] = this.isMuti; + queryParams['isMuti'] = queryParams['multipleSelect']; + if (this.options.remoteSort && this.options.initSort) { + queryParams['order'] = this.options.initSort.type;//鏂规硶 + queryParams['sort'] = this.options.initSort.field;//瀛楁 + } + if (this.options.rootParams) { + for (var key in this.options.rootParams) { + queryParams[key] = this.options.rootParams[key]; + } + } + if (this.options.conditionParams) { + //璇存槑鏄墿灞曞睘鎬� + for (var key in this.options.conditionParams) { + queryParams['conditionMap["' + key + '"]'] = this.options.conditionParams[key];//鏂扮殑鏂瑰紡 + } + } + if(this.options.where ) { + for (var key in this.options.where) { + queryParams['conditionMap["' + key + '"]'] = this.options.where[key];//鏂� + } + } + if (this.options.treeExtandParams) { + //璇存槑鏄墿灞曞睘鎬� + for (var key in this.options.treeExtandParams) { + queryParams['extandParamsMap["' + key + '"]'] = this.options.treeExtandParams[key];//鏂扮殑鏂瑰紡 + } + } + if (this.options.sourceDataParams) { + //璇存槑鏄墿灞曞睘鎬� + for (var key in this.options.sourceDataParams) { + if (key && key.constructor === Object) return; + queryParams['sourceData["' + key + '"]'] = this.options.sourceDataParams[key];//鏂扮殑鏂瑰紡 + } + } + if (this.options.replaceParams) { + //璇存槑鏄墿灞曞睘鎬� + for (var key in this.options.replaceParams) { + if (key && key.constructor === Object) return; + queryParams['replaceMap["' + key + '"]'] = this.options.replaceParams[key];//鏂扮殑鏂瑰紡 + } + } + this.params=queryParams; }, getTree(){ - getTree(this.params,this.options.url).then(res => { + getTree(this.params,this.treeUrl).then(res => { this.treeData=res.data }) }, treeLoad: function (treeNode, resolve) { - const parentId = (treeNode.level === 0) ? 0 : treeNode.data.id; - getLazyTree({...this.params,parentId:parentId}).then(res => { + const parentOid = (treeNode.level === 0) ? 0 : treeNode.data.oid; + this.params.parentOid=parentOid.indexOf('@vcitreesep@') > -1 ? parentOid.split('@vcitreesep@')[1] : parentOid; + this.params.parentValue=this.params.parentOid; + this.params.parentBtmName=treeNode.data.attributes.btmName || treeNode.data.attributes.btmname; + this.params.parentBtmType=this.params.parentBtmName; + + if (this.options.rootParams && treeNode.level !== 0) { + for (var key in this.options.rootParams) { + delete this.params[key] + } + } + getLazyTree(this.params,this.treeUrl).then(res => { resolve(res.data.data.map(item => { return { ...item, @@ -50,8 +142,16 @@ } })) }); + }, + 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}); } - + }, + watch:{ } } </script> -- Gitblit v1.9.3