From 59ff9baa407775998954f271f7ed2cde8db01a26 Mon Sep 17 00:00:00 2001 From: wangting <wangting@vci-tech.com> Date: 星期二, 14 一月 2025 17:06:05 +0800 Subject: [PATCH] 查询模板下拉框数据联动,排序列表与创建表单排序字段数据联动 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formQueryDialog.vue | 532 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 298 insertions(+), 234 deletions(-) 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 612fa18..f03a5b9 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 @@ -1,112 +1,151 @@ <template> <div style="padding: 0 10px"> <div style="text-align: center;margin-bottom: 10px"> - <avue-radio v-model="radioForm" :disabled ="readOnly" :dic="radioDic" style="margin: 0 20px 0 0;display: inline-block"></avue-radio> - <el-button v-if="!readOnly" plain size="mini" type="primary" @click="clearValue">娓呯┖鍊�</el-button> - <el-button v-if="!readOnly" plain size="mini" type="primary" @click="delAll">鍒犻櫎鍏ㄩ儴鏉′欢</el-button> + <avue-radio v-model="radioForm" :dic="radioDic" :disabled="readOnly" + style="margin: 0 20px 0 0;display: inline-block"></avue-radio> + <el-button v-if="!readOnly" plain size="mini" type="primary" @click="clearValue">娓呯┖鍊�</el-button> + <el-button v-if="!readOnly" 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 :disabled ="readOnly" v-model="condition.operator" type="tree" :dic="condition.operatorDic" :clearable="false" style="width: 80px;margin: 0 5px;"></avue-select> - <el-date-picker :disabled ="readOnly" 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"> + <div v-if="radioForm==0" style="height: calc(100% - 75px);text-align: center;" @drop="drop" @dragover.prevent> + <div v-for="(condition,index) in conditionList" :key="index" class="el-input--small" + style="margin-bottom: 5px; text-align:left"> + <span :title="condition.clause" + style="width: 32%;display: inline-block;text-align: right;word-break: break-all">{{ condition.clause }}</span> + <avue-select v-model="condition.operator" :clearable="false" :dic="condition.operatorDic" :disabled="readOnly" + style="width: 80px;margin: 0 5px;" type="tree"></avue-select> + <el-date-picker v-if="condition.type=='VTDate'" v-model="condition.ordinaryValue" :disabled="readOnly" + style="width:36%;margin-right: 5px;display: inline-block;" type="date" + value-format="YYYY-MM-DD"> </el-date-picker> - <el-date-picker :disabled ="readOnly" v-else-if="condition.type=='VTDateTime'" v-model="condition.ordinaryValue" style="width:300px;margin-right: 5px;display: inline-block;" + <el-date-picker v-else-if="condition.type=='VTDateTime'" v-model="condition.ordinaryValue" :disabled="readOnly" + style="width:36%;margin-right: 5px;display: inline-block;" type="datetime"> </el-date-picker> - <el-time-select :disabled ="readOnly" 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 v-else-if="condition.type=='VTTime'" v-model="condition.ordinaryValue" :disabled="readOnly" + style="width:36%;margin-right: 5px;display: inline-block;" value-format="HH:mm:ss"> </el-time-select> - <avue-input-number :disabled ="readOnly" 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 :disabled ="readOnly" 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 :disabled ="readOnly" v-else v-model="condition.ordinaryValue" placeholder="" style="width: 300px;margin-right: 5px;"></avue-input> - <el-button v-if="!readOnly" plain size="mini" type="primary" @click="checkTemp(index)">閫夋嫨鏌ヨ妯℃澘</el-button> - <el-button v-if="!readOnly" size="mini" type="danger" icon="el-icon-delete" @click="delCondition(index)" style="padding: 7px 8px"></el-button> + <!--<avue-input-number v-else-if="condition.type=='VTInteger'" v-model="condition.ordinaryValue" + :disabled="readOnly" + precision="0" + 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" + :disabled="readOnly" + style="width:300px;margin-right: 5px;display: inline-block;"></avue-input-number> + <avue-input v-else v-model="condition.ordinaryValue" :disabled="readOnly" placeholder="" + style="width: 300px;margin-right: 5px;"></avue-input>--> + <avue-input v-else v-model="condition.ordinaryValue" :disabled="readOnly" placeholder="" + style="width: 36%;margin-right: 5px;"></avue-input> + <el-button v-if="!readOnly" plain size="mini" type="primary" @click="checkTemp(index)">閫夋嫨鏌ヨ妯℃澘</el-button> + <el-button v-if="!readOnly" icon="el-icon-delete" size="mini" style="padding: 7px 8px" type="danger" + @click="delCondition(index)"></el-button> </div> </div> - <div v-else @drop="drop" @dragover.prevent style="height: 220px;text-align: left"> - <avue-tree ref="tree" @node-drag-end="handleDragEnd" @node-drag-leave="handleDragLeave" @node-drag-over="handleDragOver" - style="height: 220px" :data="treeData" :option="treeOption" @node-click="nodeClick" node-key="value"></avue-tree> + <div v-else style="height: 220px;text-align: left" @drop="drop" @dragover.prevent> + <avue-tree ref="tree" :data="treeData" :option="treeOption" + node-key="value" + style="height: 220px" @node-drag-end="handleDragEnd" @node-drag-leave="handleDragLeave" + @node-drag-over="handleDragOver" + @node-click="nodeClick"></avue-tree> </div> <div v-if="!readOnly" 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> + <el-button v-show="radioForm==1" plain size="mini" type="primary" @click="addHandler">澧炲姞閫昏緫</el-button> + <el-button v-show="radioForm==1" plain size="mini" type="primary" @click="editHandler">淇敼鏉′欢</el-button> + <el-button v-show="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 + :append-to-body="true" + :close-on-click-modal="false" + :destroy-on-close="true" :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" + width="550px" @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"> + {{ clickNode.showLabel }} + <avue-select v-if="['VTInteger','VTDouble','VTLong'].includes(clickNode.type)" v-model="clickNode.operator" + :clearable="false" :dic="operatorIntDic" style="width: 80px;margin: 0 5px;" + type="tree"></avue-select> + <avue-select v-else-if="['VTDateTime','VTDate','VTTime'].includes(clickNode.type)" v-model="clickNode.operator" + :clearable="false" :dic="operatorDateDic" style="width: 80px;margin: 0 5px;" + type="tree"></avue-select> + <avue-select v-else v-model="clickNode.operator" :clearable="false" :dic="operatorDic" + style="width: 80px;margin: 0 5px;" + type="tree"></avue-select> + <el-date-picker v-if="clickNode.type=='VTDate'" v-model="clickNode.inputValue" + style="width:300px;display: inline-block;" type="date" + value-format="YYYY-MM-DD"> </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 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 v-else-if="clickNode.type=='VTTime'" v-model="clickNode.inputValue" + style="width:300px;display: inline-block;" + value-format="HH:mm:ss"> </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> + <avue-input-number v-else-if="clickNode.type=='VTInteger'" v-model="clickNode.inputValue" precision="0" + 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" style="width: 300px;margin-right: 5px;vertical-align: top;" + type="textarea"></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 v-if="!['VTInteger','VTDouble','VTLong','VTDateTime','VTDate','VTTime'].includes(clickNode.type)" + size="small" + @click="checkTemp"> + 閫夋嫨鏌ヨ妯℃澘 + </el-button> + <el-button plain size="small" type="primary" @click="submitDialog">淇� 瀛�</el-button> <el-button size="small" @click="dialog.showDialog=false">鍙� 娑�</el-button> </div> </el-dialog> <el-dialog v-dialogDrag + :append-to-body="true" + :close-on-click-modal="false" + :destroy-on-close="true" :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" + width="800px" @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-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 plain size="small" type="primary" @click="submitQueryDialog">纭� 瀹�</el-button> <el-button size="small" @click="cancleQueryDialog">鍙� 娑�</el-button> </div> </el-dialog> <!--鏌ヨ--> <el-dialog v-dialogDrag + :append-to-body="true" + :close-on-click-modal="false" + :destroy-on-close="true" :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" + width="900px" @close="queryResultDialog.showDialog=false"> <div class="el-input--small"> - <avue-crud ref="crud" :data="resultData" :option="resultOption" - :table-loading="queryResultDialog.loading"> + <avue-crud ref="crud" :data="resultData" :option="resultOption" + :table-loading="queryResultDialog.loading"> </avue-crud> </div> </el-dialog> @@ -116,10 +155,10 @@ <script> import basicOption from "@/util/basic-option"; import {getAllQTs} from "@/api/queryTemplate/queryDefine"; -import {getCriteria} from "@/api/queryTemplate/linkTypeQuery"; import {dateFormat} from "@/util/date" + export default { -name: "formQueryDialog", + name: "formQueryDialog", props: { queryCondition: { type: Array, @@ -129,14 +168,31 @@ type: Object, default: {} }, - levelFlag:{ + levelFlag: { type: Number, default: 0 }, - readOnly:{ - type:Boolean, - default:false - } + readOnly: { + type: Boolean, + default: false + }, + searchColumn: { + type: Array, + default: [ + { + label: 'OID', + prop: 'OID', + }, + { + label: 'CREATOR', + prop: 'CREATOR' + }, + { + label: 'CREATETIME', + prop: 'CREATETIME' + }, + ] + }, }, data() { return { @@ -162,13 +218,13 @@ label: '楂樼骇', value: 1 }], - conditionList:[], - treeData:[], - treeOption:{ - defaultExpandAll:true, + conditionList: [], + treeData: [], + treeOption: { + defaultExpandAll: true, menu: false, addBtn: false, - filter:false, + filter: false, draggable: true, allowDrop: (draggingNode, dropNode, type) => { debugger; @@ -189,7 +245,7 @@ total: 0, pageSizes: [10, 30, 50, 100], }, - crudData:[], + crudData: [], crudOption: { ...basicOption, addBtn: false, @@ -197,7 +253,7 @@ delBtn: false, tip: false, header: false, - height: window.innerHeight-220, + height: window.innerHeight - 220, menu: false, column: [{ label: '鏌ヨ妯℃澘鍚嶇О', @@ -210,9 +266,9 @@ }] }, tableLoading: false, - selectionRow:[], - queryField:'', - resultData:[], + selectionRow: [], + queryField: '', + resultData: [], resultOption: { ...basicOption, addBtn: false, @@ -220,21 +276,12 @@ delBtn: false, tip: false, header: false, - height: window.innerHeight-220, + height: window.innerHeight - 220, menu: false, - column: [{ - label: 'OID', - prop: 'OID', - }, { - label: 'CREATOR', - prop: 'CREATOR' - }, { - label: 'CREATETIME', - prop: 'CREATETIME' - }] + column: this.searchColumn }, - clickNode:{}, - operatorIntDic:[{ + clickNode: {}, + operatorIntDic: [{ label: '=', value: '=' }, { @@ -262,7 +309,7 @@ label: '<', value: '<' }], - operatorDateDic : [{ + operatorDateDic: [{ label: '=', value: '=' }, { @@ -281,7 +328,7 @@ label: '<=', value: '<=' }], - operatorDic : [{ + operatorDic: [{ label: '=', value: '=' }, { @@ -300,7 +347,7 @@ } }, computed: { - radioForm:{ + radioForm: { get() { return this.levelFlag; }, @@ -310,132 +357,141 @@ } }, watch: { - queryCondition:{ + 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; + if (val && val.cIMap) { + let list = []; + let that = this; + let getValue = function (queryTemplate, item) { + if(queryTemplate.id.indexOf('qt_')==0){ + item.clause += '.' + queryTemplate.condition.cIMap['ci1'].leafInfo.clause; + item.ordinaryValue = queryTemplate.condition.cIMap['ci1'].leafInfo.value.ordinaryValue; + item.type = queryTemplate.condition.cIMap['ci1'].leafInfo.type; + }else { + item.ordinaryValue = queryTemplate.id+';'+queryTemplate.clauseList.join(','); + /*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={ + let clause = this.queryCondition.cIMap[key].leafInfo.clause; + let operator = this.queryCondition.cIMap[key].leafInfo.operator; + let item = { clause: clause, operator: operator, ordinaryValue: '', - operatorDic :[] + 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; + 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=[] + this.conditionList = list; + } else { + this.conditionList = [] } }, immediate: true, - deep:true + deep: true }, - queryTree:{ + queryTree: { handler(val) { - this.treeIndex=0; - if(val && Object.keys(val).length>0){ + this.treeIndex = 0; + if (val && Object.keys(val).length > 0) { let treeData = []; - let that=this; + let that = this; + function initValue(nodeChild) { - let children=[]; - if(nodeChild){ - nodeChild.forEach((item,index)=>{ + let children = []; + if (nodeChild) { + nodeChild.forEach((item, index) => { that.treeIndex++; - if(item.column !=null && item.column != undefined){ - const values= item.column.split(' '); - let inputValue=''; - let operator=''; - let showLabel='' - if(item.column.indexOf('not in')!=-1){ - operator='not in'; - if(values.length>3){ - inputValue=values[3]; + if (item.column != null && item.column != undefined) { + const values = item.column.split(' '); + let inputValue = ''; + let operator = ''; + let showLabel = '' + if (item.column.indexOf('not in') != -1) { + operator = 'not in'; + if (values.length > 3) { + inputValue = values[3]; } - }else{ - if(values.length>1){ - operator=values[1]; - if(values.length>2){ - inputValue=values[2]; + } else { + if (values.length > 1) { + operator = values[1]; + if (values.length > 2) { + inputValue = values[2]; } } } - if(values[0].indexOf('.')!=-1){ - const labels=values[0].split('.') - showLabel=labels[labels.length-1]; - }else { - showLabel=values[0]; + if (values[0].indexOf('.') != -1) { + const labels = values[0].split('.') + showLabel = labels[labels.length - 1]; + } else { + showLabel = values[0]; } children.push({ - label:item.column, - value:item.column+that.treeIndex, - type:item.type, - valueIndex:'v'+that.treeIndex, - inputValue:inputValue, - operator:operator, - showLabel:showLabel + label: item.column, + value: item.column + that.treeIndex, + type: item.type, + valueIndex: 'v' + that.treeIndex, + inputValue: inputValue, + operator: operator, + showLabel: showLabel }) - }else { + } else { children.push({ - label:item.connector, - value:item.connector+that.treeIndex, - valueIndex:'v'+that.treeIndex, - children:initValue(item.child) + 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) + + 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=[{ + } else { + this.treeData = [{ label: '骞朵笖', value: '骞朵笖' + this.treeIndex, valueIndex: 'v' + this.treeIndex, @@ -445,11 +501,13 @@ } }, immediate: true, - deep:true + deep: true } }, created() { - this.getTemp(); + if (!this.readOnly) { + this.getTemp(); + } }, methods: { // 鎷栨嫿鍒版椂 @@ -463,15 +521,15 @@ ordinaryValue: '' } if (data.vtDataType == 'VTInteger' || data.vtDataType == 'VTDouble' || data.vtDataType == 'VTLong') { - params.operatorDic =JSON.parse(JSON.stringify(this.operatorIntDic)) ; + params.operatorDic = JSON.parse(JSON.stringify(this.operatorIntDic)); } else if (data.vtDataType == 'VTDateTime' || data.vtDataType == 'VTDate' || data.vtDataType == 'VTTime') { params.operatorDic = JSON.parse(JSON.stringify(this.operatorDateDic)) } else { params.operatorDic = JSON.parse(JSON.stringify(this.operatorDic)) } - params.type=data.vtDataType; + params.type = data.vtDataType; this.conditionList.push(params) - }else { + } else { if (this.clickNode.label != '骞朵笖' && this.clickNode.label != '鎴栬��') { this.$message.error('璇烽�変腑閫昏緫鏉′欢娣诲姞鏌ヨ椤�'); return; @@ -479,30 +537,29 @@ this.$refs.tree.append(this.initItem(data), this.clickNode); } }, - initItem(data){ + initItem(data) { this.treeIndex++; - let item={ + let item = { label: data.name, value: data.name + this.treeIndex, valueIndex: 'v' + this.treeIndex, - type:data.vtDataType, + type: data.vtDataType, children: [], - inputValue:'', - operator:'=', - showLabel:data.name + inputValue: '', + operator: '=', + showLabel: data.name }; - let showLabel=''; - if(data.name.indexOf('.')!=-1){ - const labels=data.name.split('.') - showLabel=labels[labels.length-1]; - }else { - showLabel=data.name; + let showLabel = ''; + if (data.name.indexOf('.') != -1) { + const labels = data.name.split('.') + showLabel = labels[labels.length - 1]; + } else { + showLabel = data.name; } - item.showLabel=showLabel; + item.showLabel = showLabel; return item }, handleDragEnd(draggingNode, dropNode, dropType, ev) { - debugger; console.log('tree drag end: ', dropNode && dropNode.label, dropType); }, handleDragOver({event}) { @@ -526,19 +583,19 @@ }) this.conditionList = this.conditionList } else { - if(this.treeData[0] && this.treeData[0].children) { + if (this.treeData[0] && this.treeData[0].children) { this.clearTreeValue(this.treeData[0].children) } } }, - clearTreeValue(nodes){ - nodes.forEach((node,index)=>{ - if(node.children){ + clearTreeValue(nodes) { + nodes.forEach((node, index) => { + if (node.children) { this.clearTreeValue(node.children) - }else { - if(node.label.indexOf('not in')!=-1){ - node.label=node.label.split(' ')[0]+' not in' - }else { + } else { + if (node.label.indexOf('not in') != -1) { + node.label = node.label.split(' ')[0] + ' not in' + } else { let values = node.label.split(' '); if (values.length > 2) { node.label = values[0] + ' ' + values[1]; @@ -554,7 +611,7 @@ } else { this.treeIndex = 0; this.treeData = []; - this.clickNode={}; + this.clickNode = {}; } }, nodeClick(data) { @@ -562,7 +619,7 @@ }, //鏍� 澧炲姞閫昏緫鏉′欢 addHandler() { - if (Object.keys(this.clickNode).length>0) { + if (Object.keys(this.clickNode).length > 0) { if (this.clickNode.label == '骞朵笖' || this.clickNode.label == '鎴栬��') { this.treeIndex++; this.$refs.tree.append({ @@ -575,7 +632,7 @@ this.$message.error("鍙兘瀵归�昏緫鏉′欢澧炲姞閫昏緫鏉′欢"); } } else { - if(this.treeData.length==0){ + if (this.treeData.length == 0) { this.treeIndex = 0; this.treeData = [{ label: '骞朵笖', @@ -584,14 +641,14 @@ connector: '骞朵笖', children: [] }] - }else { + } else { this.$message.warning("璇烽�夋嫨鏌ヨ鏉′欢"); } } }, //鏍� 淇敼鏉′欢 editHandler() { - if (Object.keys(this.clickNode).length>0) { + if (Object.keys(this.clickNode).length > 0) { if (this.clickNode.label == '骞朵笖') { this.clickNode.label = '鎴栬��' } else if (this.clickNode.label == '鎴栬��') { @@ -605,7 +662,7 @@ }, //鏍� 鍒犻櫎鏉′欢 delHandler() { - if (Object.keys(this.clickNode).length>0) { + if (Object.keys(this.clickNode).length > 0) { this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬潯浠跺悧锛�', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', @@ -619,35 +676,36 @@ } }, //鏌ヨ - queryHandler(){ + queryHandler() { this.$emit('queryHandler'); }, //閫夋嫨鏌ヨ妯℃澘 checkTemp(index) { - if(index>=0){ - if(['VTInteger','VTDouble','VTLong','VTDateTime','VTDate','VTTime'].includes(this.conditionList[index].type)){ + if (index >= 0) { + if (['VTDateTime', 'VTDate', 'VTTime'].includes(this.conditionList[index].type)) { + this.$message.warning("璇ュ睘鎬х被鍨嬩笉鑳介�夋嫨鏌ヨ妯℃澘"); return false; } } - this.queryIndex=index; - this.queryDialog.showDialog=true; - this.$nextTick(()=>{ + 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; - try{ - if(['VTDateTime'].includes(this.clickNode.type)){ - this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+dateFormat(this.clickNode.inputValue); - }else if(['VTDate'].includes(this.clickNode.type)){ - this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+dateFormat(this.clickNode.inputValue ,'yyyy-MM-dd'); - }else if(['VTTime'].includes(this.clickNode.type)){ - this.clickNode.label = values[0]+' '+this.clickNode.operator+' '+dateFormat(this.clickNode.inputValue ,'hh:mm:ss'); + const values = this.clickNode.label.split(' '); + this.clickNode.label = values[0] + ' ' + this.clickNode.operator + ' ' + this.clickNode.inputValue; + try { + if (['VTDateTime'].includes(this.clickNode.type)) { + this.clickNode.label = values[0] + ' ' + this.clickNode.operator + ' ' + dateFormat(this.clickNode.inputValue); + } else if (['VTDate'].includes(this.clickNode.type)) { + this.clickNode.label = values[0] + ' ' + this.clickNode.operator + ' ' + dateFormat(this.clickNode.inputValue, 'yyyy-MM-dd'); + } else if (['VTTime'].includes(this.clickNode.type)) { + this.clickNode.label = values[0] + ' ' + this.clickNode.operator + ' ' + dateFormat(this.clickNode.inputValue, 'hh:mm:ss'); } - }catch (e) { + } catch (e) { } @@ -691,11 +749,11 @@ } this.cancleQueryDialog(); }, - cancleQueryDialog(){ + cancleQueryDialog() { this.queryDialog.showDialog = false; this.selectionClear(); - this.queryField=''; - this.queryIndex=null; + this.queryField = ''; + this.queryIndex = null; }, sizeChange(val) { this.page.pageSize = val; @@ -711,9 +769,15 @@ } </script> -<style scoped> -::v-deep .el-input--small .el-input__inner{ - height: 28px; - line-height: 28px; +<style lang="scss" scoped> +::v-deep { + .el-input--small .el-input__inner { + height: 28px; + line-height: 28px; + } + + .el-radio { + margin-right: 30px; + } } </style> -- Gitblit v1.9.3