Commit 021aa9bb188e7267a7963396238211f50c81b688

Authored by fengwotao
2 parents 2eb853ee e26aac7e

Merge branch 'main' into local_dev_ft

@@ -52,7 +52,7 @@ export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => { @@ -52,7 +52,7 @@ export const getTableTenantProfileApi = (params?: QueryTenantProfilesParam) => {
52 ...params, 52 ...params,
53 orderFiled: 'createdTime', 53 orderFiled: 'createdTime',
54 }; 54 };
55 - return defHttp.get<PaginationResult>({ 55 + return defHttp.get<PaginationResult<{ default: boolean; id: { id: string } }>>({
56 url: Api.getTenantProfile, 56 url: Api.getTenantProfile,
57 params: param, 57 params: param,
58 }); 58 });
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 import { h } from 'vue'; 2 import { h } from 'vue';
  3 + import { useI18n } from 'vue-i18n';
3 import { Description, useDescription } from '/@/components/Description'; 4 import { Description, useDescription } from '/@/components/Description';
4 import { BasicModal, useModal } from '/@/components/Modal'; 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 const [register] = useModal(); 27 const [register] = useModal();
7 28
@@ -15,19 +36,18 @@ @@ -15,19 +36,18 @@
15 paddingRight: '20px', 36 paddingRight: '20px',
16 }, 37 },
17 data: { 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 schema: [ 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 render: (val: string) => { 51 render: (val: string) => {
32 return h( 52 return h(
33 'span', 53 'span',
@@ -37,10 +57,9 @@ @@ -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 render: (val: string) => { 62 render: (val: string) => {
43 - console.log(val);  
44 // https://community.thingskit.com/question/20.html 63 // https://community.thingskit.com/question/20.html
45 return h('div', {}, [ 64 return h('div', {}, [
46 h('span', val), 65 h('span', val),
@@ -62,7 +81,7 @@ @@ -62,7 +81,7 @@
62 <template> 81 <template>
63 <BasicModal 82 <BasicModal
64 @register="register" 83 @register="register"
65 - title="关于我们" 84 + :title="handleDecode(t('routes.aboutSoftware.aboutSoftware'))"
66 width="50%" 85 width="50%"
67 cancel-text="关闭" 86 cancel-text="关闭"
68 :show-ok-btn="false" 87 :show-ok-btn="false"
@@ -37,7 +37,11 @@ @@ -37,7 +37,11 @@
37 :text="t('layout.header.dropdownItemChangePassword')" 37 :text="t('layout.header.dropdownItemChangePassword')"
38 icon="ant-design:unlock-twotone" 38 icon="ant-design:unlock-twotone"
39 /> 39 />
40 - <MenuItem key="aboutSoftware" text="关于软件" icon="ant-design:message-outline" /> 40 + <MenuItem
  41 + key="aboutSoftware"
  42 + :text="handleDecode(t('routes.aboutSoftware.aboutSoftware'))"
  43 + icon="ant-design:message-outline"
  44 + />
41 <MenuItem 45 <MenuItem
42 v-if="getUseLockPage" 46 v-if="getUseLockPage"
43 key="lock" 47 key="lock"
@@ -77,6 +81,8 @@ @@ -77,6 +81,8 @@
77 import { useRouter } from 'vue-router'; 81 import { useRouter } from 'vue-router';
78 import { usePermission } from '/@/hooks/web/usePermission'; 82 import { usePermission } from '/@/hooks/web/usePermission';
79 import AboutSoftwareModal from '../AboutSoftwareModal.vue'; 83 import AboutSoftwareModal from '../AboutSoftwareModal.vue';
  84 + import { AesEncryption } from '/@/utils/cipher';
  85 + import { cacheCipher } from '/@/settings/encryptionSetting';
80 86
81 type MenuEvent = 'logout' | 'doc' | 'lock' | 'personal' | 'changePassword' | 'aboutSoftware'; 87 type MenuEvent = 'logout' | 'doc' | 'lock' | 'personal' | 'changePassword' | 'aboutSoftware';
82 88
@@ -176,7 +182,13 @@ @@ -176,7 +182,13 @@
176 router.push('/system/changePassword'); 182 router.push('/system/changePassword');
177 }; 183 };
178 184
  185 + const encryption = new AesEncryption(cacheCipher);
  186 + const handleDecode = (string: string) => {
  187 + return encryption.decryptByAES(string);
  188 + };
  189 +
179 return { 190 return {
  191 + handleDecode,
180 updataPersonlData, 192 updataPersonlData,
181 refreshPersonlData, 193 refreshPersonlData,
182 refreshPersonalFunc, 194 refreshPersonalFunc,
  1 +export default {
  2 + aboutSoftware: 'M2e/fueM5gOxek1+Cqh5CA==',
  3 + copyrightLabel: 'euVkVv2k+9lAoBFk2/IcAg==',
  4 + websiteLabel: 'Lg18XskCEQMA57HJp/kFSg==',
  5 + authorizationLabel: 'RgtDsxIoA+6FMp4Ani+utw==',
  6 + copyright:
  7 + '5ZZv6QlLvd5rrVAubQbHxCb2HrJoY+efYpnto5GHh4Diz5PVne8rb1Ao/L+kLUrgeJe5BGIepGMuyURKaDeSPURtCLInlllTNHKjGbnJOm8BZRFm2DUWcHktj20z4WgPf2eu4deeGr1S+i62lLZwj9o9Ynf30T5W500YBzFCnb65cXA7tXGG35JhOy3fe7oo',
  8 + website: 'GJahLAezazanWODyf7QEGjU3xfvz1GEKW0OTFhG9m+U=',
  9 + authorization:
  10 + '8knL7RPacArF00UmNK2ANxRyISIZwycI8erZvHsg+fGt9Gw0Q3SLPgRLr5o+1lzs8D2RVwfiu6ogHgf8IyZHf+4A7SdTa/DRFSBVIXBgzjQ=',
  11 +};
  1 +export default {
  2 + aboutSoftware: 'M2e/fueM5gOxek1+Cqh5CA==',
  3 + copyrightLabel: 'euVkVv2k+9lAoBFk2/IcAg==',
  4 + websiteLabel: 'Lg18XskCEQMA57HJp/kFSg==',
  5 + authorizationLabel: 'RgtDsxIoA+6FMp4Ani+utw==',
  6 + copyright:
  7 + '5ZZv6QlLvd5rrVAubQbHxCb2HrJoY+efYpnto5GHh4Diz5PVne8rb1Ao/L+kLUrgeJe5BGIepGMuyURKaDeSPURtCLInlllTNHKjGbnJOm8BZRFm2DUWcHktj20z4WgPf2eu4deeGr1S+i62lLZwj9o9Ynf30T5W500YBzFCnb65cXA7tXGG35JhOy3fe7oo',
  8 + website: 'GJahLAezazanWODyf7QEGjU3xfvz1GEKW0OTFhG9m+U=',
  9 + authorization:
  10 + '8knL7RPacArF00UmNK2ANxRyISIZwycI8erZvHsg+fGt9Gw0Q3SLPgRLr5o+1lzs8D2RVwfiu6ogHgf8IyZHf+4A7SdTa/DRFSBVIXBgzjQ=',
  11 +};
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 { deviceProfile, getGatewayDevice } from '/@/api/device/deviceManager'; 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 export enum TypeEnum { 7 export enum TypeEnum {
6 IS_GATEWAY = 'GATEWAY', 8 IS_GATEWAY = 'GATEWAY',
@@ -116,7 +118,10 @@ export const step1Schemas: FormSchema[] = [ @@ -116,7 +118,10 @@ export const step1Schemas: FormSchema[] = [
116 label: '地址码', 118 label: '地址码',
117 component: 'Input', 119 component: 'Input',
118 ifShow: ({ model }) => { 120 ifShow: ({ model }) => {
119 - return model['transportType'] === 'TCP'; 121 + return (
  122 + model['transportType'] === TransportTypeEnum.TCP &&
  123 + model['deviceType'] === DeviceTypeEnum.SENSOR
  124 + );
120 }, 125 },
121 dynamicRules: ({ model }) => { 126 dynamicRules: ({ model }) => {
122 return [{ required: model['transportType'] === 'TCP', message: '地址码为必填项' }]; 127 return [{ required: model['transportType'] === 'TCP', message: '地址码为必填项' }];
@@ -362,7 +362,6 @@ @@ -362,7 +362,6 @@
362 362
363 const generateSN = async () => { 363 const generateSN = async () => {
364 const data = await generateSNCode(); 364 const data = await generateSNCode();
365 - console.log(data);  
366 setFieldsValue({ 365 setFieldsValue({
367 sn: data, 366 sn: data,
368 }); 367 });
@@ -130,9 +130,9 @@ export const tenantFormSchema: FormSchema[] = [ @@ -130,9 +130,9 @@ export const tenantFormSchema: FormSchema[] = [
130 return { 130 return {
131 api: async (params: QueryTenantProfilesParam) => { 131 api: async (params: QueryTenantProfilesParam) => {
132 const { items, total } = await getTableTenantProfileApi(params); 132 const { items, total } = await getTableTenantProfileApi(params);
133 - const firstRecord = items.at(0);  
134 - if (firstRecord) {  
135 - setFieldsValue({ tenantProfileId: firstRecord.id.id }); 133 + const defaultRecord = items.find((item) => item.default);
  134 + if (defaultRecord) {
  135 + setFieldsValue({ tenantProfileId: defaultRecord.id.id });
136 } 136 }
137 return { items, total }; 137 return { items, total };
138 }, 138 },