Commit 46b6cdbf108af99b15b9bdf1a9c028d312b87528
Merge branch 'ft' into 'main_dev'
fix(packages/external): 修复小组件下图标配置显示不出来问题,原因(更新版本新增图标和此图标命名冲突) See merge request yunteng/thingskit-view!74
Showing
14 changed files
with
208 additions
and
20 deletions
src/assets/images/chart/decorates/pickIcon.png
renamed from
src/assets/images/chart/decorates/clock1.png
43.8 KB
... | ... | @@ -10,7 +10,7 @@ export const useChartInteract = ( |
10 | 10 | chartConfig: CreateComponentType, |
11 | 11 | useChartEditStore: ChartEditStoreType, |
12 | 12 | param: { [T: string]: any }, |
13 | - interactEventOn: string, | |
13 | + interactEventOn: string | |
14 | 14 | ) => { |
15 | 15 | const chartEditStore = useChartEditStore() |
16 | 16 | const { interactEvents } = chartConfig.events |
... | ... | @@ -30,25 +30,28 @@ export const useChartInteract = ( |
30 | 30 | Header.value[key] = param[item.interactFn[key]] |
31 | 31 | } |
32 | 32 | }) |
33 | - updateIndex(chartConfig) | |
33 | + setJump(chartConfig) | |
34 | 34 | }) |
35 | - | |
36 | - function updateIndex(chart: any) { | |
35 | + function setJump(chart: CreateComponentType) { | |
36 | + /** | |
37 | + * 通过页面显示隐藏来模拟页面跳转 | |
38 | + * 当前点击对象和绑定的联动组件(分组或单个)内容隐藏,目标对象和绑定的联动组件(分组或单个)内容显示 | |
39 | + */ | |
37 | 40 | try { |
38 | 41 | const targetId = chart.option.dataset[0].target |
39 | 42 | const currentId = chart.option.dataset[0].current |
40 | - const currentButtonId = chart.option.dataset[0].currentButton | |
41 | 43 | const targetButtonId = chart.option.dataset[0].targetButton |
44 | + const currentButtonId = chart.option.dataset[0].currentButton | |
42 | 45 | const targetIndex = chartEditStore.fetchTargetIndex(targetId) |
43 | 46 | const currentIndex = chartEditStore.fetchTargetIndex(currentId) |
44 | - const currentButtonIndex = chartEditStore.fetchTargetIndex(currentButtonId) | |
45 | 47 | const targetButtonIndex = chartEditStore.fetchTargetIndex(targetButtonId) |
48 | + const currentButtonIndex = chartEditStore.fetchTargetIndex(currentButtonId) | |
46 | 49 | chartEditStore.componentList[targetIndex].status.hide = false |
47 | 50 | chartEditStore.componentList[currentIndex].status.hide = true |
48 | - chartEditStore.componentList[currentButtonIndex].status.hide = true | |
49 | 51 | chartEditStore.componentList[targetButtonIndex].status.hide = false |
50 | - } catch (e) { | |
51 | - console.error(e) | |
52 | + chartEditStore.componentList[currentButtonIndex].status.hide = true | |
53 | + } finally { | |
54 | + console.log() | |
52 | 55 | } |
53 | 56 | } |
54 | 57 | } | ... | ... |
src/packages/components/external/Decorates/Mores/PickIcon/SvgBorder.vue
renamed from
src/packages/components/external/Decorates/Mores/Icon/SvgBorder.vue
src/packages/components/external/Decorates/Mores/PickIcon/config.ts
renamed from
src/packages/components/external/Decorates/Mores/Icon/config.ts
1 | 1 | import { PublicConfigClass } from '@/packages/public' |
2 | 2 | import { CreateComponentType } from '@/packages/index.d' |
3 | -import { ClockConfig } from './index' | |
3 | +import { PickIconConfig } from './index' | |
4 | 4 | import cloneDeep from 'lodash/cloneDeep' |
5 | 5 | import { IconBorderEnum, IconBorderStyleEnum, IconDynamicEffectEnum } from '../../../types' |
6 | 6 | import { chartInitConfig } from '@/settings/designSetting' |
... | ... | @@ -32,8 +32,8 @@ export const option: IconOptions = { |
32 | 32 | } |
33 | 33 | |
34 | 34 | export default class Config extends PublicConfigClass implements CreateComponentType { |
35 | - public key = ClockConfig.key | |
35 | + public key = PickIconConfig.key | |
36 | 36 | public attr = { ...chartInitConfig, zIndex: 1, w: 50, h: 50 } |
37 | - public chartConfig = cloneDeep(ClockConfig) | |
37 | + public chartConfig = cloneDeep(PickIconConfig) | |
38 | 38 | public option = cloneDeep(option) |
39 | 39 | } | ... | ... |
src/packages/components/external/Decorates/Mores/PickIcon/config.vue
renamed from
src/packages/components/external/Decorates/Mores/Icon/config.vue
src/packages/components/external/Decorates/Mores/PickIcon/index.ts
renamed from
src/packages/components/external/Decorates/Mores/Icon/index.ts
... | ... | @@ -2,9 +2,9 @@ import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/ind |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Decorates/index.d' |
3 | 3 | import { useWidgetKey } from '@/packages/external/useWidgetKey' |
4 | 4 | |
5 | -const { key, conKey, chartKey } = useWidgetKey('Icon', true) | |
5 | +const { key, conKey, chartKey } = useWidgetKey('PickIcon', true) | |
6 | 6 | |
7 | -export const ClockConfig: ConfigType = { | |
7 | +export const PickIconConfig: ConfigType = { | |
8 | 8 | key, |
9 | 9 | chartKey, |
10 | 10 | conKey, |
... | ... | @@ -13,5 +13,5 @@ export const ClockConfig: ConfigType = { |
13 | 13 | categoryName: ChatCategoryEnumName.MORE, |
14 | 14 | package: PackagesCategoryEnum.DECORATES, |
15 | 15 | chartFrame: ChartFrameEnum.STATIC, |
16 | - image: 'clock1.png' | |
16 | + image: 'pickIcon.png' | |
17 | 17 | } | ... | ... |
src/packages/components/external/Decorates/Mores/PickIcon/index.vue
renamed from
src/packages/components/external/Decorates/Mores/Icon/index.vue
1 | +import { PublicConfigClass } from '@/packages/public' | |
2 | +import { CreateComponentType } from '@/packages/index.d' | |
3 | +import { chartInitConfig } from '@/settings/designSetting' | |
4 | +import { OverrideIframeConfig } from './index' | |
5 | +import cloneDeep from 'lodash/cloneDeep' | |
6 | + | |
7 | +export const option = { | |
8 | + // 网站路径 | |
9 | + dataset: "https://www.thingskit.com/", | |
10 | + // 圆角 | |
11 | + borderRadius: 10 | |
12 | +} | |
13 | + | |
14 | +export default class Config extends PublicConfigClass implements CreateComponentType | |
15 | +{ | |
16 | + public key = OverrideIframeConfig.key | |
17 | + public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 } | |
18 | + public chartConfig = cloneDeep(OverrideIframeConfig) | |
19 | + public option = cloneDeep(option) | |
20 | +} | ... | ... |
1 | +<template> | |
2 | + <collapse-item name="属性" :expanded="true"> | |
3 | + <setting-item-box name="路径" :alone="true"> | |
4 | + <setting-item name="请填写 https 协议的网址"> | |
5 | + <n-input v-model:value="optionData.dataset" size="small"></n-input> | |
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 } from "vue"; | |
23 | +import { option } from "./config"; | |
24 | +import { | |
25 | + CollapseItem, | |
26 | + SettingItemBox, | |
27 | + SettingItem, | |
28 | +} from "@/components/Pages/ChartItemSetting"; | |
29 | + | |
30 | +const props = defineProps({ | |
31 | + optionData: { | |
32 | + type: Object as PropType<typeof option>, | |
33 | + required: true, | |
34 | + }, | |
35 | +}); | |
36 | +</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('OverrideIframe', true) | |
6 | + | |
7 | +export const OverrideIframeConfig: 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 | +} | ... | ... |
1 | +<template> | |
2 | + <div class="iframe-content" :style="getStyle(borderRadius)"> | |
3 | + <div v-show="isShowSvg" @click="handleFullScreen" class="fullscreen-button"> | |
4 | + <svg | |
5 | + focusable="false" | |
6 | + class="" | |
7 | + data-icon="fullscreen" | |
8 | + width="2.1vw" | |
9 | + height="2.1vh" | |
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 | + style="border-width: 0" | |
27 | + ></iframe> | |
28 | + </div> | |
29 | +</template> | |
30 | + | |
31 | +<script setup lang="ts"> | |
32 | +import { PropType, shallowReactive, watch, toRefs, ref } from 'vue' | |
33 | +import { useChartDataFetch } from '@/hooks' | |
34 | +import { CreateComponentType } from '@/packages/index.d' | |
35 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
36 | +import { useFullScreen } from '@/packages/components/external/Charts/utls/fullScreen' | |
37 | + | |
38 | +const props = defineProps({ | |
39 | + chartConfig: { | |
40 | + type: Object as PropType<CreateComponentType>, | |
41 | + required: true | |
42 | + } | |
43 | +}) | |
44 | + | |
45 | +const isShowSvg = ref(false) | |
46 | + | |
47 | +const { w, h } = toRefs(props.chartConfig.attr) | |
48 | +const { borderRadius } = toRefs(props.chartConfig.option) | |
49 | + | |
50 | +const option = shallowReactive({ | |
51 | + dataset: '' | |
52 | +}) | |
53 | + | |
54 | +const getStyle = (radius: number) => { | |
55 | + return { | |
56 | + borderRadius: `${radius}px`, | |
57 | + overflow: 'hidden' | |
58 | + } | |
59 | +} | |
60 | + | |
61 | +// 编辑更新 | |
62 | +watch( | |
63 | + () => props.chartConfig.option.dataset, | |
64 | + (newData: string) => { | |
65 | + option.dataset = newData | |
66 | + }, | |
67 | + { | |
68 | + immediate: true | |
69 | + } | |
70 | +) | |
71 | + | |
72 | +// 预览更新 | |
73 | +useChartDataFetch(props.chartConfig, useChartEditStore, (newData: string) => { | |
74 | + option.dataset = newData | |
75 | +}) | |
76 | + | |
77 | +const handleFullScreen = () => { | |
78 | + const domName = document.getElementById('iframeContent') as HTMLElement | |
79 | + const htmlName = document.querySelector('html') as HTMLHtmlElement | |
80 | + useFullScreen(domName, htmlName) | |
81 | +} | |
82 | + | |
83 | +const handleMouseenter = () => (isShowSvg.value = true) | |
84 | +const handleMouseleave = () => (isShowSvg.value = false) | |
85 | +</script> | |
86 | + | |
87 | +<style lang="scss" scoped> | |
88 | +.iframe-content { | |
89 | + position: relative; | |
90 | + .fullscreen-button { | |
91 | + cursor: pointer; | |
92 | + position: absolute; | |
93 | + right: 0; | |
94 | + top: 0; | |
95 | + } | |
96 | +} | |
97 | +</style> | ... | ... |
... | ... | @@ -32,10 +32,10 @@ export const option = { |
32 | 32 | tabStyleOptions: { |
33 | 33 | textColor: 'green', |
34 | 34 | textActiveColor: 'black', |
35 | - textBackgroundColor: '#ffffff', | |
35 | + textBackgroundColor: '#FFFFFF', | |
36 | 36 | tabBarColor: 'green', |
37 | - segmentBackgroundColor: 'grey', | |
38 | - segmentActiveColor: 'white' | |
37 | + segmentBackgroundColor: '#F7F7FA', | |
38 | + segmentActiveColor: '#FFFFFF' | |
39 | 39 | } |
40 | 40 | } |
41 | 41 | ... | ... |
1 | 1 | import { EPackagesCategoryEnum, EPackagesType } from '@/packages/components/external/types' |
2 | 2 | import { ComposesList } from '@/packages/components/external/Composes' |
3 | 3 | import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' |
4 | -import { ClockConfig } from '@/packages/components/external/Decorates/Mores/Icon' | |
4 | +import { PickIconConfig } from '@/packages/components/external/Decorates/Mores/PickIcon' | |
5 | 5 | import { WeatherConfig } from '@/packages/components/external/Decorates/Mores/Weather' |
6 | 6 | import { OverrideImageConfig } from '@/packages/components/external/Informations/Mores/OverrideImage' |
7 | 7 | import { OverrideCarouselConfig } from '@/packages/components/external/Informations/Mores/OverrideCarousel' |
... | ... | @@ -9,6 +9,7 @@ import { OverrideSelectConfig } from '@/packages/components/external/Information |
9 | 9 | import { OverrideInputsDateConfig } from '@/packages/components/external/Informations/Mores/OverrideInputsDate' |
10 | 10 | import { OverrideInputsTabConfig } from '@/packages/components/external/Informations/Mores/OverrideInputsTab' |
11 | 11 | import { OverrideTextCommonConfig } from '@/packages/components/external/Informations/Mores/OverrideTextCommon' |
12 | +import { OverrideIframeConfig } from '@/packages/components/external/Informations/Mores/OverrideIframe' | |
12 | 13 | import { ButtonConfig } from '@/packages/components/external/Informations/Mores/Button' |
13 | 14 | import { OverrideBarCommonConfig } from '@/packages/components/external/Charts/Bars/OverrideBarCommon' |
14 | 15 | import { OverrideLineCommonConfig } from '@/packages/components/external/Charts/Lines/OverrideLineCommon' |
... | ... | @@ -18,7 +19,7 @@ export function useInjectLib(packagesList: EPackagesType) { |
18 | 19 | |
19 | 20 | packagesList[EPackagesCategoryEnum.COMPOSES] = ComposesList |
20 | 21 | |
21 | - addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, ClockConfig) | |
22 | + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, PickIconConfig) | |
22 | 23 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, WeatherConfig) |
23 | 24 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideImageConfig) |
24 | 25 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideCarouselConfig) |
... | ... | @@ -27,6 +28,7 @@ export function useInjectLib(packagesList: EPackagesType) { |
27 | 28 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideInputsTabConfig) |
28 | 29 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideTextCommonConfig) |
29 | 30 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, ButtonConfig) |
31 | + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideIframeConfig) | |
30 | 32 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideBarCommonConfig) |
31 | 33 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideLineCommonConfig) |
32 | 34 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideLineGradientsConfig) | ... | ... |
... | ... | @@ -113,6 +113,19 @@ const setDynamicFormValue = (request: ExtraRequestConfigType) => { |
113 | 113 | if (unref(bodyContentEl)) { |
114 | 114 | unref(bodyContentEl)?.setConfigurationData(unref(getSelectedInterfaceBody), Body) |
115 | 115 | } |
116 | + /** | |
117 | + * ft 优化动态表单包含有entityType,则自动回填DEVICE | |
118 | + */ | |
119 | + if(typeof request.requestParams ==='string' && request.requestParams) { | |
120 | + const DEVICE='DEVICE' | |
121 | + const {Params:includeEntityTypeByParams}=JSON.parse(request.requestParams as unknown as string) | |
122 | + const findEntityType = includeEntityTypeByParams.find((item:Record<string,string>)=>item.key==='scope' && item.value==='entityType') | |
123 | + if(!findEntityType) return | |
124 | + if (unref(paramsDynamicFormEl)) unref(paramsDynamicFormEl)?.setConfigurationData({ | |
125 | + [findEntityType?.value]:DEVICE | |
126 | + }) | |
127 | + } | |
128 | + //ft | |
116 | 129 | } |
117 | 130 | |
118 | 131 | const getDynamicFormValue = (): Recordable => { | ... | ... |