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 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 25 const schemas: FormSchema[] = [
26 26 {
27 27 field: FormFieldsEnum.ATTR_VALUE,
... ... @@ -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 35 schemas.unshift({
36 36 field: FormFieldsEnum.PASSWORD,
37 37 label: '操作密码',
... ... @@ -51,13 +51,13 @@ const createFormSchemas = (title?: string, password?: string): FormSchema[] => {
51 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 55 visible.value = true
56 56 password.value = operationPassword
57 57 return new Promise((resolve) => {
58 58 resolveFn.value = resolve
59 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 118 else {
119 119 const instance = h(AttributeDeliverModal)
120 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 123 command.params = transportType === TransportTypeEnum.TCP ? value : { [attr]: value }
124 124 await doCommandDelivery({ way, command, deviceId })
... ...