From 616bcec33b6df383ca90f3cbbc6ae10eab3968d2 Mon Sep 17 00:00:00 2001 From: PeopleSea Date: Tue, 2 Jul 2024 11:52:16 +0800 Subject: [PATCH 1/4] fix(dict): Optimized dictionary loading and synchronization of pagination size and total. Refined the dictionary loading logic, fixing an issue where the `pageSize` and `total` properties within the `pageOption` object of `dict` failed to synchronize correctly when using `form-select` and `form-item` components. Enhanced the watcher setup for deep listening, ensuring real-time responses to data changes. Moreover, eliminated unnecessary `setTimeout` for immediate loading. Affected components: `src/components/ma-crud/components/searchFormItem/form-select.vue` and `src/components/ma-form/formItem/form-select.vue`. fix: System configuration, radio options not rendering correctly in configuration component. Added `v-if="isCreateNode"` to `ma-form` for a comprehensive resolution to the rendering issue. Credit to @westng Closes #191 --- .../ma-crud/components/searchFormItem/form-select.vue | 10 ++++------ src/components/ma-form/formItem/form-select.vue | 11 ++++------- src/views/setting/config/index.vue | 1 + 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/components/ma-crud/components/searchFormItem/form-select.vue b/src/components/ma-crud/components/searchFormItem/form-select.vue index ed872e84..50994e89 100644 --- a/src/components/ma-crud/components/searchFormItem/form-select.vue +++ b/src/components/ma-crud/components/searchFormItem/form-select.vue @@ -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 } } @@ -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( @@ -116,10 +119,5 @@ const handlerChangeeEvent = (value) => { } onMounted(() => { - setTimeout(() => { - if (isObject(dicts.value[dictIndex])) { - dataTotal.value = dicts.value[dictIndex]?.pageInfo?.total - } - }, 3000); }) \ No newline at end of file diff --git a/src/components/ma-form/formItem/form-select.vue b/src/components/ma-form/formItem/form-select.vue index cd45173a..0dbda9b3 100644 --- a/src/components/ma-form/formItem/form-select.vue +++ b/src/components/ma-form/formItem/form-select.vue @@ -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 } } @@ -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 @@ -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') }) diff --git a/src/views/setting/config/index.vue b/src/views/setting/config/index.vue index 4fbe6351..3e0f6777 100644 --- a/src/views/setting/config/index.vue +++ b/src/views/setting/config/index.vue @@ -40,6 +40,7 @@ :title="item.name" > Date: Wed, 3 Jul 2024 11:08:12 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(crud):=20=E4=BF=AE=E5=A4=8DmiddleConten?= =?UTF-8?q?t=E6=8F=92=E6=A7=BD=E5=AF=BC=E8=87=B4=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ma-crud/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ma-crud/index.vue b/src/components/ma-crud/index.vue index 18f58fc8..86dc0e6c 100644 --- a/src/components/ma-crud/index.vue +++ b/src/components/ma-crud/index.vue @@ -47,8 +47,8 @@ +
-
From 4d21603d8db505ee8c621a471a734f2a3899a54e Mon Sep 17 00:00:00 2001 From: PeopleSea Date: Thu, 4 Jul 2024 10:40:39 +0800 Subject: [PATCH 3/4] fix(ma-resource): prevent image component from throwing error when src is null By adding a null check for the `src` attribute of the `a-image` component, we ensure that the component does not throw an error when the `networkImg` variable is undefined or null. This improves the robustness of the component and prevents potential crashes in the UI. --- src/components/ma-resource/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ma-resource/index.vue b/src/components/ma-resource/index.vue index a6064df2..b3bde14d 100644 --- a/src/components/ma-resource/index.vue +++ b/src/components/ma-resource/index.vue @@ -12,7 +12,7 @@ - +
Date: Thu, 4 Jul 2024 14:55:27 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat(crud):=20=E6=B7=BB=E5=8A=A0=E6=9C=80?= =?UTF-8?q?=E5=B0=8F=E5=88=97=E5=AE=BD=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ma-crud/components/column.vue | 2 ++ src/components/ma-crud/index.vue | 1 + src/components/ma-crud/js/defaultOptions.js | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/ma-crud/components/column.vue b/src/components/ma-crud/components/column.vue index 54318836..2f555bb4 100644 --- a/src/components/ma-crud/components/column.vue +++ b/src/components/ma-crud/components/column.vue @@ -4,6 +4,7 @@ { item = columns.value[index] } !item.width && (item.width = options.value.columnWidth) + !item.minWidth && (item.minWidth = options.value.columnMinWidth) }) provide('options', options.value) diff --git a/src/components/ma-crud/js/defaultOptions.js b/src/components/ma-crud/js/defaultOptions.js index ee438c27..07ba1fd5 100644 --- a/src/components/ma-crud/js/defaultOptions.js +++ b/src/components/ma-crud/js/defaultOptions.js @@ -54,7 +54,8 @@ export default { // 页面布局方式,支持 normal(标准)和 fixed(固定)两种 pageLayout: 'normal', // 默认统一设置列宽度 - columnWidth: 100, + columnWidth: 0,// 列宽更新为最小列宽(此处设置为 0 时候,默认最小列宽生效) + columnMinWidth: 100, // 搜索标签对齐方式 searchLabelAlign: 'right', // 全局搜索标签宽度