Commit 352568a87e7fe7b538027a38a9ae9e7b2db3c499

Authored by xp.Huang
2 parents 3b23acae b32b4b05

Merge branch 'fix/attribute-deliver-password' into 'main_dev'

fix: 修复属性下发取消密码无效

See merge request yunteng/thingskit-scada!191
@@ -21,7 +21,7 @@ enum FormFieldsEnum { @@ -21,7 +21,7 @@ enum FormFieldsEnum {
21 PASSWORD = 'password', 21 PASSWORD = 'password',
22 } 22 }
23 23
24 -const createFormSchemas = (title?: string, password?: string): FormSchema[] => { 24 +const createFormSchemas = (title?: string, password?: string, operationPasswordEnable?: boolean): FormSchema[] => {
25 const schemas: FormSchema[] = [ 25 const schemas: FormSchema[] = [
26 { 26 {
27 field: FormFieldsEnum.ATTR_VALUE, 27 field: FormFieldsEnum.ATTR_VALUE,
@@ -31,7 +31,7 @@ const createFormSchemas = (title?: string, password?: string): FormSchema[] => { @@ -31,7 +31,7 @@ const createFormSchemas = (title?: string, password?: string): FormSchema[] => {
31 }, 31 },
32 ] 32 ]
33 33
34 - if (password) { 34 + if (password && operationPasswordEnable) {
35 schemas.unshift({ 35 schemas.unshift({
36 field: FormFieldsEnum.PASSWORD, 36 field: FormFieldsEnum.PASSWORD,
37 label: '操作密码', 37 label: '操作密码',
@@ -51,13 +51,13 @@ const createFormSchemas = (title?: string, password?: string): FormSchema[] => { @@ -51,13 +51,13 @@ const createFormSchemas = (title?: string, password?: string): FormSchema[] => {
51 return schemas 51 return schemas
52 } 52 }
53 53
54 -const open = async ({ title, operationPassword }: Partial<Record<'operationPassword' | 'title', string>>) => { 54 +const open = async ({ title, operationPassword, operationPasswordEnable }: Partial<Record<'operationPassword' | 'title', string>> & { operationPasswordEnable: boolean }) => {
55 visible.value = true 55 visible.value = true
56 password.value = operationPassword 56 password.value = operationPassword
57 return new Promise((resolve) => { 57 return new Promise((resolve) => {
58 resolveFn.value = resolve 58 resolveFn.value = resolve
59 nextTick(() => { 59 nextTick(() => {
60 - setProps({ schemas: createFormSchemas(title, operationPassword) }) 60 + setProps({ schemas: createFormSchemas(title, operationPassword, operationPasswordEnable) })
61 }) 61 })
62 }) 62 })
63 } 63 }
@@ -118,7 +118,7 @@ export function useNodeEvent(eventJson: NodeDataEventJsonType, dataSourceJson: N @@ -118,7 +118,7 @@ export function useNodeEvent(eventJson: NodeDataEventJsonType, dataSourceJson: N
118 else { 118 else {
119 const instance = h(AttributeDeliverModal) 119 const instance = h(AttributeDeliverModal)
120 render(instance, document.body) 120 render(instance, document.body)
121 - const value = await (instance.component?.exposed as InstanceType<typeof AttributeDeliverModal>)?.open({ title: `${alias || deviceName}-${attrInfo.name}`, operationPassword }) as string 121 + const value = await (instance.component?.exposed as InstanceType<typeof AttributeDeliverModal>)?.open({ title: `${alias || deviceName}-${attrInfo.name}`, operationPassword, operationPasswordEnable }) as string
122 122
123 command.params = transportType === TransportTypeEnum.TCP ? value : { [attr]: value } 123 command.params = transportType === TransportTypeEnum.TCP ? value : { [attr]: value }
124 await doCommandDelivery({ way, command, deviceId }) 124 await doCommandDelivery({ way, command, deviceId })