[update] 修改一般检索联调
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<a-input-search class="input-search"
|
<a-input-search class="input-search"
|
||||||
:placeholder="$t('pleaseEnter')+$t('dashboard.generalSearch.queryCondition')"
|
:placeholder="$t('pleaseEnter')+$t('dashboard.generalSearch.queryCondition')"
|
||||||
v-model="searchValue"
|
v-model="searchValue"
|
||||||
@search="onSearch(1)">
|
@search="onInputSearch()">
|
||||||
<a-button type="primary" slot="enterButton">
|
<a-button type="primary" slot="enterButton">
|
||||||
<i class="iconfont icon-Searchbar_Search_icon"></i>
|
<i class="iconfont icon-Searchbar_Search_icon"></i>
|
||||||
</a-button>
|
</a-button>
|
||||||
@@ -147,9 +147,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
|
||||||
this.initFilterData()
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 获取要显示数量的筛选条件的数据
|
// 获取要显示数量的筛选条件的数据
|
||||||
initFilterData () {
|
initFilterData () {
|
||||||
@@ -158,6 +155,8 @@ export default {
|
|||||||
param.resourceType = this.resourceTypeCurrent === 'all' ? null : this.resourceTypeCurrent
|
param.resourceType = this.resourceTypeCurrent === 'all' ? null : this.resourceTypeCurrent
|
||||||
// 检索方式
|
// 检索方式
|
||||||
param.searchMode = this.retrievalModeCurrent
|
param.searchMode = this.retrievalModeCurrent
|
||||||
|
// 检索内容
|
||||||
|
param.searchContent = this.searchValue
|
||||||
let func
|
let func
|
||||||
if (this.retrievalModeCurrent === '1') {
|
if (this.retrievalModeCurrent === '1') {
|
||||||
func = getSearchParamNumFullText
|
func = getSearchParamNumFullText
|
||||||
@@ -166,91 +165,47 @@ export default {
|
|||||||
}
|
}
|
||||||
func(param).then(res => {
|
func(param).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// res.result = {
|
// 设置对象key为搜索时需要传给后端的字段名,以及设置选项和字段label
|
||||||
// applications: [
|
|
||||||
// { itemText: 'N1', itemValue: 1, statisticsCount: 7 },
|
|
||||||
// { itemText: '汽油', itemValue: 2, statisticsCount: 0 },
|
|
||||||
// { itemText: '汽油', itemValue: 3, statisticsCount: 0 },
|
|
||||||
// { itemText: '汽油', itemValue: 4, statisticsCount: 0 },
|
|
||||||
// { itemText: '汽油', itemValue: 5, statisticsCount: 0 },
|
|
||||||
// { itemText: '汽油', itemValue: 6, statisticsCount: 0 }
|
|
||||||
// ],
|
|
||||||
// enterpriseStandardCode: [],
|
|
||||||
// enterpriseStandardState: [],
|
|
||||||
// powerTypeDomestic: [],
|
|
||||||
// standardGradeClassify: [],
|
|
||||||
// standardProperty: [],
|
|
||||||
// standardState: [],
|
|
||||||
// standardType: []
|
|
||||||
// }
|
|
||||||
// 设置对象key为搜索时需要穿给后端的字段名,以及设置选项和字段label
|
|
||||||
for (const item in res.result) {
|
for (const item in res.result) {
|
||||||
res.result[item].unshift({ itemText: this.$t('dashboard.generalSearch.all'), itemValue: 'all' })
|
if (res.result) {
|
||||||
// 适用车辆类型
|
let label = ''
|
||||||
if (item === 'applications' && res.result[item] && res.result[item].length > 0) {
|
if (item === 'applicableVehicle') {
|
||||||
this.selectOptions.applicableVehicle = {
|
// 适用车辆类型
|
||||||
options: res.result[item],
|
label = this.$t('dashboard.generalSearch.applicableVehicleType')
|
||||||
label: this.$t('dashboard.generalSearch.applicableVehicleType'),
|
} else if (item === 'dynamicType') {
|
||||||
current: 'all'
|
// 动力类型
|
||||||
|
label = this.$t('dashboard.generalSearch.dynamicType')
|
||||||
|
} else if (item === 'enterpriseStandardState') {
|
||||||
|
// 标准状态
|
||||||
|
label = this.$t('dashboard.generalSearch.standardState')
|
||||||
|
} else if (item === 'gradeClassification') {
|
||||||
|
// 标准等级分类
|
||||||
|
label = this.$t('dashboard.generalSearch.standardGradeClassification')
|
||||||
|
} else if (item === 'standardClass') {
|
||||||
|
// 标准类别
|
||||||
|
label = this.$t('dashboard.generalSearch.standardClass')
|
||||||
|
} else if (item === 'standardCode') {
|
||||||
|
// 企业标准代号
|
||||||
|
label = this.$t('dashboard.generalSearch.enterpriseStandardCode')
|
||||||
|
} else if (item === 'standardProperty') {
|
||||||
|
// 标准类型
|
||||||
|
label = this.$t('dashboard.generalSearch.standardType')
|
||||||
|
} else if (item === 'standardState') {
|
||||||
|
// 状态
|
||||||
|
label = this.$t('dashboard.generalSearch.state')
|
||||||
}
|
}
|
||||||
}
|
res.result[item].unshift({ itemText: this.$t('dashboard.generalSearch.all'), itemValue: 'all' })
|
||||||
// 企业标准代号
|
this.selectOptions[item] = {
|
||||||
if (item === 'enterpriseStandardCode' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.standardCode = {
|
|
||||||
options: res.result[item],
|
options: res.result[item],
|
||||||
label: this.$t('dashboard.generalSearch.enterpriseStandardCode'),
|
label: label,
|
||||||
current: 'all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 标准状态
|
|
||||||
if (item === 'enterpriseStandardState' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.enterpriseStandardState = {
|
|
||||||
options: res.result[item],
|
|
||||||
label: this.$t('dashboard.generalSearch.standardState'),
|
|
||||||
current: 'all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 动力类型
|
|
||||||
if (item === 'powerTypeDomestic' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.dynamicType = {
|
|
||||||
options: res.result[item],
|
|
||||||
label: this.$t('dashboard.generalSearch.dynamicType'),
|
|
||||||
current: 'all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 标准等级分类
|
|
||||||
if (item === 'standardGradeClassify' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.gradeClassification = {
|
|
||||||
options: res.result[item],
|
|
||||||
label: this.$t('dashboard.generalSearch.standardGradeClassification'),
|
|
||||||
current: 'all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 标准类型
|
|
||||||
if (item === 'standardProperty' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.standardProperty = {
|
|
||||||
options: res.result[item],
|
|
||||||
label: this.$t('dashboard.generalSearch.standardType'),
|
|
||||||
current: 'all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 状态
|
|
||||||
if (item === 'standardState' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.standardState = {
|
|
||||||
options: res.result[item],
|
|
||||||
label: this.$t('dashboard.generalSearch.state'),
|
|
||||||
current: 'all'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 标准类别
|
|
||||||
if (item === 'standardType' && res.result[item] && res.result[item].length > 0) {
|
|
||||||
this.selectOptions.standardClass = {
|
|
||||||
options: res.result[item],
|
|
||||||
label: this.$t('dashboard.generalSearch.standardClass'),
|
|
||||||
current: 'all'
|
current: 'all'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.selectOptions = Object.assign({}, this.selectOptions)
|
||||||
|
} else {
|
||||||
|
this.$message.warning(res.message)
|
||||||
|
this.selectOptions = {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -265,7 +220,7 @@ export default {
|
|||||||
param.searchContent = this.searchValue
|
param.searchContent = this.searchValue
|
||||||
// 其他筛选条件
|
// 其他筛选条件
|
||||||
for (const item in this.selectOptions) {
|
for (const item in this.selectOptions) {
|
||||||
param[item] = this.selectOptions[item].current
|
param[item] = this.selectOptions[item].current === 'all' ? null : this.selectOptions[item].current
|
||||||
}
|
}
|
||||||
// 分页
|
// 分页
|
||||||
param.pageNo = this.ipagination.current
|
param.pageNo = this.ipagination.current
|
||||||
@@ -313,23 +268,34 @@ export default {
|
|||||||
this.ipagination.pageSize = size
|
this.ipagination.pageSize = size
|
||||||
this.onSearch()
|
this.onSearch()
|
||||||
},
|
},
|
||||||
|
onInputSearch () {
|
||||||
|
this.onSearch(1)
|
||||||
|
if (this.resourceTypeCurrent !== 'all') {
|
||||||
|
this.initFilterData()
|
||||||
|
}
|
||||||
|
},
|
||||||
// 检索方式改变
|
// 检索方式改变
|
||||||
retrievalModeChange (key) {
|
retrievalModeChange (key) {
|
||||||
this.retrievalModeCurrent = key
|
this.retrievalModeCurrent = key
|
||||||
// 更新其他筛选项的数据
|
// 更新其他筛选项的数据
|
||||||
this.initFilterData()
|
if (this.resourceTypeCurrent !== 'all') {
|
||||||
|
this.initFilterData()
|
||||||
|
}
|
||||||
this.onSearch()
|
this.onSearch()
|
||||||
},
|
},
|
||||||
// 资源类型改变
|
// 资源类型改变
|
||||||
resourceTypeChange (key) {
|
resourceTypeChange (key) {
|
||||||
this.resourceTypeCurrent = key
|
this.resourceTypeCurrent = key
|
||||||
// 更新其他筛选项的数据
|
// 更新其他筛选项的数据
|
||||||
this.initFilterData()
|
if (key !== 'all') {
|
||||||
|
this.initFilterData()
|
||||||
|
}
|
||||||
this.onSearch()
|
this.onSearch()
|
||||||
},
|
},
|
||||||
// 其他检索条件改变
|
// 其他检索条件改变
|
||||||
selectOptionsChange (changeKey, value) {
|
selectOptionsChange (changeKey, value) {
|
||||||
this.selectOptions[changeKey].current = value
|
this.selectOptions[changeKey].current = value
|
||||||
|
this.onSearch(1)
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
// 收齐展开点击
|
// 收齐展开点击
|
||||||
|
|||||||
Reference in New Issue
Block a user