web-component-gallery 1.3.12 → 2.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/dist/923.umd.js +1 -0
- package/dist/index.umd.js +1 -12252
- package/dist/js.umd.js +1 -0
- package/dist/style.css +17 -0
- package/dist/style.umd.js +1 -0
- package/{method → extensions}/AMap.js +1 -5
- package/{plugins/method → extensions}/Dialog.js +2 -2
- package/{lib/lazy_use.js → extensions/index.js} +16 -2
- package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
- package/lib/amap-comp/index.js +18 -0
- package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
- package/lib/amap-comp/style/index.js +1 -0
- package/lib/amap-comp/style/index.less +1 -0
- package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
- package/lib/amap-draw/style/index.js +1 -0
- package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
- package/lib/browse/index.jsx +0 -2
- package/lib/browse/style/index.js +1 -0
- package/lib/button/Button.js +1 -3
- package/lib/button/style/index.js +1 -0
- package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
- package/lib/date-time/style/index.js +1 -0
- package/lib/date-time/style/index.less +7 -0
- package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
- package/lib/descriptions-list/style/index.js +1 -0
- package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
- package/lib/directory/index.js +8 -0
- package/lib/directory/style/index.js +1 -0
- package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
- package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
- package/lib/form-comp/ARadio.vue +70 -0
- package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
- package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
- package/lib/form-comp/ATagsInput.vue +88 -0
- package/lib/form-comp/ATimePicker.vue +127 -0
- package/lib/{form/components → form-comp}/AUpload.vue +2 -17
- package/lib/form-comp/index.js +37 -0
- package/lib/form-comp/style/ACascaderMultiple.less +117 -0
- package/lib/form-comp/style/ARadio.less +0 -0
- package/lib/form-comp/style/ARangePicker.less +11 -0
- package/lib/form-comp/style/ASelectCustom.less +4 -0
- package/lib/form-comp/style/ATagsInput.less +24 -0
- package/lib/form-comp/style/ATimePicker.less +8 -0
- package/lib/form-comp/style/AUpload.less +15 -0
- package/lib/form-comp/style/index.js +1 -0
- package/lib/form-comp/style/index.less +7 -0
- package/lib/index.js +60 -45
- package/lib/modal/index.jsx +4 -6
- package/lib/modal/style/index.js +1 -0
- package/lib/modal/{index.less → style/index.less} +6 -7
- package/{plugins/lib/form → lib/model}/Model.js +1 -3
- package/lib/model/index.js +7 -0
- package/lib/model/style/index.js +1 -0
- package/lib/{form/style/Model.less → model/style/index.less} +10 -10
- package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
- package/lib/{form → model}/utils/resetFields.js +1 -1
- package/lib/no-data/directive.js +65 -0
- package/lib/no-data/index.js +21 -0
- package/lib/no-data/index.vue +35 -0
- package/lib/no-data/style/index.js +1 -0
- package/lib/no-data/style/index.less +15 -0
- package/lib/search/index.js +7 -0
- package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
- package/lib/search/style/index.js +1 -0
- package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
- package/lib/style/mixins.less +1 -1
- package/lib/{svgIcon → svg-icon}/index.vue +1 -17
- package/lib/svg-icon/style/index.js +1 -0
- package/lib/svg-icon/style/index.less +15 -0
- package/lib/table/index.vue +4 -8
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/index.less +12 -13
- package/lib/tree/index.js +2 -11
- package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
- package/lib/tree/style/index.js +1 -0
- package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
- package/lib/weather/index.vue +1 -9
- package/lib/weather/style/index.js +1 -0
- package/lib/weather/style/index.less +7 -0
- package/package.json +16 -34
- package/utils/Axios.js +91 -82
- package/utils/Postcss.js +12 -8
- package/README.md +0 -24
- package/dist/amap.umd.js +0 -12252
- package/dist/avatar.umd.js +0 -5337
- package/dist/button.umd.js +0 -5845
- package/dist/dateTime.umd.js +0 -1287
- package/dist/form.umd.js +0 -9981
- package/dist/multiTab.umd.js +0 -5556
- package/dist/svgIcon.umd.js +0 -1167
- package/dist/table.umd.js +0 -6306
- package/dist/tree.umd.js +0 -5393
- package/dist/weather.umd.js +0 -1167
- package/lib/amap/components/AmapSearch/index.less +0 -16
- package/lib/amap/index.js +0 -13
- package/lib/avatar/index.js +0 -7
- package/lib/avatar/index.vue +0 -47
- package/lib/basic/404.vue +0 -24
- package/lib/dateTime/index.vue +0 -43
- package/lib/form/Model.js +0 -153
- package/lib/form/Search.vue +0 -159
- package/lib/form/components/ACascaderMultiple.vue +0 -766
- package/lib/form/components/ARadio.vue +0 -74
- package/lib/form/components/ATagsInput.vue +0 -93
- package/lib/form/components/ATimePicker.vue +0 -73
- package/lib/form/index.js +0 -55
- package/lib/form/style/Search.less +0 -34
- package/lib/form/utils/render.js +0 -85
- package/lib/iframe/events.js +0 -2
- package/lib/iframe/index.jsx +0 -234
- package/lib/iframe/index.less +0 -19
- package/lib/multiTab/APIEnums.js +0 -17
- package/lib/multiTab/MultiTab.jsx +0 -237
- package/lib/multiTab/RouteAPI.js +0 -71
- package/lib/multiTab/RouteContent.jsx +0 -90
- package/lib/multiTab/RouteKeepAlive.js +0 -183
- package/lib/multiTab/events.js +0 -2
- package/lib/multiTab/index.js +0 -15
- package/lib/multiTab/index.less +0 -73
- package/lib/style/index.less +0 -2
- package/lib/tree/Directory.js +0 -428
- package/lib/tree/Tree.vue +0 -181
- package/lib/tree/style/Tree.less +0 -52
- package/method/Dialog.js +0 -134
- package/method/index.js +0 -12
- package/plugins/lib/amap/AmapDraw.jsx +0 -349
- package/plugins/lib/amap/AmapDraw.less +0 -45
- package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
- package/plugins/lib/amap/index.js +0 -13
- package/plugins/lib/avatar/index.js +0 -7
- package/plugins/lib/avatar/index.vue +0 -47
- package/plugins/lib/basic/404.vue +0 -24
- package/plugins/lib/browse/index.jsx +0 -76
- package/plugins/lib/browse/index.less +0 -4
- package/plugins/lib/button/Button.js +0 -89
- package/plugins/lib/button/index.js +0 -7
- package/plugins/lib/dateTime/index.js +0 -7
- package/plugins/lib/descriptions/index.jsx +0 -108
- package/plugins/lib/descriptions/index.less +0 -15
- package/plugins/lib/form/components/ARadio.vue +0 -74
- package/plugins/lib/form/components/ARangePicker.vue +0 -129
- package/plugins/lib/form/components/ASelectCustom.vue +0 -226
- package/plugins/lib/form/components/ATagsInput.vue +0 -93
- package/plugins/lib/form/components/ATimePicker.vue +0 -73
- package/plugins/lib/form/components/AUpload.vue +0 -183
- package/plugins/lib/form/components/RenderComp.vue +0 -69
- package/plugins/lib/form/index.js +0 -55
- package/plugins/lib/form/style/Model.less +0 -53
- package/plugins/lib/form/utils/resetFields.js +0 -16
- package/plugins/lib/iframe/events.js +0 -2
- package/plugins/lib/iframe/index.jsx +0 -234
- package/plugins/lib/iframe/index.less +0 -19
- package/plugins/lib/index.js +0 -72
- package/plugins/lib/lazy_use.js +0 -40
- package/plugins/lib/modal/index.jsx +0 -53
- package/plugins/lib/modal/index.less +0 -50
- package/plugins/lib/multiTab/APIEnums.js +0 -17
- package/plugins/lib/multiTab/MultiTab.jsx +0 -237
- package/plugins/lib/multiTab/RouteAPI.js +0 -71
- package/plugins/lib/multiTab/RouteContent.jsx +0 -90
- package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
- package/plugins/lib/multiTab/events.js +0 -2
- package/plugins/lib/multiTab/index.js +0 -15
- package/plugins/lib/multiTab/index.less +0 -73
- package/plugins/lib/style/index.less +0 -2
- package/plugins/lib/style/mixins.less +0 -79
- package/plugins/lib/svgIcon/index.js +0 -7
- package/plugins/lib/svgIcon/index.vue +0 -77
- package/plugins/lib/table/index.js +0 -7
- package/plugins/lib/table/index.vue +0 -217
- package/plugins/lib/table/style/index.less +0 -50
- package/plugins/lib/tree/index.js +0 -17
- package/plugins/lib/tree/style/Directory.less +0 -119
- package/plugins/lib/weather/index.js +0 -7
- package/plugins/lib/weather/index.vue +0 -58
- package/plugins/method/AMap.js +0 -368
- package/plugins/method/PageLoading.jsx +0 -106
- package/plugins/method/Theme.js +0 -88
- package/plugins/method/index.js +0 -12
- package/plugins/store/auth.js +0 -31
- package/plugins/store/cache.js +0 -56
- package/plugins/store/chat.js +0 -74
- package/plugins/store/project.js +0 -46
- package/plugins/utils/Axios.js +0 -105
- package/plugins/utils/Base64.js +0 -314
- package/plugins/utils/Filter.js +0 -249
- package/plugins/utils/PostMessage.js +0 -16
- package/plugins/utils/Postcss.js +0 -9
- package/plugins/utils/Rem.js +0 -24
- package/plugins/utils/Request.js +0 -38
- package/plugins/utils/Storage.js +0 -73
- package/plugins/utils/Tree.js +0 -169
- package/plugins/utils/Utils.js +0 -51
- package/plugins/utils/Validate.js +0 -33
- package/plugins/utils/Websocket.js +0 -186
- package/utils/PostMessage.js +0 -16
- package/utils/Request.js +0 -38
- /package/{method → extensions}/PageLoading.jsx +0 -0
- /package/{method → extensions}/Theme.js +0 -0
- /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
- /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
- /package/{plugins/font → font}/PingFang SC.ttf +0 -0
- /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
- /package/{plugins/font → font}/font.css +0 -0
- /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
- /package/lib/browse/{index.less → style/index.less} +0 -0
- /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
- /package/lib/{dateTime → date-time}/index.js +0 -0
- /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
- /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
- /package/lib/{svgIcon → svg-icon}/index.js +0 -0
package/method/Dialog.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import Modal from 'ant-design-vue/es/modal'
|
|
2
|
-
import {Brower} from './lib/index.js'
|
|
3
|
-
|
|
4
|
-
const defaultComponents = {
|
|
5
|
-
Brower
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default Vue => {
|
|
9
|
-
function dialog(component, componentProps, modalProps) {
|
|
10
|
-
const _vm = this
|
|
11
|
-
if (!_vm || !_vm._isVue) {
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
let dialogDiv = document.querySelector('body>div[type=dialog]')
|
|
15
|
-
if (!dialogDiv) {
|
|
16
|
-
dialogDiv = document.createElement('div')
|
|
17
|
-
dialogDiv.setAttribute('type', 'dialog')
|
|
18
|
-
document.body.appendChild(dialogDiv)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const handle = function (checkFunction, afterHandel) {
|
|
22
|
-
if (checkFunction instanceof Function) {
|
|
23
|
-
const res = checkFunction()
|
|
24
|
-
if (res instanceof Promise) {
|
|
25
|
-
res.then(c => {
|
|
26
|
-
c && afterHandel()
|
|
27
|
-
})
|
|
28
|
-
} else {
|
|
29
|
-
res && afterHandel()
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
// checkFunction && afterHandel()
|
|
33
|
-
checkFunction || afterHandel()
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const dialogInstance = new Vue({
|
|
38
|
-
data() {
|
|
39
|
-
return {
|
|
40
|
-
visible: true
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
router: _vm.$router,
|
|
44
|
-
store: _vm.$store,
|
|
45
|
-
mounted() {
|
|
46
|
-
this.$on('close', () => {
|
|
47
|
-
this.handleClose()
|
|
48
|
-
})
|
|
49
|
-
},
|
|
50
|
-
methods: {
|
|
51
|
-
handleClose() {
|
|
52
|
-
handle(this.$refs._component.onCancel, () => {
|
|
53
|
-
this.visible = false
|
|
54
|
-
this.$refs._component.$emit('close')
|
|
55
|
-
this.$refs._component.$emit('cancel')
|
|
56
|
-
dialogInstance.$destroy()
|
|
57
|
-
})
|
|
58
|
-
},
|
|
59
|
-
handleOk() {
|
|
60
|
-
handle(this.$refs._component.onOK || this.$refs._component.onOk, () => {
|
|
61
|
-
this.visible = false
|
|
62
|
-
this.$refs._component.$emit('close')
|
|
63
|
-
this.$refs._component.$emit('ok')
|
|
64
|
-
dialogInstance.$destroy()
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
render: function (h) {
|
|
69
|
-
const that = this
|
|
70
|
-
const modalModel = modalProps && modalProps.model
|
|
71
|
-
if (modalModel) {
|
|
72
|
-
delete modalProps.model
|
|
73
|
-
}
|
|
74
|
-
const ModalProps = Object.assign({}, (modalModel && { model: modalModel }) || {}, {
|
|
75
|
-
attrs: Object.assign(
|
|
76
|
-
{},
|
|
77
|
-
{
|
|
78
|
-
...(modalProps.attrs || modalProps)
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
visible: this.visible
|
|
82
|
-
}
|
|
83
|
-
),
|
|
84
|
-
on: Object.assign(
|
|
85
|
-
{},
|
|
86
|
-
{
|
|
87
|
-
...(modalProps.on || modalProps)
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
ok: () => {
|
|
91
|
-
that.handleOk()
|
|
92
|
-
},
|
|
93
|
-
cancel: () => {
|
|
94
|
-
that.handleClose()
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
const componentModel = componentProps && componentProps.model
|
|
101
|
-
if (componentModel) {
|
|
102
|
-
delete componentProps.model
|
|
103
|
-
}
|
|
104
|
-
const ComponentProps = Object.assign({}, (componentModel && { model: componentModel }) || {}, {
|
|
105
|
-
ref: '_component',
|
|
106
|
-
attrs: Object.assign(
|
|
107
|
-
{},
|
|
108
|
-
{
|
|
109
|
-
...((componentProps && componentProps.attrs) || componentProps)
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
on: Object.assign(
|
|
113
|
-
{},
|
|
114
|
-
{
|
|
115
|
-
...((componentProps && componentProps.on) || componentProps)
|
|
116
|
-
}
|
|
117
|
-
)
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
const componentContent = component instanceof String ? defaultComponents[ component ] : component
|
|
121
|
-
|
|
122
|
-
return h(Modal, ModalProps, [h(componentContent, ComponentProps)])
|
|
123
|
-
}
|
|
124
|
-
}).$mount(dialogDiv)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
Object.defineProperty(Vue.prototype, '$dialog', {
|
|
128
|
-
get: () => {
|
|
129
|
-
return function () {
|
|
130
|
-
dialog.apply(this, arguments)
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
}
|
package/method/index.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import AmapSearch from './components/AmapSearch/index.jsx'
|
|
2
|
-
import PropTypes from 'ant-design-vue/es/_util/vue-types'
|
|
3
|
-
import { getAMapInstance } from '../../method/AMap.js'
|
|
4
|
-
|
|
5
|
-
import './AmapDraw.less'
|
|
6
|
-
|
|
7
|
-
export const AmapDrawProps = {
|
|
8
|
-
/** drawEl为地图容器实例名称 */
|
|
9
|
-
drawEl: PropTypes.string.def('AmapDraw'),
|
|
10
|
-
/** drawType为绘制类型
|
|
11
|
-
* 可选值(point点 | line线 | polygon面)
|
|
12
|
-
*/
|
|
13
|
-
drawType: PropTypes.string.def('point'),
|
|
14
|
-
/** 绘制图标 (只在point类型下生效 */
|
|
15
|
-
drawIcon: PropTypes.any.def('http://api.qxfnkj.com:8090/poi/poi-marker-default.png'),
|
|
16
|
-
/** drawCount为绘制物绘制个数 */
|
|
17
|
-
drawCount: PropTypes.number.def(1),
|
|
18
|
-
/** drawOptions为绘制物配置项 */
|
|
19
|
-
drawOptions: PropTypes.object.def({}),
|
|
20
|
-
/** drawInfo为绘制物信息 */
|
|
21
|
-
drawInfo: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
22
|
-
/** drawInfoAll为所有不同类型绘制物信息(用于回显地图图层)
|
|
23
|
-
* 格式: { point: ([]||{}), line: ([]||{}) }
|
|
24
|
-
*/
|
|
25
|
-
drawInfoAll: PropTypes.object,
|
|
26
|
-
/** 限制区域 */
|
|
27
|
-
drawLimitArea: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
28
|
-
/** 限制区域样式配置 */
|
|
29
|
-
drawLimitAreaOptions: PropTypes.object.def({}),
|
|
30
|
-
/** 是否为纯地图展示数据 */
|
|
31
|
-
isExhibition: PropTypes.bool.def(false)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const AmapDraw = {
|
|
35
|
-
name: 'AmapDraw',
|
|
36
|
-
props: AmapDrawProps,
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
amap: null,
|
|
40
|
-
/** 地图存储商店 */
|
|
41
|
-
amapStore: null,
|
|
42
|
-
drawArea: null,
|
|
43
|
-
drawLayers: null,
|
|
44
|
-
drawMouseTool: null,
|
|
45
|
-
buttonProps: [],
|
|
46
|
-
drawButtonProps: [
|
|
47
|
-
{ type: 'primary', text: '绘制', event: { click: this.AmapDraw } },
|
|
48
|
-
{ text: '清除', event: { click: this.AmapDrawClear } }
|
|
49
|
-
],
|
|
50
|
-
saveButtonProps: [
|
|
51
|
-
{ type: 'primary', text: '保存', event: { click: this.AmapDrawSave } },
|
|
52
|
-
{ text: '取消', event: { click: this.AmapDrawReset } }
|
|
53
|
-
],
|
|
54
|
-
/** 地图类型 */
|
|
55
|
-
amapType: 0,
|
|
56
|
-
/** 卫星图 */
|
|
57
|
-
amapSatellite: null
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
computed: {
|
|
61
|
-
drawLayersInfo: {
|
|
62
|
-
get() {
|
|
63
|
-
return this.drawInfo
|
|
64
|
-
},
|
|
65
|
-
set(newValue) {
|
|
66
|
-
this.$emit('getAMapLayersInfo', newValue)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
watch: {
|
|
71
|
-
drawInfo: {
|
|
72
|
-
handler(newVal, oldVal) {
|
|
73
|
-
const newValue = this.drawLayersInfo
|
|
74
|
-
newVal && this.echoDrawLayers(this.drawType)
|
|
75
|
-
},
|
|
76
|
-
deep: true
|
|
77
|
-
},
|
|
78
|
-
drawInfoAll(newValue) {
|
|
79
|
-
newValue && this.echoDrawLayers()
|
|
80
|
-
},
|
|
81
|
-
drawOptions(newValue) {
|
|
82
|
-
/** 检测options覆盖物配置是否更改,更改后要同步到地图上 */
|
|
83
|
-
Object.keys(newValue).length && this.setOverlayOptions(newValue)
|
|
84
|
-
},
|
|
85
|
-
drawLimitArea(newValue) {
|
|
86
|
-
newValue && this.setDrawLimitArea()
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
async mounted() {
|
|
90
|
-
this.amapStore = await getAMapInstance()
|
|
91
|
-
this.amap = this.amapStore.initMap(this.drawEl)
|
|
92
|
-
this.amapSatellite = new this.amapStore.AMap.TileLayer.Satellite()
|
|
93
|
-
this.amap.add(this.amapSatellite)
|
|
94
|
-
this.amapSatellite.hide()
|
|
95
|
-
this.buttonProps = [].concat(this.drawButtonProps)
|
|
96
|
-
this.echoDrawLayers(this.drawType)
|
|
97
|
-
/** 如果有限制区域,则描绘在地图上 */
|
|
98
|
-
this.drawLimitArea && this.setDrawLimitArea()
|
|
99
|
-
},
|
|
100
|
-
destroyed() {
|
|
101
|
-
this.AmapDrawClear()
|
|
102
|
-
},
|
|
103
|
-
methods: {
|
|
104
|
-
/** 绘制 */
|
|
105
|
-
AmapDraw() {
|
|
106
|
-
this.buttonProps = [].concat(this.saveButtonProps)
|
|
107
|
-
this.drawMouseTool = new this.amapStore.AMap.MouseTool(this.amap)
|
|
108
|
-
|
|
109
|
-
this.AmapDrawClear()
|
|
110
|
-
this.setDrawLayers(this.drawType)
|
|
111
|
-
|
|
112
|
-
this.drawMouseTool.on('draw', ({ obj }) => {
|
|
113
|
-
if (this.drawArea && !this[`is${this.drawType}InRing`](obj))
|
|
114
|
-
return this.amap.remove(obj), this.$message.error('未在范围内描绘!')
|
|
115
|
-
/** 暂未支持一次性绘制多个 */
|
|
116
|
-
this.drawCount > 1
|
|
117
|
-
? ((this.drawLayers = this.drawLayers || []), this.drawLayers.push(obj))
|
|
118
|
-
: (this.drawLayers = obj)
|
|
119
|
-
if (this.drawLayers && (this.drawLayers.length == this.drawCount || this.drawCount == 1)) {
|
|
120
|
-
return this.drawMouseTool.close()
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
},
|
|
124
|
-
/** 清空绘制 / 清空搜索 */
|
|
125
|
-
AmapDrawClear() {
|
|
126
|
-
this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && this.amap.remove(layerItem))
|
|
127
|
-
// this.amap.clearMap()
|
|
128
|
-
this.drawLayers = null
|
|
129
|
-
this.drawLayersInfo = {}
|
|
130
|
-
},
|
|
131
|
-
/** 保存当前绘制 */
|
|
132
|
-
AmapDrawSave() {
|
|
133
|
-
this.assignDrawLayers(this.drawType)
|
|
134
|
-
this.buttonProps = [].concat(this.drawButtonProps)
|
|
135
|
-
},
|
|
136
|
-
/** 取消当前绘制 */
|
|
137
|
-
AmapDrawReset() {
|
|
138
|
-
this.buttonProps = [].concat(this.drawButtonProps)
|
|
139
|
-
this.AmapDrawClear()
|
|
140
|
-
},
|
|
141
|
-
/** 搜索地址 */
|
|
142
|
-
searchChoose(searchMarker, searchInfo) {
|
|
143
|
-
this.AmapDrawClear()
|
|
144
|
-
searchMarker.setMap(this.amap)
|
|
145
|
-
this.amap.setZoomAndCenter(15, searchMarker.getPosition())
|
|
146
|
-
this.drawType == 'point' && (this.drawLayersInfo = searchInfo)
|
|
147
|
-
// this.$emit('getAMapLayersInfo', this.drawLayersInfo)
|
|
148
|
-
},
|
|
149
|
-
/** 检测覆盖物配置信息并同步 */
|
|
150
|
-
setOverlayOptions(options) {
|
|
151
|
-
if (!this.drawLayers) return
|
|
152
|
-
this.drawCount > 1
|
|
153
|
-
? this.drawLayers.forEach(drawItem => drawItem.setOptions(options))
|
|
154
|
-
: this.drawLayers.setOptions(options)
|
|
155
|
-
},
|
|
156
|
-
/** 绘制限定区域 */
|
|
157
|
-
setDrawLimitArea() {
|
|
158
|
-
let areaRange = []
|
|
159
|
-
try {
|
|
160
|
-
areaRange = JSON.parse(this.drawLimitArea)
|
|
161
|
-
} catch {
|
|
162
|
-
areaRange = this.drawLimitArea
|
|
163
|
-
}
|
|
164
|
-
this.drawArea && this.amap.remove(this.drawArea)
|
|
165
|
-
/** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */
|
|
166
|
-
this.setMapArea(areaRange)
|
|
167
|
-
this.judgeOverlays()
|
|
168
|
-
},
|
|
169
|
-
/** 绘制地图区域范围 */
|
|
170
|
-
setMapArea(jurisdictionRange) {
|
|
171
|
-
this.drawArea = new this.amapStore.AMap.Polygon({
|
|
172
|
-
map: this.amap,
|
|
173
|
-
path: jurisdictionRange,
|
|
174
|
-
extData: 'Area',
|
|
175
|
-
strokeWeight: 6,
|
|
176
|
-
...this.drawLimitAreaOptions
|
|
177
|
-
})
|
|
178
|
-
const { lng, lat } = this.drawArea.getBounds().getCenter()
|
|
179
|
-
this.amap.setZoomAndCenter(15, [lng, lat])
|
|
180
|
-
},
|
|
181
|
-
/** 判断一个线段是否在面内 */
|
|
182
|
-
islineInRing(polyline) {
|
|
183
|
-
const paths = polyline.getPath()
|
|
184
|
-
return paths.every(pointItem => this.ispointInRing(pointItem))
|
|
185
|
-
},
|
|
186
|
-
/** 判断一个点是否在面内 */
|
|
187
|
-
ispointInRing(point) {
|
|
188
|
-
let position
|
|
189
|
-
try {
|
|
190
|
-
position = point.getPosition()
|
|
191
|
-
} catch {
|
|
192
|
-
position = point
|
|
193
|
-
}
|
|
194
|
-
return this.amapStore.AMap.GeometryUtil.isPointInRing(position, this.drawArea.getPath())
|
|
195
|
-
},
|
|
196
|
-
/** 判断地图上所覆盖物是否在限制范围内 */
|
|
197
|
-
judgeOverlays() {
|
|
198
|
-
this.amap
|
|
199
|
-
.getAllOverlays()
|
|
200
|
-
.forEach(
|
|
201
|
-
layerItem =>
|
|
202
|
-
layerItem.getExtData() != 'Area' &&
|
|
203
|
-
!this[`is${this.drawType}InRing`](layerItem) &&
|
|
204
|
-
this.removeOverlay(layerItem)
|
|
205
|
-
)
|
|
206
|
-
},
|
|
207
|
-
/** 清除单个覆盖物(或 不符合区域范围的覆盖物 */
|
|
208
|
-
removeOverlay(layerItem) {
|
|
209
|
-
this.amap.remove(layerItem)
|
|
210
|
-
this.$message.error('未在区域范围内,请重新描绘!')
|
|
211
|
-
try {
|
|
212
|
-
const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData())
|
|
213
|
-
this.drawLayers.splice(i, 1)
|
|
214
|
-
} catch {
|
|
215
|
-
this.drawLayers = null
|
|
216
|
-
this.drawLayersInfo = {}
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
/** 根据类型处理不同数据 */
|
|
220
|
-
async setDrawLayers(drawType) {
|
|
221
|
-
const type = {
|
|
222
|
-
point: 'marker',
|
|
223
|
-
line: 'polyline',
|
|
224
|
-
polygon: 'polygon'
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/** 图层基础配置 */
|
|
228
|
-
const drawOptions =
|
|
229
|
-
drawType == 'point'
|
|
230
|
-
? {
|
|
231
|
-
anchor: 'bottom-center',
|
|
232
|
-
icon: await this.amapStore.setIcon(this.drawIcon)
|
|
233
|
-
}
|
|
234
|
-
: { strokeWeight: 8 }
|
|
235
|
-
|
|
236
|
-
this.drawMouseTool[type[drawType]]({
|
|
237
|
-
...drawOptions,
|
|
238
|
-
...this.drawOptions
|
|
239
|
-
})
|
|
240
|
-
},
|
|
241
|
-
/** 赋值不同图层数据 */
|
|
242
|
-
assignDrawLayers(drawType) {
|
|
243
|
-
if (drawType == 'point') {
|
|
244
|
-
const { lng, lat } = this.drawLayers.getPosition()
|
|
245
|
-
const position = { longitude: lng, latitude: lat }
|
|
246
|
-
this.amapStore.getMapAddress(position, address => {
|
|
247
|
-
this.drawLayersInfo = {
|
|
248
|
-
...position,
|
|
249
|
-
...address
|
|
250
|
-
}
|
|
251
|
-
})
|
|
252
|
-
return
|
|
253
|
-
}
|
|
254
|
-
const range = this.drawLayers.getPath().map(({ lng, lat }) => [lng, lat])
|
|
255
|
-
this.drawLayersInfo = { range }
|
|
256
|
-
},
|
|
257
|
-
/** 回显不同类型图层 */
|
|
258
|
-
echoDrawLayers(drawType) {
|
|
259
|
-
/** 如若没挂载layers属性则退出 */
|
|
260
|
-
if (!this.amapStore || !this.amap) return
|
|
261
|
-
|
|
262
|
-
const drawLayersItem = async (drawItem, type, i = 0) => {
|
|
263
|
-
let layersItem = null
|
|
264
|
-
const { longitude, latitude, range } = drawItem
|
|
265
|
-
if ((longitude && latitude) || range) {
|
|
266
|
-
const setOptions = {
|
|
267
|
-
extData: `draw${type}${i}`,
|
|
268
|
-
...this.drawOptions
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (type == 'point') {
|
|
272
|
-
layersItem = await this.amapStore.setMarker(this.drawIcon, {
|
|
273
|
-
position: [longitude, latitude],
|
|
274
|
-
...setOptions
|
|
275
|
-
})
|
|
276
|
-
} else {
|
|
277
|
-
const options = {
|
|
278
|
-
path: range,
|
|
279
|
-
strokeWeight: 8,
|
|
280
|
-
...setOptions
|
|
281
|
-
}
|
|
282
|
-
layersItem =
|
|
283
|
-
type == 'line' ? new this.amapStore.AMap.Polyline(options) : new this.amapStore.AMap.Polygon(options)
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
layersItem.setMap(this.amap)
|
|
287
|
-
this.amap.setFitView()
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (!this.isExhibition) {
|
|
292
|
-
drawLayersItem(this.drawLayersInfo, drawType)
|
|
293
|
-
return
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (this.drawInfoAll) {
|
|
297
|
-
for (let key in this.drawInfoAll) {
|
|
298
|
-
const isArray = Array.isArray(this.drawInfoAll[key])
|
|
299
|
-
isArray
|
|
300
|
-
? this.drawInfoAll[key].forEach((drawItem, i) => {
|
|
301
|
-
drawLayersItem(drawItem, key, i)
|
|
302
|
-
})
|
|
303
|
-
: drawLayersItem(this.drawInfoAll[key], key)
|
|
304
|
-
}
|
|
305
|
-
return
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
drawLayersItem(this.drawLayersInfo, drawType)
|
|
309
|
-
},
|
|
310
|
-
/** 切换地图类型 */
|
|
311
|
-
onLayersSwitch(key) {
|
|
312
|
-
this.amapType = key
|
|
313
|
-
this.amapType ?
|
|
314
|
-
this.amapSatellite.show() :
|
|
315
|
-
this.amapSatellite.hide()
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
render(h) {
|
|
319
|
-
const amapLayers = ['电子', '卫星']
|
|
320
|
-
const { drawEl, drawIcon, amapType, buttonProps, isExhibition, AmapDrawClear, searchChoose, onLayersSwitch } = this
|
|
321
|
-
|
|
322
|
-
return (
|
|
323
|
-
<div class="AmapDraw">
|
|
324
|
-
{!isExhibition && (
|
|
325
|
-
<AmapSearch {...{ props: { drawIcon, buttonProps }, on: { searchReset: AmapDrawClear, searchChoose } }} />
|
|
326
|
-
)}
|
|
327
|
-
<div id={drawEl} />
|
|
328
|
-
<div class="AmapDraw__Layers">
|
|
329
|
-
{amapLayers.map((layer, i) => (
|
|
330
|
-
<span
|
|
331
|
-
key={i}
|
|
332
|
-
class={i === amapType && 'LayersActive'}
|
|
333
|
-
onClick={() => onLayersSwitch(i)}
|
|
334
|
-
>
|
|
335
|
-
{i === amapType}
|
|
336
|
-
{layer}
|
|
337
|
-
</span>
|
|
338
|
-
))}
|
|
339
|
-
</div>
|
|
340
|
-
</div>
|
|
341
|
-
)
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
AmapDraw.install = function (Vue) {
|
|
346
|
-
Vue.component('AmapDraw', AmapDraw)
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export default AmapDraw
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@import '../style/mixins.less';
|
|
2
|
-
@import 'ant-design-vue/lib/style/themes/default.less';
|
|
3
|
-
|
|
4
|
-
.AmapDraw {
|
|
5
|
-
position: relative;
|
|
6
|
-
|
|
7
|
-
&__Search {
|
|
8
|
-
top: 8px;
|
|
9
|
-
left: 8px;
|
|
10
|
-
z-index: 1;
|
|
11
|
-
position: absolute;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&__Layers {
|
|
15
|
-
z-index: 1;
|
|
16
|
-
right: @padding-md;
|
|
17
|
-
bottom: @padding-md;
|
|
18
|
-
position: absolute;
|
|
19
|
-
background: @component-background;
|
|
20
|
-
.layout(32px, 120px);
|
|
21
|
-
.flex-layout(column);
|
|
22
|
-
|
|
23
|
-
span {
|
|
24
|
-
flex: 1;
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
font-size: 15px;
|
|
27
|
-
color: fade(@white, 70%);
|
|
28
|
-
letter-spacing: 0.2em;
|
|
29
|
-
writing-mode: vertical-rl;
|
|
30
|
-
.flex-mixins();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.LayersActive {
|
|
34
|
-
color: @white;
|
|
35
|
-
border: 1px solid @primary-color;
|
|
36
|
-
box-sizing: border-box;
|
|
37
|
-
box-shadow: 0px 0px 16px 0px @primary-color inset;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
#AmapDraw {
|
|
42
|
-
width: 100%;
|
|
43
|
-
min-height: 304px;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'ant-design-vue/es/_util/vue-types'
|
|
2
|
-
import { FormComp, Button } from '../../../index'
|
|
3
|
-
import { getAMapInstance } from '../../../../method/AMap.js'
|
|
4
|
-
|
|
5
|
-
import './index.less'
|
|
6
|
-
|
|
7
|
-
const { ASelectCustom } = FormComp
|
|
8
|
-
|
|
9
|
-
export const AmapSearchProps = {
|
|
10
|
-
/** 搜索后绘制图标 */
|
|
11
|
-
drawIcon: PropTypes.any,
|
|
12
|
-
buttonProps: PropTypes.array.def([])
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const AmapSearch = {
|
|
16
|
-
name: 'AmapSearch',
|
|
17
|
-
props: AmapSearchProps,
|
|
18
|
-
data() {
|
|
19
|
-
return {
|
|
20
|
-
/** 地图存储商店 */
|
|
21
|
-
amapStore: null,
|
|
22
|
-
searchMarker: null,
|
|
23
|
-
addressValue: undefined,
|
|
24
|
-
selectOptions: []
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
async mounted() {
|
|
28
|
-
this.amapStore = await getAMapInstance()
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
/** 选择地址 */
|
|
32
|
-
async changeHandle() {
|
|
33
|
-
if (!this.addressValue) return this.$emit('searchReset', this.searchMarker), (this.searchMarker = null)
|
|
34
|
-
const { label, location } = this.selectOptions.find(({ id }) => id == this.addressValue)
|
|
35
|
-
const searchInfo = {
|
|
36
|
-
longitude: location.lng,
|
|
37
|
-
latitude: location.lat,
|
|
38
|
-
address: label
|
|
39
|
-
}
|
|
40
|
-
this.searchMarker = await this.amapStore.setMarker(this.drawIcon, { position: [location.lng, location.lat] })
|
|
41
|
-
this.$emit('searchChoose', this.searchMarker, searchInfo)
|
|
42
|
-
},
|
|
43
|
-
/** 根据搜索框搜索地址 */
|
|
44
|
-
searchHandle(keyword) {
|
|
45
|
-
this.amapStore.getMapSearch(keyword, addressOptions => {
|
|
46
|
-
this.selectOptions = addressOptions
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
render(h) {
|
|
51
|
-
const { selectOptions, changeHandle, searchHandle, buttonProps } = this
|
|
52
|
-
|
|
53
|
-
const props = {
|
|
54
|
-
valueKey: 'id',
|
|
55
|
-
labelKey: 'label',
|
|
56
|
-
options: selectOptions,
|
|
57
|
-
placeholder: '请输入目的地进行搜索'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div class="AmapDraw__Search">
|
|
62
|
-
<ASelectCustom v-model={this.addressValue} {...{ props, on: { change: changeHandle, search: searchHandle } }} />
|
|
63
|
-
{buttonProps && <Button buttonProps={buttonProps} class="AmapDraw__Search__Button" />}
|
|
64
|
-
</div>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
AmapSearch.install = function (Vue) {
|
|
70
|
-
Vue.component('AmapSearch', AmapSearch)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default AmapSearch
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Dropdown placement="bottomRight">
|
|
3
|
-
<span class="ant-pro-account-avatar" style="margin-right: 12px; margin-bottom: 6px;">
|
|
4
|
-
<slot name="avatar" />
|
|
5
|
-
</span>
|
|
6
|
-
<Menu class="ant-pro-drop-down menu" slot="overlay" >
|
|
7
|
-
<MenuItem key="logout" @click="handleLogout">
|
|
8
|
-
<Icon type="logout" />
|
|
9
|
-
退出登录
|
|
10
|
-
</MenuItem>
|
|
11
|
-
</Menu>
|
|
12
|
-
</Dropdown>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import { Modal, Dropdown, Menu, Icon } from 'ant-design-vue'
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: 'Avatar',
|
|
20
|
-
components: {
|
|
21
|
-
Dropdown,
|
|
22
|
-
Menu,
|
|
23
|
-
MenuItem: Menu.Item,
|
|
24
|
-
Icon
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
logoutMessage: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: '确定要退出登录吗?'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
handleLogout (e) {
|
|
34
|
-
Modal.confirm({
|
|
35
|
-
content: this.logoutMessage,
|
|
36
|
-
onOk: () => {
|
|
37
|
-
return this.$emit('handleLogout')
|
|
38
|
-
},
|
|
39
|
-
onCancel () {}
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<style lang="less" scoped>
|
|
47
|
-
</style>
|