Merge branch 'dev' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_webapp into dev
This commit is contained in:
@@ -148,7 +148,7 @@ export default {
|
|||||||
submit() {
|
submit() {
|
||||||
this.$refs.ruleForm.validate(v => {
|
this.$refs.ruleForm.validate(v => {
|
||||||
if (v) {
|
if (v) {
|
||||||
if(this.form.pictureUrlList.length) {
|
if(this.form.pictureUrlList && this.form.pictureUrlList.length) {
|
||||||
this.form.pictureUrl = this.form.pictureUrlList[0].url
|
this.form.pictureUrl = this.form.pictureUrlList[0].url
|
||||||
}
|
}
|
||||||
this.instance.post(`/app/apppublicityinfo/addOrUpdate`, this.form).then(res => {
|
this.instance.post(`/app/apppublicityinfo/addOrUpdate`, this.form).then(res => {
|
||||||
@@ -166,6 +166,7 @@ export default {
|
|||||||
params: {id}
|
params: {id}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
|
res.data.pictureUrlList = []
|
||||||
if(res.data.pictureUrl) {
|
if(res.data.pictureUrl) {
|
||||||
res.data.pictureUrlList = [{url: res.data.pictureUrl}]
|
res.data.pictureUrlList = [{url: res.data.pictureUrl}]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,9 @@
|
|||||||
<el-input v-model="forms.address" placeholder="限200字" maxlength="200"></el-input>
|
<el-input v-model="forms.address" placeholder="限200字" maxlength="200"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="网格范围" prop="enclosure">
|
<el-form-item label="网格范围" prop="enclosure">
|
||||||
<el-button size="small" @click="showMap = true">地图标绘</el-button>
|
<map-plotting v-model="forms.points">
|
||||||
|
<el-button size="small">地图标绘</el-button>
|
||||||
|
</map-plotting>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</ai-card>
|
</ai-card>
|
||||||
@@ -65,56 +67,16 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ai-detail>
|
</ai-detail>
|
||||||
<ai-dialog
|
|
||||||
title="网格范围"
|
|
||||||
:visible.sync="showMap"
|
|
||||||
:customFooter="true"
|
|
||||||
:destroyOnClose="true"
|
|
||||||
@opened="beforeSelectMap"
|
|
||||||
border
|
|
||||||
width="850px"
|
|
||||||
>
|
|
||||||
<div class="map">
|
|
||||||
<div class="tipinput">
|
|
||||||
<el-input
|
|
||||||
v-model="searchAddress"
|
|
||||||
@change="addressChange"
|
|
||||||
clearable
|
|
||||||
placeholder="请输入关键字"
|
|
||||||
id="tipinput"
|
|
||||||
size="medium"
|
|
||||||
style="width: 200px"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div id="panel"/>
|
|
||||||
<div class="container" id="container"></div>
|
|
||||||
<el-button-group style="margin-top: 8px" v-if="forms.plottingStatus==1">
|
|
||||||
<el-button type="primary" size="mini" @click="polyEditor.open()">开始编辑</el-button>
|
|
||||||
<el-button size="mini" @click="polyEditor.close()">结束编辑</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
<el-button-group
|
|
||||||
style="margin-top: 8px"
|
|
||||||
v-if="forms.plottingStatus == 0"
|
|
||||||
>
|
|
||||||
<el-button size="mini" @click="draw('polygon')">开始绘制多边形</el-button>
|
|
||||||
<!-- <el-button size="mini" @click="close()">关闭绘制</el-button> -->
|
|
||||||
<el-button size="mini" @click="clear()">清除绘制</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
</div>
|
|
||||||
<div class="dialog-footer" slot="footer">
|
|
||||||
<el-button size="medium" @click="showMap = false">取消</el-button>
|
|
||||||
<el-button type="primary" size="medium" @click="surePotting()">确认</el-button>
|
|
||||||
</div>
|
|
||||||
</ai-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AMapLoader from "@amap/amap-jsapi-loader";
|
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
|
import MapPlotting from "./mapPlotting";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "addBlock",
|
name: "addBlock",
|
||||||
|
components: {MapPlotting},
|
||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
dict: Object,
|
dict: Object,
|
||||||
@@ -126,17 +88,7 @@ export default {
|
|||||||
girdMemberManageList: [],
|
girdMemberManageList: [],
|
||||||
girdMemberList: []
|
girdMemberList: []
|
||||||
},
|
},
|
||||||
showMap: false,
|
|
||||||
map: "",
|
|
||||||
mouseTool: "",
|
|
||||||
searchAddress: "",
|
|
||||||
placeSearch: "",
|
|
||||||
overlays: [],
|
|
||||||
options: [],
|
options: [],
|
||||||
path: [],
|
|
||||||
location: {},
|
|
||||||
polyEditor: "",
|
|
||||||
title: "添加网格区块",
|
|
||||||
parentGirdInfo: {},
|
parentGirdInfo: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -177,7 +129,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getCorpLocation()
|
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
this.searchDetail();
|
this.searchDetail();
|
||||||
} else {
|
} else {
|
||||||
@@ -206,147 +157,6 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
beforeSelectMap() {
|
|
||||||
AMapLoader.load({
|
|
||||||
key: "b553334ba34f7ac3cd09df9bc8b539dc", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
||||||
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
||||||
plugins: ["AMap.MouseTool", "AMap.PlaceSearch", "AMap.PolygonEditor"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
||||||
AMapUI: {
|
|
||||||
// 是否加载 AMapUI,缺省不加载
|
|
||||||
version: "1.1", // AMapUI 缺省 1.1
|
|
||||||
plugins: [], // 需要加载的 AMapUI ui插件
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((AMap) => {
|
|
||||||
this.map = new AMap.Map("container", {
|
|
||||||
resizeEnable: true,
|
|
||||||
});
|
|
||||||
if (this.forms.plottingStatus == 1) {
|
|
||||||
let path = [];
|
|
||||||
this.forms.points.map((e, index) => {
|
|
||||||
path[index] = [e.lng, e.lat];
|
|
||||||
});
|
|
||||||
let polygon = new AMap.Polygon({
|
|
||||||
path: path,
|
|
||||||
strokeColor: "#FF33FF",
|
|
||||||
strokeWeight: 6,
|
|
||||||
strokeOpacity: 0.2,
|
|
||||||
fillOpacity: 0.4,
|
|
||||||
fillColor: "#1791fc",
|
|
||||||
zIndex: 50,
|
|
||||||
bubble: true,
|
|
||||||
});
|
|
||||||
this.map.add([polygon]);
|
|
||||||
this.map.setFitView();
|
|
||||||
this.polyEditor = new AMap.PolygonEditor(this.map, polygon);
|
|
||||||
} else {
|
|
||||||
this.mouseTool = new AMap.MouseTool(this.map);
|
|
||||||
// this.map.add(new AMap.Marker({
|
|
||||||
// position:this.map.getCenter()
|
|
||||||
// }));
|
|
||||||
this.placeSearch = new AMap.PlaceSearch({
|
|
||||||
pageSize: 3, // 单页显示结果条数
|
|
||||||
pageIndex: 1, // 页码
|
|
||||||
city: "", // 兴趣点城市
|
|
||||||
citylimit: false, //是否强制限制在设置的城市内搜索
|
|
||||||
map: this.map, // 展现结果的地图实例
|
|
||||||
panel: "panel", // 结果列表将在此容器中进行展示。
|
|
||||||
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
|
||||||
});
|
|
||||||
// this.map.setZoomAndCenter(14, [this.location.lng, this.location.lat], false, 600);
|
|
||||||
this.eventOn();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getCorpLocation() {
|
|
||||||
this.instance.post("/app/appdvcpconfig/getCorpLocation").then(res => {
|
|
||||||
if (res?.data) {
|
|
||||||
this.location = res.data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//地图事件绑定
|
|
||||||
eventOn() {
|
|
||||||
this.path = [];
|
|
||||||
this.overlays = [];
|
|
||||||
this.map.on("mousemove", null, this);
|
|
||||||
this.mouseTool.on("draw", ({obj}) => {
|
|
||||||
obj.getPath().map((e) => {
|
|
||||||
this.path.push({lat: e.getLat(), lng: e.getLng()});
|
|
||||||
});
|
|
||||||
this.overlays.push(obj);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
//map搜索
|
|
||||||
addressChange(val) {
|
|
||||||
this.placeSearch.search(val);
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.mouseTool.close(true);
|
|
||||||
},
|
|
||||||
clear() {
|
|
||||||
this.map.remove(this.overlays);
|
|
||||||
this.overlays = [];
|
|
||||||
this.path = [];
|
|
||||||
},
|
|
||||||
draw(type) {
|
|
||||||
switch (type) {
|
|
||||||
case "marker": {
|
|
||||||
this.mouseTool.marker({
|
|
||||||
//同Marker的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "polyline": {
|
|
||||||
this.mouseTool.polyline({
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
//同Polyline的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "polygon": {
|
|
||||||
this.mouseTool.polygon({
|
|
||||||
fillColor: "#00b0ff",
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
borderWeight: 2,
|
|
||||||
strokeWeight: 4,
|
|
||||||
//同Polygon的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "rectangle": {
|
|
||||||
this.mouseTool.rectangle({
|
|
||||||
fillColor: "#00b0ff",
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
//同Polygon的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "circle": {
|
|
||||||
this.mouseTool.circle({
|
|
||||||
fillColor: "#00b0ff",
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
//同Circle的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
surePotting() {
|
|
||||||
this.forms.points = [];
|
|
||||||
// this.forms.eventReportUnit = this.$refs.cascader.getCheckedNodes().label;
|
|
||||||
if (this.forms.plottingStatus == 1) {
|
|
||||||
this.polyEditor
|
|
||||||
.getTarget()
|
|
||||||
.getPath()
|
|
||||||
.map((e) => {
|
|
||||||
this.forms.points.push({lng: e.lng, lat: e.lat});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.forms.points = [...this.path];
|
|
||||||
}
|
|
||||||
this.showMap = false;
|
|
||||||
},
|
|
||||||
save() {
|
save() {
|
||||||
this.$refs["rules"].validate((valid) => {
|
this.$refs["rules"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@@ -360,7 +170,7 @@ export default {
|
|||||||
wxUserId: v.wxOpenUserId || v.wxUserId
|
wxUserId: v.wxOpenUserId || v.wxUserId
|
||||||
}
|
}
|
||||||
}) : [],
|
}) : [],
|
||||||
girdMemberList: this.forms.girdMemberList.length ? this.forms.girdMemberList.map(v => {
|
girdMemberList: this.forms.girdMemberList.length ? this.forms.girdMemberList.map(v => {
|
||||||
return {
|
return {
|
||||||
wxUserId: v.wxOpenUserId || v.wxUserId
|
wxUserId: v.wxOpenUserId || v.wxUserId
|
||||||
}
|
}
|
||||||
@@ -414,48 +224,8 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
::v-deep .amap-copyright {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
::v-deep .amap-logo {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-btn {
|
.footer-btn {
|
||||||
width: 92px;
|
width: 92px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.map {
|
|
||||||
width: 780px;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.container {
|
|
||||||
width: 760px;
|
|
||||||
height: 420px;
|
|
||||||
border-radius: 2px;
|
|
||||||
border: 1px solid #d0d4dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#panel {
|
|
||||||
position: absolute;
|
|
||||||
height: 400px;
|
|
||||||
right: 30px;
|
|
||||||
top: 20px;
|
|
||||||
width: 280px;
|
|
||||||
overflow: hidden;
|
|
||||||
z-index: 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tipinput {
|
|
||||||
position: absolute;
|
|
||||||
width: 200px;
|
|
||||||
height: 38px;
|
|
||||||
left: 20px;
|
|
||||||
top: 20px;
|
|
||||||
z-index: 10000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
<template slot="left">
|
<template slot="left">
|
||||||
<ai-tree-menu title="网格层级" @search="v=> $refs.tree.filter(v)">
|
<ai-tree-menu title="网格层级" @search="v=> $refs.tree.filter(v)">
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="treeObj.treeList"
|
:data="treeObj.treeList"
|
||||||
:props="treeObj.defaultProps"
|
:props="treeObj.defaultProps"
|
||||||
@node-click="handleNodeClick"
|
@node-click="handleNodeClick"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
ref="tree"
|
ref="tree"
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
highlight-current>
|
highlight-current>
|
||||||
<template slot-scope="{node,data}">
|
<template slot-scope="{node,data}">
|
||||||
<div v-text="node.label"/>
|
<div v-text="node.label"/>
|
||||||
</template>
|
</template>
|
||||||
@@ -118,69 +118,14 @@
|
|||||||
fixed="right"
|
fixed="right"
|
||||||
width="160">
|
width="160">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<div class="table-options">
|
<el-button type="text" @click="showEdit(row.id)">编辑</el-button>
|
||||||
<el-button type="text" @click="showEdit(row.id)">编辑</el-button>
|
<map-plotting :value="row.points" @change="v=>confirm(row,v)"/>
|
||||||
<el-button type="text" @click="poltting(row)">标绘</el-button>
|
<el-button type="text" @click="deleteById(row.id)">删除</el-button>
|
||||||
<el-button type="text" @click="deleteById(row.id)">删除</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</ai-table>
|
</ai-table>
|
||||||
</template>
|
</template>
|
||||||
</ai-list>
|
</ai-list>
|
||||||
<ai-dialog
|
|
||||||
title="网格范围"
|
|
||||||
:visible.sync="showMap"
|
|
||||||
:customFooter="true"
|
|
||||||
:destroyOnClose="true"
|
|
||||||
border
|
|
||||||
width="850px"
|
|
||||||
>
|
|
||||||
<div class="map">
|
|
||||||
<div class="tipinput">
|
|
||||||
<el-input
|
|
||||||
v-if="editRow.plottingStatus == 0"
|
|
||||||
v-model="searchAddress"
|
|
||||||
@change="addressChange"
|
|
||||||
clearable
|
|
||||||
placeholder="请输入关键字"
|
|
||||||
id="tipinput"
|
|
||||||
size="medium"
|
|
||||||
style="width: 200px"
|
|
||||||
></el-input>
|
|
||||||
</div>
|
|
||||||
<div id="panel" v-if="editRow.plottingStatus == 0"></div>
|
|
||||||
<div class="container" id="container"></div>
|
|
||||||
<el-button-group
|
|
||||||
style="margin-top: 8px"
|
|
||||||
v-if="editRow.plottingStatus == 1"
|
|
||||||
>
|
|
||||||
<el-button type="primary" size="mini" @click="beginPoltting()"
|
|
||||||
>开始编辑
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
<el-button size="mini" @click="finishPoltting()">结束编辑</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
<el-button-group
|
|
||||||
style="margin-top: 8px"
|
|
||||||
v-if="editRow.plottingStatus == 0"
|
|
||||||
>
|
|
||||||
<el-button size="mini" @click="draw('polygon')"
|
|
||||||
>开始绘制多边形
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
<!-- <el-button size="mini" @click="close()">关闭绘制</el-button> -->
|
|
||||||
<el-button size="mini" @click="clear()">清除绘制</el-button>
|
|
||||||
</el-button-group>
|
|
||||||
</div>
|
|
||||||
<div class="dialog-footer" slot="footer">
|
|
||||||
<el-button size="medium" @click="showMap = false">取消</el-button>
|
|
||||||
<el-button type="primary" size="medium" @click="confirm()"
|
|
||||||
>确认
|
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</ai-dialog>
|
|
||||||
<ai-dialog :title="`${gridInfo.girdName}网格成员`" :visible.sync="dialog" customFooter @closed="gridInfo={}"
|
<ai-dialog :title="`${gridInfo.girdName}网格成员`" :visible.sync="dialog" customFooter @closed="gridInfo={}"
|
||||||
width="700px">
|
width="700px">
|
||||||
<ai-table :tableData="gridInfo.tableData" :colConfigs="gridMemberColConfigs" :dict="dict"
|
<ai-table :tableData="gridInfo.tableData" :colConfigs="gridMemberColConfigs" :dict="dict"
|
||||||
@@ -199,10 +144,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AMapLoader from "@amap/amap-jsapi-loader";
|
import MapPlotting from "./mapPlotting";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "List",
|
name: "List",
|
||||||
|
components: {MapPlotting},
|
||||||
label: "网格区块",
|
label: "网格区块",
|
||||||
props: {
|
props: {
|
||||||
instance: Function,
|
instance: Function,
|
||||||
@@ -244,7 +190,6 @@ export default {
|
|||||||
isEdit: false,
|
isEdit: false,
|
||||||
searchId: "",
|
searchId: "",
|
||||||
fileList: [],
|
fileList: [],
|
||||||
location: {},
|
|
||||||
dialog: false,
|
dialog: false,
|
||||||
gridInfo: {},
|
gridInfo: {},
|
||||||
gridMemberColConfigs: [
|
gridMemberColConfigs: [
|
||||||
@@ -257,7 +202,6 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.getTreeList();
|
this.getTreeList();
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getCorpLocation()
|
|
||||||
this.dict.load("girdLevel", "girdType", "isLastLevel", "plottingStatus", "girdMemberType");
|
this.dict.load("girdLevel", "girdType", "isLastLevel", "plottingStatus", "girdMemberType");
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -273,13 +217,6 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCorpLocation() {
|
|
||||||
this.instance.post("/app/appdvcpconfig/getCorpLocation").then(res => {
|
|
||||||
if (res.code == 0) {
|
|
||||||
this.location = res.data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleNodeClick(val) {
|
handleNodeClick(val) {
|
||||||
this.info = {...val};
|
this.info = {...val};
|
||||||
this.searchId = val.id;
|
this.searchId = val.id;
|
||||||
@@ -390,162 +327,18 @@ export default {
|
|||||||
this.getTreeList();
|
this.getTreeList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
poltting(row) {
|
|
||||||
this.showMap = true;
|
|
||||||
this.editRow = {...row};
|
|
||||||
AMapLoader.load({
|
|
||||||
key: "b553334ba34f7ac3cd09df9bc8b539dc", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
||||||
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
||||||
plugins: ["AMap.PolygonEditor", "AMap.MouseTool", "AMap.PlaceSearch"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
||||||
AMapUI: {
|
|
||||||
// 是否加载 AMapUI,缺省不加载
|
|
||||||
version: "1.1", // AMapUI 缺省 1.1
|
|
||||||
plugins: [], // 需要加载的 AMapUI ui插件
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((AMap) => {
|
|
||||||
this.map = new AMap.Map("container", {
|
|
||||||
resizeEnable: true,
|
|
||||||
zoom: 14,
|
|
||||||
});
|
|
||||||
if (this.editRow.plottingStatus == 1) {
|
|
||||||
let path = [];
|
|
||||||
this.editRow.points.map((e, index) => {
|
|
||||||
path[index] = [e.lng, e.lat];
|
|
||||||
});
|
|
||||||
let polygon = new AMap.Polygon({
|
|
||||||
path: path,
|
|
||||||
strokeColor: "#FF33FF",
|
|
||||||
strokeWeight: 6,
|
|
||||||
strokeOpacity: 0.2,
|
|
||||||
fillOpacity: 0.4,
|
|
||||||
fillColor: "#1791fc",
|
|
||||||
zIndex: 50,
|
|
||||||
bubble: true,
|
|
||||||
});
|
|
||||||
this.map.add([polygon]);
|
|
||||||
this.map.setFitView();
|
|
||||||
this.polyEditor = new AMap.PolygonEditor(this.map, polygon);
|
|
||||||
} else {
|
|
||||||
this.mouseTool = new AMap.MouseTool(this.map);
|
|
||||||
this.placeSearch = new AMap.PlaceSearch({
|
|
||||||
pageSize: 3, // 单页显示结果条数
|
|
||||||
pageIndex: 1, // 页码
|
|
||||||
city: "", // 兴趣点城市
|
|
||||||
citylimit: false, //是否强制限制在设置的城市内搜索
|
|
||||||
map: this.map, // 展现结果的地图实例
|
|
||||||
panel: "panel", // 结果列表将在此容器中进行展示。
|
|
||||||
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
|
||||||
});
|
|
||||||
// this.map.setZoomAndCenter(14, [this.location.lng, this.location.lat], false, 600);
|
|
||||||
this.eventOn();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.log(e);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
showEdit(id) {
|
showEdit(id) {
|
||||||
this.$router.push({hash: "#add", query: {id}})
|
this.$router.push({hash: "#add", query: {id}})
|
||||||
},
|
},
|
||||||
draw(type) {
|
|
||||||
switch (type) {
|
|
||||||
case "marker": {
|
|
||||||
this.mouseTool.marker({
|
|
||||||
//同Marker的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "polyline": {
|
|
||||||
this.mouseTool.polyline({
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
//同Polyline的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "polygon": {
|
|
||||||
this.mouseTool.polygon({
|
|
||||||
fillColor: "#00b0ff",
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
borderWeight: 2,
|
|
||||||
strokeWeight: 4,
|
|
||||||
//同Polygon的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "rectangle": {
|
|
||||||
this.mouseTool.rectangle({
|
|
||||||
fillColor: "#00b0ff",
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
//同Polygon的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "circle": {
|
|
||||||
this.mouseTool.circle({
|
|
||||||
fillColor: "#00b0ff",
|
|
||||||
strokeColor: "#80d8ff",
|
|
||||||
//同Circle的Option设置
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//map搜索
|
//map搜索
|
||||||
addressChange(val) {
|
confirm(row, points) {
|
||||||
this.placeSearch.search(val);
|
this.instance.post(`/app/appgirdinfo/addOrUpdate`, {...row, points}).then((res) => {
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.mouseTool.close(true);
|
|
||||||
},
|
|
||||||
clear() {
|
|
||||||
this.map.remove(this.overlays);
|
|
||||||
this.overlays = [];
|
|
||||||
this.path = [];
|
|
||||||
},
|
|
||||||
beginPoltting() {
|
|
||||||
this.polyEditor.open();
|
|
||||||
},
|
|
||||||
finishPoltting() {
|
|
||||||
this.polyEditor.close();
|
|
||||||
},
|
|
||||||
confirm() {
|
|
||||||
let path = [];
|
|
||||||
if (this.editRow.plottingStatus == 1) {
|
|
||||||
this.polyEditor
|
|
||||||
.getTarget()
|
|
||||||
.getPath()
|
|
||||||
.map((e) => {
|
|
||||||
path.push({lng: e.lng, lat: e.lat});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
path = [...this.path];
|
|
||||||
}
|
|
||||||
delete this.editRow.points;
|
|
||||||
let {girdMemberNames} = this.editRow
|
|
||||||
this.instance.post(`/app/appgirdinfo/addOrUpdate`, {
|
|
||||||
...this.editRow,
|
|
||||||
points: path,
|
|
||||||
girdMemberNames: girdMemberNames?.toString()
|
|
||||||
}).then((res) => {
|
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
this.$message.success("提交成功!")
|
||||||
this.getList();
|
this.getList();
|
||||||
this.showMap = false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
eventOn() {
|
|
||||||
this.path = [];
|
|
||||||
this.overlays = [];
|
|
||||||
this.map.on("mousemove", this.showInfoMove, this);
|
|
||||||
this.mouseTool.on("draw", ({type, obj}) => {
|
|
||||||
obj.getPath().map((e) => {
|
|
||||||
console.log(e)
|
|
||||||
this.path.push({lat: e.getLat(), lng: e.getLng()});
|
|
||||||
});
|
|
||||||
this.overlays.push(obj);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
resetSearch() {
|
resetSearch() {
|
||||||
Object.keys(this.searchObj).map((e) => {
|
Object.keys(this.searchObj).map((e) => {
|
||||||
this.searchObj[e] = "";
|
this.searchObj[e] = "";
|
||||||
@@ -605,7 +398,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.is-current > .el-tree-node__content {
|
.is-current > .el-tree-node__content {
|
||||||
color: #fff!important;
|
color: #fff !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #2266FF;
|
background: #2266FF;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -638,35 +432,26 @@ export default {
|
|||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.map {
|
::v-deep.fullscreenMap {
|
||||||
width: 780px;
|
.el-dialog {
|
||||||
position: relative;
|
display: flex;
|
||||||
overflow: hidden;
|
flex-direction: column;
|
||||||
|
|
||||||
.container {
|
.el-dialog__body {
|
||||||
width: 760px;
|
padding: 0;
|
||||||
height: 420px;
|
flex: 1;
|
||||||
border-radius: 2px;
|
min-height: 0;
|
||||||
border: 1px solid #d0d4dc;
|
|
||||||
}
|
|
||||||
|
|
||||||
#panel {
|
.ai-dialog__content {
|
||||||
position: absolute;
|
max-height: unset !important;
|
||||||
height: 400px;
|
padding-bottom: 0;
|
||||||
right: 30px;
|
height: 100%;
|
||||||
top: 20px;
|
|
||||||
width: 280px;
|
|
||||||
overflow: hidden;
|
|
||||||
z-index: 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tipinput {
|
.ai-dialog__content--wrapper {
|
||||||
position: absolute;
|
padding-right: 0 !important;
|
||||||
width: 200px;
|
}
|
||||||
height: 38px;
|
}
|
||||||
left: 20px;
|
}
|
||||||
top: 20px;
|
|
||||||
z-index: 10000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
229
project/sass/apps/grid/AppGridBlock/components/mapPlotting.vue
Normal file
229
project/sass/apps/grid/AppGridBlock/components/mapPlotting.vue
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
<template>
|
||||||
|
<section class="mapPlotting">
|
||||||
|
<div class="clicker" @click="dialog=true,$emit('open')">
|
||||||
|
<slot v-if="$slots.default"/>
|
||||||
|
<el-button v-else type="text">标绘</el-button>
|
||||||
|
</div>
|
||||||
|
<ai-dialog :title="title" class="fullscreenMap"
|
||||||
|
:visible.sync="dialog"
|
||||||
|
:destroyOnClose="true"
|
||||||
|
@close="points=[]"
|
||||||
|
border fullscreen
|
||||||
|
@open="initMap" :modal="false"
|
||||||
|
@onConfirm="$emit('change',points.flat()),dialog=false">
|
||||||
|
<div class="mapPanel">
|
||||||
|
<div class="tipinput">
|
||||||
|
<el-input
|
||||||
|
v-model="searchAddress"
|
||||||
|
@change="addressChange"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入关键字"
|
||||||
|
id="tipinput"
|
||||||
|
size="medium"/>
|
||||||
|
</div>
|
||||||
|
<div id="panel"/>
|
||||||
|
<div class="container fill" id="container"/>
|
||||||
|
<div class="operationBtns" v-if="map">
|
||||||
|
<el-alert type="success" title="操作说明:" :closable="false">
|
||||||
|
<li>1.双击覆盖物即可编辑</li>
|
||||||
|
<li>2.编辑状态,对点双击可删除该点</li>
|
||||||
|
<li>3.绘制状态,右键结束绘制</li>
|
||||||
|
<li>4.结束编辑才能保存绘制的覆盖物信息</li>
|
||||||
|
</el-alert>
|
||||||
|
<el-button-group>
|
||||||
|
<el-button type="primary" @click="handleAdd">新建</el-button>
|
||||||
|
<el-button @click="polyEditor.close()">结束编辑</el-button>
|
||||||
|
<el-button @click="clear()">清除绘制</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ai-dialog>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AMapLoader from "@amap/amap-jsapi-loader";
|
||||||
|
import {mapState} from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "mapPlotting",
|
||||||
|
model: {
|
||||||
|
prop: "value",
|
||||||
|
event: "change"
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
title: {default: "地图标绘"},
|
||||||
|
value: Array
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(['user']),
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
map: null,
|
||||||
|
polyEditor: null,
|
||||||
|
placeSearch: null,
|
||||||
|
searchAddress: "",
|
||||||
|
overlays: [],
|
||||||
|
points: [],
|
||||||
|
dialog: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addressChange(val) {
|
||||||
|
this.placeSearch.search(val);
|
||||||
|
},
|
||||||
|
clear() {
|
||||||
|
this.map.remove(this.overlays);
|
||||||
|
this.overlays = [];
|
||||||
|
this.points = []
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
let {polyEditor} = this
|
||||||
|
polyEditor.close();
|
||||||
|
polyEditor.setTarget();
|
||||||
|
polyEditor.open();
|
||||||
|
},
|
||||||
|
initMap() {
|
||||||
|
setTimeout(() => AMapLoader.load({
|
||||||
|
key: "b553334ba34f7ac3cd09df9bc8b539dc", // 申请好的Web端开发者Key,首次调用 load 时必填
|
||||||
|
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
||||||
|
plugins: ["AMap.PlaceSearch", "AMap.PolygonEditor"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||||
|
AMapUI: {
|
||||||
|
// 是否加载 AMapUI,缺省不加载
|
||||||
|
version: "1.1", // AMapUI 缺省 1.1
|
||||||
|
plugins: [], // 需要加载的 AMapUI ui插件
|
||||||
|
},
|
||||||
|
}).then((AMap) => {
|
||||||
|
this.map = new AMap.Map("container", {
|
||||||
|
resizeEnable: true,
|
||||||
|
});
|
||||||
|
this.placeSearch = new AMap.PlaceSearch({
|
||||||
|
pageSize: 5, // 单页显示结果条数
|
||||||
|
pageIndex: 1, // 页码
|
||||||
|
city: this.user.info.areaId?.substring(0, 6), // 兴趣点城市
|
||||||
|
citylimit: true, //是否强制限制在设置的城市内搜索
|
||||||
|
map: this.map, // 展现结果的地图实例
|
||||||
|
panel: "panel", // 结果列表将在此容器中进行展示。
|
||||||
|
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
||||||
|
});
|
||||||
|
this.polyEditor = new AMap.PolygonEditor(this.map).on('add', ({target}) => {
|
||||||
|
this.polyEditor.addAdsorbPolygons(target)
|
||||||
|
target.on("dblclick", () => {
|
||||||
|
this.polyEditor.setTarget(target);
|
||||||
|
this.polyEditor.open()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.polyEditor.on('end', ({target}) => {
|
||||||
|
this.overlays.push(target);
|
||||||
|
this.points.push(target.getPath().map((e) => ({lat: e.getLat(), lng: e.getLng()})))
|
||||||
|
});
|
||||||
|
if (this.value?.length > 0) {
|
||||||
|
let path = this.value.map(e => [e.lng, e.lat]);
|
||||||
|
let polygon = new AMap.Polygon({
|
||||||
|
path,
|
||||||
|
strokeColor: "#FF33FF",
|
||||||
|
strokeWeight: 6,
|
||||||
|
strokeOpacity: 0.2,
|
||||||
|
fillOpacity: 0.4,
|
||||||
|
fillColor: "#1791fc",
|
||||||
|
})
|
||||||
|
this.map.add([polygon]);
|
||||||
|
this.map.setFitView();
|
||||||
|
this.polyEditor.addAdsorbPolygons(polygon)
|
||||||
|
polygon.on('dblclick', () => {
|
||||||
|
this.polyEditor.setTarget(polygon);
|
||||||
|
this.polyEditor.open()
|
||||||
|
});
|
||||||
|
this.polyEditor.setTarget(polygon);
|
||||||
|
this.polyEditor.open()
|
||||||
|
} else {
|
||||||
|
this.map.setCity(this.user.info.areaId?.substring(0, 6))
|
||||||
|
this.map.setZoom(14, false, 600)
|
||||||
|
}
|
||||||
|
}), 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.mapPlotting {
|
||||||
|
display: inline-block;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
.clicker {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mapPanel {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
#panel {
|
||||||
|
position: absolute;
|
||||||
|
height: 400px;
|
||||||
|
right: 30px;
|
||||||
|
top: 20px;
|
||||||
|
width: 280px;
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tipinput {
|
||||||
|
position: absolute;
|
||||||
|
width: 300px;
|
||||||
|
height: 38px;
|
||||||
|
left: 20px;
|
||||||
|
top: 20px;
|
||||||
|
z-index: 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operationBtns {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
bottom: 20px;
|
||||||
|
z-index: 10000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep.fullscreenMap {
|
||||||
|
.el-dialog {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 0;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
.ai-dialog__content {
|
||||||
|
max-height: unset !important;
|
||||||
|
padding-bottom: 0;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.ai-dialog__content--wrapper {
|
||||||
|
padding-right: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .amap-copyright {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .amap-logo {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user