Showing
7 changed files
with
58 additions
and
12 deletions
@@ -86,6 +86,7 @@ | @@ -86,6 +86,7 @@ | ||
86 | type: '', | 86 | type: '', |
87 | configuration: {}, | 87 | configuration: {}, |
88 | name: '', | 88 | name: '', |
89 | + additionalInfo: {}, | ||
89 | }); | 90 | }); |
90 | const editNextType = reactive({ | 91 | const editNextType = reactive({ |
91 | type: '', | 92 | type: '', |
@@ -97,6 +98,7 @@ | @@ -97,6 +98,7 @@ | ||
97 | editType.type = d.type; | 98 | editType.type = d.type; |
98 | editType.configuration = d.configuration; | 99 | editType.configuration = d.configuration; |
99 | editType.name = d.name; | 100 | editType.name = d.name; |
101 | + editType.additionalInfo = d.additionalInfo; | ||
100 | }; | 102 | }; |
101 | 103 | ||
102 | const [registerDrawer, { setModalProps, closeModal }] = useModalInner(async (data) => { | 104 | const [registerDrawer, { setModalProps, closeModal }] = useModalInner(async (data) => { |
@@ -247,7 +249,6 @@ | @@ -247,7 +249,6 @@ | ||
247 | id, | 249 | id, |
248 | additionalInfoV | 250 | additionalInfoV |
249 | ); | 251 | ); |
250 | - | ||
251 | if (!unref(isUpdate)) { | 252 | if (!unref(isUpdate)) { |
252 | delete allPostForm.id; | 253 | delete allPostForm.id; |
253 | } | 254 | } |
@@ -260,6 +261,17 @@ | @@ -260,6 +261,17 @@ | ||
260 | if (allPostForm.name == undefined) { | 261 | if (allPostForm.name == undefined) { |
261 | return createMessage.error('请填写名称'); | 262 | return createMessage.error('请填写名称'); |
262 | } | 263 | } |
264 | + //验证属性新增了必填 | ||
265 | + const isApiHeaders = | ||
266 | + allPostForm?.configuration?.headers || | ||
267 | + allPostForm?.configuration?.otherProperties || | ||
268 | + allPostForm?.configuration?.clientProperties; | ||
269 | + if (isApiHeaders && Object.keys(isApiHeaders).includes('')) { | ||
270 | + return createMessage.error('请填写属性'); | ||
271 | + } | ||
272 | + if (isApiHeaders && Object.values(isApiHeaders).includes('')) { | ||
273 | + return createMessage.error('请填写属性'); | ||
274 | + } | ||
263 | await postAddConvertApi(allPostForm); | 275 | await postAddConvertApi(allPostForm); |
264 | createMessage.success('数据流转新增成功'); | 276 | createMessage.success('数据流转新增成功'); |
265 | emit('success'); | 277 | emit('success'); |
@@ -267,6 +279,19 @@ | @@ -267,6 +279,19 @@ | ||
267 | closeModal(); | 279 | closeModal(); |
268 | } else { | 280 | } else { |
269 | await addOrEditFunc(); | 281 | await addOrEditFunc(); |
282 | + if (!isEdit.value) { | ||
283 | + //验证属性新增了必填 | ||
284 | + const isApiHeaders = | ||
285 | + allPostForm?.configuration?.headers || | ||
286 | + allPostForm?.configuration?.otherProperties || | ||
287 | + allPostForm?.configuration?.clientProperties; | ||
288 | + if (isApiHeaders && Object.keys(isApiHeaders).includes('')) { | ||
289 | + return createMessage.error('请填写属性'); | ||
290 | + } | ||
291 | + if (isApiHeaders && Object.values(isApiHeaders).includes('')) { | ||
292 | + return createMessage.error('请填写属性'); | ||
293 | + } | ||
294 | + } | ||
270 | await postAddConvertApi(isEdit.value ? noEditObj : allPostForm); | 295 | await postAddConvertApi(isEdit.value ? noEditObj : allPostForm); |
271 | createMessage.success('数据流转编辑成功'); | 296 | createMessage.success('数据流转编辑成功'); |
272 | emit('success'); | 297 | emit('success'); |
@@ -269,7 +269,6 @@ export const modeMqttForm: FormSchema[] = [ | @@ -269,7 +269,6 @@ export const modeMqttForm: FormSchema[] = [ | ||
269 | field: 'name', | 269 | field: 'name', |
270 | label: '名称', | 270 | label: '名称', |
271 | colProps: { span: 12 }, | 271 | colProps: { span: 12 }, |
272 | - required: true, | ||
273 | component: 'Input', | 272 | component: 'Input', |
274 | componentProps: { | 273 | componentProps: { |
275 | maxLength: 255, | 274 | maxLength: 255, |
@@ -293,7 +292,6 @@ export const modeMqttForm: FormSchema[] = [ | @@ -293,7 +292,6 @@ export const modeMqttForm: FormSchema[] = [ | ||
293 | label: 'Host', | 292 | label: 'Host', |
294 | colProps: { span: 12 }, | 293 | colProps: { span: 12 }, |
295 | component: 'Input', | 294 | component: 'Input', |
296 | - required: true, | ||
297 | componentProps: { | 295 | componentProps: { |
298 | maxLength: 255, | 296 | maxLength: 255, |
299 | placeholder: '请输入Host', | 297 | placeholder: '请输入Host', |
@@ -644,7 +642,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -644,7 +642,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
644 | field: 'description', | 642 | field: 'description', |
645 | label: '说明', | 643 | label: '说明', |
646 | colProps: { span: 12 }, | 644 | colProps: { span: 12 }, |
647 | - component: 'Input', | 645 | + component: 'InputTextArea', |
648 | componentProps: { | 646 | componentProps: { |
649 | maxLength: 255, | 647 | maxLength: 255, |
650 | placeholder: '请输入说明', | 648 | placeholder: '请输入说明', |
@@ -142,10 +142,11 @@ | @@ -142,10 +142,11 @@ | ||
142 | submitFunc: customSubmitFunc, | 142 | submitFunc: customSubmitFunc, |
143 | }); | 143 | }); |
144 | 144 | ||
145 | - const setStepTwoFieldsValueFunc = (v, v1) => { | 145 | + const setStepTwoFieldsValueFunc = (v, v1, v2) => { |
146 | setFieldsValue(v); | 146 | setFieldsValue(v); |
147 | setFieldsValue({ | 147 | setFieldsValue({ |
148 | name: v1, | 148 | name: v1, |
149 | + description: v2, | ||
149 | }); | 150 | }); |
150 | setFieldsValue({ | 151 | setFieldsValue({ |
151 | password: v.credentials?.password, | 152 | password: v.credentials?.password, |
@@ -232,14 +233,17 @@ | @@ -232,14 +233,17 @@ | ||
232 | fileList1.value = []; | 233 | fileList1.value = []; |
233 | showImg1.value = false; | 234 | showImg1.value = false; |
234 | showImg1Pic.value = ''; | 235 | showImg1Pic.value = ''; |
236 | + caCertFileName.value = ''; | ||
235 | } else if (e == 'F') { | 237 | } else if (e == 'F') { |
236 | fileList2.value = []; | 238 | fileList2.value = []; |
237 | showImg2.value = false; | 239 | showImg2.value = false; |
238 | showImg2Pic.value = ''; | 240 | showImg2Pic.value = ''; |
241 | + certFileName.value = ''; | ||
239 | } else { | 242 | } else { |
240 | fileList3.value = []; | 243 | fileList3.value = []; |
241 | showImg3.value = false; | 244 | showImg3.value = false; |
242 | showImg3Pic.value = ''; | 245 | showImg3Pic.value = ''; |
246 | + privateKeyFileName.value = ''; | ||
243 | } | 247 | } |
244 | } else { | 248 | } else { |
245 | const isLt5M = file.size / 1024 / 1024 < 5; | 249 | const isLt5M = file.size / 1024 / 1024 < 5; |
@@ -42,12 +42,13 @@ | @@ -42,12 +42,13 @@ | ||
42 | await clearValidate(['name']); | 42 | await clearValidate(['name']); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | - const setStepTwoFieldsValueFunc = async (v, v1) => { | 45 | + const setStepTwoFieldsValueFunc = async (v, v1, v2) => { |
46 | clearName.value = v1; | 46 | clearName.value = v1; |
47 | setFieldsValue(v); | 47 | setFieldsValue(v); |
48 | vType.value = v1; | 48 | vType.value = v1; |
49 | setFieldsValue({ | 49 | setFieldsValue({ |
50 | name: v1, | 50 | name: v1, |
51 | + description: v2, | ||
51 | }); | 52 | }); |
52 | }; | 53 | }; |
53 | 54 |
@@ -160,14 +160,17 @@ | @@ -160,14 +160,17 @@ | ||
160 | fileList1.value = []; | 160 | fileList1.value = []; |
161 | showImg1.value = false; | 161 | showImg1.value = false; |
162 | showImg1Pic.value = ''; | 162 | showImg1Pic.value = ''; |
163 | + caCertFileName.value = ''; | ||
163 | } else if (e == 'F') { | 164 | } else if (e == 'F') { |
164 | fileList2.value = []; | 165 | fileList2.value = []; |
165 | showImg2.value = false; | 166 | showImg2.value = false; |
166 | showImg2Pic.value = ''; | 167 | showImg2Pic.value = ''; |
168 | + certFileName.value = ''; | ||
167 | } else { | 169 | } else { |
168 | fileList3.value = []; | 170 | fileList3.value = []; |
169 | showImg3.value = false; | 171 | showImg3.value = false; |
170 | showImg3Pic.value = ''; | 172 | showImg3Pic.value = ''; |
173 | + privateKeyFileName.value = ''; | ||
171 | } | 174 | } |
172 | } else { | 175 | } else { |
173 | const isLt5M = file.size / 1024 / 1024 < 5; | 176 | const isLt5M = file.size / 1024 / 1024 < 5; |
@@ -230,10 +233,11 @@ | @@ -230,10 +233,11 @@ | ||
230 | } | 233 | } |
231 | } | 234 | } |
232 | }; | 235 | }; |
233 | - const setStepTwoFieldsValueFunc = (v, v1) => { | 236 | + const setStepTwoFieldsValueFunc = (v, v1, v2) => { |
234 | setFieldsValue(v); | 237 | setFieldsValue(v); |
235 | setFieldsValue({ | 238 | setFieldsValue({ |
236 | name: v1, | 239 | name: v1, |
240 | + description: v2, | ||
237 | }); | 241 | }); |
238 | setFieldsValue({ | 242 | setFieldsValue({ |
239 | password: v.credentials?.password, | 243 | password: v.credentials?.password, |
@@ -32,10 +32,11 @@ | @@ -32,10 +32,11 @@ | ||
32 | submitFunc: customSubmitFunc, | 32 | submitFunc: customSubmitFunc, |
33 | }); | 33 | }); |
34 | 34 | ||
35 | - const setStepTwoFieldsValueFunc = (v, v1) => { | 35 | + const setStepTwoFieldsValueFunc = (v, v1, v2) => { |
36 | setFieldsValue(v); | 36 | setFieldsValue(v); |
37 | setFieldsValue({ | 37 | setFieldsValue({ |
38 | name: v1, | 38 | name: v1, |
39 | + description: v2, | ||
39 | }); | 40 | }); |
40 | }; | 41 | }; |
41 | const customClearStepTwoValueFunc = async () => { | 42 | const customClearStepTwoValueFunc = async () => { |
@@ -95,19 +95,32 @@ | @@ -95,19 +95,32 @@ | ||
95 | try { | 95 | try { |
96 | if (v.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { | 96 | if (v.type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { |
97 | isWhereComp.value = v.type; | 97 | isWhereComp.value = v.type; |
98 | - proxy.$refs.refTransferConfigKafka.setStepTwoFieldsValueFunc(v.configuration, v.name); | 98 | + proxy.$refs.refTransferConfigKafka.setStepTwoFieldsValueFunc( |
99 | + v.configuration, | ||
100 | + v.name, | ||
101 | + v?.additionalInfo?.description | ||
102 | + ); | ||
99 | } else if (v.type == 'org.thingsboard.rule.engine.mqtt.TbMqttNode') { | 103 | } else if (v.type == 'org.thingsboard.rule.engine.mqtt.TbMqttNode') { |
100 | isWhereComp.value = v.type; | 104 | isWhereComp.value = v.type; |
101 | - proxy.$refs.refTransferConfigMqtt.setStepTwoFieldsValueFunc(v.configuration, v.name); | 105 | + proxy.$refs.refTransferConfigMqtt.setStepTwoFieldsValueFunc( |
106 | + v.configuration, | ||
107 | + v.name, | ||
108 | + v?.additionalInfo?.description | ||
109 | + ); | ||
102 | } else if (v.type == 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode') { | 110 | } else if (v.type == 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode') { |
103 | isWhereComp.value = v.type; | 111 | isWhereComp.value = v.type; |
104 | proxy.$refs.refTransferConfigRabbitMq.setStepTwoFieldsValueFunc( | 112 | proxy.$refs.refTransferConfigRabbitMq.setStepTwoFieldsValueFunc( |
105 | v.configuration, | 113 | v.configuration, |
106 | - v.name | 114 | + v.name, |
115 | + v?.additionalInfo?.description | ||
107 | ); | 116 | ); |
108 | } else if (v.type == 'org.thingsboard.rule.engine.rest.TbRestApiCallNode') { | 117 | } else if (v.type == 'org.thingsboard.rule.engine.rest.TbRestApiCallNode') { |
109 | isWhereComp.value = v.type; | 118 | isWhereComp.value = v.type; |
110 | - proxy.$refs.refTransferConfigApi.setStepTwoFieldsValueFunc(v.configuration, v.name); | 119 | + proxy.$refs.refTransferConfigApi.setStepTwoFieldsValueFunc( |
120 | + v.configuration, | ||
121 | + v.name, | ||
122 | + v?.additionalInfo?.description | ||
123 | + ); | ||
111 | } | 124 | } |
112 | } catch (e) { | 125 | } catch (e) { |
113 | return e; | 126 | return e; |