lw-cdp-ui 1.4.40 → 1.4.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/lwBiChart/item.vue +52 -57
- package/dist/components/lwTour/index.vue +101 -101
- package/dist/lw-cdp-ui.esm.js +2486 -2533
- package/dist/lw-cdp-ui.umd.js +8 -8
- package/package.json +1 -1
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
<component v-if="isShow" :is="chartComponent" :rawData="rawData" :height="height" :isBi="isBi" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script>
|
|
5
|
+
<script setup>
|
|
6
|
+
import { computed, provide } from 'vue'
|
|
6
7
|
import * as echarts from 'echarts'
|
|
7
8
|
|
|
8
|
-
import BarChart from './charts/BarChart.vue'
|
|
9
|
-
import LineChart from './charts/LineChart.vue'
|
|
10
|
-
import PieChart from './charts/PieChart.vue'
|
|
11
|
-
import AreaChart from './charts/AreaChart.vue'
|
|
12
|
-
import MetricCard from './charts/MetricCard.vue'
|
|
13
|
-
import GaugeChart from './charts/GaugeChart.vue'
|
|
14
|
-
import FunnelChart from './charts/FunnelChart.vue'
|
|
15
|
-
import ScatterChart from './charts/ScatterChart.vue'
|
|
16
|
-
import RadarChart from './charts/RadarChart.vue'
|
|
17
|
-
import MapChart from './charts/MapChart.vue'
|
|
18
|
-
import ReportTable from './charts/ReportTable.vue'
|
|
19
|
-
import ChartTitle from './charts/ChartTitle.vue'
|
|
9
|
+
import BarChart from './charts/BarChart.vue'
|
|
10
|
+
import LineChart from './charts/LineChart.vue'
|
|
11
|
+
import PieChart from './charts/PieChart.vue'
|
|
12
|
+
import AreaChart from './charts/AreaChart.vue'
|
|
13
|
+
import MetricCard from './charts/MetricCard.vue'
|
|
14
|
+
import GaugeChart from './charts/GaugeChart.vue'
|
|
15
|
+
import FunnelChart from './charts/FunnelChart.vue'
|
|
16
|
+
import ScatterChart from './charts/ScatterChart.vue'
|
|
17
|
+
import RadarChart from './charts/RadarChart.vue'
|
|
18
|
+
import MapChart from './charts/MapChart.vue'
|
|
19
|
+
import ReportTable from './charts/ReportTable.vue'
|
|
20
|
+
import ChartTitle from './charts/ChartTitle.vue'
|
|
20
21
|
|
|
22
|
+
// 组件映射表
|
|
21
23
|
const componentMap = {
|
|
22
24
|
Bar: BarChart,
|
|
23
25
|
Line: LineChart,
|
|
@@ -33,50 +35,43 @@ const componentMap = {
|
|
|
33
35
|
ChartTitle: ChartTitle
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
PieChart,
|
|
42
|
-
AreaChart,
|
|
43
|
-
MetricCard,
|
|
44
|
-
GaugeChart,
|
|
45
|
-
FunnelChart,
|
|
46
|
-
ScatterChart,
|
|
47
|
-
RadarChart,
|
|
48
|
-
MapChart,
|
|
49
|
-
ReportTable,
|
|
50
|
-
ChartTitle
|
|
38
|
+
// Props 定义
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
rawData: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => null
|
|
51
43
|
},
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
height: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '300px'
|
|
54
47
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
48
|
+
isBi: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: true
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
// 确保 echarts 实例只被创建一次
|
|
55
|
+
const echartsInstance = (() => {
|
|
56
|
+
if (!echarts._vue_echarts_instance) {
|
|
57
|
+
echarts._vue_echarts_instance = echarts
|
|
58
|
+
}
|
|
59
|
+
return echarts._vue_echarts_instance
|
|
60
|
+
})()
|
|
61
|
+
|
|
62
|
+
// 提供 echarts 实例给子组件
|
|
63
|
+
provide('echarts', echartsInstance)
|
|
64
|
+
|
|
65
|
+
// 计算属性
|
|
66
|
+
const isShow = computed(() => {
|
|
67
|
+
return props.rawData && ((props.rawData?.setting && props.rawData?.dataSet) || props.rawData?.option)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const chartType = computed(() => {
|
|
71
|
+
return props.rawData?.type || 'Bar'
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const chartComponent = computed(() => {
|
|
75
|
+
return componentMap[chartType.value] || BarChart
|
|
76
|
+
})
|
|
82
77
|
</script>
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tour v-model="isOpen" :current="currentStep">
|
|
3
|
-
<el-tour-step v-for="(step, index) in formattedSteps" :key="index" :target="step.target" :title="step.title"
|
|
4
|
-
:description="step.description" />
|
|
5
|
-
</el-tour>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
import { ref, getCurrentInstance, onMounted, nextTick, onUnmounted } from 'vue'
|
|
10
|
-
import { useRouter } from 'vue-router'
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
name: 'LwTour',
|
|
14
|
-
props: {
|
|
15
|
-
steps: {
|
|
16
|
-
type: Array,
|
|
17
|
-
required: true,
|
|
18
|
-
validator: (value) => {
|
|
19
|
-
return value.every(step => {
|
|
20
|
-
return step.css && step.title && step.description
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
// 是否在组件挂载后自动开始引导
|
|
25
|
-
autoStart: {
|
|
26
|
-
type: Boolean,
|
|
27
|
-
default: false
|
|
28
|
-
},
|
|
29
|
-
currentStep: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 0
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
setup(props, { emit }) {
|
|
35
|
-
const {
|
|
36
|
-
proxy: { $api, $expression, t, $tool, $bus }
|
|
37
|
-
} = getCurrentInstance()
|
|
38
|
-
const router = useRouter()
|
|
39
|
-
$bus.$on(`lwTourChange`, () => {
|
|
40
|
-
startTour()
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
onUnmounted(() => {
|
|
44
|
-
$bus.$emit(`lwTourOpen`, false)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
const isOpen = ref(false)
|
|
48
|
-
const formattedSteps = ref([])
|
|
49
|
-
|
|
50
|
-
// 开始引导
|
|
51
|
-
const startTour = () => {
|
|
52
|
-
const allElementsExist = props.steps.every(step => {
|
|
53
|
-
return document.querySelector(step.css)
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
if (!allElementsExist) {
|
|
57
|
-
console.warn('元素未加载完成')
|
|
58
|
-
startTour()
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
formattedSteps.value = props.steps.map(step => {
|
|
63
|
-
const targetElement = document.querySelector(step.css)
|
|
64
|
-
return {
|
|
65
|
-
target: targetElement || undefined,
|
|
66
|
-
title: step.title,
|
|
67
|
-
description: step.description,
|
|
68
|
-
// 可以添加更多el-tour支持的配置项
|
|
69
|
-
placement: 'bottom'
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
isOpen.value = true
|
|
73
|
-
|
|
74
|
-
let LwTour = $tool.data.get('LwTour') || {}
|
|
75
|
-
let { path, meta } = router.currentRoute.value
|
|
76
|
-
LwTour[`${meta.title}${path}`] = true
|
|
77
|
-
$tool.data.set('LwTour', LwTour)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// 组件挂载后自动开始引导
|
|
83
|
-
onMounted(() => {
|
|
84
|
-
let LwTour = $tool.data.get('LwTour') || {}
|
|
85
|
-
let { path, meta } = router.currentRoute.value
|
|
86
|
-
if (props.autoStart && !LwTour[`${meta.title}${path}`]) {
|
|
87
|
-
nextTick(() => {
|
|
88
|
-
startTour()
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
$bus.$emit(`lwTourOpen`, true)
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
formattedSteps,
|
|
96
|
-
isOpen,
|
|
97
|
-
startTour
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-tour v-model="isOpen" :current="currentStep">
|
|
3
|
+
<el-tour-step v-for="(step, index) in formattedSteps" :key="index" :target="step.target" :title="step.title"
|
|
4
|
+
:description="step.description" />
|
|
5
|
+
</el-tour>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import { ref, getCurrentInstance, onMounted, nextTick, onUnmounted } from 'vue'
|
|
10
|
+
import { useRouter } from 'vue-router'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'LwTour',
|
|
14
|
+
props: {
|
|
15
|
+
steps: {
|
|
16
|
+
type: Array,
|
|
17
|
+
required: true,
|
|
18
|
+
validator: (value) => {
|
|
19
|
+
return value.every(step => {
|
|
20
|
+
return step.css && step.title && step.description
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
// 是否在组件挂载后自动开始引导
|
|
25
|
+
autoStart: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
currentStep: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(props, { emit }) {
|
|
35
|
+
const {
|
|
36
|
+
proxy: { $api, $expression, t, $tool, $bus }
|
|
37
|
+
} = getCurrentInstance()
|
|
38
|
+
const router = useRouter()
|
|
39
|
+
$bus.$on(`lwTourChange`, () => {
|
|
40
|
+
startTour()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
onUnmounted(() => {
|
|
44
|
+
$bus.$emit(`lwTourOpen`, false)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const isOpen = ref(false)
|
|
48
|
+
const formattedSteps = ref([])
|
|
49
|
+
|
|
50
|
+
// 开始引导
|
|
51
|
+
const startTour = () => {
|
|
52
|
+
const allElementsExist = props.steps.every(step => {
|
|
53
|
+
return document.querySelector(step.css)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
if (!allElementsExist) {
|
|
57
|
+
console.warn('元素未加载完成')
|
|
58
|
+
startTour()
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
formattedSteps.value = props.steps.map(step => {
|
|
63
|
+
const targetElement = document.querySelector(step.css)
|
|
64
|
+
return {
|
|
65
|
+
target: targetElement || undefined,
|
|
66
|
+
title: step.title,
|
|
67
|
+
description: step.description,
|
|
68
|
+
// 可以添加更多el-tour支持的配置项
|
|
69
|
+
placement: 'bottom'
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
isOpen.value = true
|
|
73
|
+
|
|
74
|
+
let LwTour = $tool.data.get('LwTour') || {}
|
|
75
|
+
let { path, meta } = router.currentRoute.value
|
|
76
|
+
LwTour[`${meta.title}${path}`] = true
|
|
77
|
+
$tool.data.set('LwTour', LwTour)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
// 组件挂载后自动开始引导
|
|
83
|
+
onMounted(() => {
|
|
84
|
+
let LwTour = $tool.data.get('LwTour') || {}
|
|
85
|
+
let { path, meta } = router.currentRoute.value
|
|
86
|
+
if (props.autoStart && !LwTour[`${meta.title}${path}`]) {
|
|
87
|
+
nextTick(() => {
|
|
88
|
+
startTour()
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
$bus.$emit(`lwTourOpen`, true)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
formattedSteps,
|
|
96
|
+
isOpen,
|
|
97
|
+
startTour
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|