Skip to content

Commit

Permalink
Merge pull request #196 from People-Sea/main
Browse files Browse the repository at this point in the history
fix(dict): Optimized dictionary loading and synchronization of pagina…
  • Loading branch information
kanyxmo authored Jul 3, 2024
2 parents ad20829 + 616bcec commit 1ef9aec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
10 changes: 4 additions & 6 deletions src/components/ma-crud/components/searchFormItem/form-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if ( props.component.multiple === true ) {
if (isObject(props.component.dict)) {
props.component.dict.pageOption = {
page: 1,
pageSize: props.component?.dict?.pageSize ?? 15
pageSize: props.component?.dict?.pageOption?.pageSize ?? props.component?.dict?.pageSize ?? 15
}
}

Expand Down Expand Up @@ -108,6 +108,9 @@ const handlePage = async (page) => {

watch( () => get(searchForm.value, props.component.dataIndex), vl => value.value = vl )
watch( () => value.value, v => set(searchForm.value, props.component.dataIndex, v) )
watch( () => dicts.value[dictIndex] , async v => {
dataTotal.value = v?.pageInfo?.total || 0
})

const handlerChangeeEvent = (value) => {
handlerCascader(
Expand All @@ -116,10 +119,5 @@ const handlerChangeeEvent = (value) => {
}

onMounted(() => {
setTimeout(() => {
if (isObject(dicts.value[dictIndex])) {
dataTotal.value = dicts.value[dictIndex]?.pageInfo?.total
}
}, 3000);
})
</script>
11 changes: 4 additions & 7 deletions src/components/ma-form/formItem/form-select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const props = defineProps({
if (isObject(props.component.dict)) {
props.component.dict.pageOption = {
page: 1,
pageSize: props.component?.dict?.pageSize ?? 15
pageSize: props.component?.dict?.pageOption?.pageSize ?? props.component?.dict?.pageSize ?? 15
}
}

Expand All @@ -116,6 +116,9 @@ watch( () => value.value, v => {
set(formModel.value, index, v)
index.indexOf('.') > -1 && delete formModel.value[index]
} )
watch( () => dictList.value[index] , async v => {
dataTotal.value = v?.pageInfo?.total || 0
})

if (value.value === '') {
value.value = undefined
Expand Down Expand Up @@ -170,11 +173,5 @@ const handleCascaderChangeEvent = async (value) => {

rv('onCreated')
onMounted(() => {
setTimeout(() => {
if (isObject(dictList.value[index])) {
dataTotal.value = dictList.value[index]?.pageInfo?.total
}
}, 800);
rv('onMounted')
})
</script>
1 change: 1 addition & 0 deletions src/views/setting/config/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
:title="item.name"
>
<ma-form
v-if="isCreateNode"
v-model="formArray[item.id]"
:columns="optionsArray[item.id]"
@submit="submit"
Expand Down

0 comments on commit 1ef9aec

Please sign in to comment.