修改虚拟清单的高级检索
This commit is contained in:
@@ -0,0 +1,661 @@
|
|||||||
|
<template>
|
||||||
|
<div class="j-super-query-box">
|
||||||
|
<slot name="button" :isActive="superQueryFlag" :isMobile="izMobile" :open="handleOpen" :reset="handleReset">
|
||||||
|
<a-tooltip v-if="superQueryFlag" v-bind="tooltipProps" :mouseLeaveDelay="0.2">
|
||||||
|
<!-- begin 不知道为什么不加上这段代码就无法生效 -->
|
||||||
|
<span v-show="false">{{tooltipProps}}</span>
|
||||||
|
<!-- end 不知道为什么不加上这段代码就无法生效 -->
|
||||||
|
<template slot="title">
|
||||||
|
<span>{{$t('advancedQueryEffective')}}</span>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a @click="handleReset">{{$t('empty')}}</a>
|
||||||
|
</template>
|
||||||
|
<a-button-group>
|
||||||
|
<a-button type="primary" @click="handleOpen" style="margin-right: 8px;height: 38px">
|
||||||
|
<a-icon type="appstore" theme="twoTone" spin/>
|
||||||
|
<span>{{$t('advancedQuery')}}</span>
|
||||||
|
</a-button>
|
||||||
|
<a-button style="margin-right: 8px;height: 38px" v-if="izMobile" type="primary" icon="delete" @click="handleReset"/>
|
||||||
|
</a-button-group>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-button v-else style="margin-right: 8px;height: 38px" type="primary" icon="filter" @click="handleOpen">{{$t('advancedQuery')}}</a-button>
|
||||||
|
</slot>
|
||||||
|
<j-modal
|
||||||
|
:title="$t('advancedQuery')+$t('constructor')"
|
||||||
|
:width="1000"
|
||||||
|
:maskClosable="false"
|
||||||
|
:visible="visible"
|
||||||
|
@cancel="handleCancel"
|
||||||
|
:mask="false"
|
||||||
|
:fullscreen="izMobile"
|
||||||
|
class="j-super-query-modal"
|
||||||
|
style="top:5%;max-height: 95%;"
|
||||||
|
>
|
||||||
|
<template slot="footer">
|
||||||
|
<!-- <div style="float: left">-->
|
||||||
|
<!-- <a-button :loading="loading" @click="handleReset">{{$t('reset')}}</a-button>-->
|
||||||
|
<!-- <a-button :loading="loading" @click="handleSave">{{$t('SaveQueryCriteria')}}</a-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<a-button :loading="loading" @click="handleCancel">{{$t('close')}}</a-button>
|
||||||
|
<a-button :loading="loading" type="primary" @click="handleOk">{{$t('query')}}</a-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<a-spin :spinning="loading">
|
||||||
|
<a-row>
|
||||||
|
<a-col :sm="24" :md="24">
|
||||||
|
|
||||||
|
<a-empty v-if="queryParamsModel.length === 0" style="margin-bottom: 12px;">
|
||||||
|
<div slot="description">
|
||||||
|
<span>{{$t('no')}}+{{$t('query')}}+{{$t('condition')}}</span>
|
||||||
|
<a-divider type="vertical"/>
|
||||||
|
<a @click="handleAdd">{{$t('click')}}+{{$t('add')}}</a>
|
||||||
|
</div>
|
||||||
|
</a-empty>
|
||||||
|
|
||||||
|
<a-form v-else layout="inline">
|
||||||
|
|
||||||
|
<a-row style="margin-bottom: 12px;">
|
||||||
|
<a-col :md="12" :xs="24">
|
||||||
|
<a-form-item :label="$t('FilterMatching')" :labelCol="{md: 6,xs:24}" :wrapperCol="{md: 18,xs:24}" style="width: 100%;">
|
||||||
|
<a-select v-model="matchType" :getPopupContainer="node=>node.parentNode" style="width: 100%;">
|
||||||
|
<a-select-option value="and">AND{{$t('AllMatching')}}</a-select-option>
|
||||||
|
<a-select-option value="or">OR{{$t('AnyOneMatches')}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<a-row type="flex" style="margin-bottom:10px" :gutter="24" v-for="(item, index) in queryParamsModel" :key="index">
|
||||||
|
|
||||||
|
<a-col :md="8" :xs="24" style="margin-bottom: 12px;">
|
||||||
|
<a-tree-select
|
||||||
|
showSearch
|
||||||
|
v-model="item.field"
|
||||||
|
:treeData="fieldTreeData"
|
||||||
|
:dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
|
||||||
|
:placeholder="$t('SelectQueryField')"
|
||||||
|
allowClear
|
||||||
|
treeDefaultExpandAll
|
||||||
|
:getPopupContainer="node=>node.parentNode"
|
||||||
|
style="width: 100%"
|
||||||
|
@select="(val,option)=>handleSelected(option,item)"
|
||||||
|
>
|
||||||
|
</a-tree-select>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :md="4" :xs="24" style="margin-bottom: 12px;">
|
||||||
|
<a-select :placeholder="$t('matchRules')" :value="item.rule"
|
||||||
|
:getPopupContainer="node=>node.parentNode" @change="handleRuleChange(item,$event)">
|
||||||
|
<a-select-option value="eq">{{$t('beEqualTo')}}</a-select-option>
|
||||||
|
<a-select-option value="like">{{$t('contain')}}</a-select-option>
|
||||||
|
<a-select-option value="right_like">{{$t('withStart')}}</a-select-option>
|
||||||
|
<a-select-option value="left_like">{{$t('withEnd')}}</a-select-option>
|
||||||
|
<a-select-option value="in">{{$t('in')}}</a-select-option>
|
||||||
|
<a-select-option value="ne">{{$t('notEqual')}}</a-select-option>
|
||||||
|
<a-select-option value="gt">{{$t('granter')}}</a-select-option>
|
||||||
|
<a-select-option value="ge">{{$t('greaterOrEqual')}}</a-select-option>
|
||||||
|
<a-select-option value="lt">{{$t('less')}}</a-select-option>
|
||||||
|
<a-select-option value="le">{{$t('lessOrEqual')}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :md="8" :xs="24" style="margin-bottom: 12px;">
|
||||||
|
<!-- 下拉搜索 -->
|
||||||
|
<j-search-select-tag v-if="item.type==='sel_search'" v-model="item.val" :dict="getDictInfo(item)" placeholder="请选择"/>
|
||||||
|
<!-- 下拉多选 -->
|
||||||
|
<template v-else-if="item.type==='list_multi'">
|
||||||
|
<j-multi-select-tag v-if="item.options" v-model="item.val" :options="item.options" :placeholder="$t('pleaseSelect')"/>
|
||||||
|
<j-multi-select-tag v-else v-model="item.val" :dictCode="getDictInfo(item)" :placeholder="$t('pleaseSelect')"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="item.dictCode">
|
||||||
|
<template v-if="item.type === 'table-dict'">
|
||||||
|
<j-popup
|
||||||
|
v-model="item.val"
|
||||||
|
:code="item.dictTable"
|
||||||
|
:field="item.dictCode"
|
||||||
|
:orgFields="item.dictCode"
|
||||||
|
:destFields="item.dictCode"
|
||||||
|
:multi="true"
|
||||||
|
></j-popup>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<j-multi-select-tag v-show="allowMultiple(item)" v-model="item.val" :dictCode="item.dictCode" :placeholder="$t('pleaseSelect')"/>
|
||||||
|
<j-dict-select-tag v-show="!allowMultiple(item)" v-model="item.val" :dictCode="item.dictCode" :placeholder="$t('pleaseSelect')"/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<j-popup
|
||||||
|
v-else-if="item.type === 'popup'"
|
||||||
|
:value="item.val"
|
||||||
|
v-bind="item.popup"
|
||||||
|
group-id="superQuery"
|
||||||
|
@input="(e,v)=>handleChangeJPopup(item,e,v)"
|
||||||
|
:multi="true"/>
|
||||||
|
<j-select-multi-user
|
||||||
|
v-else-if="item.type === 'select-user' || item.type === 'sel_user'"
|
||||||
|
v-model="item.val"
|
||||||
|
:buttons="false"
|
||||||
|
:multiple="false"
|
||||||
|
:placeholder="$t('pleaseSelect')+$t('user')"
|
||||||
|
:returnKeys="['id', item.customReturnField || 'username']"
|
||||||
|
/>
|
||||||
|
<j-select-depart
|
||||||
|
v-else-if="item.type === 'select-depart' || item.type === 'sel_depart'"
|
||||||
|
v-model="item.val"
|
||||||
|
:multi="false"
|
||||||
|
:placeholder="$t('pleaseSelect')+$t('department')"
|
||||||
|
:customReturnField="item.customReturnField || 'id'"
|
||||||
|
/>
|
||||||
|
<a-select
|
||||||
|
v-else-if="item.options instanceof Array"
|
||||||
|
v-model="item.val"
|
||||||
|
:options="item.options"
|
||||||
|
allowClear
|
||||||
|
:placeholder="$t('pleaseSelect')"
|
||||||
|
:mode="allowMultiple(item)?'multiple':''"
|
||||||
|
/>
|
||||||
|
<j-area-linkage v-model="item.val" v-else-if="item.type==='area-linkage' || item.type==='pca'"
|
||||||
|
style="width: 100%;display: inline-block"/>
|
||||||
|
<j-date v-else-if=" item.type=='date' " v-model="item.val"
|
||||||
|
:placeholder="$t('pleaseSelect')+$t('date')" style="width: 100%;display: inline-block"></j-date>
|
||||||
|
<j-date v-else-if=" item.type=='datetime' " v-model="item.val"
|
||||||
|
:placeholder="$t('pleaseSelect')+$t('time')" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
style="width: 100%;display: inline-block"></j-date>
|
||||||
|
<a-time-picker v-else-if="item.type==='time'"
|
||||||
|
:value="item.val ? moment(item.val,'HH:mm:ss') : null" format="HH:mm:ss"
|
||||||
|
style="width: 100%;display: inline-block" @change="(time,value)=>item.val=value"/>
|
||||||
|
<a-input-number v-else-if=" item.type=='int'||item.type=='number' " style="width: 100%" :placeholder="$t('pleaseSelect')+$t('numericalValue')" v-model="item.val"/>
|
||||||
|
<a-select v-else-if="item.type=='switch'" :placeholder="$t('pleaseSelect')" v-model="item.val">
|
||||||
|
<a-select-option value="Y">{{$t('yes')}}</a-select-option>
|
||||||
|
<a-select-option value="N">{{$t('not')}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<a-input v-else v-model="item.val" :placeholder="$t('EnterValue')"/>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :md="4" :xs="0" style="margin-bottom: 12px;">
|
||||||
|
<a-button @click="handleAdd" icon="plus"></a-button>
|
||||||
|
<a-button @click="handleDel( index )" icon="minus"></a-button>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :md="0" :xs="24" style="margin-bottom: 12px;text-align: right;">
|
||||||
|
<a-button @click="handleAdd" icon="plus"></a-button>
|
||||||
|
<a-button @click="handleDel( index )" icon="minus"></a-button>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
</a-form>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-spin>
|
||||||
|
|
||||||
|
<a-modal :title="$t('pleaseEnter')+$t('SavedName')" :visible="prompt.visible" @cancel="prompt.visible=false" @ok="handlePromptOk">
|
||||||
|
<a-input v-model="prompt.value"></a-input>
|
||||||
|
</a-modal>
|
||||||
|
</j-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import moment from 'moment'
|
||||||
|
import * as utils from '@/utils/util'
|
||||||
|
import { mixinDevice } from '@/utils/mixin'
|
||||||
|
import JDate from '@/components/jero/JDate.vue'
|
||||||
|
import JSelectDepart from '@/components/jerobiz/JSelectDepart'
|
||||||
|
import JSelectMultiUser from '@/components/jerobiz/JSelectMultiUser'
|
||||||
|
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
||||||
|
import JAreaLinkage from '@comp/jero/JAreaLinkage'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'index',
|
||||||
|
mixins: [mixinDevice],
|
||||||
|
components: { JAreaLinkage, JMultiSelectTag, JDate, JSelectDepart, JSelectMultiUser },
|
||||||
|
props: {
|
||||||
|
/*
|
||||||
|
fieldList: [{
|
||||||
|
value:'',
|
||||||
|
text:'',
|
||||||
|
type:'',
|
||||||
|
dictCode:'' // 只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
}]
|
||||||
|
type:date datetime int number string
|
||||||
|
* */
|
||||||
|
fieldList: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
* 这个回调函数接收一个数组参数 即查询条件
|
||||||
|
* */
|
||||||
|
callback: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'handleSuperQuery'
|
||||||
|
},
|
||||||
|
|
||||||
|
// 当前是否在加载中
|
||||||
|
loading: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
|
||||||
|
// 保存查询条件的唯一 code,通过该 code 区分
|
||||||
|
// 默认为 null,代表以当前路由全路径为区分Code
|
||||||
|
saveCode: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
moment,
|
||||||
|
fieldTreeData: [],
|
||||||
|
|
||||||
|
prompt: {
|
||||||
|
visible: false,
|
||||||
|
value: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
visible: false,
|
||||||
|
queryParamsModel: [],
|
||||||
|
treeIcon: <a-icon type="file-text"/>,
|
||||||
|
// 保存查询条件的treeData
|
||||||
|
saveTreeData: [],
|
||||||
|
// 保存查询条件的前缀名
|
||||||
|
saveCodeBefore: 'JSuperQuerySaved_',
|
||||||
|
// 查询类型,过滤条件匹配(and、or)
|
||||||
|
matchType: 'and',
|
||||||
|
superQueryFlag: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
izMobile() {
|
||||||
|
return this.device === 'mobile'
|
||||||
|
},
|
||||||
|
tooltipProps() {
|
||||||
|
return this.izMobile ? { visible: false } : {}
|
||||||
|
},
|
||||||
|
fullSaveCode() {
|
||||||
|
let saveCode = this.saveCode
|
||||||
|
if (saveCode == null || saveCode === '') {
|
||||||
|
saveCode = this.$route.fullPath
|
||||||
|
}
|
||||||
|
return this.saveCodeBefore + saveCode
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 当 saveCode 变化时,重新查询已保存的条件
|
||||||
|
fullSaveCode: {
|
||||||
|
immediate: true,
|
||||||
|
handler() {
|
||||||
|
let list = this.$ls.get(this.fullSaveCode)
|
||||||
|
if (list instanceof Array) {
|
||||||
|
this.saveTreeData = list.map(i => this.renderSaveTreeData(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fieldList: {
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
handler(val) {
|
||||||
|
let mainData = [], subData = []
|
||||||
|
val.forEach(item => {
|
||||||
|
let data = { ...item }
|
||||||
|
data.label = data.label || data.text
|
||||||
|
let hasChildren = (data.children instanceof Array)
|
||||||
|
data.disabled = hasChildren
|
||||||
|
data.selectable = !hasChildren
|
||||||
|
if (hasChildren) {
|
||||||
|
data.children = data.children.map(item2 => {
|
||||||
|
let child = { ...item2 }
|
||||||
|
child.label = child.label || child.text
|
||||||
|
child.label = data.label + '-' + child.label
|
||||||
|
child.value = data.value + ',' + child.value
|
||||||
|
child.val = ''
|
||||||
|
return child
|
||||||
|
})
|
||||||
|
data.val = ''
|
||||||
|
subData.push(data)
|
||||||
|
} else {
|
||||||
|
mainData.push(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.fieldTreeData = mainData.concat(subData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
show() {
|
||||||
|
if (!this.queryParamsModel || this.queryParamsModel.length === 0) {
|
||||||
|
this.resetLine()
|
||||||
|
}
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
getDictInfo(item) {
|
||||||
|
let str = ''
|
||||||
|
if(!item.dictTable){
|
||||||
|
str = item.dictCode
|
||||||
|
}else{
|
||||||
|
str = item.dictTable+','+item.dictText+','+item.dictCode
|
||||||
|
}
|
||||||
|
console.log('高级查询字典信息',str)
|
||||||
|
return str
|
||||||
|
},
|
||||||
|
handleOk() {
|
||||||
|
if (!this.isNullArray(this.queryParamsModel)) {
|
||||||
|
let event = {
|
||||||
|
matchType: this.matchType,
|
||||||
|
params: this.removeEmptyObject(this.queryParamsModel)
|
||||||
|
}
|
||||||
|
// 移动端模式下关闭弹窗
|
||||||
|
if (this.izMobile) {
|
||||||
|
this.visible = false
|
||||||
|
}
|
||||||
|
this.emitCallback(event)
|
||||||
|
} else {
|
||||||
|
this.$message.warn(this.$t('CannotQueryEmpty'))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
emitCallback(event = {}) {
|
||||||
|
let { params = [], matchType = this.matchType } = event
|
||||||
|
this.superQueryFlag = (params && params.length > 0)
|
||||||
|
for (let param of params) {
|
||||||
|
if (Array.isArray(param.val)) {
|
||||||
|
param.val = param.val.join(',')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.debug('---高级查询参数--->', { params, matchType })
|
||||||
|
this.$emit(this.callback, params, matchType)
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.close()
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('close')
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.addNewLine()
|
||||||
|
},
|
||||||
|
addNewLine() {
|
||||||
|
this.queryParamsModel.push({ rule: 'eq' })
|
||||||
|
},
|
||||||
|
resetLine() {
|
||||||
|
this.superQueryFlag = false
|
||||||
|
this.queryParamsModel = []
|
||||||
|
this.addNewLine()
|
||||||
|
},
|
||||||
|
handleDel(index) {
|
||||||
|
this.queryParamsModel.splice(index, 1)
|
||||||
|
},
|
||||||
|
handleSelected(node, item) {
|
||||||
|
let { type, options, dictCode, dictTable, dictText, customReturnField, popup } = node.dataRef
|
||||||
|
item['type'] = type
|
||||||
|
item['options'] = options
|
||||||
|
item['dictCode'] = dictCode
|
||||||
|
item['dictTable'] = dictTable
|
||||||
|
item['dictText'] = dictText
|
||||||
|
item['customReturnField'] = customReturnField
|
||||||
|
if (popup) {
|
||||||
|
item['popup'] = popup
|
||||||
|
}
|
||||||
|
this.$set(item, 'val', undefined)
|
||||||
|
},
|
||||||
|
handleOpen() {
|
||||||
|
this.show()
|
||||||
|
},
|
||||||
|
handleReset() {
|
||||||
|
this.resetLine()
|
||||||
|
this.emitCallback()
|
||||||
|
},
|
||||||
|
handleSave() {
|
||||||
|
let queryParams = this.removeEmptyObject(this.queryParamsModel)
|
||||||
|
if (this.isNullArray(queryParams)) {
|
||||||
|
this.$message.warning(this.$t('EmptyCannotSaved'))
|
||||||
|
} else {
|
||||||
|
this.prompt.value = ''
|
||||||
|
this.prompt.visible = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handlePromptOk() {
|
||||||
|
let { value } = this.prompt
|
||||||
|
if(!value){
|
||||||
|
this.$message.warning(this.$t('preservation')+this.$t('name')+this.$t('cannotEmpty'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 取出查询条件
|
||||||
|
let records = this.removeEmptyObject(this.queryParamsModel)
|
||||||
|
// 判断有没有重名的
|
||||||
|
let filterList = this.saveTreeData.filter(i => i.originTitle === value)
|
||||||
|
if (filterList.length > 0) {
|
||||||
|
this.$confirm({
|
||||||
|
content: `${value} `+this.$t('AlreadyExists'),
|
||||||
|
onOk: () => {
|
||||||
|
this.prompt.visible = false
|
||||||
|
filterList[0].records = records
|
||||||
|
this.saveToLocalStore()
|
||||||
|
this.$message.success(this.$t('SavedSuccessfully'))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// 没有重名的,直接添加
|
||||||
|
this.prompt.visible = false
|
||||||
|
// 添加到树列表中
|
||||||
|
this.saveTreeData.push(this.renderSaveTreeData({
|
||||||
|
title: value,
|
||||||
|
matchType: this.matchType,
|
||||||
|
records: records
|
||||||
|
}))
|
||||||
|
// 保存到 LocalStore
|
||||||
|
this.saveToLocalStore()
|
||||||
|
this.$message.success(this.$t('SavedSuccessfully'))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleTreeSelect(idx, event) {
|
||||||
|
if (event.selectedNodes[0]) {
|
||||||
|
let { matchType, records } = event.selectedNodes[0].data.props
|
||||||
|
// 将保存的matchType取出,兼容旧数据,如果没有保存就还是使用原来的
|
||||||
|
this.matchType = matchType || this.matchType
|
||||||
|
this.queryParamsModel = utils.cloneObject(records)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleRemoveSaveTreeItem(event, vNode) {
|
||||||
|
// 阻止事件冒泡
|
||||||
|
event.stopPropagation()
|
||||||
|
|
||||||
|
this.$confirm({
|
||||||
|
content: this.$t('DeleteQuery'),
|
||||||
|
onOk: () => {
|
||||||
|
let { eventKey } = vNode
|
||||||
|
this.saveTreeData.splice(Number.parseInt(eventKey.substring(2)), 1)
|
||||||
|
this.saveToLocalStore()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 将查询保存到 LocalStore 里
|
||||||
|
saveToLocalStore() {
|
||||||
|
let saveValue = this.saveTreeData.map(({ originTitle, matchType, records }) => ({ title: originTitle, matchType, records }))
|
||||||
|
this.$ls.set(this.fullSaveCode, saveValue)
|
||||||
|
},
|
||||||
|
|
||||||
|
isNullArray(array) {
|
||||||
|
//判断是不是空数组对象
|
||||||
|
if (!array || array.length === 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (array.length === 1) {
|
||||||
|
let obj = array[0]
|
||||||
|
if (!obj.field || (obj.val == null || obj.val === '') || !obj.rule) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
// 去掉数组中的空对象
|
||||||
|
removeEmptyObject(arr) {
|
||||||
|
let array = utils.cloneObject(arr)
|
||||||
|
for (let i = 0; i < array.length; i++) {
|
||||||
|
let item = array[i]
|
||||||
|
if (item == null || Object.keys(item).length <= 0) {
|
||||||
|
array.splice(i--, 1)
|
||||||
|
} else {
|
||||||
|
if (Array.isArray(item.options)) {
|
||||||
|
// 如果有字典属性,就不需要保存 options 了
|
||||||
|
//update-begin-author:taoyan date:20200819 for:【开源问题】 高级查询 下拉框作为并且选项很多多多 LOWCOD-779
|
||||||
|
delete item.options
|
||||||
|
//update-end-author:taoyan date:20200819 for:【开源问题】 高级查询 下拉框作为并且选项很多多多 LOWCOD-779
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 渲染保存查询条件的 title(加个删除按钮) */
|
||||||
|
renderSaveTreeData(item) {
|
||||||
|
item.icon = this.treeIcon
|
||||||
|
item.originTitle = item['title']
|
||||||
|
item.title = (arg1, arg2) => {
|
||||||
|
let vNode
|
||||||
|
// 兼容旧版的Antdv
|
||||||
|
if (arg1.dataRef) {
|
||||||
|
vNode = arg1
|
||||||
|
} else if (arg2.dataRef) {
|
||||||
|
vNode = arg2
|
||||||
|
} else {
|
||||||
|
return <span style="color:red;">Antdv版本不支持</span>
|
||||||
|
}
|
||||||
|
let {originTitle} = vNode.dataRef
|
||||||
|
return (
|
||||||
|
<div class="j-history-tree-title">
|
||||||
|
<span>{originTitle}</span>
|
||||||
|
|
||||||
|
<div class="j-history-tree-title-closer" onClick={e => this.handleRemoveSaveTreeItem(e, vNode)}>
|
||||||
|
<a-icon type="close-circle"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 判断是否允许多选 */
|
||||||
|
allowMultiple(item) {
|
||||||
|
return item.rule === 'in'
|
||||||
|
},
|
||||||
|
|
||||||
|
handleRuleChange(item, newValue) {
|
||||||
|
let oldValue = item.rule
|
||||||
|
this.$set(item, 'rule', newValue)
|
||||||
|
// 上一个规则是否是 in,且type是字典或下拉
|
||||||
|
if (oldValue === 'in') {
|
||||||
|
if (item.dictCode || item.options instanceof Array) {
|
||||||
|
let value = item.val
|
||||||
|
if (typeof item.val === 'string') {
|
||||||
|
value = item.val.split(',')[0]
|
||||||
|
} else if (Array.isArray(item.val)) {
|
||||||
|
value = item.val[0]
|
||||||
|
}
|
||||||
|
this.$set(item, 'val', value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleChangeJPopup(item, e, values) {
|
||||||
|
item.val = values[item.popup['destFields']]
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
|
||||||
|
.j-super-query-box {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.j-super-query-modal {
|
||||||
|
|
||||||
|
.j-super-query-history-card {
|
||||||
|
/deep/ .ant-card-body,
|
||||||
|
/deep/ .ant-card-head-title {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .ant-card-head {
|
||||||
|
padding: 4px 8px;
|
||||||
|
min-height: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.j-super-query-history-empty {
|
||||||
|
/deep/ .ant-empty-image {
|
||||||
|
height: 80px;
|
||||||
|
line-height: 80px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ img {
|
||||||
|
width: 80px;
|
||||||
|
height: 65px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .ant-empty-description {
|
||||||
|
color: #afafaf;
|
||||||
|
margin: 8px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.j-super-query-history-tree {
|
||||||
|
|
||||||
|
.j-history-tree-title {
|
||||||
|
width: calc(100% - 24px);
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
&-closer {
|
||||||
|
color: #999999;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s, color 0.3s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.j-history-tree-title-closer {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .ant-tree-switcher {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/ .ant-tree-node-content-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/deep/ .ant-calendar-picker{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -72,6 +72,9 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
||||||
<a-col :md="6" :sm="24">
|
<a-col :md="6" :sm="24">
|
||||||
|
<globalAdvancedQuery ref="globalAdvancedQueryRef"
|
||||||
|
@handleSuperQuery="handleSuperQuery"
|
||||||
|
:fieldList="fieldList"/>
|
||||||
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
||||||
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
||||||
</a-col>
|
</a-col>
|
||||||
@@ -210,6 +213,7 @@
|
|||||||
import editModel from './editModel'
|
import editModel from './editModel'
|
||||||
import UpdateLog from '@/components/UpdateLog/index'
|
import UpdateLog from '@/components/UpdateLog/index'
|
||||||
import batSetting from './batSetting'
|
import batSetting from './batSetting'
|
||||||
|
import globalAdvancedQuery from '@/components/globalAdvancedQuery/index'
|
||||||
import { getAction, postAction, downloadFile } from '@/api/manage'
|
import { getAction, postAction, downloadFile } from '@/api/manage'
|
||||||
import { Base64 } from 'js-base64'
|
import { Base64 } from 'js-base64'
|
||||||
|
|
||||||
@@ -220,14 +224,15 @@
|
|||||||
addModel,
|
addModel,
|
||||||
editModel,
|
editModel,
|
||||||
UpdateLog,
|
UpdateLog,
|
||||||
batSetting
|
batSetting,
|
||||||
|
globalAdvancedQuery
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: '维护虚拟清单',
|
title: '维护虚拟清单',
|
||||||
queryParam: {},
|
queryParam: {},
|
||||||
visibleFile:false,
|
visibleFile: false,
|
||||||
dataSourceFile:[],
|
dataSourceFile: [],
|
||||||
columnsFile: [
|
columnsFile: [
|
||||||
{
|
{
|
||||||
title: this.$t('deliverableTemplate'),
|
title: this.$t('deliverableTemplate'),
|
||||||
@@ -445,7 +450,73 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
isTrue: false
|
isTrue: false,
|
||||||
|
queryParamQuery:{},
|
||||||
|
// fieldList | array |✔| 需要查询的列集合示例如下,type类型有:date/datetime/string/int/number
|
||||||
|
fieldList: [
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'shi4Yong4Fan4Wei2',
|
||||||
|
text: this.$t('scopeOfApplication'),
|
||||||
|
dictCode: 'apply_scope'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'status',
|
||||||
|
text: this.$t('status'),
|
||||||
|
dictCode: 'state'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
value: 'correspondingStandard',
|
||||||
|
text: this.$t('correspondingStandard')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'region',
|
||||||
|
text: this.$t('zoneOfApplication'),
|
||||||
|
dictCode: 'region'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'implementType',
|
||||||
|
text: this.$t('implementationCategory'),
|
||||||
|
dictCode: 'implement_type'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'xin1Che1Xing2Shi2Shi1Ri4Qi1',
|
||||||
|
text: this.$t('ImplementationDate')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'implementTime',
|
||||||
|
text: this.$t('vehicleInProductionDate')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
value: 'wvtaId',
|
||||||
|
text: 'WVTA ID'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '',
|
||||||
|
value: 'attestationType',
|
||||||
|
text: this.$t('certificationType'),
|
||||||
|
dictCode: 'attestation_type'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '',
|
||||||
|
value: 'attestationRank',
|
||||||
|
text: this.$t('certificationLevel'),
|
||||||
|
dictCode: 'attestation_rank'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '',
|
||||||
|
value: 'dutyTerritory',
|
||||||
|
text: this.$t('areaOfResponsibility'),
|
||||||
|
dictCode: 'duty_territory'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -468,6 +539,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleSuperQuery(params, matchType) {
|
||||||
|
let sqp = {}
|
||||||
|
if (!params || (params && params.length == 0)) {
|
||||||
|
sqp['superQueryParams'] = ''
|
||||||
|
this.$refs.globalAdvancedQueryRef.superQueryFlag = false
|
||||||
|
} else {
|
||||||
|
this.$refs.globalAdvancedQueryRef.superQueryFlag = true
|
||||||
|
sqp['superQueryParams'] = encodeURI(JSON.stringify(params))
|
||||||
|
sqp['superQueryMatchType'] = matchType
|
||||||
|
}
|
||||||
|
this.queryParamQuery = sqp
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
UpdateLogClick() {
|
UpdateLogClick() {
|
||||||
this.$refs.UpdateLogRef.getList()
|
this.$refs.UpdateLogRef.getList()
|
||||||
},
|
},
|
||||||
@@ -525,7 +609,8 @@
|
|||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
let query = {
|
let query = {
|
||||||
...this.queryParam
|
...this.queryParam,
|
||||||
|
...this.queryParamQuery
|
||||||
}
|
}
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getAction(this.url.list, query).then((res) => {
|
getAction(this.url.list, query).then((res) => {
|
||||||
@@ -648,7 +733,7 @@
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
||||||
<a-col :md="6" :sm="24">
|
<a-col :md="6" :sm="24">
|
||||||
|
<globalAdvancedQuery ref="globalAdvancedQueryRef"
|
||||||
|
@handleSuperQuery="handleSuperQuery"
|
||||||
|
:fieldList="fieldList"/>
|
||||||
<a-button class="box-button" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
|
<a-button class="box-button" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
|
||||||
<a-button class="box-button" style="margin-left: 8px"
|
<a-button class="box-button" style="margin-left: 8px"
|
||||||
@click="searchReset">{{ $t('reset') }}</a-button>
|
@click="searchReset">{{ $t('reset') }}</a-button>
|
||||||
@@ -240,6 +243,7 @@ import listAddModel from './listAddModel'
|
|||||||
import listEditModel from './listEditModel'
|
import listEditModel from './listEditModel'
|
||||||
import batSetting from './batSetting'
|
import batSetting from './batSetting'
|
||||||
import transferList from './transferList'
|
import transferList from './transferList'
|
||||||
|
import globalAdvancedQuery from '@/components/globalAdvancedQuery/index'
|
||||||
import {getAction, postAction, downloadFile, deleteAction} from '@/api/manage'
|
import {getAction, postAction, downloadFile, deleteAction} from '@/api/manage'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import {mapGetters} from 'vuex'
|
import {mapGetters} from 'vuex'
|
||||||
@@ -252,7 +256,8 @@ export default {
|
|||||||
listAddModel,
|
listAddModel,
|
||||||
listEditModel,
|
listEditModel,
|
||||||
batSetting,
|
batSetting,
|
||||||
transferList
|
transferList,
|
||||||
|
globalAdvancedQuery
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -475,6 +480,7 @@ export default {
|
|||||||
visibleFile: false,
|
visibleFile: false,
|
||||||
dataSourceFile: [],
|
dataSourceFile: [],
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
|
queryParamQuery:{},
|
||||||
isDisplay: true,
|
isDisplay: true,
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -504,7 +510,54 @@ export default {
|
|||||||
transferUrl: ''//调取
|
transferUrl: ''//调取
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
dataSource: []
|
dataSource: [],
|
||||||
|
// fieldList | array |✔| 需要查询的列集合示例如下,type类型有:date/datetime/string/int/number
|
||||||
|
fieldList: [
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
value: 'correspondingStandard',
|
||||||
|
text: this.$t('correspondingStandard')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'implementType',
|
||||||
|
text: this.$t('implementationCategory'),
|
||||||
|
dictCode: 'implement_type'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'xin1Che1Xing2Shi2Shi1Ri4Qi1',
|
||||||
|
text: this.$t('ImplementationDate')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'date',
|
||||||
|
value: 'implementTime',
|
||||||
|
text: this.$t('vehicleInProductionDate')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'string',
|
||||||
|
value: 'wvtaId',
|
||||||
|
text: 'WVTA ID'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '',
|
||||||
|
value: 'attestationType',
|
||||||
|
text: this.$t('certificationType'),
|
||||||
|
dictCode: 'attestation_type'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '',
|
||||||
|
value: 'attestationRank',
|
||||||
|
text: this.$t('certificationLevel'),
|
||||||
|
dictCode: 'attestation_rank'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: '',
|
||||||
|
value: 'dutyTerritory',
|
||||||
|
text: this.$t('areaOfResponsibility'),
|
||||||
|
dictCode: 'duty_territory'//只要 dictCode 有值,无论 type 是什么,都显示为字典下拉框
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -619,8 +672,22 @@ export default {
|
|||||||
addModelList() {
|
addModelList() {
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
|
handleSuperQuery(params, matchType) {
|
||||||
|
let sqp = {}
|
||||||
|
if (!params || (params && params.length == 0)) {
|
||||||
|
sqp['superQueryParams'] = ''
|
||||||
|
this.$refs.globalAdvancedQueryRef.superQueryFlag = false
|
||||||
|
} else {
|
||||||
|
this.$refs.globalAdvancedQueryRef.superQueryFlag = true
|
||||||
|
sqp['superQueryParams'] = encodeURI(JSON.stringify(params))
|
||||||
|
sqp['superQueryMatchType'] = matchType
|
||||||
|
}
|
||||||
|
this.queryParamQuery = sqp
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
getList() {
|
getList() {
|
||||||
let query = {
|
let query = {
|
||||||
|
...this.queryParamQuery,
|
||||||
...this.queryParam,
|
...this.queryParam,
|
||||||
projectLibraryId: this.$route.query.id
|
projectLibraryId: this.$route.query.id
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user