Commit e9d99e240d116d2d1081e297cbed812ae3f18398

Authored by xp.Huang
2 parents 8b6f5ed7 eac97a1d

Merge branch 'ft' into 'main_dev'

perf(src/components): 优化部分功能体验

See merge request yunteng/thingskit-view!98
Showing 56 changed files with 380 additions and 66 deletions
1 <template> 1 <template>
2 <n-dropdown trigger="hover" @select="handleSelect" :show-arrow="true" :options="options"> 2 <n-dropdown trigger="hover" @select="handleSelect" :show-arrow="true" :options="options">
3 <div class="user-info-box"> 3 <div class="user-info-box">
4 - <person-icon v-if="!avatarLogo"></person-icon>  
5 <n-avatar 4 <n-avatar
6 - v-else  
7 round 5 round
8 object-fit="cover" 6 object-fit="cover"
9 size="medium" 7 size="medium"
1 -import { CameraConfig } from './Camera/index'  
2 -import { SingleCameraConfig } from './SingleCamera/index'  
3 -import { OverrideILoadConfigurationframeConfig } from './OverrideILoadConfigurationframe/index'  
4 -  
5 -export default [SingleCameraConfig, CameraConfig, OverrideILoadConfigurationframeConfig] 1 +/**
  2 + * 此项目扩展侧边栏功能,保留待用
  3 + */
1 -export enum ChatCategoryEnum {  
2 - MORE = 'Mores'  
3 -} 1 +// export enum ChatCategoryEnum {
  2 +// MORE = 'Mores'
  3 +// }
4 4
5 -export enum ChatCategoryEnumName {  
6 - MORE = '更多'  
7 -} 5 +// export enum ChatCategoryEnumName {
  6 +// MORE = '更多'
  7 +// }
8 8
9 -export enum PackagesCategoryEnum {  
10 - WORD_CLOUD = 'WordCloud'  
11 -} 9 +// export enum PackagesCategoryEnum {
  10 +// WORD_CLOUD = 'WordCloud'
  11 +// }
1 -import Mores from './Mores' 1 +// import Mores from './Mores'
2 2
3 -export const ComposesList = [...Mores] 3 +// export const ComposesList = [...Mores]
@@ -13,5 +13,5 @@ export const Decorates07Config: ConfigType = { @@ -13,5 +13,5 @@ export const Decorates07Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.DECORATE, 13 categoryName: ChatCategoryEnumName.DECORATE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'decorates11.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Decorates08Config: ConfigType = { @@ -13,5 +13,5 @@ export const Decorates08Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.DECORATE, 13 categoryName: ChatCategoryEnumName.DECORATE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'decorates08.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Decorates09Config: ConfigType = { @@ -13,5 +13,5 @@ export const Decorates09Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.DECORATE, 13 categoryName: ChatCategoryEnumName.DECORATE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'decorates09.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Decorates10Config: ConfigType = { @@ -13,5 +13,5 @@ export const Decorates10Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.DECORATE, 13 categoryName: ChatCategoryEnumName.DECORATE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'decorates10.png',
17 } 17 }
@@ -130,7 +130,7 @@ const props = defineProps({ @@ -130,7 +130,7 @@ const props = defineProps({
130 }) 130 })
131 const uploadFileListRef = ref() 131 const uploadFileListRef = ref()
132 132
133 -const selectValue = ref('headerBg08.png') 133 +const selectValue = ref<string| null>('headerBg08.png')
134 134
135 const getAllBackgroundImageList = computed(() => { 135 const getAllBackgroundImageList = computed(() => {
136 const pathList = import.meta.glob('../../../../../../assets/external/headbackground/*') 136 const pathList = import.meta.glob('../../../../../../assets/external/headbackground/*')
@@ -220,7 +220,7 @@ const handleChange = (value: boolean) => { @@ -220,7 +220,7 @@ const handleChange = (value: boolean) => {
220 const clearImage = () => { 220 const clearImage = () => {
221 props.optionData.backgroundImage = '' 221 props.optionData.backgroundImage = ''
222 props.optionData.bgSrc = '' 222 props.optionData.bgSrc = ''
223 - selectValue.value = '' 223 + selectValue.value = null
224 } 224 }
225 </script> 225 </script>
226 <style lang="scss" scoped> 226 <style lang="scss" scoped>
@@ -13,5 +13,5 @@ export const Subtitle4Config: ConfigType = { @@ -13,5 +13,5 @@ export const Subtitle4Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.SUBTITLE, 13 categoryName: ChatCategoryEnumName.SUBTITLE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'title4.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Subtitle5Config: ConfigType = { @@ -13,5 +13,5 @@ export const Subtitle5Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.SUBTITLE, 13 categoryName: ChatCategoryEnumName.SUBTITLE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'title5.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Subtitle6Config: ConfigType = { @@ -13,5 +13,5 @@ export const Subtitle6Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.SUBTITLE, 13 categoryName: ChatCategoryEnumName.SUBTITLE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'title6.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Subtitle7Config: ConfigType = { @@ -13,5 +13,5 @@ export const Subtitle7Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.SUBTITLE, 13 categoryName: ChatCategoryEnumName.SUBTITLE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'title7.png',
17 } 17 }
@@ -13,5 +13,5 @@ export const Subtitle8Config: ConfigType = { @@ -13,5 +13,5 @@ export const Subtitle8Config: ConfigType = {
13 categoryName: ChatCategoryEnumName.SUBTITLE, 13 categoryName: ChatCategoryEnumName.SUBTITLE,
14 package: PackagesCategoryEnum.DECORATES, 14 package: PackagesCategoryEnum.DECORATES,
15 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
16 - image: 'title3.png', 16 + image: 'title8.png',
17 } 17 }
@@ -4,12 +4,12 @@ @@ -4,12 +4,12 @@
4 <n-select size="small" v-model:value="optionData.buttonType" :options="buttonTypeOptions" /> 4 <n-select size="small" v-model:value="optionData.buttonType" :options="buttonTypeOptions" />
5 </setting-item-box> 5 </setting-item-box>
6 <setting-item-box name="虚线"> 6 <setting-item-box name="虚线">
7 - <setting-item name=""> 7 + <setting-item name="是否开启">
8 <n-switch v-model:value="optionData.buttonDashed" /> 8 <n-switch v-model:value="optionData.buttonDashed" />
9 </setting-item> 9 </setting-item>
10 </setting-item-box> 10 </setting-item-box>
11 <setting-item-box name="透明"> 11 <setting-item-box name="透明">
12 - <setting-item name=""> 12 + <setting-item name="是否开启">
13 <n-switch v-model:value="optionData.buttonGhost" /> 13 <n-switch v-model:value="optionData.buttonGhost" />
14 </setting-item> 14 </setting-item>
15 </setting-item-box> 15 </setting-item-box>
@@ -17,16 +17,31 @@ @@ -17,16 +17,31 @@
17 <setting-item name=""> 17 <setting-item name="">
18 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.buttonColor"></n-color-picker> 18 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.buttonColor"></n-color-picker>
19 </setting-item> 19 </setting-item>
  20 + <setting-item>
  21 + <n-button size="small" @click="optionData.buttonColor=''">
  22 + 恢复默认
  23 + </n-button>
  24 + </setting-item>
20 </setting-item-box> 25 </setting-item-box>
21 <setting-item-box name="文字颜色"> 26 <setting-item-box name="文字颜色">
22 <setting-item name=""> 27 <setting-item name="">
23 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.buttonTextColor"></n-color-picker> 28 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.buttonTextColor"></n-color-picker>
24 </setting-item> 29 </setting-item>
  30 + <setting-item>
  31 + <n-button size="small" @click="optionData.buttonTextColor='white'">
  32 + 恢复默认
  33 + </n-button>
  34 + </setting-item>
25 </setting-item-box> 35 </setting-item-box>
26 <setting-item-box name="文字大小"> 36 <setting-item-box name="文字大小">
27 <setting-item name=""> 37 <setting-item name="">
28 <n-input-number v-model:value="optionData.buttonTextSize" /> 38 <n-input-number v-model:value="optionData.buttonTextSize" />
29 </setting-item> 39 </setting-item>
  40 + <setting-item>
  41 + <n-button size="small" @click="optionData.buttonTextSize='16'">
  42 + 恢复默认
  43 + </n-button>
  44 + </setting-item>
30 </setting-item-box> 45 </setting-item-box>
31 <setting-item-box :alone="true"> 46 <setting-item-box :alone="true">
32 <setting-item name="按钮文字" :alone="true"> 47 <setting-item name="按钮文字" :alone="true">
@@ -59,7 +74,7 @@ @@ -59,7 +74,7 @@
59 74
60 <script lang="ts" setup> 75 <script lang="ts" setup>
61 import { PropType, ref, onMounted } from 'vue' 76 import { PropType, ref, onMounted } from 'vue'
62 -import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting' 77 +import { CollapseItem, SettingItemBox ,SettingItem} from '@/components/Pages/ChartItemSetting'
63 import { option } from './config' 78 import { option } from './config'
64 import { icon } from '@/plugins' 79 import { icon } from '@/plugins'
65 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' 80 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
@@ -25,7 +25,7 @@ export const option = { @@ -25,7 +25,7 @@ export const option = {
25 25
26 export default class Config extends PublicConfigClass implements CreateComponentType { 26 export default class Config extends PublicConfigClass implements CreateComponentType {
27 public key = OverrideInputsDateConfig.key 27 public key = OverrideInputsDateConfig.key
28 - public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 } 28 + public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: 99999 }
29 public chartConfig = cloneDeep(OverrideInputsDateConfig) 29 public chartConfig = cloneDeep(OverrideInputsDateConfig)
30 public interactActions = interactActions 30 public interactActions = interactActions
31 public option = cloneDeep(option) 31 public option = cloneDeep(option)
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <collapse-item name="时间配置" :expanded="true"> 7 <collapse-item name="时间配置" :expanded="true">
8 <setting-item-box name="快捷选择"> 8 <setting-item-box name="快捷选择">
9 <setting-item name="日期"> 9 <setting-item name="日期">
10 - <n-select @change="shortCutSelect" v-model:value="optionData.shortcut" size="small" :options="intervalOption" /> 10 + <n-select clearable @change="shortCutSelect" v-model:value="optionData.shortcut" size="small" :options="intervalOption" />
11 </setting-item> 11 </setting-item>
12 </setting-item-box> 12 </setting-item-box>
13 <setting-item-box name="基础"> 13 <setting-item-box name="基础">
@@ -108,6 +108,10 @@ const datePickerTypeOptions = [ @@ -108,6 +108,10 @@ const datePickerTypeOptions = [
108 value: ComponentInteractEventEnum.DATE_RANGE 108 value: ComponentInteractEventEnum.DATE_RANGE
109 }, 109 },
110 { 110 {
  111 + label: '日期时间范围',
  112 + value: ComponentInteractEventEnum.DATE_TIME_RANGE
  113 + },
  114 + {
111 label: '月份', 115 label: '月份',
112 value: ComponentInteractEventEnum.MONTH 116 value: ComponentInteractEventEnum.MONTH
113 }, 117 },
@@ -84,6 +84,7 @@ export const interactActions: InteractActionsType[] = [ @@ -84,6 +84,7 @@ export const interactActions: InteractActionsType[] = [
84 [ComponentInteractEventEnum.DATE]: time, 84 [ComponentInteractEventEnum.DATE]: time,
85 [ComponentInteractEventEnum.DATE_TIME]: time, 85 [ComponentInteractEventEnum.DATE_TIME]: time,
86 [ComponentInteractEventEnum.DATE_RANGE]: timeRange, 86 [ComponentInteractEventEnum.DATE_RANGE]: timeRange,
  87 + [ComponentInteractEventEnum.DATE_TIME_RANGE]: timeRange,
87 [ComponentInteractEventEnum.MONTH]: time, 88 [ComponentInteractEventEnum.MONTH]: time,
88 [ComponentInteractEventEnum.MONTH_RANGE]: timeRange, 89 [ComponentInteractEventEnum.MONTH_RANGE]: timeRange,
89 [ComponentInteractEventEnum.QUARTER]: time, 90 [ComponentInteractEventEnum.QUARTER]: time,
@@ -30,7 +30,7 @@ export const option = { @@ -30,7 +30,7 @@ export const option = {
30 30
31 export default class Config extends PublicConfigClass implements CreateComponentType { 31 export default class Config extends PublicConfigClass implements CreateComponentType {
32 public key = OverrideSelectConfig.key 32 public key = OverrideSelectConfig.key
33 - public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 } 33 + public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: 99999 }
34 public chartConfig = cloneDeep(OverrideSelectConfig) 34 public chartConfig = cloneDeep(OverrideSelectConfig)
35 public interactActions = interactActions 35 public interactActions = interactActions
36 public option = cloneDeep(option) 36 public option = cloneDeep(option)
src/packages/components/external/Informations/Mores/Camera/components/CameraItem.vue renamed from src/packages/components/external/Composes/Mores/Camera/components/CameraItem.vue
src/packages/components/external/Informations/Mores/Camera/components/index.ts renamed from src/packages/components/external/Composes/Mores/Camera/components/index.ts
src/packages/components/external/Informations/Mores/Camera/config.ts renamed from src/packages/components/external/Composes/Mores/Camera/config.ts
src/packages/components/external/Informations/Mores/Camera/config.vue renamed from src/packages/components/external/Composes/Mores/Camera/config.vue
src/packages/components/external/Informations/Mores/Camera/index.ts renamed from src/packages/components/external/Composes/Mores/Camera/index.ts
1 -import { ChartFrameEnum, ConfigType } from '@/packages/index.d'  
2 -import { EPackagesCategoryEnum } from '@/packages/components/external/types'  
3 -import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' 1 +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
  2 +import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Informations/index.d'
4 import { useWidgetKey } from '@/packages/external/useWidgetKey' 3 import { useWidgetKey } from '@/packages/external/useWidgetKey'
5 4
6 -const { key, chartKey, conKey } = useWidgetKey('Camera') 5 +const { key, conKey, chartKey } = useWidgetKey('Camera', true)
  6 +
7 export const CameraConfig: ConfigType = { 7 export const CameraConfig: ConfigType = {
8 key, 8 key,
9 chartKey, 9 chartKey,
@@ -11,7 +11,7 @@ export const CameraConfig: ConfigType = { @@ -11,7 +11,7 @@ export const CameraConfig: ConfigType = {
11 title: '多个摄像头', 11 title: '多个摄像头',
12 category: ChatCategoryEnum.MORE, 12 category: ChatCategoryEnum.MORE,
13 categoryName: ChatCategoryEnumName.MORE, 13 categoryName: ChatCategoryEnumName.MORE,
14 - package: EPackagesCategoryEnum.COMPOSES,  
15 - chartFrame: ChartFrameEnum.NAIVE_UI, 14 + package: PackagesCategoryEnum.INFORMATIONS,
  15 + chartFrame: ChartFrameEnum.NAIVE_UI,
16 image: 'camera.png' 16 image: 'camera.png'
17 } 17 }
src/packages/components/external/Informations/Mores/Camera/index.vue renamed from src/packages/components/external/Composes/Mores/Camera/index.vue
src/packages/components/external/Informations/Mores/Camera/static/left.svg renamed from src/packages/components/external/Composes/Mores/Camera/static/left.svg
src/packages/components/external/Informations/Mores/Camera/static/right.svg renamed from src/packages/components/external/Composes/Mores/Camera/static/right.svg
  1 +import { PublicConfigClass } from '@/packages/public'
  2 +import { CreateComponentType } from '@/packages/index.d'
  3 +import { chartInitConfig } from '@/settings/designSetting'
  4 +import { CustomEchartsConfig } from './index'
  5 +import cloneDeep from 'lodash/cloneDeep'
  6 +
  7 +export const option = {
  8 + //数据源设置 默认设置一个
  9 + dataset: `
  10 + {
  11 + backgroundColor: 'transparent',
  12 + tooltip: {
  13 + trigger: 'none'
  14 + },
  15 + xAxis: {
  16 + data: ["百分比"],
  17 + axisTick: {
  18 + show: false
  19 + },
  20 + axisLine: {
  21 + show: false
  22 + },
  23 + axisLabel: {
  24 + show: false,
  25 + textStyle: {
  26 + color: '#e54035'
  27 + }
  28 + }
  29 + },
  30 + yAxis: {
  31 + splitLine: {
  32 + show: false
  33 + },
  34 + axisTick: {
  35 + show: false
  36 + },
  37 + axisLine: {
  38 + show: false
  39 + },
  40 + axisLabel: {
  41 + show: false
  42 + }
  43 + },
  44 + series: [{
  45 + name: '最上层立体圆',
  46 + type: 'pictorialBar',
  47 + symbolSize: [300, 45],
  48 + symbolOffset: [0, -20],
  49 + z: 12,
  50 + itemStyle: {
  51 + normal: {
  52 + color: '#363F5E'
  53 + }
  54 + },
  55 + data: [{
  56 + value: 100,
  57 + symbolPosition: 'end'
  58 + }]
  59 + }, {
  60 + name: '中间立体圆',
  61 + type: 'pictorialBar',
  62 + symbolSize: [300, 45],
  63 + symbolOffset: [0, -20],
  64 + z: 12,
  65 + itemStyle: {
  66 + normal: {
  67 + color: '#2B5B4D'
  68 + }
  69 + },
  70 + data: [{
  71 + value: 30,
  72 + symbolPosition: 'end'
  73 + }]
  74 + }, {
  75 + name: '最底部立体圆',
  76 + type: 'pictorialBar',
  77 + symbolSize: [300, 45],
  78 + symbolOffset: [0, 20],
  79 + z: 12,
  80 + itemStyle: {
  81 + normal: {
  82 + color: '#01CC04'
  83 + }
  84 + },
  85 + data: [101 - 40]
  86 + }, {
  87 + //底部立体柱
  88 + stack: '1',
  89 + type: 'bar',
  90 + itemStyle: {
  91 + normal: {
  92 + color: '#01CC04',
  93 + opacity: .7
  94 + }
  95 + },
  96 + label: {
  97 + show: true,
  98 + position: "top",
  99 + distance: 15,
  100 + color: "#FFFE00",
  101 + fontSize:50,
  102 + formatter:'{c}'+'%'
  103 + },
  104 +
  105 + silent: true,
  106 + barWidth: 300,
  107 + barGap: '-100%', // Make series be overlap
  108 + data: [30]
  109 + }, {
  110 + //上部立体柱
  111 + stack: '1',
  112 + type: 'bar',
  113 + itemStyle: {
  114 + normal: {
  115 + color: '#36405E',
  116 + opacity: .7
  117 + }
  118 + },
  119 + silent: true,
  120 + barWidth: 300,
  121 + barGap: '-100%', // Make series be overlap
  122 + data: [100 - 30]
  123 + }]
  124 +}
  125 + `
  126 +}
  127 +
  128 +export default class Config extends PublicConfigClass implements CreateComponentType {
  129 + public key = CustomEchartsConfig.key
  130 + public attr = { ...chartInitConfig, w: 1200, h: 800, zIndex: -1 }
  131 + public chartConfig = cloneDeep(CustomEchartsConfig)
  132 + public option = cloneDeep(option)
  133 +}
  1 +<template>
  2 + <collapse-item name="数据源(option配置里的内容)" :expanded="true">
  3 + <monaco-editor v-model:modelValue="optionData.dataset" width="400px" height="480px" language="json" />
  4 + </collapse-item>
  5 +</template>
  6 +
  7 +<script setup lang="ts">
  8 +import { PropType } from 'vue'
  9 +import { option } from './config'
  10 +import { CollapseItem } from '@/components/Pages/ChartItemSetting'
  11 +import { MonacoEditor } from '@/components/Pages/MonacoEditor'
  12 +
  13 +defineProps({
  14 + optionData: {
  15 + type: Object as PropType<typeof option>,
  16 + required: true
  17 + }
  18 +})
  19 +
  20 +
  21 +</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('CustomEcharts', true)
  6 +
  7 +export const CustomEchartsConfig: ConfigType = {
  8 + key,
  9 + chartKey,
  10 + conKey,
  11 + title: '自定义echarts组件',
  12 + category: ChatCategoryEnum.MORE,
  13 + categoryName: ChatCategoryEnumName.MORE,
  14 + package: PackagesCategoryEnum.INFORMATIONS,
  15 + chartFrame: ChartFrameEnum.COMMON,
  16 + image: 'iframe.png'
  17 +}
  1 +<template>
  2 + <v-chart
  3 + ref="vChartRef"
  4 + :init-options="initOptions"
  5 + :theme="themeColor"
  6 + :option="option"
  7 + :manual-update="isPreview()"
  8 + :update-options="{
  9 + replaceMerge: replaceMergeArr
  10 + }"
  11 + autoresize
  12 + ></v-chart>
  13 +</template>
  14 +
  15 +<script setup lang="ts">
  16 +import { ref, computed, PropType, watch } from 'vue'
  17 +import VChart from 'vue-echarts'
  18 +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
  19 +import { use } from 'echarts/core'
  20 +import { CanvasRenderer } from 'echarts/renderers'
  21 +import { BarChart } from 'echarts/charts'
  22 +import config from './config'
  23 +import { mergeTheme } from '@/packages/public/chart'
  24 +import { useChartDataFetch } from '@/hooks'
  25 +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
  26 +import { isPreview } from '@/utils'
  27 +import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
  28 +
  29 +const props = defineProps({
  30 + themeSetting: {
  31 + type: Object,
  32 + required: true
  33 + },
  34 + themeColor: {
  35 + type: Object,
  36 + required: true
  37 + },
  38 + chartConfig: {
  39 + type: Object as PropType<config>,
  40 + required: true
  41 + }
  42 +})
  43 +
  44 +const initOptions = useCanvasInitOptions(eval('(' + props.chartConfig.option.dataset + ')'), props.themeSetting)
  45 +
  46 +use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
  47 +
  48 +const replaceMergeArr = ref<string[]>()
  49 +
  50 +const option = computed(() => {
  51 + return mergeTheme(eval('(' + props.chartConfig.option.dataset + ')'), props.themeSetting, [])
  52 +})
  53 +
  54 +const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
  55 +
  56 +const updateVChart = (dataset: object) => {
  57 + new Promise(resolve => {
  58 + setTimeout(() => {
  59 + resolve(
  60 + vChartRef.value?.setOption(
  61 + {
  62 + ...dataset
  63 + },
  64 + {
  65 + notMerge: true
  66 + }
  67 + )
  68 + )
  69 + }, 100)
  70 + })
  71 +}
  72 +
  73 +watch(
  74 + () => props.chartConfig.option.dataset,
  75 + newValue => {
  76 + try {
  77 + //嵌套字符串使用JSON.parse会报错,这里使用eval函数
  78 + updateVChart(eval('(' + newValue + ')'))
  79 + } catch (e) {
  80 + console.error(
  81 + `文件位置:src\\packages\\components\\external\\InformationsMores\\CustomEcharts\\index.vue`,
  82 + '错误信息:您的json格式有误'
  83 + )
  84 + }
  85 + },
  86 + {
  87 + immediate: true,
  88 + deep: true
  89 + }
  90 +)
  91 +</script>
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/config.ts renamed from src/packages/components/external/Composes/Mores/OverrideILoadConfigurationframe/config.ts
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/config.vue renamed from src/packages/components/external/Composes/Mores/OverrideILoadConfigurationframe/config.vue
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/index.ts renamed from src/packages/components/external/Composes/Mores/OverrideILoadConfigurationframe/index.ts
1 -import { ChartFrameEnum, ConfigType } from '@/packages/index.d'  
2 -import { EPackagesCategoryEnum } from '@/packages/components/external/types'  
3 -import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' 1 +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
  2 +import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Informations/index.d'
4 import { useWidgetKey } from '@/packages/external/useWidgetKey' 3 import { useWidgetKey } from '@/packages/external/useWidgetKey'
5 4
6 -const { key, conKey, chartKey } = useWidgetKey('OverrideILoadConfigurationframe') 5 +const { key, conKey, chartKey } = useWidgetKey('OverrideILoadConfigurationframe', true)
7 6
8 export const OverrideILoadConfigurationframeConfig: ConfigType = { 7 export const OverrideILoadConfigurationframeConfig: ConfigType = {
9 key, 8 key,
@@ -12,7 +11,7 @@ export const OverrideILoadConfigurationframeConfig: ConfigType = { @@ -12,7 +11,7 @@ export const OverrideILoadConfigurationframeConfig: ConfigType = {
12 title: '加载组态', 11 title: '加载组态',
13 category: ChatCategoryEnum.MORE, 12 category: ChatCategoryEnum.MORE,
14 categoryName: ChatCategoryEnumName.MORE, 13 categoryName: ChatCategoryEnumName.MORE,
15 - package: EPackagesCategoryEnum.COMPOSES, 14 + package: PackagesCategoryEnum.INFORMATIONS,
16 chartFrame: ChartFrameEnum.COMMON, 15 chartFrame: ChartFrameEnum.COMMON,
17 image: 'configuration.png' 16 image: 'configuration.png'
18 } 17 }
src/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe/index.vue renamed from src/packages/components/external/Composes/Mores/OverrideILoadConfigurationframe/index.vue
src/packages/components/external/Informations/Mores/SingleCamera/components/VideoPlay.vue renamed from src/packages/components/external/Composes/Mores/SingleCamera/components/VideoPlay.vue
src/packages/components/external/Informations/Mores/SingleCamera/components/index.ts renamed from src/packages/components/external/Composes/Mores/SingleCamera/components/index.ts
src/packages/components/external/Informations/Mores/SingleCamera/config.ts renamed from src/packages/components/external/Composes/Mores/SingleCamera/config.ts
src/packages/components/external/Informations/Mores/SingleCamera/config.vue renamed from src/packages/components/external/Composes/Mores/SingleCamera/config.vue
src/packages/components/external/Informations/Mores/SingleCamera/index.ts renamed from src/packages/components/external/Composes/Mores/SingleCamera/index.ts
1 -import { ChartFrameEnum, ConfigType } from '@/packages/index.d'  
2 -import { EPackagesCategoryEnum } from '@/packages/components/external/types'  
3 -import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' 1 +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
  2 +import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Informations/index.d'
4 import { useWidgetKey } from '@/packages/external/useWidgetKey' 3 import { useWidgetKey } from '@/packages/external/useWidgetKey'
5 4
6 -const { key, chartKey, conKey } = useWidgetKey('SingleCamera') 5 +const { key, conKey, chartKey } = useWidgetKey('SingleCamera', true)
  6 +
7 export const SingleCameraConfig: ConfigType = { 7 export const SingleCameraConfig: ConfigType = {
8 key, 8 key,
9 chartKey, 9 chartKey,
@@ -11,7 +11,7 @@ export const SingleCameraConfig: ConfigType = { @@ -11,7 +11,7 @@ export const SingleCameraConfig: ConfigType = {
11 title: '单个摄像头', 11 title: '单个摄像头',
12 category: ChatCategoryEnum.MORE, 12 category: ChatCategoryEnum.MORE,
13 categoryName: ChatCategoryEnumName.MORE, 13 categoryName: ChatCategoryEnumName.MORE,
14 - package: EPackagesCategoryEnum.COMPOSES,  
15 - chartFrame: ChartFrameEnum.NAIVE_UI, 14 + package: PackagesCategoryEnum.INFORMATIONS,
  15 + chartFrame: ChartFrameEnum.NAIVE_UI,
16 image: 'camera.png' 16 image: 'camera.png'
17 } 17 }
src/packages/components/external/Informations/Mores/SingleCamera/index.vue renamed from src/packages/components/external/Composes/Mores/SingleCamera/index.vue
1 -import { EPackagesCategoryEnum, EPackagesType } from '@/packages/components/external/types'  
2 -import { ComposesList } from '@/packages/components/external/Composes' 1 +// import { EPackagesCategoryEnum, EPackagesType } from '@/packages/components/external/types'
  2 +import { EPackagesType } from '@/packages/components/external/types'
  3 +// import { ComposesList } from '@/packages/components/external/Composes'//此项目扩展侧边栏功能,保留待用
3 import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' 4 import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
4 import { PickIconConfig } from '@/packages/components/external/Decorates/Mores/PickIcon' 5 import { PickIconConfig } from '@/packages/components/external/Decorates/Mores/PickIcon'
5 import { WeatherConfig } from '@/packages/components/external/Decorates/Mores/Weather' 6 import { WeatherConfig } from '@/packages/components/external/Decorates/Mores/Weather'
@@ -37,12 +38,16 @@ import { Decorates07Config } from '@/packages/components/external/Decorates/Deco @@ -37,12 +38,16 @@ import { Decorates07Config } from '@/packages/components/external/Decorates/Deco
37 import { Decorates08Config } from '@/packages/components/external/Decorates/Decorates/Decorates08' 38 import { Decorates08Config } from '@/packages/components/external/Decorates/Decorates/Decorates08'
38 import { Decorates09Config } from '@/packages/components/external/Decorates/Decorates/Decorates09' 39 import { Decorates09Config } from '@/packages/components/external/Decorates/Decorates/Decorates09'
39 import { Decorates10Config } from '@/packages/components/external/Decorates/Decorates/Decorates10' 40 import { Decorates10Config } from '@/packages/components/external/Decorates/Decorates/Decorates10'
  41 +import { CameraConfig } from '@/packages/components/external/Informations/Mores/Camera'
  42 +import { SingleCameraConfig } from '@/packages/components/external/Informations/Mores/SingleCamera'
  43 +import { OverrideILoadConfigurationframeConfig } from '@/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe'
  44 +import { CustomEchartsConfig } from '@/packages/components/external/Informations/Mores/CustomEcharts'
40 45
41 /** 46 /**
42 * 重写动态注入 47 * 重写动态注入
43 */ 48 */
44 export function useInjectLib(packagesList: EPackagesType) { 49 export function useInjectLib(packagesList: EPackagesType) {
45 - packagesList[EPackagesCategoryEnum.COMPOSES] = ComposesList 50 + // packagesList[EPackagesCategoryEnum.COMPOSES] = ComposesList //此项目扩展侧边栏功能,保留待用
46 51
47 //小组件 52 //小组件
48 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, PickIconConfig)//新增小组件图标 53 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, PickIconConfig)//新增小组件图标
@@ -76,6 +81,10 @@ export function useInjectLib(packagesList: EPackagesType) { @@ -76,6 +81,10 @@ export function useInjectLib(packagesList: EPackagesType) {
76 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideTextBarrageConfig)//重写信息下的弹幕文字 81 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideTextBarrageConfig)//重写信息下的弹幕文字
77 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideTextGradientConfig)//重写信息下的渐变文字 82 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideTextGradientConfig)//重写信息下的渐变文字
78 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideVideoConfig)//重写信息下的视频 83 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideVideoConfig)//重写信息下的视频
  84 + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, CameraConfig)//新增信息下的多个摄像头
  85 + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, SingleCameraConfig)//新增信息下的单个摄像头
  86 + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideILoadConfigurationframeConfig)//新增信息下的加载组态
  87 + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, CustomEchartsConfig)//新增信息下的自定义ecahrts组件
79 // 88 //
80 89
81 //图表 90 //图表
@@ -2,9 +2,10 @@ @@ -2,9 +2,10 @@
2 import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d'; 2 import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d';
3 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'; 3 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore';
4 import { NEllipsis, NImage, NSelect, NSpace, NText, SelectOption } from 'naive-ui'; 4 import { NEllipsis, NImage, NSelect, NSpace, NText, SelectOption } from 'naive-ui';
5 -import { computed, h, unref } from 'vue'; 5 +import { h } from 'vue';
6 import { useBackgroundSelect } from '@/utils/external/useBackgroundImageSelect'; 6 import { useBackgroundSelect } from '@/utils/external/useBackgroundImageSelect';
7 7
  8 +const emit = defineEmits(['bgChange'])
8 const chartEditStore = useChartEditStore() 9 const chartEditStore = useChartEditStore()
9 const canvasConfig = chartEditStore.getEditCanvasConfig 10 const canvasConfig = chartEditStore.getEditCanvasConfig
10 11
@@ -17,10 +18,15 @@ const renderOption = (option: SelectOption) => { @@ -17,10 +18,15 @@ const renderOption = (option: SelectOption) => {
17 ]) 18 ])
18 } 19 }
19 20
20 -const handleUpdateValue = (value: string, _option: SelectOption) => { 21 +const handleUpdateValue = (value: string) => {
21 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.BACKGROUND_IMAGE, value) 22 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.BACKGROUND_IMAGE, value)
  23 + emit('bgChange',value)
22 } 24 }
23 25
  26 +const removeBg = ()=> canvasConfig.backgroundImage = null
  27 +defineExpose({
  28 + removeBg
  29 +})
24 </script> 30 </script>
25 31
26 32
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 <n-space vertical :size="12"> 43 <n-space vertical :size="12">
44 <n-space> 44 <n-space>
45 <!-- THINGS_KIT 新增预置背景选择 --> 45 <!-- THINGS_KIT 新增预置背景选择 -->
46 - <SelectBackgroundImage /> 46 + <SelectBackgroundImage ref="selectBackgroundImageRef" @bgChange="handleBgChange" />
47 <n-text>背景颜色</n-text> 47 <n-text>背景颜色</n-text>
48 <div class="picker-height"> 48 <div class="picker-height">
49 <n-color-picker 49 <n-color-picker
@@ -179,21 +179,21 @@ const globalTabList = [ @@ -179,21 +179,21 @@ const globalTabList = [
179 render: ChartThemeColor 179 render: ChartThemeColor
180 } 180 }
181 ] 181 ]
182 - 182 +// THINGS_KIT 优化适配方式默认选中X轴铺满,Y轴自适应滚动
183 const previewTypeList = [ 183 const previewTypeList = [
184 { 184 {
185 - key: PreviewScaleEnum.FIT,  
186 - title: '自适应',  
187 - icon: ScaleIcon,  
188 - desc: '自适应比例展示,页面会有留白'  
189 - },  
190 - {  
191 key: PreviewScaleEnum.SCROLL_Y, 185 key: PreviewScaleEnum.SCROLL_Y,
192 title: 'Y轴滚动', 186 title: 'Y轴滚动',
193 icon: FitToWidthIcon, 187 icon: FitToWidthIcon,
194 desc: 'X轴铺满,Y轴自适应滚动' 188 desc: 'X轴铺满,Y轴自适应滚动'
195 }, 189 },
196 { 190 {
  191 + key: PreviewScaleEnum.FIT,
  192 + title: '自适应',
  193 + icon: ScaleIcon,
  194 + desc: '自适应比例展示,页面会有留白'
  195 + },
  196 + {
197 key: PreviewScaleEnum.SCROLL_X, 197 key: PreviewScaleEnum.SCROLL_X,
198 title: 'X轴滚动', 198 title: 'X轴滚动',
199 icon: FitToHeightIcon, 199 icon: FitToHeightIcon,
@@ -248,10 +248,15 @@ const selectColorValueHandle = (value: number) => { @@ -248,10 +248,15 @@ const selectColorValueHandle = (value: number) => {
248 canvasConfig.selectColor = value == 0 248 canvasConfig.selectColor = value == 0
249 } 249 }
250 250
  251 +// THINGS_KIT 优化清除背景,背景选择下拉框值还存在
  252 +const selectBackgroundImageRef=ref<typeof SelectBackgroundImage|null>()
  253 +
251 // 清除背景 254 // 清除背景
252 const clearImage = () => { 255 const clearImage = () => {
253 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.BACKGROUND_IMAGE, undefined) 256 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.BACKGROUND_IMAGE, undefined)
254 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.SELECT_COLOR, true) 257 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.SELECT_COLOR, true)
  258 + // THINGS_KIT 优化清除背景,背景选择下拉框值还存在
  259 + selectBackgroundImageRef.value?.removeBg()
255 } 260 }
256 261
257 // 启用/关闭 颜色(强制更新) 262 // 启用/关闭 颜色(强制更新)
@@ -291,6 +296,13 @@ const customRequest = (options: UploadCustomRequestOptions) => { @@ -291,6 +296,13 @@ const customRequest = (options: UploadCustomRequestOptions) => {
291 const selectPreviewType = (key: PreviewScaleEnum) => { 296 const selectPreviewType = (key: PreviewScaleEnum) => {
292 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.PREVIEW_SCALE_TYPE, key) 297 chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.PREVIEW_SCALE_TYPE, key)
293 } 298 }
  299 +
  300 +// THINGS_KIT 优化背景图片选择,应用类型自动选择应用背景
  301 +const handleBgChange=(value:string)=>{
  302 + if(!value) return
  303 + selectColorValue.value = 1,selectColorValueHandle(1),chartEditStore.setEditCanvasConfig(EditCanvasConfigEnum.BACKGROUND_IMAGE, value)
  304 +}
  305 +
294 </script> 306 </script>
295 307
296 <style lang="scss" scoped> 308 <style lang="scss" scoped>
@@ -183,9 +183,19 @@ const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => { @@ -183,9 +183,19 @@ const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => {
183 iter: Array<CreateComponentType | CreateComponentGroupType>, 183 iter: Array<CreateComponentType | CreateComponentGroupType>,
184 val: CreateComponentType | CreateComponentGroupType 184 val: CreateComponentType | CreateComponentGroupType
185 ) => { 185 ) => {
186 - if (!val.groupList && val.request.requestDataType === RequestDataTypeEnum.AJAX && val.request.requestUrl) { 186 + /**
  187 + * WARNING 这里升级版本有冲突
  188 + * 不修改这里的话,会造成联动组件绑定不了动态请求或者静态相关的组件
  189 + * 由于只修改一处,所以没必要进行重写,原因是原作者绑定组件(必须是带有动态请求,不支持静态组件),此项目有时需要绑定静态组件看效果,所以不判断必须是动态请求
  190 + * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
  191 + * 源代码 && val.request.requestDataType === RequestDataTypeEnum.AJAX && val.request.requestUrl
  192 + * 修改后的代码 无修改
  193 + * 修改后代码在//之间
  194 + */
  195 + if (!val.groupList ) {
187 iter.push(val) 196 iter.push(val)
188 } 197 }
  198 + //
189 return val.groupList && val.groupList.length > 0 ? [...iter, ...fnFlattern(val.groupList)] : iter 199 return val.groupList && val.groupList.length > 0 ? [...iter, ...fnFlattern(val.groupList)] : iter
190 }, 200 },
191 [] 201 []