feat: 表单编辑逻辑修改
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
</slot>
|
||||
关闭
|
||||
</a-button>
|
||||
<a-button style="margin-right: 10px" type="primary" @click="editForm" v-if="mode === 'view' && type === 'readonly'">
|
||||
<a-button style="margin-right: 10px" type="primary" @click="editForm" v-if="mode === 'view'">
|
||||
<slot name="icon">
|
||||
<edit-outlined />
|
||||
</slot>
|
||||
@ -65,15 +65,14 @@ if (hash.indexOf('createForm') > 0) {
|
||||
} else if (hash.indexOf('viewForm') > 0) {
|
||||
mode.value = 'view';
|
||||
}
|
||||
const type = ref('readonly')
|
||||
|
||||
dynamicComponent.value = defineAsyncComponent({
|
||||
loader: () => import(`./../../views/${pathArr[0]}/${pathArr[1]}/components/Form.vue`)
|
||||
});
|
||||
|
||||
function editForm() {
|
||||
type.value = 'edit'
|
||||
setFormType()
|
||||
mode.value = 'update'
|
||||
formRef.value.setEnabledForm();
|
||||
}
|
||||
|
||||
function onFormMounted(_formProps) {
|
||||
@ -88,11 +87,7 @@ async function setFormType() {
|
||||
}
|
||||
await nextTick();
|
||||
if (_mode === 'view') {
|
||||
if (type.value === 'readonly') {
|
||||
await formRef.value.setDisabledForm();
|
||||
} else {
|
||||
await formRef.value.setEnabledForm();
|
||||
}
|
||||
}
|
||||
await formRef.value.setFormDataFromId(formId.value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user