From 1203d84fbee0e1ffc31fcf2234a3f81f48f809eb Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期四, 05 九月 2024 20:35:14 +0800 Subject: [PATCH] 链接类型查询模板 --- Source/plt-web/plt-web-ui/src/App.vue | 1 Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js | 22 Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js | 8 Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue | 125 ++- Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue | 692 ++++++++++++++++-- Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue | 97 +- Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue | 514 ++++++++++++++ Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formQueryDialog.vue | 677 ++++++++++++++++++ Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue | 5 9 files changed, 1,959 insertions(+), 182 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/App.vue b/Source/plt-web/plt-web-ui/src/App.vue index 0664619..421e759 100644 --- a/Source/plt-web/plt-web-ui/src/App.vue +++ b/Source/plt-web/plt-web-ui/src/App.vue @@ -50,6 +50,7 @@ } .dialog-footer{ background-color: #ffffff; + z-index: 10000; } .avue-crud .avue-form { margin: 0px auto !important; // 琛ㄦ牸鍐呯殑琛ㄥ崟锛堟瘮濡�:鎼滅储鏍忥級 鍙栨秷涓嬭竟璺� diff --git a/Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js b/Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js index 6e55884..0f898d7 100644 --- a/Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js +++ b/Source/plt-web/plt-web-ui/src/api/queryTemplate/linkTypeQuery.js @@ -26,3 +26,11 @@ params:params }); } +// 鏌ヨ鏉′欢鐨勬煡璇㈡帴鍙o紝鎺ュ彛鏂瑰紡POST锛屽弬鏁颁笌淇濆瓨鎺ュ彛浼犲弬涓�鑷� +export function getCriteria(params) { + return request({ + url: "/api/templateController/getCriteria", + method: "post", + data:params + }); +} diff --git a/Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js b/Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js index 4d9946c..71c3460 100644 --- a/Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js +++ b/Source/plt-web/plt-web-ui/src/api/queryTemplate/queryDefine.js @@ -1,6 +1,7 @@ import request from '@/router/axios'; //鏌ヨ妯℃澘瀹氫箟 // 妯℃澘鍒楄〃瀹氫箟涓嬫媺妗嗘煡璇� +//btmName: 绫诲瀷鍚�, linkFlag: 鏄惁閾炬帴绫诲瀷 export function gridTemplate(params) { return request({ url: "/api/templateController/queryTemplateList", @@ -11,6 +12,27 @@ }); } +//閾炬帴绫诲瀷鏌ヨ妯℃澘鍊欓�夋潯浠� +//btmName: 閾炬帴绫诲瀷鍚�, linkFlag: 鏄惁閾炬帴绫诲瀷 +//btmName: 涓氬姟绫诲瀷鍚�, linkFlag: 鏄惁閾炬帴绫诲瀷锛宒irection锛氭鍚戝弽鍚� +export function queryTemplateListByAttr(params) { + return request({ + url: "/api/templateController/queryTemplateListByAttr", + method: "get", + params:{ + ...params + } + }); +} + +//鑾峰彇鎵�鏈夋煡璇㈡ā鏉� +export function getAllQTs(page,limit) { + return request({ + url: "/api/templateController/getAllQTs", + method: "get" + }); +} + // 淇敼 export function updateTemplate(params) { return request({ 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 new file mode 100644 index 0000000..5d3b778 --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formDialog.vue @@ -0,0 +1,514 @@ +<template> + <el-dialog v-dialogDrag + :title="dialog.title" + :visible.sync="dialog.showDialog" + width="1620px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="cancelDialog"> + <div style="min-height: 665px;max-height: 85vh;padding-bottom: 50px;"> + <basic-form key="linkQueryForm" style="margin-bottom: 0" + ref="form" + :span="4" + :formItems="formItems" + :formData="form" + @getFormData="getFormData"> + </basic-form> + <avue-crud ref="crud" title="璁剧疆鎺掑簭" + :data="orderInfoList" :option="crudOption"> + <template slot="menuLeft" slot-scope="scope"> + <el-button icon="el-icon-plus" size="small" type="primary" @click="addRow">鍒涘缓</el-button> + </template> + <template slot="menu" slot-scope="scope"> + <el-button icon="el-icon-delete" size="small" type="text" @click="rowDeleteHandler(scope)">鍒犻櫎 + </el-button> + </template> + </avue-crud> + <el-dialog v-dialogDrag + title="鍒涘缓" + :visible.sync="crudDialog.showDialog" + width="500px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="crudDialog.showDialog=false"> + <avue-form ref="tableForm" :option="tableFormOption" v-model="tableForm"></avue-form> + <div class="dialog-footer avue-dialog__footer"> + <el-button type="primary" plain size="small" @click="rowSave" >淇� 瀛�</el-button> + </div> + </el-dialog> + <el-container style="margin-top: 10px;"> + <el-aside style="width:350px"> + <fieldset> + <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-tree> + </div> + </fieldset> + </el-aside> + <el-main> + <fieldset style="margin: 0 10px"> + <legend> 鏌ヨ鏉′欢 </legend> + <form-query-dialog ref="formQuery" + style="height: 300px;" + :queryCondition="queryCondition" + :queryTree="queryTree" + :levelFlag.sync="form.levelFlag" + ></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"> + <el-button type="primary" plain size="small" @click="submitDialog" >淇� 瀛�</el-button> + <el-button size="small" @click="cancelDialog">鍙� 娑�</el-button> + </div> + </el-dialog> +</template> + +<script> +import {getAllOrderbyAttributeByLink} from "@/api/modeling/linkType/api"; +import {linkSave} from "@/api/queryTemplate/linkTypeQuery"; +import basicOption from "@/util/basic-option"; +import {queryTemplateListByAttr} from "@/api/queryTemplate/queryDefine"; +import formQueryDialog from "./formQueryDialog.vue"; +export default { + name: "formDialog", + components:{formQueryDialog}, + data(){ + return { + dialog: { + showDialog: false, + title: "鍒涘缓", + submitTxt: "淇濆瓨", + submitIcon: "el-icon-check", + loading: false, + type: "add", + }, + crudDialog: { + showDialog: false, + submitTxt: "淇濆瓨", + submitIcon: "el-icon-check", + }, + formItems:[{ + label: '鏌ヨ妯℃澘鍚嶇О', + prop: 'qtName', + type: 'input', + span:5, + rules: [{ + required: true, + message: "璇疯緭鍏ユ煡璇㈡ā鏉垮悕绉�", + trigger: "blur" + }] + }], + form:{ + btmName:'', + qtName: '', + levelFlag:0,//0:鏅�氭煡璇㈡ā鏉�; 1:楂樼骇鏌ヨ妯℃澘" + queryTemplate:{} + }, + //宸叉湁鎺掑簭鍒楄〃閰嶇疆 + crudOption: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + selection: false, + height: "220", + tip: false, + column: [{ + label: '鎺掑簭瀛楁', + prop: 'orderField' + }, { + label: '鎺掑簭鏂瑰紡', + prop: 'orderMode' + }, { + label: '浼樺厛绾�', + prop: 'level' + }] + }, + //宸叉湁鎺掑簭 + orderInfoList:[], + //璁剧疆鎺掑簭寮圭獥琛ㄥ崟鏁版嵁 + tableForm:{ + orderField:'', + orderMode:'ASC', + level:'' + }, + //璁剧疆鎺掑簭寮圭獥鎵�鏈夊彲鎺掑簭瀛楁 + orderFieldList:[], + //璁剧疆鎺掑簭寮圭獥琛ㄥ崟閰嶇疆 + tableFormOption: { + menuBtn: false, + submitBtn: false, + emptyBtn: false, + span:24, + column: [{ + label: '鎺掑簭瀛楁', + prop: 'orderField', + type:'select', + props: { + label: 'id', + value: 'id' + }, + rules: [{ + required: true, + message: "璇烽�夋嫨鎺掑簭瀛楁", + trigger: "blur" + }] + }, { + label: '鎺掑簭鏂瑰紡', + prop: 'orderMode', + type: 'select', + dicData: [{ + label: '鍗囧簭', + value: 'ASC' + }, { + label: '闄嶅簭', + value: 'DESC' + }], + value: 'ASC' + }, { + label: '浼樺厛绾�', + prop: 'level', + type: 'number', + min:1, + rules: [{ + required: true, + message: "璇疯緭鍏ヤ紭鍏堢骇", + trigger: "blur" + }] + }] + }, + treeOption:{ + defaultExpandAll:true, + menu: false, + addBtn: false, + filter:false, + draggable: true, + allowDrop: () => { + return false; + }, + allowDrag: () => { + return true; + }, + }, + linkQueryDefineForm:'',//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑鍊� + linkQueryDefineDic:[],//閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁 + //閾炬帴绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑椤瑰睘鎬� + linkTreeData: [], + businessQueryDefineForm:'',//涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑鍊� + businessQueryDefineDic:[],//涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟涓嬫媺鏁版嵁 + //涓氬姟绫诲瀷鏌ヨ妯℃澘瀹氫箟閫変腑椤瑰睘鎬� + businessTreeData: [], + //楂樼骇鏌ヨ鏉′欢 + 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) { + this.dialog.title = title; + this.dialog.type = mode; + this.form.btmName = btmName; + this.treeData = data.treeData; + + if (data.selectData) { + this.selectData = data.selectData; + this.form.qtName = this.selectData.qtName; + if (data.selectData.queryTemplate.orderInfoList && data.selectData.queryTemplate.orderInfoList.length > 0) { + this.orderInfoList = JSON.parse(JSON.stringify(data.selectData.queryTemplate.orderInfoList));//宸叉湁鎺掑簭 + } + this.queryCondition=this.selectData.queryTemplate.condition; + this.queryTree=this.selectData.tree; + this.form.levelFlag=this.selectData.levelFlag; + } else { + this.selectData = {}; + this.orderInfoList = []; + this.queryCondition=[]; + this.queryTree={ + connector:'骞朵笖', + child:[] + }; + } + this.dialog.showDialog = true; + this.getTemp(data.treeData.label, true) + }, + cancelDialog() { + this.dialog.loading = false; + this.dialog.showDialog = false; + this.$nextTick(() => { + this.form = { + btmName: '', + qtName: '', + levelFlag:0, + queryTemplate: {} + }; + this.orderInfoList =[]; + this.businessQueryDefineForm=''; + this.linkQueryDefineForm=''; + this.$refs.form.clearValidate(); + }); + }, + submitDialog() { + this.$refs.form.validate((valid) => { + if (valid) { + const formData=this.initFormData(); + console.log(formData) + linkSave(formData).then(res => { + if (res.data.success) { + this.$message.success("淇濆瓨鎴愬姛"); + this.cancelDialog(); + this.$emit("refresh"); + } + }); + } else { + return false; + } + }); + }, + initFormData() { + let formData = { + btmName: this.form.btmName, + 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) { + //楂樼骇 + let that = this; + function initValue(nodeChild) { + let children = []; + if (nodeChild) { + nodeChild.forEach((item, index) => { + if (item.label != '骞朵笖' && item.label != '鎴栬��') { + children.push(item.label); + } else { + children.push({ + connector: item.label, + child: initValue(item.children) + }) + } + }) + } + return children; + } + + let treeData = { + connector: this.$refs.formQuery.treeData[0].label + }; + if (this.$refs.formQuery.treeData[0].children) { + treeData.child = initValue(this.$refs.formQuery.treeData[0].children); + } + formData.tree = treeData + } + + formData.condition = this.$refs.formQuery.conditionList; + + return formData; + }, + getFormData(form) { + this.form = form; + }, + addRow() { + this.crudDialog.showDialog = true; + }, + // 琛屽垹闄� + rowDeleteHandler(data) { + this.orderInfoList.splice(data.index,1); + this.orderFieldList.unshift({ + id: data.row.orderField + }); + this.tableFormOption.column[0].dicData= this.orderFieldList + }, + //鑾峰彇鎺掑簭璁剧疆涓墍鏈夋帓搴忓瓧娈� + getAllAttr() { + getAllOrderbyAttributeByLink({ + name: this.treeData.label, + btmType: this.form.btmType, + direction: this.form.direction + }).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}); + } + }) + this.tableFormOption.column[0].dicData=dicData; + this.orderFieldList=dicData; + }) + }, + //鎺掑簭璁剧疆淇濆瓨 + rowSave() { + this.$refs.tableForm.validate((valid) => { + if(valid){ + this.orderInfoList.push(JSON.parse(JSON.stringify(this.tableForm))); + this.crudDialog.showDialog=false; + const orderInfoStr = JSON.stringify(this.orderInfoList); + const dicData = []; + this.orderFieldList.forEach(item => { + if (orderInfoStr.indexOf('"orderField":"' + item.id + '"') == -1) { + dicData.push(item); + } + }) + this.tableFormOption.column[0].dicData=dicData; + this.orderFieldList=dicData; + this.tableForm= { + orderField: '', + orderMode: 'ASC', + level: '' + } + } + }) + }, + //鑾峰彇鏌ヨ妯℃澘瀹氫箟涓嬫媺 + getTemp(btmName,linkFlag) { + if (btmName) { + queryTemplateListByAttr({btmName: btmName, linkFlag: linkFlag,direction:this.form.direction}).then(res => { + const data = res.data.data.map(item => { + item.label = item.name + '-' + (item.linkTypeName || 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 + }] + } + }, + // 寮�濮嬫嫋鎷芥爲鑺傜偣浜嬩欢 + handleDragStart(node, ev) { + // 浣跨敤 setData 鏂规硶璁剧疆鏁版嵁 + ev.dataTransfer.setData('item', JSON.stringify(node.data)); + }, + }, +} +</script> + +<style scoped> +fieldset { + border-radius: 5px; + -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1); + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1); + padding: 10px 6px; + box-sizing: border-box; + margin: 0; + border: 1px solid #EBEEF5; +} +</style> diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formQueryDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formQueryDialog.vue new file mode 100644 index 0000000..677e8bd --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/formQueryDialog.vue @@ -0,0 +1,677 @@ +<template> + <div style="padding: 0 10px"> + <div style="text-align: center;margin-bottom: 10px"> + <avue-radio v-model="radioForm" :dic="radioDic" style="margin: 0 20px 0 0;display: inline-block"></avue-radio> + <el-button plain size="mini" type="primary" @click="clearValue">娓呯┖鍊�</el-button> + <el-button plain size="mini" type="primary" @click="delAll">鍒犻櫎鍏ㄩ儴鏉′欢</el-button> + </div> + <div v-if="radioForm==0" @drop="drop" @dragover.prevent style="height: 220px;text-align: center;"> + <div v-for="(condition,index) in conditionList" :key="index" class="el-input--small" style="margin-bottom: 5px; text-align:left"> + <span style="width: 200px;display: inline-block;text-align: right" :title="condition.clause">{{condition.clause}}</span> + <avue-select v-model="condition.operator" type="tree" :dic="condition.operatorDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <el-date-picker v-if="condition.type=='VTDate'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;" value-format="YYYY-MM-DD" + type="date"> + </el-date-picker> + <el-date-picker v-else-if="condition.type=='VTDateTime'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;" + type="datetime"> + </el-date-picker> + <el-time-select v-else-if="condition.type=='VTTime'" v-model="condition.ordinaryValue" value-format="HH:mm:ss" style="width:300px;margin-right: 5px;display: inline-block;"> + </el-time-select> + <avue-input-number v-else-if="condition.type=='VTInteger'" precision="0" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;"></avue-input-number> + <avue-input-number v-else-if="condition.type=='VTLong' || condition.type=='VTDouble'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;"></avue-input-number> + <avue-input v-else v-model="condition.ordinaryValue" placeholder="" style="width: 300px;margin-right: 5px;"></avue-input> + <el-button plain size="mini" type="primary" @click="checkTemp(index)">閫夋嫨鏌ヨ妯℃澘</el-button> + <el-button size="mini" type="danger" icon="el-icon-delete" @click="delCondition(index)" style="padding: 7px 8px"></el-button> + </div> + </div> + <div v-else style="height: 220px;text-align: left"> + <avue-tree ref="tree" @node-drop="handleDrop" style="height: 220px" :data="treeData" :option="treeOption" @node-click="nodeClick" node-key="value"></avue-tree> + </div> + <div style="text-align: right;margin-top: 10px;"> + <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="addHandler">澧炲姞閫昏緫</el-button> + <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="editHandler">淇敼鏉′欢</el-button> + <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="delHandler">鍒犻櫎</el-button> + <el-button plain size="mini" type="primary" @click="queryHandler">鏌ヨ</el-button> + <el-button plain size="mini" type="primary" @click="">鍙栨秷</el-button> + </div> + + <el-dialog v-dialogDrag + :title="dialog.title" + :visible.sync="dialog.showDialog" + width="550px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="dialog.showDialog=false"> + <div style="height: 200px;"> + {{clickNode.showLabel}} + <avue-select v-if="['VTInteger','VTDouble','VTLong'].includes(clickNode.type)" v-model="clickNode.operator" type="tree" :dic="operatorIntDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <avue-select v-else-if="['VTDateTime','VTDate','VTTime'].includes(clickNode.type)" v-model="clickNode.operator" type="tree" :dic="operatorDateDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <avue-select v-else v-model="clickNode.operator" type="tree" :dic="operatorDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <el-date-picker v-if="clickNode.type=='VTDate'" v-model="clickNode.inputValue" style="width:300px;display: inline-block;" value-format="YYYY-MM-DD" + type="date"> + </el-date-picker> + <el-date-picker v-else-if="clickNode.type=='VTDateTime'" v-model="clickNode.inputValue" style="width:350px;display: inline-block;" + type="datetime"> + </el-date-picker> + <el-time-select v-else-if="clickNode.type=='VTTime'" v-model="clickNode.inputValue" value-format="HH:mm:ss" style="width:300px;display: inline-block;"> + </el-time-select> + <avue-input-number v-else-if="clickNode.type=='VTInteger'" precision="0" v-model="clickNode.inputValue" style="width:300px;display: inline-block;"></avue-input-number> + <avue-input-number v-else-if="clickNode.type=='VTLong' || clickNode.type=='VTDouble'" v-model="clickNode.inputValue" style="width:300px;display: inline-block;"></avue-input-number> + <avue-input v-else v-model="clickNode.inputValue" type="textarea" style="width: 300px;margin-right: 5px;vertical-align: top;"></avue-input> + </div> + <div class="dialog-footer avue-dialog__footer"> + <el-button size="small" @click="checkTemp" v-if="!['VTInteger','VTDouble','VTLong','VTDateTime','VTDate','VTTime'].includes(clickNode.type)">閫夋嫨鏌ヨ妯℃澘</el-button> + <el-button type="primary" plain size="small" @click="submitDialog" >淇� 瀛�</el-button> + <el-button size="small" @click="dialog.showDialog=false">鍙� 娑�</el-button> + </div> + </el-dialog> + <el-dialog v-dialogDrag + :title="queryDialog.title" + :visible.sync="queryDialog.showDialog" + width="800px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="cancleQueryDialog"> + <div class="el-input--small"> + 杈撳叆鏌ヨ瀛楁锛�<avue-input v-model="queryField" style="width: 500px;margin-bottom: 10px"></avue-input> + <avue-crud ref="crud" :data="crudData" :option="crudOption" + :page.sync="page" + :table-loading="tableLoading" + @selection-change="selectionChange" + @row-click="rowClick" + @size-change="sizeChange" + @current-change="currentChange"> + </avue-crud> + </div> + <div class="dialog-footer avue-dialog__footer"> + <el-button type="primary" plain size="small" @click="submitQueryDialog" >纭� 瀹�</el-button> + <el-button size="small" @click="cancleQueryDialog">鍙� 娑�</el-button> + </div> + </el-dialog> + <el-dialog v-dialogDrag + :title="queryResultDialog.title" + :visible.sync="queryResultDialog.showDialog" + width="900px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="queryResultDialog.showDialog='false'"> + <div class="el-input--small"> + <avue-crud ref="crud" :data="resultData" :option="resultOption" + :table-loading="queryResultDialog.loading"> + </avue-crud> + </div> + </el-dialog> + </div> +</template> + +<script> +import basicOption from "@/util/basic-option"; +import {getAllQTs} from "@/api/queryTemplate/queryDefine"; +import {getCriteria} from "@/api/queryTemplate/linkTypeQuery"; + +export default { +name: "formQueryDialog", + props: { + queryCondition: { + type: Array, + default: [] + }, + queryTree: { + type: Object, + default: {} + }, + levelFlag:{ + type: Number, + default: 0 + } + }, + data() { + return { + dialog: { + showDialog: false, + title: "鏌ヨ鏉′欢璁剧疆妗�", + loading: false + }, + queryDialog: { + showDialog: false, + title: "閫夋嫨鏌ヨ妯℃澘", + loading: false + }, + queryResultDialog: { + showDialog: false, + title: "鏌ヨ缁撴灉", + loading: false + }, + radioDic: [{ + label: '鏅��', + value: 0 + }, { + label: '楂樼骇', + value: 1 + }], + conditionList:[], + treeData:[], + treeOption:{ + defaultExpandAll:true, + menu: false, + addBtn: false, + filter:false, + draggable: true, + allowDrop: (draggingNode, dropNode, type) => { + debugger; + if (dropNode.data.label === '骞朵笖' || dropNode.data.label === '鎴栬��') { + return true; + } else { + this.$message.error('璇烽�変腑閫昏緫鏉′欢娣诲姞鏌ヨ椤�'); + return false; + } + }, + allowDrag: (draggingNode) => { + return false; + }, + }, + page: { + currentPage: 1, + pageSize: 10, + total: 0, + pageSizes: [10, 30, 50, 100], + }, + crudData:[], + crudOption: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + tip: false, + header: false, + height: window.innerHeight-220, + menu: false, + column: [{ + label: '鏌ヨ妯℃澘鍚嶇О', + prop: 'qtName', + sortable: true, + }, { + label: '閾炬帴绫诲瀷鎴栦笟鍔$被鍨�', + prop: 'btmName', + sortable: true, + }] + }, + tableLoading: false, + selectionRow:[], + queryField:'', + resultData:[], + resultOption: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + tip: false, + header: false, + height: window.innerHeight-220, + menu: false, + column: [{ + label: 'OID', + prop: 'OID', + }, { + label: 'CREATOR', + prop: 'CREATOR' + }, { + label: 'CREATETIME', + prop: 'CREATETIME' + }] + }, + clickNode:{}, + operatorIntDic:[{ + label: '=', + value: '=' + }, { + label: '!=', + value: '!=' + }, { + label: '鍖呭惈', + value: '鍖呭惈' + }, { + label: 'in', + value: 'in' + }, { + label: 'not in', + value: 'not in' + }, { + label: '>=', + value: '>=' + }, { + label: '>', + value: '>' + }, { + label: '<=', + value: '<=' + }, { + label: '<', + value: '<' + }], + operatorDateDic : [{ + label: '=', + value: '=' + }, { + label: '!=', + value: '!=' + }, { + label: 'in', + value: 'in' + }, { + label: 'not in', + value: 'not in' + }, { + label: '>=', + value: '>=' + }, { + label: '<=', + value: '<=' + }], + operatorDic : [{ + label: '=', + value: '=' + }, { + label: '!=', + value: '!=' + }, { + label: '鍖呭惈', + value: '鍖呭惈' + }, { + label: 'in', + value: 'in' + }, { + label: 'not in', + value: 'not in' + }] + } + }, + computed: { + radioForm:{ + get() { + return this.levelFlag; + }, + set(value) { + this.$emit('update:levelFlag', value); + } + } + }, + watch: { + queryCondition:{ + handler(val) { + if(val && val.cIMap){ + let list=[]; + let that=this; + let getValue =function(queryTemplate,item) { + for (let key in queryTemplate.condition.cIMap) { + if (queryTemplate.condition.cIMap[key].leaf) { + item.clause += '.' + queryTemplate.condition.cIMap[key].leafInfo.clause; + if (queryTemplate.condition.cIMap[key].leafInfo.value.queryTemplate) { + getValue(queryTemplate.condition.cIMap[key].leafInfo.value.queryTemplate, item) + } else { + item.ordinaryValue = queryTemplate.condition.cIMap[key].leafInfo.value.ordinaryValue; + item.type=queryTemplate.condition.cIMap[key].leafInfo.type; + if(['VTInteger','VTDouble','VTLong'].includes(item.type)){ + item.operatorDic=that.operatorIntDic; + }else if(['VTDateTime','VTDate','VTTime'].includes(item.type)){ + item.operatorDic=that.operatorDateDic; + }else{ + item.operatorDic=that.operatorDic; + } + } + } + } + } + for (let key in val.cIMap) { + if (this.queryCondition.cIMap[key].leaf) { + let clause=this.queryCondition.cIMap[key].leafInfo.clause; + let operator= this.queryCondition.cIMap[key].leafInfo.operator; + let item={ + clause: clause, + operator: operator, + ordinaryValue: '', + operatorDic :[] + } + if(this.queryCondition.cIMap[key].leafInfo.value.queryTemplate) { + getValue(this.queryCondition.cIMap[key].leafInfo.value.queryTemplate, item) + }else { + item.ordinaryValue=this.queryCondition.cIMap[key].leafInfo.value.ordinaryValue; + item.type=this.queryCondition.cIMap[key].leafInfo.type; + if(['VTInteger','VTDouble','VTLong'].includes(item.type)){ + item.operatorDic=that.operatorIntDic; + }else if(['VTDateTime','VTDate','VTTime'].includes(item.type)){ + item.operatorDic=that.operatorDateDic; + }else{ + item.operatorDic=that.operatorDic; + } + } + list.push(item) + } + } + this.conditionList= list; + }else{ + this.conditionList=[] + } + }, + immediate: true, + deep:true + }, + queryTree:{ + handler(val) { + this.treeIndex=0; + if(val && Object.keys(val).length>0){ + let treeData = []; + let that=this; + function initValue(nodeChild) { + let children=[]; + if(nodeChild){ + nodeChild.forEach((item,index)=>{ + that.treeIndex++; + if(item.column !=null && item.column != undefined){ + children.push({ + label:item.column, + value:item.column+that.treeIndex, + type:item.type, + valueIndex:'v'+that.treeIndex + }) + }else { + children.push({ + label:item.connector, + value:item.connector+that.treeIndex, + valueIndex:'v'+that.treeIndex, + children:initValue(item.child) + }) + } + }) + } + return children; + } + const node={ + label:val.connector, + value:val.connector+this.treeIndex, + valueIndex:'v'+this.treeIndex, + children:initValue(val.child) + } + treeData.push(node) + this.treeData = treeData; + }else { + this.treeData=[{ + label: '骞朵笖', + value: '骞朵笖' + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + connector: '骞朵笖', + children: [] + }] + } + }, + immediate: true, + deep:true + } + }, + created() { + this.getTemp(); + }, + methods: { + // 鎷栨嫿鍒版椂 + drop(event) { + // 浣跨敤 getData 鏂规硶鑾峰彇鏁版嵁 + const data = JSON.parse(event.dataTransfer.getData('item')); + if (this.radioForm == 0) { + const params = { + clause: data.value, + operator: '=', + ordinaryValue: '' + } + if (data.atttributes.vtDataType == 'VTInteger' || data.atttributes.vtDataType == 'VTDouble' || data.atttributes.vtDataType == 'VTLong') { + params.operatorDic =JSON.parse(JSON.stringify(this.operatorIntDic)) ; + } else if (data.atttributes.vtDataType == 'VTDateTime' || data.atttributes.vtDataType == 'VTDate' || data.atttributes.vtDataType == 'VTTime') { + params.operatorDic = JSON.parse(JSON.stringify(this.operatorDateDic)) + } else { + params.operatorDic = JSON.parse(JSON.stringify(this.operatorDic)) + } + params.type=data.atttributes.vtDataType; + this.conditionList.push(params) + }else {debugger; + if (this.clickNode.label != '骞朵笖' && this.clickNode.label != '鎴栬��') { + this.$message.error('璇烽�変腑閫昏緫鏉′欢娣诲姞鏌ヨ椤�'); + return; + } + this.treeIndex++; + this.$refs.tree.append({ + label: data.value, + value: data.value + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + children: [] + }, this.clickNode); + } + }, + handleDrop(draggingNode, dropNode, dropType, ev) { + debugger; + console.log('tree drop: ', dropNode.label, dropType); + }, + //鍒犻櫎鏅�氭煡璇㈡潯浠� + delCondition(index) { + this.conditionList.splice(index, 1); + }, + //娓呯┖鍊� + clearValue() { + if (this.radioForm == 0) { + this.conditionList.map(item => { + item.ordinaryValue = ''; + return item; + }) + this.conditionList = this.conditionList + } else { + if(this.treeData[0] && this.treeData[0].children) { + this.clearTreeValue(this.treeData[0].children) + } + } + }, + clearTreeValue(nodes){ + nodes.forEach((node,index)=>{ + if(node.children){ + this.clearTreeValue(node.children) + }else { + let values=node.label.split(' '); + if(values.length>2){ + node.label=values[0]+' '+values[1]; + } + } + }) + }, + //鍒犻櫎鍏ㄩ儴鏉′欢 + delAll() { + if (this.radioForm == 0) { + this.conditionList = []; + } else { + this.treeIndex = 0; + this.treeData = []; + this.clickNode={}; + } + }, + nodeClick(data) { + this.clickNode = data + }, + //鏍� 澧炲姞閫昏緫鏉′欢 + addHandler() { + if (Object.keys(this.clickNode).length>0) { + if (this.clickNode.label == '骞朵笖' || this.clickNode.label == '鎴栬��') { + this.treeIndex++; + this.$refs.tree.append({ + label: '骞朵笖', + value: '骞朵笖' + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + children: [] + }, this.$refs.tree.getCurrentNode()); + } else { + this.$message.error("鍙兘瀵归�昏緫鏉′欢澧炲姞閫昏緫鏉′欢"); + } + } else { + if(this.treeData.length==0){ + this.treeIndex = 0; + this.treeData = [{ + label: '骞朵笖', + value: '骞朵笖' + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + connector: '骞朵笖', + children: [] + }] + }else { + this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); + } + } + }, + //鏍� 淇敼鏉′欢 + editHandler() { + if (Object.keys(this.clickNode).length>0) { + if (this.clickNode.label == '骞朵笖') { + this.clickNode.label = '鎴栬��' + } else if (this.clickNode.label == '鎴栬��') { + this.clickNode.label = '骞朵笖' + } else { + const values= this.clickNode.label.split(' '); + this.clickNode.inputValue=''; + if(values.length>1){ + this.clickNode.operator=values[1]; + if(values.length>2){ + if(['VTDateTime','VTDate','VTTime'].includes(this.clickNode.type)){ + this.clickNode.inputValue=new Date(values[2]); + }else { + this.clickNode.inputValue=values[2]; + } + } + } + if(values[0].indexOf('.')!=-1){ + const labels=values[0].split('.') + this.clickNode.showLabel=labels[labels.length-1]; + }else { + this.clickNode.showLabel=values[0]; + } + this.dialog.showDialog = true; + } + } else { + this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); + } + }, + //鏍� 鍒犻櫎鏉′欢 + delHandler() { + if (Object.keys(this.clickNode).length>0) { + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬潯浠跺悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$refs.tree.remove(this.clickNode); + this.clickNode = {}; + }) + } else { + this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); + } + }, + //鏌ヨ + queryHandler(){ + this.$parent.$parent.$parent.$parent.$refs.form.validate((valid) => { + if (valid) { + this.queryResultDialog.loading=true; + const formData=this.$parent.$parent.$parent.$parent.initFormData(); + getCriteria(formData).then(res => { + if (res.data.success) { + this.resultData=res.data.data; + this.queryResultDialog.showDialog=true; + this.queryResultDialog.loading=false; + } + }); + } else { + return false; + } + }); + }, + //閫夋嫨鏌ヨ妯℃澘 + checkTemp(index) { + if(index>=0){ + if(['VTInteger','VTDouble','VTLong','VTDateTime','VTDate','VTTime'].includes(this.conditionList[index].type)){ + return false; + } + } + this.queryIndex=index; + this.queryDialog.showDialog=true; + this.$nextTick(()=>{ + this.$refs.crud.doLayout(); + }); + }, + //鏌ヨ鏉′欢淇濆瓨 + submitDialog() { + const values= this.clickNode.label.split(' '); + this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+this.clickNode.inputValue; + this.dialog.showDialog = false; + }, + //鑾峰彇鏌ヨ妯℃澘鍒楄〃 + getTemp() { + getAllQTs(this.page.currentPage, this.page.pageSize).then(res => { + this.crudData = res.data.data; + this.tableLoading = false; + }) + }, + rowClick(row) { + this.$refs.crud.toggleSelection(); + this.$refs.crud.toggleRowSelection(row); //閫変腑褰撳墠琛� + this.selectionRow = [row]; + }, + selectionChange(list) { + this.selectionRow = list; + }, + selectionClear() { + this.selectionRow = []; + this.$refs.crud.toggleSelection(); + }, + //閫夋嫨鏌ヨ妯℃澘 + submitQueryDialog() { + if (this.selectionRow.length == 0) { + this.$message.error('璇烽�夋嫨鏌ヨ妯℃澘鍐嶈繘琛屾搷浣�'); + return; + } + if (this.queryField == '') { + this.$message.error('璇峰~鍐欒緭鍏ユ煡璇㈠瓧娈�'); + return; + } + const value = this.selectionRow[0].qtName + ';' + this.queryField + if (this.radioForm == 0) { + //鏅�� + this.conditionList[this.queryIndex].ordinaryValue = value; + } else { + this.clickNode.inputValue = value; + } + this.cancleQueryDialog(); + }, + cancleQueryDialog(){ + this.queryDialog.showDialog = false; + this.selectionClear(); + this.queryField=''; + this.queryIndex=null; + }, + sizeChange(val) { + this.page.pageSize = val; + this.getTemp(); + }, + + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + this.getTemp(); + }, + } +} +</script> + +<style scoped> +::v-deep .el-input--small .el-input__inner{ + height: 28px; + line-height: 28px; +} +</style> diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue index ddeabbc..a17252d 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue @@ -21,16 +21,19 @@ <el-main> <basic-container> + <div v-if="this.nodeRow && this.nodeRow.label"> + <el-button icon="el-icon-plus" size="small" type="primary" @click="addHandler">鍒涘缓</el-button> + <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editHandler">淇敼</el-button> + <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">鍒犻櫎</el-button> + <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button> + <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">瀵煎叆</el-button> + </div> <avue-crud ref="crud" + @selection-change="selectionChange" + @row-click="rowClick" :data="crudData" :option="crudOption" :table-loading="tableLoading" style="margin-top: 10px"> - <template slot="menuLeft" slot-scope="scope"> - <el-button icon="el-icon-plus" size="small" type="primary" @click="addHandler">鍒涘缓</el-button> - <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editHandler">淇敼</el-button> - <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">鍒犻櫎</el-button> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭</el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="upLoadClickHandler">瀵煎叆</el-button> - </template> </avue-crud> + <form-dialog ref="formRef" @refresh="getTemp"></form-dialog> </basic-container> </el-main> @@ -43,8 +46,11 @@ import basicOption from "@/util/basic-option"; import func from "@/util/func"; import {dateFormat} from "@/util/date"; +import FormDialog from "./formDialog.vue" +import {deleteLinkTemplate} from "@/api/queryTemplate/linkTypeQuery"; export default { name: "index", + components: {FormDialog}, data() { return { treeOption: { @@ -134,66 +140,41 @@ this.tableLoading = false; }) }, - selectHandler(selection, row) { - + rowClick(row) { + this.$refs.crud.toggleSelection(); + this.$refs.crud.toggleRowSelection(row); //閫変腑褰撳墠琛� + this.selectionRow = [row]; }, - changeTemp(data) { - this.$refs.queryCrud.clearSelection(); - if (data.value != '') { - let abNames = data.item.abNames.join(',').toLowerCase().split(',') - - } + selectionChange(list) { + this.selectionRow = list; + }, + selectionClear() { + this.selectionRow = []; + this.$refs.crud.toggleSelection(); }, //鍒涘缓 addHandler() { - if (func.isEmptyObject(this.nodeRow)) { - this.$message.error('璇烽�夋嫨瑕佹坊鍔犵殑鑺傜偣'); - return; - } - this.title = 'add'; - this.visible = true; - this.$nextTick(() => { + this.$refs.formRef.openDialog(this.nodeRow.label,'鍒涘缓','add',{treeData:this.nodeRow}); + this.$nextTick(()=>{ + this.$refs.formRef.formItems[0].disabled = false; + this.$refs.formRef.$refs.form.getInit(this.$refs.formRef.formItems) }); }, //淇敼 editHandler() { - if (func.isEmptyObject(this.nodeRow)) { - this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + if (this.selectionRow.length!=1) { + this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹�'); return; } - this.form.name = this.templateForm; - this.title = 'edit'; - this.visible = true; - this.$nextTick(() => { + this.$refs.formRef.openDialog(this.nodeRow.label,'淇敼','edit',{treeData:this.nodeRow,selectData:this.selectionRow[0]}); + this.$nextTick(()=>{ + this.$refs.formRef.formItems[0].disabled = true; + this.$refs.formRef.$refs.form.getInit(this.$refs.formRef.formItems) }); - }, - // 鏂板缂栬緫淇濆瓨 - addDialogSavaHandler() { - this.$refs.form.validate((valid) => { - const saveFunction = this.title === 'add' ? saveTemplate : updateTemplate; - if (valid) { - saveFunction(this.form).then(res => { - if (res.data.code === 200) { - this.$message.success(res.data.obj); - this.addDialogClose(); - } - }) - } else { - return false; - } - }); - }, - // 鏂板缂栬緫瀵硅瘽妗嗗彇娑� - addDialogClose() { - this.form = { - name: '' - }; - this.$refs.form.clearValidate(); - this.visible = false; }, //鍒犻櫎 delHandler() { - if (func.isEmptyObject(this.nodeRow)) { + if (this.selectionRow.length==0) { this.$message.error('璇烽�夋嫨鏁版嵁'); return; } @@ -202,13 +183,13 @@ cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - deleteTemplate({ - name: this.templateForm, - btmName: this.nodeRow.label, - linkFlag: false - }).then(res => { + let names=this.selectionRow.map(item=>{ + return item.qtName + }) + deleteLinkTemplate({names:names.join(',')}).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); + this.getTemp(); } }) }).catch(() => { 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 2b7229c..35ac7b2 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 @@ -2,7 +2,7 @@ <el-dialog v-dialogDrag :title="dialog.title" :visible.sync="dialog.showDialog" - width="1600px" + width="1620px" :append-to-body="true" class="avue-dialog" :destroy-on-close="true" @@ -55,7 +55,12 @@ <el-main> <fieldset style="margin: 0 10px"> <legend> 鏌ヨ鏉′欢 </legend> - <form-query-dialog style="height: 300px;" :queryCondition="queryCondition" :queryTree="queryTree"></form-query-dialog> + <form-query-dialog ref="formQuery" + style="height: 300px;" + :queryCondition="queryCondition" + :queryTree="queryTree" + :levelFlag.sync="form.levelFlag" + ></form-query-dialog> </fieldset> </el-main> <el-aside style="width:350px"> @@ -82,7 +87,7 @@ import {getAllOrderbyAttributeByLink} from "@/api/modeling/linkType/api"; import {linkSave} from "@/api/queryTemplate/linkTypeQuery"; import basicOption from "@/util/basic-option"; -import {gridTemplate} from "@/api/queryTemplate/queryDefine"; +import {queryTemplateListByAttr} from "@/api/queryTemplate/queryDefine"; import formQueryDialog from "./formQueryDialog.vue"; export default { name: "formDialog", @@ -174,6 +179,7 @@ form:{ btmName:'', qtName: '', + levelFlag:0,//0:鏅�氭煡璇㈡ā鏉�; 1:楂樼骇鏌ヨ妯℃澘" queryTemplate:{} }, //宸叉湁鎺掑簭鍒楄〃閰嶇疆 @@ -273,7 +279,8 @@ //楂樼骇鏌ヨ鏉′欢 queryTree:{}, //鏅�氭煡璇㈡潯浠� - queryCondition:[] + queryCondition:[], + }; }, watch: { @@ -322,14 +329,7 @@ } }, immediate: true, - }, - 'dialog.type': { - handler(val) { - if(val=='edit'){ - } - }, - immediate: true, - }, + } }, methods: { openDialog(btmName, title, mode, data) { @@ -350,12 +350,16 @@ this.orderInfoList = JSON.parse(JSON.stringify(data.selectData.queryTemplate.orderInfoList));//宸叉湁鎺掑簭 } this.queryCondition=this.selectData.queryTemplate.condition; - this.queryTree=this.selectData.queryTemplate.tree; + this.queryTree=this.selectData.tree; + this.form.levelFlag=this.selectData.levelFlag; } else { this.selectData = {}; this.orderInfoList = []; this.queryCondition=[]; - this.queryTree={}; + this.queryTree={ + connector:'骞朵笖', + child:[] + }; } this.dialog.showDialog = true; this.getTemp(data.treeData.label, true) @@ -367,6 +371,7 @@ this.form = { btmName: '', qtName: '', + levelFlag:0, queryTemplate: {} }; this.orderInfoList =[]; @@ -378,26 +383,8 @@ submitDialog() { this.$refs.form.validate((valid) => { if (valid) { - let formData={ - btmName:this.form.btmName, - qtName:this.form.qtName, - queryTemplate:{ - btmType:this.form.btmType, - clauseList:['*'], - direction:this.form.direction, - id:this.form.qtName, - level:this.form.level, - linkType:this.form.btmName, - orderInfoList:this.orderInfoList, - queryISLeaf:this.form.queryISLeaf, - recReturnMode:1,//閫掑綊杩斿洖鏁版嵁妯″紡:1锛歊ECRETURNMODE_FLAT, 2锛歊ECRETURNMODE_FILTER - rightFlag:true, - secretFlag:true, - type:'link', - version:this.form.version - } - } - formData.condition=[] + const formData=this.initFormData(); + console.log(formData) linkSave(formData).then(res => { if (res.data.success) { this.$message.success("淇濆瓨鎴愬姛"); @@ -409,6 +396,60 @@ return false; } }); + }, + initFormData() { + let formData = { + btmName: this.form.btmName, + qtName: this.form.qtName, + levelFlag: this.form.levelFlag, + queryTemplate: { + btmType: this.form.btmType, + clauseList: ['*'], + direction: this.form.direction, + id: this.form.qtName, + level: this.form.level, + linkType: this.form.btmName, + orderInfoList: this.orderInfoList, + queryISLeaf: this.form.queryISLeaf, + recReturnMode: 1,//閫掑綊杩斿洖鏁版嵁妯″紡:1锛歊ECRETURNMODE_FLAT, 2锛歊ECRETURNMODE_FILTER + rightFlag: true, + secretFlag: true, + type: 'link', + version: this.form.version + } + } + if (formData.levelFlag == 1) { + //楂樼骇 + let that = this; + function initValue(nodeChild) { + let children = []; + if (nodeChild) { + nodeChild.forEach((item, index) => { + if (item.label != '骞朵笖' && item.label != '鎴栬��') { + children.push(item.label); + } else { + children.push({ + connector: item.label, + child: initValue(item.children) + }) + } + }) + } + return children; + } + + let treeData = { + connector: this.$refs.formQuery.treeData[0].label + }; + if (this.$refs.formQuery.treeData[0].children) { + treeData.child = initValue(this.$refs.formQuery.treeData[0].children); + } + formData.tree = treeData + } + + formData.condition = this.$refs.formQuery.conditionList; + + return formData; }, getFormData(form) { this.form = form; @@ -468,7 +509,7 @@ //鑾峰彇鏌ヨ妯℃澘瀹氫箟涓嬫媺 getTemp(btmName,linkFlag) { if (btmName) { - gridTemplate({btmName: btmName, linkFlag: linkFlag}).then(res => { + queryTemplateListByAttr({btmName: btmName, linkFlag: linkFlag,direction:this.form.direction}).then(res => { const data = res.data.data.map(item => { item.label = item.name + '-' + (item.linkTypeName || item.btmName); item.value = item.name; @@ -486,10 +527,11 @@ }, linkQueryDefineChange(data) { if (data.value) { - const childData = data.item.abNames.map(item => { + const childData = data.item.attrs.map(item => { return { - label: item, - value: item + label: item.name, + value: item.name, + atttributes:item }; }); this.linkTreeData = [{ @@ -501,10 +543,11 @@ }, businessQueryDefineChange(data) { if (data.value) { - const childData = data.item.abNames.map(item => { + const childData = data.item.attrs.map(item => { return { - label: item, - value: item + label: item.name, + value: item.name, + atttributes:item }; }); this.businessTreeData = [{ diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue index 20164a4..677e8bd 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue @@ -6,27 +6,115 @@ <el-button plain size="mini" type="primary" @click="delAll">鍒犻櫎鍏ㄩ儴鏉′欢</el-button> </div> <div v-if="radioForm==0" @drop="drop" @dragover.prevent style="height: 220px;text-align: center;"> - <div v-for="condition in conditionList" class="el-input--small" style="margin-bottom: 5px;"> - <span style="width: 150px;display: inline-block;text-align: right" :title="condition.clause">{{condition.clause}}</span> - <avue-select v-model="condition.operator" type="tree" :dic="operatorDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> - <avue-input v-model="condition.ordinaryValue" placeholder="" style="width: 300px;margin-right: 5px;"></avue-input> - <el-button plain size="mini" type="primary" @click="delAll">閫夋嫨鏌ヨ妯℃澘</el-button> + <div v-for="(condition,index) in conditionList" :key="index" class="el-input--small" style="margin-bottom: 5px; text-align:left"> + <span style="width: 200px;display: inline-block;text-align: right" :title="condition.clause">{{condition.clause}}</span> + <avue-select v-model="condition.operator" type="tree" :dic="condition.operatorDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <el-date-picker v-if="condition.type=='VTDate'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;" value-format="YYYY-MM-DD" + type="date"> + </el-date-picker> + <el-date-picker v-else-if="condition.type=='VTDateTime'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;" + type="datetime"> + </el-date-picker> + <el-time-select v-else-if="condition.type=='VTTime'" v-model="condition.ordinaryValue" value-format="HH:mm:ss" style="width:300px;margin-right: 5px;display: inline-block;"> + </el-time-select> + <avue-input-number v-else-if="condition.type=='VTInteger'" precision="0" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;"></avue-input-number> + <avue-input-number v-else-if="condition.type=='VTLong' || condition.type=='VTDouble'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;"></avue-input-number> + <avue-input v-else v-model="condition.ordinaryValue" placeholder="" style="width: 300px;margin-right: 5px;"></avue-input> + <el-button plain size="mini" type="primary" @click="checkTemp(index)">閫夋嫨鏌ヨ妯℃澘</el-button> + <el-button size="mini" type="danger" icon="el-icon-delete" @click="delCondition(index)" style="padding: 7px 8px"></el-button> </div> </div> <div v-else style="height: 220px;text-align: left"> - <avue-tree style="height: 220px" :data="treeData" :option="treeOption"></avue-tree> + <avue-tree ref="tree" @node-drop="handleDrop" style="height: 220px" :data="treeData" :option="treeOption" @node-click="nodeClick" node-key="value"></avue-tree> </div> <div style="text-align: right;margin-top: 10px;"> <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="addHandler">澧炲姞閫昏緫</el-button> - <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="del">淇敼鏉′欢</el-button> - <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="del">鍒犻櫎</el-button> - <el-button plain size="mini" type="primary" @click="del">鏌ヨ</el-button> - <el-button plain size="mini" type="primary" @click="del">鍙栨秷</el-button> + <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="editHandler">淇敼鏉′欢</el-button> + <el-button v-if="radioForm==1" plain size="mini" type="primary" @click="delHandler">鍒犻櫎</el-button> + <el-button plain size="mini" type="primary" @click="queryHandler">鏌ヨ</el-button> + <el-button plain size="mini" type="primary" @click="">鍙栨秷</el-button> </div> + + <el-dialog v-dialogDrag + :title="dialog.title" + :visible.sync="dialog.showDialog" + width="550px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="dialog.showDialog=false"> + <div style="height: 200px;"> + {{clickNode.showLabel}} + <avue-select v-if="['VTInteger','VTDouble','VTLong'].includes(clickNode.type)" v-model="clickNode.operator" type="tree" :dic="operatorIntDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <avue-select v-else-if="['VTDateTime','VTDate','VTTime'].includes(clickNode.type)" v-model="clickNode.operator" type="tree" :dic="operatorDateDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <avue-select v-else v-model="clickNode.operator" type="tree" :dic="operatorDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> + <el-date-picker v-if="clickNode.type=='VTDate'" v-model="clickNode.inputValue" style="width:300px;display: inline-block;" value-format="YYYY-MM-DD" + type="date"> + </el-date-picker> + <el-date-picker v-else-if="clickNode.type=='VTDateTime'" v-model="clickNode.inputValue" style="width:350px;display: inline-block;" + type="datetime"> + </el-date-picker> + <el-time-select v-else-if="clickNode.type=='VTTime'" v-model="clickNode.inputValue" value-format="HH:mm:ss" style="width:300px;display: inline-block;"> + </el-time-select> + <avue-input-number v-else-if="clickNode.type=='VTInteger'" precision="0" v-model="clickNode.inputValue" style="width:300px;display: inline-block;"></avue-input-number> + <avue-input-number v-else-if="clickNode.type=='VTLong' || clickNode.type=='VTDouble'" v-model="clickNode.inputValue" style="width:300px;display: inline-block;"></avue-input-number> + <avue-input v-else v-model="clickNode.inputValue" type="textarea" style="width: 300px;margin-right: 5px;vertical-align: top;"></avue-input> + </div> + <div class="dialog-footer avue-dialog__footer"> + <el-button size="small" @click="checkTemp" v-if="!['VTInteger','VTDouble','VTLong','VTDateTime','VTDate','VTTime'].includes(clickNode.type)">閫夋嫨鏌ヨ妯℃澘</el-button> + <el-button type="primary" plain size="small" @click="submitDialog" >淇� 瀛�</el-button> + <el-button size="small" @click="dialog.showDialog=false">鍙� 娑�</el-button> + </div> + </el-dialog> + <el-dialog v-dialogDrag + :title="queryDialog.title" + :visible.sync="queryDialog.showDialog" + width="800px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="cancleQueryDialog"> + <div class="el-input--small"> + 杈撳叆鏌ヨ瀛楁锛�<avue-input v-model="queryField" style="width: 500px;margin-bottom: 10px"></avue-input> + <avue-crud ref="crud" :data="crudData" :option="crudOption" + :page.sync="page" + :table-loading="tableLoading" + @selection-change="selectionChange" + @row-click="rowClick" + @size-change="sizeChange" + @current-change="currentChange"> + </avue-crud> + </div> + <div class="dialog-footer avue-dialog__footer"> + <el-button type="primary" plain size="small" @click="submitQueryDialog" >纭� 瀹�</el-button> + <el-button size="small" @click="cancleQueryDialog">鍙� 娑�</el-button> + </div> + </el-dialog> + <el-dialog v-dialogDrag + :title="queryResultDialog.title" + :visible.sync="queryResultDialog.showDialog" + width="900px" + :append-to-body="true" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="queryResultDialog.showDialog='false'"> + <div class="el-input--small"> + <avue-crud ref="crud" :data="resultData" :option="resultOption" + :table-loading="queryResultDialog.loading"> + </avue-crud> + </div> + </el-dialog> </div> </template> <script> +import basicOption from "@/util/basic-option"; +import {getAllQTs} from "@/api/queryTemplate/queryDefine"; +import {getCriteria} from "@/api/queryTemplate/linkTypeQuery"; + export default { name: "formQueryDialog", props: { @@ -38,10 +126,28 @@ type: Object, default: {} }, + levelFlag:{ + type: Number, + default: 0 + } }, data() { return { - radioForm: 0, + dialog: { + showDialog: false, + title: "鏌ヨ鏉′欢璁剧疆妗�", + loading: false + }, + queryDialog: { + showDialog: false, + title: "閫夋嫨鏌ヨ妯℃澘", + loading: false + }, + queryResultDialog: { + showDialog: false, + title: "鏌ヨ缁撴灉", + loading: false + }, radioDic: [{ label: '鏅��', value: 0 @@ -49,94 +155,516 @@ label: '楂樼骇', value: 1 }], - conditionList:this.queryCondition, + conditionList:[], + treeData:[], treeOption:{ defaultExpandAll:true, menu: false, addBtn: false, filter:false, + draggable: true, + allowDrop: (draggingNode, dropNode, type) => { + debugger; + if (dropNode.data.label === '骞朵笖' || dropNode.data.label === '鎴栬��') { + return true; + } else { + this.$message.error('璇烽�変腑閫昏緫鏉′欢娣诲姞鏌ヨ椤�'); + return false; + } + }, + allowDrag: (draggingNode) => { + return false; + }, }, - treeData:this.queryTree, - //VTInteger銆乂TDouble銆乂TLong + page: { + currentPage: 1, + pageSize: 10, + total: 0, + pageSizes: [10, 30, 50, 100], + }, + crudData:[], + crudOption: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + tip: false, + header: false, + height: window.innerHeight-220, + menu: false, + column: [{ + label: '鏌ヨ妯℃澘鍚嶇О', + prop: 'qtName', + sortable: true, + }, { + label: '閾炬帴绫诲瀷鎴栦笟鍔$被鍨�', + prop: 'btmName', + sortable: true, + }] + }, + tableLoading: false, + selectionRow:[], + queryField:'', + resultData:[], + resultOption: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + tip: false, + header: false, + height: window.innerHeight-220, + menu: false, + column: [{ + label: 'OID', + prop: 'OID', + }, { + label: 'CREATOR', + prop: 'CREATOR' + }, { + label: 'CREATETIME', + prop: 'CREATETIME' + }] + }, + clickNode:{}, operatorIntDic:[{ - label:'=', - value:'=' - },{ - label:'!=', - value:'!=' - },{ - label:'鍖呭惈', - value:'鍖呭惈' - },{ - label:'in', - value:'in' - },{ - label:'not in', - value:'not in' - },{ - label:'>=', - value:'>=' - },{ - label:'>', - value:'>' - },{ - label:'<=', - value:'<=' - },{ - label:'<', - value:'<' + label: '=', + value: '=' + }, { + label: '!=', + value: '!=' + }, { + label: '鍖呭惈', + value: '鍖呭惈' + }, { + label: 'in', + value: 'in' + }, { + label: 'not in', + value: 'not in' + }, { + label: '>=', + value: '>=' + }, { + label: '>', + value: '>' + }, { + label: '<=', + value: '<=' + }, { + label: '<', + value: '<' }], - //VTDateTime銆乂TDate銆乂TTime - operatorTimeDic:[{ - label:'=', - value:'=' - },{ - label:'!=', - value:'!=' - },{ - label:'in', - value:'in' - },{ - label:'not in', - value:'not in' - },{ - label:'>=', - value:'>=' - },{ - label:'<=', - value:'<=' + operatorDateDic : [{ + label: '=', + value: '=' + }, { + label: '!=', + value: '!=' + }, { + label: 'in', + value: 'in' + }, { + label: 'not in', + value: 'not in' + }, { + label: '>=', + value: '>=' + }, { + label: '<=', + value: '<=' }], - //鍏跺畠 - operatorDic:[{ - label:'=', - value:'=' - },{ - label:'!=', - value:'!=' - },{ - label:'鍖呭惈', - value:'鍖呭惈' - },{ - label:'in', - value:'in' - },{ - label:'not in', - value:'not in' + operatorDic : [{ + label: '=', + value: '=' + }, { + label: '!=', + value: '!=' + }, { + label: '鍖呭惈', + value: '鍖呭惈' + }, { + label: 'in', + value: 'in' + }, { + label: 'not in', + value: 'not in' }] } }, - methods:{ + computed: { + radioForm:{ + get() { + return this.levelFlag; + }, + set(value) { + this.$emit('update:levelFlag', value); + } + } + }, + watch: { + queryCondition:{ + handler(val) { + if(val && val.cIMap){ + let list=[]; + let that=this; + let getValue =function(queryTemplate,item) { + for (let key in queryTemplate.condition.cIMap) { + if (queryTemplate.condition.cIMap[key].leaf) { + item.clause += '.' + queryTemplate.condition.cIMap[key].leafInfo.clause; + if (queryTemplate.condition.cIMap[key].leafInfo.value.queryTemplate) { + getValue(queryTemplate.condition.cIMap[key].leafInfo.value.queryTemplate, item) + } else { + item.ordinaryValue = queryTemplate.condition.cIMap[key].leafInfo.value.ordinaryValue; + item.type=queryTemplate.condition.cIMap[key].leafInfo.type; + if(['VTInteger','VTDouble','VTLong'].includes(item.type)){ + item.operatorDic=that.operatorIntDic; + }else if(['VTDateTime','VTDate','VTTime'].includes(item.type)){ + item.operatorDic=that.operatorDateDic; + }else{ + item.operatorDic=that.operatorDic; + } + } + } + } + } + for (let key in val.cIMap) { + if (this.queryCondition.cIMap[key].leaf) { + let clause=this.queryCondition.cIMap[key].leafInfo.clause; + let operator= this.queryCondition.cIMap[key].leafInfo.operator; + let item={ + clause: clause, + operator: operator, + ordinaryValue: '', + operatorDic :[] + } + if(this.queryCondition.cIMap[key].leafInfo.value.queryTemplate) { + getValue(this.queryCondition.cIMap[key].leafInfo.value.queryTemplate, item) + }else { + item.ordinaryValue=this.queryCondition.cIMap[key].leafInfo.value.ordinaryValue; + item.type=this.queryCondition.cIMap[key].leafInfo.type; + if(['VTInteger','VTDouble','VTLong'].includes(item.type)){ + item.operatorDic=that.operatorIntDic; + }else if(['VTDateTime','VTDate','VTTime'].includes(item.type)){ + item.operatorDic=that.operatorDateDic; + }else{ + item.operatorDic=that.operatorDic; + } + } + list.push(item) + } + } + this.conditionList= list; + }else{ + this.conditionList=[] + } + }, + immediate: true, + deep:true + }, + queryTree:{ + handler(val) { + this.treeIndex=0; + if(val && Object.keys(val).length>0){ + let treeData = []; + let that=this; + function initValue(nodeChild) { + let children=[]; + if(nodeChild){ + nodeChild.forEach((item,index)=>{ + that.treeIndex++; + if(item.column !=null && item.column != undefined){ + children.push({ + label:item.column, + value:item.column+that.treeIndex, + type:item.type, + valueIndex:'v'+that.treeIndex + }) + }else { + children.push({ + label:item.connector, + value:item.connector+that.treeIndex, + valueIndex:'v'+that.treeIndex, + children:initValue(item.child) + }) + } + }) + } + return children; + } + const node={ + label:val.connector, + value:val.connector+this.treeIndex, + valueIndex:'v'+this.treeIndex, + children:initValue(val.child) + } + treeData.push(node) + this.treeData = treeData; + }else { + this.treeData=[{ + label: '骞朵笖', + value: '骞朵笖' + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + connector: '骞朵笖', + children: [] + }] + } + }, + immediate: true, + deep:true + } + }, + created() { + this.getTemp(); + }, + methods: { // 鎷栨嫿鍒版椂 drop(event) { // 浣跨敤 getData 鏂规硶鑾峰彇鏁版嵁 const data = JSON.parse(event.dataTransfer.getData('item')); - const params = { - clause: data.value, - operator: '=', - ordinaryValue: '' + if (this.radioForm == 0) { + const params = { + clause: data.value, + operator: '=', + ordinaryValue: '' + } + if (data.atttributes.vtDataType == 'VTInteger' || data.atttributes.vtDataType == 'VTDouble' || data.atttributes.vtDataType == 'VTLong') { + params.operatorDic =JSON.parse(JSON.stringify(this.operatorIntDic)) ; + } else if (data.atttributes.vtDataType == 'VTDateTime' || data.atttributes.vtDataType == 'VTDate' || data.atttributes.vtDataType == 'VTTime') { + params.operatorDic = JSON.parse(JSON.stringify(this.operatorDateDic)) + } else { + params.operatorDic = JSON.parse(JSON.stringify(this.operatorDic)) + } + params.type=data.atttributes.vtDataType; + this.conditionList.push(params) + }else {debugger; + if (this.clickNode.label != '骞朵笖' && this.clickNode.label != '鎴栬��') { + this.$message.error('璇烽�変腑閫昏緫鏉′欢娣诲姞鏌ヨ椤�'); + return; + } + this.treeIndex++; + this.$refs.tree.append({ + label: data.value, + value: data.value + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + children: [] + }, this.clickNode); } - this.conditionList.push(params) - } + }, + handleDrop(draggingNode, dropNode, dropType, ev) { + debugger; + console.log('tree drop: ', dropNode.label, dropType); + }, + //鍒犻櫎鏅�氭煡璇㈡潯浠� + delCondition(index) { + this.conditionList.splice(index, 1); + }, + //娓呯┖鍊� + clearValue() { + if (this.radioForm == 0) { + this.conditionList.map(item => { + item.ordinaryValue = ''; + return item; + }) + this.conditionList = this.conditionList + } else { + if(this.treeData[0] && this.treeData[0].children) { + this.clearTreeValue(this.treeData[0].children) + } + } + }, + clearTreeValue(nodes){ + nodes.forEach((node,index)=>{ + if(node.children){ + this.clearTreeValue(node.children) + }else { + let values=node.label.split(' '); + if(values.length>2){ + node.label=values[0]+' '+values[1]; + } + } + }) + }, + //鍒犻櫎鍏ㄩ儴鏉′欢 + delAll() { + if (this.radioForm == 0) { + this.conditionList = []; + } else { + this.treeIndex = 0; + this.treeData = []; + this.clickNode={}; + } + }, + nodeClick(data) { + this.clickNode = data + }, + //鏍� 澧炲姞閫昏緫鏉′欢 + addHandler() { + if (Object.keys(this.clickNode).length>0) { + if (this.clickNode.label == '骞朵笖' || this.clickNode.label == '鎴栬��') { + this.treeIndex++; + this.$refs.tree.append({ + label: '骞朵笖', + value: '骞朵笖' + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + children: [] + }, this.$refs.tree.getCurrentNode()); + } else { + this.$message.error("鍙兘瀵归�昏緫鏉′欢澧炲姞閫昏緫鏉′欢"); + } + } else { + if(this.treeData.length==0){ + this.treeIndex = 0; + this.treeData = [{ + label: '骞朵笖', + value: '骞朵笖' + this.treeIndex, + valueIndex: 'v' + this.treeIndex, + connector: '骞朵笖', + children: [] + }] + }else { + this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); + } + } + }, + //鏍� 淇敼鏉′欢 + editHandler() { + if (Object.keys(this.clickNode).length>0) { + if (this.clickNode.label == '骞朵笖') { + this.clickNode.label = '鎴栬��' + } else if (this.clickNode.label == '鎴栬��') { + this.clickNode.label = '骞朵笖' + } else { + const values= this.clickNode.label.split(' '); + this.clickNode.inputValue=''; + if(values.length>1){ + this.clickNode.operator=values[1]; + if(values.length>2){ + if(['VTDateTime','VTDate','VTTime'].includes(this.clickNode.type)){ + this.clickNode.inputValue=new Date(values[2]); + }else { + this.clickNode.inputValue=values[2]; + } + } + } + if(values[0].indexOf('.')!=-1){ + const labels=values[0].split('.') + this.clickNode.showLabel=labels[labels.length-1]; + }else { + this.clickNode.showLabel=values[0]; + } + this.dialog.showDialog = true; + } + } else { + this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); + } + }, + //鏍� 鍒犻櫎鏉′欢 + delHandler() { + if (Object.keys(this.clickNode).length>0) { + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬潯浠跺悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$refs.tree.remove(this.clickNode); + this.clickNode = {}; + }) + } else { + this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); + } + }, + //鏌ヨ + queryHandler(){ + this.$parent.$parent.$parent.$parent.$refs.form.validate((valid) => { + if (valid) { + this.queryResultDialog.loading=true; + const formData=this.$parent.$parent.$parent.$parent.initFormData(); + getCriteria(formData).then(res => { + if (res.data.success) { + this.resultData=res.data.data; + this.queryResultDialog.showDialog=true; + this.queryResultDialog.loading=false; + } + }); + } else { + return false; + } + }); + }, + //閫夋嫨鏌ヨ妯℃澘 + checkTemp(index) { + if(index>=0){ + if(['VTInteger','VTDouble','VTLong','VTDateTime','VTDate','VTTime'].includes(this.conditionList[index].type)){ + return false; + } + } + this.queryIndex=index; + this.queryDialog.showDialog=true; + this.$nextTick(()=>{ + this.$refs.crud.doLayout(); + }); + }, + //鏌ヨ鏉′欢淇濆瓨 + submitDialog() { + const values= this.clickNode.label.split(' '); + this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+this.clickNode.inputValue; + this.dialog.showDialog = false; + }, + //鑾峰彇鏌ヨ妯℃澘鍒楄〃 + getTemp() { + getAllQTs(this.page.currentPage, this.page.pageSize).then(res => { + this.crudData = res.data.data; + this.tableLoading = false; + }) + }, + rowClick(row) { + this.$refs.crud.toggleSelection(); + this.$refs.crud.toggleRowSelection(row); //閫変腑褰撳墠琛� + this.selectionRow = [row]; + }, + selectionChange(list) { + this.selectionRow = list; + }, + selectionClear() { + this.selectionRow = []; + this.$refs.crud.toggleSelection(); + }, + //閫夋嫨鏌ヨ妯℃澘 + submitQueryDialog() { + if (this.selectionRow.length == 0) { + this.$message.error('璇烽�夋嫨鏌ヨ妯℃澘鍐嶈繘琛屾搷浣�'); + return; + } + if (this.queryField == '') { + this.$message.error('璇峰~鍐欒緭鍏ユ煡璇㈠瓧娈�'); + return; + } + const value = this.selectionRow[0].qtName + ';' + this.queryField + if (this.radioForm == 0) { + //鏅�� + this.conditionList[this.queryIndex].ordinaryValue = value; + } else { + this.clickNode.inputValue = value; + } + this.cancleQueryDialog(); + }, + cancleQueryDialog(){ + this.queryDialog.showDialog = false; + this.selectionClear(); + this.queryField=''; + this.queryIndex=null; + }, + sizeChange(val) { + this.page.pageSize = val; + this.getTemp(); + }, + + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + this.getTemp(); + }, } } </script> diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue index 76df4c5..06a359e 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue @@ -103,6 +103,7 @@ }, { label: '鏂瑰悜', prop: 'direction', + width:80, formatter:function (row, value) { if (row.queryTemplate.direction == 'positive') { return '姝e悜' @@ -113,6 +114,7 @@ }, { label: '涓氬姟绫诲瀷', prop: 'btmType', + width: 130, formatter:function (row, value) { return row.queryTemplate.btmType; } @@ -135,12 +137,14 @@ }, { label: '鏌ヨ鏄惁鏈変笅绾�', prop: 'queryISLeaf', + width: 120, formatter:function (row, value) { return row.queryTemplate.queryISLeaf } }, { label: '瀛愯妭鐐瑰眰娆℃暟', prop: 'level', + width: 100, formatter:function (row, value) { return row.queryTemplate.level; } @@ -208,7 +212,6 @@ } this.$refs.formRef.openDialog(this.nodeRow.label,'淇敼','edit',{treeData:this.nodeRow,selectData:this.selectionRow[0]}); this.$nextTick(()=>{ - debugger; this.$refs.formRef.formItems[0].disabled = true; this.$refs.formRef.$refs.form.getInit(this.$refs.formRef.formItems) }); -- Gitblit v1.9.3