Commit 497a85cad7e75811144b6e1e9e843fc0791a4cf7
Merge branch 'fix/DEFECT-1608' into 'main_dev'
fix: 修改数据流转、场景联动、看板选择组织逻辑 See merge request yunteng/thingskit-front!898
Showing
10 changed files
with
66 additions
and
12 deletions
@@ -56,7 +56,10 @@ | @@ -56,7 +56,10 @@ | ||
56 | return unref(orgList); | 56 | return unref(orgList); |
57 | } | 57 | } |
58 | }, | 58 | }, |
59 | - params: { ...params, _t: unref(timespan) }, | 59 | + params: { |
60 | + ...params, | ||
61 | + _t: unref(timespan), | ||
62 | + }, | ||
60 | onChange: (...args: any[]) => { | 63 | onChange: (...args: any[]) => { |
61 | emit('change', ...args); | 64 | emit('change', ...args); |
62 | }, | 65 | }, |
@@ -31,9 +31,9 @@ | @@ -31,9 +31,9 @@ | ||
31 | import { CredentialsEnum } from '../mqtt/enum'; | 31 | import { CredentialsEnum } from '../mqtt/enum'; |
32 | 32 | ||
33 | const credentialsFile = reactive({ | 33 | const credentialsFile = reactive({ |
34 | - caCertFileName: '', | ||
35 | - certFileName: '', | ||
36 | - privateKeyFileName: '', | 34 | + caCertFileName: undefined, |
35 | + certFileName: undefined, | ||
36 | + privateKeyFileName: undefined, | ||
37 | }); | 37 | }); |
38 | 38 | ||
39 | const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ | 39 | const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ |
@@ -50,6 +50,11 @@ | @@ -50,6 +50,11 @@ | ||
50 | const getValue = async () => { | 50 | const getValue = async () => { |
51 | const values = await validateFields(); | 51 | const values = await validateFields(); |
52 | if (!values) return; | 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 | const credentials = { | 58 | const credentials = { |
54 | type: values['type'], | 59 | type: values['type'], |
55 | ...credentialsFile, | 60 | ...credentialsFile, |
@@ -51,10 +51,16 @@ | @@ -51,10 +51,16 @@ | ||
51 | const getValue = async () => { | 51 | const getValue = async () => { |
52 | const values = await validateFields(); | 52 | const values = await validateFields(); |
53 | if (!values) return; | 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 | const credentials = { | 59 | const credentials = { |
55 | type: values['type'], | 60 | type: values['type'], |
56 | ...credentialsFile, | 61 | ...credentialsFile, |
57 | }; | 62 | }; |
63 | + | ||
58 | const mergeValues = { | 64 | const mergeValues = { |
59 | ...values, | 65 | ...values, |
60 | ...{ credentials }, | 66 | ...{ credentials }, |
@@ -67,7 +73,12 @@ | @@ -67,7 +73,12 @@ | ||
67 | if (credentials) { | 73 | if (credentials) { |
68 | for (let i in credentials) Reflect.set(credentialsFile, i, credentials[i]); | 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 | const resetValue = () => resetFields(); | 84 | const resetValue = () => resetFields(); |
@@ -18,7 +18,7 @@ class MqttFormPartialConfig { | @@ -18,7 +18,7 @@ class MqttFormPartialConfig { | ||
18 | return [ | 18 | return [ |
19 | { label: 'Anonymous', value: 'anonymous' }, | 19 | { label: 'Anonymous', value: 'anonymous' }, |
20 | { label: 'Basic', value: 'basic' }, | 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,9 +138,21 @@ export const modeMqttForm: FormSchema[] = [ | ||
138 | label: '凭据类型', | 138 | label: '凭据类型', |
139 | colProps: { span: 12 }, | 139 | colProps: { span: 12 }, |
140 | defaultValue: MqttFormPartialConfig.type, | 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 | { |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | export enum CredentialsEnum { | 6 | export enum CredentialsEnum { |
7 | IS_ANONYMOUS = 'anonymous', | 7 | IS_ANONYMOUS = 'anonymous', |
8 | IS_BASIC = 'basic', | 8 | IS_BASIC = 'basic', |
9 | - IS_PEM = 'pem', | 9 | + IS_PEM = 'cert.PEM', |
10 | } | 10 | } |
11 | 11 | ||
12 | export const isBasic = (type: string) => { | 12 | export const isBasic = (type: string) => { |
@@ -128,8 +128,9 @@ | @@ -128,8 +128,9 @@ | ||
128 | : undefined, | 128 | : undefined, |
129 | appendClientIdSuffix: getDataFlowParams.appendClientIdSuffix || undefined, | 129 | appendClientIdSuffix: getDataFlowParams.appendClientIdSuffix || undefined, |
130 | type: undefined, | 130 | type: undefined, |
131 | + username: undefined, | ||
132 | + password: undefined, | ||
131 | }; | 133 | }; |
132 | - | ||
133 | const rest = isRabbitmq(getDataFlowMethod?.type) | 134 | const rest = isRabbitmq(getDataFlowMethod?.type) |
134 | ? await postAddConvertApi({ ...restData.data, ...data }) | 135 | ? await postAddConvertApi({ ...restData.data, ...data }) |
135 | : await postAddConvertApi({ ...restData.data, ...data, configuration }); | 136 | : await postAddConvertApi({ ...restData.data, ...data, configuration }); |
@@ -755,6 +755,18 @@ export const actionSchema: FormSchema[] = [ | @@ -755,6 +755,18 @@ export const actionSchema: FormSchema[] = [ | ||
755 | component: 'Select', | 755 | component: 'Select', |
756 | label: '', | 756 | label: '', |
757 | show: ({ values }) => isAlarmOut(values.outTarget), | 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 | componentProps: { | 770 | componentProps: { |
759 | placeholder: '请选择告警等级', | 771 | placeholder: '请选择告警等级', |
760 | options: [ | 772 | options: [ |
@@ -273,6 +273,10 @@ | @@ -273,6 +273,10 @@ | ||
273 | if (validate.device == 'PART' && validate.deviceId == undefined) | 273 | if (validate.device == 'PART' && validate.deviceId == undefined) |
274 | return createMessage.error('请选择设备'); | 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 | //ft-add-2022-11-22 | 280 | //ft-add-2022-11-22 |
277 | //TODO-fengtao-设备验证 | 281 | //TODO-fengtao-设备验证 |
278 | const value = getFieldsValue(); | 282 | const value = getFieldsValue(); |
@@ -188,7 +188,9 @@ | @@ -188,7 +188,9 @@ | ||
188 | if (hasDetailPermission) { | 188 | if (hasDetailPermission) { |
189 | const boardId = encode(record.id); | 189 | const boardId = encode(record.id); |
190 | const boardName = encode(record.name); | 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 | } else createMessage.warning('没有权限'); | 194 | } else createMessage.warning('没有权限'); |
193 | }; | 195 | }; |
194 | 196 |
@@ -90,6 +90,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { | @@ -90,6 +90,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { | ||
90 | const isUpdate = unref(mode) === DataActionModeEnum.UPDATE; | 90 | const isUpdate = unref(mode) === DataActionModeEnum.UPDATE; |
91 | const selectWidgetKeys = useSelectWidgetKeys(); | 91 | const selectWidgetKeys = useSelectWidgetKeys(); |
92 | const category = unref(selectWidgetKeys).categoryKey; | 92 | const category = unref(selectWidgetKeys).categoryKey; |
93 | + | ||
93 | return [ | 94 | return [ |
94 | { | 95 | { |
95 | field: DataSourceField.IS_GATEWAY_DEVICE, | 96 | field: DataSourceField.IS_GATEWAY_DEVICE, |
@@ -191,6 +192,9 @@ export const commonDataSourceSchemas = (): FormSchema[] => { | @@ -191,6 +192,9 @@ export const commonDataSourceSchemas = (): FormSchema[] => { | ||
191 | }); | 192 | }); |
192 | }, | 193 | }, |
193 | showCreate: false, | 194 | showCreate: false, |
195 | + apiTreeSelectProps: { | ||
196 | + params: { organizationId: location?.pathname?.split('/')?.pop() || '' }, | ||
197 | + }, | ||
194 | getPopupContainer: () => document.body, | 198 | getPopupContainer: () => document.body, |
195 | }; | 199 | }; |
196 | }, | 200 | }, |