diff --git a/src/components/customField/Search.vue b/src/components/customField/Search.vue index e60a29bd..e7dafe1a 100644 --- a/src/components/customField/Search.vue +++ b/src/components/customField/Search.vue @@ -307,6 +307,14 @@ export default { type: String, required: false, default: null + }, + // 默认的查询条件 + defaultSearchParams: { + type: Object, + required: false, + default: () => { + return {} + } } // searchQueryList: { // type: Array, @@ -331,6 +339,9 @@ export default { optionsData: {} // 用接口获取到的下拉数据 } }, + created () { + this.queryParam = Object.assign({}, this.defaultSearchParams) + }, mounted () { this.getSysCategoryTree() this.getSearch() @@ -352,7 +363,8 @@ export default { eventBus.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam))) }, searchReset () { - this.queryParam = {} + this.queryParam = Object.assign({}, this.defaultSearchParams) + console.log(this.defaultSearchParams, this.queryParam) this.$emit('reset', JSON.parse(JSON.stringify(this.queryParam))) eventBus.$emit('searchQuery', JSON.parse(JSON.stringify(this.queryParam))) }, @@ -378,6 +390,9 @@ export default { this.getQueryConditionFunc(params).then((res) => { if (res.success) { this.searchList = res.result + // 标准状态特殊处理成多选 + const standardStateIndex = this.searchList.findIndex(item => item.dbFieldName === 'standard_state') + this.searchList[standardStateIndex].fieldShowType = FieldType.OPTION_MORE.value this.getOptionsData() // 获取下拉数据 console.log(this.searchList) } diff --git a/src/mixins/ConfigurableTableMixin.js b/src/mixins/ConfigurableTableMixin.js index 4b5cf7a2..0cf8d5b3 100644 --- a/src/mixins/ConfigurableTableMixin.js +++ b/src/mixins/ConfigurableTableMixin.js @@ -59,7 +59,8 @@ export const ConfigurableTableMixin = { getTableHeaderFunc: null, // 获取表头的方法 tableSlotField: [], // 表格需要使用插槽的字段,dbFieldName disabledMixinsCreate: false, - isBackTitle: false // 是否是详情页有返回的标题 + isBackTitle: false, // 是否是详情页有返回的标题 + defaultSearchParams: {} } }, computed: { @@ -81,6 +82,7 @@ export const ConfigurableTableMixin = { if (this.disabledMixinsCreate) { return } + this.searchParams = Object.assign({}, this.defaultSearchParams) this.getTableHeader() this.loadData() // 过滤没有权限的按钮 diff --git a/src/views/dashboard/search/AdvancedSearch.vue b/src/views/dashboard/search/AdvancedSearch.vue index da1b74b9..120ef43b 100644 --- a/src/views/dashboard/search/AdvancedSearch.vue +++ b/src/views/dashboard/search/AdvancedSearch.vue @@ -153,7 +153,7 @@