Commit 491c013a0b8403d256396f8898d561426efec789

Authored by xp.Huang
2 parents 618b6218 d5512a07

Merge branch 'ww' into 'main'

fix: DEFECT-1046 create device fill in code field need deivceType is SENSOR && transportType is TCP

See merge request yunteng/thingskit-front!478
1 1 <script lang="ts" setup>
2 2 import { h } from 'vue';
  3 + import { useI18n } from 'vue-i18n';
3 4 import { Description, useDescription } from '/@/components/Description';
4 5 import { BasicModal, useModal } from '/@/components/Modal';
  6 + import { cacheCipher } from '/@/settings/encryptionSetting';
  7 + import { AesEncryption } from '/@/utils/cipher';
  8 +
  9 + const encryption = new AesEncryption(cacheCipher);
  10 +
  11 + const { t } = useI18n();
  12 +
  13 + enum FiledKey {
  14 + copyright = 'field1',
  15 + website = 'filed2',
  16 + authorization = 'field3',
  17 + }
  18 +
  19 + // const handleEncode = (string: string) => {
  20 + // return encryption.encryptByAES(string);
  21 + // };
  22 +
  23 + const handleDecode = (encodeString: string) => {
  24 + return encryption.decryptByAES(encodeString);
  25 + };
5 26
6 27 const [register] = useModal();
7 28
... ... @@ -15,19 +36,18 @@
15 36 paddingRight: '20px',
16 37 },
17 38 data: {
18   - copyright:
19   - 'ThingsKit物联网平台版权归成都云腾五洲科技有限公司所有,您可以任意商用,但请注意保留本版权声明',
20   - website: 'https://thingskit.com',
21   - authorization: '若不想保留本版权声明,请前往以下链接查看移出方法,',
  39 + [FiledKey.copyright]: handleDecode(t('routes.aboutSoftware.copyright')),
  40 + [FiledKey.website]: handleDecode(t('routes.aboutSoftware.website')),
  41 + [FiledKey.authorization]: handleDecode(t('routes.aboutSoftware.authorization')),
22 42 },
23 43 schema: [
24 44 {
25   - field: 'copyright',
26   - label: '版权声明',
  45 + field: FiledKey.copyright,
  46 + label: handleDecode(t('routes.aboutSoftware.copyrightLabel')),
27 47 },
28 48 {
29   - field: 'website',
30   - label: '官网',
  49 + field: FiledKey.website,
  50 + label: handleDecode(t('routes.aboutSoftware.websiteLabel')),
31 51 render: (val: string) => {
32 52 return h(
33 53 'span',
... ... @@ -37,10 +57,9 @@
37 57 },
38 58 },
39 59 {
40   - field: 'authorization',
41   - label: '商业授权',
  60 + field: FiledKey.authorization,
  61 + label: handleDecode(t('routes.aboutSoftware.authorizationLabel')),
42 62 render: (val: string) => {
43   - console.log(val);
44 63 // https://community.thingskit.com/question/20.html
45 64 return h('div', {}, [
46 65 h('span', val),
... ...
  1 +export default {
  2 + copyrightLabel: 'euVkVv2k+9lAoBFk2/IcAg==',
  3 + websiteLabel: 'Lg18XskCEQMA57HJp/kFSg==',
  4 + authorizationLabel: 'RgtDsxIoA+6FMp4Ani+utw==',
  5 + copyright:
  6 + '5ZZv6QlLvd5rrVAubQbHxCb2HrJoY+efYpnto5GHh4Diz5PVne8rb1Ao/L+kLUrgeJe5BGIepGMuyURKaDeSPURtCLInlllTNHKjGbnJOm8BZRFm2DUWcHktj20z4WgPf2eu4deeGr1S+i62lLZwj9o9Ynf30T5W500YBzFCnb65cXA7tXGG35JhOy3fe7oo',
  7 + website: 'GJahLAezazanWODyf7QEGjU3xfvz1GEKW0OTFhG9m+U=',
  8 + authorization:
  9 + '8knL7RPacArF00UmNK2ANxRyISIZwycI8erZvHsg+fGt9Gw0Q3SLPgRLr5o+1lzs8D2RVwfiu6ogHgf8IyZHf+4A7SdTa/DRFSBVIXBgzjQ=',
  10 +};
... ...
  1 +export default {
  2 + copyrightLabel: 'euVkVv2k+9lAoBFk2/IcAg==',
  3 + websiteLabel: 'Lg18XskCEQMA57HJp/kFSg==',
  4 + authorizationLabel: 'RgtDsxIoA+6FMp4Ani+utw==',
  5 + copyright:
  6 + '5ZZv6QlLvd5rrVAubQbHxCb2HrJoY+efYpnto5GHh4Diz5PVne8rb1Ao/L+kLUrgeJe5BGIepGMuyURKaDeSPURtCLInlllTNHKjGbnJOm8BZRFm2DUWcHktj20z4WgPf2eu4deeGr1S+i62lLZwj9o9Ynf30T5W500YBzFCnb65cXA7tXGG35JhOy3fe7oo',
  7 + website: 'GJahLAezazanWODyf7QEGjU3xfvz1GEKW0OTFhG9m+U=',
  8 + authorization:
  9 + '8knL7RPacArF00UmNK2ANxRyISIZwycI8erZvHsg+fGt9Gw0Q3SLPgRLr5o+1lzs8D2RVwfiu6ogHgf8IyZHf+4A7SdTa/DRFSBVIXBgzjQ=',
  10 +};
... ...
1 1 import { FormSchema } from '/@/components/Form';
2 2 import { findDictItemByCode } from '/@/api/system/dict';
3 3 import { deviceProfile, getGatewayDevice } from '/@/api/device/deviceManager';
  4 +import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
  5 +import { TransportTypeEnum } from '../../profiles/components/TransportDescript/const';
4 6
5 7 export enum TypeEnum {
6 8 IS_GATEWAY = 'GATEWAY',
... ... @@ -116,7 +118,10 @@ export const step1Schemas: FormSchema[] = [
116 118 label: '地址码',
117 119 component: 'Input',
118 120 ifShow: ({ model }) => {
119   - return model['transportType'] === 'TCP';
  121 + return (
  122 + model['transportType'] === TransportTypeEnum.TCP &&
  123 + model['deviceType'] === DeviceTypeEnum.SENSOR
  124 + );
120 125 },
121 126 dynamicRules: ({ model }) => {
122 127 return [{ required: model['transportType'] === 'TCP', message: '地址码为必填项' }];
... ...
... ... @@ -362,7 +362,6 @@
362 362
363 363 const generateSN = async () => {
364 364 const data = await generateSNCode();
365   - console.log(data);
366 365 setFieldsValue({
367 366 sn: data,
368 367 });
... ...