From aa869225a5f2054cb0253d8f037863aaec866c6e Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期五, 27 九月 2024 09:51:36 +0800 Subject: [PATCH] UI定义页面 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue | 189 ++++++++++++++++------------------------------ 1 files changed, 66 insertions(+), 123 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue index 5d3b778..f30d66c 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue @@ -43,11 +43,11 @@ <el-container style="margin-top: 10px;"> <el-aside style="width:350px"> <fieldset> - <legend> 閾炬帴绫诲瀷鍊欓�夋潯浠� </legend> + <legend> 鍊欓�夋潯浠� </legend> <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-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" @node-drag-end="handleDragEnd"> </avue-tree> </div> </fieldset> @@ -60,20 +60,10 @@ :queryCondition="queryCondition" :queryTree="queryTree" :levelFlag.sync="form.levelFlag" + @queryHandler="queryHandler" ></form-query-dialog> </fieldset> </el-main> - <el-aside style="width:350px"> - <fieldset> - <legend> 涓氬姟绫诲瀷鍊欓�夋潯浠� </legend> - <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> - </div> - </fieldset> - </el-aside> </el-container> </div> <div class="dialog-footer avue-dialog__footer"> @@ -84,11 +74,10 @@ </template> <script> -import {getAllOrderbyAttributeByLink} from "@/api/modeling/linkType/api"; -import {linkSave} from "@/api/queryTemplate/linkTypeQuery"; +import {btmSave,getBizTypeQTDs,getCriteriaBtm} from "@/api/queryTemplate/businessTypeQuery"; import basicOption from "@/util/basic-option"; import {queryTemplateListByAttr} from "@/api/queryTemplate/queryDefine"; -import formQueryDialog from "./formQueryDialog.vue"; +import formQueryDialog from "@/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue"; export default { name: "formDialog", components:{formQueryDialog}, @@ -138,7 +127,14 @@ prop: 'orderField' }, { label: '鎺掑簭鏂瑰紡', - prop: 'orderMode' + prop: 'orderMode', + formatter:function (row, value) { + if (row.orderMode == 'ASC') { + return '鍗囧簭' + }else{ + return '闄嶅簭' + } + } }, { label: '浼樺厛绾�', prop: 'level' @@ -206,14 +202,19 @@ allowDrop: () => { 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:[],//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁 - //閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑椤瑰睘鎬� - linkTreeData: [], businessQueryDefineForm:'',//涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑鍊� businessQueryDefineDic:[],//涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁 //涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑椤瑰睘鎬� @@ -222,56 +223,9 @@ queryTree:{}, //鏅�氭煡璇㈡潯浠� queryCondition:[], - }; }, watch: { - //鏂瑰悜 - 'form.direction': { - handler(val) { - if(val=='positive'){ - //姝e悜 - const dicData=this.treeData.btmItemsTo.map(item=>{ - return { - label: item, - value: item - } - }) - dicData.push({ - label: '鎵�鏈夌被鍨�', - value: '*' - }) - this.$refs.form.updateDic('btmType', dicData); - this.form.btmType=dicData[0].value - this.getAllAttr(); - }else if(val=='opposite'){ - //鍙嶅悜 - const dicData=this.treeData.btmItemsFrom.map(item=>{ - return { - label: item, - value: item - } - }) - dicData.push({ - label: '鎵�鏈夌被鍨�', - value: '*' - }) - this.$refs.form.updateDic('btmType', dicData); - this.form.btmType=dicData[0].value - this.getAllAttr(); - } - }, - immediate: true, - }, - //涓氬姟绫诲瀷 - 'form.btmType': { - handler(val) { - if(val && val!='*'){ - this.getTemp(val,false); - } - }, - immediate: true, - } }, methods: { openDialog(btmName, title, mode, data) { @@ -299,7 +253,9 @@ }; } this.dialog.showDialog = true; - this.getTemp(data.treeData.label, true) + this.treeOption.defaultExpandedKeys=[data.treeData.label] + this.getTemp(data.treeData.label) + this.getAllAttr(); }, cancelDialog() { this.dialog.loading = false; @@ -322,11 +278,13 @@ if (valid) { const formData=this.initFormData(); console.log(formData) - linkSave(formData).then(res => { + btmSave(formData).then(res => { if (res.data.success) { this.$message.success("淇濆瓨鎴愬姛"); this.cancelDialog(); this.$emit("refresh"); + }else { + this.$refs.form.clearValidate(); } }); } else { @@ -340,17 +298,7 @@ qtName: this.form.qtName, levelFlag: this.form.levelFlag, queryTemplate: { - btmType: this.form.btmType, - clauseList: ['*'], - id: this.form.qtName, - level: this.form.level, - linkType: this.form.btmName, orderInfoList: this.orderInfoList, - recReturnMode: 1,//閫掑綊杩斿洖鏁版嵁妯″紡:1锛歊ECRETURNMODE_FLAT, 2锛歊ECRETURNMODE_FILTER - rightFlag: true, - secretFlag: true, - type: 'link', - version: this.form.version } } if (formData.levelFlag == 1) { @@ -402,16 +350,14 @@ }, //鑾峰彇鎺掑簭璁剧疆涓墍鏈夋帓搴忓瓧娈� getAllAttr() { - getAllOrderbyAttributeByLink({ - name: this.treeData.label, - btmType: this.form.btmType, - direction: this.form.direction + getBizTypeQTDs({ + btmName: this.treeData.label }).then(res => { const orderInfoStr = JSON.stringify(this.orderInfoList); const dicData = []; res.data.data.forEach(item => { - if (orderInfoStr.indexOf('"orderField":"' + item + '"') == -1) { - dicData.push({id: item}); + if (orderInfoStr.indexOf('"orderField":"' + item.id + '"') == -1) { + dicData.push(item); } }) this.tableFormOption.column[0].dicData=dicData; @@ -442,53 +388,24 @@ }) }, //鑾峰彇鏌ヨ妯℃澘瀹氫箟涓嬫媺 - getTemp(btmName,linkFlag) { + getTemp(btmName) { if (btmName) { - queryTemplateListByAttr({btmName: btmName, linkFlag: linkFlag,direction:this.form.direction}).then(res => { + queryTemplateListByAttr({btmName: btmName,linkFlag:false}).then(res => { const data = res.data.data.map(item => { - item.label = item.name + '-' + (item.linkTypeName || item.btmName); + item.label = item.name + '-' + item.btmName; item.value = item.name; return item; }); - if(linkFlag){ - this.linkQueryDefineDic=data - data.length>0 && (this.linkQueryDefineForm=data[0].value); - }else { this.businessQueryDefineDic=data; data.length>0 && (this.businessQueryDefineForm= data[0].value); - } }) - } - }, - 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 - }] } }, 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 }] } }, @@ -496,6 +413,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(); + getCriteriaBtm(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