Commit 92b5c14e5b9b63934f5ee20ba6c5f55626904854

Authored by loveumiko
2 parents bf6190c8 21c4291e

Merge branch 'main_dev' of http://git.yunteng.com/yunteng/thingskit-front into f…

…eat/device-new-protocol
Showing 48 changed files with 349 additions and 176 deletions
@@ -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=
@@ -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,8 @@ export interface ConfigurationCenterItemsModal { @@ -8,6 +8,8 @@ export interface ConfigurationCenterItemsModal {
8 remark: string; 8 remark: string;
9 publicId?: string; 9 publicId?: string;
10 organizationId?: string; 10 organizationId?: string;
  11 + platform?: string;
  12 + productIds?: string;
11 } 13 }
12 export type queryPageParams = BasicPageParams & { 14 export type queryPageParams = BasicPageParams & {
13 name?: Nullable<string>; 15 name?: Nullable<string>;
@@ -45,7 +45,7 @@ enum DeviceManagerApi { @@ -45,7 +45,7 @@ enum DeviceManagerApi {
45 DEVICE_PUBLIC = '/customer/public/device', 45 DEVICE_PUBLIC = '/customer/public/device',
46 46
47 DEVICE_PRIVATE = '/customer/device', 47 DEVICE_PRIVATE = '/customer/device',
48 - DEVICE_COLLECT = '/device/collect ', //收藏 48 + DEVICE_COLLECT = '/collect/DEVICE_COLLECT', //收藏
49 49
50 /** 50 /**
51 * @description 通过设备列表获取设备信息 51 * @description 通过设备列表获取设备信息
@@ -62,7 +62,7 @@ export const devicePage = (params: DeviceQueryParam) => { @@ -62,7 +62,7 @@ export const devicePage = (params: DeviceQueryParam) => {
62 }); 62 });
63 }; 63 };
64 64
65 -export const deviceCollect = (params: Array<any>) => { 65 +export const deviceCollect = (params: string[]) => {
66 return defHttp.post({ 66 return defHttp.post({
67 url: `${DeviceManagerApi.DEVICE_COLLECT}`, 67 url: `${DeviceManagerApi.DEVICE_COLLECT}`,
68 params, 68 params,
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',
@@ -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: '请选择读写类型',
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 icon="ion:document-text-outline" 17 icon="ion:document-text-outline"
18 /> 18 />
19 <MenuItem 19 <MenuItem
  20 + v-if="hasPermission('system:password:view')"
20 key="changePassword" 21 key="changePassword"
21 :text="t('layout.header.dropdownItemChangePassword')" 22 :text="t('layout.header.dropdownItemChangePassword')"
22 icon="ant-design:unlock-twotone" 23 icon="ant-design:unlock-twotone"
@@ -279,20 +279,20 @@ @@ -279,20 +279,20 @@
279 ref="listEl" 279 ref="listEl"
280 :loading="loading" 280 :loading="loading"
281 :data-source="cameraList" 281 :data-source="cameraList"
282 - class="bg-light-50 w-full h-full dark:bg-dark-900 split-mode-list" 282 + class="bg-light-50 w-full !h-full dark:bg-dark-900 split-mode-list"
283 :grid="(gridLayout as any)" 283 :grid="(gridLayout as any)"
284 :style="{ '--height': `${100 / pagination.colNumber}%` }" 284 :style="{ '--height': `${100 / pagination.colNumber}%` }"
285 > 285 >
286 <template #renderItem="{ item }"> 286 <template #renderItem="{ item }">
287 <List.Item> 287 <List.Item>
288 - <div class="box-border w-full h-full p-1px"> 288 + <div class="box-border w-full !h-full p-1px">
289 <div 289 <div
290 v-if="item.placeholder" 290 v-if="item.placeholder"
291 - class="bg-black w-full h-full overflow-hidden relative" 291 + class="bg-black w-full !h-full overflow-hidden relative"
292 ></div> 292 ></div>
293 <div 293 <div
294 v-if="!item.placeholder" 294 v-if="!item.placeholder"
295 - class="bg-black w-full h-full overflow-hidden relative video-container" 295 + class="bg-black w-full !h-full overflow-hidden relative video-container"
296 > 296 >
297 <Spin 297 <Spin
298 class="!absolute top-1/2 left-1/2 transform -translate-1/2" 298 class="!absolute top-1/2 left-1/2 transform -translate-1/2"
@@ -333,7 +333,7 @@ @@ -333,7 +333,7 @@
333 } 333 }
334 334
335 .split-screen-mode:deep(.ant-spin-container) { 335 .split-screen-mode:deep(.ant-spin-container) {
336 - height: 100%; 336 + height: 100% !important;
337 } 337 }
338 338
339 .video-container { 339 .video-container {
@@ -4,6 +4,7 @@ import { createImgPreview } from '/@/components/Preview'; @@ -4,6 +4,7 @@ import { createImgPreview } from '/@/components/Preview';
4 import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter'; 4 import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter';
5 import { useComponentRegister } from '/@/components/Form'; 5 import { useComponentRegister } from '/@/components/Form';
6 import { OrgTreeSelect } from '../../common/OrgTreeSelect'; 6 import { OrgTreeSelect } from '../../common/OrgTreeSelect';
  7 +import { getDeviceProfile } from '/@/api/alarm/position';
7 8
8 useComponentRegister('OrgTreeSelect', OrgTreeSelect); 9 useComponentRegister('OrgTreeSelect', OrgTreeSelect);
9 export enum Platform { 10 export enum Platform {
@@ -136,6 +137,28 @@ export const formSchema: FormSchema[] = [ @@ -136,6 +137,28 @@ export const formSchema: FormSchema[] = [
136 component: 'OrgTreeSelect', 137 component: 'OrgTreeSelect',
137 }, 138 },
138 { 139 {
  140 + field: 'isTemplate',
  141 + label: '模版',
  142 + component: 'Switch',
  143 + defaultValue: 0,
  144 + componentProps: {
  145 + checkedValue: 1,
  146 + unCheckedValue: 0,
  147 + },
  148 + },
  149 + {
  150 + field: 'productIds',
  151 + label: '产品',
  152 + component: 'ApiSelect',
  153 + required: true,
  154 + componentProps: {
  155 + api: getDeviceProfile,
  156 + mode: 'multiple',
  157 + labelField: 'name',
  158 + valueField: 'tbProfileId',
  159 + },
  160 + },
  161 + {
139 field: 'platform', 162 field: 'platform',
140 label: '平台', 163 label: '平台',
141 required: true, 164 required: true,
  1 +import { Platform } from './center.data';
  2 +import { ConfigurationCenterItemsModal } from '/@/api/configuration/center/model/configurationCenterModal';
  3 +import { useGlobSetting } from '/@/hooks/setting';
  4 +
  5 +export enum ScadaModeEnum {
  6 + LIGHTBOX = 'lightbox',
  7 + DESIGN = 'design',
  8 + SHARE = 'share',
  9 +}
  10 +
  11 +interface ScadaLinkParamsType {
  12 + configurationId: string;
  13 + organizationId: string;
  14 + mode: ScadaModeEnum;
  15 + platform: Platform;
  16 + publicId?: string;
  17 +}
  18 +
  19 +const getRandomString = () => Number(Math.random().toString().substring(2)).toString(36);
  20 +
  21 +export const encode = (record: Recordable) => {
  22 + let hash = JSON.stringify(record);
  23 + const mixinString = getRandomString()
  24 + .slice(0, 10)
  25 + .padEnd(10, getRandomString())
  26 + .split('')
  27 + .map((item) => (Math.random() > 0.5 ? item.toUpperCase() : item))
  28 + .join('');
  29 + hash = window.btoa(hash);
  30 + hash = hash.substring(0, 6) + mixinString + hash.substring(6);
  31 + hash = window.btoa(hash);
  32 + return hash;
  33 +};
  34 +
  35 +export const createScadaPageLink = (
  36 + record: ConfigurationCenterItemsModal,
  37 + mode: ScadaModeEnum = ScadaModeEnum.DESIGN,
  38 + open = true
  39 +) => {
  40 + const { configurationPrefix } = useGlobSetting();
  41 + const params: ScadaLinkParamsType = {
  42 + configurationId: record.id,
  43 + organizationId: record.organizationId!,
  44 + mode: mode,
  45 + platform: record.platform as Platform,
  46 + };
  47 +
  48 + if (mode === ScadaModeEnum.SHARE) {
  49 + params.publicId = record.publicId;
  50 + }
  51 +
  52 + const href = new URL(location.origin);
  53 + href.pathname = configurationPrefix;
  54 + href.hash = encode(params);
  55 + open && window.open(href.href);
  56 + return href.href;
  57 +};
@@ -14,14 +14,12 @@ @@ -14,14 +14,12 @@
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';  
18 import ConfigurationCenterDrawer from './ConfigurationCenterDrawer.vue'; 17 import ConfigurationCenterDrawer from './ConfigurationCenterDrawer.vue';
19 import { useDrawer } from '/@/components/Drawer'; 18 import { useDrawer } from '/@/components/Drawer';
20 import { getBoundingClientRect } from '/@/utils/domUtils'; 19 import { getBoundingClientRect } from '/@/utils/domUtils';
21 import configurationSrc from '/@/assets/icons/configuration.svg'; 20 import configurationSrc from '/@/assets/icons/configuration.svg';
22 import { cloneDeep } from 'lodash'; 21 import { cloneDeep } from 'lodash';
23 import { usePermission } from '/@/hooks/web/usePermission'; 22 import { usePermission } from '/@/hooks/web/usePermission';
24 - import { useGlobSetting } from '/@/hooks/setting';  
25 import { AuthIcon, CardLayoutButton } from '/@/components/Widget'; 23 import { AuthIcon, CardLayoutButton } from '/@/components/Widget';
26 import AuthDropDown from '/@/components/Widget/AuthDropDown.vue'; 24 import AuthDropDown from '/@/components/Widget/AuthDropDown.vue';
27 import { ShareModal } from '/@/views/common/ShareModal'; 25 import { ShareModal } from '/@/views/common/ShareModal';
@@ -31,6 +29,7 @@ @@ -31,6 +29,7 @@
31 import { useRole } from '/@/hooks/business/useRole'; 29 import { useRole } from '/@/hooks/business/useRole';
32 import { useClipboard } from '@vueuse/core'; 30 import { useClipboard } from '@vueuse/core';
33 import { Icon } from '/@/components/Icon'; 31 import { Icon } from '/@/components/Icon';
  32 + import { createScadaPageLink, ScadaModeEnum } from './help';
34 33
35 const listColumn = ref(5); 34 const listColumn = ref(5);
36 35
@@ -130,25 +129,15 @@ @@ -130,25 +129,15 @@
130 } 129 }
131 }; 130 };
132 131
133 - const { configurationPrefix } = useGlobSetting();  
134 - const isDev = isDevMode();  
135 -  
136 const handlePreview = (record: ConfigurationCenterItemsModal) => { 132 const handlePreview = (record: ConfigurationCenterItemsModal) => {
137 if (!unref(getPreviewFlag)) return; 133 if (!unref(getPreviewFlag)) return;
138 - window.open(  
139 - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${  
140 - record!.id  
141 - }&lightbox=1&organizationId=${record.organizationId}`  
142 - ); 134 + createScadaPageLink(record, ScadaModeEnum.LIGHTBOX);
143 }; 135 };
144 136
145 const handleDesign = (record: ConfigurationCenterItemsModal) => { 137 const handleDesign = (record: ConfigurationCenterItemsModal) => {
146 if (!unref(getDesignFlag)) return; 138 if (!unref(getDesignFlag)) return;
147 - window.open(  
148 - `${configurationPrefix}/${isDev ? '?dev=1&' : '?'}configurationId=${  
149 - record!.id  
150 - }&organizationId=${record.organizationId}`  
151 - ); 139 +
  140 + createScadaPageLink(record, ScadaModeEnum.DESIGN);
152 }; 141 };
153 142
154 const handleDelete = async (record: ConfigurationCenterItemsModal) => { 143 const handleDelete = async (record: ConfigurationCenterItemsModal) => {
@@ -165,14 +154,7 @@ @@ -165,14 +154,7 @@
165 }; 154 };
166 155
167 const createShareUrl = (record: ConfigurationCenterItemsModal) => { 156 const createShareUrl = (record: ConfigurationCenterItemsModal) => {
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()}`; 157 + return createScadaPageLink(record, ScadaModeEnum.SHARE, false);
176 }; 158 };
177 159
178 const { copied, copy } = useClipboard({ legacy: true }); 160 const { copied, copy } = useClipboard({ legacy: true });
@@ -16,54 +16,33 @@ @@ -16,54 +16,33 @@
16 </div> 16 </div>
17 </div> 17 </div>
18 <div class="mt-8"> 18 <div class="mt-8">
19 - <a-row type="flex" align="top">  
20 - <a-col  
21 - :span="  
22 - method === RequestMethodTypeEnum.WEBSOCKET  
23 - ? 11  
24 - : httpType === RequestHttpTypeEnum.POST  
25 - ? 6  
26 - : 6  
27 - "  
28 - > 19 + <div class="flex">
  20 + <div>
29 <p>过滤器函数编写:</p> 21 <p>过滤器函数编写:</p>
30 - <AceTypeIsJsEditor  
31 - :restData="getRestData"  
32 - @changeAceContent="onHandleAceContent"  
33 - ref="aceTypeIsJsEditorRef"  
34 - />  
35 - </a-col>  
36 - <a-col :span="1">  
37 - <a-divider type="vertical" class="divider-color" />  
38 - </a-col>  
39 - <a-col  
40 - :span="  
41 - method === RequestMethodTypeEnum.WEBSOCKET  
42 - ? 12  
43 - : httpType === RequestHttpTypeEnum.POST  
44 - ? 17  
45 - : 17  
46 - "  
47 - style="position: relative"  
48 - :style="{  
49 - left:  
50 - (method === RequestMethodTypeEnum.WEBSOCKET  
51 - ? 1.5  
52 - : httpType === RequestHttpTypeEnum.POST  
53 - ? -0.25  
54 - : 0) + 'vw',  
55 - }"  
56 - >  
57 - <a-col> 22 + <div class="w-90">
  23 + <AceTypeIsJsEditor
  24 + :restData="getRestData"
  25 + @changeAceContent="onHandleAceContent"
  26 + ref="aceTypeIsJsEditorRef"
  27 + />
  28 + </div>
  29 + </div>
  30 + <div><a-divider type="vertical" class="divider-color" /></div>
  31 + <div class="flex flex-col ml-8">
  32 + <div>
58 <p>接口返回数据(res):</p> 33 <p>接口返回数据(res):</p>
59 - <JsonEditor style="height: 35vh" :showBtn="true" ref="jsonEditorRef" />  
60 - </a-col>  
61 - <a-col class="mt-3"> 34 + <div>
  35 + <JsonEditor class="w-100 h-100" :showBtn="true" ref="jsonEditorRef" />
  36 + </div>
  37 + </div>
  38 + <div class="mt-4">
62 <p>过滤器结果:</p> 39 <p>过滤器结果:</p>
63 - <JsonFilterEditor style="height: 35vh" :showBtn="true" ref="jsonEditorFilterRef" />  
64 - </a-col>  
65 - </a-col>  
66 - </a-row> 40 + <div>
  41 + <JsonFilterEditor class="w-100 h-100" :showBtn="true" ref="jsonEditorFilterRef" />
  42 + </div>
  43 + </div>
  44 + </div>
  45 + </div>
67 </div> 46 </div>
68 </div> 47 </div>
69 </template> 48 </template>
@@ -78,7 +57,7 @@ @@ -78,7 +57,7 @@
78 import AceTypeIsJsEditor from '../../SimpleRequest/components/aceEditor.vue'; 57 import AceTypeIsJsEditor from '../../SimpleRequest/components/aceEditor.vue';
79 import { Tag } from 'ant-design-vue'; 58 import { Tag } from 'ant-design-vue';
80 import { useThrottleFn } from '@vueuse/shared'; 59 import { useThrottleFn } from '@vueuse/shared';
81 - import { RequestMethodTypeEnum, RequestHttpTypeEnum } from '../../../config/enum'; 60 + import { RequestMethodTypeEnum } from '../../../config/enum';
82 61
83 const emits = defineEmits(['emitExcute']); 62 const emits = defineEmits(['emitExcute']);
84 63
@@ -334,9 +313,9 @@ @@ -334,9 +313,9 @@
334 } 313 }
335 314
336 .divider-color { 315 .divider-color {
337 - height: 78.5vh; 316 + height: 54rem;
338 background-color: #e5e7eb; 317 background-color: #e5e7eb;
339 position: relative; 318 position: relative;
340 - left: 1.16vw; 319 + left: 1rem;
341 } 320 }
342 </style> 321 </style>
@@ -99,7 +99,7 @@ export const descSchema = (emit: EmitType): DescItem[] => { @@ -99,7 +99,7 @@ export const descSchema = (emit: EmitType): DescItem[] => {
99 export const realTimeDataColumns: BasicColumn[] = [ 99 export const realTimeDataColumns: BasicColumn[] = [
100 { 100 {
101 title: '键', 101 title: '键',
102 - dataIndex: 'key', 102 + dataIndex: 'name',
103 width: 100, 103 width: 100,
104 }, 104 },
105 { 105 {
@@ -175,7 +175,10 @@ @@ -175,7 +175,10 @@
175 label: '取消收藏', 175 label: '取消收藏',
176 auth: 'api:yt:device:online:record', 176 auth: 'api:yt:device:online:record',
177 icon: 'ant-design:heart-outlined', 177 icon: 'ant-design:heart-outlined',
178 - onClick: handelCollect.bind(null, record), 178 + popConfirm: {
  179 + title: '是否取消收藏',
  180 + confirm: handelCollect.bind(null, record),
  181 + },
179 }, 182 },
180 { 183 {
181 label: '删除', 184 label: '删除',
@@ -305,6 +308,7 @@ @@ -305,6 +308,7 @@
305 columns, 308 columns,
306 beforeFetch: (params) => { 309 beforeFetch: (params) => {
307 const { deviceProfileId } = params; 310 const { deviceProfileId } = params;
  311 + if (!deviceProfileId) return;
308 const obj = { 312 const obj = {
309 ...params, 313 ...params,
310 ...{ 314 ...{
@@ -106,7 +106,7 @@ export const defaultSchemas: FormSchema[] = [ @@ -106,7 +106,7 @@ export const defaultSchemas: FormSchema[] = [
106 getPopupContainer: () => document.body, 106 getPopupContainer: () => document.body,
107 }; 107 };
108 }, 108 },
109 - colProps: useGridLayout(2, 2, 2, 2, 2, 2) as unknown as ColEx, 109 + colProps: useGridLayout(1.5, 1.5, 1.5, 1.5, 1.5, 1.5) as unknown as ColEx,
110 }, 110 },
111 { 111 {
112 field: SchemaFiled.AGG, 112 field: SchemaFiled.AGG,
@@ -260,6 +260,7 @@ @@ -260,6 +260,7 @@
260 }, 260 },
261 beforeFetch: (params) => { 261 beforeFetch: (params) => {
262 const { deviceProfileId } = params; 262 const { deviceProfileId } = params;
  263 + if (!deviceProfileId) return;
263 const deviceProfileIds = [deviceProfileId]; 264 const deviceProfileIds = [deviceProfileId];
264 const obj = { 265 const obj = {
265 ...params, 266 ...params,
@@ -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,
@@ -12,6 +12,8 @@ @@ -12,6 +12,8 @@
12 import { sendSms } from '/@/api/message/template'; 12 import { sendSms } from '/@/api/message/template';
13 import { useMessage } from '/@/hooks/web/useMessage'; 13 import { useMessage } from '/@/hooks/web/useMessage';
14 import { phoneRule } from '/@/utils/rules'; 14 import { phoneRule } from '/@/utils/rules';
  15 + import { PlateFormTypeEnum } from './template.data';
  16 +
15 const schemas: FormSchema[] = [ 17 const schemas: FormSchema[] = [
16 { 18 {
17 field: 'id', 19 field: 'id',
@@ -142,7 +144,38 @@ @@ -142,7 +144,38 @@
142 field: 'params', 144 field: 'params',
143 componentProps: { 145 componentProps: {
144 placeholder: 146 placeholder:
145 - platformType.value !== 'TENCENT_CLOUD' ? '示例:{"code":"1234"}' : '示例:["123456"]', 147 + platformType.value !== PlateFormTypeEnum.tencent_cound
  148 + ? '示例:{"code":"1234"}'
  149 + : '示例:["123456"]',
  150 + },
  151 + dynamicRules: () => {
  152 + return [
  153 + {
  154 + required: true,
  155 + validator: (_, value) => {
  156 + try {
  157 + if (typeof value == 'object') {
  158 + return Promise.resolve();
  159 + } else {
  160 + if (typeof JSON.parse(value) == 'object') {
  161 + return Promise.resolve();
  162 + }
  163 + return Promise.reject(
  164 + platformType.value !== PlateFormTypeEnum.tencent_cound
  165 + ? '请输入JSON格式例如{"code":"1234"}'
  166 + : '请输入这种格式["123456"]'
  167 + );
  168 + }
  169 + } catch {
  170 + return Promise.reject(
  171 + platformType.value !== PlateFormTypeEnum.tencent_cound
  172 + ? '请输入JSON格式例如{"code":"1234"}'
  173 + : '请输入这种格式["123456"]'
  174 + );
  175 + }
  176 + },
  177 + },
  178 + ];
146 }, 179 },
147 }); 180 });
148 await resetFields(); 181 await resetFields();
@@ -154,7 +187,7 @@ @@ -154,7 +187,7 @@
154 async function handleOK() { 187 async function handleOK() {
155 let smsParams: any = null; 188 let smsParams: any = null;
156 const values = await validate(); 189 const values = await validate();
157 - if (platformType.value === 'TENCENT_CLOUD') { 190 + if (platformType.value === PlateFormTypeEnum.tencent_cound) {
158 //腾讯云发送格式 将字符串转为数组 191 //腾讯云发送格式 将字符串转为数组
159 smsParams = { 192 smsParams = {
160 tencent_param: JSON.parse(Reflect.get(values, 'params')), 193 tencent_param: JSON.parse(Reflect.get(values, 'params')),
@@ -4,6 +4,11 @@ import { findDictItemByCode } from '/@/api/system/dict'; @@ -4,6 +4,11 @@ import { findDictItemByCode } from '/@/api/system/dict';
4 import { findMessageConfig } from '/@/api/message/config'; 4 import { findMessageConfig } from '/@/api/message/config';
5 import { isMessage } from '/@/views/message/config/config.data'; 5 import { isMessage } from '/@/views/message/config/config.data';
6 6
  7 +export enum PlateFormTypeEnum {
  8 + ali_cound = 'ALI_CLOUD',
  9 + tencent_cound = 'TENCENT_CLOUD',
  10 +}
  11 +
7 export const columns: BasicColumn[] = [ 12 export const columns: BasicColumn[] = [
8 { 13 {
9 title: '模板名称', 14 title: '模板名称',
@@ -223,47 +228,33 @@ export const formSchema: FormSchema[] = [ @@ -223,47 +228,33 @@ export const formSchema: FormSchema[] = [
223 helpMessage: [], 228 helpMessage: [],
224 componentProps({ formActionType }) { 229 componentProps({ formActionType }) {
225 const { updateSchema } = formActionType; 230 const { updateSchema } = formActionType;
  231 + updateSchema({
  232 + field: 'templatePurpose',
  233 + helpMessage: [
  234 + `登录模板平台提供如下参数:
  235 + {
  236 + "code":"验证码"
  237 + }。`,
  238 + `忘记密码模板平台提供如下参数:
  239 + {
  240 + "code":"验证码"
  241 + }。`,
  242 + `告警通知模板平台提供如下参数:
  243 + {
  244 + "organization":"设备所属组织",
  245 + "deviceName":"设备名称",
  246 + "severity":"告警等级",
  247 + "type":"告警类型",
  248 + "triggerValue":"触发值",
  249 + "createTime":"告警时间"
  250 + }。`,
  251 + `清除密码模板平台提供如下参数:
  252 + {
  253 + "code":"验证码"
  254 + }。`,
  255 + ],
  256 + });
226 return { 257 return {
227 - onChange(value) {  
228 - if (value === 'FOR_LOGIN') {  
229 - updateSchema({  
230 - field: 'templatePurpose',  
231 - helpMessage: `登录模板平台提供如下参数:  
232 - {  
233 - "code":"验证码"  
234 - }`,  
235 - });  
236 - } else if (value === 'FOR_FORGET_PASSWORD') {  
237 - updateSchema({  
238 - field: 'templatePurpose',  
239 - helpMessage: `忘记密码模板平台提供如下参数:  
240 - {  
241 - "code":"验证码"  
242 - }`,  
243 - });  
244 - } else if (value === 'FOR_ALARM_NOTICE') {  
245 - updateSchema({  
246 - field: 'templatePurpose',  
247 - helpMessage: `告警通知模板平台提供如下参数:  
248 - {  
249 - "type":"告警类型",  
250 - "deviceName":"设备名称",  
251 - "severity":"告警等级",  
252 - "organization":"设备所属组织",  
253 - "createTime":"告警时间",  
254 - "triggerValue":"触发值",  
255 - }`,  
256 - });  
257 - } else if (value === 'FOR_SET_PASSWORD') {  
258 - updateSchema({  
259 - field: 'templatePurpose',  
260 - helpMessage: `清除密码模板平台提供如下参数:  
261 - {  
262 - "code":"验证码"  
263 - }`,  
264 - });  
265 - }  
266 - },  
267 api: findDictItemByCode, 258 api: findDictItemByCode,
268 params: { 259 params: {
269 dictCode: 'template_purpose', 260 dictCode: 'template_purpose',
@@ -86,12 +86,12 @@ export enum OriginatorTelemetryFieldsEnum { @@ -86,12 +86,12 @@ export enum OriginatorTelemetryFieldsEnum {
86 } 86 }
87 87
88 export enum OriginatorTelemetryFieldsNameEnum { 88 export enum OriginatorTelemetryFieldsNameEnum {
89 - LATEST_TS_KEY_NAMES = 'Latest timeseries', 89 + LATEST_TS_KEY_NAMES = 'Timeseries key',
90 AGGREGATION = '数据聚合功能', 90 AGGREGATION = '数据聚合功能',
91 FETCH_MODE = 'Fetch Mode', 91 FETCH_MODE = 'Fetch Mode',
92 ORDER_BY = 'Order by', 92 ORDER_BY = 'Order by',
93 LIMIT = 'Limit', 93 LIMIT = 'Limit',
94 - USE_METADATA_INTERVAL_PATTERNS = 'useMetadataIntervalPatterns', 94 + USE_METADATA_INTERVAL_PATTERNS = 'Use interval patterns',
95 START_INTERVAL = 'Start Interval', 95 START_INTERVAL = 'Start Interval',
96 START_INTERVAL_TIME_UNIT = 'Start Interval Time Unit', 96 START_INTERVAL_TIME_UNIT = 'Start Interval Time Unit',
97 END_INTERVAL = 'End Interval', 97 END_INTERVAL = 'End Interval',
@@ -73,6 +73,10 @@ export const formSchemas: FormSchema[] = [ @@ -73,6 +73,10 @@ export const formSchemas: FormSchema[] = [
73 getPopupContainer: () => document.body, 73 getPopupContainer: () => document.body,
74 placeholder: `请选择${RestApiCallFieldsEnum.PROXY_SCHEME}`, 74 placeholder: `请选择${RestApiCallFieldsEnum.PROXY_SCHEME}`,
75 }, 75 },
  76 + ifShow: ({ model }) => {
  77 + const ifShowField = model[RestApiCallFieldsEnum.ENABLE_PROXY];
  78 + return ifShowField && !model[RestApiCallFieldsEnum.USE_SYSTEM_PROXY_PROPERTIES];
  79 + },
76 }, 80 },
77 { 81 {
78 field: RestApiCallFieldsEnum.PROXY_HOST, 82 field: RestApiCallFieldsEnum.PROXY_HOST,
@@ -83,6 +87,10 @@ export const formSchemas: FormSchema[] = [ @@ -83,6 +87,10 @@ export const formSchemas: FormSchema[] = [
83 componentProps: { 87 componentProps: {
84 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_HOST}`, 88 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_HOST}`,
85 }, 89 },
  90 + ifShow: ({ model }) => {
  91 + const ifShowField = model[RestApiCallFieldsEnum.ENABLE_PROXY];
  92 + return ifShowField && !model[RestApiCallFieldsEnum.USE_SYSTEM_PROXY_PROPERTIES];
  93 + },
86 }, 94 },
87 { 95 {
88 field: RestApiCallFieldsEnum.PROXY_PORT, 96 field: RestApiCallFieldsEnum.PROXY_PORT,
@@ -93,6 +101,10 @@ export const formSchemas: FormSchema[] = [ @@ -93,6 +101,10 @@ export const formSchemas: FormSchema[] = [
93 componentProps: { 101 componentProps: {
94 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_HOST}`, 102 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_HOST}`,
95 }, 103 },
  104 + ifShow: ({ model }) => {
  105 + const ifShowField = model[RestApiCallFieldsEnum.ENABLE_PROXY];
  106 + return ifShowField && !model[RestApiCallFieldsEnum.USE_SYSTEM_PROXY_PROPERTIES];
  107 + },
96 }, 108 },
97 { 109 {
98 field: RestApiCallFieldsEnum.PROXY_USER, 110 field: RestApiCallFieldsEnum.PROXY_USER,
@@ -101,6 +113,10 @@ export const formSchemas: FormSchema[] = [ @@ -101,6 +113,10 @@ export const formSchemas: FormSchema[] = [
101 componentProps: { 113 componentProps: {
102 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_USER}`, 114 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_USER}`,
103 }, 115 },
  116 + ifShow: ({ model }) => {
  117 + const ifShowField = model[RestApiCallFieldsEnum.ENABLE_PROXY];
  118 + return ifShowField && !model[RestApiCallFieldsEnum.USE_SYSTEM_PROXY_PROPERTIES];
  119 + },
104 }, 120 },
105 { 121 {
106 field: RestApiCallFieldsEnum.PROXY_PASSWORD, 122 field: RestApiCallFieldsEnum.PROXY_PASSWORD,
@@ -109,6 +125,10 @@ export const formSchemas: FormSchema[] = [ @@ -109,6 +125,10 @@ export const formSchemas: FormSchema[] = [
109 componentProps: { 125 componentProps: {
110 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_PASSWORD}`, 126 placeholder: `请输入${RestApiCallFieldsNameEnum.PROXY_PASSWORD}`,
111 }, 127 },
  128 + ifShow: ({ model }) => {
  129 + const ifShowField = model[RestApiCallFieldsEnum.ENABLE_PROXY];
  130 + return ifShowField && !model[RestApiCallFieldsEnum.USE_SYSTEM_PROXY_PROPERTIES];
  131 + },
112 }, 132 },
113 { 133 {
114 field: RestApiCallFieldsEnum.READ_TIMEOUT_MS, 134 field: RestApiCallFieldsEnum.READ_TIMEOUT_MS,
@@ -229,7 +229,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -229,7 +229,7 @@ export const trigger_condition_schema: FormSchema[] = [
229 placeholder: '请选择类型', 229 placeholder: '请选择类型',
230 labelField: 'itemText', 230 labelField: 'itemText',
231 valueField: 'itemValue', 231 valueField: 'itemValue',
232 - getPopupContainer: () => document.body, 232 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
233 onChange(e) { 233 onChange(e) {
234 if (e) { 234 if (e) {
235 setFieldsValue({ deviceProfileId: '' }); 235 setFieldsValue({ deviceProfileId: '' });
@@ -256,7 +256,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -256,7 +256,7 @@ export const trigger_condition_schema: FormSchema[] = [
256 placeholder: '请选择产品', 256 placeholder: '请选择产品',
257 labelField: 'name', 257 labelField: 'name',
258 valueField: 'id', 258 valueField: 'id',
259 - getPopupContainer: () => document.body, 259 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
260 onChange: async (e) => { 260 onChange: async (e) => {
261 if (e) { 261 if (e) {
262 setFieldsValue({ type2: '', entityId: [] }); 262 setFieldsValue({ type2: '', entityId: [] });
@@ -315,7 +315,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -315,7 +315,7 @@ export const trigger_condition_schema: FormSchema[] = [
315 return []; 315 return [];
316 }, 316 },
317 placeholder: '请选择设备', 317 placeholder: '请选择设备',
318 - getPopupContainer: () => document.body, 318 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
319 filterOption: (inputValue: string, option: Record<'label' | 'value', string>) => { 319 filterOption: (inputValue: string, option: Record<'label' | 'value', string>) => {
320 let { label, value } = option; 320 let { label, value } = option;
321 label = label.toLowerCase(); 321 label = label.toLowerCase();
@@ -450,7 +450,7 @@ export const actionSchema: FormSchema[] = [ @@ -450,7 +450,7 @@ export const actionSchema: FormSchema[] = [
450 placeholder: '请选择类型', 450 placeholder: '请选择类型',
451 labelField: 'itemText', 451 labelField: 'itemText',
452 valueField: 'itemValue', 452 valueField: 'itemValue',
453 - getPopupContainer: () => document.body, 453 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
454 onChange(e) { 454 onChange(e) {
455 if (e) { 455 if (e) {
456 setFieldsValue({ deviceProfileId: '' }); 456 setFieldsValue({ deviceProfileId: '' });
@@ -482,7 +482,7 @@ export const actionSchema: FormSchema[] = [ @@ -482,7 +482,7 @@ export const actionSchema: FormSchema[] = [
482 placeholder: '请选择产品', 482 placeholder: '请选择产品',
483 labelField: 'name', 483 labelField: 'name',
484 valueField: 'id', 484 valueField: 'id',
485 - getPopupContainer: () => document.body, 485 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
486 onChange: (_value: string, options = {} as DeviceProfileModel) => { 486 onChange: (_value: string, options = {} as DeviceProfileModel) => {
487 const oldType = formModel['transportType']; 487 const oldType = formModel['transportType'];
488 488
@@ -556,7 +556,7 @@ export const actionSchema: FormSchema[] = [ @@ -556,7 +556,7 @@ export const actionSchema: FormSchema[] = [
556 return []; 556 return [];
557 }, 557 },
558 placeholder: '请选择设备', 558 placeholder: '请选择设备',
559 - getPopupContainer: () => document.body, 559 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
560 }; 560 };
561 }, 561 },
562 ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), 562 ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget),
@@ -593,7 +593,7 @@ export const actionSchema: FormSchema[] = [ @@ -593,7 +593,7 @@ export const actionSchema: FormSchema[] = [
593 dictCode: 'custom_define', 593 dictCode: 'custom_define',
594 }, 594 },
595 numberToString: true, 595 numberToString: true,
596 - getPopupContainer: () => document.body, 596 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
597 onChange: () => { 597 onChange: () => {
598 setFieldsValue({ doContext: null, thingsModelId: null }); 598 setFieldsValue({ doContext: null, thingsModelId: null });
599 }, 599 },
@@ -619,7 +619,7 @@ export const actionSchema: FormSchema[] = [ @@ -619,7 +619,7 @@ export const actionSchema: FormSchema[] = [
619 }, 619 },
620 labelField: 'itemText', 620 labelField: 'itemText',
621 valueField: 'itemValue', 621 valueField: 'itemValue',
622 - getPopupContainer: () => document.body, 622 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
623 }, 623 },
624 ifShow: ({ values }) => 624 ifShow: ({ values }) =>
625 isDeviceOut(values.outTarget) && isPartOrAll(values.device) && isDefine(values.commandType), 625 isDeviceOut(values.outTarget) && isPartOrAll(values.device) && isDefine(values.commandType),
@@ -688,7 +688,7 @@ export const actionSchema: FormSchema[] = [ @@ -688,7 +688,7 @@ export const actionSchema: FormSchema[] = [
688 }, 688 },
689 labelField: 'functionName', 689 labelField: 'functionName',
690 valueField: 'id', 690 valueField: 'id',
691 - getPopupContainer: () => document.body, 691 + getPopupContainer: (triggerNode) => triggerNode.parentNode,
692 onChange: (_, options: ModelOfMatterParams) => { 692 onChange: (_, options: ModelOfMatterParams) => {
693 if (options) { 693 if (options) {
694 // setFieldsValue({ doContext: { ...options.functionJson, callType: options.callType } }); 694 // setFieldsValue({ doContext: { ...options.functionJson, callType: options.callType } });
@@ -148,6 +148,7 @@ @@ -148,6 +148,7 @@
148 { value: 'DEFAULT', label: '默认' }, 148 { value: 'DEFAULT', label: '默认' },
149 { value: 'SYSTEM', label: '系统' }, 149 { value: 'SYSTEM', label: '系统' },
150 { value: 'REPORT', label: '报表' }, 150 { value: 'REPORT', label: '报表' },
  151 + { value: 'TASK_CENTER', label: '任务中心' },
151 ]); 152 ]);
152 const optionStatus: any = ref([ 153 const optionStatus: any = ref([
153 { value: '1 ', label: '成功' }, 154 { value: '1 ', label: '成功' },
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 min: 0, 45 min: 0,
46 max: 100, 46 max: 100,
47 formatter: (e) => { 47 formatter: (e) => {
48 - const value = e.replace(/^0/g, ''); 48 + const value = e?.toString().replace(/^0/g, '');
49 if (value) { 49 if (value) {
50 return value.replace(/^0/g, ''); 50 return value.replace(/^0/g, '');
51 } else { 51 } else {
@@ -24,6 +24,18 @@ @@ -24,6 +24,18 @@
24 label: '文本字体大小', 24 label: '文本字体大小',
25 component: 'InputNumber', 25 component: 'InputNumber',
26 defaultValue: 14, 26 defaultValue: 14,
  27 + componentProps: {
  28 + min: 0,
  29 + max: 100,
  30 + formatter: (e) => {
  31 + const value = e?.toString().replace(/^0/g, '');
  32 + if (value) {
  33 + return value.replace(/^0/g, '');
  34 + } else {
  35 + return 0;
  36 + }
  37 + },
  38 + },
27 }, 39 },
28 { 40 {
29 field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME, 41 field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME,
@@ -36,7 +36,19 @@ @@ -36,7 +36,19 @@
36 field: ComponentConfigFieldEnum.FONT_SIZE, 36 field: ComponentConfigFieldEnum.FONT_SIZE,
37 label: '文本字体大小', 37 label: '文本字体大小',
38 component: 'InputNumber', 38 component: 'InputNumber',
39 - defaultValue: option.fontSize, 39 + defaultValue: 14,
  40 + componentProps: {
  41 + min: 0,
  42 + max: 100,
  43 + formatter: (e) => {
  44 + const value = e?.toString().replace(/^0/g, '');
  45 + if (value) {
  46 + return value.replace(/^0/g, '');
  47 + } else {
  48 + return 0;
  49 + }
  50 + },
  51 + },
40 }, 52 },
41 { 53 {
42 field: ComponentConfigFieldEnum.PASS_WORD, 54 field: ComponentConfigFieldEnum.PASS_WORD,
@@ -22,7 +22,19 @@ @@ -22,7 +22,19 @@
22 field: ComponentConfigFieldEnum.FONT_SIZE, 22 field: ComponentConfigFieldEnum.FONT_SIZE,
23 label: '文本字体大小', 23 label: '文本字体大小',
24 component: 'InputNumber', 24 component: 'InputNumber',
25 - defaultValue: option.fontSize, 25 + defaultValue: 14,
  26 + componentProps: {
  27 + min: 0,
  28 + max: 100,
  29 + formatter: (e) => {
  30 + const value = e?.toString().replace(/^0/g, '');
  31 + if (value) {
  32 + return value.replace(/^0/g, '');
  33 + } else {
  34 + return 0;
  35 + }
  36 + },
  37 + },
26 }, 38 },
27 { 39 {
28 field: ComponentConfigFieldEnum.PASS_WORD, 40 field: ComponentConfigFieldEnum.PASS_WORD,
@@ -18,7 +18,19 @@ @@ -18,7 +18,19 @@
18 field: ComponentConfigFieldEnum.VALUE_SIZE, 18 field: ComponentConfigFieldEnum.VALUE_SIZE,
19 label: '数值字体大小', 19 label: '数值字体大小',
20 component: 'InputNumber', 20 component: 'InputNumber',
21 - defaultValue: option.fontSize, 21 + defaultValue: 14,
  22 + componentProps: {
  23 + min: 0,
  24 + max: 100,
  25 + formatter: (e) => {
  26 + const value = e?.toString().replace(/^0/g, '');
  27 + if (value) {
  28 + return value.replace(/^0/g, '');
  29 + } else {
  30 + return 0;
  31 + }
  32 + },
  33 + },
22 }, 34 },
23 { 35 {
24 field: ComponentConfigFieldEnum.TEXT_COLOR, 36 field: ComponentConfigFieldEnum.TEXT_COLOR,
@@ -30,7 +30,19 @@ @@ -30,7 +30,19 @@
30 field: ComponentConfigFieldEnum.FONT_SIZE, 30 field: ComponentConfigFieldEnum.FONT_SIZE,
31 label: '文本字体大小', 31 label: '文本字体大小',
32 component: 'InputNumber', 32 component: 'InputNumber',
33 - defaultValue: option.fontSize, 33 + defaultValue: 14,
  34 + componentProps: {
  35 + min: 0,
  36 + max: 100,
  37 + formatter: (e) => {
  38 + const value = e?.toString().replace(/^0/g, '');
  39 + if (value) {
  40 + return value.replace(/^0/g, '');
  41 + } else {
  42 + return 0;
  43 + }
  44 + },
  45 + },
34 }, 46 },
35 { 47 {
36 field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME, 48 field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME,
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 min: 0, 58 min: 0,
59 max: 100, 59 max: 100,
60 formatter: (e) => { 60 formatter: (e) => {
61 - const value = e.replace(/^0/g, ''); 61 + const value = e?.toString().replace(/^0/g, '');
62 if (value) { 62 if (value) {
63 return value.replace(/^0/g, ''); 63 return value.replace(/^0/g, '');
64 } else { 64 } else {
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 min: 0, 76 min: 0,
77 max: 100, 77 max: 100,
78 formatter: (e) => { 78 formatter: (e) => {
79 - const value = e.replace(/^0/g, ''); 79 + const value = e?.toString().replace(/^0/g, '');
80 if (value) { 80 if (value) {
81 return value.replace(/^0/g, ''); 81 return value.replace(/^0/g, '');
82 } else { 82 } else {
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 min: 0, 64 min: 0,
65 max: 100, 65 max: 100,
66 formatter: (e) => { 66 formatter: (e) => {
67 - const value = e.replace(/^0/g, ''); 67 + const value = e?.toString().replace(/^0/g, '');
68 if (value) { 68 if (value) {
69 return value.replace(/^0/g, ''); 69 return value.replace(/^0/g, '');
70 } else { 70 } else {
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 min: 0, 82 min: 0,
83 max: 100, 83 max: 100,
84 formatter: (e) => { 84 formatter: (e) => {
85 - const value = e.replace(/^0/g, ''); 85 + const value = e?.toString().replace(/^0/g, '');
86 if (value) { 86 if (value) {
87 return value.replace(/^0/g, ''); 87 return value.replace(/^0/g, '');
88 } else { 88 } else {
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 import { ComponentConfigFieldEnum } from '/@/views/visual/packages/enum'; 2 import { ComponentConfigFieldEnum } from '/@/views/visual/packages/enum';
3 import { useForm, BasicForm } from '/@/components/Form'; 3 import { useForm, BasicForm } from '/@/components/Form';
4 import { PublicFormInstaceType } from '/@/views/visual/dataSourceBindPanel/index.type'; 4 import { PublicFormInstaceType } from '/@/views/visual/dataSourceBindPanel/index.type';
  5 + import { nextTick } from 'vue';
5 6
6 const [register, { getFieldsValue, setFieldsValue, resetFields }] = useForm({ 7 const [register, { getFieldsValue, setFieldsValue, resetFields }] = useForm({
7 schemas: [ 8 schemas: [
@@ -28,7 +29,7 @@ @@ -28,7 +29,7 @@
28 min: 0, 29 min: 0,
29 max: 100, 30 max: 100,
30 formatter: (e) => { 31 formatter: (e) => {
31 - const value = e.replace(/^0/g, ''); 32 + const value = e?.toString().replace(/^0/g, '');
32 if (value) { 33 if (value) {
33 return value.replace(/^0/g, ''); 34 return value.replace(/^0/g, '');
34 } else { 35 } else {
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 min: 0, 58 min: 0,
59 max: 100, 59 max: 100,
60 formatter: (e) => { 60 formatter: (e) => {
61 - const value = e.replace(/^0/g, ''); 61 + const value = e?.toString().replace(/^0/g, '');
62 if (value) { 62 if (value) {
63 return value.replace(/^0/g, ''); 63 return value.replace(/^0/g, '');
64 } else { 64 } else {
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
76 min: 0, 76 min: 0,
77 max: 100, 77 max: 100,
78 formatter: (e) => { 78 formatter: (e) => {
79 - const value = e.replace(/^0/g, ''); 79 + const value = e?.toString().replace(/^0/g, '');
80 if (value) { 80 if (value) {
81 return value.replace(/^0/g, ''); 81 return value.replace(/^0/g, '');
82 } else { 82 } else {
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 min: 0, 72 min: 0,
73 max: 100, 73 max: 100,
74 formatter: (e) => { 74 formatter: (e) => {
75 - const value = e.replace(/^0/g, ''); 75 + const value = e?.toString().replace(/^0/g, '');
76 if (value) { 76 if (value) {
77 return value.replace(/^0/g, ''); 77 return value.replace(/^0/g, '');
78 } else { 78 } else {
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 min: 0, 90 min: 0,
91 max: 100, 91 max: 100,
92 formatter: (e) => { 92 formatter: (e) => {
93 - const value = e.replace(/^0/g, ''); 93 + const value = e?.toString().replace(/^0/g, '');
94 if (value) { 94 if (value) {
95 return value.replace(/^0/g, ''); 95 return value.replace(/^0/g, '');
96 } else { 96 } else {
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 min: 0, 51 min: 0,
52 max: 100, 52 max: 100,
53 formatter: (e) => { 53 formatter: (e) => {
54 - const value = e.replace(/^0/g, ''); 54 + const value = e?.toString().replace(/^0/g, '');
55 if (value) { 55 if (value) {
56 return value.replace(/^0/g, ''); 56 return value.replace(/^0/g, '');
57 } else { 57 } else {
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 min: 0, 69 min: 0,
70 max: 100, 70 max: 100,
71 formatter: (e) => { 71 formatter: (e) => {
72 - const value = e.replace(/^0/g, ''); 72 + const value = e?.toString().replace(/^0/g, '');
73 if (value) { 73 if (value) {
74 return value.replace(/^0/g, ''); 74 return value.replace(/^0/g, '');
75 } else { 75 } else {
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 min: 0, 62 min: 0,
63 max: 100, 63 max: 100,
64 formatter: (e) => { 64 formatter: (e) => {
65 - const value = e.replace(/^0/g, ''); 65 + const value = e?.toString().replace(/^0/g, '');
66 if (value) { 66 if (value) {
67 return value.replace(/^0/g, ''); 67 return value.replace(/^0/g, '');
68 } else { 68 } else {
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 min: 0, 80 min: 0,
81 max: 100, 81 max: 100,
82 formatter: (e) => { 82 formatter: (e) => {
83 - const value = e.replace(/^0/g, ''); 83 + const value = e?.toString().replace(/^0/g, '');
84 if (value) { 84 if (value) {
85 return value.replace(/^0/g, ''); 85 return value.replace(/^0/g, '');
86 } else { 86 } else {
@@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
85 min: 0, 85 min: 0,
86 max: 100, 86 max: 100,
87 formatter: (e) => { 87 formatter: (e) => {
88 - const value = e.replace(/^0/g, ''); 88 + const value = e?.toString().replace(/^0/g, '');
89 if (value) { 89 if (value) {
90 return value.replace(/^0/g, ''); 90 return value.replace(/^0/g, '');
91 } else { 91 } else {
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 min: 0, 103 min: 0,
104 max: 100, 104 max: 100,
105 formatter: (e) => { 105 formatter: (e) => {
106 - const value = e.replace(/^0/g, ''); 106 + const value = e?.toString().replace(/^0/g, '');
107 if (value) { 107 if (value) {
108 return value.replace(/^0/g, ''); 108 return value.replace(/^0/g, '');
109 } else { 109 } else {
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 min: 0, 33 min: 0,
34 max: 100, 34 max: 100,
35 formatter: (e) => { 35 formatter: (e) => {
36 - const value = e.replace(/^0/g, ''); 36 + const value = e?.toString().replace(/^0/g, '');
37 if (value) { 37 if (value) {
38 return value.replace(/^0/g, ''); 38 return value.replace(/^0/g, '');
39 } else { 39 } else {
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 min: 0, 55 min: 0,
56 max: 100, 56 max: 100,
57 formatter: (e) => { 57 formatter: (e) => {
58 - const value = e.replace(/^0/g, ''); 58 + const value = e?.toString().replace(/^0/g, '');
59 if (value) { 59 if (value) {
60 return value.replace(/^0/g, ''); 60 return value.replace(/^0/g, '');
61 } else { 61 } else {
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 min: 0, 28 min: 0,
29 max: 100, 29 max: 100,
30 formatter: (e) => { 30 formatter: (e) => {
31 - const value = e.replace(/^0/g, ''); 31 + const value = e?.toString().replace(/^0/g, '');
32 if (value) { 32 if (value) {
33 return value.replace(/^0/g, ''); 33 return value.replace(/^0/g, '');
34 } else { 34 } else {
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 componentProps: { 45 componentProps: {
46 min: 0, 46 min: 0,
47 formatter: (e) => { 47 formatter: (e) => {
48 - const value = e.replace(/^0/g, ''); 48 + const value = e?.toString().replace(/^0/g, '');
49 if (value) { 49 if (value) {
50 return value.replace(/^0/g, ''); 50 return value.replace(/^0/g, '');
51 } else { 51 } else {
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 min: 0, 28 min: 0,
29 max: 100, 29 max: 100,
30 formatter: (e) => { 30 formatter: (e) => {
31 - const value = e.replace(/^0/g, ''); 31 + const value = e?.toString().replace(/^0/g, '');
32 if (value) { 32 if (value) {
33 return value.replace(/^0/g, ''); 33 return value.replace(/^0/g, '');
34 } else { 34 } else {
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 min: 0, 46 min: 0,
47 max: 100, 47 max: 100,
48 formatter: (e) => { 48 formatter: (e) => {
49 - const value = e.replace(/^0/g, ''); 49 + const value = e?.toString().replace(/^0/g, '');
50 if (value) { 50 if (value) {
51 return value.replace(/^0/g, ''); 51 return value.replace(/^0/g, '');
52 } else { 52 } else {
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 min: 0, 33 min: 0,
34 max: 100, 34 max: 100,
35 formatter: (e) => { 35 formatter: (e) => {
36 - const value = e.replace(/^0/g, ''); 36 + const value = e?.toString().replace(/^0/g, '');
37 if (value) { 37 if (value) {
38 return value.replace(/^0/g, ''); 38 return value.replace(/^0/g, '');
39 } else { 39 } else {
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 min: 0, 51 min: 0,
52 max: 100, 52 max: 100,
53 formatter: (e) => { 53 formatter: (e) => {
54 - const value = e.replace(/^0/g, ''); 54 + const value = e?.toString().replace(/^0/g, '');
55 if (value) { 55 if (value) {
56 return value.replace(/^0/g, ''); 56 return value.replace(/^0/g, '');
57 } else { 57 } else {
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 min: 0, 32 min: 0,
33 max: 100, 33 max: 100,
34 formatter: (e) => { 34 formatter: (e) => {
35 - const value = e.replace(/^0/g, ''); 35 + const value = e?.toString().replace(/^0/g, '');
36 if (value) { 36 if (value) {
37 return value.replace(/^0/g, ''); 37 return value.replace(/^0/g, '');
38 } else { 38 } else {
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 min: 0, 50 min: 0,
51 max: 100, 51 max: 100,
52 formatter: (e) => { 52 formatter: (e) => {
53 - const value = e.replace(/^0/g, ''); 53 + const value = e?.toString().replace(/^0/g, '');
54 if (value) { 54 if (value) {
55 return value.replace(/^0/g, ''); 55 return value.replace(/^0/g, '');
56 } else { 56 } else {
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 min: 0, 34 min: 0,
35 max: 100, 35 max: 100,
36 formatter: (e) => { 36 formatter: (e) => {
37 - const value = e.replace(/^0/g, ''); 37 + const value = e?.toString().replace(/^0/g, '');
38 if (value) { 38 if (value) {
39 return value.replace(/^0/g, ''); 39 return value.replace(/^0/g, '');
40 } else { 40 } else {
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 min: 0, 52 min: 0,
53 max: 100, 53 max: 100,
54 formatter: (e) => { 54 formatter: (e) => {
55 - const value = e.replace(/^0/g, ''); 55 + const value = e?.toString().replace(/^0/g, '');
56 if (value) { 56 if (value) {
57 return value.replace(/^0/g, ''); 57 return value.replace(/^0/g, '');
58 } else { 58 } else {
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 componentProps: { 32 componentProps: {
33 min: 0, 33 min: 0,
34 formatter: (e) => { 34 formatter: (e) => {
35 - const value = e.replace(/^0/g, ''); 35 + const value = e?.toString().replace(/^0/g, '');
36 if (value) { 36 if (value) {
37 return value.replace(/^0/g, ''); 37 return value.replace(/^0/g, '');
38 } else { 38 } else {
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 min: 0, 50 min: 0,
51 max: 100, 51 max: 100,
52 formatter: (e) => { 52 formatter: (e) => {
53 - const value = e.replace(/^0/g, ''); 53 + const value = e?.toString().replace(/^0/g, '');
54 if (value) { 54 if (value) {
55 return value.replace(/^0/g, ''); 55 return value.replace(/^0/g, '');
56 } else { 56 } else {