...
|
...
|
@@ -11,7 +11,7 @@ const visible = ref(false) |
11
|
11
|
|
12
|
12
|
const password = ref()
|
13
|
13
|
|
14
|
|
-const [register, { getFieldsValue, resetFields, validate, setProps }] = useForm({
|
|
14
|
+const [register, { getFieldsValue, resetFields, validate, setProps, clearValidate }] = useForm({
|
15
|
15
|
layout: FormLayoutEnum.VERTICAL,
|
16
|
16
|
showActionButtonGroup: false,
|
17
|
17
|
})
|
...
|
...
|
@@ -40,7 +40,7 @@ const createFormSchemas = (title?: string, password?: string, operationPasswordE |
40
|
40
|
rules: [
|
41
|
41
|
{
|
42
|
42
|
validator(_rule, value) {
|
43
|
|
- if (value !== password) return Promise.reject(new Error('操作密码不正确'))
|
|
43
|
+ if (value && value !== password) return Promise.reject(new Error('操作密码不正确'))
|
44
|
44
|
return Promise.resolve()
|
45
|
45
|
},
|
46
|
46
|
},
|
...
|
...
|
@@ -70,11 +70,18 @@ const handleOk = async () => { |
70
|
70
|
resetFields()
|
71
|
71
|
}
|
72
|
72
|
|
|
73
|
+const handleCancel = () => {
|
|
74
|
+ clearValidate()
|
|
75
|
+ resetFields()
|
|
76
|
+}
|
|
77
|
+
|
73
|
78
|
defineExpose({ open })
|
74
|
79
|
</script>
|
75
|
80
|
|
76
|
81
|
<template>
|
77
|
|
- <Modal v-model:open="visible" title="属性下发" ok-text="确认" :width="400" cancel-text="取消" @ok="handleOk">
|
|
82
|
+ <Modal
|
|
83
|
+ v-model:open="visible" title="属性下发" ok-text="确认" :width="400" cancel-text="取消" @cancel="handleCancel" @ok="handleOk"
|
|
84
|
+ >
|
78
|
85
|
<!-- <section>
|
79
|
86
|
<FormItem label="操作密码" :label-col="{ span: 24 }">
|
80
|
87
|
<Input v-model:value="value" placeholder="请输入下发值" />
|
...
|
...
|
|