adtec-core-package 0.3.4 → 0.3.5
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
|
@@ -45,14 +45,16 @@ const is_retract = ref(false)
|
|
|
45
45
|
const ref_div = ref()
|
|
46
46
|
const windowContent = useWindowSize()
|
|
47
47
|
const collapsed = inject<boolean>('collapsed')
|
|
48
|
-
const collapsedSearch=ref<boolean
|
|
48
|
+
const collapsedSearch=ref<boolean>(false)
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
50
|
//@ts-expect-error
|
|
51
51
|
watch(collapsed, () => {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
//@ts-ignore
|
|
53
|
+
collapsedSearch.value = collapsed.value
|
|
54
|
+
// calculation()
|
|
54
55
|
})
|
|
55
56
|
watch(collapsedSearch, () => {
|
|
57
|
+
console.log("collapsedSearch")
|
|
56
58
|
calculation()
|
|
57
59
|
})
|
|
58
60
|
watch(windowContent.width, () => {
|
|
@@ -110,7 +112,9 @@ const emit = defineEmits<{
|
|
|
110
112
|
(event: 'search'): void
|
|
111
113
|
}>()
|
|
112
114
|
onMounted(() => {
|
|
113
|
-
|
|
115
|
+
//ts-ignore
|
|
116
|
+
//@ts-expect-error
|
|
117
|
+
collapsedSearch.value = collapsed.value
|
|
114
118
|
//@ts-ignore
|
|
115
119
|
window.$wujie?.bus.$on("collapsedChangeBus", (val:boolean) => {
|
|
116
120
|
collapsedSearch.value=val
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script lang="ts" setup>
|
|
16
|
-
import { onMounted, ref, watch
|
|
17
|
-
import {
|
|
16
|
+
import { onMounted, type PropType, ref, watch } from 'vue'
|
|
17
|
+
import { type EChartsCoreOption, useEcharts } from '../../hooks/useEcharts.ts' // 引入hooks
|
|
18
18
|
const props = defineProps({
|
|
19
19
|
options: { type: Object as PropType<EChartsCoreOption>, required: true },
|
|
20
20
|
height: { type: String, default: '100%' },
|
|
@@ -6,22 +6,22 @@ import { dictStore } from '../stores/dictStore'
|
|
|
6
6
|
|
|
7
7
|
export default function useDictHooks(dictTypes?: string[]) {
|
|
8
8
|
const dictStores = dictStore()
|
|
9
|
-
const { dictMap, dictDefaultValueMap } = storeToRefs(dictStores)
|
|
9
|
+
const { dictMap, dictDefaultValueMap,dictDataMap } = storeToRefs(dictStores)
|
|
10
10
|
const getDict = async (dictTypes: string[]) => {
|
|
11
11
|
try {
|
|
12
12
|
if (!dictTypes || !dictTypes.length) return
|
|
13
13
|
// 判断是否存在缓存数据,如果存在则不请求接口
|
|
14
|
-
const dictKeySet = new Set(Object.keys(
|
|
14
|
+
const dictKeySet = new Set(Object.keys(dictMap.value))
|
|
15
15
|
const uncachedDictTypes = dictTypes.filter((dictType) => !dictKeySet.has(dictType))
|
|
16
16
|
if (!uncachedDictTypes.length) return
|
|
17
17
|
const data = await SysDictCacheApi.batchGetSysDictDataCacheVo(uncachedDictTypes)
|
|
18
|
-
|
|
18
|
+
dictMap.value = { ...dictMap.value, ...data }
|
|
19
19
|
// 获取默认值
|
|
20
20
|
Object.keys(data).forEach((item: string) => {
|
|
21
21
|
findDefaultValue(data[item], item)
|
|
22
22
|
const dataMap = new Map<string, ISysDictDataCacheVo>()
|
|
23
23
|
packageDictDataMap(dataMap, data[item])
|
|
24
|
-
|
|
24
|
+
dictDataMap.value.set(item, dataMap)
|
|
25
25
|
})
|
|
26
26
|
} catch (error: any) {
|
|
27
27
|
ElMessage.error(error.msg || error.message)
|
|
@@ -42,7 +42,7 @@ export default function useDictHooks(dictTypes?: string[]) {
|
|
|
42
42
|
|
|
43
43
|
const findDefaultValue = async (list: ISysDictDataCacheVo[], type: string) => {
|
|
44
44
|
const find = getDefaultValue(list)
|
|
45
|
-
find &&
|
|
45
|
+
find && dictDefaultValueMap.value.set(type, find)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const getDefaultValue = (list?: ISysDictDataCacheVo[]): ISysDictDataCacheVo | undefined => {
|
|
@@ -57,11 +57,11 @@ export default function useDictHooks(dictTypes?: string[]) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const getDictName = (value?: string, dictType?: string) => {
|
|
60
|
-
return
|
|
60
|
+
return dictDataMap.value.get(dictType!)?.get(value!)?.label || value
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const getDictData = (value: string, dictType: string) => {
|
|
64
|
-
return
|
|
64
|
+
return dictDataMap.value.get(dictType)?.get(value)
|
|
65
65
|
}
|
|
66
66
|
if (dictTypes && dictTypes.length) {
|
|
67
67
|
getDict(dictTypes).then(() => {})
|
package/src/hooks/useEcharts.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* 创建时间: 2024/11/4 下午4:51
|
|
5
5
|
* 修改时间: 2024/11/4 下午4:51
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import type { Ref } from 'vue'
|
|
8
|
+
import { onBeforeUnmount, onDeactivated, onMounted, shallowRef, unref } from 'vue'
|
|
9
9
|
import echarts from '../plugins/echartsConfig.ts'
|
|
10
10
|
|
|
11
11
|
export type EChartsCoreOption = echarts.EChartsCoreOption
|
|
@@ -51,7 +51,7 @@ const useEcharts = (elRef: Ref<HTMLDivElement>, options: EChartsCoreOption) => {
|
|
|
51
51
|
return {
|
|
52
52
|
initCharts,
|
|
53
53
|
setOptions,
|
|
54
|
-
resize
|
|
54
|
+
resize,
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -9,22 +9,22 @@ import * as echarts from 'echarts/core'
|
|
|
9
9
|
//
|
|
10
10
|
// 引入内置组件,组件后缀都为Component
|
|
11
11
|
import {
|
|
12
|
-
TitleComponent,
|
|
13
|
-
TooltipComponent,
|
|
14
|
-
GridComponent,
|
|
15
|
-
PolarComponent,
|
|
16
12
|
AriaComponent,
|
|
17
|
-
|
|
13
|
+
CalendarComponent,
|
|
14
|
+
DatasetComponent,
|
|
15
|
+
DataZoomComponent,
|
|
16
|
+
GraphicComponent,
|
|
17
|
+
GridComponent,
|
|
18
18
|
LegendComponent,
|
|
19
|
+
ParallelComponent,
|
|
20
|
+
PolarComponent,
|
|
19
21
|
RadarComponent,
|
|
20
|
-
ToolboxComponent,
|
|
21
|
-
DatasetComponent, // 数据集组件
|
|
22
|
-
DataZoomComponent,
|
|
23
|
-
VisualMapComponent,
|
|
24
22
|
TimelineComponent,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
TitleComponent,
|
|
24
|
+
ToolboxComponent,
|
|
25
|
+
TooltipComponent,
|
|
26
|
+
TransformComponent,
|
|
27
|
+
VisualMapComponent
|
|
28
28
|
} from 'echarts/components'
|
|
29
29
|
|
|
30
30
|
// 引入渲染器:echarst默认使用canvas渲染,引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
|
|
@@ -34,14 +34,7 @@ import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'
|
|
|
34
34
|
import { LabelLayout, UniversalTransition } from 'echarts/features'
|
|
35
35
|
|
|
36
36
|
// 引入图表类型,后缀都为Chart
|
|
37
|
-
import {
|
|
38
|
-
BarChart,
|
|
39
|
-
LineChart,
|
|
40
|
-
PieChart,
|
|
41
|
-
MapChart,
|
|
42
|
-
RadarChart,
|
|
43
|
-
PictorialBarChart,
|
|
44
|
-
} from 'echarts/charts'
|
|
37
|
+
import { BarChart, LineChart, MapChart, PictorialBarChart, PieChart, RadarChart } from 'echarts/charts'
|
|
45
38
|
|
|
46
39
|
// 注册必须的组件
|
|
47
40
|
echarts.use([
|