chore: config
This commit is contained in:
parent
600bfc7aaf
commit
fd3f1f738a
@ -16,12 +16,11 @@ const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
|
||||
const schema = modalSchema();
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
},
|
||||
schema,
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
@ -40,14 +39,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await configInfo(id);
|
||||
// 只取需要的字段
|
||||
schema
|
||||
.map((item) => item.fieldName)
|
||||
.forEach((key) => {
|
||||
if (key in record) {
|
||||
formApi.setFieldValue(key, record[key as keyof typeof record]);
|
||||
}
|
||||
});
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
|
Loading…
Reference in New Issue
Block a user