Commit 1ad0acbe854f6a97c18e88769bb9c865954caee1

Authored by xp.Huang
2 parents f8996584 bc6835ae

Merge branch 'ft' into 'main_dev'

fix: 修改问题

See merge request yunteng/thingskit-view!83
Showing 22 changed files with 689 additions and 100 deletions
... ... @@ -129,17 +129,24 @@ export const customRequest = async (request: RequestConfigType) => {
129 129
130 130 const body = transformBodyValue(Body, requestParamsBodyType)
131 131
  132 + /**
  133 + * ft 修改post请求针对这种接口(/api/yt/device,设备列表分页),是post请求,body体一定要携带内容,空内容也可以
  134 + * 修改后的代码在注释之间,并标注好源代码和修改后代码,方便回溯
  135 + * 源代码 data: body,
  136 + * 修改后代码 data: !body? {"":null} :body,
  137 + */
132 138 Params = handleParams(Params)
133 139 return customHttp.request<any>({
134 140 url: requestUrl,
135 141 baseURL: getOriginUrl(requestOriginUrl!),
136 142 method: requestHttpType,
137 143 params: Params,
138   - data: body,
  144 + data: !body? {"":null} :body,
139 145 headers: extraValue(Header)
140 146 }, {
141 147 joinPrefix: false,
142 148 apiUrl: '',
143 149 withShareToken: isShareMode()
144 150 })
  151 + //ft
145 152 }
... ...
No preview for this file type

571 KB | W: | H:

3.07 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -7,11 +7,38 @@ import cloneDeep from 'lodash/cloneDeep'
7 7 import dataJson from './data.json'
8 8
9 9 export const includes = ['legend', 'xAxis', 'yAxis', 'grid']
10   -
  10 +export const seriesItem = {
  11 + type: 'line',
  12 + smooth: false,
  13 + symbolSize: 5, //设定实心点的大小
  14 + label: {
  15 + show: true,
  16 + position: 'top',
  17 + color: '#fff',
  18 + fontSize: 12
  19 + },
  20 + lineStyle: {
  21 + width: 3,
  22 + type: 'solid'
  23 + },
  24 + areaStyle: {
  25 + opacity: 0.8,
  26 + color: new graphic.LinearGradient(0, 0, 0, 1, [
  27 + {
  28 + offset: 0,
  29 + color: chartColorsSearch[defaultTheme][3]
  30 + },
  31 + {
  32 + offset: 1,
  33 + color: 'rgba(0,0,0,0)'
  34 + }
  35 + ])
  36 + }
  37 +}
11 38 // 其它配置项比如新增(动画)
12 39 const otherConfig = {
13 40 // 轮播动画
14   - isCarousel: false,
  41 + isCarousel: false
15 42 }
16 43 const option = {
17 44 ...otherConfig,
... ... @@ -31,63 +58,7 @@ const option = {
31 58 type: 'value'
32 59 },
33 60 dataset: { ...dataJson },
34   - series: [
35   - {
36   - type: 'line',
37   - smooth: false,
38   - symbolSize: 5, //设定实心点的大小
39   - label: {
40   - show: true,
41   - position: 'top',
42   - color: '#fff',
43   - fontSize: 12
44   - },
45   - lineStyle: {
46   - width: 3,
47   - type: 'solid'
48   - },
49   - areaStyle: {
50   - opacity: 0.8,
51   - color: new graphic.LinearGradient(0, 0, 0, 1, [
52   - {
53   - offset: 0,
54   - color: chartColorsSearch[defaultTheme][3]
55   - },
56   - {
57   - offset: 1,
58   - color: 'rgba(0,0,0,0)'
59   - }
60   - ])
61   - }
62   - },
63   - {
64   - type: 'line',
65   - smooth: false,
66   - label: {
67   - show: true,
68   - position: 'top',
69   - color: '#fff',
70   - fontSize: 12
71   - },
72   - lineStyle: {
73   - width: 3,
74   - type: 'solid'
75   - },
76   - areaStyle: {
77   - opacity: 0.8,
78   - color: new graphic.LinearGradient(0, 0, 0, 1, [
79   - {
80   - offset: 0,
81   - color: chartColorsSearch[defaultTheme][4]
82   - },
83   - {
84   - offset: 1,
85   - color: 'rgba(0,0,0,0)'
86   - }
87   - ])
88   - }
89   - }
90   - ]
  61 + series: [seriesItem, seriesItem]
91 62 }
92 63
93 64 export default class Config extends PublicConfigClass implements CreateComponentType {
... ...
... ... @@ -3,22 +3,25 @@
3 3 ref="vChartRef"
4 4 :init-options="initOptions"
5 5 :theme="themeColor"
6   - :option="option.value"
  6 + :option="option"
7 7 :manual-update="isPreview()"
8 8 autoresize
  9 + :update-options="{
  10 + replaceMerge: replaceMergeArr
  11 + }"
9 12 @mouseover="handleHighlight"
10 13 @mouseout="handleDownplay"
11 14 ></v-chart>
12 15 </template>
13 16
14 17 <script setup lang="ts">
15   -import { reactive, watch, PropType, onMounted } from 'vue'
  18 +import { reactive, watch, PropType, onMounted, ref, nextTick,computed } from 'vue'
16 19 import VChart from 'vue-echarts'
17 20 import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
18 21 import { use, graphic } from 'echarts/core'
19 22 import { CanvasRenderer } from 'echarts/renderers'
20 23 import { LineChart } from 'echarts/charts'
21   -import config, { includes } from './config'
  24 +import config, { includes, seriesItem } from './config'
22 25 import { mergeTheme } from '@/packages/public/chart'
23 26 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
24 27 import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
... ... @@ -27,6 +30,7 @@ import { useChartDataFetch } from '@/hooks'
27 30 import { isPreview, colorGradientCustomMerge } from '@/utils'
28 31 import dataJson from './data.json'
29 32 import { useFullScreen } from '../../utls/fullScreen'
  33 +import isObject from 'lodash/isObject'
30 34
31 35 const props = defineProps({
32 36 themeSetting: {
... ... @@ -48,8 +52,8 @@ const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSe
48 52 use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
49 53 const chartEditStore = useChartEditStore()
50 54
51   -const option = reactive({
52   - value: {}
  55 +const option = computed(() => {
  56 + return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
53 57 })
54 58 const toolBoxOption = {
55 59 show: true,
... ... @@ -95,7 +99,7 @@ watch(
95 99 ])
96 100 })
97 101 }
98   - option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
  102 + // option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
99 103 props.chartConfig.option = option.value
100 104 } catch (error) {
101 105 console.log(error)
... ... @@ -106,12 +110,12 @@ watch(
106 110 }
107 111 )
108 112
109   -watch(
110   - () => props.chartConfig.option.dataset,
111   - () => {
112   - option.value = props.chartConfig.option
113   - }
114   -)
  113 +// watch(
  114 +// () => props.chartConfig.option.dataset,
  115 +// () => {
  116 +// option.value = props.chartConfig.option
  117 +// }
  118 +// )
115 119 let seriesDataNum = -1
116 120 let seriesDataMaxLength = 0
117 121 let intervalInstance: any = null
... ... @@ -194,7 +198,36 @@ const updateVChart = (newData: any) => {
194 198 })
195 199 }
196 200
197   -const {vChartRef} = useChartDataFetch(props.chartConfig, useChartEditStore, (newData) => {
  201 +const replaceMergeArr = ref<string[]>()
  202 +
  203 +// dataset 无法变更条数的补丁
  204 +watch(
  205 + () => props.chartConfig.option.dataset,
  206 + (newData: { dimensions: any }, oldData) => {
  207 + try {
  208 + // option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
  209 + if (!isObject(newData) || !('dimensions' in newData)) return
  210 + if (Array.isArray(newData?.dimensions)) {
  211 + const seriesArr = []
  212 + for (let i = 0; i < newData.dimensions.length - 1; i++) {
  213 + seriesArr.push(seriesItem)
  214 + }
  215 + replaceMergeArr.value = ['series']
  216 + props.chartConfig.option.series = seriesArr
  217 + nextTick(() => {
  218 + replaceMergeArr.value = []
  219 + })
  220 + }
  221 + } catch (error) {
  222 + console.log(error)
  223 + }
  224 + },
  225 + {
  226 + deep: false
  227 + }
  228 +)
  229 +
  230 +const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, newData => {
198 231 // addPieInterval(newData)
199 232 updateVChart(newData)
200 233 })
... ...
... ... @@ -50,7 +50,11 @@ export const option = {
50 50 // 指标颜色
51 51 indicatorTextColor: '#FFFFFFFF',
52 52 // 偏移角度
53   - offsetDegree: 0
  53 + offsetDegree: 0,
  54 + value:{
  55 + min:0,
  56 + max:1000
  57 + }
54 58 }
55 59
56 60 export default class Config extends PublicConfigClass implements CreateComponentType {
... ...
... ... @@ -10,7 +10,14 @@
10 10 <n-input v-model:value="optionData.unit" size="small"></n-input>
11 11 </setting-item>
12 12 </SettingItemBox>
13   -
  13 + <SettingItemBox name="范围">
  14 + <SettingItem name="最小值">
  15 + <n-input-number :min="0" v-model:value="optionData.value.min" size="small"></n-input-number>
  16 + </SettingItem>
  17 + <setting-item name="最大值">
  18 + <n-input-number v-model:value="optionData.value.max" size="small"></n-input-number>
  19 + </setting-item>
  20 + </SettingItemBox>
14 21 <SettingItemBox name="轨道">
15 22 <SettingItem name="形状">
16 23 <n-select v-model:value="optionData.type" :options="types" placeholder="选择形状" />
... ... @@ -41,7 +48,7 @@
41 48 <SettingItem name="文本颜色">
42 49 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.indicatorTextColor"></n-color-picker>
43 50 </SettingItem>
44   - <setting-item name="文本大小">
  51 + <setting-item name="文本大小">
45 52 <n-input-number v-model:value="optionData.indicatorTextSize" size="small"></n-input-number>
46 53 </setting-item>
47 54 </SettingItemBox>
... ... @@ -49,17 +56,26 @@
49 56 </template>
50 57
51 58 <script setup lang="ts">
52   -import { PropType } from 'vue'
  59 +import { PropType, watch, ref } from 'vue'
53 60 // 以下是封装的设置模块布局组件,具体效果可在官网查看
54 61 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
55 62
56 63 // 获取 option 的数据,便于使用 typeof 获取类型
57 64 import { option, types, indicatorPlacements } from './config'
58 65
59   -defineProps({
  66 +const props = defineProps({
60 67 optionData: {
61 68 type: Object as PropType<typeof option>,
62 69 required: true
63 70 }
64 71 })
  72 +
  73 +watch(
  74 + () => props.optionData.dataset,
  75 + (newData: number) => {
  76 + if (newData < props.optionData.value.min || newData > props.optionData.value.max) {
  77 + window['$message'].error('取值范围在最小值和最大值之间')
  78 + }
  79 + }
  80 +)
65 81 </script>
... ...
  1 +import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
  2 +import { CreateComponentType } from '@/packages/index.d'
  3 +import { OverrideWaterPoloConfig } from './index'
  4 +import cloneDeep from 'lodash/cloneDeep'
  5 +
  6 +export const shapes = [
  7 + {
  8 + label: '圆形',
  9 + value: 'circle'
  10 + },
  11 + {
  12 + label: '正方形',
  13 + value: 'rect'
  14 + },
  15 + {
  16 + label: '带圆角的正方形',
  17 + value: 'roundRect'
  18 + },
  19 + {
  20 + label: '正三角形',
  21 + value: 'triangle'
  22 + },
  23 + {
  24 + label: '菱形',
  25 + value: 'diamond'
  26 + },
  27 + {
  28 + label: '水滴',
  29 + value: 'pin'
  30 + },
  31 + {
  32 + label: '箭头',
  33 + value: 'arrow'
  34 + },
  35 +]
  36 +
  37 +export const includes = []
  38 +
  39 +export const option = {
  40 + dataset: 0.5,
  41 + series: [
  42 + {
  43 + type: 'liquidFill',
  44 + shape: shapes[0].value,
  45 + radius: '90%',
  46 + data: [0],
  47 + center: ['50%', '50%'],
  48 + color: [
  49 + {
  50 + type: 'linear',
  51 + x: 0,
  52 + y: 0,
  53 + x2: 0,
  54 + y2: 1,
  55 + colorStops: [
  56 + {
  57 + offset: 0,
  58 + color: '#446bf5',
  59 + },
  60 + {
  61 + offset: 1,
  62 + color: '#2ca3e2',
  63 + },
  64 + ],
  65 + globalCoord: false,
  66 + },
  67 + ],
  68 + backgroundStyle: {
  69 + borderWidth: 1,
  70 + color: 'rgba(51, 66, 127, 0.7)',
  71 + },
  72 + label: {
  73 + normal: {
  74 + textStyle: {
  75 + fontSize: 50,
  76 + color: '#fff',
  77 + },
  78 + },
  79 + },
  80 + outline: {
  81 + show: false,
  82 + borderDistance: 10,
  83 + itemStyle: {
  84 + borderWidth: 2,
  85 + borderColor: '#112165'
  86 + }
  87 + }
  88 + }
  89 + ]
  90 +}
  91 +
  92 +export default class Config extends PublicConfigClass implements CreateComponentType
  93 +{
  94 + public key = OverrideWaterPoloConfig.key
  95 + public chartConfig = cloneDeep(OverrideWaterPoloConfig)
  96 + public option = echartOptionProfixHandle(option, includes)
  97 +}
... ...
  1 +<template>
  2 + <CollapseItem
  3 + v-for="(item, index) in seriesList"
  4 + :key="index"
  5 + name="水球"
  6 + :expanded="true"
  7 + >
  8 + <SettingItemBox name="内容">
  9 + <SettingItem name="数值">
  10 + <n-input-number
  11 + v-model:value="optionData.dataset"
  12 + :min="0"
  13 + :step="0.01"
  14 + size="small"
  15 + placeholder="水球数值"
  16 + ></n-input-number>
  17 + </SettingItem>
  18 + <SettingItem name="形状">
  19 + <n-select v-model:value="item.shape" :options="shapes" placeholder="选择形状" />
  20 + </SettingItem>
  21 + <SettingItem name="文本">
  22 + <n-input-number v-model:value="item.label.normal.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="文字大小">
  23 + </n-input-number>
  24 + </SettingItem>
  25 + <SettingItem name="颜色1">
  26 + <n-color-picker
  27 + size="small"
  28 + :modes="['hex']"
  29 + v-model:value="item.color[0].colorStops[0].color"
  30 + ></n-color-picker>
  31 + </SettingItem>
  32 + <SettingItem name="颜色2">
  33 + <n-color-picker
  34 + size="small"
  35 + :modes="['hex']"
  36 + v-model:value="item.color[0].colorStops[1].color"
  37 + ></n-color-picker>
  38 + </SettingItem>
  39 + </SettingItemBox>
  40 + <SettingItemBox name="背景" :alone="true">
  41 + <SettingItem>
  42 + <n-color-picker
  43 + size="small"
  44 + :modes="['hex']"
  45 + v-model:value="item.backgroundStyle.color"
  46 + ></n-color-picker>
  47 + </SettingItem>
  48 + </SettingItemBox>
  49 + </CollapseItem>
  50 +</template>
  51 +
  52 +<script setup lang="ts">
  53 +import { PropType, computed } from 'vue'
  54 +import { option, shapes } from './config'
  55 +import {
  56 + CollapseItem,
  57 + SettingItemBox,
  58 + SettingItem,
  59 +} from '@/components/Pages/ChartItemSetting'
  60 +
  61 +const props = defineProps({
  62 + optionData: {
  63 + type: Object as PropType<typeof option>,
  64 + required: true,
  65 + },
  66 +})
  67 +
  68 +const seriesList = computed(() => {
  69 + return props.optionData.series
  70 +})
  71 +</script>
... ...
  1 +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
  2 +import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Charts/index.d'
  3 +import { useWidgetKey } from '@/packages/external/useWidgetKey'
  4 +
  5 +const { key, conKey, chartKey } = useWidgetKey('OverrideWaterPolo', true)
  6 +
  7 +export const OverrideWaterPoloConfig: ConfigType = {
  8 + key,
  9 + chartKey,
  10 + conKey,
  11 + title: '自定义水球图',
  12 + category: ChatCategoryEnum.MORE,
  13 + categoryName: ChatCategoryEnumName.MORE,
  14 + package: PackagesCategoryEnum.CHARTS,
  15 + chartFrame: ChartFrameEnum.COMMON,
  16 + image: 'water_WaterPolo.png'
  17 +}
... ...
  1 +<template>
  2 + <v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize></v-chart>
  3 +</template>
  4 +
  5 +<script setup lang="ts">
  6 +import { PropType, watch, reactive } from 'vue'
  7 +import VChart from 'vue-echarts'
  8 +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
  9 +import { use } from 'echarts/core'
  10 +import 'echarts-liquidfill/src/liquidFill.js'
  11 +import { CanvasRenderer } from 'echarts/renderers'
  12 +import { GridComponent } from 'echarts/components'
  13 +import config from './config'
  14 +import { isPreview, isString, isNumber, colorGradientCustomMerge } from '@/utils'
  15 +import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
  16 +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
  17 +import { useChartDataFetch } from '@/hooks'
  18 +
  19 +const props = defineProps({
  20 + themeSetting: {
  21 + type: Object,
  22 + required: true
  23 + },
  24 + themeColor: {
  25 + type: Object,
  26 + required: true
  27 + },
  28 + chartConfig: {
  29 + type: Object as PropType<config>,
  30 + required: true
  31 + }
  32 +})
  33 +
  34 +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
  35 +
  36 +use([CanvasRenderer, GridComponent])
  37 +
  38 +const chartEditStore = useChartEditStore()
  39 +
  40 +const option = reactive({
  41 + value: {}
  42 +})
  43 +
  44 +// 渐变色处理
  45 +watch(
  46 + () => chartEditStore.getEditCanvasConfig.chartThemeColor,
  47 + (newColor: keyof typeof chartColorsSearch) => {
  48 + try {
  49 + if (!isPreview()) {
  50 + const themeColor =
  51 + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[newColor] ||
  52 + colorGradientCustomMerge(chartEditStore.getEditCanvasConfig.chartCustomThemeColorInfo)[defaultTheme]
  53 + // 背景颜色
  54 + props.chartConfig.option.series[0].backgroundStyle.color = themeColor[2]
  55 + // 水球颜色
  56 + props.chartConfig.option.series[0].color[0].colorStops = [
  57 + {
  58 + offset: 0,
  59 + color: themeColor[0]
  60 + },
  61 + {
  62 + offset: 1,
  63 + color: themeColor[1]
  64 + }
  65 + ]
  66 + }
  67 + option.value = props.chartConfig.option
  68 + } catch (error) {
  69 + console.log(error)
  70 + }
  71 + },
  72 + {
  73 + immediate: true
  74 + }
  75 +)
  76 +
  77 +// 数据处理
  78 +const dataHandle = (newData: number | string) => {
  79 + newData = isString(newData) ? parseFloat(newData) : newData
  80 + return parseFloat(newData.toFixed(2))
  81 +}
  82 +
  83 +// 编辑
  84 +watch(
  85 + () => props.chartConfig.option.dataset,
  86 + newData => {
  87 + if (!isString(newData) && !isNumber(newData)) return
  88 + props.chartConfig.option.series[0].data = [dataHandle(newData)]
  89 + option.value = props.chartConfig.option
  90 + },
  91 + {
  92 + immediate: true,
  93 + deep: false
  94 + }
  95 +)
  96 +
  97 +// 预览
  98 +useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
  99 + // @ts-ignore
  100 + option.value.series[0].data = [dataHandle(newData)]
  101 +})
  102 +</script>
... ...
... ... @@ -6,7 +6,7 @@ import { chartInitConfig } from '@/settings/designSetting'
6 6
7 7 export const option = {
8 8 //vue3dLoader支持数组或字符串,暂且绑定字符串,这个插件可以加载多个模型
9   - dataset: '',
  9 + dataset: 'src/assets/external/three/踏月桥.stl',
10 10 backgroundColor: '', //场景背景色
11 11 backgroundAlpha: 0, //场景透明度
12 12 enableDamping: false, //是否启用阻尼
... ...
... ... @@ -2,10 +2,30 @@ import { PublicConfigClass } from '@/packages/public'
2 2 import { CreateComponentType } from '@/packages/index.d'
3 3 import { OverrideCarouselConfig } from './index'
4 4 import cloneDeep from 'lodash/cloneDeep'
  5 +import logo from '@/assets/logo.png'
5 6
6 7 export const option = {
7 8 // 图片资源列表
8   - dataset: [],
  9 + dataset: [
  10 + {
  11 + id: -Math.random() + '',
  12 + name: '图片1',
  13 + status: 'finished',
  14 + url: logo
  15 + },
  16 + {
  17 + id: -Math.random() + '',
  18 + name: '图片2',
  19 + status: 'finished',
  20 + url: logo
  21 + },
  22 + {
  23 + id: -Math.random() + '',
  24 + name: '图片3',
  25 + status: 'finished',
  26 + url: logo
  27 + }
  28 + ],
9 29 // 自动播放
10 30 autoplay: true,
11 31 // 自动播放的间隔(ms)
... ...
... ... @@ -94,7 +94,7 @@ const fileList = ref<UploadFileInfo[]>([])
94 94 watch(
95 95 () => props.optionData,
96 96 newValue => {
97   - fileList.value = newValue?.dataset
  97 + fileList.value = newValue?.dataset as UploadFileInfo[]
98 98 },
99 99 {
100 100 immediate: true
... ...
1 1 <template>
2   - <div class="iframe-content" :style="getStyle(borderRadius)">
  2 + <div
  3 + @mouseenter="handleMouseenter"
  4 + @mouseleave="handleMouseleave"
  5 + class="iframe-content"
  6 + :style="getStyle(borderRadius)"
  7 + >
3 8 <div v-show="isShowSvg" @click="handleFullScreen" id="fullscreenButton">
4 9 <svg
5 10 focusable="false"
... ... @@ -16,16 +21,7 @@
16 21 ></path>
17 22 </svg>
18 23 </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>
  24 + <iframe id="iframeContent" :src="option.dataset" :width="w" :height="h" style="border-width: 0"></iframe>
29 25 </div>
30 26 </template>
31 27
... ...
... ... @@ -5,6 +5,7 @@ import cloneDeep from 'lodash/cloneDeep'
5 5 import video from '@/assets/videos/earth.mp4'
6 6
7 7 export const option = {
  8 + text:'视频.mp4',
8 9 // 视频路径
9 10 dataset: video,
10 11 // 循环播放
... ...
... ... @@ -2,7 +2,12 @@
2 2 <!-- eslint-disable vue/no-mutating-props -->
3 3 <template>
4 4 <collapse-item name="视频" expanded>
5   - <setting-item-box name="源" alone>
  5 + <setting-item-box name="名字" alone>
  6 + <setting-item>
  7 + <n-input disabled v-model:value="optionData.text" size="small"></n-input>
  8 + </setting-item>
  9 + </setting-item-box>
  10 + <setting-item-box name="上传" alone>
6 11 <FileUpload
7 12 :fileSizeConst="fileSizeConst"
8 13 :max="1"
... ... @@ -71,6 +76,7 @@ const props = defineProps({
71 76 })
72 77
73 78 const handleFileStaticUri = (value: UploadFileInfo[]) => {
  79 + props.optionData.text=value[0]?.name as string
74 80 props.optionData.dataset = value[0]?.url as string
75 81 }
76 82 </script>
... ...
... ... @@ -21,6 +21,7 @@ import { OverridePieCircleConfig } from '@/packages/components/external/Charts/P
21 21 import { OverrideMapBaseConfig } from '@/packages/components/external/Charts/Maps/OverrideMapBase'
22 22 import { OverrideILoadConfigurationframeConfig } from '@/packages/components/external/Informations/Mores/OverrideILoadConfigurationframe'
23 23 import { OverrideVideoConfig } from '@/packages/components/external/Informations/Mores/OverrideVideo'
  24 +import { OverrideWaterPoloConfig } from '@/packages/components/external/Charts/Mores/OverrideWaterPolo'
24 25
25 26 export function useInjectLib(packagesList: EPackagesType) {
26 27 packagesList[EPackagesCategoryEnum.COMPOSES] = ComposesList
... ... @@ -43,8 +44,13 @@ export function useInjectLib(packagesList: EPackagesType) {
43 44 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideProcessConfig)
44 45 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverridePieCircleConfig)
45 46 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideMapBaseConfig)
46   - addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideILoadConfigurationframeConfig)
  47 + addWidgetToCategoryByCategoryName(
  48 + packagesList,
  49 + PackagesCategoryEnum.INFORMATIONS,
  50 + OverrideILoadConfigurationframeConfig
  51 + )
47 52 addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.INFORMATIONS, OverrideVideoConfig)
  53 + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideWaterPoloConfig)
48 54 }
49 55
50 56 /**
... ...
  1 +/**
  2 + * 需要隐藏的组件配置
  3 + * 加重写的都是覆盖原组件的
  4 + * 没加重写的是原来就有的
  5 + */
  6 +
  7 +export const hideAsideComponentsObj = {
  8 + Bars: [
  9 + 'VBarCommon' //柱状图
  10 + ],
  11 + Lines: [
  12 + 'VLineCommon', //折线图
  13 + 'VLineGradients', //双折线渐变面积图
  14 + // 'ExternalVCOverrideLineGradients' //重写双折线渐变面积图
  15 + ],
  16 + Pies: [
  17 + 'VPieCircle' //饼图-环形
  18 + ],
  19 + Maps: [
  20 + 'VMapBase' //地图(可选省份)
  21 + ],
  22 + Mores: [
  23 + 'VProcess', //NaiveUI-进度
  24 + 'VImage', //图片
  25 + 'VImageCarousel', //轮播图
  26 + 'VVideo', //视频
  27 + 'VIframe', //远程网页
  28 + 'VWaterPolo' //水球图
  29 + ],
  30 + Texts: [
  31 + 'VTextGradient', //渐变文字
  32 + 'VTextBarrage', //弹幕文字
  33 + 'VTextCommon' //文字
  34 + ],
  35 + all: [
  36 + 'VBarCommon', //柱状图
  37 + 'VLineCommon', //折线图
  38 + 'VLineLinearSingle', //单折线渐变图
  39 + 'VLineGradientSingle', //单折线渐变面积图
  40 + 'VLineGradients', //双折线渐变面积图
  41 + // 'ExternalVCOverrideLineGradients', //重写双折线渐变面积图
  42 + 'VPieCircle', //饼图-环形
  43 + 'VMapBase', //地图(可选省份)
  44 + 'VProcess', //NaiveUI-进度
  45 + 'VTextGradient', //渐变文字
  46 + 'VTextBarrage', //弹幕文字
  47 + 'VTextCommon', //文字
  48 + 'VVideo', //视频
  49 + 'VIframe', //远程网页
  50 + // 'VImage', //图片
  51 + 'VImageCarousel', //轮播图
  52 + 'VWaterPolo' //水球图
  53 + ]
  54 +}
... ...
  1 +import ChartsOptionContent from './index.vue'
  2 +
  3 +export { ChartsOptionContent }
... ...
  1 +<template>
  2 + <!-- 侧边栏和数据分发处理 -->
  3 + <div class="go-chart-common">
  4 + <n-menu
  5 + v-show="hidePackageOneCategory"
  6 + class="chart-menu-width"
  7 + v-model:value="selectValue"
  8 + :options="packages.menuOptions"
  9 + :icon-size="16"
  10 + :indent="18"
  11 + @update:value="clickItemHandle"
  12 + ></n-menu>
  13 + <div class="chart-content-list">
  14 + <n-scrollbar trigger="none">
  15 + <charts-item-box :menuOptions="packages.selectOptions" @deletePhoto="deleteHandle"></charts-item-box>
  16 + </n-scrollbar>
  17 + </div>
  18 + </div>
  19 +</template>
  20 +<script setup lang="ts">
  21 +import { ref, watch, computed, reactive } from 'vue'
  22 +import { ConfigType } from '@/packages/index.d'
  23 +import { useSettingStore } from '@/store/modules/settingStore/settingStore'
  24 +import { loadAsyncComponent } from '@/utils'
  25 +import { usePackagesStore } from '@/store/modules/packagesStore/packagesStore'
  26 +import { PackagesCategoryEnum } from '@/packages/index.d'
  27 +import { hideAsideComponentsObj } from './config'
  28 +import { remove } from 'lodash'
  29 +
  30 +const ChartsItemBox = loadAsyncComponent(() => import('../../../components/ChartsItemBox/index.vue'))
  31 +const packagesStore = usePackagesStore()
  32 +
  33 +const props = defineProps({
  34 + selectOptions: {
  35 + type: Object,
  36 + default: () => {}
  37 + }
  38 +})
  39 +
  40 +// 隐藏设置
  41 +const settingStore = useSettingStore()
  42 +
  43 +const hidePackageOneCategory = computed(() => {
  44 + if (packages.categorysNum > 2) return true
  45 + return !settingStore.getHidePackageOneCategory
  46 +})
  47 +
  48 +let packages = reactive<{
  49 + [T: string]: any
  50 +}>({
  51 + // 侧边栏
  52 + menuOptions: [],
  53 + // 当前选择
  54 + selectOptions: {},
  55 + // 分类归档
  56 + categorys: {
  57 + all: []
  58 + },
  59 + categoryNames: {
  60 + all: '所有'
  61 + },
  62 + // 分类归档数量
  63 + categorysNum: 0,
  64 + // 存储不同类别组件进来的选中值
  65 + saveSelectOptions: {}
  66 +})
  67 +
  68 +const selectValue = ref<string>('all')
  69 +
  70 +// 设置初始列表
  71 +const setSelectOptions = (categorys: any) => {
  72 + for (const val in categorys) {
  73 + packages.selectOptions = categorys[val]
  74 + break
  75 + }
  76 +}
  77 +
  78 +// THINGS_KIT修改左侧边栏隐藏部分组件(比如重写的,有问题的等需要隐藏)
  79 +const byKeyhideAside = (hideAsideComponentsObj: Record<string, string[]>, categorys: Record<string, any>) => {
  80 + for (const key in categorys) {
  81 + const categoryKey = key
  82 + const categoryValue = categorys[key]
  83 + for (const hideKey in hideAsideComponentsObj) {
  84 + const needHideKey = hideKey
  85 + const needCategoryValue = hideAsideComponentsObj[key]
  86 + if (categoryKey === needHideKey) {
  87 + remove(categoryValue, item => {
  88 + const { chartKey } = item as any
  89 + return needCategoryValue.includes(chartKey)
  90 + })
  91 + }
  92 + }
  93 + }
  94 + return categorys
  95 +}
  96 +
  97 +watch(
  98 + // @ts-ignore
  99 + () => props.selectOptions,
  100 + (newData: { list: ConfigType[] }) => {
  101 + packages.categorysNum = 0
  102 + if (!newData) return
  103 + newData.list.forEach((e: ConfigType) => {
  104 + const value: ConfigType[] = (packages.categorys as any)[e.category]
  105 + packages.categorys[e.category] = value && value.length ? [...value, e] : [e]
  106 + packages.categoryNames[e.category] = e.categoryName
  107 + packages.categorys['all'].push(e)
  108 + })
  109 + for (const val in packages.categorys) {
  110 + packages.categorysNum += 1
  111 + packages.menuOptions.push({
  112 + key: val,
  113 + label: packages.categoryNames[val]
  114 + })
  115 + }
  116 + setSelectOptions(packages.categorys)
  117 + byKeyhideAside(hideAsideComponentsObj, packages.categorys)
  118 + console.log(packages.categorys)
  119 + // 默认选中处理
  120 + selectValue.value = packages.menuOptions[0]['key']
  121 + },
  122 + {
  123 + immediate: true
  124 + }
  125 +)
  126 +
  127 +watch(
  128 + () => packagesStore.newPhoto,
  129 + newPhoto => {
  130 + if (!newPhoto) return
  131 + const newPhotoCategory = newPhoto.category
  132 + packages.categorys[newPhotoCategory].splice(1, 0, newPhoto)
  133 + packages.categorys['all'].splice(1, 0, newPhoto)
  134 + }
  135 +)
  136 +
  137 +// 删除图片
  138 +const deleteHandle = (item: ConfigType, index: number) => {
  139 + packages.categorys[item.category].splice(index, 1)
  140 + packages.categorys['all'].splice(index, 1)
  141 +}
  142 +
  143 +// 处理点击事件
  144 +const clickItemHandle = (key: string) => {
  145 + packages.selectOptions = packages.categorys[key]
  146 +}
  147 +</script>
  148 +
  149 +<style lang="scss" scoped>
  150 +/* 此高度与 ContentBox 组件关联*/
  151 +$topHeight: 40px;
  152 +$menuWidth: 65px;
  153 +@include go('chart-common') {
  154 + display: flex;
  155 + height: calc(100vh - #{$--header-height} - #{$topHeight});
  156 + .chart-menu-width {
  157 + width: $menuWidth;
  158 + flex-shrink: 0;
  159 + @include fetch-bg-color('background-color2-shallow');
  160 + }
  161 + .chart-content-list {
  162 + width: 200px;
  163 + flex: 1;
  164 + display: flex;
  165 + flex-direction: column;
  166 + align-items: center;
  167 + }
  168 + @include deep() {
  169 + .n-menu-item {
  170 + height: 30px;
  171 + &.n-menu-item--selected {
  172 + &::before {
  173 + background-color: rgba(0, 0, 0, 0);
  174 + }
  175 + }
  176 + .n-menu-item-content {
  177 + text-align: center;
  178 + padding: 0px 14px !important;
  179 + font-size: 12px !important;
  180 + }
  181 + }
  182 + }
  183 +}
  184 +</style>
... ...
1 1 <template>
2 2 <!-- 左侧所有组件的展示列表 -->
3   - <content-box class="go-content-charts" :class="{ scoped: !getCharts }" title="组件" :depth="1" :backIcon="false">
  3 + <content-box class="go-content-charts" :class="{ scoped: !getCharts }" title="组件" :depth="1" :backIcon="false">
4 4 <template #icon>
5 5 <n-icon size="14" :depth="2">
6 6 <bar-chart-icon></bar-chart-icon>
... ... @@ -22,7 +22,7 @@
22 22 @update:value="clickItemHandle"
23 23 ></n-menu>
24 24 <div class="menu-component-box">
25   - <go-skeleton :load="!selectOptions" round text :repeat="2" style="width: 90%"></go-skeleton>
  25 + <go-skeleton :load="!selectOptions" round text :repeat="2" style="width: 90%"></go-skeleton>
26 26 <charts-option-content
27 27 v-if="selectOptions"
28 28 :selectOptions="selectOptions"
... ... @@ -36,11 +36,12 @@
36 36
37 37 <script setup lang="ts">
38 38 import { ContentBox } from '../ContentBox/index'
39   -import { ChartsOptionContent } from './components/ChartsOptionContent'
  39 +// THINGS_KIT 重写ChartsOptionContent组件路径
  40 +import { ChartsOptionContent } from './external/components/ChartsOptionContent'
40 41 import { ChartsSearch } from './components/ChartsSearch'
41   -import { useAsideHook } from './hooks/useAside.hook'
42   -
43   -const { getCharts, BarChartIcon, themeColor, selectOptions, selectValue, clickItemHandle, menuOptions } = useAsideHook()
  42 +import { useAsideHook } from './hooks/useAside.hook'
  43 +
  44 +const { getCharts, BarChartIcon, themeColor, selectOptions, selectValue, clickItemHandle, menuOptions } = useAsideHook()
44 45 </script>
45 46
46 47 <style lang="scss" scoped>
... ...