Commit e200e1789faba3718b3357f652dca0dc9a27c6b0

Authored by loveumiko
1 parent 352568a8

fix: 修复组态属性下发弹框操作密码验证重复

... ... @@ -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 },
... ... @@ -74,7 +74,10 @@ defineExpose({ open })
74 74 </script>
75 75
76 76 <template>
77   - <Modal v-model:open="visible" title="属性下发" ok-text="确认" :width="400" cancel-text="取消" @ok="handleOk">
  77 + <Modal
  78 + v-model:open="visible" title="属性下发" ok-text="确认" :width="400" cancel-text="取消" @cancel="
  79 + clearValidate()" @ok="handleOk"
  80 + >
78 81 <!-- <section>
79 82 <FormItem label="操作密码" :label-col="{ span: 24 }">
80 83 <Input v-model:value="value" placeholder="请输入下发值" />
... ...
... ... @@ -22,7 +22,7 @@ const createFormSchemas = (password: string): FormSchema[] => {
22 22 required: true,
23 23 rules: [{
24 24 validator(_rule, value) {
25   - if (value !== password) return Promise.reject(new Error('操作密码不正确'))
  25 + if (value && value !== password) return Promise.reject(new Error('操作密码不正确'))
26 26 return Promise.resolve()
27 27 },
28 28 }],
... ...
... ... @@ -11,7 +11,6 @@ import { genModbusCommand, getDeviceActiveTime, getDeviceInfo, getThingsModelSer
11 11 import { ThingsModelForm } from '@/core/Library/components/ThingsModelForm'
12 12 import { useMessage } from '@/hooks/web/useMessage'
13 13 import type { StructJSON } from '@/api/device/model'
14   -import { CommandWayEnum } from '@/enums/commandEnum'
15 14
16 15 interface ServiceInfo {
17 16 title?: string
... ...