fix: 合并1.0.9

This commit is contained in:
奔跑的面条 2022-09-12 00:31:52 +08:00
commit 0d26dce512
104 changed files with 60168 additions and 470 deletions

View File

@ -9,16 +9,17 @@ module.exports = {
sourceType: 'module', sourceType: 'module',
ecmaFeatures: { ecmaFeatures: {
jsx: true, jsx: true,
tsx: true, tsx: true
}, }
}, },
env: { env: {
node: true, node: true,
// The Follow config only works with eslint-plugin-vue v8.0.0+
'vue/setup-compiler-macros': true
}, },
extends: ["plugin:vue/vue3-essential", "eslint:recommended"], extends: ['plugin:vue/vue3-essential', 'eslint:recommended'],
rules: { rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off", 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}, }
}; }

View File

@ -4,12 +4,14 @@ import { RequestHttpEnum } from '@/enums/httpEnum'
// 单个X数据 // 单个X数据
export const chartDataUrl = '/mock/chartData' export const chartDataUrl = '/mock/chartData'
export const chartSingleDataUrl = '/mock/chartSingleData'
export const numberFloatUrl = '/mock/number/float' export const numberFloatUrl = '/mock/number/float'
export const numberIntUrl = '/mock/number/int' export const numberIntUrl = '/mock/number/int'
export const textUrl = '/mock/text' export const textUrl = '/mock/text'
export const imageUrl = '/mock/image' export const imageUrl = '/mock/image'
export const rankListUrl = '/mock/rankList' export const rankListUrl = '/mock/rankList'
export const scrollBoardUrl = '/mock/scrollBoard' export const scrollBoardUrl = '/mock/scrollBoard'
export const radarUrl = '/mock/radarData'
const mockObject: MockMethod[] = [ const mockObject: MockMethod[] = [
{ {
@ -19,6 +21,11 @@ const mockObject: MockMethod[] = [
method: RequestHttpEnum.GET, method: RequestHttpEnum.GET,
response: () => test.fetchMockData response: () => test.fetchMockData
}, },
{
url: chartSingleDataUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchMockSingleData
},
{ {
url: numberFloatUrl, url: numberFloatUrl,
method: RequestHttpEnum.GET, method: RequestHttpEnum.GET,
@ -48,7 +55,12 @@ const mockObject: MockMethod[] = [
url: scrollBoardUrl, url: scrollBoardUrl,
method: RequestHttpEnum.GET, method: RequestHttpEnum.GET,
response: () => test.fetchScrollBoard response: () => test.fetchScrollBoard
} },
{
url: radarUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchRadar
},
] ]
export default mockObject export default mockObject

View File

@ -1,4 +1,39 @@
export default { export default {
// 单图表
fetchMockSingleData: {
code: 0,
status: 200,
msg: '请求成功',
data: {
dimensions: ['product', 'dataOne'],
source: [
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
}
]
}
},
// 图表 // 图表
fetchMockData: { fetchMockData: {
code: 0, code: 0,
@ -79,29 +114,72 @@ export default {
['行10列1', '行10列2', '行10列3'] ['行10列1', '行10列2', '行10列3']
] ]
}, },
// 获取数字 // 获取数字-浮点型
fetchNumberFloat: { fetchNumberFloat: {
code: 0, code: 0,
status: 200, status: 200,
msg: '请求成功', msg: '请求成功',
data: '@float(0, 0.99, 1, 4)' data: '@float(0, 0.99, 1, 4)'
}, },
// 获取数字-整型
fetchNumberInt: { fetchNumberInt: {
code: 0, code: 0,
status: 200, status: 200,
msg: '请求成功', msg: '请求成功',
data: '@integer(0, 100)' data: '@integer(0, 100)'
}, },
// 文字
fetchText: { fetchText: {
code: 0, code: 0,
status: 200, status: 200,
msg: '请求成功', msg: '请求成功',
data: '@paragraph(1, 10)' data: '@paragraph(1, 10)'
}, },
// 图片
fetchImage: (num: number) => ({ fetchImage: (num: number) => ({
code: 0, code: 0,
status: 200, status: 200,
msg: '请求成功', msg: '请求成功',
data: `https://robohash.org/${num}` data: `https://robohash.org/${num}`
}) }),
// 雷达
fetchRadar: {
code: 0,
status: 200,
msg: '请求成功',
data: {
radarIndicator: [
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 }
],
seriesData: [
{
value: [
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)'
],
name: 'data1'
},
{
value: [
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)'
],
name: 'data2'
}
]
}
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -37,7 +37,9 @@ const props = defineProps({
hidden: { hidden: {
request: false, request: false,
type: Array, type: Array,
default: [] default() {
return []
}
}, },
// 使 // 使
narrow: { narrow: {
@ -76,7 +78,7 @@ const btnList: {
icon: RemoveIcon icon: RemoveIcon
}, },
{ {
title: isFull ? '缩小' : '放大', title: isFull.value ? '缩小' : '放大',
key: props.narrow ? 'fullResize' : 'resize', key: props.narrow ? 'fullResize' : 'resize',
icon: ResizeIcon icon: ResizeIcon
} }

View File

@ -62,16 +62,15 @@ export const useChartDataFetch = (
if (res && res.data) { if (res && res.data) {
try { try {
const filter = targetComponent.filter const filter = targetComponent.filter
// 更新回调函数
if (updateCallback) {
updateCallback(newFunctionHandle(res.data, filter))
} else {
// eCharts 组件配合 vChart 库更新方式 // eCharts 组件配合 vChart 库更新方式
if (chartFrame === ChartFrameEnum.ECHARTS) { if (chartFrame === ChartFrameEnum.ECHARTS) {
if (vChartRef.value) { if (vChartRef.value) {
vChartRef.value.setOption({ dataset: newFunctionHandle(res.data, filter) }) vChartRef.value.setOption({ dataset: newFunctionHandle(res.data, filter) })
} }
} }
// 更新回调函数
if (updateCallback) {
updateCallback(newFunctionHandle(res.data, filter))
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { BarCommonConfig } from './index' import { BarCommonConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -6,6 +6,15 @@ import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis'] export const includes = ['legend', 'xAxis', 'yAxis']
export const seriesItem = {
type: 'bar',
barWidth: null,
itemStyle: {
color: null,
borderRadius: 0
}
}
export const option = { export const option = {
tooltip: { tooltip: {
show: true, show: true,
@ -27,27 +36,10 @@ export const option = {
type: 'value' type: 'value'
}, },
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [ series: [seriesItem, seriesItem]
{
type: 'bar',
barWidth: null,
itemStyle: {
color: null,
borderRadius: 0
}
},
{
type: 'bar',
barWidth: null,
itemStyle: {
color: null,
borderRadius: 0
}
}
]
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = BarCommonConfig.key public key = BarCommonConfig.key
public chartConfig = cloneDeep(BarCommonConfig) public chartConfig = cloneDeep(BarCommonConfig)
// 图表配置项 // 图表配置项

View File

@ -1,25 +1,29 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart
ref="vChartRef"
:theme="themeColor"
:option="option"
:manual-update="isPreview()"
:update-options="{
replaceMerge: replaceMergeArr
}"
autoresize
></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType } from 'vue' import { ref, nextTick, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts' import { BarChart } from 'echarts/charts'
import { includes } from './config' import config, { includes, seriesItem } from './config'
import { mergeTheme } from '@/packages/public/chart' import { mergeTheme } from '@/packages/public/chart'
import { useChartDataFetch } from '@/hooks' import { useChartDataFetch } from '@/hooks'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils' import { isPreview } from '@/utils'
import { import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
DatasetComponent,
GridComponent,
TooltipComponent,
LegendComponent
} from 'echarts/components'
const props = defineProps({ const props = defineProps({
themeSetting: { themeSetting: {
@ -31,23 +35,39 @@ const props = defineProps({
required: true required: true
}, },
chartConfig: { chartConfig: {
type: Object as PropType<CreateComponentType>, type: Object as PropType<config>,
required: true required: true
} }
}) })
use([ use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
DatasetComponent,
CanvasRenderer, const replaceMergeArr = ref<string[]>()
BarChart,
GridComponent,
TooltipComponent,
LegendComponent
])
const option = computed(() => { const option = computed(() => {
return mergeTheme(props.chartConfig.option, props.themeSetting, includes) return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
}) })
// dataset
watch(
() => props.chartConfig.option.dataset,
(newData, oldData) => {
if (newData.dimensions.length !== oldData.dimensions.length) {
const seriesArr = []
for (let i = 0; i < newData.dimensions.length - 1; i++) {
seriesArr.push(seriesItem)
}
replaceMergeArr.value = ['series']
props.chartConfig.option.series = seriesArr
nextTick(() => {
replaceMergeArr.value = []
})
}
},
{
deep: false
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore) const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script> </script>

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { BarCrossrangeConfig } from './index' import { BarCrossrangeConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -6,50 +6,40 @@ import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis'] export const includes = ['legend', 'xAxis', 'yAxis']
export const seriesItem = {
type: 'bar',
barWidth: null,
itemStyle: {
color: null,
borderRadius: 0
}
}
export const option = { export const option = {
tooltip: { tooltip: {
show: true, show: true,
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
show: true, show: true,
type: 'shadow', type: 'shadow'
}, }
}, },
legend: { legend: {
show: true, show: true
}, },
xAxis: { xAxis: {
show: true, show: true,
type: 'value', type: 'value',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
}, },
yAxis: { yAxis: {
show: true, show: true,
type: 'category', type: 'category'
}, },
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [ series: [seriesItem, seriesItem]
{
type: 'bar',
barWidth: null,
itemStyle: {
color: null,
borderRadius: 0,
},
},
{
type: 'bar',
barWidth: null,
itemStyle: {
color: null,
borderRadius: 0,
},
},
],
} }
export default class Config extends publicConfig export default class Config extends PublicConfigClass implements CreateComponentType {
implements CreateComponentType {
public key = BarCrossrangeConfig.key public key = BarCrossrangeConfig.key
public chartConfig = cloneDeep(BarCrossrangeConfig) public chartConfig = cloneDeep(BarCrossrangeConfig)
// 图表配置项 // 图表配置项

View File

@ -1,24 +1,28 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart
ref="vChartRef"
:theme="themeColor"
:option="option"
:manual-update="isPreview()"
:update-options="{
replaceMerge: replaceMergeArr
}"
autoresize
></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType } from 'vue' import { ref, nextTick, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts' import { BarChart } from 'echarts/charts'
import { mergeTheme } from '@/packages/public/chart' import { mergeTheme } from '@/packages/public/chart'
import config, { includes } from './config' import config, { includes, seriesItem } from './config'
import { useChartDataFetch } from '@/hooks' import { useChartDataFetch } from '@/hooks'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils' import { isPreview } from '@/utils'
import { import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
DatasetComponent,
GridComponent,
TooltipComponent,
LegendComponent,
} from 'echarts/components'
const props = defineProps({ const props = defineProps({
themeSetting: { themeSetting: {
@ -35,18 +39,34 @@ const props = defineProps({
} }
}) })
use([ use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
DatasetComponent,
CanvasRenderer, const replaceMergeArr = ref<string[]>()
BarChart,
GridComponent,
TooltipComponent,
LegendComponent,
])
const option = computed(() => { const option = computed(() => {
return mergeTheme(props.chartConfig.option, props.themeSetting, includes) return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
}) })
// dataset
watch(
() => props.chartConfig.option.dataset,
(newData, oldData) => {
if (newData?.dimensions.length !== oldData?.dimensions.length) {
const seriesArr = []
for (let i = 0; i < newData.dimensions.length - 1; i++) {
seriesArr.push(seriesItem)
}
replaceMergeArr.value = ['series']
props.chartConfig.option.series = seriesArr
nextTick(() => {
replaceMergeArr.value = []
})
}
},
{
deep: false
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore) const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script> </script>

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { LineCommonConfig } from './index' import { LineCommonConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index' import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
@ -6,6 +6,18 @@ import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis'] export const includes = ['legend', 'xAxis', 'yAxis']
export const seriesItem = {
type: 'line',
lineStyle: {
type: 'solid',
width: 3,
itemStyle: {
color: null,
borderRadius: 0
}
}
}
export const option = { export const option = {
tooltip: { tooltip: {
show: true, show: true,
@ -19,43 +31,17 @@ export const option = {
}, },
xAxis: { xAxis: {
show: true, show: true,
type: 'category', type: 'category'
}, },
yAxis: { yAxis: {
show: true, show: true,
type: 'value' type: 'value'
}, },
dataset: { ...dataJson }, dataset: { ...dataJson },
series: [ series: [seriesItem, seriesItem]
{
type: 'line',
lineStyle: {
type: 'solid',
width: 3,
color: {
type: 'linear',
colorStops: [
{
offset: 0,
color: chartColorsSearch[defaultTheme][0] // 0% 处的颜色
},
{
offset: 1,
color: chartColorsSearch[defaultTheme][1] // 100% 处的颜色
}
],
globalCoord: false // 缺省为 false
},
shadowColor: chartColorsSearch[defaultTheme][2],
shadowBlur: 10,
shadowOffsetY: 20
},
}
]
} }
export default class Config extends publicConfig export default class Config extends PublicConfigClass implements CreateComponentType {
implements CreateComponentType {
public key: string = LineCommonConfig.key public key: string = LineCommonConfig.key
public chartConfig = LineCommonConfig public chartConfig = LineCommonConfig
// 图表配置项 // 图表配置项

View File

@ -6,20 +6,6 @@
:expanded="true" :expanded="true"
> >
<SettingItemBox name="线条"> <SettingItemBox name="线条">
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="item.lineStyle.color.colorStops[0].color"
></n-color-picker>
</SettingItem>
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="item.lineStyle.color.colorStops[1].color"
></n-color-picker>
</SettingItem>
<SettingItem name="宽度"> <SettingItem name="宽度">
<n-input-number <n-input-number
v-model:value="item.lineStyle.width" v-model:value="item.lineStyle.width"
@ -37,26 +23,6 @@
></n-select> ></n-select>
</SettingItem> </SettingItem>
</SettingItemBox> </SettingItemBox>
<SettingItemBox name="阴影" :alone="true">
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="item.lineStyle.shadowColor"
></n-color-picker>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="设置">
<SettingItem name="阴影">
<n-button
size="small"
@click="item.lineStyle.shadowColor = 'rgba(0, 0, 0, 0)'"
>
去除阴影
</n-button>
</SettingItem>
</SettingItemBox>
</CollapseItem> </CollapseItem>
<!-- Echarts 全局设置 --> <!-- Echarts 全局设置 -->
<global-setting :optionData="optionData" :in-chart="true"></global-setting> <global-setting :optionData="optionData" :in-chart="true"></global-setting>

View File

@ -1,33 +1,40 @@
{ {
"dimensions": ["product", "data1"], "dimensions": ["product", "data1", "data2"],
"source": [ "source": [
{ {
"product": "Mon", "product": "Mon",
"data1": 120 "data1": 120,
"data2": 130
}, },
{ {
"product": "Tue", "product": "Tue",
"data1": 200 "data1": 200,
"data2": 130
}, },
{ {
"product": "Wed", "product": "Wed",
"data1": 150 "data1": 150,
"data2": 312
}, },
{ {
"product": "Thu", "product": "Thu",
"data1": 80 "data1": 80,
"data2": 268
}, },
{ {
"product": "Fri", "product": "Fri",
"data1": 70 "data1": 70,
"data2": 155
}, },
{ {
"product": "Sat", "product": "Sat",
"data1": 110 "data1": 110,
"data2": 117
}, },
{ {
"product": "Sun", "product": "Sun",
"data1": 130 "data1": 130,
"data2": 160
} }
] ]
} }

View File

@ -2,25 +2,28 @@
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:theme="themeColor" :theme="themeColor"
:option="option.value" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
autoresize> :update-options="{
replaceMerge: replaceMergeArr
}"
autoresize
>
</v-chart> </v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, watch, reactive } from 'vue'; import { PropType, computed, watch, ref, nextTick } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts' import { LineChart } from 'echarts/charts'
import config, { includes } from './config' import config, { includes, seriesItem } from './config'
import { mergeTheme } from '@/packages/public/chart' import { mergeTheme } from '@/packages/public/chart'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
import { useChartDataFetch } from '@/hooks' import { useChartDataFetch } from '@/hooks'
import { isPreview } from '@/utils' import { isPreview } from '@/utils'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
const props = defineProps({ const props = defineProps({
themeSetting: { themeSetting: {
@ -37,41 +40,34 @@ const props = defineProps({
} }
}) })
use([ use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
DatasetComponent,
CanvasRenderer,
LineChart,
GridComponent,
TooltipComponent,
LegendComponent
])
const chartEditStore = useChartEditStore() const replaceMergeArr = ref<string[]>()
const option = reactive({
value: {} const option = computed(() => {
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
}) })
// // dataset
watch(() => chartEditStore.getEditCanvasConfig.chartThemeColor, (newColor: keyof typeof chartColorsSearch) => { watch(
if (!isPreview()) { () => props.chartConfig.option.dataset,
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] (newData, oldData) => {
props.chartConfig.option.series.forEach((value: any) => { if (newData?.dimensions.length !== oldData?.dimensions.length) {
value.lineStyle.shadowColor = themeColor[2] const seriesArr = []
value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => { for (let i = 0; i < newData.dimensions.length - 1; i++) {
v.color = themeColor[i] seriesArr.push(seriesItem)
}) }
replaceMergeArr.value = ['series']
props.chartConfig.option.series = seriesArr
nextTick(() => {
replaceMergeArr.value = []
}) })
} }
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes) },
props.chartConfig.option = option.value {
}, { deep: false
immediate: true, }
}) )
watch(() => props.chartConfig.option.dataset, () => {
option.value = props.chartConfig.option
})
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore) const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script> </script>

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { LineGradientSingleConfig } from './index' import { LineGradientSingleConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { graphic } from 'echarts/core' import { graphic } from 'echarts/core'
@ -20,7 +20,7 @@ const options = {
}, },
xAxis: { xAxis: {
show: true, show: true,
type: 'category', type: 'category'
}, },
yAxis: { yAxis: {
show: true, show: true,
@ -52,8 +52,7 @@ const options = {
] ]
} }
export default class Config extends publicConfig export default class Config extends PublicConfigClass implements CreateComponentType {
implements CreateComponentType {
public key: string = LineGradientSingleConfig.key public key: string = LineGradientSingleConfig.key
public chartConfig = LineGradientSingleConfig public chartConfig = LineGradientSingleConfig
// 图表配置项 // 图表配置项

View File

@ -6,7 +6,7 @@ export const LineGradientSingleConfig: ConfigType = {
key: 'LineGradientSingle', key: 'LineGradientSingle',
chartKey: 'VLineGradientSingle', chartKey: 'VLineGradientSingle',
conKey: 'VCLineGradientSingle', conKey: 'VCLineGradientSingle',
title: '单折线面积图', title: '单折线渐变面积图',
category: ChatCategoryEnum.LINE, category: ChatCategoryEnum.LINE,
categoryName: ChatCategoryEnumName.LINE, categoryName: ChatCategoryEnumName.LINE,
package: PackagesCategoryEnum.CHARTS, package: PackagesCategoryEnum.CHARTS,

View File

@ -1,10 +1,5 @@
<template> <template>
<v-chart <v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
ref="vChartRef"
:theme="themeColor"
:option="option.value"
:manual-update="isPreview()"
autoresize>
</v-chart> </v-chart>
</template> </template>
@ -37,14 +32,7 @@ const props = defineProps({
} }
}) })
use([ use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
DatasetComponent,
CanvasRenderer,
LineChart,
GridComponent,
TooltipComponent,
LegendComponent,
])
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()
const option = reactive({ const option = reactive({
@ -52,7 +40,9 @@ const option = reactive({
}) })
// //
watch(() => chartEditStore.getEditCanvasConfig.chartThemeColor, (newColor: keyof typeof chartColorsSearch) => { watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
if (!isPreview()) { if (!isPreview()) {
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
props.chartConfig.option.series.forEach((value: any, index: number) => { props.chartConfig.option.series.forEach((value: any, index: number) => {
@ -70,14 +60,21 @@ watch(() => chartEditStore.getEditCanvasConfig.chartThemeColor, (newColor: keyof
} }
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes) option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
props.chartConfig.option = option.value props.chartConfig.option = option.value
}, { },
{
immediate: true immediate: true
}) }
)
watch(
watch(() => props.chartConfig.option.dataset, () => { () => props.chartConfig.option.dataset,
() => {
option.value = props.chartConfig.option option.value = props.chartConfig.option
}) },
{
deep: false
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore) const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script> </script>

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { LineGradientsConfig } from './index' import { LineGradientsConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { graphic } from 'echarts/core' import { graphic } from 'echarts/core'
@ -20,7 +20,7 @@ const option = {
}, },
xAxis: { xAxis: {
show: true, show: true,
type: 'category', type: 'category'
}, },
yAxis: { yAxis: {
show: true, show: true,
@ -33,7 +33,7 @@ const option = {
smooth: false, smooth: false,
lineStyle: { lineStyle: {
width: 3, width: 3,
type: 'solid', type: 'solid'
}, },
areaStyle: { areaStyle: {
opacity: 0.8, opacity: 0.8,
@ -47,7 +47,7 @@ const option = {
color: 'rgba(0,0,0,0)' color: 'rgba(0,0,0,0)'
} }
]) ])
}, }
}, },
{ {
type: 'line', type: 'line',
@ -69,13 +69,12 @@ const option = {
color: 'rgba(0,0,0,0)' color: 'rgba(0,0,0,0)'
} }
]) ])
}, }
} }
] ]
} }
export default class Config extends publicConfig export default class Config extends PublicConfigClass implements CreateComponentType {
implements CreateComponentType {
public key: string = LineGradientsConfig.key public key: string = LineGradientsConfig.key
public chartConfig = LineGradientsConfig public chartConfig = LineGradientsConfig
// 图表配置项 // 图表配置项

View File

@ -6,7 +6,7 @@ export const LineGradientsConfig: ConfigType = {
key: 'LineGradients', key: 'LineGradients',
chartKey: 'VLineGradients', chartKey: 'VLineGradients',
conKey: 'VCLineGradients', conKey: 'VCLineGradients',
title: '双折线面积图', title: '双折线渐变面积图',
category: ChatCategoryEnum.LINE, category: ChatCategoryEnum.LINE,
categoryName: ChatCategoryEnumName.LINE, categoryName: ChatCategoryEnumName.LINE,
package: PackagesCategoryEnum.CHARTS, package: PackagesCategoryEnum.CHARTS,

View File

@ -31,14 +31,7 @@ const props = defineProps({
} }
}) })
use([ use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
DatasetComponent,
CanvasRenderer,
LineChart,
GridComponent,
TooltipComponent,
LegendComponent,
])
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()
const option = reactive({ const option = reactive({
@ -46,7 +39,9 @@ const option = reactive({
}) })
// //
watch(() => chartEditStore.getEditCanvasConfig.chartThemeColor, (newColor: keyof typeof chartColorsSearch) => { watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
if (!isPreview()) { if (!isPreview()) {
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme] const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
props.chartConfig.option.series.forEach((value: any, index: number) => { props.chartConfig.option.series.forEach((value: any, index: number) => {
@ -64,13 +59,18 @@ watch(() => chartEditStore.getEditCanvasConfig.chartThemeColor, (newColor: keyof
} }
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes) option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
props.chartConfig.option = option.value props.chartConfig.option = option.value
}, { },
{
immediate: true immediate: true
}) }
)
watch(() => props.chartConfig.option.dataset, () => { watch(
() => props.chartConfig.option.dataset,
() => {
option.value = props.chartConfig.option option.value = props.chartConfig.option
}) }
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore) const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script> </script>

View File

@ -0,0 +1,62 @@
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { LineLinearSingleConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import { defaultTheme, chartColorsSearch } from '@/settings/chartThemes/index'
import dataJson from './data.json'
export const includes = ['legend', 'xAxis', 'yAxis']
export const option = {
tooltip: {
show: true,
trigger: 'axis',
axisPointer: {
type: 'line'
}
},
legend: {
show: true
},
xAxis: {
show: true,
type: 'category'
},
yAxis: {
show: true,
type: 'value'
},
dataset: { ...dataJson },
series: [
{
type: 'line',
lineStyle: {
type: 'solid',
width: 3,
color: {
type: 'linear',
colorStops: [
{
offset: 0,
color: chartColorsSearch[defaultTheme][0] // 0% 处的颜色
},
{
offset: 1,
color: chartColorsSearch[defaultTheme][1] // 100% 处的颜色
}
],
globalCoord: false // 缺省为 false
},
shadowColor: chartColorsSearch[defaultTheme][2],
shadowBlur: 10,
shadowOffsetY: 20
}
}
]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = LineLinearSingleConfig.key
public chartConfig = LineLinearSingleConfig
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}

View File

@ -0,0 +1,86 @@
<template>
<CollapseItem
v-for="(item, index) in seriesList"
:key="index"
:name="`样式`"
:expanded="true"
>
<SettingItemBox name="线条">
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="item.lineStyle.color.colorStops[0].color"
></n-color-picker>
</SettingItem>
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="item.lineStyle.color.colorStops[1].color"
></n-color-picker>
</SettingItem>
<SettingItem name="宽度">
<n-input-number
v-model:value="item.lineStyle.width"
:min="1"
:max="100"
size="small"
placeholder="自动计算"
></n-input-number>
</SettingItem>
<SettingItem name="类型">
<n-select
v-model:value="item.lineStyle.type"
size="small"
:options="lineConf.lineStyle.type"
></n-select>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="阴影" :alone="true">
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="item.lineStyle.shadowColor"
></n-color-picker>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="设置">
<SettingItem name="阴影">
<n-button
size="small"
@click="item.lineStyle.shadowColor = 'rgba(0, 0, 0, 0)'"
>
去除阴影
</n-button>
</SettingItem>
</SettingItemBox>
</CollapseItem>
<!-- Echarts 全局设置 -->
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { lineConf } from '@/packages/chartConfiguration/echarts/index'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import {
GlobalSetting,
CollapseItem,
SettingItemBox,
SettingItem
} from '@/components/Pages/ChartItemSetting'
const props = defineProps({
optionData: {
type: Object as PropType<GlobalThemeJsonType>,
required: true
}
})
const seriesList = computed(() => {
return props.optionData.series
})
</script>

View File

@ -0,0 +1,33 @@
{
"dimensions": ["product", "data1"],
"source": [
{
"product": "Mon",
"data1": 120
},
{
"product": "Tue",
"data1": 200
},
{
"product": "Wed",
"data1": 150
},
{
"product": "Thu",
"data1": 80
},
{
"product": "Fri",
"data1": 70
},
{
"product": "Sat",
"data1": 110
},
{
"product": "Sun",
"data1": 130
}
]
}

View File

@ -0,0 +1,15 @@
import image from '@/assets/images/chart/charts/line_linear_single.png'
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const LineLinearSingleConfig: ConfigType = {
key: 'LineLinearSingle',
chartKey: 'VLineLinearSingle',
conKey: 'VCLineLinearSingle',
title: '单折线渐变图',
category: ChatCategoryEnum.LINE,
categoryName: ChatCategoryEnumName.LINE,
package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.ECHARTS,
image
}

View File

@ -0,0 +1,74 @@
<template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
</v-chart>
</template>
<script setup lang="ts">
import { PropType, watch, reactive } from 'vue'
import VChart from 'vue-echarts'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts'
import config, { includes } from './config'
import { mergeTheme } from '@/packages/public/chart'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
import { useChartDataFetch } from '@/hooks'
import { isPreview } from '@/utils'
const props = defineProps({
themeSetting: {
type: Object,
required: true
},
themeColor: {
type: Object,
required: true
},
chartConfig: {
type: Object as PropType<config>,
required: true
}
})
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
const chartEditStore = useChartEditStore()
const option = reactive({
value: {}
})
//
watch(
() => chartEditStore.getEditCanvasConfig.chartThemeColor,
(newColor: keyof typeof chartColorsSearch) => {
if (!isPreview()) {
const themeColor = chartColorsSearch[newColor] || chartColorsSearch[defaultTheme]
props.chartConfig.option.series.forEach((value: any) => {
value.lineStyle.shadowColor = themeColor[2]
value.lineStyle.color.colorStops.forEach((v: { color: string }, i: number) => {
v.color = themeColor[i]
})
})
}
option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
props.chartConfig.option = option.value
},
{
immediate: true
}
)
watch(
() => props.chartConfig.option.dataset,
() => {
option.value = props.chartConfig.option
},
{
deep: false
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script>

View File

@ -1,5 +1,6 @@
import { LineCommonConfig } from './LineCommon/index' import { LineCommonConfig } from './LineCommon/index'
import { LineLinearSingleConfig } from './LineLinearSingle/index'
import { LineGradientSingleConfig } from './LineGradientSingle/index' import { LineGradientSingleConfig } from './LineGradientSingle/index'
import { LineGradientsConfig } from './LineGradients/index' import { LineGradientsConfig } from './LineGradients/index'
export default [LineCommonConfig, LineGradientSingleConfig, LineGradientsConfig] export default [LineCommonConfig, LineLinearSingleConfig, LineGradientSingleConfig, LineGradientsConfig]

View File

@ -0,0 +1,68 @@
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { MapChinaConfig } from './index'
import { chartInitConfig } from '@/settings/designSetting'
import { CreateComponentType } from '@/packages/index.d'
import dataJson from './data.json'
export const includes = []
export const option = {
dataset: dataJson,
tooltip: {
show: true,
trigger: 'item'
},
geo: {
show: false,
type: 'map',
roam: false,
map: 'china'
},
series: [
{
type: 'effectScatter',
coordinateSystem: 'geo',
symbolSize: 6,
zlevel: 1,
label: {
show: false
},
itemStyle: {
shadowBlur: 10,
color: '#00ECC8'
},
data: []
},
{
name: '地图',
type: 'map',
map: 'china',
zoom: 1, //缩放
itemStyle: {
// 背景色
areaColor: 'rgba(117, 236, 170, 0.3)',
emphasis: {
areaColor: 'rgba(117, 236, 170, .8)',
borderWidth: 1,
shadowBlur: 10,
shadowColor: '#75ecaa'
},
color: '#ffffff',
borderColor: '#75ecaa',
borderWidth: 1,
showHainanIsLands: true // 是否显示南海群岛
},
label: {
show: true,
color: '#ffffff'
},
data: []
}
]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = MapChinaConfig.key
public attr = { ...chartInitConfig, w: 750, h: 800, zIndex: -1 }
public chartConfig = MapChinaConfig
public option = echartOptionProfixHandle(option, includes)
}

View File

@ -0,0 +1,82 @@
<template>
<!-- Echarts 全局设置 -->
<div>
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
<CollapseItem name="地图" :expanded="true">
<SettingItemBox name="省份" :alone="true">
<SettingItem name="背景颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="seriesList[1].itemStyle.areaColor"
></n-color-picker>
</SettingItem>
<SettingItem name="聚焦颜色(预览可见)">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="seriesList[1].itemStyle.emphasis.areaColor"
></n-color-picker>
</SettingItem>
<SettingItem name="聚焦阴影(预览可见)">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="seriesList[1].itemStyle.emphasis.shadowColor"
></n-color-picker>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="边框">
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="seriesList[1].itemStyle.borderColor"
></n-color-picker>
</SettingItem>
<SettingItem name="大小">
<n-input-number
v-model:value="seriesList[1].itemStyle.borderWidth"
:min="1"
size="small"
placeholder="请输入边框大小"
></n-input-number>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="其他">
<SettingItem>
<n-checkbox v-model:checked="seriesList[1].itemStyle.showHainanIsLands" size="small">显示南海群岛</n-checkbox>
</SettingItem>
</SettingItemBox>
</CollapseItem>
<CollapseItem name="标记" :expanded="true">
<SettingItemBox name="样式">
<SettingItem name="大小">
<n-input-number v-model:value="seriesList[0].symbolSize" size="small" :min="0"></n-input-number>
</SettingItem>
<SettingItem name="颜色">
<n-color-picker size="small" :modes="['hex']" v-model:value="seriesList[0].itemStyle.color"></n-color-picker>
</SettingItem>
</SettingItemBox>
</CollapseItem>
</div>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { lineConf } from '@/packages/chartConfiguration/echarts/index'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { GlobalSetting } from '@/components/Pages/ChartItemSetting'
const props = defineProps({
optionData: {
type: Object as PropType<GlobalThemeJsonType>,
required: true
}
})
const seriesList = computed(() => {
return props.optionData.series
})
</script>

View File

@ -0,0 +1,146 @@
{
"point": [
{
"name": "北京",
"value": [116.2, 39.56, 1000]
}
],
"map": [
{
"name": "北京市",
"value": 100
},
{
"name": "天津市",
"value": 99
},
{
"name": "河北省",
"value": 98
},
{
"name": "山西省",
"value": 97
},
{
"name": "内蒙古自治区",
"value": 96
},
{
"name": "辽宁省",
"value": 95
},
{
"name": "吉林省",
"value": 94
},
{
"name": "黑龙江省",
"value": 93
},
{
"name": "上海市",
"value": 92
},
{
"name": "江苏省",
"value": 91
},
{
"name": "浙江省",
"value": 90
},
{
"name": "安徽省",
"value": 89
},
{
"name": "福建省",
"value": 88
},
{
"name": "江西省",
"value": 87
},
{
"name": "山东省",
"value": 86
},
{
"name": "河南省",
"value": 85
},
{
"name": "湖北省",
"value": 84
},
{
"name": "湖南省",
"value": 83
},
{
"name": "广东省",
"value": 82
},
{
"name": "广西壮族自治区",
"value": 81
},
{
"name": "海南省",
"value": 80
},
{
"name": "重庆市",
"value": 79
},
{
"name": "四川省",
"value": 78
},
{
"name": "贵州省",
"value": 77
},
{
"name": "云南省",
"value": 76
},
{
"name": "西藏自治区",
"value": 75
},
{
"name": "陕西省",
"value": 74
},
{
"name": "甘肃省",
"value": 73
},
{
"name": "青海省",
"value": 72
},
{
"name": "宁夏回族自治区",
"value": 71
},
{
"name": "新疆维吾尔自治区",
"value": 70
},
{
"name": "台湾省",
"value": 69
},
{
"name": "香港特别行政区",
"value": 68
},
{
"name": "澳门特别行政区",
"value": 67
}
]
}

View File

@ -1,14 +1,15 @@
import image from '@/assets/images/chart/charts/map.png' import image from '@/assets/images/chart/charts/map.png'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const MapChineConfig: ConfigType = { export const MapChinaConfig: ConfigType = {
key: 'MapChine', key: 'MapChina',
chartKey: 'VMapChine', chartKey: 'VMapChina',
conKey: 'VCMapChine', conKey: 'VCMapChina',
title: '北京地图', title: '地图',
category: ChatCategoryEnum.MAP, category: ChatCategoryEnum.MAP,
categoryName: ChatCategoryEnumName.MAP, categoryName: ChatCategoryEnumName.MAP,
package: PackagesCategoryEnum.CHARTS, package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.COMMON,
image image
} }

View File

@ -0,0 +1,94 @@
<template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
</v-chart>
</template>
<script setup lang="ts">
import { PropType, reactive, watch } from 'vue'
import config, { includes } from './config'
import VChart from 'vue-echarts'
import { use, registerMap } from 'echarts/core'
import { EffectScatterChart, MapChart } from 'echarts/charts'
import { CanvasRenderer } from 'echarts/renderers'
import { useChartDataFetch } from '@/hooks'
import { mergeTheme } from '@/packages/public/chart'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils'
import mapJson from './map.json'
import mapJsonWithoutHainanIsLands from './mapWithoutHainanIsLands.json'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, GeoComponent } from 'echarts/components'
const props = defineProps({
themeSetting: {
type: Object,
required: true
},
themeColor: {
type: Object,
required: true
},
chartConfig: {
type: Object as PropType<config>,
required: true
}
})
use([
MapChart,
DatasetComponent,
CanvasRenderer,
GridComponent,
TooltipComponent,
LegendComponent,
GeoComponent,
EffectScatterChart
])
registerMap('china', { geoJSON: mapJson as any, specialAreas: {} })
const option = reactive({
value: mergeTheme(props.chartConfig.option, props.themeSetting, includes)
})
const dataSetHandle = (dataset: any) => {
props.chartConfig.option.series.forEach((item: any) => {
if (item.type === 'effectScatter' && dataset.point) item.data = dataset.point
else if (item.type === 'map' && dataset.point) item.data = dataset.map
option.value = props.chartConfig.option
})
}
const mapTypeHandle = (show: boolean) => {
show
? registerMap('china', { geoJSON: mapJson as any, specialAreas: {} })
: registerMap('china', { geoJSON: mapJsonWithoutHainanIsLands as any, specialAreas: {} })
option.value = props.chartConfig.option
}
watch(
() => props.chartConfig.option.series[1].itemStyle.showHainanIsLands,
newData => {
mapTypeHandle(newData)
},
{
deep: true,
immediate: true
}
)
watch(
() => props.chartConfig.option.dataset,
newData => {
dataSetHandle(newData)
},
{
immediate: true,
deep: false
}
)
//
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
dataSetHandle(newData)
})
</script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
<template>
</template>
<script setup lang="ts">
</script>

View File

@ -1,13 +0,0 @@
<template>
<div>
line组件渲染
</div>
</template>
<script setup lang="ts">
</script>
<style lang="scss" scoped>
</style>

View File

@ -1,3 +1,3 @@
import { MapChineConfig } from './MapChine/index' import { MapChinaConfig } from './MapChina/index'
export default [MapChineConfig] export default [MapChinaConfig]

View File

@ -0,0 +1,62 @@
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { FunnelConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend']
// 排序枚举
export const FunnelOrderEnumList = [
{ label: '倒三角', value: 'descending' },
{ label: '正三角', value: 'ascending' }
]
// 标签位置枚举
export const FunnelLabelPositionEnumList = [
{ label: '内部', value: 'inside' },
{ label: '外部', value: 'outside' },
{ label: '内部左侧', value: 'insideLeft' },
{ label: '内部右侧', value: 'insideRight' }
]
export const option = {
tooltip: {},
legend: {},
dataset: { ...dataJson },
series: [
{
name: 'Funnel',
type: 'funnel',
top: 70,
left: '10%',
width: '80%',
min: 0,
minSize: '0%',
maxSize: '100%',
sort: 'descending', // descending | ascending
gap: 5,
label: {
show: true,
position: 'inside',
fontSize: 12
},
itemStyle: {
borderColor: '#fff',
borderWidth: 0
},
emphasis: {
label: {
fontSize: 20
}
}
}
]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = FunnelConfig.key
public chartConfig = cloneDeep(FunnelConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}

View File

@ -1,6 +1,67 @@
<template> <template>
<!-- Echarts 全局设置 -->
<global-setting :optionData="optionData" :in-chart="true"> </global-setting>
<!-- 漏斗图 -->
<collapse-item v-for="(item, index) in seriesList" :key="index" :name="`漏斗图`" expanded>
<setting-item-box name="排序" alone>
<setting-item>
<n-select v-model:value="item.sort" :options="FunnelOrderEnumList" size="small" />
</setting-item>
</setting-item-box>
<SettingItemBox name="范围" :alone="true">
<setting-item :name="`顶部距离:${item.top}px`">
<n-slider v-model:value="item.top" :min="0" :max="300" :format-tooltip="sliderFormatTooltip"></n-slider>
</setting-item>
</SettingItemBox>
<setting-item-box name="区块">
<setting-item name="边框大小">
<n-input-number v-model:value="item.itemStyle.borderWidth" :min="0" :max="10" size="small" />
</setting-item>
<setting-item name="边框颜色">
<n-color-picker v-model:value="item.itemStyle.borderColor" :modes="['hex']" size="small" />
</setting-item>
<setting-item name="间隔">
<n-input-number v-model:value="item.gap" :min="0" :max="20" size="small" />
</setting-item>
</setting-item-box>
<setting-item-box name="标签">
<setting-item name="是否显示">
<n-checkbox v-model:checked="item.label.show" size="small">标签</n-checkbox>
</setting-item>
<setting-item name="位置">
<n-select v-model:value="item.label.position" :options="FunnelLabelPositionEnumList" size="small" />
</setting-item>
<setting-item name="大小">
<n-input-number v-model:value="item.label.fontSize" :min="0" size="small" />
</setting-item>
<setting-item name="悬停时大小">
<n-input-number v-model:value="item.emphasis.label.fontSize" :min="0" size="small" />
</setting-item>
</setting-item-box>
</collapse-item>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed } from 'vue'
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { option, FunnelOrderEnumList, FunnelLabelPositionEnumList } from './config'
const props = defineProps({
optionData: {
type: Object as PropType<typeof option & GlobalThemeJsonType>,
required: true
}
})
const seriesList = computed(() => {
return props.optionData.series
})
const sliderFormatTooltip = (v: number) => {
return `${v}px`
}
</script> </script>

View File

@ -0,0 +1,10 @@
{
"dimensions": ["product", "dataOne"],
"source": [
{ "product": "data1", "dataOne": 20 },
{ "product": "data2", "dataOne": 40 },
{ "product": "data3", "dataOne": 60 },
{ "product": "data4", "dataOne": 80 },
{ "product": "data5", "dataOne": 100 }
]
}

View File

@ -1,5 +1,5 @@
import image from '@/assets/images/chart/charts/funnel.png' import image from '@/assets/images/chart/charts/funnel.png'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const FunnelConfig: ConfigType = { export const FunnelConfig: ConfigType = {
@ -10,5 +10,6 @@ export const FunnelConfig: ConfigType = {
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.CHARTS, package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.ECHARTS,
image image
} }

View File

@ -1,13 +1,41 @@
<template> <template>
<div> <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
水波
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType } from 'vue'
import VChart from 'vue-echarts'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { FunnelChart } from 'echarts/charts'
import { includes } from './config'
import { mergeTheme } from '@/packages/public/chart'
import { useChartDataFetch } from '@/hooks'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
const props = defineProps({
themeSetting: {
type: Object,
required: true
},
themeColor: {
type: Object,
required: true
},
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
use([DatasetComponent, CanvasRenderer, FunnelChart, GridComponent, TooltipComponent, LegendComponent])
const option = computed(() => {
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
})
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script> </script>
<style lang="scss" scoped>
</style>

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { ProcessConfig } from './index' import { ProcessConfig } from './index'
import { chartInitConfig } from '@/settings/designSetting' import { chartInitConfig } from '@/settings/designSetting'
@ -53,7 +53,7 @@ export const option = {
offsetDegree: 0 offsetDegree: 0
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = ProcessConfig.key public key = ProcessConfig.key
public attr = { ...chartInitConfig, h: 500, zIndex: -1 } public attr = { ...chartInitConfig, h: 500, zIndex: -1 }
public chartConfig = cloneDeep(ProcessConfig) public chartConfig = cloneDeep(ProcessConfig)

View File

@ -58,6 +58,9 @@ watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
(newData: any) => { (newData: any) => {
option.dataset = toNumber(newData, 2) option.dataset = toNumber(newData, 2)
},
{
deep: false
} }
) )
// //

View File

@ -0,0 +1,51 @@
import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { RadarConfig } from './index'
import { CreateComponentType } from '@/packages/index.d'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'
export const includes = ['legend']
// 雷达形状
export const RadarShapeEnumList = [
{ label: '多边形', value: 'polygon' },
{ label: '圆形', value: 'circle' }
]
export const option = {
tooltip: {
show: true
},
legend: {
data: dataJson.seriesData.map(i => i.name)
},
dataset: { ...dataJson },
radar: {
shape: 'polygon',
radius: ['0%', '60%'],
center: ['50%', '55%'],
splitArea: { show: true },
splitLine: { show: true },
axisName: { show: true, color: '#eee', fontSize: 12 },
axisLine: { show: true },
axisTick: { show: true },
indicator: dataJson.radarIndicator
},
series: [
{
name: 'radar',
type: 'radar',
areaStyle: {
opacity: 0.1
},
data: dataJson.seriesData
}
]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = RadarConfig.key
public chartConfig = cloneDeep(RadarConfig)
// 图表配置项
public option = echartOptionProfixHandle(option, includes)
}

View File

@ -1,6 +1,141 @@
<template> <template>
<div>
<!-- Echarts 全局设置 -->
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
<CollapseItem name="雷达" :expanded="true">
<SettingItemBox name="样式">
<SettingItem>
<n-checkbox v-model:checked="radarConfig.splitArea.show">背景</n-checkbox>
</SettingItem>
<SettingItem>
<n-checkbox v-model:checked="radarConfig.splitLine.show">分割线</n-checkbox>
</SettingItem>
<SettingItem name="雷达形状">
<n-select v-model:value="radarConfig.shape" size="small" :options="RadarShapeEnumList" placeholder="选择形状" />
</SettingItem>
</SettingItemBox>
<SettingItemBox name="坐标轴">
<SettingItem>
<n-checkbox v-model:checked="radarConfig.axisLine.show">轴线</n-checkbox>
</SettingItem>
<SettingItem>
<n-checkbox v-model:checked="radarConfig.axisTick.show">刻度</n-checkbox>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="范围">
<setting-item :name="`最小值:${radarProp.radius[0]}%`">
<n-slider
v-model:value="radarProp.radius[0]"
:min="0"
:max="100"
:format-tooltip="sliderFormatTooltip"
@update:value="updateRadius0"
></n-slider>
</setting-item>
<setting-item :name="`最大值:${radarProp.radius[1]}%`">
<n-slider
v-model:value="radarProp.radius[1]"
:min="0"
:max="100"
:format-tooltip="sliderFormatTooltip"
@update:value="updateRadius1"
></n-slider>
</setting-item>
</SettingItemBox>
<SettingItemBox name="偏移">
<setting-item :name="`X 轴值:${radarProp.center[0]}%`">
<n-slider
v-model:value="radarProp.center[0]"
:min="0"
:max="100"
:format-tooltip="sliderFormatTooltip"
@update:value="updateCenter0"
></n-slider>
</setting-item>
<setting-item :name="`Y 轴值:${radarProp.center[1]}%`">
<n-slider
v-model:value="radarProp.center[1]"
:min="0"
:max="100"
:format-tooltip="sliderFormatTooltip"
@update:value="updateCenter1"
></n-slider>
</setting-item>
</SettingItemBox>
<SettingItemBox name="指示器">
<SettingItem name="颜色">
<n-color-picker size="small" :modes="['hex']" v-model:value="radarConfig.axisName.color"></n-color-picker>
</SettingItem>
<SettingItem name="大小">
<n-input-number v-model:value="radarConfig.axisName.fontSize" size="small" :min="9"></n-input-number>
</SettingItem>
<SettingItem>
<n-checkbox v-model:checked="radarConfig.axisName.show">文字标签</n-checkbox>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="系列" :alone="true">
<SettingItem name="背景透明度">
<n-input-number
v-model:value="optionData.series[0].areaStyle.opacity"
size="small"
:min="0"
:max="1"
:step="0.1"
></n-input-number>
</SettingItem>
</SettingItemBox>
</CollapseItem>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed, reactive } from 'vue'
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { option, RadarShapeEnumList } from './config'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
const props = defineProps({
optionData: {
type: Object as PropType<typeof option & GlobalThemeJsonType>,
required: true
}
})
const radarConfig = computed<typeof option.radar>(() => {
return props.optionData.radar
})
const radarProp = reactive({
radius: [0, 60],
center: [50, 50]
})
//
const updateRadius0 = (value: number) => {
props.optionData.radar.radius[0] = `${value}%`
}
const updateRadius1 = (value: number) => {
props.optionData.radar.radius[1] = `${value}%`
}
//
const updateCenter0 = (value: number) => {
props.optionData.radar.center[0] = `${value}%`
}
const updateCenter1 = (value: number) => {
props.optionData.radar.center[1] = `${value}%`
}
// percent
const sliderFormatTooltip = (v: number) => {
return `${v}%`
}
</script> </script>

View File

@ -0,0 +1,20 @@
{
"radarIndicator": [
{ "name": "数据1", "max": 6500 },
{ "name": "数据2", "max": 16000 },
{ "name": "数据3", "max": 30000 },
{ "name": "数据4", "max": 38000 },
{ "name": "数据5", "max": 52000 },
{ "name": "数据6", "max": 25000 }
],
"seriesData": [
{
"name": "data1",
"value": [4200, 3000, 20000, 35000, 50000, 18000]
},
{
"name": "data2",
"value": [5000, 14000, 28000, 26000, 42000, 21000]
}
]
}

View File

@ -1,14 +1,15 @@
import image from '@/assets/images/chart/charts/radar.png' import image from '@/assets/images/chart/charts/radar.png'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const RadarConfig: ConfigType = { export const RadarConfig: ConfigType = {
key: 'Radar', key: 'Radar',
chartKey: 'VRadar', chartKey: 'VRadar',
conKey: 'VCRadar', conKey: 'VCRadar',
title: '雷达', title: '雷达',
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.CHARTS, package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.COMMON,
image image
} }

View File

@ -1,13 +1,69 @@
<template> <template>
<div> <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
水波
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, PropType, watch } from 'vue'
import VChart from 'vue-echarts'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { RadarChart } from 'echarts/charts'
import { includes } from './config'
import { mergeTheme } from '@/packages/public/chart'
import { useChartDataFetch } from '@/hooks'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { isPreview } from '@/utils'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
const props = defineProps({
themeSetting: {
type: Object,
required: true
},
themeColor: {
type: Object,
required: true
},
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent])
const vChartRef = ref<typeof VChart>()
const option = computed(() => {
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
})
const dataSetHandle = (dataset: any) => {
if (dataset.seriesData) {
props.chartConfig.option.series[0].data = dataset.seriesData
// @ts-ignore
props.chartConfig.option.legend.data = dataset.seriesData.map((i: { name: string }) => i.name)
}
if (dataset.radarIndicator) {
props.chartConfig.option.radar.indicator = dataset.radarIndicator
}
if (vChartRef.value && isPreview()) {
vChartRef.value.setOption(props.chartConfig.option)
}
}
watch(
() => props.chartConfig.option.dataset,
newData => {
dataSetHandle(newData)
},
{
deep: false
}
)
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
dataSetHandle(newData)
})
</script> </script>
<style lang="scss" scoped>
</style>

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { WaterPoloConfig } from './index' import { WaterPoloConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -89,7 +89,7 @@ export const option = {
] ]
} }
export default class Config extends publicConfig implements CreateComponentType export default class Config extends PublicConfigClass implements CreateComponentType
{ {
public key = WaterPoloConfig.key public key = WaterPoloConfig.key
public chartConfig = cloneDeep(WaterPoloConfig) public chartConfig = cloneDeep(WaterPoloConfig)

View File

@ -10,6 +10,6 @@ export const WaterPoloConfig: ConfigType = {
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.CHARTS, package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.ECHARTS, chartFrame: ChartFrameEnum.COMMON,
image image
} }

View File

@ -79,7 +79,8 @@ watch(
option.value = props.chartConfig.option option.value = props.chartConfig.option
}, },
{ {
immediate: true immediate: true,
deep: false
} }
) )

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { PieCircleConfig } from './index' import { PieCircleConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
@ -54,7 +54,7 @@ const option = {
] ]
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = PieCircleConfig.key public key: string = PieCircleConfig.key
public chartConfig = PieCircleConfig public chartConfig = PieCircleConfig

View File

@ -50,7 +50,8 @@ watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
newData => dataHandle(newData), newData => dataHandle(newData),
{ {
immediate: true immediate: true,
deep: false
} }
) )

View File

@ -1,4 +1,4 @@
import { echartOptionProfixHandle, publicConfig } from '@/packages/public' import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public'
import { PieCommonConfig } from './index' import { PieCommonConfig } from './index'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import dataJson from './data.json' import dataJson from './data.json'
@ -44,7 +44,7 @@ const option = {
] ]
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = PieCommonConfig.key public key: string = PieCommonConfig.key
public chartConfig = PieCommonConfig public chartConfig = PieCommonConfig

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border01Config } from './index' import { Border01Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -9,7 +9,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border01Config.key public key = Border01Config.key
public chartConfig = cloneDeep(Border01Config) public chartConfig = cloneDeep(Border01Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border02Config } from './index' import { Border02Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,8 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig export default class Config extends PublicConfigClass implements CreateComponentType {
implements CreateComponentType {
public key = Border02Config.key public key = Border02Config.key
public chartConfig = cloneDeep(Border02Config) public chartConfig = cloneDeep(Border02Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border03Config } from './index' import { Border03Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border03Config.key public key = Border03Config.key
public chartConfig = cloneDeep(Border03Config) public chartConfig = cloneDeep(Border03Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border04Config } from './index' import { Border04Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -13,7 +13,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border04Config.key public key = Border04Config.key
public chartConfig = cloneDeep(Border04Config) public chartConfig = cloneDeep(Border04Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border05Config } from './index' import { Border05Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border05Config.key public key = Border05Config.key
public chartConfig = cloneDeep(Border05Config) public chartConfig = cloneDeep(Border05Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border06Config } from './index' import { Border06Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border06Config.key public key = Border06Config.key
public chartConfig = cloneDeep(Border06Config) public chartConfig = cloneDeep(Border06Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border07Config } from './index' import { Border07Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border07Config.key public key = Border07Config.key
public chartConfig = cloneDeep(Border07Config) public chartConfig = cloneDeep(Border07Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border08Config } from './index' import { Border08Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -10,7 +10,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border08Config.key public key = Border08Config.key
public chartConfig = cloneDeep(Border08Config) public chartConfig = cloneDeep(Border08Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border09Config } from './index' import { Border09Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border09Config.key public key = Border09Config.key
public chartConfig = cloneDeep(Border09Config) public chartConfig = cloneDeep(Border09Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border10Config } from './index' import { Border10Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border10Config.key public key = Border10Config.key
public chartConfig = cloneDeep(Border10Config) public chartConfig = cloneDeep(Border10Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border11Config } from './index' import { Border11Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border11Config.key public key = Border11Config.key
public chartConfig = cloneDeep(Border11Config) public chartConfig = cloneDeep(Border11Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border12Config } from './index' import { Border12Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border12Config.key public key = Border12Config.key
public chartConfig = cloneDeep(Border12Config) public chartConfig = cloneDeep(Border12Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Border13Config } from './index' import { Border13Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
backgroundColor: '#00000000' backgroundColor: '#00000000'
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Border13Config.key public key = Border13Config.key
public chartConfig = cloneDeep(Border13Config) public chartConfig = cloneDeep(Border13Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Decorates01Config } from './index' import { Decorates01Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -10,7 +10,7 @@ export const option = {
endWidth: 5 endWidth: 5
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Decorates01Config.key public key = Decorates01Config.key
public chartConfig = cloneDeep(Decorates01Config) public chartConfig = cloneDeep(Decorates01Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Decorates02Config } from './index' import { Decorates02Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -9,7 +9,7 @@ export const option = {
lineHeight: 3 lineHeight: 3
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Decorates02Config.key public key = Decorates02Config.key
public chartConfig = cloneDeep(Decorates02Config) public chartConfig = cloneDeep(Decorates02Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,16 +1,15 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Decorates03Config } from './index' import { Decorates03Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
dataset: '装饰-03',
textColor: '#fff', textColor: '#fff',
textSize: 24, textSize: 24,
colors: ['#1dc1f5', '#1dc1f5'], colors: ['#1dc1f5', '#1dc1f5'],
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Decorates03Config.key public key = Decorates03Config.key
public chartConfig = cloneDeep(Decorates03Config) public chartConfig = cloneDeep(Decorates03Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -56,11 +56,12 @@ import {
SettingItemBox, SettingItemBox,
SettingItem, SettingItem,
} from '@/components/Pages/ChartItemSetting' } from '@/components/Pages/ChartItemSetting'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { option } from './config' import { option } from './config'
const props = defineProps({ const props = defineProps({
optionData: { optionData: {
type: Object as PropType<typeof option>, type: Object as PropType<typeof option & GlobalThemeJsonType>,
required: true, required: true,
}, },
}) })

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Decorates04Config } from './index' import { Decorates04Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -9,7 +9,7 @@ export const option = {
reverse: false reverse: false
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Decorates04Config.key public key = Decorates04Config.key
public chartConfig = cloneDeep(Decorates04Config) public chartConfig = cloneDeep(Decorates04Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { Decorates05Config } from './index' import { Decorates05Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -8,7 +8,7 @@ export const option = {
dur: 3 dur: 3
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = Decorates05Config.key public key = Decorates05Config.key
public chartConfig = cloneDeep(Decorates05Config) public chartConfig = cloneDeep(Decorates05Config)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { NumberConfig } from './index' import { NumberConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -18,7 +18,7 @@ export const option = {
suffixColor: '#4a9ef8', suffixColor: '#4a9ef8',
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = NumberConfig.key public key = NumberConfig.key
public chartConfig = cloneDeep(NumberConfig) public chartConfig = cloneDeep(NumberConfig)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -6,8 +6,13 @@
</span> </span>
</template> </template>
<span :style="`color:${numberColor};font-size:${numberSize}px`"> <span :style="`color:${numberColor};font-size:${numberSize}px`">
<n-number-animation :from="option.from" :to="option.dataset" :duration="dur * 1000" :show-separator="showSeparator" <n-number-animation
:precision="precision"></n-number-animation> :from="option.from"
:to="option.dataset"
:duration="dur * 1000"
:show-separator="showSeparator"
:precision="precision"
></n-number-animation>
</span> </span>
<template #suffix> <template #suffix>
<span :style="`color:${suffixColor};font-size:${numberSize}px`"> <span :style="`color:${suffixColor};font-size:${numberSize}px`">
@ -26,25 +31,16 @@ import { useChartDataFetch } from '@/hooks'
const props = defineProps({ const props = defineProps({
chartConfig: { chartConfig: {
type: Object as PropType<CreateComponentType>, type: Object as PropType<CreateComponentType>,
required: true, required: true
}, }
}) })
const option = reactive({ const option = reactive({
from: 0, from: 0,
dataset: 0, dataset: 0
}) })
const { w, h } = toRefs(props.chartConfig.attr) const { w, h } = toRefs(props.chartConfig.attr)
let { let { dur, showSeparator, prefixText, prefixColor, suffixText, suffixColor, precision, numberSize, numberColor } =
dur, toRefs(props.chartConfig.option)
showSeparator,
prefixText,
prefixColor,
suffixText,
suffixColor,
precision,
numberSize,
numberColor,
} = toRefs(props.chartConfig.option)
const updateNumber = (newData: number) => { const updateNumber = (newData: number) => {
// //
@ -56,14 +52,19 @@ watch(
() => props.chartConfig.option.from, () => props.chartConfig.option.from,
() => { () => {
option.from = props.chartConfig.option.from option.from = props.chartConfig.option.from
}, { immediate: true } },
{ immediate: true }
) )
watch( watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
() => { () => {
option.dataset = props.chartConfig.option.dataset option.dataset = props.chartConfig.option.dataset
}, { immediate: true } },
{
immediate: true,
deep: false
}
) )
useChartDataFetch(props.chartConfig, useChartEditStore, updateNumber) useChartDataFetch(props.chartConfig, useChartEditStore, updateNumber)

View File

@ -0,0 +1,38 @@
import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { TimeCommonConfig } from './index'
import cloneDeep from 'lodash/cloneDeep'
import { chartInitConfig } from '@/settings/designSetting'
export enum FontWeightEnum {
NORMAL = '常规',
BOLD = '加粗'
}
export const FontWeightObject = {
[FontWeightEnum.NORMAL]: 'normal',
[FontWeightEnum.BOLD]: 'bold'
}
export const option = {
// 数据说明
timeSize: 24,
timeLineHeight: 50,
timeTextIndent: 2,
timeColor: '#E6F7FF',
fontWeight: 'normal',
//阴影
showShadow: true,
hShadow: 0,
vShadow: 0,
blurShadow: 8,
colorShadow: '#0075ff'
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = TimeCommonConfig.key
public attr = { ...chartInitConfig, w: 300, h: 50, zIndex: -1 }
public chartConfig = cloneDeep(TimeCommonConfig)
public option = cloneDeep(option)
}

View File

@ -0,0 +1,99 @@
<template>
<CollapseItem name="内容" :expanded="true">
<SettingItemBox name="字体">
<SettingItem name="大小">
<n-input-number
v-model:value="optionData.timeSize"
size="small"
:min="1"
></n-input-number>
</SettingItem>
<SettingItem name="粗细">
<n-select
v-model:value="optionData.fontWeight"
size="small"
:options="fontWeightOptions"
/>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="间距">
<SettingItem name="字距">
<n-input-number
v-model:value="optionData.timeTextIndent"
size="small"
:min="1"
></n-input-number>
</SettingItem>
<SettingItem name="行距">
<n-input-number
v-model:value="optionData.timeLineHeight"
size="small"
:min="1"
></n-input-number>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="颜色">
<SettingItem name="时间">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="optionData.timeColor"
></n-color-picker>
</SettingItem>
</SettingItemBox>
<SettingItemBox name="阴影">
<SettingItem>
<n-space>
<n-switch v-model:value="optionData.showShadow" size="small" />
<n-text>展示阴影</n-text>
</n-space>
</SettingItem>
<SettingItem name="x">
<n-input-number v-model:value="optionData.hShadow" size="small"></n-input-number
></SettingItem>
<SettingItem name="y">
<n-input-number v-model:value="optionData.vShadow" size="small"></n-input-number
></SettingItem>
<SettingItem name="模糊">
<n-input-number
v-model:value="optionData.blurShadow"
size="small"
></n-input-number
></SettingItem>
<SettingItem name="颜色">
<n-color-picker
size="small"
:modes="['hex']"
v-model:value="optionData.colorShadow"
></n-color-picker
></SettingItem>
</SettingItemBox>
</CollapseItem>
</template>
<script setup lang="ts">
import { PropType } from "vue";
import {
CollapseItem,
SettingItemBox,
SettingItem,
} from "@/components/Pages/ChartItemSetting";
import { option, FontWeightEnum, FontWeightObject } from "./config";
const props = defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true,
},
});
const fontWeightOptions = [
{
label: FontWeightEnum.NORMAL,
value: FontWeightObject[FontWeightEnum.NORMAL],
},
{
label: FontWeightEnum.BOLD,
value: FontWeightObject[FontWeightEnum.BOLD],
},
];
</script>

View File

@ -0,0 +1,14 @@
import image from '@/assets/images/chart/decorates/time-common.png'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TimeCommonConfig: ConfigType = {
key: 'TimeCommon',
chartKey: 'VTimeCommon',
conKey: 'VCTimeCommon',
title: '通用时间',
category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.DECORATES,
image
}

View File

@ -0,0 +1,92 @@
<template>
<div class="go-decorates-number" :style="`width:${w}px;height:${h}px;`">
<div
:style="`color:${timeColor};font-size:${timeSize}px;line-height:${timeLineHeight}px;
letter-spacing:${timeTextIndent}px;font-weight:${fontWeight};
text-shadow: ${boxShadow}`"
>
{{ newData }}
</div>
</div>
</template>
<script setup lang="ts">
import { PropType, toRefs, ref, reactive, watch, onMounted, onUnmounted } from "vue";
import { CreateComponentType } from "@/packages/index.d";
import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore";
import { useChartDataFetch } from "@/hooks";
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true,
},
});
let yearMonthDay = ref("2021-2-3");
let nowData = ref("08:00:00");
let newData = ref("2021-2-3 08:00:00");
let boxShadow = ref("none");
const { w, h } = toRefs(props.chartConfig.attr);
let {
timeColor,
timeSize,
timeLineHeight,
timeTextIndent,
fontWeight,
showShadow,
hShadow,
vShadow,
blurShadow,
colorShadow,
} = toRefs(props.chartConfig.option);
watch(
props.chartConfig.option,
() => {
if (props.chartConfig.option.showShadow) {
boxShadow.value = `${props.chartConfig.option.hShadow}px ${props.chartConfig.option.vShadow}px ${props.chartConfig.option.blurShadow}px ${props.chartConfig.option.colorShadow}`;
} else {
boxShadow.value = "none";
}
},
{
immediate: true,
}
);
onMounted(() => {
const timer = setInterval(() => {
var datetime = new Date();
var year = datetime.getFullYear();
var month =
datetime.getMonth() + 1 < 10
? "0" + (datetime.getMonth() + 1)
: datetime.getMonth() + 1;
var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
var hh = datetime.getHours(); //
var mm = datetime.getMinutes(); //
var ss = datetime.getSeconds(); //
let time = "";
if (hh < 10) time += "0";
time += hh + ":";
if (mm < 10) time += "0";
time += mm + ":";
if (ss < 10) time += "0";
time += ss;
yearMonthDay.value = `${year}-${month}-${date}`;
nowData.value = time;
newData.value = yearMonthDay.value + " " + nowData.value;
}, 500);
});
onUnmounted(() => {
clearInterval();
});
useChartDataFetch(props.chartConfig, useChartEditStore);
</script>
<style lang="scss" scoped>
@include go("decorates-number") {
text-align: center;
}
</style>

View File

@ -2,5 +2,6 @@ import { WeatherConfig } from './Weather/index'
import { TimeConfig } from './Time/index' import { TimeConfig } from './Time/index'
import { WeatherTimeConfig } from './WeatherTime/index' import { WeatherTimeConfig } from './WeatherTime/index'
import { NumberConfig } from './Number/index' import { NumberConfig } from './Number/index'
import { TimeCommonConfig } from './TimeCommon/index'
export default [WeatherConfig, TimeConfig, WeatherTimeConfig, NumberConfig] export default [WeatherConfig, TimeCommonConfig, TimeConfig, WeatherTimeConfig, NumberConfig]

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { ImageConfig } from './index' import { ImageConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -13,7 +13,7 @@ export const option = {
borderRadius: 10 borderRadius: 10
} }
export default class Config extends publicConfig implements CreateComponentType export default class Config extends PublicConfigClass implements CreateComponentType
{ {
public key = ImageConfig.key public key = ImageConfig.key
public chartConfig = cloneDeep(ImageConfig) public chartConfig = cloneDeep(ImageConfig)

View File

@ -46,7 +46,8 @@ watch(
option.dataset = newData option.dataset = newData
}, },
{ {
immediate: true immediate: true,
deep: false
} }
) )

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { TextCommonConfig } from './index' import { TextCommonConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -31,7 +31,7 @@ export const option = {
backgroundColor: '#00000000', backgroundColor: '#00000000',
} }
export default class Config extends publicConfig implements CreateComponentType export default class Config extends PublicConfigClass implements CreateComponentType
{ {
public key = TextCommonConfig.key public key = TextCommonConfig.key
public chartConfig = cloneDeep(TextCommonConfig) public chartConfig = cloneDeep(TextCommonConfig)

View File

@ -57,8 +57,10 @@ watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
(newData: any) => { (newData: any) => {
option.dataset = newData option.dataset = newData
}, { },
immediate: true {
immediate: true,
deep: false
} }
) )

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { TextGradientConfig } from './index' import { TextGradientConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -13,7 +13,7 @@ export const option = {
} }
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = TextGradientConfig.key public key = TextGradientConfig.key
public chartConfig = cloneDeep(TextGradientConfig) public chartConfig = cloneDeep(TextGradientConfig)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -32,7 +32,8 @@ watch(
option.dataset = newData option.dataset = newData
}, },
{ {
immediate: true immediate: true,
deep: false
} }
) )

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { TableListConfig } from './index' import { TableListConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -29,7 +29,7 @@ export const option = {
valueFormatter(item: { value: any}) { return item.value} valueFormatter(item: { value: any}) { return item.value}
} }
export default class Config extends publicConfig implements CreateComponentType { export default class Config extends PublicConfigClass implements CreateComponentType {
public key = TableListConfig.key public key = TableListConfig.key
public chartConfig = cloneDeep(TableListConfig) public chartConfig = cloneDeep(TableListConfig)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -169,6 +169,9 @@ watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
() => { () => {
onRestart() onRestart()
},
{
deep: false
} }
) )

View File

@ -1,4 +1,4 @@
import { publicConfig } from '@/packages/public' import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d' import { CreateComponentType } from '@/packages/index.d'
import { TableScrollBoardConfig } from './index' import { TableScrollBoardConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
@ -9,20 +9,17 @@ export const option = {
dataset: dataJson, dataset: dataJson,
index: true, index: true,
columnWidth: [30, 100, 100], columnWidth: [30, 100, 100],
align: ['center','right','right','right'], align: ['center', 'right', 'right', 'right'],
rowNum: 5, rowNum: 5,
waitTime: 2, waitTime: 2,
headerHeight: 35, headerHeight: 35,
carousel: 'single', carousel: 'single',
headerBGC: '#00BAFF', headerBGC: '#00BAFF',
oddRowBGC: '#003B51', oddRowBGC: '#003B51',
evenRowBGC: '#0A2732', evenRowBGC: '#0A2732'
} }
export default class Config export default class Config extends PublicConfigClass implements CreateComponentType {
extends publicConfig
implements CreateComponentType
{
public key = TableScrollBoardConfig.key public key = TableScrollBoardConfig.key
public chartConfig = cloneDeep(TableScrollBoardConfig) public chartConfig = cloneDeep(TableScrollBoardConfig)
public option = cloneDeep(option) public option = cloneDeep(option)

View File

@ -2,7 +2,7 @@ import type { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
export enum ChartFrameEnum { export enum ChartFrameEnum {
// echarts 框架 // 支持 dataset 的 echarts 框架
ECHARTS = 'echarts', ECHARTS = 'echarts',
// UI 组件框架 // UI 组件框架
NAIVE_UI = 'naiveUI', NAIVE_UI = 'naiveUI',

View File

@ -36,7 +36,7 @@ const requestConfig: RequestConfigType = {
} }
// 单实例类 // 单实例类
export class publicConfig implements PublicConfigType { export class PublicConfigClass implements PublicConfigType {
public id = getUUID() public id = getUUID()
public isGroup = false public isGroup = false
// 基本信息 // 基本信息
@ -78,8 +78,8 @@ export class publicConfig implements PublicConfigType {
} }
} }
// 成组类 (部分属性不需要, 不继承 publicConfig) // 多选成组类
export class PublicGroupConfigClass extends publicConfig implements CreateComponentGroupType { export class PublicGroupConfigClass extends PublicConfigClass implements CreateComponentGroupType {
// 成组 // 成组
public isGroup = true public isGroup = true
// 名称 // 名称

View File

@ -480,6 +480,8 @@ export const useChartEditStore = defineStore({
try { try {
// 暂不支持多选 // 暂不支持多选
if (this.getTargetChart.selectId.length > 1) return if (this.getTargetChart.selectId.length > 1) return
// 处理弹窗普通复制的场景
if (document.getElementsByClassName('n-modal-body-wrapper').length) return
loadingStart() loadingStart()
const index: number = this.fetchTargetIndex() const index: number = this.fetchTargetIndex()

View File

@ -79,7 +79,7 @@
<!-- 骨架图 --> <!-- 骨架图 -->
<go-skeleton :load="loading" :repeat="3"></go-skeleton> <go-skeleton :load="loading" :repeat="3"></go-skeleton>
<!-- 请求配置model --> <!-- 请求配置model -->
<chart-data-request v-model:modelShow="requestShow"></chart-data-request> <chart-data-request v-model:modelShow="requestShow" @sendHandle="sendHandle"></chart-data-request>
</div> </div>
</template> </template>

View File

@ -33,7 +33,6 @@
</n-timeline-item> </n-timeline-item>
<n-timeline-item type="success" :title="TimelineTitleEnum.CONTENT"> <n-timeline-item type="success" :title="TimelineTitleEnum.CONTENT">
<n-space vertical> <n-space vertical>
<n-text depth="3">ECharts 图表需符合 ECharts-setdata 数据规范</n-text>
<n-space class="source-btn-box"> <n-space class="source-btn-box">
<n-upload <n-upload
v-model:file-list="uploadFileListRef" v-model:file-list="uploadFileListRef"
@ -81,7 +80,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch } from 'vue' import { ref, computed, watch } from 'vue'
import { PackagesCategoryEnum } from '@/packages/index.d' import { ChartFrameEnum } from '@/packages/index.d'
import { RequestDataTypeEnum } from '@/enums/httpEnum' import { RequestDataTypeEnum } from '@/enums/httpEnum'
import { icon } from '@/plugins' import { icon } from '@/plugins'
import { DataResultEnum, TimelineTitleEnum } from '../../index.d' import { DataResultEnum, TimelineTitleEnum } from '../../index.d'
@ -120,9 +119,9 @@ const filterShow = computed(() => {
return targetData.value.request.requestDataType === RequestDataTypeEnum.AJAX return targetData.value.request.requestDataType === RequestDataTypeEnum.AJAX
}) })
// // dataset
const isCharts = computed(() => { const isCharts = computed(() => {
return targetData.value.chartConfig.package === PackagesCategoryEnum.CHARTS return targetData.value.chartConfig.chartFrame === ChartFrameEnum.ECHARTS
}) })
// //
@ -165,21 +164,23 @@ const dimensionsAndSourceHandle = () => {
watch( watch(
() => targetData.value?.option?.dataset, () => targetData.value?.option?.dataset,
( (
newData: { newData?: {
source: any source: any
dimensions: any dimensions: any
} | null } | null
) => { ) => {
if (newData && isObject(newData)) { if (newData && targetData?.value?.chartConfig?.chartFrame === ChartFrameEnum.ECHARTS) {
// Echarts // DataSet
source.value = newData source.value = newData
if (isCharts.value) { if (isCharts.value) {
dimensions.value = newData.dimensions dimensions.value = newData.dimensions
dimensionsAndSource.value = dimensionsAndSourceHandle() dimensionsAndSource.value = dimensionsAndSourceHandle()
} }
} else { } else if (newData !== undefined && newData !== null) {
dimensionsAndSource.value = null dimensionsAndSource.value = null
source.value = newData source.value = newData
} else {
source.value = '此组件无数据源'
} }
}, },
{ {

View File

@ -62,7 +62,17 @@ import { selectTypeOptions, selectTimeOptions } from '@/views/chart/ContentConfi
import { RequestHeader } from '../RequestHeader' import { RequestHeader } from '../RequestHeader'
import { isDev } from '@/utils' import { isDev } from '@/utils'
import { icon } from '@/plugins' import { icon } from '@/plugins'
import { chartDataUrl, rankListUrl, scrollBoardUrl, numberFloatUrl, numberIntUrl, textUrl, imageUrl } from '@/api/mock' import {
chartDataUrl,
chartSingleDataUrl,
rankListUrl,
scrollBoardUrl,
numberFloatUrl,
numberIntUrl,
textUrl,
imageUrl,
radarUrl
} from '@/api/mock'
const { HelpOutlineIcon } = icon.ionicons5 const { HelpOutlineIcon } = icon.ionicons5
const { targetData, chartEditStore } = useTargetData() const { targetData, chartEditStore } = useTargetData()
@ -73,6 +83,9 @@ const apiList = [
{ {
value: `【图表】${chartDataUrl}` value: `【图表】${chartDataUrl}`
}, },
{
value: `【单数据图表】${chartSingleDataUrl}`
},
{ {
value: `【文本】${textUrl}` value: `【文本】${textUrl}`
}, },
@ -90,6 +103,9 @@ const apiList = [
}, },
{ {
value: `【滚动表格】${scrollBoardUrl}` value: `【滚动表格】${scrollBoardUrl}`
},
{
value: `【雷达】${radarUrl}`
} }
] ]
</script> </script>

View File

@ -33,7 +33,7 @@ import { useTargetData } from '../../../hooks/useTargetData.hook'
import { RequestGlobalConfig } from './components/RequestGlobalConfig' import { RequestGlobalConfig } from './components/RequestGlobalConfig'
import { RequestTargetConfig } from './components/RequestTargetConfig' import { RequestTargetConfig } from './components/RequestTargetConfig'
const emit = defineEmits(['update:modelShow']) const emit = defineEmits(['update:modelShow', 'sendHandle'])
const { targetData } = useTargetData() const { targetData } = useTargetData()
// //
@ -50,6 +50,7 @@ defineProps({
const closeHandle = () => { const closeHandle = () => {
emit('update:modelShow', false) emit('update:modelShow', false)
emit('sendHandle')
} }
</script> </script>

View File

@ -1,16 +1,11 @@
<template> <template>
<div class="go-chart-configurations-data" v-if="targetData"> <div class="go-chart-configurations-data" v-if="targetData">
<setting-item-box name="请求方式" :alone="true"> <setting-item-box name="请求方式" :alone="true">
<n-select <n-select v-model:value="targetData.request.requestDataType" :disabled="isNotData" :options="selectOptions" />
v-model:value="targetData.request.requestDataType"
:options="selectOptions"
/>
</setting-item-box> </setting-item-box>
<!-- 静态 --> <!-- 静态 -->
<chart-data-static <chart-data-static v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"></chart-data-static>
v-if="targetData.request.requestDataType === RequestDataTypeEnum.STATIC"
></chart-data-static>
<!-- 动态 --> <!-- 动态 -->
<chart-data-ajax v-else></chart-data-ajax> <chart-data-ajax v-else></chart-data-ajax>
@ -18,6 +13,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'
import { SettingItemBox } from '@/components/Pages/ChartItemSetting' import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { useTargetData } from '../hooks/useTargetData.hook' import { useTargetData } from '../hooks/useTargetData.hook'
import { ChartDataStatic } from './components/ChartDataStatic/index' import { ChartDataStatic } from './components/ChartDataStatic/index'
@ -38,4 +34,9 @@ const selectOptions: SelectCreateDataType[] = [
value: RequestDataTypeEnum.AJAX value: RequestDataTypeEnum.AJAX
} }
] ]
//
const isNotData = computed(() => {
return typeof targetData.value?.option?.dataset === 'undefined'
})
</script> </script>

View File

@ -7,6 +7,7 @@
:showBottom="true" :showBottom="true"
:depth="1" :depth="1"
:xScroll="true" :xScroll="true"
@mousedown="mousedownHandleUnStop"
@drop="dragHandle" @drop="dragHandle"
@dragover="dragoverHandle" @dragover="dragoverHandle"
@dragenter="dragoverHandle" @dragenter="dragoverHandle"
@ -88,7 +89,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
import { useLayout } from './hooks/useLayout.hook' import { useLayout } from './hooks/useLayout.hook'
import { useAddKeyboard } from '../hooks/useKeyboard.hook' import { useAddKeyboard } from '../hooks/useKeyboard.hook'
import { useSync } from '../hooks/useSync.hook' import { useSync } from '../hooks/useSync.hook'
import { dragHandle, dragoverHandle, useMouseHandle } from './hooks/useDrag.hook' import { dragHandle, dragoverHandle, mousedownHandleUnStop, useMouseHandle } from './hooks/useDrag.hook'
import { useComponentStyle, useSizeStyle } from './hooks/useStyle.hook' import { useComponentStyle, useSizeStyle } from './hooks/useStyle.hook'
import { ContentBox } from '../ContentBox/index' import { ContentBox } from '../ContentBox/index'

Some files were not shown because too many files have changed in this diff Show More