Commit 86c6548cf47ece562ea1a8f9563e933f91ebde64
1 parent
1f360ec4
fix(front): 数据转换BUG 【credentials里面没有username,password】
Showing
2 changed files
with
13 additions
and
76 deletions
1 | 1 | import { FormSchema } from '/@/components/Form'; |
2 | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | -import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi'; | |
4 | 3 | import { ref } from 'vue'; |
5 | 4 | import { useMessage } from '/@/hooks/web/useMessage'; |
6 | 5 | const { createMessage } = useMessage(); |
... | ... | @@ -125,25 +124,7 @@ export const modeKafkaForm: FormSchema[] = [ |
125 | 124 | if (value == '') { |
126 | 125 | reject('请输入名称'); |
127 | 126 | } else { |
128 | - if (values.name != undefined) { | |
129 | - isExistDataManagerNameApi({ | |
130 | - id: '', | |
131 | - name: value, | |
132 | - type: | |
133 | - typeValue.value == '' | |
134 | - ? 'org.thingsboard.rule.engine.kafka.TbKafkaNode' | |
135 | - : typeValue.value, | |
136 | - }).then((data) => { | |
137 | - if (data == true) { | |
138 | - createMessage.error('名称已存在'); | |
139 | - resolve(); | |
140 | - } else { | |
141 | - resolve(); | |
142 | - } | |
143 | - }); | |
144 | - } else { | |
145 | - resolve(); | |
146 | - } | |
127 | + resolve(); | |
147 | 128 | } |
148 | 129 | }); |
149 | 130 | }, |
... | ... | @@ -319,39 +300,6 @@ export const modeMqttForm: FormSchema[] = [ |
319 | 300 | maxLength: 255, |
320 | 301 | placeholder: '请输入名称', |
321 | 302 | }, |
322 | - dynamicRules: ({ values }) => { | |
323 | - return [ | |
324 | - { | |
325 | - required: true, | |
326 | - validator(_, value) { | |
327 | - return new Promise((resolve, reject) => { | |
328 | - if (value == '') { | |
329 | - reject('请输入名称'); | |
330 | - } else { | |
331 | - if (values.name != undefined) { | |
332 | - isExistDataManagerNameApi({ | |
333 | - name: value, | |
334 | - type: | |
335 | - typeValue.value == '' | |
336 | - ? 'org.thingsboard.rule.engine.mqtt.TbMqttNode' | |
337 | - : typeValue.value, | |
338 | - }).then((data) => { | |
339 | - if (data == true) { | |
340 | - createMessage.error('名称已存在'); | |
341 | - resolve(); | |
342 | - } else { | |
343 | - resolve(); | |
344 | - } | |
345 | - }); | |
346 | - } else { | |
347 | - resolve(); | |
348 | - } | |
349 | - } | |
350 | - }); | |
351 | - }, | |
352 | - }, | |
353 | - ]; | |
354 | - }, | |
355 | 303 | }, |
356 | 304 | { |
357 | 305 | field: 'topicPattern', |
... | ... | @@ -440,24 +388,24 @@ export const modeMqttForm: FormSchema[] = [ |
440 | 388 | }, |
441 | 389 | { |
442 | 390 | field: 'username', |
443 | - label: 'Username', | |
391 | + label: '用户名', | |
444 | 392 | colProps: { span: 12 }, |
445 | 393 | component: 'Input', |
446 | 394 | required: true, |
447 | 395 | componentProps: { |
448 | 396 | maxLength: 255, |
449 | - placeholder: '请输入Username', | |
397 | + placeholder: '请输入用户名', | |
450 | 398 | }, |
451 | 399 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), |
452 | 400 | }, |
453 | 401 | { |
454 | 402 | field: 'password', |
455 | - label: 'Password', | |
403 | + label: '密码', | |
456 | 404 | colProps: { span: 12 }, |
457 | 405 | component: 'Input', |
458 | 406 | componentProps: { |
459 | 407 | maxLength: 255, |
460 | - placeholder: '请输入Password', | |
408 | + placeholder: '请输入密码', | |
461 | 409 | }, |
462 | 410 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), |
463 | 411 | }, |
... | ... | @@ -528,24 +476,7 @@ export const modeRabbitMqForm: FormSchema[] = [ |
528 | 476 | if (value == '') { |
529 | 477 | reject('请输入名称'); |
530 | 478 | } else { |
531 | - if (values.name != undefined) { | |
532 | - isExistDataManagerNameApi({ | |
533 | - name: value, | |
534 | - type: | |
535 | - typeValue.value == '' | |
536 | - ? 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode' | |
537 | - : typeValue.value, | |
538 | - }).then((data) => { | |
539 | - if (data == true) { | |
540 | - createMessage.error('名称已存在'); | |
541 | - resolve(); | |
542 | - } else { | |
543 | - resolve(); | |
544 | - } | |
545 | - }); | |
546 | - } else { | |
547 | - resolve(); | |
548 | - } | |
479 | + resolve(); | |
549 | 480 | } |
550 | 481 | }); |
551 | 482 | }, | ... | ... |
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | <script lang="ts"> |
67 | 67 | import { defineComponent, ref, reactive } from 'vue'; |
68 | 68 | import { BasicForm, useForm } from '/@/components/Form'; |
69 | - import { modeMqttForm } from '../config'; | |
69 | + import { CredentialsEnum, modeMqttForm } from '../config'; | |
70 | 70 | import { InboxOutlined } from '@ant-design/icons-vue'; |
71 | 71 | import { Alert, Divider, Descriptions, Upload } from 'ant-design-vue'; |
72 | 72 | |
... | ... | @@ -128,6 +128,12 @@ |
128 | 128 | const getSonValueFunc = async () => { |
129 | 129 | sonValues.configuration = await validate(); |
130 | 130 | credentialsV.credentials.type = sonValues.configuration.type; |
131 | + if (credentialsV.credentials.type == CredentialsEnum.IS_BASIC) { | |
132 | + credentialsV.credentials.username = sonValues.configuration.username; | |
133 | + credentialsV.credentials.password = sonValues.configuration.password; | |
134 | + sonValues.configuration.username = undefined; | |
135 | + sonValues.configuration.password = undefined; | |
136 | + } | |
131 | 137 | Object.assign(sonValues.configuration, credentialsV); |
132 | 138 | return sonValues; |
133 | 139 | }; | ... | ... |