@jetlinks-web/components 1.0.1 → 1.0.2
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 +9 -9
- package/src/AMap/Map.vue +2 -2
- package/src/Echarts/Echarts.vue +43 -43
- package/src/GeoComponent/GeoComponent.vue +139 -139
- package/src/PermissionButton/hooks.ts +1 -1
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetlinks-web/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"module": "index.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"clean": "pnpm rimraf node_modules && pnpm rimraf .turbo"
|
|
9
|
-
},
|
|
10
7
|
"keywords": [],
|
|
11
8
|
"files": [
|
|
12
9
|
"src",
|
|
@@ -16,9 +13,6 @@
|
|
|
16
13
|
"author": "",
|
|
17
14
|
"license": "ISC",
|
|
18
15
|
"dependencies": {
|
|
19
|
-
"@jetlinks-web/hooks": "workspace:^",
|
|
20
|
-
"@jetlinks-web/stores": "workspace:^",
|
|
21
|
-
"@jetlinks-web/utils": "workspace:^",
|
|
22
16
|
"@vuemap/vue-amap": "^2.0.17",
|
|
23
17
|
"@vueuse/core": "^10.2.1",
|
|
24
18
|
"ant-design-vue": "^3.2.20",
|
|
@@ -26,10 +20,16 @@
|
|
|
26
20
|
"lodash-es": "^4.17.21",
|
|
27
21
|
"pinia": "^2.1.6",
|
|
28
22
|
"vue": "^3.3.4",
|
|
29
|
-
"vue-router": "^4.2.4"
|
|
23
|
+
"vue-router": "^4.2.4",
|
|
24
|
+
"@jetlinks-web/hooks": "^1.0.3",
|
|
25
|
+
"@jetlinks-web/utils": "^1.0.2",
|
|
26
|
+
"@jetlinks-web/stores": "^1.0.1"
|
|
30
27
|
},
|
|
31
28
|
"publishConfig": {
|
|
32
29
|
"registry": "https://registry.npmjs.org/",
|
|
33
30
|
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "pnpm rimraf node_modules && pnpm rimraf .turbo"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|
package/src/AMap/Map.vue
CHANGED
|
@@ -33,8 +33,8 @@ import type { CSSProperties, PropType } from 'vue';
|
|
|
33
33
|
import { ref, computed } from 'vue'
|
|
34
34
|
import { initAMapApiLoader, ElAmap } from '@vuemap/vue-amap';
|
|
35
35
|
import '@vuemap/vue-amap/dist/style.css';
|
|
36
|
-
import { store } from '@jetlinks/stores'
|
|
37
|
-
import { getAMapUiPromise } from '@jetlinks/utils'
|
|
36
|
+
import { store } from '@jetlinks-web/stores'
|
|
37
|
+
import { getAMapUiPromise } from '@jetlinks-web/utils'
|
|
38
38
|
import { MapProps } from './util'
|
|
39
39
|
interface AMapProps {
|
|
40
40
|
style?: CSSProperties;
|
package/src/Echarts/Echarts.vue
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="echartsDom" class="echarts-warp" :style="style"></div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script lang="ts" name="Echarts" setup>
|
|
6
|
-
import { CSSProperties, nextTick, ref, watch, Ref } from 'vue'
|
|
7
|
-
import { useECharts } from '@jetlinks/hooks'
|
|
8
|
-
|
|
9
|
-
interface Props {
|
|
10
|
-
style?: CSSProperties
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
options: {
|
|
15
|
-
type: Object,
|
|
16
|
-
default: undefined,
|
|
17
|
-
},
|
|
18
|
-
style: Object as PropType<Props['style']>,
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const echartsDom = ref<Ref<HTMLDivElement> | HTMLDivElement>()
|
|
22
|
-
|
|
23
|
-
const { setOptions } = useECharts(echartsDom.value)
|
|
24
|
-
|
|
25
|
-
watch(
|
|
26
|
-
() => props.options,
|
|
27
|
-
() => {
|
|
28
|
-
if (props.options) {
|
|
29
|
-
nextTick(() => {
|
|
30
|
-
setOptions(props.options)
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{ immediate: true, deep: true },
|
|
35
|
-
)
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<style scoped>
|
|
39
|
-
.echarts-warp {
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="echartsDom" class="echarts-warp" :style="style"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script lang="ts" name="Echarts" setup>
|
|
6
|
+
import { CSSProperties, nextTick, ref, watch, Ref } from 'vue'
|
|
7
|
+
import { useECharts } from '@jetlinks-web/hooks'
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
style?: CSSProperties
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
options: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: undefined,
|
|
17
|
+
},
|
|
18
|
+
style: Object as PropType<Props['style']>,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const echartsDom = ref<Ref<HTMLDivElement> | HTMLDivElement>()
|
|
22
|
+
|
|
23
|
+
const { setOptions } = useECharts(echartsDom.value)
|
|
24
|
+
|
|
25
|
+
watch(
|
|
26
|
+
() => props.options,
|
|
27
|
+
() => {
|
|
28
|
+
if (props.options) {
|
|
29
|
+
nextTick(() => {
|
|
30
|
+
setOptions(props.options)
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{ immediate: true, deep: true },
|
|
35
|
+
)
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
.echarts-warp {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
<!-- 坐标点拾取组件 -->
|
|
2
|
-
<template>
|
|
3
|
-
<div class="page-container">
|
|
4
|
-
<j-input allowClear v-bind="props" v-model:value="inputPoint">
|
|
5
|
-
<template #addonAfter>
|
|
6
|
-
<AIcon type="EnvironmentOutlined" @click="modalVisible = true" />
|
|
7
|
-
</template>
|
|
8
|
-
</j-input>
|
|
9
|
-
<j-modal
|
|
10
|
-
title="地理位置"
|
|
11
|
-
ok-text="确认"
|
|
12
|
-
cancel-text="取消"
|
|
13
|
-
v-model:visible="modalVisible"
|
|
14
|
-
width="700px"
|
|
15
|
-
@cancel="modalVisible = false"
|
|
16
|
-
@ok="handleModalSubmit"
|
|
17
|
-
destroyOnClose
|
|
18
|
-
>
|
|
19
|
-
<div style="width: 100%; height: 400px">
|
|
20
|
-
<div style="margin-bottom: 10px;">地理位置:{{ mapPoint }}</div>
|
|
21
|
-
<el-amap
|
|
22
|
-
:center="_center"
|
|
23
|
-
:zoom="_zoom"
|
|
24
|
-
@init="initMap"
|
|
25
|
-
@click="clickMap"
|
|
26
|
-
>
|
|
27
|
-
<el-amap-search-box visible @select="selectPosition" />
|
|
28
|
-
<el-amap-marker :position="position" />
|
|
29
|
-
</el-amap>
|
|
30
|
-
</div>
|
|
31
|
-
</j-modal>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script setup lang="ts">
|
|
36
|
-
import { store } from '@jetlinks/stores'
|
|
37
|
-
import { initAMapApiLoader } from '@vuemap/vue-amap'
|
|
38
|
-
import '@vuemap/vue-amap/dist/style.css'
|
|
39
|
-
import { computed, CSSProperties, PropType, ref } from 'vue'
|
|
40
|
-
|
|
41
|
-
interface AMapProps {
|
|
42
|
-
style?: CSSProperties
|
|
43
|
-
class?: string
|
|
44
|
-
AMapUI?: string | boolean
|
|
45
|
-
plugins?: string[]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const systemStore = store.SystemStore
|
|
49
|
-
|
|
50
|
-
const amapKey = systemStore.systemInfo.apiKey
|
|
51
|
-
|
|
52
|
-
interface EmitProps {
|
|
53
|
-
(e: 'update:point', data: string): void
|
|
54
|
-
(e: 'change', data: string): void
|
|
55
|
-
}
|
|
56
|
-
const props = defineProps({
|
|
57
|
-
style: Object as PropType<AMapProps['style']>,
|
|
58
|
-
class: String as PropType<AMapProps['class']>,
|
|
59
|
-
AMapUI: [String, Boolean],
|
|
60
|
-
center: Array as PropType<number[]>,
|
|
61
|
-
plugin: Array,
|
|
62
|
-
zoom: {
|
|
63
|
-
type: Number,
|
|
64
|
-
default: 12,
|
|
65
|
-
},
|
|
66
|
-
securityJsCode: String,
|
|
67
|
-
point: { type: [Number, String], default: '' },
|
|
68
|
-
})
|
|
69
|
-
const emit = defineEmits<EmitProps>()
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
initAMapApiLoader({
|
|
73
|
-
key: amapKey,
|
|
74
|
-
securityJsCode: props.securityJsCode
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
// 手动输入的坐标点(经纬度字符串)
|
|
78
|
-
const inputPoint = computed({
|
|
79
|
-
get: () => {
|
|
80
|
-
return props.point
|
|
81
|
-
},
|
|
82
|
-
set: (val: any) => {
|
|
83
|
-
mapPoint.value = val
|
|
84
|
-
emit('update:point', val)
|
|
85
|
-
emit('change', val)
|
|
86
|
-
},
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
// 地图弹窗
|
|
90
|
-
const modalVisible = ref<boolean>(false)
|
|
91
|
-
|
|
92
|
-
const handleModalSubmit = () => {
|
|
93
|
-
inputPoint.value = mapPoint.value
|
|
94
|
-
modalVisible.value = false
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// 地图拾取的坐标点(经纬度字符串)
|
|
98
|
-
const mapPoint = ref('')
|
|
99
|
-
|
|
100
|
-
const _zoom = ref<number>(props.zoom)
|
|
101
|
-
const _center = ref<number[]>(props?.center || [])
|
|
102
|
-
let map: any = null
|
|
103
|
-
|
|
104
|
-
// 地图经纬度
|
|
105
|
-
const position = ref<number[] | string[]>([])
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* 地图初始化
|
|
109
|
-
* @param e
|
|
110
|
-
*/
|
|
111
|
-
const initMap = (e: any) => {
|
|
112
|
-
map = e
|
|
113
|
-
|
|
114
|
-
const pointStr = mapPoint.value as string
|
|
115
|
-
position.value = pointStr ? pointStr.split(',') : _center.value
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* 地图点击
|
|
120
|
-
* @param e
|
|
121
|
-
*/
|
|
122
|
-
const clickMap = (e: any) => {
|
|
123
|
-
mapPoint.value = `${e.lnglat.lng},${e.lnglat.lat}`
|
|
124
|
-
position.value = [e.lnglat.lng, e.lnglat.lat]
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* 选择搜索结果
|
|
129
|
-
* @param e
|
|
130
|
-
*/
|
|
131
|
-
const selectPosition = (e: any) => {
|
|
132
|
-
const selectPoint = [e.poi.location.lng, e.poi.location.lat]
|
|
133
|
-
map.setCenter(selectPoint)
|
|
134
|
-
mapPoint.value = selectPoint.join(',')
|
|
135
|
-
position.value = selectPoint
|
|
136
|
-
}
|
|
137
|
-
</script>
|
|
138
|
-
|
|
139
|
-
<style lang="less" scoped></style>
|
|
1
|
+
<!-- 坐标点拾取组件 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="page-container">
|
|
4
|
+
<j-input allowClear v-bind="props" v-model:value="inputPoint">
|
|
5
|
+
<template #addonAfter>
|
|
6
|
+
<AIcon type="EnvironmentOutlined" @click="modalVisible = true" />
|
|
7
|
+
</template>
|
|
8
|
+
</j-input>
|
|
9
|
+
<j-modal
|
|
10
|
+
title="地理位置"
|
|
11
|
+
ok-text="确认"
|
|
12
|
+
cancel-text="取消"
|
|
13
|
+
v-model:visible="modalVisible"
|
|
14
|
+
width="700px"
|
|
15
|
+
@cancel="modalVisible = false"
|
|
16
|
+
@ok="handleModalSubmit"
|
|
17
|
+
destroyOnClose
|
|
18
|
+
>
|
|
19
|
+
<div style="width: 100%; height: 400px">
|
|
20
|
+
<div style="margin-bottom: 10px;">地理位置:{{ mapPoint }}</div>
|
|
21
|
+
<el-amap
|
|
22
|
+
:center="_center"
|
|
23
|
+
:zoom="_zoom"
|
|
24
|
+
@init="initMap"
|
|
25
|
+
@click="clickMap"
|
|
26
|
+
>
|
|
27
|
+
<el-amap-search-box visible @select="selectPosition" />
|
|
28
|
+
<el-amap-marker :position="position" />
|
|
29
|
+
</el-amap>
|
|
30
|
+
</div>
|
|
31
|
+
</j-modal>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { store } from '@jetlinks-web/stores'
|
|
37
|
+
import { initAMapApiLoader } from '@vuemap/vue-amap'
|
|
38
|
+
import '@vuemap/vue-amap/dist/style.css'
|
|
39
|
+
import { computed, CSSProperties, PropType, ref } from 'vue'
|
|
40
|
+
|
|
41
|
+
interface AMapProps {
|
|
42
|
+
style?: CSSProperties
|
|
43
|
+
class?: string
|
|
44
|
+
AMapUI?: string | boolean
|
|
45
|
+
plugins?: string[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const systemStore = store.SystemStore
|
|
49
|
+
|
|
50
|
+
const amapKey = systemStore.systemInfo.apiKey
|
|
51
|
+
|
|
52
|
+
interface EmitProps {
|
|
53
|
+
(e: 'update:point', data: string): void
|
|
54
|
+
(e: 'change', data: string): void
|
|
55
|
+
}
|
|
56
|
+
const props = defineProps({
|
|
57
|
+
style: Object as PropType<AMapProps['style']>,
|
|
58
|
+
class: String as PropType<AMapProps['class']>,
|
|
59
|
+
AMapUI: [String, Boolean],
|
|
60
|
+
center: Array as PropType<number[]>,
|
|
61
|
+
plugin: Array,
|
|
62
|
+
zoom: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 12,
|
|
65
|
+
},
|
|
66
|
+
securityJsCode: String,
|
|
67
|
+
point: { type: [Number, String], default: '' },
|
|
68
|
+
})
|
|
69
|
+
const emit = defineEmits<EmitProps>()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
initAMapApiLoader({
|
|
73
|
+
key: amapKey,
|
|
74
|
+
securityJsCode: props.securityJsCode
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// 手动输入的坐标点(经纬度字符串)
|
|
78
|
+
const inputPoint = computed({
|
|
79
|
+
get: () => {
|
|
80
|
+
return props.point
|
|
81
|
+
},
|
|
82
|
+
set: (val: any) => {
|
|
83
|
+
mapPoint.value = val
|
|
84
|
+
emit('update:point', val)
|
|
85
|
+
emit('change', val)
|
|
86
|
+
},
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// 地图弹窗
|
|
90
|
+
const modalVisible = ref<boolean>(false)
|
|
91
|
+
|
|
92
|
+
const handleModalSubmit = () => {
|
|
93
|
+
inputPoint.value = mapPoint.value
|
|
94
|
+
modalVisible.value = false
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 地图拾取的坐标点(经纬度字符串)
|
|
98
|
+
const mapPoint = ref('')
|
|
99
|
+
|
|
100
|
+
const _zoom = ref<number>(props.zoom)
|
|
101
|
+
const _center = ref<number[]>(props?.center || [])
|
|
102
|
+
let map: any = null
|
|
103
|
+
|
|
104
|
+
// 地图经纬度
|
|
105
|
+
const position = ref<number[] | string[]>([])
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 地图初始化
|
|
109
|
+
* @param e
|
|
110
|
+
*/
|
|
111
|
+
const initMap = (e: any) => {
|
|
112
|
+
map = e
|
|
113
|
+
|
|
114
|
+
const pointStr = mapPoint.value as string
|
|
115
|
+
position.value = pointStr ? pointStr.split(',') : _center.value
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 地图点击
|
|
120
|
+
* @param e
|
|
121
|
+
*/
|
|
122
|
+
const clickMap = (e: any) => {
|
|
123
|
+
mapPoint.value = `${e.lnglat.lng},${e.lnglat.lat}`
|
|
124
|
+
position.value = [e.lnglat.lng, e.lnglat.lat]
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 选择搜索结果
|
|
129
|
+
* @param e
|
|
130
|
+
*/
|
|
131
|
+
const selectPosition = (e: any) => {
|
|
132
|
+
const selectPoint = [e.poi.location.lng, e.poi.location.lat]
|
|
133
|
+
map.setCenter(selectPoint)
|
|
134
|
+
mapPoint.value = selectPoint.join(',')
|
|
135
|
+
position.value = selectPoint
|
|
136
|
+
}
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<style lang="less" scoped></style>
|