|
@@ -208,65 +208,12 @@
|
|
|
>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <el-dialog
|
|
|
+ <!--地图选点-->
|
|
|
+ <routeInfo-getpoint
|
|
|
+ ref="getpoint"
|
|
|
:visible.sync="showMapDialog"
|
|
|
- title="地图选点"
|
|
|
- :modal-append-to-body="true"
|
|
|
- :append-to-body="true"
|
|
|
- style="text-align: left"
|
|
|
- width="60%"
|
|
|
- top="5vh"
|
|
|
- :close-on-click-modal="false"
|
|
|
- >
|
|
|
- <el-amap
|
|
|
- ref="stationMap"
|
|
|
- vid="stationMap"
|
|
|
- :amap-manager="amapManager"
|
|
|
- :center="pointPosition"
|
|
|
- :zoom="zoom"
|
|
|
- :events="events"
|
|
|
- class="amap-demo"
|
|
|
- :plugin="plugins"
|
|
|
- style="width: 100%; height: 500px"
|
|
|
- >
|
|
|
- <el-amap-marker
|
|
|
- vid="amapDemo"
|
|
|
- :position="pointPosition"
|
|
|
- ></el-amap-marker>
|
|
|
-
|
|
|
- <!--站点入口-->
|
|
|
- <el-amap-marker
|
|
|
- :zIndex="1"
|
|
|
- v-for="station in stationSubInfoList"
|
|
|
- :key="station.id"
|
|
|
- :position="station.position"
|
|
|
- :title="station.title"
|
|
|
- :icon="station.icon"
|
|
|
- ></el-amap-marker>
|
|
|
- </el-amap>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <div style="position: absolute; left: 20px; bottom: 20px">
|
|
|
- <el-input
|
|
|
- placeholder="当前经纬度"
|
|
|
- v-model="selectedRow.location"
|
|
|
- style="width: 400px"
|
|
|
- >
|
|
|
- <template slot="prepend">经纬度</template>
|
|
|
- <el-button slot="append" icon="el-icon-search" @click="handleRegeo"
|
|
|
- >定位</el-button
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- <el-switch
|
|
|
- v-model="ranging"
|
|
|
- @change="rangingChange"
|
|
|
- active-text="开启测距"
|
|
|
- inactive-text="关闭测距">
|
|
|
- </el-switch>
|
|
|
- </div>
|
|
|
- <el-button @click="showMapDialog = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="handleSelectPoint()">确 定</el-button>
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
+ @yes="handleChangeLocation"
|
|
|
+ ></routeInfo-getpoint>
|
|
|
<el-dialog
|
|
|
title="导入"
|
|
|
:visible.sync="batchImportVisible"
|
|
@@ -322,23 +269,16 @@
|
|
|
import Constant from "@/constant";
|
|
|
import routeInfoApi from "@/api/bus/routeInfo";
|
|
|
import SelectTree from "@/components/SelectTree";
|
|
|
+import RouteInfoGetPoint from "./routeInfo-getpoint";
|
|
|
import companyInfoApi from "@/api/bus/companyInfo";
|
|
|
import dataDictionaryApi from "@/api/sys/dataDictionary";
|
|
|
import regionInfoApi from "@/api/base/regionInfo";
|
|
|
-
|
|
|
-import greenIcon from "@/assets/icons/green.svg";
|
|
|
-import redIcon from "@/assets/icons/red.svg";
|
|
|
-
|
|
|
import { getToken } from "@/utils/auth"; // get token from cookie
|
|
|
|
|
|
-import AMap from "vue-amap";
|
|
|
-let amapManager = new AMap.AMapManager();
|
|
|
-
|
|
|
export default {
|
|
|
props: ["businessKey", "title"],
|
|
|
data() {
|
|
|
return {
|
|
|
- plugins: ["AMap.Scale", "AMap.OverView", "AMap.ToolBar", "AMap.MapType","AMap.RangingTool"],
|
|
|
formModel: {
|
|
|
enableChangeParent: false,
|
|
|
id: "",
|
|
@@ -348,7 +288,6 @@ export default {
|
|
|
stationList: [],
|
|
|
removeStationList: []
|
|
|
},
|
|
|
- stationSubInfoList: [],
|
|
|
ruleValidate: {
|
|
|
companyId: [
|
|
|
{ required: true, message: "所属单位不能为空", trigger: "blur" },
|
|
@@ -385,27 +324,7 @@ export default {
|
|
|
typeData: [],
|
|
|
treeData: [],
|
|
|
selectedRow: {},
|
|
|
- pointPosition: [112.240222, 30.337053],
|
|
|
showMapDialog: false,
|
|
|
- amapManager,
|
|
|
- zoom: 12,
|
|
|
- mapRuler: {},
|
|
|
- ranging: false,
|
|
|
- events: {
|
|
|
- init: (map)=>{
|
|
|
- const ruler = new window.AMap.RangingTool(map);
|
|
|
- this.mapRuler = ruler
|
|
|
- },
|
|
|
- click: (e) => {
|
|
|
- if(!this.ranging){
|
|
|
- var pt = e.lnglat; //点击选择新地址为中心点
|
|
|
- console.log(pt);
|
|
|
-
|
|
|
- this.pointPosition = [pt.lng, pt.lat];
|
|
|
- this.selectedRow.location = pt.lng + "," + pt.lat;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
props: {
|
|
|
// 配置项(必选)
|
|
|
value: "id",
|
|
@@ -448,14 +367,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
- rangingChange(value) {
|
|
|
- if(value){
|
|
|
- this.mapRuler.turnOn();
|
|
|
- }
|
|
|
- else{
|
|
|
- this.mapRuler.turnOff();
|
|
|
- }
|
|
|
- },
|
|
|
closeDialog() {
|
|
|
this.$emit("close", false);
|
|
|
},
|
|
@@ -480,12 +391,16 @@ export default {
|
|
|
self.formModel.stationList[i].sortNo = i+1;
|
|
|
}
|
|
|
|
|
|
+ self.loading = true;
|
|
|
+
|
|
|
if (id == null || id.length == 0) {
|
|
|
return routeInfoApi.add(self.formModel);
|
|
|
} else {
|
|
|
return routeInfoApi.update(self.formModel);
|
|
|
}
|
|
|
})().then(function (response) {
|
|
|
+ self.loading = false;
|
|
|
+
|
|
|
var jsonData = response.data;
|
|
|
|
|
|
if (jsonData.result) {
|
|
@@ -526,29 +441,9 @@ export default {
|
|
|
return isJPG && isLt2M;
|
|
|
},
|
|
|
handleLocation(row) {
|
|
|
- this.selectedRow = row;
|
|
|
this.showMapDialog = true;
|
|
|
-
|
|
|
- if (row.location != null && row.location.length > 0) {
|
|
|
- var arr = row.location.split(",");
|
|
|
-
|
|
|
- this.pointPosition = arr;
|
|
|
- }
|
|
|
-
|
|
|
- if(row.stationSubInfoList!=null){
|
|
|
- this.stationSubInfoList = [];
|
|
|
-
|
|
|
- row.stationSubInfoList.forEach(subItem=>{
|
|
|
- var startToEnd = subItem.startStationId == this.formModel.stationList[0].id;
|
|
|
-
|
|
|
- this.stationSubInfoList.push({
|
|
|
- id: subItem.id,
|
|
|
- title: row.name + "入口" + (startToEnd ? "(起)" : "(终)"),
|
|
|
- position: [subItem.longitude,subItem.latitude],
|
|
|
- icon: startToEnd ? greenIcon : redIcon
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ this.selectedRow = row;
|
|
|
+ this.$refs.getpoint.showPoint(row);
|
|
|
},
|
|
|
handleAdd() {
|
|
|
this.formModel.stationList.push({
|
|
@@ -575,19 +470,6 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- handleRegeo() {
|
|
|
- var row = this.selectedRow;
|
|
|
-
|
|
|
- if (row.location != null && row.location.length > 0) {
|
|
|
- var arr = row.location.split(",");
|
|
|
- this.pointPosition = arr;
|
|
|
- }
|
|
|
- },
|
|
|
- handleSelectPoint() {
|
|
|
- this.selectedRow.location =
|
|
|
- this.pointPosition[0] + "," + this.pointPosition[1];
|
|
|
- this.showMapDialog = false;
|
|
|
- },
|
|
|
handleDelete(row) {
|
|
|
var stationList = this.formModel.stationList;
|
|
|
|
|
@@ -691,9 +573,39 @@ export default {
|
|
|
self.$message.error(error + "");
|
|
|
});
|
|
|
},
|
|
|
+ handleChangeLocation(points) {
|
|
|
+ console.log(points);
|
|
|
+
|
|
|
+ if(this.selectedRow!=null){
|
|
|
+ points.forEach(pt=>{
|
|
|
+
|
|
|
+ if(pt.type=="station"){
|
|
|
+ this.selectedRow.location = pt.location;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ var list = this.selectedRow.stationSubInfoList;
|
|
|
+
|
|
|
+ if(list!=null){
|
|
|
+ for(var i=0;i<list.length;i++){
|
|
|
+ var subItem = list[i];
|
|
|
+
|
|
|
+ if(subItem.id == pt.id){
|
|
|
+ console.log(subItem);
|
|
|
+
|
|
|
+ subItem.longitude = pt.position[0];
|
|
|
+ subItem.latitude = pt.position[1];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
components: {
|
|
|
"el-select-tree": SelectTree,
|
|
|
+ "routeInfo-getpoint": RouteInfoGetPoint
|
|
|
},
|
|
|
mounted: function () {
|
|
|
var self = this;
|