web-component-gallery 0.1.71 → 0.1.73
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/amap.umd.js +4 -4
- package/dist/index.umd.js +4 -4
- package/lib/amap/AmapDraw.jsx +148 -115
- package/lib/iframe/index.jsx +4 -9
- package/lib/layout/Header.less +2 -5
- package/lib/modal/index.css +1 -1
- package/lib/modal/index.less +1 -1
- package/package.json +1 -1
- package/plugins/lib/amap/AmapDraw.jsx +148 -115
- package/plugins/lib/iframe/index.jsx +4 -9
- package/plugins/lib/layout/Header.less +2 -5
- package/plugins/lib/modal/index.less +1 -1
package/dist/amap.umd.js
CHANGED
|
@@ -8527,7 +8527,7 @@ eval("/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source cod
|
|
|
8527
8527
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8528
8528
|
|
|
8529
8529
|
"use strict";
|
|
8530
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AmapDrawProps: function() { return /* binding */ AmapDrawProps; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/AmapSearch/index.jsx */ \"./plugins/lib/amap/components/AmapSearch/index.jsx\");\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _AmapDraw_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AmapDraw.less */ \"./plugins/lib/amap/AmapDraw.less\");\n\n\n\n\nconst AmapDrawProps = {\n /** drawType为绘制类型\r\n * 可选值(point点 | line线 | polygon面)\r\n */\n drawType: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('point'),\n /** 绘制图标 (只在point类型下生效 */\n drawIcon: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].any,\n /** drawCount为绘制物绘制个数 */\n drawCount: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].number.def(1),\n /** drawOptions为绘制物配置项 */\n drawOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** drawInfo为绘制物信息 */\n drawInfo: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array]),\n /** 限制区域 */\n drawLimitArea: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string]),\n /** 限制区域样式配置 */\n drawLimitAreaOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** 是否隐藏搜索地址 */\n searchHidden: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].bool.def(false)\n};\nconst AmapDraw = {\n name: 'AmapDraw',\n props: AmapDrawProps,\n data() {\n return {\n amap: null,\n drawArea: null,\n drawLayers: null,\n buttonProps: [],\n drawButtonProps: [{\n type: 'primary',\n text: '绘制',\n event: {\n click: this.AmapDraw\n }\n }, {\n text: '清除',\n event: {\n click: this.AmapDrawClear\n }\n }],\n saveButtonProps: [{\n type: 'primary',\n text: '保存',\n event: {\n click: this.AmapDrawSave\n }\n }, {\n text: '取消',\n event: {\n click: this.AmapDrawReset\n }\n }]\n };\n },\n computed: {\n drawLayersInfo: {\n get() {\n return this.drawInfo;\n },\n set(newValue) {\n this.$emit('getAMapLayersInfo', newValue);\n }\n }\n },\n watch: {\n drawInfo(newValue) {\n newValue && this[`dispose${this.drawType}`]('echo');\n },\n drawOptions(newValue) {\n /** 检测options覆盖物配置是否更改,更改后要同步到地图上 */\n Object.keys(newValue).length && this.setOverlayOptions(newValue);\n },\n drawLimitArea(newValue) {\n newValue && this.setDrawLimitArea();\n }\n },\n mounted() {\n const timer = setTimeout(() => {\n this.$initAMap({\n el: 'AmapDraw'\n }, amap => {\n this.amap = amap;\n this.drawInfo && (this.drawInfo.length || Object.keys(this.drawInfo).length) && (this.drawLayersInfo = this.drawInfo, this[`dispose${this.drawType}`]('echo'));\n this.buttonProps = [].concat(this.drawButtonProps);\n /** 如果有限制区域,则描绘在地图上 */\n this.drawLimitArea && this.setDrawLimitArea();\n clearTimeout(timer);\n });\n }, 60);\n },\n destroyed() {\n this.AmapDrawClear();\n },\n methods: {\n /** 绘制 */\n AmapDraw() {\n this.buttonProps = [].concat(this.saveButtonProps);\n this.AmapDrawClear();\n const mouseTool = new this.$amap.MouseTool(this.amap);\n this[`dispose${this.drawType}`]('draw', mouseTool);\n mouseTool.on('draw', ({\n obj\n }) => {\n if (this.drawArea && !this[`is${this.drawType}InRing`](obj)) return this.amap.remove(obj), this.$message.error('未在范围内描绘!');\n this.drawCount > 1 ? (this.drawLayers = this.drawLayers || [], this.drawLayers.push(obj)) : this.drawLayers = obj;\n this.disposeData(this.drawCount > 1);\n if (this.drawLayers && (this.drawLayers.length == this.drawCount || this.drawCount == 1)) {\n return mouseTool.close();\n }\n });\n },\n /** 清空绘制 / 清空搜索 */\n AmapDrawClear() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && this.amap.remove(layerItem));\n // this.amap.clearMap()\n this.drawLayers = null;\n this.drawLayersInfo = {};\n },\n /** 保存当前绘制 */\n AmapDrawSave() {\n this.buttonProps = [].concat(this.drawButtonProps);\n },\n /** 取消当前绘制 */\n AmapDrawReset() {\n this.drawLayers.pop();\n Array.isArray(this.drawLayersInfo) ? this.drawLayersInfo.pop() : this.drawLayersInfo = {};\n this.AmapDrawSave();\n },\n /** 搜索地址 */\n searchChoose(searchMarker, searchInfo) {\n this.AmapDrawClear();\n searchMarker.setMap(this.amap);\n this.amap.setZoomAndCenter(15, searchMarker.getPosition());\n this.drawType == 'point' && (this.drawLayersInfo = searchInfo);\n // this.$emit('getAMapLayersInfo', this.drawLayersInfo)\n },\n /** 检测覆盖物配置信息并同步 */\n setOverlayOptions(options) {\n if (!this.drawLayers) return;\n this.drawCount > 1 ? this.drawLayers.forEach(drawItem => drawItem.setOptions(options)) : this.drawLayers.setOptions(options);\n },\n /** 绘制限定区域 */\n setDrawLimitArea() {\n let areaRange = [];\n try {\n areaRange = JSON.parse(this.drawLimitArea);\n } catch {\n areaRange = this.drawLimitArea;\n }\n this.drawArea && this.amap.remove(this.drawArea);\n /** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */\n this.setMapArea(areaRange);\n this.judgeOverlays();\n },\n /** 判断地图上所覆盖物是否在限制范围内 */\n judgeOverlays() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && !this[`is${this.drawType}InRing`](layerItem) && this.removeOverlay(layerItem));\n },\n /** 清除单个覆盖物(或 不符合区域范围的覆盖物 */\n removeOverlay(layerItem) {\n this.amap.remove(layerItem);\n this.$message.error('未在区域范围内,请重新描绘!');\n try {\n const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData());\n this.drawLayers.splice(i, 1);\n } catch {\n this.drawLayers = null;\n this.drawLayersInfo = {};\n }\n },\n /** 处理抛出数据 */\n disposeData(isBoolean) {\n this[`dispose${this.drawType}`](isBoolean ? 'batch' : 'single');\n // setTimeout(() => this.$emit('getAMapLayersInfo', this.drawLayersInfo), 600 )\n },\n /** 根据类型处理不同数据 */\n disposepoint(methods, mouseTool) {\n const _that = this;\n switch (methods) {\n case 'draw':\n mouseTool.marker({\n ...this.$amapLayers.setMarker(this.drawIcon).getOptions(),\n ...this.drawOptions\n });\n break;\n case 'single':\n const {\n lng,\n lat\n } = this.drawLayers.getPosition();\n const position = {\n longitude: lng,\n latitude: lat\n };\n this.$amapMethods.getMapAddress(position, address => {\n this.drawLayersInfo = {\n ...position,\n ...address\n };\n });\n break;\n case 'batch':\n // this.$set( this.drawLayersInfo, 'position', [] )\n // this.drawLayers.forEach((drawItem, i) => {\n // const {lng,lat} = drawItem.getPosition()\n // this.$set( this.drawLayersInfo.position, i, [lng,lat] )\n // })\n break;\n case 'echo':\n Array.isArray(this.drawLayersInfo) ? (this.drawLayers = [], this.drawLayersInfo.forEach((drawItem, i) => {\n this.drawLayers.push(setMarker(drawItem, i));\n })) : this.drawLayers = setMarker(this.drawLayersInfo);\n break;\n }\n function setMarker(drawItem, i = 0) {\n const {\n longitude,\n latitude,\n setIcon = _that.drawIcon\n } = drawItem;\n const disposeMarker = _that.$amapLayers.setMarker(setIcon, {\n position: [longitude, latitude],\n extData: `drawpoint${i}`\n });\n disposeMarker.setMap(_that.amap);\n return disposeMarker;\n }\n },\n disposeline(methods, mouseTool) {\n const _that = this;\n switch (methods) {\n case 'draw':\n mouseTool.polyline({\n strokeWeight: 8,\n ...this.drawOptions\n });\n break;\n case 'single':\n const range = this.drawLayers.getPath().map(({\n lng,\n lat\n }) => [lng, lat]);\n this.drawLayersInfo = {\n range\n };\n break;\n case 'batch':\n break;\n case 'echo':\n Array.isArray(this.drawLayersInfo) ? (this.drawLayers = [], this.drawLayersInfo.forEach((drawItem, i) => {\n this.drawLayers.push(setPolyline(drawItem, i));\n })) : this.drawLayers = setPolyline(this.drawLayersInfo);\n break;\n }\n function setPolyline({\n range\n }, i = 0) {\n const disposePolyline = new _that.$amap.Polyline({\n path: range,\n strokeWeight: 8,\n extData: `drawline${i}`,\n ..._that.drawOptions\n });\n disposePolyline.setMap(_that.amap);\n return disposePolyline;\n }\n }\n },\n render(h) {\n const {\n props,\n buttonProps,\n searchHidden,\n AmapDrawClear,\n searchChoose\n } = this;\n return h(\"div\", {\n \"class\": \"AmapDraw\"\n }, [!searchHidden && h(_components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n \"props\": {\n ...{\n ...props,\n buttonProps\n }\n },\n \"on\": {\n ...{\n searchReset: AmapDrawClear,\n searchChoose: searchChoose\n }\n }\n }), h(\"div\", {\n \"attrs\": {\n \"id\": \"AmapDraw\"\n }\n })]);\n }\n};\nAmapDraw.install = function (Vue) {\n Vue.component('AmapDraw', AmapDraw);\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (AmapDraw);\n\n//# sourceURL=webpack://mui/./plugins/lib/amap/AmapDraw.jsx?");
|
|
8530
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AmapDrawProps: function() { return /* binding */ AmapDrawProps; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/AmapSearch/index.jsx */ \"./plugins/lib/amap/components/AmapSearch/index.jsx\");\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _AmapDraw_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AmapDraw.less */ \"./plugins/lib/amap/AmapDraw.less\");\n\n\n\n\nconst AmapDrawProps = {\n /** drawEl为地图容器实例名称 */\n drawEl: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('AmapDraw'),\n /** drawType为绘制类型\r\n * 可选值(point点 | line线 | polygon面) \r\n */\n drawType: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('point'),\n /** 绘制图标 (只在point类型下生效 */\n drawIcon: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].any,\n /** drawCount为绘制物绘制个数 */\n drawCount: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].number.def(1),\n /** drawOptions为绘制物配置项 */\n drawOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** drawInfo为绘制物信息 */\n drawInfo: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array]),\n /** drawInfoAll为所有不同类型绘制物信息(用于回显地图图层) \r\n * 格式: { point: ([]||{}), line: ([]||{}) }\r\n */\n drawInfoAll: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object,\n /** 限制区域 */\n drawLimitArea: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string]),\n /** 限制区域样式配置 */\n drawLimitAreaOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** 是否为纯地图展示数据 */\n isExhibition: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].bool.def(false)\n};\nconst AmapDraw = {\n name: 'AmapDraw',\n props: AmapDrawProps,\n data() {\n return {\n amap: null,\n drawArea: null,\n drawLayers: null,\n drawMouseTool: null,\n buttonProps: [],\n drawButtonProps: [{\n type: 'primary',\n text: '绘制',\n event: {\n click: this.AmapDraw\n }\n }, {\n text: '清除',\n event: {\n click: this.AmapDrawClear\n }\n }],\n saveButtonProps: [{\n type: 'primary',\n text: '保存',\n event: {\n click: this.AmapDrawSave\n }\n }, {\n text: '取消',\n event: {\n click: this.AmapDrawReset\n }\n }]\n };\n },\n computed: {\n drawLayersInfo: {\n get() {\n return this.drawInfo;\n },\n set(newValue) {\n this.$emit('getAMapLayersInfo', newValue);\n }\n }\n },\n watch: {\n drawOptions(newValue) {\n /** 检测options覆盖物配置是否更改,更改后要同步到地图上 */\n Object.keys(newValue).length && this.setOverlayOptions(newValue);\n },\n drawLimitArea(newValue) {\n newValue && this.setDrawLimitArea();\n },\n drawInfoAll(newValue) {\n newValue && this.echoDrawLayers();\n }\n },\n mounted() {\n const timer = setTimeout(() => {\n this.$initAMap({\n el: this.drawEl\n }, amap => {\n this.amap = amap;\n this.buttonProps = [].concat(this.drawButtonProps);\n this.echoDrawLayers(this.drawType);\n /** 如果有限制区域,则描绘在地图上 */\n this.drawLimitArea && this.setDrawLimitArea();\n clearTimeout(timer);\n });\n }, 60);\n },\n destroyed() {\n this.AmapDrawClear();\n },\n methods: {\n /** 绘制 */\n AmapDraw() {\n console.log('进入');\n this.buttonProps = [].concat(this.saveButtonProps);\n this.drawMouseTool = new this.$amap.MouseTool(this.amap);\n this.AmapDrawClear();\n this.setDrawLayers(this.drawType);\n this.drawMouseTool.on('draw', ({\n obj\n }) => {\n if (this.drawArea && !this[`is${this.drawType}InRing`](obj)) return this.amap.remove(obj), this.$message.error('未在范围内描绘!');\n /** 暂未支持一次性绘制多个 */\n this.drawCount > 1 ? (this.drawLayers = this.drawLayers || [], this.drawLayers.push(obj)) : this.drawLayers = obj;\n if (this.drawLayers && (this.drawLayers.length == this.drawCount || this.drawCount == 1)) {\n return this.drawMouseTool.close();\n }\n });\n },\n /** 清空绘制 / 清空搜索 */\n AmapDrawClear() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && this.amap.remove(layerItem));\n // this.amap.clearMap()\n this.drawLayers = null;\n this.drawLayersInfo = {};\n },\n /** 保存当前绘制 */\n AmapDrawSave() {\n this.assignDrawLayers(this.drawType);\n this.buttonProps = [].concat(this.drawButtonProps);\n },\n /** 取消当前绘制 */\n AmapDrawReset() {\n this.buttonProps = [].concat(this.drawButtonProps);\n this.AmapDrawClear();\n },\n /** 搜索地址 */\n searchChoose(searchMarker, searchInfo) {\n this.AmapDrawClear();\n searchMarker.setMap(this.amap);\n this.amap.setZoomAndCenter(15, searchMarker.getPosition());\n this.drawType == 'point' && (this.drawLayersInfo = searchInfo);\n // this.$emit('getAMapLayersInfo', this.drawLayersInfo)\n },\n /** 检测覆盖物配置信息并同步 */\n setOverlayOptions(options) {\n if (!this.drawLayers) return;\n this.drawCount > 1 ? this.drawLayers.forEach(drawItem => drawItem.setOptions(options)) : this.drawLayers.setOptions(options);\n },\n /** 绘制限定区域 */\n setDrawLimitArea() {\n let areaRange = [];\n try {\n areaRange = JSON.parse(this.drawLimitArea);\n } catch {\n areaRange = this.drawLimitArea;\n }\n this.drawArea && this.amap.remove(this.drawArea);\n /** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */\n this.setMapArea(areaRange);\n this.judgeOverlays();\n },\n /** 绘制地图区域范围 */\n setMapArea(jurisdictionRange) {\n this.drawArea = new this.$amap.Polygon({\n map: this.amap,\n path: jurisdictionRange,\n extData: 'Area',\n strokeWeight: 6,\n ...this.drawLimitAreaOptions\n });\n const {\n lng,\n lat\n } = this.drawArea.getBounds().getCenter();\n this.amap.setZoomAndCenter(15, [lng, lat]);\n },\n /** 判断一个线段是否在面内 */\n islineInRing(polyline) {\n const paths = polyline.getPath();\n return paths.every(pointItem => this.ispointInRing(pointItem));\n },\n /** 判断一个点是否在面内 */\n ispointInRing(point) {\n let position;\n try {\n position = point.getPosition();\n } catch {\n position = point;\n }\n return this.$amap.GeometryUtil.isPointInRing(position, this.drawArea.getPath());\n },\n /** 判断地图上所覆盖物是否在限制范围内 */\n judgeOverlays() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && !this[`is${this.drawType}InRing`](layerItem) && this.removeOverlay(layerItem));\n },\n /** 清除单个覆盖物(或 不符合区域范围的覆盖物 */\n removeOverlay(layerItem) {\n this.amap.remove(layerItem);\n this.$message.error('未在区域范围内,请重新描绘!');\n try {\n const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData());\n this.drawLayers.splice(i, 1);\n } catch {\n this.drawLayers = null;\n this.drawLayersInfo = {};\n }\n },\n /** 根据类型处理不同数据 */\n setDrawLayers(drawType) {\n const type = {\n point: 'marker',\n line: 'polyline',\n polygon: 'polygon'\n };\n\n /** 图层基础配置 */\n const drawOptions = drawType == 'point' ? this.$amapLayers.setMarker(this.drawIcon).getOptions() : {\n strokeWeight: 8\n };\n this.drawMouseTool[type[drawType]]({\n ...drawOptions,\n ...this.drawOptions\n });\n },\n /** 赋值不同图层数据 */\n assignDrawLayers(drawType) {\n if (drawType == 'point') {\n const {\n lng,\n lat\n } = this.drawLayers.getPosition();\n const position = {\n longitude: lng,\n latitude: lat\n };\n this.$amapMethods.getMapAddress(position, address => {\n this.drawLayersInfo = {\n ...position,\n ...address\n };\n });\n return;\n }\n const range = this.drawLayers.getPath().map(({\n lng,\n lat\n }) => [lng, lat]);\n this.drawLayersInfo = {\n range\n };\n },\n /** 回显不同类型图层 */\n echoDrawLayers(drawType) {\n const drawLayersItem = (drawItem, type, i = 0) => {\n let layersItem = null;\n const {\n longitude,\n latitude,\n range\n } = drawItem;\n const setOptions = {\n extData: `draw${type}${i}`,\n ...this.drawOptions\n };\n if (type == 'point') {\n layersItem = this.$amapLayers.setMarker(this.drawIcon, {\n position: [longitude, latitude],\n ...setOptions\n });\n } else {\n const options = {\n path: range,\n strokeWeight: 8,\n ...setOptions\n };\n layersItem = type == 'line' ? new this.$amap.Polyline(options) : new this.$amap.Polygon(options);\n }\n layersItem.setMap(this.amap);\n };\n if (!this.isExhibition) {\n drawLayersItem(this.drawLayersInfo, drawType);\n return;\n }\n if (this.drawInfoAll) {\n for (let key in this.drawInfoAll) {\n const isArray = Array.isArray(this.drawInfoAll[key]);\n isArray ? this.drawInfoAll[key].forEach((drawItem, i) => {\n drawLayersItem(drawItem, key, i);\n }) : drawLayersItem(this.drawInfoAll[key], key);\n }\n return;\n }\n drawLayersItem(this.drawLayersInfo, drawType);\n }\n },\n render(h) {\n const {\n props,\n buttonProps,\n isExhibition,\n AmapDrawClear,\n searchChoose\n } = this;\n console.log(isExhibition, '--isExhibition');\n return h(\"div\", {\n \"class\": \"AmapDraw\"\n }, [!isExhibition && h(_components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n \"props\": {\n ...{\n ...props,\n buttonProps\n }\n },\n \"on\": {\n ...{\n searchReset: AmapDrawClear,\n searchChoose: searchChoose\n }\n }\n }), h(\"div\", {\n \"attrs\": {\n \"id\": \"AmapDraw\"\n }\n })]);\n }\n};\nAmapDraw.install = function (Vue) {\n Vue.component('AmapDraw', AmapDraw);\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (AmapDraw);\n\n//# sourceURL=webpack://mui/./plugins/lib/amap/AmapDraw.jsx?");
|
|
8531
8531
|
|
|
8532
8532
|
/***/ }),
|
|
8533
8533
|
|
|
@@ -8670,7 +8670,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue_
|
|
|
8670
8670
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8671
8671
|
|
|
8672
8672
|
"use strict";
|
|
8673
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modal/index.jsx */ \"./plugins/lib/modal/index.jsx\");\n/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events.js */ \"./plugins/lib/iframe/events.js\");\n/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less */ \"./plugins/lib/iframe/index.less\");\n\n\n\n\nconst IframeContainerProps = {\n activeKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string,\n checkedKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('name'),\n linkurlKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('linkUrl'),\n operatesArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n componentsArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n postMessage: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object\n};\nconst IframeContainer = {\n name: 'IframeComp',\n props: IframeContainerProps,\n data() {\n return {\n modalComponents: {}\n };\n },\n render(h, content) {\n const {\n $props,\n modalComponents\n } = this;\n const {\n activeKey,\n checkedKey,\n componentsArr\n } = $props;\n const IframeComponents = componentsArr.map(componentItem => {\n const isActive = activeKey === componentItem[checkedKey];\n return this.getIframeComponent(componentItem, isActive);\n });\n const modalKeys = Object.keys(modalComponents);\n const ModalOperates = modalKeys.map(modalKey => {\n return h(_modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n \"props\": {\n ...{\n ...modalComponents[modalKey],\n cancelHandle: () => this.closeModalHandle(modalKey)\n }\n }\n }, [this.getIframeComponent(modalComponents[modalKey], true)]);\n });\n return h(\"div\", {\n \"class\": \"ant-pro-grid-content-page\"\n }, [IframeComponents, ModalOperates]);\n },\n watch: {\n activeKey(newVal) {\n this.modalComponents = {};\n },\n activeKeyAndParams: {\n handler(newVal, oldVal) {\n this.postCompMessage();\n },\n deep: true\n }\n },\n computed: {\n activeKeyAndParams() {\n const {\n activeKey,\n postMessage,\n componentsArr\n } = this;\n return {\n activeKey,\n postMessage,\n componentsArr\n };\n }\n },\n created() {\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalOpen', ({\n name,\n params\n }) => {\n const activeModal = this.switchModalHandle(name, params);\n activeModal && this.$set(this.modalComponents, name, {\n mode: params.mode,\n visible: true,\n ...activeModal\n });\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalClose', ({\n name,\n params\n }) => {\n this.closeModalHandle(name);\n params && this.postCompMessage(params);\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalGoBack', ({\n name,\n params\n }, closeModal) => {\n this.closeModalHandle(closeModal);\n this.switchModalHandle(name, params);\n });\n },\n mounted() {\n this.postCompMessage();\n },\n methods: {\n postCompMessage(data = {}) {\n const {\n componentsArr,\n activeKey,\n postMessage\n } = this;\n componentsArr.length && this.postIframeMessage(componentsArr, {\n type: 'refreshPage',\n activeKey,\n data\n });\n },\n closeModalHandle(name) {\n this.modalComponents[name].visible = false;\n delete this.modalComponents[name];\n },\n switchModalHandle(name, data) {\n const {\n operatesArr,\n checkedKey\n } = this;\n const activeModal = operatesArr.find(operatesItem => operatesItem[checkedKey] === name);\n activeModal && this.postIframeMessage(operatesArr, {\n type: 'refreshModal',\n activeKey: name,\n data\n });\n return activeModal;\n },\n postIframeMessage(components, iframeConfig) {\n const {\n type,\n activeKey,\n data = {}\n } = iframeConfig;\n this.$nextTick(() => {\n const {\n checkedKey,\n linkurlKey,\n postMessage\n } = this;\n const refKey = components.find(componentsItem => activeKey === componentsItem[checkedKey])?.[linkurlKey];\n
|
|
8673
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modal/index.jsx */ \"./plugins/lib/modal/index.jsx\");\n/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events.js */ \"./plugins/lib/iframe/events.js\");\n/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less */ \"./plugins/lib/iframe/index.less\");\n\n\n\n\nconst IframeContainerProps = {\n activeKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string,\n checkedKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('name'),\n linkurlKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('linkUrl'),\n operatesArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n componentsArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n postMessage: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object\n};\nconst IframeContainer = {\n name: 'IframeComp',\n props: IframeContainerProps,\n data() {\n return {\n modalComponents: {}\n };\n },\n render(h, content) {\n const {\n $props,\n modalComponents\n } = this;\n const {\n activeKey,\n checkedKey,\n componentsArr\n } = $props;\n const IframeComponents = componentsArr.map(componentItem => {\n const isActive = activeKey === componentItem[checkedKey];\n return this.getIframeComponent(componentItem, isActive);\n });\n const modalKeys = Object.keys(modalComponents);\n const ModalOperates = modalKeys.map(modalKey => {\n return h(_modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n \"props\": {\n ...{\n ...modalComponents[modalKey],\n cancelHandle: () => this.closeModalHandle(modalKey)\n }\n }\n }, [this.getIframeComponent(modalComponents[modalKey], true)]);\n });\n return h(\"div\", {\n \"class\": \"ant-pro-grid-content-page\"\n }, [IframeComponents, ModalOperates]);\n },\n watch: {\n activeKey(newVal) {\n this.modalComponents = {};\n },\n activeKeyAndParams: {\n handler(newVal, oldVal) {\n this.postCompMessage();\n },\n deep: true\n }\n },\n computed: {\n activeKeyAndParams() {\n const {\n activeKey,\n postMessage,\n componentsArr\n } = this;\n return {\n activeKey,\n postMessage,\n componentsArr\n };\n }\n },\n created() {\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalOpen', ({\n name,\n params\n }) => {\n const activeModal = this.switchModalHandle(name, params);\n activeModal && this.$set(this.modalComponents, name, {\n mode: params.mode,\n visible: true,\n ...activeModal\n });\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalClose', ({\n name,\n params\n }) => {\n this.closeModalHandle(name);\n params && this.postCompMessage(params);\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalGoBack', ({\n name,\n params\n }, closeModal) => {\n this.closeModalHandle(closeModal);\n this.switchModalHandle(name, params);\n });\n },\n mounted() {\n this.postCompMessage();\n },\n methods: {\n postCompMessage(data = {}) {\n const {\n componentsArr,\n activeKey,\n postMessage\n } = this;\n componentsArr.length && this.postIframeMessage(componentsArr, {\n type: 'refreshPage',\n activeKey,\n data\n });\n },\n closeModalHandle(name) {\n this.modalComponents[name].visible = false;\n delete this.modalComponents[name];\n },\n switchModalHandle(name, data) {\n const {\n operatesArr,\n checkedKey\n } = this;\n const activeModal = operatesArr.find(operatesItem => operatesItem[checkedKey] === name);\n activeModal && this.postIframeMessage(operatesArr, {\n type: 'refreshModal',\n activeKey: name,\n data\n });\n return activeModal;\n },\n postIframeMessage(components, iframeConfig) {\n const {\n type,\n activeKey,\n data = {}\n } = iframeConfig;\n this.$nextTick(() => {\n const {\n checkedKey,\n linkurlKey,\n postMessage\n } = this;\n const refKey = components.find(componentsItem => activeKey === componentsItem[checkedKey])?.[linkurlKey];\n if (!refKey) return;\n const iframeWin = this.$refs[refKey]?.contentWindow;\n iframeWin && iframeWin.postMessage({\n type,\n params: {\n routeQuery: postMessage,\n data,\n name: activeKey\n }\n }, '*');\n });\n },\n getIframeComponent(componentItem, isActive) {\n const h = this.$createElement;\n const {\n linkurlKey,\n checkedKey\n } = this;\n return h(\"iframe\", {\n \"attrs\": {\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"src\": componentItem[linkurlKey]\n },\n \"ref\": componentItem[linkurlKey],\n \"key\": componentItem[checkedKey],\n \"style\": {\n border: 'none',\n display: isActive ? 'block' : 'none'\n }\n });\n }\n }\n};\nIframeContainer.install = function (Vue) {\n Vue.prototype.$IframeBus = _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\n Vue.component('IframePage', IframeContainer);\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (IframeContainer);\n\n//# sourceURL=webpack://mui/./plugins/lib/iframe/index.jsx?");
|
|
8674
8674
|
|
|
8675
8675
|
/***/ }),
|
|
8676
8676
|
|
|
@@ -9109,7 +9109,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
9109
9109
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9110
9110
|
|
|
9111
9111
|
"use strict";
|
|
9112
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.ant-layout-head > div,\\n.ant-layout-head-top > div {\\n width: 100%;\\n height: 100%;\\n}\\n.ant-layout-head-top {\\n
|
|
9112
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.ant-layout-head > div,\\n.ant-layout-head-top > div {\\n width: 100%;\\n height: 100%;\\n}\\n.ant-layout-head-top {\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n position: relative;\\n}\\n.ant-layout-head-top-left {\\n left: 0;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n position: absolute;\\n}\\n.ant-layout-head-top-right {\\n right: 0;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n position: absolute;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/layout/Header.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9113
9113
|
|
|
9114
9114
|
/***/ }),
|
|
9115
9115
|
|
|
@@ -9142,7 +9142,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
9142
9142
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9143
9143
|
|
|
9144
9144
|
"use strict";
|
|
9145
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.AntModal__small .ant-modal {\\n width: 712px;\\n height: 640px;\\n}\\n.AntModal__middle .ant-modal {\\n width: 1104px;\\n height: 848px;\\n}\\n.AntModal__large .ant-modal {\\n width: 1600px;\\n height: 848px;\\n}\\n.AntModal__max .ant-modal {\\n width: 100%;\\n height: 100%;\\n top: 0;\\n}\\n.ant-modal-content {\\n display: flex;\\n flex-direction: column;\\n height: 100%;\\n}\\n.ant-modal-body {\\n flex: 1;\\n
|
|
9145
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.AntModal__small .ant-modal {\\n width: 712px;\\n height: 640px;\\n}\\n.AntModal__middle .ant-modal {\\n width: 1104px;\\n height: 848px;\\n}\\n.AntModal__large .ant-modal {\\n width: 1600px;\\n height: 848px;\\n}\\n.AntModal__max .ant-modal {\\n width: 100%;\\n height: 100%;\\n top: 0;\\n}\\n.ant-modal-content {\\n display: flex;\\n flex-direction: column;\\n height: 100%;\\n}\\n.ant-modal-body {\\n flex: 1;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/modal/index.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9146
9146
|
|
|
9147
9147
|
/***/ }),
|
|
9148
9148
|
|
package/dist/index.umd.js
CHANGED
|
@@ -8527,7 +8527,7 @@ eval("/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source cod
|
|
|
8527
8527
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8528
8528
|
|
|
8529
8529
|
"use strict";
|
|
8530
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AmapDrawProps: function() { return /* binding */ AmapDrawProps; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/AmapSearch/index.jsx */ \"./plugins/lib/amap/components/AmapSearch/index.jsx\");\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _AmapDraw_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AmapDraw.less */ \"./plugins/lib/amap/AmapDraw.less\");\n\n\n\n\nconst AmapDrawProps = {\n /** drawType为绘制类型\r\n * 可选值(point点 | line线 | polygon面)\r\n */\n drawType: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('point'),\n /** 绘制图标 (只在point类型下生效 */\n drawIcon: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].any,\n /** drawCount为绘制物绘制个数 */\n drawCount: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].number.def(1),\n /** drawOptions为绘制物配置项 */\n drawOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** drawInfo为绘制物信息 */\n drawInfo: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array]),\n /** 限制区域 */\n drawLimitArea: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string]),\n /** 限制区域样式配置 */\n drawLimitAreaOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** 是否隐藏搜索地址 */\n searchHidden: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].bool.def(false)\n};\nconst AmapDraw = {\n name: 'AmapDraw',\n props: AmapDrawProps,\n data() {\n return {\n amap: null,\n drawArea: null,\n drawLayers: null,\n buttonProps: [],\n drawButtonProps: [{\n type: 'primary',\n text: '绘制',\n event: {\n click: this.AmapDraw\n }\n }, {\n text: '清除',\n event: {\n click: this.AmapDrawClear\n }\n }],\n saveButtonProps: [{\n type: 'primary',\n text: '保存',\n event: {\n click: this.AmapDrawSave\n }\n }, {\n text: '取消',\n event: {\n click: this.AmapDrawReset\n }\n }]\n };\n },\n computed: {\n drawLayersInfo: {\n get() {\n return this.drawInfo;\n },\n set(newValue) {\n this.$emit('getAMapLayersInfo', newValue);\n }\n }\n },\n watch: {\n drawInfo(newValue) {\n newValue && this[`dispose${this.drawType}`]('echo');\n },\n drawOptions(newValue) {\n /** 检测options覆盖物配置是否更改,更改后要同步到地图上 */\n Object.keys(newValue).length && this.setOverlayOptions(newValue);\n },\n drawLimitArea(newValue) {\n newValue && this.setDrawLimitArea();\n }\n },\n mounted() {\n const timer = setTimeout(() => {\n this.$initAMap({\n el: 'AmapDraw'\n }, amap => {\n this.amap = amap;\n this.drawInfo && (this.drawInfo.length || Object.keys(this.drawInfo).length) && (this.drawLayersInfo = this.drawInfo, this[`dispose${this.drawType}`]('echo'));\n this.buttonProps = [].concat(this.drawButtonProps);\n /** 如果有限制区域,则描绘在地图上 */\n this.drawLimitArea && this.setDrawLimitArea();\n clearTimeout(timer);\n });\n }, 60);\n },\n destroyed() {\n this.AmapDrawClear();\n },\n methods: {\n /** 绘制 */\n AmapDraw() {\n this.buttonProps = [].concat(this.saveButtonProps);\n this.AmapDrawClear();\n const mouseTool = new this.$amap.MouseTool(this.amap);\n this[`dispose${this.drawType}`]('draw', mouseTool);\n mouseTool.on('draw', ({\n obj\n }) => {\n if (this.drawArea && !this[`is${this.drawType}InRing`](obj)) return this.amap.remove(obj), this.$message.error('未在范围内描绘!');\n this.drawCount > 1 ? (this.drawLayers = this.drawLayers || [], this.drawLayers.push(obj)) : this.drawLayers = obj;\n this.disposeData(this.drawCount > 1);\n if (this.drawLayers && (this.drawLayers.length == this.drawCount || this.drawCount == 1)) {\n return mouseTool.close();\n }\n });\n },\n /** 清空绘制 / 清空搜索 */\n AmapDrawClear() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && this.amap.remove(layerItem));\n // this.amap.clearMap()\n this.drawLayers = null;\n this.drawLayersInfo = {};\n },\n /** 保存当前绘制 */\n AmapDrawSave() {\n this.buttonProps = [].concat(this.drawButtonProps);\n },\n /** 取消当前绘制 */\n AmapDrawReset() {\n this.drawLayers.pop();\n Array.isArray(this.drawLayersInfo) ? this.drawLayersInfo.pop() : this.drawLayersInfo = {};\n this.AmapDrawSave();\n },\n /** 搜索地址 */\n searchChoose(searchMarker, searchInfo) {\n this.AmapDrawClear();\n searchMarker.setMap(this.amap);\n this.amap.setZoomAndCenter(15, searchMarker.getPosition());\n this.drawType == 'point' && (this.drawLayersInfo = searchInfo);\n // this.$emit('getAMapLayersInfo', this.drawLayersInfo)\n },\n /** 检测覆盖物配置信息并同步 */\n setOverlayOptions(options) {\n if (!this.drawLayers) return;\n this.drawCount > 1 ? this.drawLayers.forEach(drawItem => drawItem.setOptions(options)) : this.drawLayers.setOptions(options);\n },\n /** 绘制限定区域 */\n setDrawLimitArea() {\n let areaRange = [];\n try {\n areaRange = JSON.parse(this.drawLimitArea);\n } catch {\n areaRange = this.drawLimitArea;\n }\n this.drawArea && this.amap.remove(this.drawArea);\n /** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */\n this.setMapArea(areaRange);\n this.judgeOverlays();\n },\n /** 判断地图上所覆盖物是否在限制范围内 */\n judgeOverlays() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && !this[`is${this.drawType}InRing`](layerItem) && this.removeOverlay(layerItem));\n },\n /** 清除单个覆盖物(或 不符合区域范围的覆盖物 */\n removeOverlay(layerItem) {\n this.amap.remove(layerItem);\n this.$message.error('未在区域范围内,请重新描绘!');\n try {\n const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData());\n this.drawLayers.splice(i, 1);\n } catch {\n this.drawLayers = null;\n this.drawLayersInfo = {};\n }\n },\n /** 处理抛出数据 */\n disposeData(isBoolean) {\n this[`dispose${this.drawType}`](isBoolean ? 'batch' : 'single');\n // setTimeout(() => this.$emit('getAMapLayersInfo', this.drawLayersInfo), 600 )\n },\n /** 根据类型处理不同数据 */\n disposepoint(methods, mouseTool) {\n const _that = this;\n switch (methods) {\n case 'draw':\n mouseTool.marker({\n ...this.$amapLayers.setMarker(this.drawIcon).getOptions(),\n ...this.drawOptions\n });\n break;\n case 'single':\n const {\n lng,\n lat\n } = this.drawLayers.getPosition();\n const position = {\n longitude: lng,\n latitude: lat\n };\n this.$amapMethods.getMapAddress(position, address => {\n this.drawLayersInfo = {\n ...position,\n ...address\n };\n });\n break;\n case 'batch':\n // this.$set( this.drawLayersInfo, 'position', [] )\n // this.drawLayers.forEach((drawItem, i) => {\n // const {lng,lat} = drawItem.getPosition()\n // this.$set( this.drawLayersInfo.position, i, [lng,lat] )\n // })\n break;\n case 'echo':\n Array.isArray(this.drawLayersInfo) ? (this.drawLayers = [], this.drawLayersInfo.forEach((drawItem, i) => {\n this.drawLayers.push(setMarker(drawItem, i));\n })) : this.drawLayers = setMarker(this.drawLayersInfo);\n break;\n }\n function setMarker(drawItem, i = 0) {\n const {\n longitude,\n latitude,\n setIcon = _that.drawIcon\n } = drawItem;\n const disposeMarker = _that.$amapLayers.setMarker(setIcon, {\n position: [longitude, latitude],\n extData: `drawpoint${i}`\n });\n disposeMarker.setMap(_that.amap);\n return disposeMarker;\n }\n },\n disposeline(methods, mouseTool) {\n const _that = this;\n switch (methods) {\n case 'draw':\n mouseTool.polyline({\n strokeWeight: 8,\n ...this.drawOptions\n });\n break;\n case 'single':\n const range = this.drawLayers.getPath().map(({\n lng,\n lat\n }) => [lng, lat]);\n this.drawLayersInfo = {\n range\n };\n break;\n case 'batch':\n break;\n case 'echo':\n Array.isArray(this.drawLayersInfo) ? (this.drawLayers = [], this.drawLayersInfo.forEach((drawItem, i) => {\n this.drawLayers.push(setPolyline(drawItem, i));\n })) : this.drawLayers = setPolyline(this.drawLayersInfo);\n break;\n }\n function setPolyline({\n range\n }, i = 0) {\n const disposePolyline = new _that.$amap.Polyline({\n path: range,\n strokeWeight: 8,\n extData: `drawline${i}`,\n ..._that.drawOptions\n });\n disposePolyline.setMap(_that.amap);\n return disposePolyline;\n }\n }\n },\n render(h) {\n const {\n props,\n buttonProps,\n searchHidden,\n AmapDrawClear,\n searchChoose\n } = this;\n return h(\"div\", {\n \"class\": \"AmapDraw\"\n }, [!searchHidden && h(_components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n \"props\": {\n ...{\n ...props,\n buttonProps\n }\n },\n \"on\": {\n ...{\n searchReset: AmapDrawClear,\n searchChoose: searchChoose\n }\n }\n }), h(\"div\", {\n \"attrs\": {\n \"id\": \"AmapDraw\"\n }\n })]);\n }\n};\nAmapDraw.install = function (Vue) {\n Vue.component('AmapDraw', AmapDraw);\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (AmapDraw);\n\n//# sourceURL=webpack://mui/./plugins/lib/amap/AmapDraw.jsx?");
|
|
8530
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AmapDrawProps: function() { return /* binding */ AmapDrawProps; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/AmapSearch/index.jsx */ \"./plugins/lib/amap/components/AmapSearch/index.jsx\");\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _AmapDraw_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AmapDraw.less */ \"./plugins/lib/amap/AmapDraw.less\");\n\n\n\n\nconst AmapDrawProps = {\n /** drawEl为地图容器实例名称 */\n drawEl: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('AmapDraw'),\n /** drawType为绘制类型\r\n * 可选值(point点 | line线 | polygon面) \r\n */\n drawType: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('point'),\n /** 绘制图标 (只在point类型下生效 */\n drawIcon: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].any,\n /** drawCount为绘制物绘制个数 */\n drawCount: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].number.def(1),\n /** drawOptions为绘制物配置项 */\n drawOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** drawInfo为绘制物信息 */\n drawInfo: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array]),\n /** drawInfoAll为所有不同类型绘制物信息(用于回显地图图层) \r\n * 格式: { point: ([]||{}), line: ([]||{}) }\r\n */\n drawInfoAll: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object,\n /** 限制区域 */\n drawLimitArea: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].oneOfType([ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object, ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string]),\n /** 限制区域样式配置 */\n drawLimitAreaOptions: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object.def({}),\n /** 是否为纯地图展示数据 */\n isExhibition: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].bool.def(false)\n};\nconst AmapDraw = {\n name: 'AmapDraw',\n props: AmapDrawProps,\n data() {\n return {\n amap: null,\n drawArea: null,\n drawLayers: null,\n drawMouseTool: null,\n buttonProps: [],\n drawButtonProps: [{\n type: 'primary',\n text: '绘制',\n event: {\n click: this.AmapDraw\n }\n }, {\n text: '清除',\n event: {\n click: this.AmapDrawClear\n }\n }],\n saveButtonProps: [{\n type: 'primary',\n text: '保存',\n event: {\n click: this.AmapDrawSave\n }\n }, {\n text: '取消',\n event: {\n click: this.AmapDrawReset\n }\n }]\n };\n },\n computed: {\n drawLayersInfo: {\n get() {\n return this.drawInfo;\n },\n set(newValue) {\n this.$emit('getAMapLayersInfo', newValue);\n }\n }\n },\n watch: {\n drawOptions(newValue) {\n /** 检测options覆盖物配置是否更改,更改后要同步到地图上 */\n Object.keys(newValue).length && this.setOverlayOptions(newValue);\n },\n drawLimitArea(newValue) {\n newValue && this.setDrawLimitArea();\n },\n drawInfoAll(newValue) {\n newValue && this.echoDrawLayers();\n }\n },\n mounted() {\n const timer = setTimeout(() => {\n this.$initAMap({\n el: this.drawEl\n }, amap => {\n this.amap = amap;\n this.buttonProps = [].concat(this.drawButtonProps);\n this.echoDrawLayers(this.drawType);\n /** 如果有限制区域,则描绘在地图上 */\n this.drawLimitArea && this.setDrawLimitArea();\n clearTimeout(timer);\n });\n }, 60);\n },\n destroyed() {\n this.AmapDrawClear();\n },\n methods: {\n /** 绘制 */\n AmapDraw() {\n console.log('进入');\n this.buttonProps = [].concat(this.saveButtonProps);\n this.drawMouseTool = new this.$amap.MouseTool(this.amap);\n this.AmapDrawClear();\n this.setDrawLayers(this.drawType);\n this.drawMouseTool.on('draw', ({\n obj\n }) => {\n if (this.drawArea && !this[`is${this.drawType}InRing`](obj)) return this.amap.remove(obj), this.$message.error('未在范围内描绘!');\n /** 暂未支持一次性绘制多个 */\n this.drawCount > 1 ? (this.drawLayers = this.drawLayers || [], this.drawLayers.push(obj)) : this.drawLayers = obj;\n if (this.drawLayers && (this.drawLayers.length == this.drawCount || this.drawCount == 1)) {\n return this.drawMouseTool.close();\n }\n });\n },\n /** 清空绘制 / 清空搜索 */\n AmapDrawClear() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && this.amap.remove(layerItem));\n // this.amap.clearMap()\n this.drawLayers = null;\n this.drawLayersInfo = {};\n },\n /** 保存当前绘制 */\n AmapDrawSave() {\n this.assignDrawLayers(this.drawType);\n this.buttonProps = [].concat(this.drawButtonProps);\n },\n /** 取消当前绘制 */\n AmapDrawReset() {\n this.buttonProps = [].concat(this.drawButtonProps);\n this.AmapDrawClear();\n },\n /** 搜索地址 */\n searchChoose(searchMarker, searchInfo) {\n this.AmapDrawClear();\n searchMarker.setMap(this.amap);\n this.amap.setZoomAndCenter(15, searchMarker.getPosition());\n this.drawType == 'point' && (this.drawLayersInfo = searchInfo);\n // this.$emit('getAMapLayersInfo', this.drawLayersInfo)\n },\n /** 检测覆盖物配置信息并同步 */\n setOverlayOptions(options) {\n if (!this.drawLayers) return;\n this.drawCount > 1 ? this.drawLayers.forEach(drawItem => drawItem.setOptions(options)) : this.drawLayers.setOptions(options);\n },\n /** 绘制限定区域 */\n setDrawLimitArea() {\n let areaRange = [];\n try {\n areaRange = JSON.parse(this.drawLimitArea);\n } catch {\n areaRange = this.drawLimitArea;\n }\n this.drawArea && this.amap.remove(this.drawArea);\n /** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */\n this.setMapArea(areaRange);\n this.judgeOverlays();\n },\n /** 绘制地图区域范围 */\n setMapArea(jurisdictionRange) {\n this.drawArea = new this.$amap.Polygon({\n map: this.amap,\n path: jurisdictionRange,\n extData: 'Area',\n strokeWeight: 6,\n ...this.drawLimitAreaOptions\n });\n const {\n lng,\n lat\n } = this.drawArea.getBounds().getCenter();\n this.amap.setZoomAndCenter(15, [lng, lat]);\n },\n /** 判断一个线段是否在面内 */\n islineInRing(polyline) {\n const paths = polyline.getPath();\n return paths.every(pointItem => this.ispointInRing(pointItem));\n },\n /** 判断一个点是否在面内 */\n ispointInRing(point) {\n let position;\n try {\n position = point.getPosition();\n } catch {\n position = point;\n }\n return this.$amap.GeometryUtil.isPointInRing(position, this.drawArea.getPath());\n },\n /** 判断地图上所覆盖物是否在限制范围内 */\n judgeOverlays() {\n this.amap.getAllOverlays().forEach(layerItem => layerItem.getExtData() != 'Area' && !this[`is${this.drawType}InRing`](layerItem) && this.removeOverlay(layerItem));\n },\n /** 清除单个覆盖物(或 不符合区域范围的覆盖物 */\n removeOverlay(layerItem) {\n this.amap.remove(layerItem);\n this.$message.error('未在区域范围内,请重新描绘!');\n try {\n const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData());\n this.drawLayers.splice(i, 1);\n } catch {\n this.drawLayers = null;\n this.drawLayersInfo = {};\n }\n },\n /** 根据类型处理不同数据 */\n setDrawLayers(drawType) {\n const type = {\n point: 'marker',\n line: 'polyline',\n polygon: 'polygon'\n };\n\n /** 图层基础配置 */\n const drawOptions = drawType == 'point' ? this.$amapLayers.setMarker(this.drawIcon).getOptions() : {\n strokeWeight: 8\n };\n this.drawMouseTool[type[drawType]]({\n ...drawOptions,\n ...this.drawOptions\n });\n },\n /** 赋值不同图层数据 */\n assignDrawLayers(drawType) {\n if (drawType == 'point') {\n const {\n lng,\n lat\n } = this.drawLayers.getPosition();\n const position = {\n longitude: lng,\n latitude: lat\n };\n this.$amapMethods.getMapAddress(position, address => {\n this.drawLayersInfo = {\n ...position,\n ...address\n };\n });\n return;\n }\n const range = this.drawLayers.getPath().map(({\n lng,\n lat\n }) => [lng, lat]);\n this.drawLayersInfo = {\n range\n };\n },\n /** 回显不同类型图层 */\n echoDrawLayers(drawType) {\n const drawLayersItem = (drawItem, type, i = 0) => {\n let layersItem = null;\n const {\n longitude,\n latitude,\n range\n } = drawItem;\n const setOptions = {\n extData: `draw${type}${i}`,\n ...this.drawOptions\n };\n if (type == 'point') {\n layersItem = this.$amapLayers.setMarker(this.drawIcon, {\n position: [longitude, latitude],\n ...setOptions\n });\n } else {\n const options = {\n path: range,\n strokeWeight: 8,\n ...setOptions\n };\n layersItem = type == 'line' ? new this.$amap.Polyline(options) : new this.$amap.Polygon(options);\n }\n layersItem.setMap(this.amap);\n };\n if (!this.isExhibition) {\n drawLayersItem(this.drawLayersInfo, drawType);\n return;\n }\n if (this.drawInfoAll) {\n for (let key in this.drawInfoAll) {\n const isArray = Array.isArray(this.drawInfoAll[key]);\n isArray ? this.drawInfoAll[key].forEach((drawItem, i) => {\n drawLayersItem(drawItem, key, i);\n }) : drawLayersItem(this.drawInfoAll[key], key);\n }\n return;\n }\n drawLayersItem(this.drawLayersInfo, drawType);\n }\n },\n render(h) {\n const {\n props,\n buttonProps,\n isExhibition,\n AmapDrawClear,\n searchChoose\n } = this;\n console.log(isExhibition, '--isExhibition');\n return h(\"div\", {\n \"class\": \"AmapDraw\"\n }, [!isExhibition && h(_components_AmapSearch_index_jsx__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n \"props\": {\n ...{\n ...props,\n buttonProps\n }\n },\n \"on\": {\n ...{\n searchReset: AmapDrawClear,\n searchChoose: searchChoose\n }\n }\n }), h(\"div\", {\n \"attrs\": {\n \"id\": \"AmapDraw\"\n }\n })]);\n }\n};\nAmapDraw.install = function (Vue) {\n Vue.component('AmapDraw', AmapDraw);\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (AmapDraw);\n\n//# sourceURL=webpack://mui/./plugins/lib/amap/AmapDraw.jsx?");
|
|
8531
8531
|
|
|
8532
8532
|
/***/ }),
|
|
8533
8533
|
|
|
@@ -8670,7 +8670,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue_
|
|
|
8670
8670
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8671
8671
|
|
|
8672
8672
|
"use strict";
|
|
8673
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modal/index.jsx */ \"./plugins/lib/modal/index.jsx\");\n/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events.js */ \"./plugins/lib/iframe/events.js\");\n/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less */ \"./plugins/lib/iframe/index.less\");\n\n\n\n\nconst IframeContainerProps = {\n activeKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string,\n checkedKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('name'),\n linkurlKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('linkUrl'),\n operatesArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n componentsArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n postMessage: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object\n};\nconst IframeContainer = {\n name: 'IframeComp',\n props: IframeContainerProps,\n data() {\n return {\n modalComponents: {}\n };\n },\n render(h, content) {\n const {\n $props,\n modalComponents\n } = this;\n const {\n activeKey,\n checkedKey,\n componentsArr\n } = $props;\n const IframeComponents = componentsArr.map(componentItem => {\n const isActive = activeKey === componentItem[checkedKey];\n return this.getIframeComponent(componentItem, isActive);\n });\n const modalKeys = Object.keys(modalComponents);\n const ModalOperates = modalKeys.map(modalKey => {\n return h(_modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n \"props\": {\n ...{\n ...modalComponents[modalKey],\n cancelHandle: () => this.closeModalHandle(modalKey)\n }\n }\n }, [this.getIframeComponent(modalComponents[modalKey], true)]);\n });\n return h(\"div\", {\n \"class\": \"ant-pro-grid-content-page\"\n }, [IframeComponents, ModalOperates]);\n },\n watch: {\n activeKey(newVal) {\n this.modalComponents = {};\n },\n activeKeyAndParams: {\n handler(newVal, oldVal) {\n this.postCompMessage();\n },\n deep: true\n }\n },\n computed: {\n activeKeyAndParams() {\n const {\n activeKey,\n postMessage,\n componentsArr\n } = this;\n return {\n activeKey,\n postMessage,\n componentsArr\n };\n }\n },\n created() {\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalOpen', ({\n name,\n params\n }) => {\n const activeModal = this.switchModalHandle(name, params);\n activeModal && this.$set(this.modalComponents, name, {\n mode: params.mode,\n visible: true,\n ...activeModal\n });\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalClose', ({\n name,\n params\n }) => {\n this.closeModalHandle(name);\n params && this.postCompMessage(params);\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalGoBack', ({\n name,\n params\n }, closeModal) => {\n this.closeModalHandle(closeModal);\n this.switchModalHandle(name, params);\n });\n },\n mounted() {\n this.postCompMessage();\n },\n methods: {\n postCompMessage(data = {}) {\n const {\n componentsArr,\n activeKey,\n postMessage\n } = this;\n componentsArr.length && this.postIframeMessage(componentsArr, {\n type: 'refreshPage',\n activeKey,\n data\n });\n },\n closeModalHandle(name) {\n this.modalComponents[name].visible = false;\n delete this.modalComponents[name];\n },\n switchModalHandle(name, data) {\n const {\n operatesArr,\n checkedKey\n } = this;\n const activeModal = operatesArr.find(operatesItem => operatesItem[checkedKey] === name);\n activeModal && this.postIframeMessage(operatesArr, {\n type: 'refreshModal',\n activeKey: name,\n data\n });\n return activeModal;\n },\n postIframeMessage(components, iframeConfig) {\n const {\n type,\n activeKey,\n data = {}\n } = iframeConfig;\n this.$nextTick(() => {\n const {\n checkedKey,\n linkurlKey,\n postMessage\n } = this;\n const refKey = components.find(componentsItem => activeKey === componentsItem[checkedKey])?.[linkurlKey];\n
|
|
8673
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ant-design-vue/es/_util/vue-types */ \"./node_modules/ant-design-vue/es/_util/vue-types/index.js\");\n/* harmony import */ var _modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modal/index.jsx */ \"./plugins/lib/modal/index.jsx\");\n/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events.js */ \"./plugins/lib/iframe/events.js\");\n/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.less */ \"./plugins/lib/iframe/index.less\");\n\n\n\n\nconst IframeContainerProps = {\n activeKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string,\n checkedKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('name'),\n linkurlKey: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].string.def('linkUrl'),\n operatesArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n componentsArr: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].array,\n postMessage: ant_design_vue_es_util_vue_types__WEBPACK_IMPORTED_MODULE_3__[\"default\"].object\n};\nconst IframeContainer = {\n name: 'IframeComp',\n props: IframeContainerProps,\n data() {\n return {\n modalComponents: {}\n };\n },\n render(h, content) {\n const {\n $props,\n modalComponents\n } = this;\n const {\n activeKey,\n checkedKey,\n componentsArr\n } = $props;\n const IframeComponents = componentsArr.map(componentItem => {\n const isActive = activeKey === componentItem[checkedKey];\n return this.getIframeComponent(componentItem, isActive);\n });\n const modalKeys = Object.keys(modalComponents);\n const ModalOperates = modalKeys.map(modalKey => {\n return h(_modal_index_jsx__WEBPACK_IMPORTED_MODULE_0__[\"default\"], {\n \"props\": {\n ...{\n ...modalComponents[modalKey],\n cancelHandle: () => this.closeModalHandle(modalKey)\n }\n }\n }, [this.getIframeComponent(modalComponents[modalKey], true)]);\n });\n return h(\"div\", {\n \"class\": \"ant-pro-grid-content-page\"\n }, [IframeComponents, ModalOperates]);\n },\n watch: {\n activeKey(newVal) {\n this.modalComponents = {};\n },\n activeKeyAndParams: {\n handler(newVal, oldVal) {\n this.postCompMessage();\n },\n deep: true\n }\n },\n computed: {\n activeKeyAndParams() {\n const {\n activeKey,\n postMessage,\n componentsArr\n } = this;\n return {\n activeKey,\n postMessage,\n componentsArr\n };\n }\n },\n created() {\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalOpen', ({\n name,\n params\n }) => {\n const activeModal = this.switchModalHandle(name, params);\n activeModal && this.$set(this.modalComponents, name, {\n mode: params.mode,\n visible: true,\n ...activeModal\n });\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalClose', ({\n name,\n params\n }) => {\n this.closeModalHandle(name);\n params && this.postCompMessage(params);\n });\n _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].$on('modalGoBack', ({\n name,\n params\n }, closeModal) => {\n this.closeModalHandle(closeModal);\n this.switchModalHandle(name, params);\n });\n },\n mounted() {\n this.postCompMessage();\n },\n methods: {\n postCompMessage(data = {}) {\n const {\n componentsArr,\n activeKey,\n postMessage\n } = this;\n componentsArr.length && this.postIframeMessage(componentsArr, {\n type: 'refreshPage',\n activeKey,\n data\n });\n },\n closeModalHandle(name) {\n this.modalComponents[name].visible = false;\n delete this.modalComponents[name];\n },\n switchModalHandle(name, data) {\n const {\n operatesArr,\n checkedKey\n } = this;\n const activeModal = operatesArr.find(operatesItem => operatesItem[checkedKey] === name);\n activeModal && this.postIframeMessage(operatesArr, {\n type: 'refreshModal',\n activeKey: name,\n data\n });\n return activeModal;\n },\n postIframeMessage(components, iframeConfig) {\n const {\n type,\n activeKey,\n data = {}\n } = iframeConfig;\n this.$nextTick(() => {\n const {\n checkedKey,\n linkurlKey,\n postMessage\n } = this;\n const refKey = components.find(componentsItem => activeKey === componentsItem[checkedKey])?.[linkurlKey];\n if (!refKey) return;\n const iframeWin = this.$refs[refKey]?.contentWindow;\n iframeWin && iframeWin.postMessage({\n type,\n params: {\n routeQuery: postMessage,\n data,\n name: activeKey\n }\n }, '*');\n });\n },\n getIframeComponent(componentItem, isActive) {\n const h = this.$createElement;\n const {\n linkurlKey,\n checkedKey\n } = this;\n return h(\"iframe\", {\n \"attrs\": {\n \"width\": \"100%\",\n \"height\": \"100%\",\n \"src\": componentItem[linkurlKey]\n },\n \"ref\": componentItem[linkurlKey],\n \"key\": componentItem[checkedKey],\n \"style\": {\n border: 'none',\n display: isActive ? 'block' : 'none'\n }\n });\n }\n }\n};\nIframeContainer.install = function (Vue) {\n Vue.prototype.$IframeBus = _events_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"];\n Vue.component('IframePage', IframeContainer);\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (IframeContainer);\n\n//# sourceURL=webpack://mui/./plugins/lib/iframe/index.jsx?");
|
|
8674
8674
|
|
|
8675
8675
|
/***/ }),
|
|
8676
8676
|
|
|
@@ -9109,7 +9109,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
9109
9109
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9110
9110
|
|
|
9111
9111
|
"use strict";
|
|
9112
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.ant-layout-head > div,\\n.ant-layout-head-top > div {\\n width: 100%;\\n height: 100%;\\n}\\n.ant-layout-head-top {\\n
|
|
9112
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.ant-layout-head > div,\\n.ant-layout-head-top > div {\\n width: 100%;\\n height: 100%;\\n}\\n.ant-layout-head-top {\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n position: relative;\\n}\\n.ant-layout-head-top-left {\\n left: 0;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n position: absolute;\\n}\\n.ant-layout-head-top-right {\\n right: 0;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n position: absolute;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/layout/Header.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9113
9113
|
|
|
9114
9114
|
/***/ }),
|
|
9115
9115
|
|
|
@@ -9142,7 +9142,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
9142
9142
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9143
9143
|
|
|
9144
9144
|
"use strict";
|
|
9145
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.AntModal__small .ant-modal {\\n width: 712px;\\n height: 640px;\\n}\\n.AntModal__middle .ant-modal {\\n width: 1104px;\\n height: 848px;\\n}\\n.AntModal__large .ant-modal {\\n width: 1600px;\\n height: 848px;\\n}\\n.AntModal__max .ant-modal {\\n width: 100%;\\n height: 100%;\\n top: 0;\\n}\\n.ant-modal-content {\\n display: flex;\\n flex-direction: column;\\n height: 100%;\\n}\\n.ant-modal-body {\\n flex: 1;\\n
|
|
9145
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n.AntModal__small .ant-modal {\\n width: 712px;\\n height: 640px;\\n}\\n.AntModal__middle .ant-modal {\\n width: 1104px;\\n height: 848px;\\n}\\n.AntModal__large .ant-modal {\\n width: 1600px;\\n height: 848px;\\n}\\n.AntModal__max .ant-modal {\\n width: 100%;\\n height: 100%;\\n top: 0;\\n}\\n.ant-modal-content {\\n display: flex;\\n flex-direction: column;\\n height: 100%;\\n}\\n.ant-modal-body {\\n flex: 1;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/modal/index.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9146
9146
|
|
|
9147
9147
|
/***/ }),
|
|
9148
9148
|
|
package/lib/amap/AmapDraw.jsx
CHANGED
|
@@ -4,8 +4,10 @@ import PropTypes from 'ant-design-vue/es/_util/vue-types'
|
|
|
4
4
|
import './AmapDraw.less'
|
|
5
5
|
|
|
6
6
|
export const AmapDrawProps = {
|
|
7
|
+
/** drawEl为地图容器实例名称 */
|
|
8
|
+
drawEl: PropTypes.string.def('AmapDraw'),
|
|
7
9
|
/** drawType为绘制类型
|
|
8
|
-
* 可选值(point点 | line线 | polygon面)
|
|
10
|
+
* 可选值(point点 | line线 | polygon面)
|
|
9
11
|
*/
|
|
10
12
|
drawType: PropTypes.string.def('point'),
|
|
11
13
|
/** 绘制图标 (只在point类型下生效 */
|
|
@@ -16,12 +18,16 @@ export const AmapDrawProps = {
|
|
|
16
18
|
drawOptions: PropTypes.object.def({}),
|
|
17
19
|
/** drawInfo为绘制物信息 */
|
|
18
20
|
drawInfo: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
21
|
+
/** drawInfoAll为所有不同类型绘制物信息(用于回显地图图层)
|
|
22
|
+
* 格式: { point: ([]||{}), line: ([]||{}) }
|
|
23
|
+
*/
|
|
24
|
+
drawInfoAll: PropTypes.object,
|
|
19
25
|
/** 限制区域 */
|
|
20
26
|
drawLimitArea: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
21
27
|
/** 限制区域样式配置 */
|
|
22
28
|
drawLimitAreaOptions: PropTypes.object.def({}),
|
|
23
|
-
/**
|
|
24
|
-
|
|
29
|
+
/** 是否为纯地图展示数据 */
|
|
30
|
+
isExhibition: PropTypes.bool.def(false)
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
const AmapDraw = {
|
|
@@ -32,6 +38,7 @@ const AmapDraw = {
|
|
|
32
38
|
amap: null,
|
|
33
39
|
drawArea: null,
|
|
34
40
|
drawLayers: null,
|
|
41
|
+
drawMouseTool: null,
|
|
35
42
|
buttonProps: [],
|
|
36
43
|
drawButtonProps: [
|
|
37
44
|
{ type: 'primary', text: '绘制', event: { click: this.AmapDraw } },
|
|
@@ -54,26 +61,23 @@ const AmapDraw = {
|
|
|
54
61
|
}
|
|
55
62
|
},
|
|
56
63
|
watch: {
|
|
57
|
-
drawInfo(newValue) {
|
|
58
|
-
newValue && this[`dispose${this.drawType}`]('echo')
|
|
59
|
-
},
|
|
60
64
|
drawOptions(newValue) {
|
|
61
65
|
/** 检测options覆盖物配置是否更改,更改后要同步到地图上 */
|
|
62
66
|
Object.keys(newValue).length && this.setOverlayOptions(newValue)
|
|
63
67
|
},
|
|
64
68
|
drawLimitArea(newValue) {
|
|
65
69
|
newValue && this.setDrawLimitArea()
|
|
70
|
+
},
|
|
71
|
+
drawInfoAll(newValue) {
|
|
72
|
+
newValue && this.echoDrawLayers()
|
|
66
73
|
}
|
|
67
74
|
},
|
|
68
75
|
mounted() {
|
|
69
76
|
const timer = setTimeout( () => {
|
|
70
|
-
this.$initAMap({el:
|
|
77
|
+
this.$initAMap({el: this.drawEl}, amap => {
|
|
71
78
|
this.amap = amap
|
|
72
|
-
this.drawInfo && ( this.drawInfo.length || Object.keys(this.drawInfo).length ) && (
|
|
73
|
-
this.drawLayersInfo = this.drawInfo,
|
|
74
|
-
this[`dispose${this.drawType}`]('echo')
|
|
75
|
-
)
|
|
76
79
|
this.buttonProps = [].concat(this.drawButtonProps)
|
|
80
|
+
this.echoDrawLayers(this.drawType)
|
|
77
81
|
/** 如果有限制区域,则描绘在地图上 */
|
|
78
82
|
this.drawLimitArea && this.setDrawLimitArea()
|
|
79
83
|
clearTimeout(timer)
|
|
@@ -86,24 +90,27 @@ const AmapDraw = {
|
|
|
86
90
|
methods: {
|
|
87
91
|
/** 绘制 */
|
|
88
92
|
AmapDraw() {
|
|
93
|
+
console.log('进入')
|
|
89
94
|
this.buttonProps = [].concat(this.saveButtonProps)
|
|
95
|
+
this.drawMouseTool = new this.$amap.MouseTool(this.amap)
|
|
96
|
+
|
|
90
97
|
this.AmapDrawClear()
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
this.setDrawLayers(this.drawType)
|
|
99
|
+
|
|
100
|
+
this.drawMouseTool.on('draw', ({obj}) => {
|
|
94
101
|
if(this.drawArea && !this[`is${this.drawType}InRing`](obj)) return (
|
|
95
|
-
this.amap.remove(obj),
|
|
96
|
-
this.$message.error('未在范围内描绘!')
|
|
97
|
-
)
|
|
102
|
+
this.amap.remove(obj),
|
|
103
|
+
this.$message.error('未在范围内描绘!')
|
|
104
|
+
)
|
|
105
|
+
/** 暂未支持一次性绘制多个 */
|
|
98
106
|
this.drawCount > 1 ? (
|
|
99
107
|
this.drawLayers = this.drawLayers || [],
|
|
100
108
|
this.drawLayers.push(obj)
|
|
101
109
|
) : this.drawLayers = obj
|
|
102
|
-
this.disposeData(this.drawCount > 1)
|
|
103
110
|
if(this.drawLayers &&
|
|
104
111
|
(this.drawLayers.length == this.drawCount ||
|
|
105
112
|
this.drawCount == 1 )) {
|
|
106
|
-
return
|
|
113
|
+
return this.drawMouseTool.close()
|
|
107
114
|
}
|
|
108
115
|
})
|
|
109
116
|
},
|
|
@@ -114,26 +121,24 @@ const AmapDraw = {
|
|
|
114
121
|
)
|
|
115
122
|
// this.amap.clearMap()
|
|
116
123
|
this.drawLayers = null
|
|
117
|
-
this.drawLayersInfo = {}
|
|
124
|
+
this.drawLayersInfo = {}
|
|
118
125
|
},
|
|
119
126
|
/** 保存当前绘制 */
|
|
120
127
|
AmapDrawSave() {
|
|
128
|
+
this.assignDrawLayers(this.drawType)
|
|
121
129
|
this.buttonProps = [].concat(this.drawButtonProps)
|
|
122
130
|
},
|
|
123
131
|
/** 取消当前绘制 */
|
|
124
132
|
AmapDrawReset() {
|
|
125
|
-
this.
|
|
126
|
-
|
|
127
|
-
this.drawLayersInfo.pop() :
|
|
128
|
-
this.drawLayersInfo = {}
|
|
129
|
-
this.AmapDrawSave()
|
|
133
|
+
this.buttonProps = [].concat(this.drawButtonProps)
|
|
134
|
+
this.AmapDrawClear()
|
|
130
135
|
},
|
|
131
136
|
/** 搜索地址 */
|
|
132
137
|
searchChoose(searchMarker, searchInfo) {
|
|
133
|
-
this.AmapDrawClear()
|
|
134
|
-
searchMarker.setMap(this.amap)
|
|
138
|
+
this.AmapDrawClear()
|
|
139
|
+
searchMarker.setMap(this.amap)
|
|
135
140
|
this.amap.setZoomAndCenter( 15, searchMarker.getPosition() )
|
|
136
|
-
this.drawType == 'point' && (this.drawLayersInfo = searchInfo)
|
|
141
|
+
this.drawType == 'point' && (this.drawLayersInfo = searchInfo)
|
|
137
142
|
// this.$emit('getAMapLayersInfo', this.drawLayersInfo)
|
|
138
143
|
},
|
|
139
144
|
/** 检测覆盖物配置信息并同步 */
|
|
@@ -151,8 +156,31 @@ const AmapDraw = {
|
|
|
151
156
|
this.drawArea && this.amap.remove(this.drawArea)
|
|
152
157
|
/** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */
|
|
153
158
|
this.setMapArea(areaRange)
|
|
154
|
-
this.judgeOverlays()
|
|
159
|
+
this.judgeOverlays()
|
|
160
|
+
},
|
|
161
|
+
/** 绘制地图区域范围 */
|
|
162
|
+
setMapArea(jurisdictionRange) {
|
|
163
|
+
this.drawArea = new this.$amap.Polygon({
|
|
164
|
+
map: this.amap,
|
|
165
|
+
path: jurisdictionRange,
|
|
166
|
+
extData: 'Area',
|
|
167
|
+
strokeWeight: 6,
|
|
168
|
+
...this.drawLimitAreaOptions
|
|
169
|
+
})
|
|
170
|
+
const {lng,lat} = this.drawArea.getBounds().getCenter()
|
|
171
|
+
this.amap.setZoomAndCenter( 15, [lng,lat] )
|
|
155
172
|
},
|
|
173
|
+
/** 判断一个线段是否在面内 */
|
|
174
|
+
islineInRing(polyline) {
|
|
175
|
+
const paths = polyline.getPath()
|
|
176
|
+
return paths.every( pointItem => this.ispointInRing(pointItem) )
|
|
177
|
+
},
|
|
178
|
+
/** 判断一个点是否在面内 */
|
|
179
|
+
ispointInRing(point) {
|
|
180
|
+
let position
|
|
181
|
+
try { position = point.getPosition() } catch{ position = point }
|
|
182
|
+
return this.$amap.GeometryUtil.isPointInRing(position,this.drawArea.getPath())
|
|
183
|
+
},
|
|
156
184
|
/** 判断地图上所覆盖物是否在限制范围内 */
|
|
157
185
|
judgeOverlays() {
|
|
158
186
|
this.amap.getAllOverlays().forEach( layerItem =>
|
|
@@ -164,7 +192,7 @@ const AmapDraw = {
|
|
|
164
192
|
removeOverlay(layerItem) {
|
|
165
193
|
this.amap.remove(layerItem)
|
|
166
194
|
this.$message.error('未在区域范围内,请重新描绘!')
|
|
167
|
-
try {
|
|
195
|
+
try {
|
|
168
196
|
const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData() )
|
|
169
197
|
this.drawLayers.splice( i, 1 )
|
|
170
198
|
} catch {
|
|
@@ -172,102 +200,107 @@ const AmapDraw = {
|
|
|
172
200
|
this.drawLayersInfo = {}
|
|
173
201
|
}
|
|
174
202
|
},
|
|
175
|
-
/** 处理抛出数据 */
|
|
176
|
-
disposeData(isBoolean) {
|
|
177
|
-
this[`dispose${this.drawType}`](isBoolean?'batch':'single')
|
|
178
|
-
// setTimeout(() => this.$emit('getAMapLayersInfo', this.drawLayersInfo), 600 )
|
|
179
|
-
},
|
|
180
203
|
/** 根据类型处理不同数据 */
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
case 'batch':
|
|
201
|
-
// this.$set( this.drawLayersInfo, 'position', [] )
|
|
202
|
-
// this.drawLayers.forEach((drawItem, i) => {
|
|
203
|
-
// const {lng,lat} = drawItem.getPosition()
|
|
204
|
-
// this.$set( this.drawLayersInfo.position, i, [lng,lat] )
|
|
205
|
-
// })
|
|
206
|
-
break;
|
|
207
|
-
case 'echo':
|
|
208
|
-
Array.isArray(this.drawLayersInfo) ?
|
|
209
|
-
(this.drawLayers = [],
|
|
210
|
-
this.drawLayersInfo.forEach( (drawItem, i) => {
|
|
211
|
-
this.drawLayers.push(setMarker(drawItem, i))
|
|
212
|
-
} )) :
|
|
213
|
-
this.drawLayers = setMarker(this.drawLayersInfo)
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
function setMarker(drawItem, i = 0) {
|
|
217
|
-
const {longitude, latitude, setIcon = _that.drawIcon} = drawItem
|
|
218
|
-
const disposeMarker = _that.$amapLayers.setMarker(
|
|
219
|
-
setIcon,
|
|
220
|
-
{ position: [longitude, latitude], extData: `drawpoint${i}` }
|
|
221
|
-
)
|
|
222
|
-
disposeMarker.setMap(_that.amap)
|
|
223
|
-
return disposeMarker
|
|
224
|
-
}
|
|
204
|
+
setDrawLayers(drawType) {
|
|
205
|
+
|
|
206
|
+
const type = {
|
|
207
|
+
point: 'marker',
|
|
208
|
+
line: 'polyline',
|
|
209
|
+
polygon: 'polygon'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** 图层基础配置 */
|
|
213
|
+
const drawOptions =
|
|
214
|
+
drawType == 'point' ?
|
|
215
|
+
this.$amapLayers.setMarker(this.drawIcon).getOptions() :
|
|
216
|
+
{ strokeWeight: 8 }
|
|
217
|
+
|
|
218
|
+
this.drawMouseTool[type[drawType]]({
|
|
219
|
+
...drawOptions,
|
|
220
|
+
...this.drawOptions
|
|
221
|
+
})
|
|
222
|
+
|
|
225
223
|
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
224
|
+
/** 赋值不同图层数据 */
|
|
225
|
+
assignDrawLayers(drawType) {
|
|
226
|
+
if(drawType == 'point') {
|
|
227
|
+
const {lng,lat} = this.drawLayers.getPosition()
|
|
228
|
+
const position = { longitude: lng, latitude: lat }
|
|
229
|
+
this.$amapMethods.getMapAddress(position, address => {
|
|
230
|
+
this.drawLayersInfo = {
|
|
231
|
+
...position,
|
|
232
|
+
...address
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
const range = this.drawLayers.getPath()
|
|
238
|
+
.map(({lng,lat}) => [lng,lat])
|
|
239
|
+
this.drawLayersInfo = { range }
|
|
240
|
+
},
|
|
241
|
+
/** 回显不同类型图层 */
|
|
242
|
+
echoDrawLayers(drawType) {
|
|
243
|
+
|
|
244
|
+
const drawLayersItem = (drawItem, type, i=0) => {
|
|
245
|
+
let layersItem = null
|
|
246
|
+
const {longitude, latitude, range} = drawItem
|
|
247
|
+
const setOptions = {
|
|
248
|
+
extData: `draw${type}${i}`,
|
|
249
|
+
...this.drawOptions
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
|
|
252
|
+
if(type == 'point') {
|
|
253
|
+
layersItem = this.$amapLayers.setMarker(
|
|
254
|
+
this.drawIcon,
|
|
255
|
+
{
|
|
256
|
+
position: [longitude, latitude],
|
|
257
|
+
...setOptions
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const options = {
|
|
254
263
|
path: range,
|
|
255
|
-
strokeWeight: 8,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
264
|
+
strokeWeight: 8,
|
|
265
|
+
...setOptions
|
|
266
|
+
}
|
|
267
|
+
layersItem = type == 'line' ?
|
|
268
|
+
new this.$amap.Polyline(options) :
|
|
269
|
+
new this.$amap.Polygon(options)
|
|
270
|
+
}
|
|
271
|
+
layersItem.setMap(this.amap)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if(!this.isExhibition) {
|
|
275
|
+
drawLayersItem(this.drawLayersInfo, drawType)
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if(this.drawInfoAll) {
|
|
280
|
+
for (let key in this.drawInfoAll) {
|
|
281
|
+
const isArray = Array.isArray(this.drawInfoAll[key])
|
|
282
|
+
isArray ?
|
|
283
|
+
this.drawInfoAll[key].forEach((drawItem, i) => {
|
|
284
|
+
drawLayersItem(drawItem, key, i)
|
|
285
|
+
}) :
|
|
286
|
+
drawLayersItem(this.drawInfoAll[key], key)
|
|
287
|
+
}
|
|
288
|
+
return
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
drawLayersItem(this.drawLayersInfo, drawType)
|
|
292
|
+
|
|
262
293
|
}
|
|
263
294
|
},
|
|
264
295
|
render (h) {
|
|
265
|
-
const { props, buttonProps,
|
|
296
|
+
const { props, buttonProps, isExhibition, AmapDrawClear, searchChoose } = this
|
|
297
|
+
|
|
298
|
+
console.log(isExhibition, '--isExhibition')
|
|
266
299
|
|
|
267
300
|
return (
|
|
268
301
|
<div class="AmapDraw">
|
|
269
302
|
{
|
|
270
|
-
!
|
|
303
|
+
!isExhibition &&
|
|
271
304
|
<AmapSearch
|
|
272
305
|
{ ...{ props: { ...props, buttonProps }, on: { searchReset: AmapDrawClear, searchChoose: searchChoose } } }
|
|
273
306
|
/>
|
package/lib/iframe/index.jsx
CHANGED
|
@@ -129,15 +129,10 @@ const IframeContainer = {
|
|
|
129
129
|
this.$nextTick(() => {
|
|
130
130
|
const { checkedKey, linkurlKey, postMessage } = this
|
|
131
131
|
const refKey = components.find(componentsItem => activeKey === componentsItem[checkedKey])?.[linkurlKey]
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
iframeWin.postMessage({ type, params: { routeQuery: postMessage, data, name: activeKey } }, '*')
|
|
137
|
-
}
|
|
138
|
-
iframeWin && iframeWin.postMessage({ type, params: { routeQuery: postMessage, data, name: activeKey } }, '*')
|
|
139
|
-
clearTimeout(timer)
|
|
140
|
-
}, 60 )
|
|
132
|
+
|
|
133
|
+
if(!refKey) return
|
|
134
|
+
const iframeWin = this.$refs[refKey]?.contentWindow
|
|
135
|
+
iframeWin && iframeWin.postMessage({ type, params: { routeQuery: postMessage, data, name: activeKey } }, '*')
|
|
141
136
|
})
|
|
142
137
|
},
|
|
143
138
|
getIframeComponent(componentItem, isActive) {
|
package/lib/layout/Header.less
CHANGED
package/lib/modal/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.AntModal__small .ant-modal{width:712px;height:640px}.AntModal__middle .ant-modal{width:1104px;height:848px}.AntModal__large .ant-modal{width:1600px;height:848px}.AntModal__max .ant-modal{width:100%;height:100%;top:0}.ant-modal-content{display:flex;flex-direction:column;height:100%}.ant-modal-body{flex:1
|
|
1
|
+
.AntModal__small .ant-modal{width:712px;height:640px}.AntModal__middle .ant-modal{width:1104px;height:848px}.AntModal__large .ant-modal{width:1600px;height:848px}.AntModal__max .ant-modal{width:100%;height:100%;top:0}.ant-modal-content{display:flex;flex-direction:column;height:100%}.ant-modal-body{flex:1}
|
package/lib/modal/index.less
CHANGED
package/package.json
CHANGED
|
@@ -4,8 +4,10 @@ import PropTypes from 'ant-design-vue/es/_util/vue-types'
|
|
|
4
4
|
import './AmapDraw.less'
|
|
5
5
|
|
|
6
6
|
export const AmapDrawProps = {
|
|
7
|
+
/** drawEl为地图容器实例名称 */
|
|
8
|
+
drawEl: PropTypes.string.def('AmapDraw'),
|
|
7
9
|
/** drawType为绘制类型
|
|
8
|
-
* 可选值(point点 | line线 | polygon面)
|
|
10
|
+
* 可选值(point点 | line线 | polygon面)
|
|
9
11
|
*/
|
|
10
12
|
drawType: PropTypes.string.def('point'),
|
|
11
13
|
/** 绘制图标 (只在point类型下生效 */
|
|
@@ -16,12 +18,16 @@ export const AmapDrawProps = {
|
|
|
16
18
|
drawOptions: PropTypes.object.def({}),
|
|
17
19
|
/** drawInfo为绘制物信息 */
|
|
18
20
|
drawInfo: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
21
|
+
/** drawInfoAll为所有不同类型绘制物信息(用于回显地图图层)
|
|
22
|
+
* 格式: { point: ([]||{}), line: ([]||{}) }
|
|
23
|
+
*/
|
|
24
|
+
drawInfoAll: PropTypes.object,
|
|
19
25
|
/** 限制区域 */
|
|
20
26
|
drawLimitArea: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
21
27
|
/** 限制区域样式配置 */
|
|
22
28
|
drawLimitAreaOptions: PropTypes.object.def({}),
|
|
23
|
-
/**
|
|
24
|
-
|
|
29
|
+
/** 是否为纯地图展示数据 */
|
|
30
|
+
isExhibition: PropTypes.bool.def(false)
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
const AmapDraw = {
|
|
@@ -32,6 +38,7 @@ const AmapDraw = {
|
|
|
32
38
|
amap: null,
|
|
33
39
|
drawArea: null,
|
|
34
40
|
drawLayers: null,
|
|
41
|
+
drawMouseTool: null,
|
|
35
42
|
buttonProps: [],
|
|
36
43
|
drawButtonProps: [
|
|
37
44
|
{ type: 'primary', text: '绘制', event: { click: this.AmapDraw } },
|
|
@@ -54,26 +61,23 @@ const AmapDraw = {
|
|
|
54
61
|
}
|
|
55
62
|
},
|
|
56
63
|
watch: {
|
|
57
|
-
drawInfo(newValue) {
|
|
58
|
-
newValue && this[`dispose${this.drawType}`]('echo')
|
|
59
|
-
},
|
|
60
64
|
drawOptions(newValue) {
|
|
61
65
|
/** 检测options覆盖物配置是否更改,更改后要同步到地图上 */
|
|
62
66
|
Object.keys(newValue).length && this.setOverlayOptions(newValue)
|
|
63
67
|
},
|
|
64
68
|
drawLimitArea(newValue) {
|
|
65
69
|
newValue && this.setDrawLimitArea()
|
|
70
|
+
},
|
|
71
|
+
drawInfoAll(newValue) {
|
|
72
|
+
newValue && this.echoDrawLayers()
|
|
66
73
|
}
|
|
67
74
|
},
|
|
68
75
|
mounted() {
|
|
69
76
|
const timer = setTimeout( () => {
|
|
70
|
-
this.$initAMap({el:
|
|
77
|
+
this.$initAMap({el: this.drawEl}, amap => {
|
|
71
78
|
this.amap = amap
|
|
72
|
-
this.drawInfo && ( this.drawInfo.length || Object.keys(this.drawInfo).length ) && (
|
|
73
|
-
this.drawLayersInfo = this.drawInfo,
|
|
74
|
-
this[`dispose${this.drawType}`]('echo')
|
|
75
|
-
)
|
|
76
79
|
this.buttonProps = [].concat(this.drawButtonProps)
|
|
80
|
+
this.echoDrawLayers(this.drawType)
|
|
77
81
|
/** 如果有限制区域,则描绘在地图上 */
|
|
78
82
|
this.drawLimitArea && this.setDrawLimitArea()
|
|
79
83
|
clearTimeout(timer)
|
|
@@ -86,24 +90,27 @@ const AmapDraw = {
|
|
|
86
90
|
methods: {
|
|
87
91
|
/** 绘制 */
|
|
88
92
|
AmapDraw() {
|
|
93
|
+
console.log('进入')
|
|
89
94
|
this.buttonProps = [].concat(this.saveButtonProps)
|
|
95
|
+
this.drawMouseTool = new this.$amap.MouseTool(this.amap)
|
|
96
|
+
|
|
90
97
|
this.AmapDrawClear()
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
this.setDrawLayers(this.drawType)
|
|
99
|
+
|
|
100
|
+
this.drawMouseTool.on('draw', ({obj}) => {
|
|
94
101
|
if(this.drawArea && !this[`is${this.drawType}InRing`](obj)) return (
|
|
95
|
-
this.amap.remove(obj),
|
|
96
|
-
this.$message.error('未在范围内描绘!')
|
|
97
|
-
)
|
|
102
|
+
this.amap.remove(obj),
|
|
103
|
+
this.$message.error('未在范围内描绘!')
|
|
104
|
+
)
|
|
105
|
+
/** 暂未支持一次性绘制多个 */
|
|
98
106
|
this.drawCount > 1 ? (
|
|
99
107
|
this.drawLayers = this.drawLayers || [],
|
|
100
108
|
this.drawLayers.push(obj)
|
|
101
109
|
) : this.drawLayers = obj
|
|
102
|
-
this.disposeData(this.drawCount > 1)
|
|
103
110
|
if(this.drawLayers &&
|
|
104
111
|
(this.drawLayers.length == this.drawCount ||
|
|
105
112
|
this.drawCount == 1 )) {
|
|
106
|
-
return
|
|
113
|
+
return this.drawMouseTool.close()
|
|
107
114
|
}
|
|
108
115
|
})
|
|
109
116
|
},
|
|
@@ -114,26 +121,24 @@ const AmapDraw = {
|
|
|
114
121
|
)
|
|
115
122
|
// this.amap.clearMap()
|
|
116
123
|
this.drawLayers = null
|
|
117
|
-
this.drawLayersInfo = {}
|
|
124
|
+
this.drawLayersInfo = {}
|
|
118
125
|
},
|
|
119
126
|
/** 保存当前绘制 */
|
|
120
127
|
AmapDrawSave() {
|
|
128
|
+
this.assignDrawLayers(this.drawType)
|
|
121
129
|
this.buttonProps = [].concat(this.drawButtonProps)
|
|
122
130
|
},
|
|
123
131
|
/** 取消当前绘制 */
|
|
124
132
|
AmapDrawReset() {
|
|
125
|
-
this.
|
|
126
|
-
|
|
127
|
-
this.drawLayersInfo.pop() :
|
|
128
|
-
this.drawLayersInfo = {}
|
|
129
|
-
this.AmapDrawSave()
|
|
133
|
+
this.buttonProps = [].concat(this.drawButtonProps)
|
|
134
|
+
this.AmapDrawClear()
|
|
130
135
|
},
|
|
131
136
|
/** 搜索地址 */
|
|
132
137
|
searchChoose(searchMarker, searchInfo) {
|
|
133
|
-
this.AmapDrawClear()
|
|
134
|
-
searchMarker.setMap(this.amap)
|
|
138
|
+
this.AmapDrawClear()
|
|
139
|
+
searchMarker.setMap(this.amap)
|
|
135
140
|
this.amap.setZoomAndCenter( 15, searchMarker.getPosition() )
|
|
136
|
-
this.drawType == 'point' && (this.drawLayersInfo = searchInfo)
|
|
141
|
+
this.drawType == 'point' && (this.drawLayersInfo = searchInfo)
|
|
137
142
|
// this.$emit('getAMapLayersInfo', this.drawLayersInfo)
|
|
138
143
|
},
|
|
139
144
|
/** 检测覆盖物配置信息并同步 */
|
|
@@ -151,8 +156,31 @@ const AmapDraw = {
|
|
|
151
156
|
this.drawArea && this.amap.remove(this.drawArea)
|
|
152
157
|
/** 判断目前地图上存在的所绘制覆盖物是否在限制范围内 */
|
|
153
158
|
this.setMapArea(areaRange)
|
|
154
|
-
this.judgeOverlays()
|
|
159
|
+
this.judgeOverlays()
|
|
160
|
+
},
|
|
161
|
+
/** 绘制地图区域范围 */
|
|
162
|
+
setMapArea(jurisdictionRange) {
|
|
163
|
+
this.drawArea = new this.$amap.Polygon({
|
|
164
|
+
map: this.amap,
|
|
165
|
+
path: jurisdictionRange,
|
|
166
|
+
extData: 'Area',
|
|
167
|
+
strokeWeight: 6,
|
|
168
|
+
...this.drawLimitAreaOptions
|
|
169
|
+
})
|
|
170
|
+
const {lng,lat} = this.drawArea.getBounds().getCenter()
|
|
171
|
+
this.amap.setZoomAndCenter( 15, [lng,lat] )
|
|
155
172
|
},
|
|
173
|
+
/** 判断一个线段是否在面内 */
|
|
174
|
+
islineInRing(polyline) {
|
|
175
|
+
const paths = polyline.getPath()
|
|
176
|
+
return paths.every( pointItem => this.ispointInRing(pointItem) )
|
|
177
|
+
},
|
|
178
|
+
/** 判断一个点是否在面内 */
|
|
179
|
+
ispointInRing(point) {
|
|
180
|
+
let position
|
|
181
|
+
try { position = point.getPosition() } catch{ position = point }
|
|
182
|
+
return this.$amap.GeometryUtil.isPointInRing(position,this.drawArea.getPath())
|
|
183
|
+
},
|
|
156
184
|
/** 判断地图上所覆盖物是否在限制范围内 */
|
|
157
185
|
judgeOverlays() {
|
|
158
186
|
this.amap.getAllOverlays().forEach( layerItem =>
|
|
@@ -164,7 +192,7 @@ const AmapDraw = {
|
|
|
164
192
|
removeOverlay(layerItem) {
|
|
165
193
|
this.amap.remove(layerItem)
|
|
166
194
|
this.$message.error('未在区域范围内,请重新描绘!')
|
|
167
|
-
try {
|
|
195
|
+
try {
|
|
168
196
|
const i = this.drawLayers.findIndex(layer => layer.getExtData() == layerItem.getExtData() )
|
|
169
197
|
this.drawLayers.splice( i, 1 )
|
|
170
198
|
} catch {
|
|
@@ -172,102 +200,107 @@ const AmapDraw = {
|
|
|
172
200
|
this.drawLayersInfo = {}
|
|
173
201
|
}
|
|
174
202
|
},
|
|
175
|
-
/** 处理抛出数据 */
|
|
176
|
-
disposeData(isBoolean) {
|
|
177
|
-
this[`dispose${this.drawType}`](isBoolean?'batch':'single')
|
|
178
|
-
// setTimeout(() => this.$emit('getAMapLayersInfo', this.drawLayersInfo), 600 )
|
|
179
|
-
},
|
|
180
203
|
/** 根据类型处理不同数据 */
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
case 'batch':
|
|
201
|
-
// this.$set( this.drawLayersInfo, 'position', [] )
|
|
202
|
-
// this.drawLayers.forEach((drawItem, i) => {
|
|
203
|
-
// const {lng,lat} = drawItem.getPosition()
|
|
204
|
-
// this.$set( this.drawLayersInfo.position, i, [lng,lat] )
|
|
205
|
-
// })
|
|
206
|
-
break;
|
|
207
|
-
case 'echo':
|
|
208
|
-
Array.isArray(this.drawLayersInfo) ?
|
|
209
|
-
(this.drawLayers = [],
|
|
210
|
-
this.drawLayersInfo.forEach( (drawItem, i) => {
|
|
211
|
-
this.drawLayers.push(setMarker(drawItem, i))
|
|
212
|
-
} )) :
|
|
213
|
-
this.drawLayers = setMarker(this.drawLayersInfo)
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
function setMarker(drawItem, i = 0) {
|
|
217
|
-
const {longitude, latitude, setIcon = _that.drawIcon} = drawItem
|
|
218
|
-
const disposeMarker = _that.$amapLayers.setMarker(
|
|
219
|
-
setIcon,
|
|
220
|
-
{ position: [longitude, latitude], extData: `drawpoint${i}` }
|
|
221
|
-
)
|
|
222
|
-
disposeMarker.setMap(_that.amap)
|
|
223
|
-
return disposeMarker
|
|
224
|
-
}
|
|
204
|
+
setDrawLayers(drawType) {
|
|
205
|
+
|
|
206
|
+
const type = {
|
|
207
|
+
point: 'marker',
|
|
208
|
+
line: 'polyline',
|
|
209
|
+
polygon: 'polygon'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** 图层基础配置 */
|
|
213
|
+
const drawOptions =
|
|
214
|
+
drawType == 'point' ?
|
|
215
|
+
this.$amapLayers.setMarker(this.drawIcon).getOptions() :
|
|
216
|
+
{ strokeWeight: 8 }
|
|
217
|
+
|
|
218
|
+
this.drawMouseTool[type[drawType]]({
|
|
219
|
+
...drawOptions,
|
|
220
|
+
...this.drawOptions
|
|
221
|
+
})
|
|
222
|
+
|
|
225
223
|
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
224
|
+
/** 赋值不同图层数据 */
|
|
225
|
+
assignDrawLayers(drawType) {
|
|
226
|
+
if(drawType == 'point') {
|
|
227
|
+
const {lng,lat} = this.drawLayers.getPosition()
|
|
228
|
+
const position = { longitude: lng, latitude: lat }
|
|
229
|
+
this.$amapMethods.getMapAddress(position, address => {
|
|
230
|
+
this.drawLayersInfo = {
|
|
231
|
+
...position,
|
|
232
|
+
...address
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
const range = this.drawLayers.getPath()
|
|
238
|
+
.map(({lng,lat}) => [lng,lat])
|
|
239
|
+
this.drawLayersInfo = { range }
|
|
240
|
+
},
|
|
241
|
+
/** 回显不同类型图层 */
|
|
242
|
+
echoDrawLayers(drawType) {
|
|
243
|
+
|
|
244
|
+
const drawLayersItem = (drawItem, type, i=0) => {
|
|
245
|
+
let layersItem = null
|
|
246
|
+
const {longitude, latitude, range} = drawItem
|
|
247
|
+
const setOptions = {
|
|
248
|
+
extData: `draw${type}${i}`,
|
|
249
|
+
...this.drawOptions
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
|
|
252
|
+
if(type == 'point') {
|
|
253
|
+
layersItem = this.$amapLayers.setMarker(
|
|
254
|
+
this.drawIcon,
|
|
255
|
+
{
|
|
256
|
+
position: [longitude, latitude],
|
|
257
|
+
...setOptions
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const options = {
|
|
254
263
|
path: range,
|
|
255
|
-
strokeWeight: 8,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
264
|
+
strokeWeight: 8,
|
|
265
|
+
...setOptions
|
|
266
|
+
}
|
|
267
|
+
layersItem = type == 'line' ?
|
|
268
|
+
new this.$amap.Polyline(options) :
|
|
269
|
+
new this.$amap.Polygon(options)
|
|
270
|
+
}
|
|
271
|
+
layersItem.setMap(this.amap)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if(!this.isExhibition) {
|
|
275
|
+
drawLayersItem(this.drawLayersInfo, drawType)
|
|
276
|
+
return
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if(this.drawInfoAll) {
|
|
280
|
+
for (let key in this.drawInfoAll) {
|
|
281
|
+
const isArray = Array.isArray(this.drawInfoAll[key])
|
|
282
|
+
isArray ?
|
|
283
|
+
this.drawInfoAll[key].forEach((drawItem, i) => {
|
|
284
|
+
drawLayersItem(drawItem, key, i)
|
|
285
|
+
}) :
|
|
286
|
+
drawLayersItem(this.drawInfoAll[key], key)
|
|
287
|
+
}
|
|
288
|
+
return
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
drawLayersItem(this.drawLayersInfo, drawType)
|
|
292
|
+
|
|
262
293
|
}
|
|
263
294
|
},
|
|
264
295
|
render (h) {
|
|
265
|
-
const { props, buttonProps,
|
|
296
|
+
const { props, buttonProps, isExhibition, AmapDrawClear, searchChoose } = this
|
|
297
|
+
|
|
298
|
+
console.log(isExhibition, '--isExhibition')
|
|
266
299
|
|
|
267
300
|
return (
|
|
268
301
|
<div class="AmapDraw">
|
|
269
302
|
{
|
|
270
|
-
!
|
|
303
|
+
!isExhibition &&
|
|
271
304
|
<AmapSearch
|
|
272
305
|
{ ...{ props: { ...props, buttonProps }, on: { searchReset: AmapDrawClear, searchChoose: searchChoose } } }
|
|
273
306
|
/>
|
|
@@ -129,15 +129,10 @@ const IframeContainer = {
|
|
|
129
129
|
this.$nextTick(() => {
|
|
130
130
|
const { checkedKey, linkurlKey, postMessage } = this
|
|
131
131
|
const refKey = components.find(componentsItem => activeKey === componentsItem[checkedKey])?.[linkurlKey]
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
iframeWin.postMessage({ type, params: { routeQuery: postMessage, data, name: activeKey } }, '*')
|
|
137
|
-
}
|
|
138
|
-
iframeWin && iframeWin.postMessage({ type, params: { routeQuery: postMessage, data, name: activeKey } }, '*')
|
|
139
|
-
clearTimeout(timer)
|
|
140
|
-
}, 60 )
|
|
132
|
+
|
|
133
|
+
if(!refKey) return
|
|
134
|
+
const iframeWin = this.$refs[refKey]?.contentWindow
|
|
135
|
+
iframeWin && iframeWin.postMessage({ type, params: { routeQuery: postMessage, data, name: activeKey } }, '*')
|
|
141
136
|
})
|
|
142
137
|
},
|
|
143
138
|
getIframeComponent(componentItem, isActive) {
|