Commit dec4e007afd82f0069eaa4105840c2d811989b3e
Merge branch 'main_dev' into 'main'
Main dev See merge request yunteng/thingskit-view!282
Showing
22 changed files
with
266 additions
and
52 deletions
1 | 1 | import { defHttp } from '@/utils/external/http/axios' |
2 | -import {CameraRecord, ConfigurationItemType, DictItem, OrganizationListItem, UploadResponse} from './model' | |
2 | +import { CameraRecord, ConfigurationItemType, DictItem, OrganizationListItem, UploadResponse } from './model' | |
3 | 3 | import { PaginationResult } from '/#/external/axios' |
4 | 4 | import { isShareMode } from '@/views/share/hook' |
5 | 5 | |
... | ... | @@ -22,6 +22,7 @@ enum Api { |
22 | 22 | GET_DEVICE_LATEST = '/plugins/telemetry/DEVICE/', |
23 | 23 | DEVICE_ATTR = '/device/attributes', |
24 | 24 | ALARM_LIST = '/alarm', |
25 | + BASE_DELETE_URL = '/oss', | |
25 | 26 | } |
26 | 27 | |
27 | 28 | export const getDictItemByCode = (value: string) => { |
... | ... | @@ -89,7 +90,7 @@ export const getOrganizationList = (params?: OrganizationListItem) => |
89 | 90 | |
90 | 91 | //获取视频列表 |
91 | 92 | export const getVideoList = (params?: object) => |
92 | - defHttp.get<{data: CameraRecord[]}>({ | |
93 | + defHttp.get<{ data: CameraRecord[] }>({ | |
93 | 94 | url: Api.VIDEO, |
94 | 95 | params |
95 | 96 | }) |
... | ... | @@ -160,6 +161,17 @@ export const getAlarmList = (params?: object) => |
160 | 161 | url: Api.ALARM_LIST, |
161 | 162 | params |
162 | 163 | }, |
163 | - { | |
164 | - withShareToken: true | |
165 | - }) | |
164 | + { | |
165 | + withShareToken: true | |
166 | + }) | |
167 | + | |
168 | + | |
169 | +/** | |
170 | + * 删除上传的图片 | |
171 | + * @description deleteFilePath图片url | |
172 | + */ | |
173 | +export const deleteFilePath = (deleteFilePath?: string) => { | |
174 | + return defHttp.delete({ | |
175 | + url: `${Api.BASE_DELETE_URL}?deleteFilePath=${deleteFilePath}`, | |
176 | + }); | |
177 | +}; | ... | ... |
... | ... | @@ -31,6 +31,7 @@ interface uploadSizeFormatIF { |
31 | 31 | } |
32 | 32 | |
33 | 33 | const props = defineProps({ |
34 | + uploadIndex: Number, | |
34 | 35 | uploadImageUrl: { |
35 | 36 | type: String as PropType<string>, |
36 | 37 | default: '' |
... | ... | @@ -60,7 +61,7 @@ const customRequest = (options: UploadCustomRequestOptions) => { |
60 | 61 | uploadParams.append('file', newNameFile) |
61 | 62 | const uploadRes = await uploadFile(uploadParams) |
62 | 63 | if (!uploadRes) return |
63 | - emit('sendFile', uploadRes?.fileStaticUri) | |
64 | + emit('sendFile', uploadRes?.fileStaticUri, props.uploadIndex) | |
64 | 65 | window['$message'].success('上传文件成功!') |
65 | 66 | } else { |
66 | 67 | window['$message'].error('上传文件失败,请稍后重试!') |
... | ... | @@ -88,7 +89,7 @@ const beforeUploadHandle = (file: UploadFileInfo) => { |
88 | 89 | //单个点击删除 |
89 | 90 | const remove = () => { |
90 | 91 | fileList.value = [] |
91 | - emit('removeFile', true) | |
92 | + emit('removeFile', true, props.uploadIndex) | |
92 | 93 | } |
93 | 94 | </script> |
94 | 95 | ... | ... |
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | </template> |
8 | 8 | |
9 | 9 | <script setup lang="ts"> |
10 | -import { PropType, toRefs, watch, ref, computed, unref } from 'vue' | |
10 | +import { PropType, toRefs, watch, ref } from 'vue' | |
11 | 11 | import { CreateComponentType } from '@/packages/index.d' |
12 | 12 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
13 | 13 | import { useChartDataFetch } from '@/hooks' |
... | ... | @@ -25,16 +25,19 @@ const props = defineProps({ |
25 | 25 | |
26 | 26 | const { w, h } = toRefs(props.chartConfig.attr) |
27 | 27 | |
28 | -const { targetData, chartEditStore } = useTargetData() | |
28 | +const { targetData } = useTargetData() | |
29 | 29 | |
30 | +/** | |
31 | + * 递归判断是否是ws会造成页面崩溃,浏览器无法点击 | |
32 | + * | |
30 | 33 | const isWebsocket = computed(() => { |
31 | - const result = query(chartEditStore.getComponentList) | |
34 | + const result = query(chartEditStore.getComponentList) as unknown as any | |
32 | 35 | if (result === false) return false |
33 | - | |
34 | - if (result.id === targetData.value.id) | |
36 | + if (!targetData.value) return | |
37 | + if (result?.id === targetData.value.id) | |
35 | 38 | return targetData.value.request.requestContentType as RequestContentTypeEnum === RequestContentTypeEnum.WEB_SOCKET |
36 | 39 | else { |
37 | - return result.request.requestContentType as RequestContentTypeEnum === RequestContentTypeEnum.WEB_SOCKET | |
40 | + return result?.request.requestContentType as RequestContentTypeEnum === RequestContentTypeEnum.WEB_SOCKET | |
38 | 41 | } |
39 | 42 | }) |
40 | 43 | |
... | ... | @@ -42,19 +45,20 @@ function query(list: CreateComponentType[]) { |
42 | 45 | if (!list || !list?.length) return false |
43 | 46 | |
44 | 47 | for (const item of list) { |
48 | + if (!targetData.value) return | |
45 | 49 | if (item.id === targetData.value.id) { |
46 | 50 | return item |
47 | 51 | } |
48 | 52 | if (item.groupList && item.groupList?.length) { |
49 | - const flag = query(list) | |
53 | + const flag = query(item.groupList) // 不能使用list递归,页面报内存溢出 | |
50 | 54 | if (flag) { |
51 | 55 | return item |
52 | 56 | } |
53 | 57 | } |
54 | 58 | } |
55 | - | |
56 | 59 | return false |
57 | 60 | } |
61 | +*/ | |
58 | 62 | |
59 | 63 | const { |
60 | 64 | flipperLength, |
... | ... | @@ -97,7 +101,7 @@ watch( |
97 | 101 | ) |
98 | 102 | |
99 | 103 | useChartDataFetch(props.chartConfig, useChartEditStore, (newVal: string | number) => { |
100 | - if (unref(isWebsocket)) return | |
104 | + if(targetData.value?.request?.requestContentType === RequestContentTypeEnum.WEB_SOCKET) return //请求类型是ws,则终止 | |
101 | 105 | updateDatasetHandler(newVal) |
102 | 106 | }) |
103 | 107 | </script> | ... | ... |
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <n-input :style="`width:${w}px;`" type="text" | |
3 | + <n-input :style="`width:${w}px;height:${h}px;`" type="text" | |
4 | 4 | v-model:value="option.value.dataset" |
5 | 5 | placeholder="请输入" |
6 | - @update="onChange"> | |
6 | + @blur="onBlur"> | |
7 | 7 | |
8 | 8 | </n-input> |
9 | 9 | </div> |
... | ... | @@ -25,6 +25,7 @@ const props = defineProps({ |
25 | 25 | }) |
26 | 26 | |
27 | 27 | const { w, h } = toRefs(props.chartConfig.attr) |
28 | + | |
28 | 29 | const option = shallowReactive({ |
29 | 30 | value: { |
30 | 31 | inputValue: props.chartConfig.option.inputValue, |
... | ... | @@ -32,8 +33,7 @@ const option = shallowReactive({ |
32 | 33 | } |
33 | 34 | }) |
34 | 35 | |
35 | -const onChange = (v: string) => { | |
36 | - // if(v == undefined) return; | |
36 | +const onBlur = () => { | |
37 | 37 | // 存储到联动数据 |
38 | 38 | useChartInteract( |
39 | 39 | props.chartConfig, |
... | ... | @@ -49,7 +49,6 @@ watch( |
49 | 49 | () => props.chartConfig.option, |
50 | 50 | (newData: any) => { |
51 | 51 | option.value = newData |
52 | - onChange(newData.inputValue) | |
53 | 52 | }, |
54 | 53 | { |
55 | 54 | immediate: true, | ... | ... |
1.41 KB
... | ... | @@ -123,9 +123,14 @@ const createInfoWindow = async (extraInfo: dataExtraInfoType) => { |
123 | 123 | devicePartInfo.name = name |
124 | 124 | devicePartInfo.deviceProfileId = deviceProfileId |
125 | 125 | if (tbDeviceId.startsWith('@')) return //假的模拟数据则终止 |
126 | + let deviceLastUpdateTs = null | |
126 | 127 | const res = await getDeviceActiveTime(tbDeviceId) //查询设备最后离线时间 |
127 | - let { lastUpdateTs } = res[0] | |
128 | - const lastUpdateFormatTs = dayjs(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss') | |
128 | + if (!res) { | |
129 | + deviceLastUpdateTs = null | |
130 | + } else { | |
131 | + deviceLastUpdateTs = res[0]['lastUpdateTs'] | |
132 | + } | |
133 | + const lastUpdateFormatTs = deviceLastUpdateTs ? dayjs(deviceLastUpdateTs).format('YYYY-MM-DD HH:mm:ss'): '' | |
129 | 134 | //以render方式渲染小组件里的边框组件 |
130 | 135 | const BorderInstance = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/index.vue`) |
131 | 136 | const config = await import(`../../../../Decorates/Borders/${mpBorderConfig.value.value}/config.ts`) |
... | ... | @@ -194,11 +199,11 @@ const handleOpenDrawer = async () => { |
194 | 199 | } |
195 | 200 | |
196 | 201 | onMounted(() => { |
197 | - ;(window as any).handleOpenDrawer = handleOpenDrawer | |
202 | + (window as any).handleOpenDrawer = handleOpenDrawer | |
198 | 203 | }) |
199 | 204 | |
200 | 205 | onUnmounted(() => { |
201 | - ;(window as any).handleOpenDrawer = null | |
206 | + (window as any).handleOpenDrawer = null | |
202 | 207 | }) |
203 | 208 | |
204 | 209 | //地图鼠标hover |
... | ... | @@ -233,13 +238,15 @@ const dataHandle = (newData: dataJsonType) => { |
233 | 238 | // 记录新标记 |
234 | 239 | if (mapMarkerType.value === MarkerEnum.MARKER) { |
235 | 240 | newData.markers.forEach((markerItem: dataJsonMarkersType) => { |
241 | + console.log("🚀 ~ newData.markers.forEach ~ markerItem:", markerItem.extraInfo.deviceState) | |
236 | 242 | const markerInstance = new AMapIns.Marker({ |
237 | 243 | position: [markerItem.position[0], markerItem.position[1]], |
238 | 244 | offset: new AMapIns.Pixel(-13, 5), |
239 | 245 | icon: new AMapIns.Icon({ |
240 | - image: iconMarker.value, | |
241 | - size: new AMapIns.Size(22, 22), //图标所处区域大小 | |
242 | - imageSize: new AMapIns.Size(22, 22) //图标大小 | |
246 | + // image: iconMarker.value, | |
247 | + image: markerItem.extraInfo.deviceState === 'ONLINE' ? online : markerItem.extraInfo.deviceState === 'INACTIVE' ? inactive : offline, | |
248 | + size: new AMapIns.Size(35, 35), //图标所处区域大小 | |
249 | + imageSize: new AMapIns.Size(35, 35) //图标大小 | |
243 | 250 | }) |
244 | 251 | }) |
245 | 252 | // 原作者这种方式添加,属于JS API 1.4.8版本的 | ... | ... |
1 | +import { PublicConfigClass } from '@/packages/public' | |
2 | +import { CreateComponentType } from '@/packages/index.d' | |
3 | +import { chartInitConfig } from '@/settings/designSetting' | |
4 | +import { VariableImageConfig } from './index' | |
5 | +import cloneDeep from 'lodash/cloneDeep' | |
6 | + | |
7 | +export const option = { | |
8 | + dataset: '', | |
9 | + valueConfig: [ | |
10 | + { | |
11 | + value: '', | |
12 | + imageUrl: '' | |
13 | + } | |
14 | + ] | |
15 | +} | |
16 | + | |
17 | +export default class Config extends PublicConfigClass implements CreateComponentType { | |
18 | + public key = VariableImageConfig.key | |
19 | + public attr = { ...chartInitConfig, w: 500, h: 300, zIndex: -1 } | |
20 | + public chartConfig = cloneDeep(VariableImageConfig) | |
21 | + public option = cloneDeep(option) | |
22 | +} | ... | ... |
1 | +<template> | |
2 | + <collapse-item name="配置" :expanded="true"> | |
3 | + <template v-for="(item, index) in optionData.valueConfig" :key="index"> | |
4 | + <setting-item-box name="变量值" :alone="true"> | |
5 | + <setting-item> | |
6 | + <n-input v-model:value="item.value"></n-input> | |
7 | + </setting-item> | |
8 | + </setting-item-box> | |
9 | + <div style="height: 10px"></div> | |
10 | + <setting-item-box name="变量图片" :alone="true"> | |
11 | + <setting-item> | |
12 | + <TKUpload | |
13 | + :uploadIndex="index" | |
14 | + :uploadImageUrl="item.imageUrl" | |
15 | + @sendFile="handleSendFile" | |
16 | + @removeFile="handleRemoveFile" | |
17 | + /> | |
18 | + </setting-item> | |
19 | + </setting-item-box> | |
20 | + <n-button size="small" @click="optionData.valueConfig.splice(index, 1)"> - </n-button> | |
21 | + </template> | |
22 | + <n-button | |
23 | + style="margin-left: 10px" | |
24 | + v-if="optionData.valueConfig" | |
25 | + size="small" | |
26 | + @click=" | |
27 | + optionData.valueConfig.push({ | |
28 | + value: '', | |
29 | + imageUrl: '', | |
30 | + }) | |
31 | + " | |
32 | + > | |
33 | + + | |
34 | + </n-button> | |
35 | + </collapse-item> | |
36 | +</template> | |
37 | + | |
38 | +<script setup lang="ts"> | |
39 | +import { PropType } from 'vue' | |
40 | +import { option } from './config' | |
41 | +import { TKUpload } from '@/components/external/Common/TKUpload' | |
42 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | |
43 | + | |
44 | +const props = defineProps({ | |
45 | + optionData: { | |
46 | + type: Object as PropType<typeof option>, | |
47 | + required: true | |
48 | + } | |
49 | +}) | |
50 | + | |
51 | +const handleSendFile = (file: string, index: number) => { | |
52 | + if (!file) return | |
53 | + props.optionData.valueConfig[index].imageUrl = file | |
54 | +} | |
55 | + | |
56 | +const handleRemoveFile = (status: boolean, index: number) => | |
57 | + status ? (props.optionData.valueConfig[index].imageUrl = '') : null | |
58 | +</script> | ... | ... |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Informations/index.d' | |
3 | +import { useWidgetKey } from '@/packages/external/useWidgetKey' | |
4 | + | |
5 | +const { key, conKey, chartKey } = useWidgetKey('VariableImage', true) | |
6 | + | |
7 | +export const VariableImageConfig: ConfigType = { | |
8 | + key, | |
9 | + chartKey, | |
10 | + conKey, | |
11 | + title: '变量图片(适合ws)', | |
12 | + category: ChatCategoryEnum.MORE, | |
13 | + categoryName: ChatCategoryEnumName.MORE, | |
14 | + package: PackagesCategoryEnum.INFORMATIONS, | |
15 | + chartFrame: ChartFrameEnum.COMMON, | |
16 | + image: 'iframe.png' | |
17 | +} | ... | ... |
1 | +<template> | |
2 | + <div> | |
3 | + <n-image | |
4 | + preview-disabled | |
5 | + :fallback-src="requireErrorImg()" | |
6 | + :src="!dataset ? logo : dataset" | |
7 | + :width="w" | |
8 | + :height="h" | |
9 | + ></n-image> | |
10 | + </div> | |
11 | +</template> | |
12 | + | |
13 | +<script setup lang="ts"> | |
14 | +import { PropType, toRefs, watch } from 'vue' | |
15 | +import { requireErrorImg } from '@/utils' | |
16 | +import { useChartDataFetch } from '@/hooks' | |
17 | +import { CreateComponentType } from '@/packages/index.d' | |
18 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
19 | +import { option } from './config' | |
20 | +import logo from '@/assets/logo.png' | |
21 | + | |
22 | +const props = defineProps({ | |
23 | + chartConfig: { | |
24 | + type: Object as PropType<CreateComponentType>, | |
25 | + required: true | |
26 | + } | |
27 | +}) | |
28 | + | |
29 | +const { w, h } = toRefs(props.chartConfig.attr) | |
30 | + | |
31 | +const { dataset, valueConfig } = toRefs(props.chartConfig.option as unknown as typeof option) | |
32 | + | |
33 | +watch( | |
34 | + () => dataset?.value, | |
35 | + newValue => { | |
36 | + const findImageUrl = valueConfig?.value.find( | |
37 | + (valueConfigItem: typeof option['valueConfig'][0]) => String(valueConfigItem.value) === String(newValue) | |
38 | + ) | |
39 | + if (findImageUrl) { | |
40 | + dataset.value = findImageUrl?.imageUrl | |
41 | + } | |
42 | + }, | |
43 | + { | |
44 | + immediate: true | |
45 | + } | |
46 | +) | |
47 | + | |
48 | +// 预览更新 | |
49 | +useChartDataFetch(props.chartConfig, useChartEditStore) | |
50 | +</script> | ... | ... |
... | ... | @@ -8,7 +8,7 @@ export const OverrideTextEnumCommonConfig: ConfigType = { |
8 | 8 | key, |
9 | 9 | chartKey, |
10 | 10 | conKey, |
11 | - title: '自定义文字(支持枚举)', | |
11 | + title: '文字枚举(适合ws)', | |
12 | 12 | category: ChatCategoryEnum.TEXT, |
13 | 13 | categoryName: ChatCategoryEnumName.TEXT, |
14 | 14 | package: PackagesCategoryEnum.INFORMATIONS, | ... | ... |
... | ... | @@ -21,6 +21,7 @@ import { CameraConfig } from '@/packages/components/external/Informations/Mores/ |
21 | 21 | import { SingleCameraConfig } from '@/packages/components/external/Informations/Mores/SingleCamera' |
22 | 22 | import { OverrideILoadConfigurationframeConfig } from '@/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe' |
23 | 23 | import { CustomEchartsConfig } from '@/packages/components/external/Informations/Mores/CustomEcharts' |
24 | +import { VariableImageConfig } from '@/packages/components/external/Informations/Mores/VariableImage' | |
24 | 25 | import { OverrideBarCommonConfig } from '@/packages/components/external/Charts/Bars/OverrideBarCommon' |
25 | 26 | import { OverrideLineCommonConfig } from '@/packages/components/external/Charts/Lines/OverrideLineCommon' |
26 | 27 | import { OverrideLineGradientsConfig } from '@/packages/components/external/Charts/Lines/OverrideLineGradients' |
... | ... | @@ -145,6 +146,7 @@ export function useInjectLib(packagesList: EPackagesType) { |
145 | 146 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, SingleCameraConfig)//新增信息下的单个摄像头 |
146 | 147 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideILoadConfigurationframeConfig)//新增信息下的加载组态 |
147 | 148 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, CustomEchartsConfig)//新增信息下的自定义ecahrts组件 |
149 | + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, VariableImageConfig)//新增信息下的变量图片组件 | |
148 | 150 | // |
149 | 151 | |
150 | 152 | //图表 | ... | ... |
... | ... | @@ -50,7 +50,7 @@ |
50 | 50 | </template> |
51 | 51 | |
52 | 52 | <script setup lang="ts"> |
53 | -import { PropType, watch, ref, Ref, computed, nextTick } from 'vue' | |
53 | +import { PropType, watch, ref, Ref, computed, nextTick, onMounted } from 'vue' | |
54 | 54 | import { MacOsControlBtn } from '@/components/Tips/MacOsControlBtn/index' |
55 | 55 | import { ChartGlobImage } from '@/components/Pages/ChartGlobImage' |
56 | 56 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
... | ... | @@ -166,6 +166,18 @@ watch( |
166 | 166 | } |
167 | 167 | } |
168 | 168 | ) |
169 | + | |
170 | +/** | |
171 | + * 修复vue draggable拖拽插件在火狐浏览器上确实会存在拖拽会新开一个窗口,属于官方问题,其他浏览器不存在此问题。 | |
172 | + * 解决代码如下 | |
173 | + */ | |
174 | +onMounted(() => { | |
175 | + document.body.ondrop = function (event) { | |
176 | + event.preventDefault() | |
177 | + event.stopPropagation() | |
178 | + } | |
179 | +}) | |
180 | +// | |
169 | 181 | </script> |
170 | 182 | |
171 | 183 | <style lang="scss" scoped> | ... | ... |
... | ... | @@ -451,6 +451,8 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => { |
451 | 451 | params[BuiltInVariable.SELECT_TIME_AGGREGATION].agg = null |
452 | 452 | params[BuiltInVariable.SELECT_TIME_AGGREGATION].limit = 7 |
453 | 453 | params[BuiltInVariable.SELECT_TIME_AGGREGATION].interval = null |
454 | + params.page = null | |
455 | + params.pageSize = null | |
454 | 456 | getSelectDeviceAttr.value.value = null |
455 | 457 | getSelectOrgTree.value.value = null |
456 | 458 | getSelectDeviceProfile.value.value = null | ... | ... |
... | ... | @@ -163,7 +163,6 @@ const setConfigurationData = async (request: ExtraRequestConfigType) => { |
163 | 163 | * 源代码 selectedPublicInterface.value = requestDataPondId |
164 | 164 | * 修改后代码 selectedPublicInterface.value = publicInterfaceList.value.find(it=>it.id === requestDataPondId)?.id||'' |
165 | 165 | */ |
166 | - console.log(publicInterfaceList.value) | |
167 | 166 | selectedPublicInterface.value = publicInterfaceList.value.find(it => it.id === publicInterfaceSelectId)?.id || '' |
168 | 167 | //ft |
169 | 168 | requestContentTypeRef.value = requestContentType | ... | ... |
... | ... | @@ -275,7 +275,7 @@ const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => { |
275 | 275 | const requestDataPond = chartEditStore.getRequestGlobalConfig.requestDataPond.map(item => ({ |
276 | 276 | id: item.dataPondId, |
277 | 277 | title: item.dataPondName, |
278 | - disabled: false, | |
278 | + disabled: true, | |
279 | 279 | type: 'requestDataPond' |
280 | 280 | })) |
281 | 281 | const tarArr = requestDataPond.concat(mapOptionList) | ... | ... |
... | ... | @@ -193,13 +193,13 @@ const btnList: BtnListType[] = [ |
193 | 193 | icon: DownloadIcon, |
194 | 194 | handle: exportHandle |
195 | 195 | }, |
196 | - { | |
197 | - key: 'edit', | |
198 | - type: TypeEnum.BUTTON, | |
199 | - name: '编辑', | |
200 | - icon: CreateIcon, | |
201 | - handle: editHandle | |
202 | - }, | |
196 | + // { | |
197 | + // key: 'edit', | |
198 | + // type: TypeEnum.BUTTON, | |
199 | + // name: '编辑', | |
200 | + // icon: CreateIcon, | |
201 | + // handle: editHandle | |
202 | + // }, | |
203 | 203 | { |
204 | 204 | key: 'setting', |
205 | 205 | type: TypeEnum.BUTTON, | ... | ... |
... | ... | @@ -13,14 +13,16 @@ |
13 | 13 | {{ props.componentData.chartConfig.title }} |
14 | 14 | </span> |
15 | 15 | </n-ellipsis> |
16 | - <layers-status :isGroup="isGroup" :hover="hover" :status="status"></layers-status> | |
16 | + <div class="list-layers"> | |
17 | + <layers-status :isGroup="isGroup" :hover="hover" :status="status"></layers-status> | |
18 | + </div> | |
17 | 19 | </div> |
18 | 20 | <div :class="{ 'select-modal': select }"></div> |
19 | 21 | </div> |
20 | 22 | </template> |
21 | 23 | |
22 | 24 | <script setup lang="ts"> |
23 | -import { computed, PropType, ref } from 'vue' | |
25 | +import { computed, PropType, ref } from 'vue' | |
24 | 26 | import { requireErrorImg } from '@/utils' |
25 | 27 | import { useDesignStore } from '@/store/modules/designStore/designStore' |
26 | 28 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
... | ... | @@ -141,8 +143,24 @@ $textSize: 10px; |
141 | 143 | } |
142 | 144 | |
143 | 145 | .list-text { |
146 | + position: absolute; | |
147 | + z-index: 99; | |
148 | + left: 70px; | |
149 | + top: 20px; | |
144 | 150 | padding-left: 6px; |
151 | + width: 60px; | |
145 | 152 | font-size: $textSize; |
153 | + overflow: hidden; | |
154 | + text-align: left; | |
155 | + text-overflow: ellipsis; | |
156 | + white-space: nowrap; | |
157 | + } | |
158 | + | |
159 | + .list-layers { | |
160 | + position: absolute; | |
161 | + z-index: 99; | |
162 | + left: 140px; | |
163 | + top: 15px; | |
146 | 164 | } |
147 | 165 | |
148 | 166 | /* 选中样式 */ | ... | ... |
... | ... | @@ -11,6 +11,7 @@ import { useSync } from '../useSync.hook' |
11 | 11 | import { BaseUpdateContentParams, DateViewConfigurationInfoType } from '@/api/external/contentSave/model/contentModel' |
12 | 12 | import { useRole } from './business/useRole' |
13 | 13 | import { ChartEditStoreType, PageChartEditStoreType } from '@/store/modules/chartEditStore/chartEditStore.d' |
14 | +import { deleteFilePath } from '@/api/external/common' | |
14 | 15 | |
15 | 16 | /** |
16 | 17 | * * base64转file |
... | ... | @@ -180,7 +181,8 @@ export const useSyncRemote = () => { |
180 | 181 | |
181 | 182 | //thumbnailSyncUpdate 缩略图保存 |
182 | 183 | const thumbnailSyncUpdate = throttle(async (updateImg = true) => { |
183 | - const { state, organizationId, dataViewName } = projectInfoStore.getProjectInfo | |
184 | + console.log(projectInfoStore.getProjectInfo, 'projectInfoStore.getProjectInfo') | |
185 | + const { state, organizationId, dataViewName, thumbnail } = projectInfoStore.getProjectInfo | |
184 | 186 | if (updateImg) { |
185 | 187 | // 获取缩略图片 |
186 | 188 | const range = document.querySelector('.go-edit-range') as HTMLElement |
... | ... | @@ -198,6 +200,9 @@ export const useSyncRemote = () => { |
198 | 200 | base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`) |
199 | 201 | ) |
200 | 202 | const uploadRes = await uploadFile(uploadParams) |
203 | + if (thumbnail) { | |
204 | + await deleteFilePath(thumbnail) | |
205 | + } | |
201 | 206 | // 保存预览图 |
202 | 207 | if (uploadRes) { |
203 | 208 | await saveDataViewList({ | ... | ... |
... | ... | @@ -13,13 +13,18 @@ import Preview from './index.vue' |
13 | 13 | |
14 | 14 | let key = ref(Date.now()) |
15 | 15 | |
16 | -// 数据变更 -> 组件销毁重建 | |
17 | -;[SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW].forEach((saveEvent: string) => { | |
18 | - if (!window.opener && !window.opener.addEventListener) return | |
19 | - window.opener.addEventListener(saveEvent, async (e: any) => { | |
20 | - const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType | |
21 | - setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }]) | |
22 | - key.value = Date.now() | |
23 | - }) | |
24 | -}) | |
16 | +// 数据变更 -> 组件销毁重建 | |
17 | +try { | |
18 | + const listenerArr = [SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW] | |
19 | + listenerArr.forEach((saveEvent: string) => { | |
20 | + if (!window.opener || !window.opener.addEventListener) return | |
21 | + window.opener.addEventListener(saveEvent, async (e: any) => { | |
22 | + const localStorageInfo: ChartEditStorageType = (await getSessionStorageInfo()) as unknown as ChartEditStorageType | |
23 | + setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }]) | |
24 | + key.value = Date.now() | |
25 | + }) | |
26 | + }) | |
27 | +} catch (error) { | |
28 | + console.log(error) | |
29 | +} | |
25 | 30 | </script> | ... | ... |