Showing
6 changed files
with
203 additions
and
1 deletions
... | ... | @@ -6,7 +6,8 @@ enum Api { |
6 | 6 | UPLOAD = '/oss/upload', |
7 | 7 | DOWNLOAD = '/oss/download_file/', |
8 | 8 | AREALIST = '/area/list', |
9 | - PLATFORM = '/platform/get' | |
9 | + PLATFORM = '/platform/get', | |
10 | + CONFIGURATION = '/configuration/center' | |
10 | 11 | } |
11 | 12 | |
12 | 13 | export const getDictItemByCode = (value: string) => { |
... | ... | @@ -39,3 +40,8 @@ export const getAreaList = (data: object) => { |
39 | 40 | |
40 | 41 | //获取企业定制 |
41 | 42 | export const getPlatformInfo = () => defHttp.get({ url: Api.PLATFORM }) |
43 | + | |
44 | +//获取组态列表 | |
45 | +export const getConfigurationList = (params: object) => { | |
46 | + return defHttp.get({ url: `${Api.CONFIGURATION}`, params }) | |
47 | +} | ... | ... |
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/config.ts
0 → 100644
1 | +import { PublicConfigClass } from '@/packages/public' | |
2 | +import { CreateComponentType } from '@/packages/index.d' | |
3 | +import { chartInitConfig } from '@/settings/designSetting' | |
4 | +import { OverrideILoadConfigurationframeConfig } from './index' | |
5 | +import cloneDeep from 'lodash/cloneDeep' | |
6 | + | |
7 | +export const option = { | |
8 | + // 网站路径 | |
9 | + dataset: "", | |
10 | + // 圆角 | |
11 | + borderRadius: 10 | |
12 | +} | |
13 | + | |
14 | +export default class Config extends PublicConfigClass implements CreateComponentType | |
15 | +{ | |
16 | + public key = OverrideILoadConfigurationframeConfig.key | |
17 | + public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } | |
18 | + public chartConfig = cloneDeep(OverrideILoadConfigurationframeConfig) | |
19 | + public option = cloneDeep(option) | |
20 | +} | ... | ... |
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/config.vue
0 → 100644
1 | +<template> | |
2 | + <collapse-item name="属性" :expanded="true"> | |
3 | + <setting-item-box name="路径" :alone="true"> | |
4 | + <setting-item name="请选择要加载的组态"> | |
5 | + <n-select size="small" v-model:value="optionData.dataset" :options="configurationOptions" /> | |
6 | + </setting-item> | |
7 | + </setting-item-box> | |
8 | + <setting-item-box name="样式"> | |
9 | + <setting-item name="圆角"> | |
10 | + <n-input-number | |
11 | + v-model:value="optionData.borderRadius" | |
12 | + size="small" | |
13 | + :min="0" | |
14 | + placeholder="圆角" | |
15 | + ></n-input-number> | |
16 | + </setting-item> | |
17 | + </setting-item-box> | |
18 | + </collapse-item> | |
19 | +</template> | |
20 | + | |
21 | +<script setup lang="ts"> | |
22 | +import { PropType, onMounted, ref } from 'vue' | |
23 | +import { option } from './config' | |
24 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | |
25 | +import { getConfigurationList } from '@/api/external/common/index' | |
26 | + | |
27 | +defineProps({ | |
28 | + optionData: { | |
29 | + type: Object as PropType<typeof option>, | |
30 | + required: true | |
31 | + } | |
32 | +}) | |
33 | + | |
34 | +const configurationOptions = ref([]) | |
35 | + | |
36 | +const getConfigurationOptions = async (params: object) => { | |
37 | + const { items } = await getConfigurationList(params) | |
38 | + if (items) { | |
39 | + configurationOptions.value = items.map((item: Record<string, string>) => ({ label: item.name, value: item.id })) | |
40 | + } | |
41 | +} | |
42 | + | |
43 | +onMounted(() => { | |
44 | + getConfigurationOptions({ page: 1, pageSize: 10 }) | |
45 | +}) | |
46 | +</script> | ... | ... |
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/index.ts
0 → 100644
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('OverrideILoadConfigurationframe', true) | |
6 | + | |
7 | +export const OverrideILoadConfigurationframeConfig: ConfigType = { | |
8 | + key, | |
9 | + chartKey, | |
10 | + conKey, | |
11 | + title: '加载组态', | |
12 | + category: ChatCategoryEnum.MORE, | |
13 | + categoryName: ChatCategoryEnumName.MORE, | |
14 | + package: PackagesCategoryEnum.INFORMATIONS, | |
15 | + chartFrame: ChartFrameEnum.COMMON, | |
16 | + image: 'iframe.png' | |
17 | +} | ... | ... |
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/index.vue
0 → 100644
1 | +<template> | |
2 | + <div class="iframe-content" :style="getStyle(borderRadius)"> | |
3 | + <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton"> | |
4 | + <svg | |
5 | + focusable="false" | |
6 | + class="" | |
7 | + data-icon="fullscreen" | |
8 | + width="4vw" | |
9 | + height="4vh" | |
10 | + fill="currentColor" | |
11 | + aria-hidden="true" | |
12 | + viewBox="64 64 896 896" | |
13 | + > | |
14 | + <path | |
15 | + d="M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z" | |
16 | + ></path> | |
17 | + </svg> | |
18 | + </div> | |
19 | + <iframe | |
20 | + @mouseenter="handleMouseenter" | |
21 | + @mouseleave="handleMouseleave" | |
22 | + id="iframeContent" | |
23 | + :src="option.dataset" | |
24 | + :width="w" | |
25 | + :height="h" | |
26 | + :allowfullscreen="allowfullscreen" | |
27 | + style="border-width: 0" | |
28 | + ></iframe> | |
29 | + </div> | |
30 | +</template> | |
31 | + | |
32 | +<script setup lang="ts"> | |
33 | +import { PropType, shallowReactive, watch, toRefs, ref } from 'vue' | |
34 | +import { useChartDataFetch } from '@/hooks' | |
35 | +import { CreateComponentType } from '@/packages/index.d' | |
36 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
37 | +import { useFullScreen } from '@/packages/components/external/Charts/utls/fullScreen' | |
38 | +import { isDevMode } from '@/utils/external/env'; | |
39 | + | |
40 | + | |
41 | +const props = defineProps({ | |
42 | + chartConfig: { | |
43 | + type: Object as PropType<CreateComponentType>, | |
44 | + required: true | |
45 | + } | |
46 | +}) | |
47 | + | |
48 | +const isShowSvg = ref(false) | |
49 | + | |
50 | +const allowfullscreen = ref(false) | |
51 | + | |
52 | +const { w, h } = toRefs(props.chartConfig.attr) | |
53 | +const { borderRadius } = toRefs(props.chartConfig.option) | |
54 | + | |
55 | +const option = shallowReactive({ | |
56 | + dataset: '' | |
57 | +}) | |
58 | + | |
59 | +const getStyle = (radius: number) => { | |
60 | + return { | |
61 | + borderRadius: `${radius}px`, | |
62 | + overflow: 'hidden' | |
63 | + } | |
64 | +} | |
65 | + | |
66 | +const isDev = isDevMode(); | |
67 | + | |
68 | +// 编辑更新 | |
69 | +watch( | |
70 | + () => props.chartConfig.option.dataset, | |
71 | + (newData: string) => { | |
72 | + const currentHost = window.location.host | |
73 | + const currentProtocol = window.location.protocol | |
74 | + //预览 | |
75 | + option.dataset = `${currentProtocol}//${currentHost}/thingskit-scada/${isDev ? '?dev=1&' : '?'}configurationId=${newData}&lightbox=1` | |
76 | + }, | |
77 | + { | |
78 | + immediate: true | |
79 | + } | |
80 | +) | |
81 | + | |
82 | +// 预览更新 | |
83 | +useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => { | |
84 | + option.dataset = newData | |
85 | +}) | |
86 | + | |
87 | +const handleFullScreen = () => { | |
88 | + const domName = document.getElementById('iframeContent') as HTMLElement | |
89 | + const htmlName = document.querySelector('html') as HTMLHtmlElement | |
90 | + useFullScreen(domName, htmlName) | |
91 | +} | |
92 | + | |
93 | +const handleMouseenter = () => { | |
94 | + isShowSvg.value = true | |
95 | + allowfullscreen.value = true | |
96 | +} | |
97 | + | |
98 | +const handleMouseleave = () => (isShowSvg.value = false) | |
99 | +</script> | |
100 | +<style lang="scss" scoped> | |
101 | +.iframe-content { | |
102 | + #fullscreenButton { | |
103 | + color: white; | |
104 | + cursor: pointer; | |
105 | + position: absolute; | |
106 | + z-index: 999999; | |
107 | + top: 3%; | |
108 | + right: 0.1vw; | |
109 | + } | |
110 | +} | |
111 | +</style> | ... | ... |
... | ... | @@ -19,6 +19,7 @@ import { OverrideLineGradientsConfig } from '@/packages/components/external/Char |
19 | 19 | import { OverrideProcessConfig } from '@/packages/components/external/Charts/Mores/OverrideProcess' |
20 | 20 | import { OverridePieCircleConfig } from '@/packages/components/external/Charts/Pies/OverridePieCircle' |
21 | 21 | import { OverrideMapBaseConfig } from '@/packages/components/external/Charts/Maps/OverrideMapBase' |
22 | +import { OverrideILoadConfigurationframeConfig } from '@/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe' | |
22 | 23 | |
23 | 24 | export function useInjectLib(packagesList: EPackagesType) { |
24 | 25 | packagesList[EPackagesCategoryEnum.COMPOSES] = ComposesList |
... | ... | @@ -41,6 +42,7 @@ export function useInjectLib(packagesList: EPackagesType) { |
41 | 42 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideProcessConfig) |
42 | 43 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverridePieCircleConfig) |
43 | 44 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideMapBaseConfig) |
45 | + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideILoadConfigurationframeConfig) | |
44 | 46 | } |
45 | 47 | |
46 | 48 | /** | ... | ... |