[update] 修改一般检索联调

This commit is contained in:
lideqin
2023-11-16 17:07:09 +08:00
parent 816477c861
commit 0f8054e9c5
+51 -85
View File
@@ -7,7 +7,7 @@
<a-input-search class="input-search"
:placeholder="$t('pleaseEnter')+$t('dashboard.generalSearch.queryCondition')"
v-model="searchValue"
@search="onSearch(1)">
@search="onInputSearch()">
<a-button type="primary" slot="enterButton">
<i class="iconfont icon-Searchbar_Search_icon"></i>
</a-button>
@@ -147,9 +147,6 @@ export default {
}
}
},
mounted () {
this.initFilterData()
},
methods: {
// 获取要显示数量的筛选条件的数据
initFilterData () {
@@ -158,6 +155,8 @@ export default {
param.resourceType = this.resourceTypeCurrent === 'all' ? null : this.resourceTypeCurrent
// 检索方式
param.searchMode = this.retrievalModeCurrent
// 检索内容
param.searchContent = this.searchValue
let func
if (this.retrievalModeCurrent === '1') {
func = getSearchParamNumFullText
@@ -166,91 +165,47 @@ export default {
}
func(param).then(res => {
if (res.success) {
// res.result = {
// 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
// 设置对象key为搜索时需要传给后端的字段名,以及设置选项和字段label
for (const item in res.result) {
res.result[item].unshift({ itemText: this.$t('dashboard.generalSearch.all'), itemValue: 'all' })
// 适用车辆类型
if (item === 'applications' && res.result[item] && res.result[item].length > 0) {
this.selectOptions.applicableVehicle = {
options: res.result[item],
label: this.$t('dashboard.generalSearch.applicableVehicleType'),
current: 'all'
if (res.result) {
let label = ''
if (item === 'applicableVehicle') {
// 适用车辆类型
label = this.$t('dashboard.generalSearch.applicableVehicleType')
} else if (item === 'dynamicType') {
// 动力类型
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')
}
}
// 企业标准代号
if (item === 'enterpriseStandardCode' && res.result[item] && res.result[item].length > 0) {
this.selectOptions.standardCode = {
res.result[item].unshift({ itemText: this.$t('dashboard.generalSearch.all'), itemValue: 'all' })
this.selectOptions[item] = {
options: res.result[item],
label: this.$t('dashboard.generalSearch.enterpriseStandardCode'),
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'),
label: label,
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
// 其他筛选条件
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
@@ -313,23 +268,34 @@ export default {
this.ipagination.pageSize = size
this.onSearch()
},
onInputSearch () {
this.onSearch(1)
if (this.resourceTypeCurrent !== 'all') {
this.initFilterData()
}
},
// 检索方式改变
retrievalModeChange (key) {
this.retrievalModeCurrent = key
// 更新其他筛选项的数据
this.initFilterData()
if (this.resourceTypeCurrent !== 'all') {
this.initFilterData()
}
this.onSearch()
},
// 资源类型改变
resourceTypeChange (key) {
this.resourceTypeCurrent = key
// 更新其他筛选项的数据
this.initFilterData()
if (key !== 'all') {
this.initFilterData()
}
this.onSearch()
},
// 其他检索条件改变
selectOptionsChange (changeKey, value) {
this.selectOptions[changeKey].current = value
this.onSearch(1)
this.$forceUpdate()
},
// 收齐展开点击