Commit ae397f60855b9c0674b0142ad3e1d28b819b0b58

Authored by xp.Huang
2 parents dfb13261 9b0f183d

Merge branch 'perf/things-model' into 'main_dev'

Perf/things model

See merge request yunteng/thingskit-front!964
... ... @@ -8,7 +8,7 @@ VITE_GLOB_PUBLIC_PATH = /
8 8 # Please note that no line breaks
9 9
10 10 # 本地
11   -VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-scada","http://localhost:3000/"],["/large-designer", "http://localhost:5555/large-designer/"]]
  11 +VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-scada","http://localhost:5173/thingskit-scada"],["/large-designer", "http://localhost:5555/large-designer/"]]
12 12
13 13 # 实时数据的ws地址
14 14 VITE_GLOB_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token=
... ...
... ... @@ -22,9 +22,11 @@
22 22 value: ModelOfMatterParams[];
23 23 disabled: boolean;
24 24 hasStructForm?: boolean;
  25 + hiddenAccessMode?: boolean;
25 26 }>(),
26 27 {
27 28 value: () => [],
  29 + hiddenAccessMode: false,
28 30 hasStructForm: false,
29 31 }
30 32 );
... ... @@ -106,11 +108,12 @@
106 108 <span class="mr-2">
107 109 <PlusOutlined />
108 110 </span>
109   - <span @click="!$props.disabled && handleCreateParams()">增加参数</span>
  111 + <span @click="!disabled && handleCreateParams()">增加参数</span>
110 112 </div>
111 113 </div>
112 114 <StructFormModel
113   - :has-struct-form="$props.hasStructForm!"
  115 + :has-struct-form="hasStructForm!"
  116 + :hidden-access-mode="hiddenAccessMode"
114 117 :disabled="$props.disabled"
115 118 :value-list="getValue"
116 119 @register="registerModal"
... ...
... ... @@ -23,6 +23,7 @@
23 23 disabled: boolean;
24 24 hasStructForm: boolean;
25 25 valueList: StructRecord[];
  26 + hiddenAccessMode: boolean;
26 27 }>();
27 28
28 29 const emit = defineEmits(['register', 'submit']);
... ... @@ -31,7 +32,7 @@
31 32
32 33 const [register, { validate, setFieldsValue, setProps }] = useForm({
33 34 labelWidth: 100,
34   - schemas: formSchemas(props.hasStructForm),
  35 + schemas: formSchemas(props.hasStructForm, props.hiddenAccessMode),
35 36 actionColOptions: {
36 37 span: 14,
37 38 },
... ...
... ... @@ -28,7 +28,11 @@ export const validateJSON = (_rule, value = [] as ModelOfMatterParams[], _callba
28 28 return Promise.reject('JSON对象不能为空');
29 29 };
30 30
31   -export const formSchemas = (hasStructForm: boolean, isTcp = false): FormSchema[] => {
  31 +export const formSchemas = (
  32 + hasStructForm: boolean,
  33 + hiddenAccessMode: boolean,
  34 + isTcp = false
  35 +): FormSchema[] => {
32 36 return [
33 37 {
34 38 field: FormField.FUNCTION_NAME,
... ... @@ -299,7 +303,7 @@ export const formSchemas = (hasStructForm: boolean, isTcp = false): FormSchema[]
299 303 colProps: {
300 304 span: 24,
301 305 },
302   - ifShow: () => !hasStructForm,
  306 + ifShow: () => !hiddenAccessMode && !hasStructForm,
303 307 defaultValue: 'r',
304 308 componentProps: {
305 309 placeholder: '请选择读写类型',
... ...
... ... @@ -14,12 +14,14 @@
14 14 import { ConfigurationPermission, Platform, searchFormSchema } from './center.data';
15 15 import { useMessage } from '/@/hooks/web/useMessage';
16 16 import { Authority } from '/@/components/Authority';
  17 + import { isDevMode } from '/@/utils/env';
17 18 import ConfigurationCenterDrawer from './ConfigurationCenterDrawer.vue';
18 19 import { useDrawer } from '/@/components/Drawer';
19 20 import { getBoundingClientRect } from '/@/utils/domUtils';
20 21 import configurationSrc from '/@/assets/icons/configuration.svg';
21 22 import { cloneDeep } from 'lodash';
22 23 import { usePermission } from '/@/hooks/web/usePermission';
  24 + import { useGlobSetting } from '/@/hooks/setting';
23 25 import { AuthIcon, CardLayoutButton } from '/@/components/Widget';
24 26 import AuthDropDown from '/@/components/Widget/AuthDropDown.vue';
25 27 import { ShareModal } from '/@/views/common/ShareModal';
... ... @@ -29,7 +31,6 @@
29 31 import { useRole } from '/@/hooks/business/useRole';
30 32 import { useClipboard } from '@vueuse/core';
31 33 import { Icon } from '/@/components/Icon';
32   - import { createScadaPageLink, ScadaModeEnum } from './help';
33 34
34 35 const listColumn = ref(5);
35 36
... ... @@ -129,15 +130,25 @@
129 130 }
130 131 };
131 132
  133 + const { configurationPrefix } = useGlobSetting();
  134 + const isDev = isDevMode();
  135 +
132 136 const handlePreview = (record: ConfigurationCenterItemsModal) => {
133 137 if (!unref(getPreviewFlag)) return;
134   - createScadaPageLink(record, ScadaModeEnum.LIGHTBOX);
  138 + window.open(
  139 + `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${
  140 + record!.id
  141 + }&lightbox=1&organizationId=${record.organizationId}`
  142 + );
135 143 };
136 144
137 145 const handleDesign = (record: ConfigurationCenterItemsModal) => {
138 146 if (!unref(getDesignFlag)) return;
139   -
140   - createScadaPageLink(record, ScadaModeEnum.DESIGN);
  147 + window.open(
  148 + `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${
  149 + record!.id
  150 + }&organizationId=${record.organizationId}`
  151 + );
141 152 };
142 153
143 154 const handleDelete = async (record: ConfigurationCenterItemsModal) => {
... ... @@ -154,7 +165,14 @@
154 165 };
155 166
156 167 const createShareUrl = (record: ConfigurationCenterItemsModal) => {
157   - return createScadaPageLink(record, ScadaModeEnum.SHARE, false);
  168 + const searchParams = new URLSearchParams();
  169 + isDev && searchParams.set('dev', '1');
  170 + searchParams.set('share', 'SCADA');
  171 + searchParams.set('configurationId', record.id);
  172 + searchParams.set('publicId', record.publicId || '');
  173 + searchParams.set('lightbox', '1');
  174 + searchParams.set('organizationId', record!.organizationId || '');
  175 + return `${origin}${configurationPrefix}/?${searchParams.toString()}`;
158 176 };
159 177
160 178 const { copied, copy } = useClipboard({ legacy: true });
... ...
... ... @@ -19,7 +19,7 @@
19 19
20 20 const [register, { validate, resetFields, setFieldsValue, setProps }] = useForm({
21 21 labelWidth: 100,
22   - schemas: formSchemas(false, props.transportType === TransportTypeEnum.TCP),
  22 + schemas: formSchemas(false, false, props.transportType === TransportTypeEnum.TCP),
23 23 actionColOptions: {
24 24 span: 14,
25 25 },
... ...
... ... @@ -143,6 +143,9 @@ export const serviceSchemas = (tcpDeviceFlag: boolean): FormSchema[] => {
143 143 rules: [{ message: '输入参数为必填项', required: true, type: 'array' }],
144 144 ifShow: !tcpDeviceFlag,
145 145 colProps: { span: 24 },
  146 + componentProps: {
  147 + hiddenAccessMode: true,
  148 + },
146 149 },
147 150 {
148 151 field: FormField.OUTPUT_PARAM,
... ... @@ -151,6 +154,9 @@ export const serviceSchemas = (tcpDeviceFlag: boolean): FormSchema[] => {
151 154 valueField: 'value',
152 155 changeEvent: 'update:value',
153 156 colProps: { span: 24 },
  157 + componentProps: {
  158 + hiddenAccessMode: true,
  159 + },
154 160 },
155 161 {
156 162 field: FormField.REFARK,
... ... @@ -218,6 +224,9 @@ export const eventSchemas: FormSchema[] = [
218 224 valueField: 'value',
219 225 changeEvent: 'update:value',
220 226 colProps: { span: 24 },
  227 + componentProps: {
  228 + hiddenAccessMode: true,
  229 + },
221 230 },
222 231 {
223 232 field: FormField.REFARK,
... ...