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