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