adtec-core-package 0.3.2 → 0.3.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adtec-core-package",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -13,27 +13,29 @@
|
|
|
13
13
|
"format": "prettier --write src/"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@onlyoffice/document-editor-vue": "1.4.0",
|
|
17
16
|
"@element-plus/icons-vue": "^2.3.1",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"jsencrypt": "^3.3.2",
|
|
17
|
+
"@onlyoffice/document-editor-vue": "1.4.0",
|
|
18
|
+
"@types/echarts": "^5.0.0",
|
|
21
19
|
"axios": "^1.7.7",
|
|
20
|
+
"crypto-js": "^4.2.0",
|
|
21
|
+
"echarts": "^5.6.0",
|
|
22
22
|
"element-plus": "^2.8.7",
|
|
23
|
+
"jsencrypt": "^3.3.2",
|
|
23
24
|
"pinia": "^2.3.0",
|
|
25
|
+
"pinia-plugin-store": "^2.2.9",
|
|
24
26
|
"scss": "^0.2.4",
|
|
25
27
|
"scss-loader": "^0.0.1",
|
|
28
|
+
"socket.io-client": "^2.3.1",
|
|
29
|
+
"uuid": "^11.0.3",
|
|
26
30
|
"vue": "^3.5.13",
|
|
27
31
|
"vue-focus-lock": "^3.0.0",
|
|
28
|
-
"vue-
|
|
29
|
-
"
|
|
30
|
-
"socket.io-client": "^2.3.1",
|
|
31
|
-
"vue-img-viewr": "2.0.11"
|
|
32
|
+
"vue-img-viewr": "2.0.11",
|
|
33
|
+
"vue-router": "^4.5.0"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
36
|
"@tsconfig/node22": "^22.0.0",
|
|
35
|
-
"@types/node": "^22.10.2",
|
|
36
37
|
"@types/crypto-js": "^4.2.2",
|
|
38
|
+
"@types/node": "^22.10.2",
|
|
37
39
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
38
40
|
"@vitejs/plugin-vue-jsx": "^4.1.1",
|
|
39
41
|
"@vue/eslint-config-prettier": "^10.1.0",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!--创建人 胡啸东-->
|
|
2
|
+
<!--说明: index-->
|
|
3
|
+
<!--创建时间: 2024/11/4 下午4:52-->
|
|
4
|
+
<!--修改时间: 2024/11/4 下午4:52-->
|
|
5
|
+
<template>
|
|
6
|
+
<div
|
|
7
|
+
ref="echartsRef"
|
|
8
|
+
:style="{
|
|
9
|
+
width: width,
|
|
10
|
+
height: height,
|
|
11
|
+
}"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { onMounted, ref, watch, type PropType } from 'vue'
|
|
17
|
+
import { useEcharts, type EChartsCoreOption } from '../../hooks/useEcharts.ts' // 引入hooks
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
options: { type: Object as PropType<EChartsCoreOption>, required: true },
|
|
20
|
+
height: { type: String, default: '100%' },
|
|
21
|
+
width: { type: String, default: '100%' },
|
|
22
|
+
themeColors: { type: Array as PropType<string[]>, default: () => [] },
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const echartsRef = ref()
|
|
26
|
+
|
|
27
|
+
const { setOptions, initCharts } = useEcharts(echartsRef, props.options)
|
|
28
|
+
|
|
29
|
+
watch(
|
|
30
|
+
() => props.options,
|
|
31
|
+
(nVal) => {
|
|
32
|
+
let targetOptions: EChartsCoreOption = {}
|
|
33
|
+
if (props.themeColors && props.themeColors.length > 0) {
|
|
34
|
+
targetOptions = { ...nVal }
|
|
35
|
+
targetOptions.color = props.themeColors
|
|
36
|
+
} else {
|
|
37
|
+
targetOptions = { ...nVal }
|
|
38
|
+
}
|
|
39
|
+
setOptions(targetOptions)
|
|
40
|
+
},
|
|
41
|
+
{ deep: true },
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
initCharts()
|
|
46
|
+
})
|
|
47
|
+
defineExpose({ setOptions, initCharts })
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建人 胡啸东
|
|
3
|
+
* 说明: useEcharts
|
|
4
|
+
* 创建时间: 2024/11/4 下午4:51
|
|
5
|
+
* 修改时间: 2024/11/4 下午4:51
|
|
6
|
+
*/
|
|
7
|
+
import { onBeforeUnmount, onDeactivated, onMounted, shallowRef, unref } from 'vue'
|
|
8
|
+
import type{Ref}from 'vue'
|
|
9
|
+
import echarts from '../plugins/echartsConfig.ts'
|
|
10
|
+
|
|
11
|
+
export type EChartsCoreOption = echarts.EChartsCoreOption
|
|
12
|
+
|
|
13
|
+
const useEcharts = (elRef: Ref<HTMLDivElement>, options: EChartsCoreOption) => {
|
|
14
|
+
const charts = shallowRef<echarts.ECharts>()
|
|
15
|
+
|
|
16
|
+
const setOptions = (options: EChartsCoreOption) => {
|
|
17
|
+
charts.value && charts.value.setOption(options)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 初始化
|
|
21
|
+
const initCharts = (themeColor?: Array<string>) => {
|
|
22
|
+
const el = unref(elRef)
|
|
23
|
+
if (!el || !unref(el)) {
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
charts.value = echarts.init(el)
|
|
27
|
+
if (themeColor) {
|
|
28
|
+
options.color = themeColor
|
|
29
|
+
}
|
|
30
|
+
setOptions(options)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 重新窗口变化时,重新计算
|
|
34
|
+
const resize = () => {
|
|
35
|
+
charts.value && charts.value.resize()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onMounted(() => {
|
|
39
|
+
window.addEventListener('resize', resize)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// 页面keepAlive时,不监听页面
|
|
43
|
+
onDeactivated(() => {
|
|
44
|
+
window.removeEventListener('resize', resize)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
onBeforeUnmount(() => {
|
|
48
|
+
window.removeEventListener('resize', resize)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
initCharts,
|
|
53
|
+
setOptions,
|
|
54
|
+
resize
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { useEcharts }
|
package/src/mixin/globalMixin.ts
CHANGED
|
@@ -15,6 +15,7 @@ import ElTableColumnEdit from '../components/Table/ElTableColumnEdit.vue'
|
|
|
15
15
|
import vKeydown from '../directives/vKeydown'
|
|
16
16
|
import ElAutoToolTip from '../components/autoToolTip/ElAutoToolTip.vue'
|
|
17
17
|
import userSelect from '../components/business/userSelect.vue'
|
|
18
|
+
import baseEcharts from '../components/baseEcharts/index.vue'
|
|
18
19
|
//@ts-ignore
|
|
19
20
|
export const globalMixin = {
|
|
20
21
|
components: {
|
|
@@ -26,7 +27,9 @@ export const globalMixin = {
|
|
|
26
27
|
ElIconBtn,
|
|
27
28
|
ElIconSearch,
|
|
28
29
|
ElTableColumnEdit,
|
|
29
|
-
ElAutoToolTip,
|
|
30
|
+
ElAutoToolTip,
|
|
31
|
+
userSelect,
|
|
32
|
+
baseEcharts,
|
|
30
33
|
},
|
|
31
34
|
directives: {
|
|
32
35
|
keydown: vKeydown,
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建人 胡啸东
|
|
3
|
+
* 说明: echartsConfig
|
|
4
|
+
* 创建时间: 2024/11/4 下午4:50
|
|
5
|
+
* 修改时间: 2024/11/4 下午4:50
|
|
6
|
+
*/
|
|
7
|
+
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
|
|
8
|
+
import * as echarts from 'echarts/core'
|
|
9
|
+
//
|
|
10
|
+
// 引入内置组件,组件后缀都为Component
|
|
11
|
+
import {
|
|
12
|
+
TitleComponent,
|
|
13
|
+
TooltipComponent,
|
|
14
|
+
GridComponent,
|
|
15
|
+
PolarComponent,
|
|
16
|
+
AriaComponent,
|
|
17
|
+
ParallelComponent,
|
|
18
|
+
LegendComponent,
|
|
19
|
+
RadarComponent,
|
|
20
|
+
ToolboxComponent,
|
|
21
|
+
DatasetComponent, // 数据集组件
|
|
22
|
+
DataZoomComponent,
|
|
23
|
+
VisualMapComponent,
|
|
24
|
+
TimelineComponent,
|
|
25
|
+
CalendarComponent,
|
|
26
|
+
GraphicComponent,
|
|
27
|
+
TransformComponent, // 数据转换器组件(filter, sort)
|
|
28
|
+
} from 'echarts/components'
|
|
29
|
+
|
|
30
|
+
// 引入渲染器:echarst默认使用canvas渲染,引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
|
|
31
|
+
import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'
|
|
32
|
+
|
|
33
|
+
// 标签自动布局、全局过渡动画等特性
|
|
34
|
+
import { LabelLayout, UniversalTransition } from 'echarts/features'
|
|
35
|
+
|
|
36
|
+
// 引入图表类型,后缀都为Chart
|
|
37
|
+
import {
|
|
38
|
+
BarChart,
|
|
39
|
+
LineChart,
|
|
40
|
+
PieChart,
|
|
41
|
+
MapChart,
|
|
42
|
+
RadarChart,
|
|
43
|
+
PictorialBarChart,
|
|
44
|
+
} from 'echarts/charts'
|
|
45
|
+
|
|
46
|
+
// 注册必须的组件
|
|
47
|
+
echarts.use([
|
|
48
|
+
// 内置组件
|
|
49
|
+
TitleComponent,
|
|
50
|
+
TooltipComponent,
|
|
51
|
+
GridComponent,
|
|
52
|
+
PolarComponent,
|
|
53
|
+
AriaComponent,
|
|
54
|
+
ParallelComponent,
|
|
55
|
+
LegendComponent,
|
|
56
|
+
RadarComponent,
|
|
57
|
+
ToolboxComponent,
|
|
58
|
+
DatasetComponent,
|
|
59
|
+
DataZoomComponent,
|
|
60
|
+
VisualMapComponent,
|
|
61
|
+
TimelineComponent,
|
|
62
|
+
CalendarComponent,
|
|
63
|
+
GraphicComponent,
|
|
64
|
+
TransformComponent,
|
|
65
|
+
// 渲染器
|
|
66
|
+
CanvasRenderer,
|
|
67
|
+
SVGRenderer,
|
|
68
|
+
// 特性
|
|
69
|
+
LabelLayout,
|
|
70
|
+
UniversalTransition,
|
|
71
|
+
// 图表
|
|
72
|
+
BarChart,
|
|
73
|
+
LineChart,
|
|
74
|
+
PieChart,
|
|
75
|
+
MapChart,
|
|
76
|
+
RadarChart,
|
|
77
|
+
PictorialBarChart,
|
|
78
|
+
])
|
|
79
|
+
|
|
80
|
+
export default echarts
|