Commit 0d8bf1b594461c053a3a894326979baab9257c36

Authored by xp.Huang
2 parents 352568a8 5aed566e

Merge branch 'fix/DEFECT-1798' into 'main_dev'

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

See merge request yunteng/thingskit-scada!192
@@ -11,7 +11,7 @@ const visible = ref(false) @@ -11,7 +11,7 @@ const visible = ref(false)
11 11
12 const password = ref() 12 const password = ref()
13 13
14 -const [register, { getFieldsValue, resetFields, validate, setProps }] = useForm({ 14 +const [register, { getFieldsValue, resetFields, validate, setProps, clearValidate }] = useForm({
15 layout: FormLayoutEnum.VERTICAL, 15 layout: FormLayoutEnum.VERTICAL,
16 showActionButtonGroup: false, 16 showActionButtonGroup: false,
17 }) 17 })
@@ -40,7 +40,7 @@ const createFormSchemas = (title?: string, password?: string, operationPasswordE @@ -40,7 +40,7 @@ const createFormSchemas = (title?: string, password?: string, operationPasswordE
40 rules: [ 40 rules: [
41 { 41 {
42 validator(_rule, value) { 42 validator(_rule, value) {
43 - if (value !== password) return Promise.reject(new Error('操作密码不正确')) 43 + if (value && value !== password) return Promise.reject(new Error('操作密码不正确'))
44 return Promise.resolve() 44 return Promise.resolve()
45 }, 45 },
46 }, 46 },
@@ -70,11 +70,18 @@ const handleOk = async () => { @@ -70,11 +70,18 @@ const handleOk = async () => {
70 resetFields() 70 resetFields()
71 } 71 }
72 72
  73 +const handleCancel = () => {
  74 + clearValidate()
  75 + resetFields()
  76 +}
  77 +
73 defineExpose({ open }) 78 defineExpose({ open })
74 </script> 79 </script>
75 80
76 <template> 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 <!-- <section> 85 <!-- <section>
79 <FormItem label="操作密码" :label-col="{ span: 24 }"> 86 <FormItem label="操作密码" :label-col="{ span: 24 }">
80 <Input v-model:value="value" placeholder="请输入下发值" /> 87 <Input v-model:value="value" placeholder="请输入下发值" />
@@ -22,7 +22,7 @@ const createFormSchemas = (password: string): FormSchema[] => { @@ -22,7 +22,7 @@ const createFormSchemas = (password: string): FormSchema[] => {
22 required: true, 22 required: true,
23 rules: [{ 23 rules: [{
24 validator(_rule, value) { 24 validator(_rule, value) {
25 - if (value !== password) return Promise.reject(new Error('操作密码不正确')) 25 + if (value && value !== password) return Promise.reject(new Error('操作密码不正确'))
26 return Promise.resolve() 26 return Promise.resolve()
27 }, 27 },
28 }], 28 }],
@@ -11,7 +11,6 @@ import { genModbusCommand, getDeviceActiveTime, getDeviceInfo, getThingsModelSer @@ -11,7 +11,6 @@ import { genModbusCommand, getDeviceActiveTime, getDeviceInfo, getThingsModelSer
11 import { ThingsModelForm } from '@/core/Library/components/ThingsModelForm' 11 import { ThingsModelForm } from '@/core/Library/components/ThingsModelForm'
12 import { useMessage } from '@/hooks/web/useMessage' 12 import { useMessage } from '@/hooks/web/useMessage'
13 import type { StructJSON } from '@/api/device/model' 13 import type { StructJSON } from '@/api/device/model'
14 -import { CommandWayEnum } from '@/enums/commandEnum'  
15 14
16 interface ServiceInfo { 15 interface ServiceInfo {
17 title?: string 16 title?: string