Commit 5db2f6981ac004847550f03eddbc7134991b9903

Authored by ww
1 parent f8607ab0

perf: 优化组态中心

@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 "clazz", 9 "clazz",
10 "Cmds", 10 "Cmds",
11 "COAP", 11 "COAP",
  12 + "drawio",
12 "echarts", 13 "echarts",
13 "edrx", 14 "edrx",
14 "EFENTO", 15 "EFENTO",
@@ -8,6 +8,7 @@ export interface ConfigurationCenterItemsModal { @@ -8,6 +8,7 @@ export interface ConfigurationCenterItemsModal {
8 remark: string; 8 remark: string;
9 publicId?: string; 9 publicId?: string;
10 organizationId?: string; 10 organizationId?: string;
  11 + platform?: string;
11 } 12 }
12 export type queryPageParams = BasicPageParams & { 13 export type queryPageParams = BasicPageParams & {
13 name?: Nullable<string>; 14 name?: Nullable<string>;
1 import { StructJSON } from './modelOfMatterModel'; 1 import { StructJSON } from './modelOfMatterModel';
2 import { BasicPageParams } from '/@/api/model/baseModel'; 2 import { BasicPageParams } from '/@/api/model/baseModel';
3 -import { AlarmStatus } from '/@/views/alarm/log/config/detail.config'; 3 +import { AlarmStatus } from '/@/enums/alarmEnum';
4 import { DeviceStatusEnum } from '/@/views/rule/dataFlow/cpns/config'; 4 import { DeviceStatusEnum } from '/@/views/rule/dataFlow/cpns/config';
5 export enum DeviceState { 5 export enum DeviceState {
6 INACTIVE = 'INACTIVE', 6 INACTIVE = 'INACTIVE',
  1 +const getRandomString = () => Number(Math.random().toString().substring(2)).toString(36);
  2 +
  3 +export const encode = (record: Recordable) => {
  4 + let hash = JSON.stringify(record);
  5 + const mixinString = getRandomString()
  6 + .padEnd(10, getRandomString())
  7 + .split('')
  8 + .map((item) => (Math.random() > 0.5 ? item.toUpperCase() : item))
  9 + .join('');
  10 +
  11 + hash = window.btoa(hash);
  12 + hash = hash.substring(0, 6) + mixinString + hash.substring(6);
  13 + hash = window.btoa(hash);
  14 + return hash;
  15 +};
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 import { useRole } from '/@/hooks/business/useRole'; 31 import { useRole } from '/@/hooks/business/useRole';
32 import { useClipboard } from '@vueuse/core'; 32 import { useClipboard } from '@vueuse/core';
33 import { Icon } from '/@/components/Icon'; 33 import { Icon } from '/@/components/Icon';
  34 + import { encode } from './help';
34 35
35 const listColumn = ref(5); 36 const listColumn = ref(5);
36 37
@@ -135,20 +136,44 @@ @@ -135,20 +136,44 @@
135 136
136 const handlePreview = (record: ConfigurationCenterItemsModal) => { 137 const handlePreview = (record: ConfigurationCenterItemsModal) => {
137 if (!unref(getPreviewFlag)) return; 138 if (!unref(getPreviewFlag)) return;
138 - window.open(  
139 - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${  
140 - record!.id  
141 - }&lightbox=1&organizationId=${record.organizationId}`  
142 - ); 139 + // window.open(
  140 + // `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${
  141 + // record!.id
  142 + // }&lightbox=1&organizationId=${record.organizationId}`
  143 + // );
  144 +
  145 + const params = {
  146 + configurationId: record.id,
  147 + organizationId: record.organizationId,
  148 + mode: 'lightbox',
  149 + platform: record.platform,
  150 + };
  151 +
  152 + const href = new URL(location.origin);
  153 + href.pathname = '/drawio';
  154 + href.hash = encode(params);
  155 + window.open(href.href);
143 }; 156 };
144 157
145 const handleDesign = (record: ConfigurationCenterItemsModal) => { 158 const handleDesign = (record: ConfigurationCenterItemsModal) => {
146 if (!unref(getDesignFlag)) return; 159 if (!unref(getDesignFlag)) return;
147 - window.open(  
148 - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${  
149 - record!.id  
150 - }&organizationId=${record.organizationId}`  
151 - ); 160 + // window.open(
  161 + // `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${
  162 + // record!.id
  163 + // }&organizationId=${record.organizationId}`
  164 + // );
  165 +
  166 + const params = {
  167 + configurationId: record.id,
  168 + organizationId: record.organizationId,
  169 + mode: 'design',
  170 + platform: record.platform,
  171 + };
  172 +
  173 + const href = new URL(location.origin);
  174 + href.pathname = '/drawio';
  175 + href.hash = encode(params);
  176 + window.open(href.href);
152 }; 177 };
153 178
154 const handleDelete = async (record: ConfigurationCenterItemsModal) => { 179 const handleDelete = async (record: ConfigurationCenterItemsModal) => {