Commit 7fc071022d01a9c7d719c4bfc3dc3bfa21f01fa6
Merge branch 'perf/configuration-center' into 'main_dev'
Perf/configuration center See merge request yunteng/thingskit-front!960
Showing
6 changed files
with
73 additions
and
11 deletions
1 | 1 | import { StructJSON } from './modelOfMatterModel'; |
2 | 2 | import { BasicPageParams } from '/@/api/model/baseModel'; |
3 | -import { AlarmStatus } from '/@/views/alarm/log/config/detail.config'; | |
3 | +import { AlarmStatus } from '/@/enums/alarmEnum'; | |
4 | 4 | import { DeviceStatusEnum } from '/@/views/rule/dataFlow/cpns/config'; |
5 | 5 | export enum DeviceState { |
6 | 6 | INACTIVE = 'INACTIVE', | ... | ... |
... | ... | @@ -4,6 +4,7 @@ import { createImgPreview } from '/@/components/Preview'; |
4 | 4 | import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter'; |
5 | 5 | import { useComponentRegister } from '/@/components/Form'; |
6 | 6 | import { OrgTreeSelect } from '../../common/OrgTreeSelect'; |
7 | +import { getDeviceProfile } from '/@/api/alarm/position'; | |
7 | 8 | |
8 | 9 | useComponentRegister('OrgTreeSelect', OrgTreeSelect); |
9 | 10 | export enum Platform { |
... | ... | @@ -136,6 +137,24 @@ export const formSchema: FormSchema[] = [ |
136 | 137 | component: 'OrgTreeSelect', |
137 | 138 | }, |
138 | 139 | { |
140 | + field: 'isTemplate', | |
141 | + label: '模版', | |
142 | + component: 'Switch', | |
143 | + defaultValue: 0, | |
144 | + }, | |
145 | + { | |
146 | + field: 'productIds', | |
147 | + label: '产品', | |
148 | + component: 'ApiSelect', | |
149 | + required: true, | |
150 | + componentProps: { | |
151 | + api: getDeviceProfile, | |
152 | + mode: 'multiple', | |
153 | + labelField: 'name', | |
154 | + valueField: 'tbProfileId', | |
155 | + }, | |
156 | + }, | |
157 | + { | |
139 | 158 | field: 'platform', |
140 | 159 | label: '平台', |
141 | 160 | required: true, | ... | ... |
src/views/configuration/center/help.ts
0 → 100644
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 | + .slice(0, 10) | |
7 | + .padEnd(10, getRandomString()) | |
8 | + .split('') | |
9 | + .map((item) => (Math.random() > 0.5 ? item.toUpperCase() : item)) | |
10 | + .join(''); | |
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 | 31 | import { useRole } from '/@/hooks/business/useRole'; |
32 | 32 | import { useClipboard } from '@vueuse/core'; |
33 | 33 | import { Icon } from '/@/components/Icon'; |
34 | + import { encode } from './help'; | |
34 | 35 | |
35 | 36 | const listColumn = ref(5); |
36 | 37 | |
... | ... | @@ -135,20 +136,44 @@ |
135 | 136 | |
136 | 137 | const handlePreview = (record: ConfigurationCenterItemsModal) => { |
137 | 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 | 158 | const handleDesign = (record: ConfigurationCenterItemsModal) => { |
146 | 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 | 179 | const handleDelete = async (record: ConfigurationCenterItemsModal) => { | ... | ... |