Browse Source

新增仓库地图定位功能

master
guoxing 9 months ago
parent
commit
12838ef3cd
  1. 1
      package.json
  2. 66
      src/main.js
  3. 196
      src/views/baseInfo/warehouses/warehouse/warehouseAdd.vue
  4. 342
      src/views/baseInfo/warehouses/warehouse/warehouseAdd2.vue
  5. 292
      src/views/baseInfo/warehouses/warehouse/warehouseAdd3.vue
  6. 11
      src/views/system/organizationManage/organizationManage.vue
  7. 2
      src/views/system/roleAdminister/roleAdminister.vue

1
package.json

@ -14,6 +14,7 @@
"test:ci": "npm run lint && npm run test:unit"
},
"dependencies": {
"@amap/amap-jsapi-loader": "^1.0.1",
"axios": "^0.24.0",
"bpmn-js": "^9.2.2",
"core-js": "^3.8.3",

66
src/main.js

@ -16,8 +16,11 @@ import eimage from '@/components/E-image/index.vue'
import moment from 'moment'
import Print from '@/utils/print' // 引入附件的js文件
import request from '@/utils/request'
import { setDefaultOrgPath, setDefaultOrgPathName, setStorage } from './utils/auth.js'
import VueAMap from 'vue-amap'
import {
setDefaultOrgPath,
setDefaultOrgPathName,
setStorage
} from './utils/auth.js'
Vue.use(ElementUI)
@ -33,14 +36,35 @@ Vue.filter('dateFormat', function(dateStr, pattern = 'YYYY-MM-DD') {
})
Vue.use(Print) // 注册
Vue.use(VueAMap)
VueAMap.initAMapApiLoader({
key: 'ccda12d8bffc72e9f1a32c599323a876', // 此处的key,在高德开放平台申请
plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PlaceSearch', 'AMap.Geolocation', 'AMap.Geocoder'], // 此处的插件按需添加
v: '1.4.4',
uiVersion: '1.0'
})
import AMapLoader from '@amap/amap-jsapi-loader';
// AMapLoader.load({
// key: "0054c9409ec7a97ddfe933224b36f45c", //申请好的Web端开发者 Key,调用 load 时必填
// version: "2.0", //指定要加载的 JS API 的版本,缺省时默认为 1.4.15
// plugins: [
// 'AMap.ElasticMarker',
// 'AMap.Geolocation', //定位空间,用来获取和展示用户主机所在的经纬度位置
// ' AMap.Autocomplete ', //输入提示插件
// ' AMap.PlaceSearch ', //POI搜索插件
// ' AMap.Scale ', //右下角缩略图插件,比例尺
// ' AMap.OverView ', //地图鹰眼插件
// ' AMap.ToolBar ', //地图工具条
// ' AMap.MapType ', //类别切换空间,实现默认图层与卫星图,实施交通层之间切换的控制
// ' AMap.PolyEditor ', //编辑 折线多边形
// ' AMap.CircleEditor ',
// "AMap.Geocoder", //地图编码
// 'AMap.AMapManager',
// 'AMap.Marker'
// ], // 此处的插件按需添加
// })
// .then((AMap) => {
// const map = new AMap.Map("container");
// })
// .catch((e) => {
// console.error(e); //加载错误提示
// });
window._AMapSecurityConfig = {
securityJsCode: "e4ce71df213230e89231cc3ef9c98313",
};
Vue.config.productionTip = false
// let token = null
@ -63,7 +87,7 @@ if (parseInt(one) > 18) {
}
}
// 获取登录用户信息
// 获取登录用户信息
function getUserInfo() {
// return request({
// url: '/wms/apiadmin/sysuser/loginDetails',
@ -100,19 +124,22 @@ function getUserInfo() {
// window.sessionStorage.setItem('departmentSid', user.departmentSid)
// window.sessionStorage.setItem('orgNamePath', user.orgNamePath)
// window.sessionStorage.setItem('orgSidPath', user.orgSidPath)
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
new Vue({
el: '#app',
router,
store,
render: h => h(App)
})
// })
}
getUserInfo()
function GetQueryString(name) {
var one = window.location.href.indexOf('?token=') + 7
if (one < 7) { return null }
if (one < 7) {
return null
}
var two = window.location.href.lastIndexOf('&') // + 1
var data = window.location.href.substr(one)
if (two > one) {
@ -125,5 +152,6 @@ function GetQueryString(name) {
return null
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
var r = window.location.search.substr(1).match(reg)
if (r != null) return unescape(r[2]); return null
if (r != null) return unescape(r[2]);
return null
}

196
src/views/baseInfo/warehouses/warehouse/warehouseAdd.vue

@ -1,95 +1,115 @@
<template>
<div>
<div v-show="viewState == 1 ">
<div class="tab-header webtop">
<!-- 标题 -->
<div>仓库信息</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
<div class="tab-header webtop">
<!-- 标题 -->
<div>仓库信息</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<div class="listconadd">
<el-card class="box-card">
<div class="item">
<span class="item_text"><span class="must">*</span> 仓库名称</span>
<el-input v-model="formobj.warehouseName" placeholder="仓库名称" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 仓库编码</span>
<el-input v-model="formobj.warehouseCode" placeholder="仓库编码" class="item_input" clearable
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" />
</div>
<div class="item">
<span class="item_text">仓库联系人</span>
<el-input v-model="formobj.contacts" placeholder="仓库联系人" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">手机号码</span>
<el-input v-model="formobj.mob" placeholder="手机号码" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">仓库主管</span>
<el-input v-model="formobj.manager" placeholder="仓库主管" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">联系电话</span>
<el-input v-model="formobj.telephone" placeholder="联系电话" class="item_input" clearable />
</div>
<el-card class="box-card">
<div class="item">
<span class="item_text"><span class="must">*</span> 仓库名称</span>
<el-input v-model="formobj.warehouseName" placeholder="仓库名称" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 仓库编码</span>
<el-input v-model="formobj.warehouseCode" placeholder="仓库编码" class="item_input" clearable
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" />
</div>
<div class="item">
<span class="item_text">仓库联系人</span>
<el-input v-model="formobj.contacts" placeholder="仓库联系人" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">手机号码</span>
<el-input v-model="formobj.mob" placeholder="手机号码" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">仓库主管</span>
<el-input v-model="formobj.manager" placeholder="仓库主管" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">联系电话</span>
<el-input v-model="formobj.telephone" placeholder="联系电话" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">占地面积</span>
<el-input v-model="formobj.squareMeter" placeholder="占地面积" class="item_input" clearable
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
</div>
<div class="item">
<div class="item">
<span class="item_text">占地面积</span>
<el-input v-model="formobj.squareMeter" placeholder="占地面积" class="item_input" clearable
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
</div>
<!-- <div class="item">
<span class="item_text">仓库经度</span>
<el-input v-model="formobj.longitude" placeholder="仓库经度" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text">仓库纬度</span>
<el-input v-model="formobj.latitude" placeholder="仓库纬度" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 具体地址</span>
<el-input v-model="formobj.address" placeholder="具体地址" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 使用状态</span>
<el-radio-group v-model="formobj.usageStatus" size="small" @change="changeTheme" class="item_input">
<el-radio :label="1">正常</el-radio>
<el-radio :label="0">停用</el-radio>
</el-radio-group>
<!-- <el-input v-model="formobj.usageStatus" placeholder="仓库排序" class="item_input" clearable /> -->
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 仓库排序</span>
<el-input v-model="formobj.sortNo" placeholder="仓库排序" class="item_input" clearable
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
</div>
<div class="item">
<span class="item_text">仓库备注</span>
<el-input v-model="formobj.remarks" placeholder="备注" class="item_input" clearable />
</div>
</el-card>
</div> -->
<div class="item">
<span class="item_text">仓库经纬度</span>
<div class="item_input" style="display: flex;flex-direction: row;align-items: center;">
<el-input v-model="formobj.lngAndLat" placeholder="例:116.397428,39.90923" clearable
style="margin-right: 20px;" />
<span style="height: 40px;width:7%;color: #0294D7;text-decoration: underline ;cursor: pointer;"
@click="showMap">地图定位</span>
</div>
</div>
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 具体地址</span>
<el-input v-model="formobj.address" placeholder="具体地址" class="item_input" clearable />
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 使用状态</span>
<el-radio-group v-model="formobj.usageStatus" size="small" @change="changeTheme" class="item_input">
<el-radio :label="1">正常</el-radio>
<el-radio :label="0">停用</el-radio>
</el-radio-group>
<!-- <el-input v-model="formobj.usageStatus" placeholder="仓库排序" class="item_input" clearable /> -->
</div>
<div class="item">
<span class="item_text"><span class="must">*</span> 仓库排序</span>
<el-input v-model="formobj.sortNo" placeholder="仓库排序" class="item_input" clearable
oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" />
</div>
<div class="item">
<span class="item_text">仓库备注</span>
<el-input v-model="formobj.remarks" placeholder="备注" class="item_input" clearable />
</div>
</el-card>
</div>
</div>
<!-- End 查询和其列表部分 -->
<!-- 新增修改部分组件 -->
<divAdd v-show="viewState == 2 " ref="divadd" @backData="backData" @doback="resetState" />
</div>
</template>
<script>
import req from '@/api/baseinfo/warehouse/warehouse.js'
import divAdd from './warehouseAdd2.vue'
export default {
components: {},
components: {
divAdd
},
data() {
return {
viewState: 1,
submitdisabled: false,
dialogVisible: false,
formobj: {
sid: '',
warehouseName: '',
@ -100,6 +120,7 @@
manager: '',
longitude: '',
latitude: '',
lngAndLat: '',
usageStatus: 1,
address: '',
squareMeter: '',
@ -114,6 +135,9 @@
}
},
created() {},
mounted() {
},
methods: {
changeTheme(val) {
@ -186,6 +210,7 @@
manager: '',
longitude: '',
latitude: '',
lngAndLat: '',
usageStatus: 1,
address: '',
squareMeter: '',
@ -211,11 +236,46 @@
this.formobj = row
})
},
showMap() {
this.viewState = 2
this.$refs['divadd'].showAdd()
},
resetState() {
this.viewState = 1
},
backData(value) {
this.viewState = 1
console.log('backData:', value)
this.formobj.address = value.address
this.formobj.lngAndLat = value.lngAndLat
}
}
}
</script>
<style lang="scss" scoped>
.g-poi-search {
position: absolute;
top: 80px;
left: 30px;
padding: 8px;
border-radius: 2px;
background-color: #fff;
z-index: 100;
}
.g-poi-search .el-select .el-input>input.el-input__inner {
height: 28px;
line-height: 28px;
}
.g-poi-search-popper .el-select-dropdown__item {
width: 200px;
height: 28px;
line-height: 28px;
}
//
::v-deep .hide {

342
src/views/baseInfo/warehouses/warehouse/warehouseAdd2.vue

@ -0,0 +1,342 @@
<template>
<div>
<div class="tab-header webtop">
<!-- 标题 -->
<div>仓库信息</div>
<!-- start 添加修改按钮 -->
<div>
<el-button type="primary" size="small" @click="saveAddress">保存</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<div class="listconadd">
<div class="flex-center" style="padding: 5px;">
<div id="mymap" style="height:650px;width:90%;margin-left: 5%;margin-top: 2%;"></div>
<div class="g-poi-search" style="display: flex;flex-direction: column;">
<span style="">请输入关键字</span>
<el-input id="tipinput" v-model="searchText" style="width:300px;margin-top: 5px;" />
<span style="margin-top: 15px;width:300px;">当前地址:{{addressInfo.address}}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
name: "Home",
components: {},
data() {
return {
searchText: '',
map: null,
geocoder: null,
addressInfo: {
lngAndLat: "",
address: ""
},
pointList: [],
geolocation: null,
};
},
mounted() {
},
methods: {
showAdd() {
this.initMap();
},
initMap() {
let that = this;
window._AMapSecurityConfig = {
securityJsCode: "e4ce71df213230e89231cc3ef9c98313",
};
AMapLoader.load({
key: "0054c9409ec7a97ddfe933224b36f45c", // WebKey load
version: "2.0", // JSAPI 1.4.15
plugins: [], //使'AMap.Scale'['...','...']
})
.then((AMap) => {
that.map = new AMap.Map("mymap", {
// id
viewMode: "3D", // 3D
zoom: 15, //
center: [116.397428, 39.90923], //
});
that.map.plugin("AMap.Geocoder", function() {
that.geocoder = new AMap.Geocoder();
// geocoder.getLocation(address, function (status, result) {
// if (status === "complete" && result.info === "OK") {
// // result
// console.log(result);
// }
// });
});
that.map.plugin('AMap.Geolocation', function() {
var geolocation = new AMap.Geolocation({
enableHighAccuracy: true, //使:true
timeout: 10000, //105s
position: 'RB', //
offset: [10, 20], //[10, 20]
zoomToAccuracy: true, //
});
that.geolocation = geolocation
that.map.addControl(geolocation);
geolocation.getCurrentPosition(function(status, result) {
if (status == 'complete') {
that.onComplete(result)
} else {
that.onError(result)
}
});
});
//
var autoOptions = {
input: "tipinput"
};
that.map.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], function() {
var auto = new AMap.AutoComplete(autoOptions);
var placeSearch = new AMap.PlaceSearch({
map: that.map
}); //
auto.on("select", select); //
function select(e) {
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name);
placeSearch.search(e.poi.name, function(status, result) {
console.log("placeSearch", result)
that.map.clearMap()
var pois = result.poiList.pois;
for (var i = 0; i < pois.length; i++) {
var poi = pois[i];
var marker = [];
marker[i] = new AMap.Marker({
position: poi.location, // [116.39, 39.9]
title: poi.name
});
//
//
marker[i].on("click", function(e) {
console.log("click", e);
that.showInfoWindow2(e)
});
that.map.add(marker[i]);
}
that.map.setFitView();
}); //
}
});
this.handleClick()
})
.catch((e) => {
console.log(e);
});
},
//
onComplete(data) {
console.log('定位结果:' + data.position) //
let lnglat = data.position;
let marker = new AMap.Marker({ //
title: "",
position: new AMap.LngLat(lnglat.lng, lnglat.lat)
})
this.map.clearMap() //
this.map.add(marker) //
this.showInfoWindow(marker); //
},
//
onError(data) {
console.log('onError:' + data) //
this.getLngLatLocation()
},
//
getLngLatLocation() {
const that = this;
that.geolocation.getCityInfo(function(status, result) {
if (status === 'complete') {
let data = result.position
that.address = result.province + result.city;
that.showLocation(data)
} else {
that.$message.error('获取地址失败')
}
})
},
//
showLocation(data) {
let marker = new AMap.Marker({
title: "",
position: new AMap.LngLat(data[0], data[1]) //
})
this.map.clearMap() //
this.map.add(marker) //
this.showInfoWindow(marker); //
},
//
showInfoWindow2(marker) {
console.log('showInfoWindow:', marker)
let that = this
let lnglat = [marker.lnglat.lng, marker.lnglat.lat]
let address = ''
that.geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.regeocode) {
address = result.regeocode.formattedAddress;
that.addressInfo.address = result.regeocode.formattedAddress;
that.addressInfo.lngAndLat = marker.lnglat.lng + ',' + marker.lnglat.lat
let infoWindow = new AMap.InfoWindow({
isCustom: true, //
content: `<div style="background-color: white;padding: 5px; border-radius: 5px;border: 1px solid #cccccc;"> 地址:${address}</div>`,
// content: marker.content,
closeWhenClickMap: true,
zIndex: 999,
offset: new AMap.Pixel(15, -20)
});
infoWindow.open(that.map, lnglat);
} else {
// console.log('getAddress', '')
// that.$message.error('')
}
})
},
//
showInfoWindow(marker) {
console.log('showInfoWindow:', marker)
let that = this
let lnglat = [marker._position.lng, marker._position.lat]
let address = ''
that.geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.regeocode) {
address = result.regeocode.formattedAddress;
that.addressInfo.address = result.regeocode.formattedAddress;
that.addressInfo.lngAndLat = marker._position.lng + ',' + marker._position.lat
let infoWindow = new AMap.InfoWindow({
isCustom: true, //
content: `<div style="background-color: white;padding: 5px; border-radius: 5px;border: 1px solid #cccccc;"> 地址:${address}</div>`,
// content: marker.content,
closeWhenClickMap: true,
zIndex: 999,
offset: new AMap.Pixel(16, -35)
});
infoWindow.open(that.map, marker.getPosition());
} else {
// console.log('getAddress', '')
// that.$message.error('')
}
})
},
//
handleClick() {
this.map.on('click', (e) => {
let lng = e.lnglat.lng
let lat = e.lnglat.lat
console.log('handleClick:', e)
let marker = new AMap.Marker({
position: new AMap.LngLat(lng, lat),
})
this.map.clearMap() //
this.map.add(marker) //
let lnglat = [lng, lat]
let that = this
that.geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.regeocode) {
console.log('getAddress:', result.regeocode)
that.addressInfo.address = result.regeocode.formattedAddress;
that.addressInfo.lngAndLat = lng + ',' + lat
that.showInfoWindow(marker); //
// let thisPosition = {
// address: that.address,
// lng: lng,
// lat: lat
// };
// that.$emit("select", thisPosition) //
} else {
console.log('getAddress:', '根据经纬度查询地址失败')
that.$message.error('根据经纬度查询地址失败')
}
})
})
},
//
saveAddress() {
this.$emit('backData', this.addressInfo)
this.searchText = ''
this.map = null
this.geocoder = null
this.addressInfo = {
lngAndLat: "",
address: ""
}
this.pointList = []
this.geolocation = null
},
//
handleReturn() {
this.searchText = ''
this.map = null
this.geocoder = null
this.addressInfo = {
lngAndLat: "",
address: ""
}
this.pointList = []
this.geolocation = null
this.$emit('doback')
}
}
};
</script>
<style scoped>
.g-poi-search {
position: absolute;
top: 100px;
left: 130px;
padding: 8px;
border-radius: 2px;
background-color: #fff;
border: 1px #c1c1c1 solid;
}
.g-poi-search .el-select .el-input>input.el-input__inner {
height: 28px;
line-height: 28px;
}
.g-poi-search-popper .el-select-dropdown__item {
width: 200px;
height: 28px;
line-height: 28px;
}
</style>

292
src/views/baseInfo/warehouses/warehouse/warehouseAdd3.vue

@ -0,0 +1,292 @@
<template>
<div class="flex-center" style="padding: 5px;">
<div id="mymap" style="height:650px;width:90%;margin-left: 5%;margin-top: 2%;"></div>
<div class="g-poi-search">
<!-- <span style="">请输入关键字</span> -->
<el-input id="tipinput" v-model="searchText" style="width:300px;margin-top: 5px;" />
<!-- <span style="margin-top: 15px;width:300px;">当前地址:{{addressInfo.address}}</span> -->
</div>
</div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
name: "Home",
components: {},
data() {
return {
searchText: '',
map: null,
geocoder: null,
addressInfo: {
lngAndLat: "",
address: ""
},
pointList: [],
geolocation: null,
};
},
mounted() {
},
methods: {
showAdd() {
this.initMap();
},
initMap() {
let that = this;
window._AMapSecurityConfig = {
securityJsCode: "e4ce71df213230e89231cc3ef9c98313",
};
AMapLoader.load({
key: "0054c9409ec7a97ddfe933224b36f45c", // WebKey load
version: "2.0", // JSAPI 1.4.15
plugins: [], //使'AMap.Scale'['...','...']
})
.then((AMap) => {
that.map = new AMap.Map("mymap", {
// id
viewMode: "3D", // 3D
zoom: 15, //
center: [116.397428, 39.90923], //
});
//
var autoOptions = {
input: "tipinput"
};
that.map.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], function() {
var auto = new AMap.AutoComplete(autoOptions);
var placeSearch = new AMap.PlaceSearch({
map: that.map
}); //
auto.on("select", select); //
function select(e) {
console.log("placeSearch", e)
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name);
// placeSearch.search(e.poi.name, function(status, result) {
// console.log("placeSearch", result)
// that.map.clearMap()
// var pois = result.poiList.pois;
// for (var i = 0; i < pois.length; i++) {
// var poi = pois[i];
// var marker = [];
// marker[i] = new AMap.Marker({
// position: poi.location, // [116.39, 39.9]
// title: poi.name
// });
// //
// //
// marker[i].on("click", function(e) {
// console.log("click", e);
// that.showInfoWindow2(e)
// });
// that.map.add(marker[i]);
// }
// that.map.setFitView();
// }); //
}
});
// this.handleClick()
})
.catch((e) => {
console.log(e);
});
},
//
onComplete(data) {
console.log('定位结果:' + data.position) //
let lnglat = data.position;
let marker = new AMap.Marker({ //
title: "",
position: new AMap.LngLat(lnglat.lng, lnglat.lat)
})
this.map.clearMap() //
this.map.add(marker) //
this.showInfoWindow(marker); //
},
//
onError(data) {
console.log('onError:' + data) //
this.getLngLatLocation()
},
//
getLngLatLocation() {
const that = this;
that.geolocation.getCityInfo(function(status, result) {
if (status === 'complete') {
let data = result.position
that.address = result.province + result.city;
that.showLocation(data)
} else {
that.$message.error('获取地址失败')
}
})
},
//
showLocation(data) {
let marker = new AMap.Marker({
title: "",
position: new AMap.LngLat(data[0], data[1]) //
})
this.map.clearMap() //
this.map.add(marker) //
this.showInfoWindow(marker); //
},
//
showInfoWindow2(marker) {
console.log('showInfoWindow:', marker)
let that = this
let lnglat = [marker.lnglat.lng, marker.lnglat.lat]
let address = ''
that.geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.regeocode) {
address = result.regeocode.formattedAddress;
that.addressInfo.address = result.regeocode.formattedAddress;
that.addressInfo.lngAndLat = marker.lnglat.lng + ',' + marker.lnglat.lat
let infoWindow = new AMap.InfoWindow({
isCustom: true, //
content: `<div style="background-color: white;padding: 5px; border-radius: 5px;border: 1px solid #cccccc;"> 地址:${address}</div>`,
// content: marker.content,
closeWhenClickMap: true,
zIndex: 999,
offset: new AMap.Pixel(15, -20)
});
infoWindow.open(that.map, lnglat);
} else {
// console.log('getAddress', '')
// that.$message.error('')
}
})
},
//
showInfoWindow(marker) {
console.log('showInfoWindow:', marker)
let that = this
let lnglat = [marker._position.lng, marker._position.lat]
let address = ''
that.geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.regeocode) {
address = result.regeocode.formattedAddress;
that.addressInfo.address = result.regeocode.formattedAddress;
that.addressInfo.lngAndLat = marker._position.lng + ',' + marker._position.lat
let infoWindow = new AMap.InfoWindow({
isCustom: true, //
content: `<div style="background-color: white;padding: 5px; border-radius: 5px;border: 1px solid #cccccc;"> 地址:${address}</div>`,
// content: marker.content,
closeWhenClickMap: true,
zIndex: 999,
offset: new AMap.Pixel(16, -35)
});
infoWindow.open(that.map, marker.getPosition());
} else {
// console.log('getAddress', '')
// that.$message.error('')
}
})
},
//
handleClick() {
this.map.on('click', (e) => {
let lng = e.lnglat.lng
let lat = e.lnglat.lat
console.log('handleClick:', e)
let marker = new AMap.Marker({
position: new AMap.LngLat(lng, lat),
})
this.map.clearMap() //
this.map.add(marker) //
let lnglat = [lng, lat]
let that = this
that.geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.regeocode) {
console.log('getAddress:', result.regeocode)
that.addressInfo.address = result.regeocode.formattedAddress;
that.addressInfo.lngAndLat = lng + ',' + lat
that.showInfoWindow(marker); //
// let thisPosition = {
// address: that.address,
// lng: lng,
// lat: lat
// };
// that.$emit("select", thisPosition) //
} else {
console.log('getAddress:', '根据经纬度查询地址失败')
that.$message.error('根据经纬度查询地址失败')
}
})
})
},
//
saveAddress() {
this.$emit('backData', this.addressInfo)
// this.searchText = ''
// this.map = null
// this.geocoder = null
// this.addressInfo = {
// lngAndLat: "",
// address: ""
// }
// this.pointList = []
// this.geolocation = null
},
//
handleReturn() {
// this.searchText = ''
// this.map = null
// this.geocoder = null
// this.addressInfo = {
// lngAndLat: "",
// address: ""
// }
// this.pointList = []
// this.geolocation = null
this.$emit('doback')
}
}
};
</script>
<style scoped>
.g-poi-search {
position: absolute;
top: 100px;
left: 130px;
padding: 8px;
border-radius: 2px;
background-color: #fff;
border: 1px #c1c1c1 solid;
}
.g-poi-search .el-select .el-input>input.el-input__inner {
height: 28px;
line-height: 28px;
}
.g-poi-search-popper .el-select-dropdown__item {
width: 200px;
height: 28px;
line-height: 28px;
}
</style>

11
src/views/system/organizationManage/organizationManage.vue

@ -450,8 +450,15 @@
console.log('zgNamesChange:', val)
const choose = this.staffdata.filter((item) => item.sid == val)
console.log('>>>>>>>>>zgNamesChange', choose)
this.form.zgNames = choose[0].name
this.form.zgStaffSid = choose[0].sid
if (choose != null && choose.length > 0) {
this.form.zgNames = choose[0].name
this.form.zgStaffSid = choose[0].sid
} else {
this.form.zgNames = ''
this.form.zgStaffSid = ''
}
},
save() {
if (this.fgStaffSid.length > 0) {

2
src/views/system/roleAdminister/roleAdminister.vue

@ -489,7 +489,7 @@
this.formBackup = Object.assign({}, this.roleForm)
this.getroleOrgList()
this.getPostList()
this.getType()
// this.getType()
},
methods: {
pagination(val) { //

Loading…
Cancel
Save