diff --git a/apps/web-antd/src/views/system/config/config-modal.vue b/apps/web-antd/src/views/system/config/config-modal.vue index e9a99906..d0dab65e 100644 --- a/apps/web-antd/src/views/system/config/config-modal.vue +++ b/apps/web-antd/src/views/system/config/config-modal.vue @@ -5,7 +5,7 @@ import { useVbenModal } from '@vben/common-ui'; import { $t } from '@vben/locales'; import { useVbenForm } from '#/adapter'; -import { configAdd, configUpdate } from '#/api/system/config'; +import { configAdd, configInfo, configUpdate } from '#/api/system/config'; import { modalSchema } from './data'; @@ -13,7 +13,7 @@ const emit = defineEmits<{ reload: [] }>(); interface ModalProps { update: boolean; - record?: any; + id: number | string; } const isUpdate = ref(false); @@ -38,11 +38,12 @@ const [BasicModal, modalApi] = useVbenModal({ return null; } modalApi.modalLoading(true); - const { record, update } = modalApi.getData() as ModalProps; + const { id, update } = modalApi.getData() as ModalProps; isUpdate.value = update; - if (update && record) { + if (update && id) { + const record = await configInfo(id); for (const key in record) { - await formApi.setFieldValue(key, record[key]); + await formApi.setFieldValue(key, record[key as keyof typeof record]); } } modalApi.modalLoading(false); @@ -57,7 +58,6 @@ async function handleConfirm() { return; } const data = await formApi.getValues(); - console.log(data); await (isUpdate.value ? configUpdate(data) : configAdd(data)); emit('reload'); await handleCancel(); diff --git a/apps/web-antd/src/views/system/config/index.vue b/apps/web-antd/src/views/system/config/index.vue index ab13185f..fe8d8cd0 100644 --- a/apps/web-antd/src/views/system/config/index.vue +++ b/apps/web-antd/src/views/system/config/index.vue @@ -27,7 +27,7 @@ function handleAdd() { } async function handleEdit(record: Recordable) { - modalApi.setData({ record, update: true }); + modalApi.setData({ id: record.configId, update: true }); modalApi.open(); }