feat:【system】优化字典的 dictType 查询,支持重置
This commit is contained in:
@@ -91,7 +91,6 @@ const loadMoreState = ref<LoadMoreState>('loading')
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
dictType: undefined as string | undefined,
|
||||
})
|
||||
|
||||
/** 颜色类型 => wd-tag 的 type 映射,和 src/components/dict-tag/dict-tag.vue 是一致的 */
|
||||
@@ -111,11 +110,6 @@ function getTagType(colorType: string): TagType {
|
||||
|
||||
/** 查询列表 */
|
||||
async function getList() {
|
||||
if (!queryParams.value.dictType) {
|
||||
list.value = []
|
||||
loadMoreState.value = 'finished'
|
||||
return
|
||||
}
|
||||
loadMoreState.value = 'loading'
|
||||
try {
|
||||
const data = await getDictDataPage(queryParams.value)
|
||||
@@ -134,7 +128,6 @@ function handleQuery(data?: Record<string, any>) {
|
||||
...data,
|
||||
pageNo: 1,
|
||||
pageSize: queryParams.value.pageSize,
|
||||
dictType: data?.dictType || props.dictType,
|
||||
}
|
||||
list.value = []
|
||||
getList()
|
||||
@@ -174,7 +167,6 @@ watch(
|
||||
() => {
|
||||
if (props.dictType) {
|
||||
queryParams.value.pageNo = 1
|
||||
queryParams.value.dictType = props.dictType
|
||||
list.value = []
|
||||
getList()
|
||||
}
|
||||
@@ -188,7 +180,6 @@ onReachBottom(() => {
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
queryParams.value.dictType = props.dictType
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -121,7 +121,7 @@ function handleSearch() {
|
||||
|
||||
/** 重置 */
|
||||
function handleReset() {
|
||||
formData.dictType = props.dictType
|
||||
formData.dictType = undefined
|
||||
formData.label = undefined
|
||||
formData.status = -1
|
||||
visible.value = false
|
||||
|
||||
Reference in New Issue
Block a user