chore: 🔨 默认过滤禁用数据 (#157)

[skip ci]

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
2024-07-11 16:17:15 +08:00
committed by GitHub
parent 6d4ccf3445
commit 60ec6ea2c1
11 changed files with 101 additions and 21 deletions

View File

@ -65,7 +65,7 @@ import config from '@/config/tableSelect'
export default {
props: {
modelValue: null,
apiObj: {
queryApi: {
type: Object,
default: () => {},
},
@ -143,7 +143,7 @@ export default {
[this.defaultProps.keyword]: this.keyword,
}
Object.assign(reqData, this.params, this.formData)
const res = await this.apiObj.post(reqData)
const res = await this.queryApi.post(reqData)
const parseData = config.parseData(res)
this.tableData = parseData.rows ?? []
this.total = parseData.total

View File

@ -19,12 +19,7 @@
</el-header>
<el-header>
<div class="left-panel">
<na-search
:controls="[]"
:vue="this"
@reset="Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))"
@search="onSearch"
ref="search" />
<na-search :controls="[]" :vue="this" @reset="onReset" @search="onSearch" ref="search" />
</div>
<div class="right-panel">
<el-button @click="this.dialog.save = { mode: 'add' }" icon="el-icon-plus" type="primary"></el-button>
@ -122,6 +117,11 @@ export default {
if (this.keywords) {
this.query.keywords = this.keywords
}
this.query.dynamicFilter.filters.push({
field: 'enabled',
operator: 'eq',
value: true,
})
},
data() {
return {
@ -189,6 +189,12 @@ export default {
}
this.$refs.table.refresh()
},
//重置
onReset() {
Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))
this.$refs.selectFilter.selected['enabled'] = [true]
},
//搜索
onSearch(form) {
if (Array.isArray(form.dy.createdTime)) {
this.query.dynamicFilter.filters.push({
@ -218,6 +224,12 @@ export default {
type: 'root',
})
}
this.$refs.search.keeps.push({
field: 'enabled',
value: true,
type: 'dy',
})
this.onReset()
},
props: ['keywords'],
watch: {},

View File

@ -29,7 +29,7 @@
},
]"
:vue="this"
@reset="Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))"
@reset="onReset"
@search="onSearch"
ref="search" />
</div>
@ -128,6 +128,11 @@ export default {
if (this.keywords) {
this.query.keywords = this.keywords
}
this.query.dynamicFilter.filters.push({
field: 'enabled',
operator: 'eq',
value: true,
})
},
data() {
return {
@ -195,6 +200,12 @@ export default {
}
this.$refs.table.refresh()
},
//重置
onReset() {
Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))
this.$refs.selectFilter.selected['enabled'] = [true]
},
//搜索
onSearch(form) {
if (Array.isArray(form.dy.createdTime)) {
this.query.dynamicFilter.filters.push({
@ -224,6 +235,12 @@ export default {
type: 'root',
})
}
this.$refs.search.keeps.push({
field: 'enabled',
value: true,
type: 'dy',
})
this.onReset()
},
props: ['keywords'],
watch: {},

View File

@ -48,7 +48,7 @@
},
]"
:vue="this"
@reset="Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))"
@reset="onReset"
@search="onSearch"
ref="search" />
</div>
@ -228,6 +228,11 @@ export default {
if (this.keywords || this.$route.query.keywords) {
this.query.keywords = this.keywords || this.$route.query.keywords
}
this.query.dynamicFilter.filters.push({
field: 'enabled',
operator: 'eq',
value: true,
})
},
data() {
return {
@ -319,6 +324,12 @@ export default {
}
this.$refs.table.refresh()
},
//重置
onReset() {
Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))
this.$refs.selectFilter.selected['enabled'] = [true]
},
//搜索
onSearch(form) {
if (Array.isArray(form.dy.createdTime)) {
this.query.dynamicFilter.filters.push({
@ -363,6 +374,12 @@ export default {
type: 'root',
})
}
this.$refs.search.keeps.push({
field: 'enabled',
value: true,
type: 'dy',
})
this.onReset()
},
props: ['keywords'],
watch: {},

View File

@ -47,7 +47,7 @@
},
]"
:vue="this"
@reset="Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))"
@reset="onReset"
@search="onSearch"
ref="search" />
</div>
@ -174,6 +174,11 @@ export default {
if (this.keywords) {
this.query.keywords = this.keywords
}
this.query.dynamicFilter.filters.push({
field: 'enabled',
operator: 'eq',
value: true,
})
},
data() {
return {
@ -265,6 +270,12 @@ export default {
}
this.$refs.table.refresh()
},
//重置
onReset() {
Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))
this.$refs.selectFilter.selected['enabled'] = [true]
},
//搜索
onSearch(form) {
if (Array.isArray(form.dy.createdTime)) {
this.query.dynamicFilter.filters.push({
@ -309,6 +320,12 @@ export default {
type: 'root',
})
}
this.$refs.search.keeps.push({
field: 'enabled',
value: true,
type: 'dy',
})
this.onReset()
},
props: ['keywords'],
watch: {},

View File

@ -45,7 +45,7 @@
},
]"
:vue="this"
@reset="Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))"
@reset="onReset"
@search="onSearch"
ref="search" />
</div>
@ -158,6 +158,11 @@ export default {
if (this.deptId) {
this.query.filter.deptId = this.deptId
}
this.query.dynamicFilter.filters.push({
field: 'enabled',
operator: 'eq',
value: true,
})
},
data() {
return {
@ -216,6 +221,12 @@ export default {
})
this.$refs.search.search()
},
//重置
onReset() {
Object.entries(this.$refs.selectFilter.selected).forEach(([key, _]) => (this.$refs.selectFilter.selected[key] = ['']))
this.$refs.selectFilter.selected['enabled'] = [true]
},
//搜索
onSearch(form) {
if (Array.isArray(form.dy.createdTime)) {
this.query.dynamicFilter.filters.push({
@ -245,6 +256,12 @@ export default {
type: 'root',
})
}
this.$refs.search.keeps.push({
field: 'enabled',
value: true,
type: 'dy',
})
this.onReset()
},
props: ['keywords', 'roleId', 'deptId'],
watch: {},