|
@@ -31,9 +31,19 @@ const formData = ref({
|
|
|
writeUrl: "",
|
|
|
});
|
|
|
|
|
|
+const onClosed = () => {
|
|
|
+ formRef.value?.resetFields();
|
|
|
+};
|
|
|
+
|
|
|
+const onCancel = () => {
|
|
|
+ formRef.value?.resetFields();
|
|
|
+ addVisible.value = false;
|
|
|
+};
|
|
|
+
|
|
|
// 1 新增 2 修改
|
|
|
|
|
|
const openDialog = (type: string, data: any) => {
|
|
|
+ formData.value.id = "";
|
|
|
dialogType.value = type;
|
|
|
|
|
|
getDevTypes();
|
|
@@ -41,10 +51,6 @@ const openDialog = (type: string, data: any) => {
|
|
|
|
|
|
addVisible.value = true;
|
|
|
|
|
|
- nextTick(() => {
|
|
|
- formRef.value?.resetFields();
|
|
|
- });
|
|
|
-
|
|
|
dialogType.value = type;
|
|
|
if (type === "1") {
|
|
|
} else {
|
|
@@ -62,6 +68,7 @@ const saveFun = () => {
|
|
|
} else {
|
|
|
await updateInstrumentResource(formData.value);
|
|
|
}
|
|
|
+ formRef.value?.resetFields();
|
|
|
emits("finished");
|
|
|
addVisible.value = false;
|
|
|
})
|
|
@@ -96,6 +103,7 @@ const getCommTypes = () => {
|
|
|
width="500"
|
|
|
align-center
|
|
|
:close-on-click-modal="false"
|
|
|
+ @close="onClosed"
|
|
|
>
|
|
|
<el-form
|
|
|
label-width="auto"
|
|
@@ -181,7 +189,7 @@ const getCommTypes = () => {
|
|
|
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button @click="addVisible = false">取消</el-button>
|
|
|
+ <el-button @click="onCancel">取消</el-button>
|
|
|
<el-button type="primary" @click="saveFun"> 保存 </el-button>
|
|
|
</div>
|
|
|
</template>
|