Commit 92b5c14e5b9b63934f5ee20ba6c5f55626904854
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 | 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= | ... | ... |
| ... | ... | @@ -45,7 +45,7 @@ enum DeviceManagerApi { |
| 45 | 45 | DEVICE_PUBLIC = '/customer/public/device', |
| 46 | 46 | |
| 47 | 47 | DEVICE_PRIVATE = '/customer/device', |
| 48 | - DEVICE_COLLECT = '/device/collect ', //收藏 | |
| 48 | + DEVICE_COLLECT = '/collect/DEVICE_COLLECT', //收藏 | |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @description 通过设备列表获取设备信息 |
| ... | ... | @@ -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 | 66 | return defHttp.post({ |
| 67 | 67 | url: `${DeviceManagerApi.DEVICE_COLLECT}`, |
| 68 | 68 | params, | ... | ... |
| 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', | ... | ... |
| ... | ... | @@ -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: '请选择读写类型', | ... | ... |
| ... | ... | @@ -279,20 +279,20 @@ |
| 279 | 279 | ref="listEl" |
| 280 | 280 | :loading="loading" |
| 281 | 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 | 283 | :grid="(gridLayout as any)" |
| 284 | 284 | :style="{ '--height': `${100 / pagination.colNumber}%` }" |
| 285 | 285 | > |
| 286 | 286 | <template #renderItem="{ item }"> |
| 287 | 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 | 289 | <div |
| 290 | 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 | 292 | ></div> |
| 293 | 293 | <div |
| 294 | 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 | 297 | <Spin |
| 298 | 298 | class="!absolute top-1/2 left-1/2 transform -translate-1/2" |
| ... | ... | @@ -333,7 +333,7 @@ |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | .split-screen-mode:deep(.ant-spin-container) { |
| 336 | - height: 100%; | |
| 336 | + height: 100% !important; | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | .video-container { | ... | ... |
| ... | ... | @@ -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,28 @@ export const formSchema: FormSchema[] = [ |
| 136 | 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 | 162 | field: 'platform', |
| 140 | 163 | label: '平台', |
| 141 | 164 | required: true, | ... | ... |
src/views/configuration/center/help.ts
0 → 100644
| 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 | 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'; | |
| 18 | 17 | import ConfigurationCenterDrawer from './ConfigurationCenterDrawer.vue'; |
| 19 | 18 | import { useDrawer } from '/@/components/Drawer'; |
| 20 | 19 | import { getBoundingClientRect } from '/@/utils/domUtils'; |
| 21 | 20 | import configurationSrc from '/@/assets/icons/configuration.svg'; |
| 22 | 21 | import { cloneDeep } from 'lodash'; |
| 23 | 22 | import { usePermission } from '/@/hooks/web/usePermission'; |
| 24 | - import { useGlobSetting } from '/@/hooks/setting'; | |
| 25 | 23 | import { AuthIcon, CardLayoutButton } from '/@/components/Widget'; |
| 26 | 24 | import AuthDropDown from '/@/components/Widget/AuthDropDown.vue'; |
| 27 | 25 | import { ShareModal } from '/@/views/common/ShareModal'; |
| ... | ... | @@ -31,6 +29,7 @@ |
| 31 | 29 | import { useRole } from '/@/hooks/business/useRole'; |
| 32 | 30 | import { useClipboard } from '@vueuse/core'; |
| 33 | 31 | import { Icon } from '/@/components/Icon'; |
| 32 | + import { createScadaPageLink, ScadaModeEnum } from './help'; | |
| 34 | 33 | |
| 35 | 34 | const listColumn = ref(5); |
| 36 | 35 | |
| ... | ... | @@ -130,25 +129,15 @@ |
| 130 | 129 | } |
| 131 | 130 | }; |
| 132 | 131 | |
| 133 | - const { configurationPrefix } = useGlobSetting(); | |
| 134 | - const isDev = isDevMode(); | |
| 135 | - | |
| 136 | 132 | const handlePreview = (record: ConfigurationCenterItemsModal) => { |
| 137 | 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 | 137 | const handleDesign = (record: ConfigurationCenterItemsModal) => { |
| 146 | 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 | 143 | const handleDelete = async (record: ConfigurationCenterItemsModal) => { |
| ... | ... | @@ -165,14 +154,7 @@ |
| 165 | 154 | }; |
| 166 | 155 | |
| 167 | 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 | 160 | const { copied, copy } = useClipboard({ legacy: true }); | ... | ... |
| ... | ... | @@ -16,54 +16,33 @@ |
| 16 | 16 | </div> |
| 17 | 17 | </div> |
| 18 | 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 | 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 | 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 | 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 | 46 | </div> |
| 68 | 47 | </div> |
| 69 | 48 | </template> |
| ... | ... | @@ -78,7 +57,7 @@ |
| 78 | 57 | import AceTypeIsJsEditor from '../../SimpleRequest/components/aceEditor.vue'; |
| 79 | 58 | import { Tag } from 'ant-design-vue'; |
| 80 | 59 | import { useThrottleFn } from '@vueuse/shared'; |
| 81 | - import { RequestMethodTypeEnum, RequestHttpTypeEnum } from '../../../config/enum'; | |
| 60 | + import { RequestMethodTypeEnum } from '../../../config/enum'; | |
| 82 | 61 | |
| 83 | 62 | const emits = defineEmits(['emitExcute']); |
| 84 | 63 | |
| ... | ... | @@ -334,9 +313,9 @@ |
| 334 | 313 | } |
| 335 | 314 | |
| 336 | 315 | .divider-color { |
| 337 | - height: 78.5vh; | |
| 316 | + height: 54rem; | |
| 338 | 317 | background-color: #e5e7eb; |
| 339 | 318 | position: relative; |
| 340 | - left: 1.16vw; | |
| 319 | + left: 1rem; | |
| 341 | 320 | } |
| 342 | 321 | </style> | ... | ... |
| ... | ... | @@ -175,7 +175,10 @@ |
| 175 | 175 | label: '取消收藏', |
| 176 | 176 | auth: 'api:yt:device:online:record', |
| 177 | 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 | 184 | label: '删除', |
| ... | ... | @@ -305,6 +308,7 @@ |
| 305 | 308 | columns, |
| 306 | 309 | beforeFetch: (params) => { |
| 307 | 310 | const { deviceProfileId } = params; |
| 311 | + if (!deviceProfileId) return; | |
| 308 | 312 | const obj = { |
| 309 | 313 | ...params, |
| 310 | 314 | ...{ | ... | ... |
| ... | ... | @@ -106,7 +106,7 @@ export const defaultSchemas: FormSchema[] = [ |
| 106 | 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 | 112 | field: SchemaFiled.AGG, | ... | ... |
| ... | ... | @@ -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, | ... | ... |
| ... | ... | @@ -12,6 +12,8 @@ |
| 12 | 12 | import { sendSms } from '/@/api/message/template'; |
| 13 | 13 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 14 | 14 | import { phoneRule } from '/@/utils/rules'; |
| 15 | + import { PlateFormTypeEnum } from './template.data'; | |
| 16 | + | |
| 15 | 17 | const schemas: FormSchema[] = [ |
| 16 | 18 | { |
| 17 | 19 | field: 'id', |
| ... | ... | @@ -142,7 +144,38 @@ |
| 142 | 144 | field: 'params', |
| 143 | 145 | componentProps: { |
| 144 | 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 | 181 | await resetFields(); |
| ... | ... | @@ -154,7 +187,7 @@ |
| 154 | 187 | async function handleOK() { |
| 155 | 188 | let smsParams: any = null; |
| 156 | 189 | const values = await validate(); |
| 157 | - if (platformType.value === 'TENCENT_CLOUD') { | |
| 190 | + if (platformType.value === PlateFormTypeEnum.tencent_cound) { | |
| 158 | 191 | //腾讯云发送格式 将字符串转为数组 |
| 159 | 192 | smsParams = { |
| 160 | 193 | tencent_param: JSON.parse(Reflect.get(values, 'params')), | ... | ... |
| ... | ... | @@ -4,6 +4,11 @@ import { findDictItemByCode } from '/@/api/system/dict'; |
| 4 | 4 | import { findMessageConfig } from '/@/api/message/config'; |
| 5 | 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 | 12 | export const columns: BasicColumn[] = [ |
| 8 | 13 | { |
| 9 | 14 | title: '模板名称', |
| ... | ... | @@ -223,47 +228,33 @@ export const formSchema: FormSchema[] = [ |
| 223 | 228 | helpMessage: [], |
| 224 | 229 | componentProps({ formActionType }) { |
| 225 | 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 | 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 | 258 | api: findDictItemByCode, |
| 268 | 259 | params: { |
| 269 | 260 | dictCode: 'template_purpose', | ... | ... |
| ... | ... | @@ -86,12 +86,12 @@ export enum OriginatorTelemetryFieldsEnum { |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | export enum OriginatorTelemetryFieldsNameEnum { |
| 89 | - LATEST_TS_KEY_NAMES = 'Latest timeseries', | |
| 89 | + LATEST_TS_KEY_NAMES = 'Timeseries key', | |
| 90 | 90 | AGGREGATION = '数据聚合功能', |
| 91 | 91 | FETCH_MODE = 'Fetch Mode', |
| 92 | 92 | ORDER_BY = 'Order by', |
| 93 | 93 | LIMIT = 'Limit', |
| 94 | - USE_METADATA_INTERVAL_PATTERNS = 'useMetadataIntervalPatterns', | |
| 94 | + USE_METADATA_INTERVAL_PATTERNS = 'Use interval patterns', | |
| 95 | 95 | START_INTERVAL = 'Start Interval', |
| 96 | 96 | START_INTERVAL_TIME_UNIT = 'Start Interval Time Unit', |
| 97 | 97 | END_INTERVAL = 'End Interval', | ... | ... |
| ... | ... | @@ -73,6 +73,10 @@ export const formSchemas: FormSchema[] = [ |
| 73 | 73 | getPopupContainer: () => document.body, |
| 74 | 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 | 82 | field: RestApiCallFieldsEnum.PROXY_HOST, |
| ... | ... | @@ -83,6 +87,10 @@ export const formSchemas: FormSchema[] = [ |
| 83 | 87 | componentProps: { |
| 84 | 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 | 96 | field: RestApiCallFieldsEnum.PROXY_PORT, |
| ... | ... | @@ -93,6 +101,10 @@ export const formSchemas: FormSchema[] = [ |
| 93 | 101 | componentProps: { |
| 94 | 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 | 110 | field: RestApiCallFieldsEnum.PROXY_USER, |
| ... | ... | @@ -101,6 +113,10 @@ export const formSchemas: FormSchema[] = [ |
| 101 | 113 | componentProps: { |
| 102 | 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 | 122 | field: RestApiCallFieldsEnum.PROXY_PASSWORD, |
| ... | ... | @@ -109,6 +125,10 @@ export const formSchemas: FormSchema[] = [ |
| 109 | 125 | componentProps: { |
| 110 | 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 | 134 | field: RestApiCallFieldsEnum.READ_TIMEOUT_MS, | ... | ... |
| ... | ... | @@ -229,7 +229,7 @@ export const trigger_condition_schema: FormSchema[] = [ |
| 229 | 229 | placeholder: '请选择类型', |
| 230 | 230 | labelField: 'itemText', |
| 231 | 231 | valueField: 'itemValue', |
| 232 | - getPopupContainer: () => document.body, | |
| 232 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 233 | 233 | onChange(e) { |
| 234 | 234 | if (e) { |
| 235 | 235 | setFieldsValue({ deviceProfileId: '' }); |
| ... | ... | @@ -256,7 +256,7 @@ export const trigger_condition_schema: FormSchema[] = [ |
| 256 | 256 | placeholder: '请选择产品', |
| 257 | 257 | labelField: 'name', |
| 258 | 258 | valueField: 'id', |
| 259 | - getPopupContainer: () => document.body, | |
| 259 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 260 | 260 | onChange: async (e) => { |
| 261 | 261 | if (e) { |
| 262 | 262 | setFieldsValue({ type2: '', entityId: [] }); |
| ... | ... | @@ -315,7 +315,7 @@ export const trigger_condition_schema: FormSchema[] = [ |
| 315 | 315 | return []; |
| 316 | 316 | }, |
| 317 | 317 | placeholder: '请选择设备', |
| 318 | - getPopupContainer: () => document.body, | |
| 318 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 319 | 319 | filterOption: (inputValue: string, option: Record<'label' | 'value', string>) => { |
| 320 | 320 | let { label, value } = option; |
| 321 | 321 | label = label.toLowerCase(); |
| ... | ... | @@ -450,7 +450,7 @@ export const actionSchema: FormSchema[] = [ |
| 450 | 450 | placeholder: '请选择类型', |
| 451 | 451 | labelField: 'itemText', |
| 452 | 452 | valueField: 'itemValue', |
| 453 | - getPopupContainer: () => document.body, | |
| 453 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 454 | 454 | onChange(e) { |
| 455 | 455 | if (e) { |
| 456 | 456 | setFieldsValue({ deviceProfileId: '' }); |
| ... | ... | @@ -482,7 +482,7 @@ export const actionSchema: FormSchema[] = [ |
| 482 | 482 | placeholder: '请选择产品', |
| 483 | 483 | labelField: 'name', |
| 484 | 484 | valueField: 'id', |
| 485 | - getPopupContainer: () => document.body, | |
| 485 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 486 | 486 | onChange: (_value: string, options = {} as DeviceProfileModel) => { |
| 487 | 487 | const oldType = formModel['transportType']; |
| 488 | 488 | |
| ... | ... | @@ -556,7 +556,7 @@ export const actionSchema: FormSchema[] = [ |
| 556 | 556 | return []; |
| 557 | 557 | }, |
| 558 | 558 | placeholder: '请选择设备', |
| 559 | - getPopupContainer: () => document.body, | |
| 559 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 560 | 560 | }; |
| 561 | 561 | }, |
| 562 | 562 | ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), |
| ... | ... | @@ -593,7 +593,7 @@ export const actionSchema: FormSchema[] = [ |
| 593 | 593 | dictCode: 'custom_define', |
| 594 | 594 | }, |
| 595 | 595 | numberToString: true, |
| 596 | - getPopupContainer: () => document.body, | |
| 596 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 597 | 597 | onChange: () => { |
| 598 | 598 | setFieldsValue({ doContext: null, thingsModelId: null }); |
| 599 | 599 | }, |
| ... | ... | @@ -619,7 +619,7 @@ export const actionSchema: FormSchema[] = [ |
| 619 | 619 | }, |
| 620 | 620 | labelField: 'itemText', |
| 621 | 621 | valueField: 'itemValue', |
| 622 | - getPopupContainer: () => document.body, | |
| 622 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 623 | 623 | }, |
| 624 | 624 | ifShow: ({ values }) => |
| 625 | 625 | isDeviceOut(values.outTarget) && isPartOrAll(values.device) && isDefine(values.commandType), |
| ... | ... | @@ -688,7 +688,7 @@ export const actionSchema: FormSchema[] = [ |
| 688 | 688 | }, |
| 689 | 689 | labelField: 'functionName', |
| 690 | 690 | valueField: 'id', |
| 691 | - getPopupContainer: () => document.body, | |
| 691 | + getPopupContainer: (triggerNode) => triggerNode.parentNode, | |
| 692 | 692 | onChange: (_, options: ModelOfMatterParams) => { |
| 693 | 693 | if (options) { |
| 694 | 694 | // setFieldsValue({ doContext: { ...options.functionJson, callType: options.callType } }); | ... | ... |
| ... | ... | @@ -24,6 +24,18 @@ |
| 24 | 24 | label: '文本字体大小', |
| 25 | 25 | component: 'InputNumber', |
| 26 | 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 | 41 | field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME, | ... | ... |
| ... | ... | @@ -36,7 +36,19 @@ |
| 36 | 36 | field: ComponentConfigFieldEnum.FONT_SIZE, |
| 37 | 37 | label: '文本字体大小', |
| 38 | 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 | 54 | field: ComponentConfigFieldEnum.PASS_WORD, | ... | ... |
| ... | ... | @@ -22,7 +22,19 @@ |
| 22 | 22 | field: ComponentConfigFieldEnum.FONT_SIZE, |
| 23 | 23 | label: '文本字体大小', |
| 24 | 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 | 40 | field: ComponentConfigFieldEnum.PASS_WORD, | ... | ... |
| ... | ... | @@ -18,7 +18,19 @@ |
| 18 | 18 | field: ComponentConfigFieldEnum.VALUE_SIZE, |
| 19 | 19 | label: '数值字体大小', |
| 20 | 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 | 36 | field: ComponentConfigFieldEnum.TEXT_COLOR, | ... | ... |
| ... | ... | @@ -30,7 +30,19 @@ |
| 30 | 30 | field: ComponentConfigFieldEnum.FONT_SIZE, |
| 31 | 31 | label: '文本字体大小', |
| 32 | 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 | 48 | field: ComponentConfigFieldEnum.SHOW_DEVICE_NAME, | ... | ... |
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | min: 0, |
| 59 | 59 | max: 100, |
| 60 | 60 | formatter: (e) => { |
| 61 | - const value = e.replace(/^0/g, ''); | |
| 61 | + const value = e?.toString().replace(/^0/g, ''); | |
| 62 | 62 | if (value) { |
| 63 | 63 | return value.replace(/^0/g, ''); |
| 64 | 64 | } else { |
| ... | ... | @@ -76,7 +76,7 @@ |
| 76 | 76 | min: 0, |
| 77 | 77 | max: 100, |
| 78 | 78 | formatter: (e) => { |
| 79 | - const value = e.replace(/^0/g, ''); | |
| 79 | + const value = e?.toString().replace(/^0/g, ''); | |
| 80 | 80 | if (value) { |
| 81 | 81 | return value.replace(/^0/g, ''); |
| 82 | 82 | } else { | ... | ... |
| ... | ... | @@ -64,7 +64,7 @@ |
| 64 | 64 | min: 0, |
| 65 | 65 | max: 100, |
| 66 | 66 | formatter: (e) => { |
| 67 | - const value = e.replace(/^0/g, ''); | |
| 67 | + const value = e?.toString().replace(/^0/g, ''); | |
| 68 | 68 | if (value) { |
| 69 | 69 | return value.replace(/^0/g, ''); |
| 70 | 70 | } else { |
| ... | ... | @@ -82,7 +82,7 @@ |
| 82 | 82 | min: 0, |
| 83 | 83 | max: 100, |
| 84 | 84 | formatter: (e) => { |
| 85 | - const value = e.replace(/^0/g, ''); | |
| 85 | + const value = e?.toString().replace(/^0/g, ''); | |
| 86 | 86 | if (value) { |
| 87 | 87 | return value.replace(/^0/g, ''); |
| 88 | 88 | } else { | ... | ... |
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | import { ComponentConfigFieldEnum } from '/@/views/visual/packages/enum'; |
| 3 | 3 | import { useForm, BasicForm } from '/@/components/Form'; |
| 4 | 4 | import { PublicFormInstaceType } from '/@/views/visual/dataSourceBindPanel/index.type'; |
| 5 | + import { nextTick } from 'vue'; | |
| 5 | 6 | |
| 6 | 7 | const [register, { getFieldsValue, setFieldsValue, resetFields }] = useForm({ |
| 7 | 8 | schemas: [ |
| ... | ... | @@ -28,7 +29,7 @@ |
| 28 | 29 | min: 0, |
| 29 | 30 | max: 100, |
| 30 | 31 | formatter: (e) => { |
| 31 | - const value = e.replace(/^0/g, ''); | |
| 32 | + const value = e?.toString().replace(/^0/g, ''); | |
| 32 | 33 | if (value) { |
| 33 | 34 | return value.replace(/^0/g, ''); |
| 34 | 35 | } else { | ... | ... |
| ... | ... | @@ -58,7 +58,7 @@ |
| 58 | 58 | min: 0, |
| 59 | 59 | max: 100, |
| 60 | 60 | formatter: (e) => { |
| 61 | - const value = e.replace(/^0/g, ''); | |
| 61 | + const value = e?.toString().replace(/^0/g, ''); | |
| 62 | 62 | if (value) { |
| 63 | 63 | return value.replace(/^0/g, ''); |
| 64 | 64 | } else { |
| ... | ... | @@ -76,7 +76,7 @@ |
| 76 | 76 | min: 0, |
| 77 | 77 | max: 100, |
| 78 | 78 | formatter: (e) => { |
| 79 | - const value = e.replace(/^0/g, ''); | |
| 79 | + const value = e?.toString().replace(/^0/g, ''); | |
| 80 | 80 | if (value) { |
| 81 | 81 | return value.replace(/^0/g, ''); |
| 82 | 82 | } else { | ... | ... |
| ... | ... | @@ -72,7 +72,7 @@ |
| 72 | 72 | min: 0, |
| 73 | 73 | max: 100, |
| 74 | 74 | formatter: (e) => { |
| 75 | - const value = e.replace(/^0/g, ''); | |
| 75 | + const value = e?.toString().replace(/^0/g, ''); | |
| 76 | 76 | if (value) { |
| 77 | 77 | return value.replace(/^0/g, ''); |
| 78 | 78 | } else { |
| ... | ... | @@ -90,7 +90,7 @@ |
| 90 | 90 | min: 0, |
| 91 | 91 | max: 100, |
| 92 | 92 | formatter: (e) => { |
| 93 | - const value = e.replace(/^0/g, ''); | |
| 93 | + const value = e?.toString().replace(/^0/g, ''); | |
| 94 | 94 | if (value) { |
| 95 | 95 | return value.replace(/^0/g, ''); |
| 96 | 96 | } else { | ... | ... |
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | min: 0, |
| 52 | 52 | max: 100, |
| 53 | 53 | formatter: (e) => { |
| 54 | - const value = e.replace(/^0/g, ''); | |
| 54 | + const value = e?.toString().replace(/^0/g, ''); | |
| 55 | 55 | if (value) { |
| 56 | 56 | return value.replace(/^0/g, ''); |
| 57 | 57 | } else { |
| ... | ... | @@ -69,7 +69,7 @@ |
| 69 | 69 | min: 0, |
| 70 | 70 | max: 100, |
| 71 | 71 | formatter: (e) => { |
| 72 | - const value = e.replace(/^0/g, ''); | |
| 72 | + const value = e?.toString().replace(/^0/g, ''); | |
| 73 | 73 | if (value) { |
| 74 | 74 | return value.replace(/^0/g, ''); |
| 75 | 75 | } else { | ... | ... |
| ... | ... | @@ -62,7 +62,7 @@ |
| 62 | 62 | min: 0, |
| 63 | 63 | max: 100, |
| 64 | 64 | formatter: (e) => { |
| 65 | - const value = e.replace(/^0/g, ''); | |
| 65 | + const value = e?.toString().replace(/^0/g, ''); | |
| 66 | 66 | if (value) { |
| 67 | 67 | return value.replace(/^0/g, ''); |
| 68 | 68 | } else { |
| ... | ... | @@ -80,7 +80,7 @@ |
| 80 | 80 | min: 0, |
| 81 | 81 | max: 100, |
| 82 | 82 | formatter: (e) => { |
| 83 | - const value = e.replace(/^0/g, ''); | |
| 83 | + const value = e?.toString().replace(/^0/g, ''); | |
| 84 | 84 | if (value) { |
| 85 | 85 | return value.replace(/^0/g, ''); |
| 86 | 86 | } else { | ... | ... |
| ... | ... | @@ -85,7 +85,7 @@ |
| 85 | 85 | min: 0, |
| 86 | 86 | max: 100, |
| 87 | 87 | formatter: (e) => { |
| 88 | - const value = e.replace(/^0/g, ''); | |
| 88 | + const value = e?.toString().replace(/^0/g, ''); | |
| 89 | 89 | if (value) { |
| 90 | 90 | return value.replace(/^0/g, ''); |
| 91 | 91 | } else { |
| ... | ... | @@ -103,7 +103,7 @@ |
| 103 | 103 | min: 0, |
| 104 | 104 | max: 100, |
| 105 | 105 | formatter: (e) => { |
| 106 | - const value = e.replace(/^0/g, ''); | |
| 106 | + const value = e?.toString().replace(/^0/g, ''); | |
| 107 | 107 | if (value) { |
| 108 | 108 | return value.replace(/^0/g, ''); |
| 109 | 109 | } else { | ... | ... |
| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | min: 0, |
| 29 | 29 | max: 100, |
| 30 | 30 | formatter: (e) => { |
| 31 | - const value = e.replace(/^0/g, ''); | |
| 31 | + const value = e?.toString().replace(/^0/g, ''); | |
| 32 | 32 | if (value) { |
| 33 | 33 | return value.replace(/^0/g, ''); |
| 34 | 34 | } else { |
| ... | ... | @@ -45,7 +45,7 @@ |
| 45 | 45 | componentProps: { |
| 46 | 46 | min: 0, |
| 47 | 47 | formatter: (e) => { |
| 48 | - const value = e.replace(/^0/g, ''); | |
| 48 | + const value = e?.toString().replace(/^0/g, ''); | |
| 49 | 49 | if (value) { |
| 50 | 50 | return value.replace(/^0/g, ''); |
| 51 | 51 | } else { | ... | ... |
| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | min: 0, |
| 29 | 29 | max: 100, |
| 30 | 30 | formatter: (e) => { |
| 31 | - const value = e.replace(/^0/g, ''); | |
| 31 | + const value = e?.toString().replace(/^0/g, ''); | |
| 32 | 32 | if (value) { |
| 33 | 33 | return value.replace(/^0/g, ''); |
| 34 | 34 | } else { |
| ... | ... | @@ -46,7 +46,7 @@ |
| 46 | 46 | min: 0, |
| 47 | 47 | max: 100, |
| 48 | 48 | formatter: (e) => { |
| 49 | - const value = e.replace(/^0/g, ''); | |
| 49 | + const value = e?.toString().replace(/^0/g, ''); | |
| 50 | 50 | if (value) { |
| 51 | 51 | return value.replace(/^0/g, ''); |
| 52 | 52 | } else { | ... | ... |
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | min: 0, |
| 34 | 34 | max: 100, |
| 35 | 35 | formatter: (e) => { |
| 36 | - const value = e.replace(/^0/g, ''); | |
| 36 | + const value = e?.toString().replace(/^0/g, ''); | |
| 37 | 37 | if (value) { |
| 38 | 38 | return value.replace(/^0/g, ''); |
| 39 | 39 | } else { |
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | min: 0, |
| 52 | 52 | max: 100, |
| 53 | 53 | formatter: (e) => { |
| 54 | - const value = e.replace(/^0/g, ''); | |
| 54 | + const value = e?.toString().replace(/^0/g, ''); | |
| 55 | 55 | if (value) { |
| 56 | 56 | return value.replace(/^0/g, ''); |
| 57 | 57 | } else { | ... | ... |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | min: 0, |
| 33 | 33 | max: 100, |
| 34 | 34 | formatter: (e) => { |
| 35 | - const value = e.replace(/^0/g, ''); | |
| 35 | + const value = e?.toString().replace(/^0/g, ''); | |
| 36 | 36 | if (value) { |
| 37 | 37 | return value.replace(/^0/g, ''); |
| 38 | 38 | } else { |
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | min: 0, |
| 51 | 51 | max: 100, |
| 52 | 52 | formatter: (e) => { |
| 53 | - const value = e.replace(/^0/g, ''); | |
| 53 | + const value = e?.toString().replace(/^0/g, ''); | |
| 54 | 54 | if (value) { |
| 55 | 55 | return value.replace(/^0/g, ''); |
| 56 | 56 | } else { | ... | ... |
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | min: 0, |
| 35 | 35 | max: 100, |
| 36 | 36 | formatter: (e) => { |
| 37 | - const value = e.replace(/^0/g, ''); | |
| 37 | + const value = e?.toString().replace(/^0/g, ''); | |
| 38 | 38 | if (value) { |
| 39 | 39 | return value.replace(/^0/g, ''); |
| 40 | 40 | } else { |
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | min: 0, |
| 53 | 53 | max: 100, |
| 54 | 54 | formatter: (e) => { |
| 55 | - const value = e.replace(/^0/g, ''); | |
| 55 | + const value = e?.toString().replace(/^0/g, ''); | |
| 56 | 56 | if (value) { |
| 57 | 57 | return value.replace(/^0/g, ''); |
| 58 | 58 | } else { | ... | ... |
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | componentProps: { |
| 33 | 33 | min: 0, |
| 34 | 34 | formatter: (e) => { |
| 35 | - const value = e.replace(/^0/g, ''); | |
| 35 | + const value = e?.toString().replace(/^0/g, ''); | |
| 36 | 36 | if (value) { |
| 37 | 37 | return value.replace(/^0/g, ''); |
| 38 | 38 | } else { |
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | min: 0, |
| 51 | 51 | max: 100, |
| 52 | 52 | formatter: (e) => { |
| 53 | - const value = e.replace(/^0/g, ''); | |
| 53 | + const value = e?.toString().replace(/^0/g, ''); | |
| 54 | 54 | if (value) { |
| 55 | 55 | return value.replace(/^0/g, ''); |
| 56 | 56 | } else { | ... | ... |