From 5042cc0622d36e3df27d0d086219ba17bc40e2f5 Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期五, 06 九月 2024 18:29:55 +0800 Subject: [PATCH] 查询模板 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue | 83 ++++++++++++++++++++++++++++------------- 1 files changed, 56 insertions(+), 27 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue index 35ac7b2..0561cfc 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue @@ -47,7 +47,7 @@ <div> 鏌ヨ妯℃澘瀹氫箟 <avue-select @change="linkQueryDefineChange" class="el-input--small" v-model="linkQueryDefineForm" placeholder="璇烽�夋嫨鍐呭" type="tree" :dic="linkQueryDefineDic" style="width:240px"></avue-select> - <avue-tree style="height: 265px" :data="linkTreeData" :option="treeOption" @node-drag-start="handleDragStart"> + <avue-tree style="height: 265px" :data="linkTreeData" :option="treeOption" @node-drag-start="handleDragStart" @node-drag-end="handleDragEnd"> </avue-tree> </div> </fieldset> @@ -60,6 +60,7 @@ :queryCondition="queryCondition" :queryTree="queryTree" :levelFlag.sync="form.levelFlag" + @queryHandler="queryHandler" ></form-query-dialog> </fieldset> </el-main> @@ -69,7 +70,7 @@ <div> 鏌ヨ妯℃澘瀹氫箟 <avue-select @change="businessQueryDefineChange" class="el-input--small" v-model="businessQueryDefineForm" placeholder="璇烽�夋嫨鍐呭" type="tree" :dic="businessQueryDefineDic" style="width: 240px;"></avue-select> - <avue-tree style="height: 265px" :data="businessTreeData" :option="treeOption" @node-drag-start="handleDragStart"> + <avue-tree style="height: 265px" :data="businessTreeData" :option="treeOption" @node-drag-start="handleDragStart" @node-drag-end="handleDragEnd"> </avue-tree> </div> </fieldset> @@ -85,7 +86,7 @@ <script> import {getAllOrderbyAttributeByLink} from "@/api/modeling/linkType/api"; -import {linkSave} from "@/api/queryTemplate/linkTypeQuery"; +import {linkSave,getCriteria} from "@/api/queryTemplate/linkTypeQuery"; import basicOption from "@/util/basic-option"; import {queryTemplateListByAttr} from "@/api/queryTemplate/queryDefine"; import formQueryDialog from "./formQueryDialog.vue"; @@ -196,7 +197,14 @@ prop: 'orderField' }, { label: '鎺掑簭鏂瑰紡', - prop: 'orderMode' + prop: 'orderMode', + formatter:function (row, value) { + if (row.orderMode == 'ASC') { + return '鍗囧簭' + }else{ + return '闄嶅簭' + } + } }, { label: '浼樺厛绾�', prop: 'level' @@ -261,12 +269,21 @@ addBtn: false, filter:false, draggable: true, - allowDrop: () => { + allowDrop: (node) => { return false; }, - allowDrag: () => { - return true; + allowDrag: (dropNode) => { + if (dropNode.data.attrs && dropNode.data.attrs.length>0) { + return false; + } else { + return true; + } }, + props:{ + label:'name', + value:'name', + children:'attrs' + } }, linkQueryDefineForm:'',//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑鍊� linkQueryDefineDic:[],//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁 @@ -362,7 +379,9 @@ }; } this.dialog.showDialog = true; + this.treeOption.defaultExpandedKeys=[data.treeData.label] this.getTemp(data.treeData.label, true) + }, cancelDialog() { this.dialog.loading = false; @@ -527,33 +546,17 @@ }, linkQueryDefineChange(data) { if (data.value) { - const childData = data.item.attrs.map(item => { - return { - label: item.name, - value: item.name, - atttributes:item - }; - }); this.linkTreeData = [{ - label: data.value, - value: data.value, - children: childData + name: data.value, + attrs: data.item.attrs }] } }, businessQueryDefineChange(data) { if (data.value) { - const childData = data.item.attrs.map(item => { - return { - label: item.name, - value: item.name, - atttributes:item - }; - }); this.businessTreeData = [{ - label: data.value, - value: data.value, - children: childData + name: data.value, + attrs: data.item.attrs }] } }, @@ -561,6 +564,32 @@ handleDragStart(node, ev) { // 浣跨敤 setData 鏂规硶璁剧疆鏁版嵁 ev.dataTransfer.setData('item', JSON.stringify(node.data)); + if(this.form.levelFlag==1){ + this.$refs.formQuery.$refs.tree.$emit('tree-node-drag-start', ev,{node:this.$refs.formQuery.initItem(node)}); + } + }, + handleDragEnd(draggingNode,endNode,position,ev){ + if(this.form.levelFlag==1) { + this.$refs.formQuery.$refs.tree.$emit('tree-node-drag-end', ev); + } + }, + //鏌ヨ + queryHandler(){ + this.$refs.form.validate((valid) => { + if (valid) { + this.$refs.formQuery.queryResultDialog.loading=true; + const formData=this.initFormData(); + getCriteria(formData).then(res => { + if (res.data.success) { + this.resultData=res.data.data; + this.$refs.formQuery.queryResultDialog.showDialog=true; + this.$refs.formQuery.queryResultDialog.loading=false; + } + }); + } else { + return false; + } + }); }, }, } -- Gitblit v1.9.3