Commit 86c6548cf47ece562ea1a8f9563e933f91ebde64
1 parent
1f360ec4
fix(front): 数据转换BUG 【credentials里面没有username,password】
Showing
2 changed files
with
13 additions
and
76 deletions
1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
2 | import { findDictItemByCode } from '/@/api/system/dict'; | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | -import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi'; | ||
4 | import { ref } from 'vue'; | 3 | import { ref } from 'vue'; |
5 | import { useMessage } from '/@/hooks/web/useMessage'; | 4 | import { useMessage } from '/@/hooks/web/useMessage'; |
6 | const { createMessage } = useMessage(); | 5 | const { createMessage } = useMessage(); |
@@ -125,25 +124,7 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -125,25 +124,7 @@ export const modeKafkaForm: FormSchema[] = [ | ||
125 | if (value == '') { | 124 | if (value == '') { |
126 | reject('请输入名称'); | 125 | reject('请输入名称'); |
127 | } else { | 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,39 +300,6 @@ export const modeMqttForm: FormSchema[] = [ | ||
319 | maxLength: 255, | 300 | maxLength: 255, |
320 | placeholder: '请输入名称', | 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 | field: 'topicPattern', | 305 | field: 'topicPattern', |
@@ -440,24 +388,24 @@ export const modeMqttForm: FormSchema[] = [ | @@ -440,24 +388,24 @@ export const modeMqttForm: FormSchema[] = [ | ||
440 | }, | 388 | }, |
441 | { | 389 | { |
442 | field: 'username', | 390 | field: 'username', |
443 | - label: 'Username', | 391 | + label: '用户名', |
444 | colProps: { span: 12 }, | 392 | colProps: { span: 12 }, |
445 | component: 'Input', | 393 | component: 'Input', |
446 | required: true, | 394 | required: true, |
447 | componentProps: { | 395 | componentProps: { |
448 | maxLength: 255, | 396 | maxLength: 255, |
449 | - placeholder: '请输入Username', | 397 | + placeholder: '请输入用户名', |
450 | }, | 398 | }, |
451 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), | 399 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), |
452 | }, | 400 | }, |
453 | { | 401 | { |
454 | field: 'password', | 402 | field: 'password', |
455 | - label: 'Password', | 403 | + label: '密码', |
456 | colProps: { span: 12 }, | 404 | colProps: { span: 12 }, |
457 | component: 'Input', | 405 | component: 'Input', |
458 | componentProps: { | 406 | componentProps: { |
459 | maxLength: 255, | 407 | maxLength: 255, |
460 | - placeholder: '请输入Password', | 408 | + placeholder: '请输入密码', |
461 | }, | 409 | }, |
462 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), | 410 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), |
463 | }, | 411 | }, |
@@ -528,24 +476,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -528,24 +476,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
528 | if (value == '') { | 476 | if (value == '') { |
529 | reject('请输入名称'); | 477 | reject('请输入名称'); |
530 | } else { | 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,7 +66,7 @@ | ||
66 | <script lang="ts"> | 66 | <script lang="ts"> |
67 | import { defineComponent, ref, reactive } from 'vue'; | 67 | import { defineComponent, ref, reactive } from 'vue'; |
68 | import { BasicForm, useForm } from '/@/components/Form'; | 68 | import { BasicForm, useForm } from '/@/components/Form'; |
69 | - import { modeMqttForm } from '../config'; | 69 | + import { CredentialsEnum, modeMqttForm } from '../config'; |
70 | import { InboxOutlined } from '@ant-design/icons-vue'; | 70 | import { InboxOutlined } from '@ant-design/icons-vue'; |
71 | import { Alert, Divider, Descriptions, Upload } from 'ant-design-vue'; | 71 | import { Alert, Divider, Descriptions, Upload } from 'ant-design-vue'; |
72 | 72 | ||
@@ -128,6 +128,12 @@ | @@ -128,6 +128,12 @@ | ||
128 | const getSonValueFunc = async () => { | 128 | const getSonValueFunc = async () => { |
129 | sonValues.configuration = await validate(); | 129 | sonValues.configuration = await validate(); |
130 | credentialsV.credentials.type = sonValues.configuration.type; | 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 | Object.assign(sonValues.configuration, credentialsV); | 137 | Object.assign(sonValues.configuration, credentialsV); |
132 | return sonValues; | 138 | return sonValues; |
133 | }; | 139 | }; |