Showing
10 changed files
with
66 additions
and
12 deletions
... | ... | @@ -31,9 +31,9 @@ |
31 | 31 | import { CredentialsEnum } from '../mqtt/enum'; |
32 | 32 | |
33 | 33 | const credentialsFile = reactive({ |
34 | - caCertFileName: '', | |
35 | - certFileName: '', | |
36 | - privateKeyFileName: '', | |
34 | + caCertFileName: undefined, | |
35 | + certFileName: undefined, | |
36 | + privateKeyFileName: undefined, | |
37 | 37 | }); |
38 | 38 | |
39 | 39 | const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ |
... | ... | @@ -50,6 +50,11 @@ |
50 | 50 | const getValue = async () => { |
51 | 51 | const values = await validateFields(); |
52 | 52 | if (!values) return; |
53 | + // if (values.type == 'anonymous' || values.type == 'basic') { | |
54 | + // credentialsFile.caCertFileName = undefined; | |
55 | + // credentialsFile.certFileName = undefined; | |
56 | + // credentialsFile.privateKeyFileName = undefined; | |
57 | + // } | |
53 | 58 | const credentials = { |
54 | 59 | type: values['type'], |
55 | 60 | ...credentialsFile, | ... | ... |
... | ... | @@ -51,10 +51,16 @@ |
51 | 51 | const getValue = async () => { |
52 | 52 | const values = await validateFields(); |
53 | 53 | if (!values) return; |
54 | + if (values.type == 'anonymous' || values.type == 'basic') { | |
55 | + credentialsFile.caCertFileName = undefined; | |
56 | + credentialsFile.certFileName = undefined; | |
57 | + credentialsFile.privateKeyFileName = undefined; | |
58 | + } | |
54 | 59 | const credentials = { |
55 | 60 | type: values['type'], |
56 | 61 | ...credentialsFile, |
57 | 62 | }; |
63 | + | |
58 | 64 | const mergeValues = { |
59 | 65 | ...values, |
60 | 66 | ...{ credentials }, |
... | ... | @@ -67,7 +73,12 @@ |
67 | 73 | if (credentials) { |
68 | 74 | for (let i in credentials) Reflect.set(credentialsFile, i, credentials[i]); |
69 | 75 | } |
70 | - setFieldsValue({ ...value, type: credentials.type }); | |
76 | + setFieldsValue({ | |
77 | + ...value, | |
78 | + type: credentials.type, | |
79 | + username: credentials.username, | |
80 | + password: credentials.password, | |
81 | + }); | |
71 | 82 | }; |
72 | 83 | |
73 | 84 | const resetValue = () => resetFields(); | ... | ... |
... | ... | @@ -18,7 +18,7 @@ class MqttFormPartialConfig { |
18 | 18 | return [ |
19 | 19 | { label: 'Anonymous', value: 'anonymous' }, |
20 | 20 | { label: 'Basic', value: 'basic' }, |
21 | - { label: 'PEM', value: 'pem' }, | |
21 | + { label: 'PEM', value: 'cert.PEM' }, | |
22 | 22 | ]; |
23 | 23 | } |
24 | 24 | } |
... | ... | @@ -138,9 +138,21 @@ export const modeMqttForm: FormSchema[] = [ |
138 | 138 | label: '凭据类型', |
139 | 139 | colProps: { span: 12 }, |
140 | 140 | defaultValue: MqttFormPartialConfig.type, |
141 | - componentProps: { | |
142 | - placeholder: '请选择Credentials', | |
143 | - options: MqttFormPartialConfig.getType(), | |
141 | + componentProps: ({ formActionType }) => { | |
142 | + const { setFieldsValue } = formActionType; | |
143 | + return { | |
144 | + placeholder: '请选择Credentials', | |
145 | + options: MqttFormPartialConfig.getType(), | |
146 | + onChange(e) { | |
147 | + if (e) { | |
148 | + console.log('执行'); | |
149 | + setFieldsValue({ | |
150 | + password: undefined, | |
151 | + username: undefined, | |
152 | + }); | |
153 | + } | |
154 | + }, | |
155 | + }; | |
144 | 156 | }, |
145 | 157 | }, |
146 | 158 | { | ... | ... |
... | ... | @@ -128,8 +128,9 @@ |
128 | 128 | : undefined, |
129 | 129 | appendClientIdSuffix: getDataFlowParams.appendClientIdSuffix || undefined, |
130 | 130 | type: undefined, |
131 | + username: undefined, | |
132 | + password: undefined, | |
131 | 133 | }; |
132 | - | |
133 | 134 | const rest = isRabbitmq(getDataFlowMethod?.type) |
134 | 135 | ? await postAddConvertApi({ ...restData.data, ...data }) |
135 | 136 | : await postAddConvertApi({ ...restData.data, ...data, configuration }); | ... | ... |
... | ... | @@ -755,6 +755,18 @@ export const actionSchema: FormSchema[] = [ |
755 | 755 | component: 'Select', |
756 | 756 | label: '', |
757 | 757 | show: ({ values }) => isAlarmOut(values.outTarget), |
758 | + // dynamicRules: (params) => { | |
759 | + // const { outTarget } = params.values; | |
760 | + // return [ | |
761 | + // { | |
762 | + // required: outTarget == 'MSG_NOTIFY' ? true : false, | |
763 | + // validator: (_, value) => { | |
764 | + // if (!value) return Promise.reject('请选择告警配置'); | |
765 | + // Promise.resolve(); | |
766 | + // }, | |
767 | + // }, | |
768 | + // ]; | |
769 | + // }, | |
758 | 770 | componentProps: { |
759 | 771 | placeholder: '请选择告警等级', |
760 | 772 | options: [ | ... | ... |
... | ... | @@ -273,6 +273,10 @@ |
273 | 273 | if (validate.device == 'PART' && validate.deviceId == undefined) |
274 | 274 | return createMessage.error('请选择设备'); |
275 | 275 | } |
276 | + if (type === 'MSG_NOTIFY') { | |
277 | + if (!validate.alarm_config) return createMessage.error('请选择告警配置'); | |
278 | + if (!validate.alarm_level) return createMessage.error('请选择告警等级'); | |
279 | + } | |
276 | 280 | //ft-add-2022-11-22 |
277 | 281 | //TODO-fengtao-设备验证 |
278 | 282 | const value = getFieldsValue(); | ... | ... |
... | ... | @@ -188,7 +188,9 @@ |
188 | 188 | if (hasDetailPermission) { |
189 | 189 | const boardId = encode(record.id); |
190 | 190 | const boardName = encode(record.name); |
191 | - router.push(`/visual/board/detail/${boardId}/${boardName}`); | |
191 | + const organizationId = encode(record?.organizationId); | |
192 | + | |
193 | + router.push(`/visual/board/detail/${boardId}/${boardName}/${organizationId}`); | |
192 | 194 | } else createMessage.warning('没有权限'); |
193 | 195 | }; |
194 | 196 | ... | ... |
... | ... | @@ -90,6 +90,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
90 | 90 | const isUpdate = unref(mode) === DataActionModeEnum.UPDATE; |
91 | 91 | const selectWidgetKeys = useSelectWidgetKeys(); |
92 | 92 | const category = unref(selectWidgetKeys).categoryKey; |
93 | + | |
93 | 94 | return [ |
94 | 95 | { |
95 | 96 | field: DataSourceField.IS_GATEWAY_DEVICE, |
... | ... | @@ -191,6 +192,9 @@ export const commonDataSourceSchemas = (): FormSchema[] => { |
191 | 192 | }); |
192 | 193 | }, |
193 | 194 | showCreate: false, |
195 | + apiTreeSelectProps: { | |
196 | + params: { organizationId: location?.pathname?.split('/')?.pop() || '' }, | |
197 | + }, | |
194 | 198 | getPopupContainer: () => document.body, |
195 | 199 | }; |
196 | 200 | }, | ... | ... |