init
This commit is contained in:
@@ -0,0 +1,394 @@
|
||||
<template>
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="6" :sm="8" v-for="(item,index) in searchList" :key="index" style="line-height: 48px">
|
||||
<template v-if="index < 3">
|
||||
<!-- 树形选择器 -->
|
||||
<div class="box-title-text" v-if="item.field_show_type === FieldType.TREE.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
class="box-input"
|
||||
v-model="queryParam[item.db_field_name]"
|
||||
:maxTagCount="1"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
:tree-data="item.tree"
|
||||
tree-checkable
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt"
|
||||
/>
|
||||
</div>
|
||||
<!-- 输入框 -->
|
||||
<div class="box-title-text"
|
||||
v-else-if="[FieldType.TEXT_STRING.value, FieldType.TEXT.value,FieldType.PERSON.value,
|
||||
FieldType.STANDARD.value, FieldType.TEXT_LINK.value].includes(item.field_show_type)">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-input class="box-input" :placeholder="$t('pleaseEnter')+item.db_field_txt"
|
||||
v-model="queryParam[item.db_field_name]"></a-input>
|
||||
</div>
|
||||
<!-- 数字输入框 -->
|
||||
<div class="box-title-text" v-else-if="item.field_show_type === FieldType.TEXT_NUMBER.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-input-number class="box-input" :placeholder="$t('pleaseEnter')+item.db_field_txt"
|
||||
v-model="queryParam[item.db_field_name]" :min="1" :max="99999999"/>
|
||||
</div>
|
||||
<!-- 字典多选框 -->
|
||||
<div class="box-title-text" v-else-if="item.field_show_type === FieldType.PULL_MORE.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<j-multi-select-tag class="box-input" v-model="queryParam[item.db_field_name]"
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt" :type="'select'"
|
||||
:triggerChange="false" :dictCode="item.dict_field"/>
|
||||
</div>
|
||||
<!-- 日期区间 -->
|
||||
<div class="box-title-text" v-else-if="[FieldType.DATE_SINGLE.value, FieldType.DATE_MORE.value].includes(item.field_show_type)">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-range-picker class="box-input" v-model="queryParam[item.db_field_name]"
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt"
|
||||
format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||
@change="onChange(item.db_field_name)"></a-range-picker>
|
||||
</div>
|
||||
<!-- 字典单选框 -->
|
||||
<div class="box-title-text" v-else-if="item.field_show_type === FieldType.PULL_SINGLE.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<j-dict-select-tag class="box-input" v-model="queryParam[item.db_field_name]"
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt"
|
||||
:type="'select'"
|
||||
:triggerChange="false" :dictCode="item.dict_field"/>
|
||||
</div>
|
||||
<!-- 单选框 -->
|
||||
<!-- <div class="box-title-text" v-else-if="item.field_show_type === '12'">-->
|
||||
<!-- <div class="title-text" :title="item.db_field_txt">-->
|
||||
<!-- <span>{{item.db_field_txt}}</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <a-select :placeholder="$t('pleaseSelect')+item.db_field_txt"-->
|
||||
<!-- class="box-input"-->
|
||||
<!-- :getPopupContainer="triggerNode=> triggerNode.parentNode"-->
|
||||
<!-- allowClear-->
|
||||
<!-- v-model="queryParam[item.db_field_name]">-->
|
||||
<!-- <a-select-option v-for="(item, key) in item.option"-->
|
||||
<!-- :key="key"-->
|
||||
<!-- :value="item.value">-->
|
||||
<!-- <span style="display: inline-block;width: 100%" :title=" item.name">-->
|
||||
<!-- {{ item.name }}-->
|
||||
<!-- </span>-->
|
||||
<!-- </a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
<template v-if="index >= 3 && toggleSearchStatus">
|
||||
<div class="box-title-text" v-if="item.field_show_type === FieldType.TREE.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-tree-select
|
||||
tree-node-filter-prop="title"
|
||||
class="box-input"
|
||||
v-model="queryParam[item.db_field_name]"
|
||||
:maxTagCount="1"
|
||||
:getPopupContainer="triggerNode=> triggerNode.parentNode"
|
||||
:tree-data="item.tree"
|
||||
tree-checkable
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt"
|
||||
/>
|
||||
</div>
|
||||
<div class="box-title-text" v-else-if="[FieldType.TEXT_STRING.value, FieldType.TEXT.value,FieldType.PERSON.value,
|
||||
FieldType.STANDARD.value, FieldType.TEXT_LINK.value].includes(item.field_show_type)">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-input class="box-input" :placeholder="$t('pleaseEnter')+item.db_field_txt"
|
||||
v-model="queryParam[item.db_field_name]"></a-input>
|
||||
</div>
|
||||
<div class="box-title-text" v-else-if="item.field_show_type === FieldType.TEXT_NUMBER.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-input-number class="box-input" :placeholder="$t('pleaseEnter')+item.db_field_txt"
|
||||
v-model="queryParam[item.db_field_name]" :min="1" :max="99999999"/>
|
||||
</div>
|
||||
<div class="box-title-text" v-else-if="item.field_show_type === FieldType.PULL_MORE.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<j-multi-select-tag class="box-input" v-model="queryParam[item.db_field_name]"
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt" :type="'select'"
|
||||
:triggerChange="false" :dictCode="item.dict_field"/>
|
||||
</div>
|
||||
<div class="box-title-text" v-else-if="[FieldType.DATE_SINGLE.value, FieldType.DATE_MORE.value].includes(item.field_show_type)">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<a-range-picker class="box-input" v-model="queryParam[item.db_field_name]"
|
||||
format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||
@change="onChange(item.db_field_name)"></a-range-picker>
|
||||
</div>
|
||||
<div class="box-title-text" v-else-if="item.field_show_type === FieldType.PULL_SINGLE.value">
|
||||
<div class="title-text" :title="item.db_field_txt">
|
||||
<span>{{item.db_field_txt}}</span>
|
||||
</div>
|
||||
<j-dict-select-tag class="box-input" v-model="queryParam[item.db_field_name]"
|
||||
:placeholder="$t('pleaseSelect')+item.db_field_txt"
|
||||
:type="'select'"
|
||||
:triggerChange="false" :dictCode="item.dict_field"/>
|
||||
</div>
|
||||
<!-- <div class="box-title-text" v-else-if="item.field_show_type === '12'">-->
|
||||
<!-- <div class="title-text" :title="item.db_field_txt">-->
|
||||
<!-- <span>{{item.db_field_txt}}</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <a-select :placeholder="$t('pleaseSelect')+item.db_field_txt"-->
|
||||
<!-- class="box-input"-->
|
||||
<!-- :getPopupContainer="triggerNode=> triggerNode.parentNode"-->
|
||||
<!-- allowClear-->
|
||||
<!-- v-model="queryParam[item.db_field_name]">-->
|
||||
<!-- <a-select-option v-for="(item, key) in item.option"-->
|
||||
<!-- :key="key"-->
|
||||
<!-- :value="item.value">-->
|
||||
<!-- <span style="display: inline-block;width: 100%" :title=" item.name">-->
|
||||
<!-- {{ item.name }}-->
|
||||
<!-- </span>-->
|
||||
<!-- </a-select-option>-->
|
||||
<!-- </a-select>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
</a-col>
|
||||
<span style="float: right;overflow: hidden;margin-right: 11px" class="table-page-search-submitButtons">
|
||||
<a-col :md="6" :sm="24">
|
||||
<a @click="handleToggleSearch" v-if="searchList.length > 3">
|
||||
{{ !toggleSearchStatus ? $t('open') : $t('putAway') }}
|
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
|
||||
</a>
|
||||
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
|
||||
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
|
||||
</a-col>
|
||||
</span>
|
||||
</a-row>
|
||||
</a-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import JDictSelectTag from '../dict/JDictSelectTag'
|
||||
import JMultiSelectTag from '../dict/JMultiSelectTag'
|
||||
import { FieldType } from '../../enums/commonEnums'
|
||||
|
||||
export default {
|
||||
name: 'Search',
|
||||
components: { JDictSelectTag, JMultiSelectTag },
|
||||
props: {
|
||||
url: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
flag: { // 暂时不清楚flag的用处,是要查searchList的时候传给后端的
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
searchQueryList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
FieldType,
|
||||
queryParam: {},
|
||||
toggleSearchStatus: false,
|
||||
searchList: []
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
// this.getSearch()
|
||||
this.searchList = [
|
||||
{
|
||||
db_field_name: 'serial_number',
|
||||
db_field_txt: '编号',
|
||||
dict_field: '',
|
||||
field_show_type: '1',
|
||||
tree: []
|
||||
},
|
||||
{
|
||||
db_field_name: 'title',
|
||||
db_field_txt: '标题',
|
||||
dict_field: '',
|
||||
field_show_type: '1',
|
||||
tree: []
|
||||
},
|
||||
{
|
||||
db_field_name: 'state',
|
||||
db_field_txt: '状态',
|
||||
dict_field: 'state',
|
||||
field_show_type: '3',
|
||||
tree: []
|
||||
},
|
||||
{
|
||||
db_field_name: 'region',
|
||||
db_field_txt: '适用地区',
|
||||
dict_field: 'region',
|
||||
field_show_type: '4',
|
||||
tree: []
|
||||
},
|
||||
// {
|
||||
// db_field_name: 'technology_territory',
|
||||
// db_field_txt: '技术领域',
|
||||
// dict_field: 'technology_territory',
|
||||
// field_show_type: '0',
|
||||
// tree: []
|
||||
// },
|
||||
{
|
||||
db_field_name: 'issue_time',
|
||||
db_field_txt: '发布日期',
|
||||
dict_field: '',
|
||||
field_show_type: '5',
|
||||
tree: []
|
||||
},
|
||||
{
|
||||
db_field_name: 'xin1_che1_xing2_shi2_shi1_ri4_qi1',
|
||||
db_field_txt: '新车型实施日期',
|
||||
dict_field: '',
|
||||
field_show_type: '5',
|
||||
tree: []
|
||||
},
|
||||
{
|
||||
db_field_name: 'implement_time',
|
||||
db_field_txt: '在产车实施日期',
|
||||
dict_field: '',
|
||||
field_show_type: '5',
|
||||
tree: []
|
||||
}
|
||||
]
|
||||
},
|
||||
methods: {
|
||||
searchQuery () {
|
||||
this.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam)))
|
||||
},
|
||||
searchReset () {
|
||||
this.queryParam = {}
|
||||
this.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam)))
|
||||
},
|
||||
// 获取查询条件列表
|
||||
getSearch () {
|
||||
const params = {
|
||||
flag: this.flag
|
||||
}
|
||||
getAction(this.url.getSearchList, params).then((res) => {
|
||||
if (res.success) {
|
||||
this.searchList = res.result
|
||||
if (this.searchQueryList && this.searchQueryList.length > 0) {
|
||||
for (let i = 0; i < this.searchList.length; i++) {
|
||||
if (this.searchList[i].db_field_name === 'issue_time') {
|
||||
this.searchList.splice(i, 1)
|
||||
i--
|
||||
}
|
||||
// db_field_name 说明可以被代替位置??
|
||||
if (this.searchList[i].db_field_name === 'title') {
|
||||
const data = this.searchList[i + 1]
|
||||
this.searchList[i + 1] = this.searchQueryList[0]
|
||||
this.searchList.push(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
onChange (item) {
|
||||
if (this.queryParam[item] && this.queryParam[item].length > 0) {
|
||||
const startDate = item + '_start'
|
||||
const endDate = item + '_end'
|
||||
this.queryParam[startDate] = this.queryParam[item][0]
|
||||
this.queryParam[endDate] = this.queryParam[item][1]
|
||||
} else {
|
||||
this.queryParam[item] = []
|
||||
}
|
||||
},
|
||||
handleToggleSearch () {
|
||||
this.toggleSearchStatus = !this.toggleSearchStatus
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.box-title-text {
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
.title-text {
|
||||
width: 110px;
|
||||
color: #000F16;
|
||||
display: inline-block;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
margin-right: 16px;
|
||||
margin-top: 3px;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.box-input {
|
||||
/*min-width: 200px;*/
|
||||
display: inline-block;
|
||||
width: calc(100% - 116px);
|
||||
height: 38px;
|
||||
margin-top: 2px;
|
||||
/deep/ .ant-select-selection--single {
|
||||
height: 38px;
|
||||
}
|
||||
/deep/ .ant-select-selection--multiple {
|
||||
height: 38px;
|
||||
.ant-select-selection__rendered > ul > li {
|
||||
margin-top: 6px;
|
||||
}
|
||||
}
|
||||
/deep/ .ant-select-selection__rendered {
|
||||
line-height: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
/deep/ .ant-calendar-picker {
|
||||
line-height: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
/deep/ .ant-calendar-picker-input {
|
||||
height: 38px;
|
||||
}
|
||||
/deep/ .ant-input-number-input-wrap {
|
||||
line-height: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
.box-button {
|
||||
height: 38px;
|
||||
/*margin-top: 2px;*/
|
||||
}
|
||||
|
||||
/deep/ .ant-select-tree {
|
||||
width: auto;
|
||||
height: 300px;
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
/*background: #fff;*/
|
||||
}
|
||||
|
||||
/deep/ .ant-select-tree-dropdown {
|
||||
min-height: 320px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user