|
|
@@ -10,7 +10,7 @@
|
|
|
:model="userMsg"
|
|
|
label-width="90px"
|
|
|
:rules="editUserMsgRules"
|
|
|
- style="display: flex;justify-content: space-between;align-items: flex-start;"
|
|
|
+ style="display: flex; justify-content: space-between; align-items: flex-start"
|
|
|
>
|
|
|
<div>
|
|
|
<!-- <el-form-item label="用户头像:" prop="newPass">
|
|
|
@@ -27,18 +27,10 @@
|
|
|
<div class="hint">仅支持jpg、gif、jpeg、bmp格式,文件小于4M</div>
|
|
|
</el-form-item> -->
|
|
|
<el-form-item label="用户名:" prop="">
|
|
|
- <el-input
|
|
|
- type="text"
|
|
|
- disabled="disabled"
|
|
|
- v-model="userMsg.username"
|
|
|
- ></el-input>
|
|
|
+ <el-input type="text" disabled="disabled" v-model="userMsg.username"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="联系方式:" prop="mobile">
|
|
|
- <el-input
|
|
|
- type="mobile"
|
|
|
- v-model="userMsg.mobile"
|
|
|
- maxlength="11"
|
|
|
- ></el-input>
|
|
|
+ <el-input type="mobile" v-model="userMsg.mobile" maxlength="11"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="地址:">
|
|
|
<div class="block">
|
|
|
@@ -51,11 +43,7 @@
|
|
|
filterable
|
|
|
>
|
|
|
</el-cascader> -->
|
|
|
- <el-select
|
|
|
- v-model="address.sheng"
|
|
|
- @change="clear('sheng')"
|
|
|
- placeholder="请选择省"
|
|
|
- >
|
|
|
+ <el-select v-model="address.sheng" @change="clear('sheng')" placeholder="请选择省">
|
|
|
<el-option
|
|
|
v-for="item in shengList"
|
|
|
:key="item.value"
|
|
|
@@ -64,11 +52,7 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <el-select
|
|
|
- v-model="address.shi"
|
|
|
- @change="clear('shi')"
|
|
|
- placeholder="请选择市"
|
|
|
- >
|
|
|
+ <el-select v-model="address.shi" @change="clear('shi')" placeholder="请选择市">
|
|
|
<el-option
|
|
|
v-for="item in shiList"
|
|
|
:key="item.value"
|
|
|
@@ -96,15 +80,12 @@
|
|
|
<el-button @click="resetForm">取消</el-button>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
- <div style="margin-right: 80px;">
|
|
|
+ <div style="margin-right: 80px" v-if="false">
|
|
|
<div>
|
|
|
- <el-button type="primary" @click="openMapDialog('isAdd')"
|
|
|
- >新增项目区域</el-button
|
|
|
- >
|
|
|
- <el-table :data="projectAreaTableData" style="width:500px">
|
|
|
+ <el-button type="primary" @click="openMapDialog('isAdd')">新增项目区域</el-button>
|
|
|
+ <el-table :data="projectAreaTableData" style="width: 500px">
|
|
|
<!-- style="width: 300px" -->
|
|
|
- <el-table-column type="index" align="center" width="50">
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column type="index" align="center" width="50"> </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="project_name"
|
|
|
label=""
|
|
|
@@ -120,17 +101,15 @@
|
|
|
<template slot-scope="scope">
|
|
|
<span
|
|
|
@click="openMapDialog(false, scope.row)"
|
|
|
- style="color:#1ab981;cursor: pointer;"
|
|
|
+ style="color: #1ab981; cursor: pointer"
|
|
|
>查看
|
|
|
</span>
|
|
|
<span
|
|
|
@click="openBasenameDialog(scope.row)"
|
|
|
- style="color:#1ab981;cursor: pointer;"
|
|
|
+ style="color: #1ab981; cursor: pointer"
|
|
|
>更改
|
|
|
</span>
|
|
|
- <span
|
|
|
- @click="deleteBase(scope.row)"
|
|
|
- style="color:#1ab981;cursor: pointer;"
|
|
|
+ <span @click="deleteBase(scope.row)" style="color: #1ab981; cursor: pointer"
|
|
|
>删除
|
|
|
</span>
|
|
|
</template>
|
|
|
@@ -180,7 +159,7 @@
|
|
|
class="input-with-select"
|
|
|
>
|
|
|
<el-button
|
|
|
- style="color: white;"
|
|
|
+ style="color: white"
|
|
|
class="searchBtn"
|
|
|
slot="append"
|
|
|
icon="el-icon-search"
|
|
|
@@ -189,21 +168,11 @@
|
|
|
搜索
|
|
|
</el-button>
|
|
|
</el-input>
|
|
|
- <el-button
|
|
|
- v-if="isAdd"
|
|
|
- class="drawBtn"
|
|
|
- @click="drawFun"
|
|
|
- round
|
|
|
- icon="el-icon-star-off"
|
|
|
+ <el-button v-if="isAdd" class="drawBtn" @click="drawFun" round icon="el-icon-star-off"
|
|
|
>绘制基地</el-button
|
|
|
>
|
|
|
</div>
|
|
|
- <div
|
|
|
- style="height: 70vh;"
|
|
|
- class="amap-demo"
|
|
|
- id="mapContainer"
|
|
|
- tabindex="0"
|
|
|
- ></div>
|
|
|
+ <div style="height: 70vh" class="amap-demo" id="mapContainer" tabindex="0"></div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<el-dialog
|
|
|
@@ -220,17 +189,9 @@
|
|
|
<el-input style="width: 217px" v-model="base_name"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <span
|
|
|
- slot="footer"
|
|
|
- style="text-align: center;display: block;"
|
|
|
- class="dialog-footer"
|
|
|
- >
|
|
|
- <el-button size="small" @click="addBaseDialogVisible = false"
|
|
|
- >取 消</el-button
|
|
|
- >
|
|
|
- <el-button size="small" type="greenInfo" @click="submitBase()"
|
|
|
- >确 定</el-button
|
|
|
- >
|
|
|
+ <span slot="footer" style="text-align: center; display: block" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="addBaseDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button size="small" type="greenInfo" @click="submitBase()">确 定</el-button>
|
|
|
</span>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -238,36 +199,36 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import AMap from 'AMap';
|
|
|
-import cityArr from './citydata.js';
|
|
|
+import AMap from 'AMap'
|
|
|
+import cityArr from './citydata.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
var telRexEx = (rule, value, callback) => {
|
|
|
if (value) {
|
|
|
if (!/^1[3456789]\d{9}$/.test(value)) {
|
|
|
- callback(new Error('手机号码有误,请重填'));
|
|
|
- return false;
|
|
|
+ callback(new Error('手机号码有误,请重填'))
|
|
|
+ return false
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
} else {
|
|
|
// callback(new Error('请输入联系方式'));
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
var emailRexEx = (rule, value, callback) => {
|
|
|
if (value) {
|
|
|
// if(!(/^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(value))){
|
|
|
if (!/^[0-9|A-z|]{6,18}[@][0-9|A-z]{1,3}.(com)$/.test(value)) {
|
|
|
- callback(new Error('邮箱有误,请重填'));
|
|
|
- return false;
|
|
|
+ callback(new Error('邮箱有误,请重填'))
|
|
|
+ return false
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
return {
|
|
|
address: {
|
|
|
sheng: '',
|
|
|
@@ -354,7 +315,7 @@ export default {
|
|
|
addBaseTitle: '新建基地',
|
|
|
isAdd: true,
|
|
|
currentRowData: {}
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
// isDrawing(newState) {
|
|
|
@@ -366,9 +327,9 @@ export default {
|
|
|
// },
|
|
|
address: {
|
|
|
handler() {
|
|
|
- this.userMsg.province = this.address.sheng;
|
|
|
- this.userMsg.city = this.address.shi;
|
|
|
- this.userMsg.district = this.address.qu;
|
|
|
+ this.userMsg.province = this.address.sheng
|
|
|
+ this.userMsg.city = this.address.shi
|
|
|
+ this.userMsg.district = this.address.qu
|
|
|
},
|
|
|
deep: true,
|
|
|
immediate: true
|
|
|
@@ -377,33 +338,33 @@ export default {
|
|
|
computed: {
|
|
|
shiList() {
|
|
|
// console.log(this.shengList, this.address.sheng);
|
|
|
- const shi = this.shengList.find(v => v.value === this.address.sheng);
|
|
|
+ const shi = this.shengList.find((v) => v.value === this.address.sheng)
|
|
|
// return shi ? shi.children:[]
|
|
|
if (shi && shi.children && shi.children.length) {
|
|
|
- return shi.children;
|
|
|
+ return shi.children
|
|
|
} else {
|
|
|
- return [];
|
|
|
+ return []
|
|
|
}
|
|
|
},
|
|
|
quList() {
|
|
|
// console.log(this.shiList, this.address.shi);
|
|
|
- const qu = this.shiList.find(v => v.value === this.address.shi);
|
|
|
+ const qu = this.shiList.find((v) => v.value === this.address.shi)
|
|
|
if (qu && qu.children && qu.children.length) {
|
|
|
- return qu.children;
|
|
|
+ return qu.children
|
|
|
} else {
|
|
|
- return [];
|
|
|
+ return []
|
|
|
}
|
|
|
// return qu ? qu.children : [];
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getRoleList();
|
|
|
+ this.getRoleList()
|
|
|
},
|
|
|
mounted() {
|
|
|
- document.oncontextmenu = new Function('event.returnValue=false;');
|
|
|
+ document.oncontextmenu = new Function('event.returnValue=false;')
|
|
|
// this.getRoleList()
|
|
|
|
|
|
- this.getProjectList();
|
|
|
+ this.getProjectList()
|
|
|
},
|
|
|
methods: {
|
|
|
getProjectList() {
|
|
|
@@ -411,115 +372,112 @@ export default {
|
|
|
method: 'POST',
|
|
|
url: '/api/api_gateway?method=device_screen.screen.project_area_list'
|
|
|
// data: {},
|
|
|
- }).then(res => {
|
|
|
+ }).then((res) => {
|
|
|
if (res.data.data && res.data.data.data && res.data.data.data.length) {
|
|
|
- this.projectAreaTableData = res.data.data.data;
|
|
|
+ this.projectAreaTableData = res.data.data.data
|
|
|
} else {
|
|
|
- this.projectAreaTableData = [];
|
|
|
+ this.projectAreaTableData = []
|
|
|
// this.$resetMessage.error(res.data.message);
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
addBaseDialogclose() {
|
|
|
- this.isDrawing = false;
|
|
|
- this.base_name = '';
|
|
|
- this.overlays = '';
|
|
|
+ this.isDrawing = false
|
|
|
+ this.base_name = ''
|
|
|
+ this.overlays = ''
|
|
|
},
|
|
|
submitBase() {
|
|
|
if (this.base_name == '') {
|
|
|
- this.$resetMessage.warning('请输入基地名称');
|
|
|
- return;
|
|
|
+ this.$resetMessage.warning('请输入基地名称')
|
|
|
+ return
|
|
|
}
|
|
|
var data = {
|
|
|
project_name: this.base_name
|
|
|
- };
|
|
|
+ }
|
|
|
if (!this.isAdd) {
|
|
|
// 修改
|
|
|
- data.project_id = this.currentRowData.project_id;
|
|
|
+ data.project_id = this.currentRowData.project_id
|
|
|
} else {
|
|
|
// 新增
|
|
|
- data.project_coordinates = JSON.stringify(this.overlays);
|
|
|
+ data.project_coordinates = JSON.stringify(this.overlays)
|
|
|
}
|
|
|
this.$axios({
|
|
|
method: 'POST',
|
|
|
url: '/api/api_gateway?method=home.homes.project_area_info',
|
|
|
data: this.qs.stringify(data)
|
|
|
- }).then(res => {
|
|
|
+ }).then((res) => {
|
|
|
if (res.data && res.data.data) {
|
|
|
- this.$resetMessage.success('添加成功!');
|
|
|
- this.addBaseDialogVisible = false;
|
|
|
- this.isDrawing = false;
|
|
|
- this.base_name = '';
|
|
|
- this.overlays = '';
|
|
|
- this.getProjectList();
|
|
|
+ this.$resetMessage.success('添加成功!')
|
|
|
+ this.addBaseDialogVisible = false
|
|
|
+ this.isDrawing = false
|
|
|
+ this.base_name = ''
|
|
|
+ this.overlays = ''
|
|
|
+ this.getProjectList()
|
|
|
} else {
|
|
|
- this.$resetMessage.error(res.data.message);
|
|
|
+ this.$resetMessage.error(res.data.message)
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
- initMap: function() {
|
|
|
+ initMap: function () {
|
|
|
var map = new AMap.Map('mapContainer', {
|
|
|
center: this.center,
|
|
|
resizeEnable: true,
|
|
|
zoom: 15,
|
|
|
layers: [new AMap.TileLayer.Satellite()],
|
|
|
lang: 'en'
|
|
|
- });
|
|
|
- AMap.plugin(
|
|
|
- ['AMap.ToolBar', 'AMap.Scale', 'AMap.MouseTool', 'AMap.Geocoder'],
|
|
|
- () => {
|
|
|
- map.addControl(new AMap.ToolBar());
|
|
|
- map.addControl(new AMap.Scale());
|
|
|
- this.mouseTool = new AMap.MouseTool(map);
|
|
|
- this.mouseTool.on('draw', this.drawBaseEnd);
|
|
|
- this.geocoder = new AMap.Geocoder({
|
|
|
- city: '全国',
|
|
|
- radius: 1000
|
|
|
- });
|
|
|
- }
|
|
|
- );
|
|
|
+ })
|
|
|
+ AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.MouseTool', 'AMap.Geocoder'], () => {
|
|
|
+ map.addControl(new AMap.ToolBar())
|
|
|
+ map.addControl(new AMap.Scale())
|
|
|
+ this.mouseTool = new AMap.MouseTool(map)
|
|
|
+ this.mouseTool.on('draw', this.drawBaseEnd)
|
|
|
+ this.geocoder = new AMap.Geocoder({
|
|
|
+ city: '全国',
|
|
|
+ radius: 1000
|
|
|
+ })
|
|
|
+ })
|
|
|
// this.xyzTileLayer = new AMap.TileLayer({
|
|
|
// tileUrl:
|
|
|
// 'http://t{0,1,2,3,4,5,6,7}.tianditu.gov.cn/DataServer?T=img_w&tk=6e5cb1bfc017afcac7a21836cf81a884&x=[x]&y=[y]&l=[z]',
|
|
|
// zIndex: 10
|
|
|
// }); // 卫星图层
|
|
|
// map.add(this.xyzTileLayer);
|
|
|
- this.map = map;
|
|
|
+ this.map = map
|
|
|
|
|
|
this.polyEditor = new AMap.PolygonEditor(this.map, '', {
|
|
|
editOptions: this.styles.landPolygon
|
|
|
- });
|
|
|
- this.polyEditor.on('addnode', this.drawLandNode); // 增加一个节点时触发此事件
|
|
|
- this.polyEditor.on('add', this.drawLandEnd); // 创建一个覆盖物之后触发该事件
|
|
|
+ })
|
|
|
+ this.polyEditor.on('addnode', this.drawLandNode) // 增加一个节点时触发此事件
|
|
|
+ this.polyEditor.on('add', this.drawLandEnd) // 创建一个覆盖物之后触发该事件
|
|
|
this.map.plugin(['AMap.DistrictSearch'], () => {
|
|
|
- this.setAdmin();
|
|
|
- });
|
|
|
+ this.setAdmin()
|
|
|
+ })
|
|
|
if (!this.isAdd) {
|
|
|
- this.drawMap();
|
|
|
+ this.drawMap()
|
|
|
}
|
|
|
},
|
|
|
openMapDialog(isAdd, data) {
|
|
|
- this.isAdd = !!isAdd;
|
|
|
+ this.isAdd = !!isAdd
|
|
|
if (data) {
|
|
|
- this.currentRowData = data;
|
|
|
+ this.currentRowData = data
|
|
|
}
|
|
|
- this.isDrawing = true;
|
|
|
+ this.isDrawing = true
|
|
|
this.$nextTick(() => {
|
|
|
- this.initMap();
|
|
|
- });
|
|
|
+ this.initMap()
|
|
|
+ })
|
|
|
},
|
|
|
openBasenameDialog(data) {
|
|
|
- this.isAdd = false;
|
|
|
- this.addBaseDialogVisible = true;
|
|
|
- this.currentRowData = data;
|
|
|
+ this.isAdd = false
|
|
|
+ this.addBaseDialogVisible = true
|
|
|
+ this.currentRowData = data
|
|
|
},
|
|
|
drawFun() {
|
|
|
// 新增项目区域
|
|
|
- this.polyEditor.close();
|
|
|
+ this.polyEditor.close()
|
|
|
this.mouseTool.measureArea({
|
|
|
...this.styles.basePolygon
|
|
|
- });
|
|
|
- this.map.setDefaultCursor('crosshair');
|
|
|
+ })
|
|
|
+ this.map.setDefaultCursor('crosshair')
|
|
|
},
|
|
|
drawMap() {
|
|
|
// var coordinates = [
|
|
|
@@ -527,111 +485,111 @@ export default {
|
|
|
// [113.70731, 34.810163],
|
|
|
// [113.775778, 34.799266]
|
|
|
// ]
|
|
|
- var coordinates = JSON.parse(this.currentRowData.project_coordinates);
|
|
|
+ var coordinates = JSON.parse(this.currentRowData.project_coordinates)
|
|
|
this.basePolygon = new AMap.Polygon({
|
|
|
path: coordinates,
|
|
|
...this.styles.basePolygon
|
|
|
- });
|
|
|
- this.map.add(this.basePolygon);
|
|
|
- this.polyEditor.addAdsorbPolygons([this.basePolygon]);
|
|
|
- this.map.setFitView([this.basePolygon]);
|
|
|
+ })
|
|
|
+ this.map.add(this.basePolygon)
|
|
|
+ this.polyEditor.addAdsorbPolygons([this.basePolygon])
|
|
|
+ this.map.setFitView([this.basePolygon])
|
|
|
},
|
|
|
searchFun() {
|
|
|
// console.log(this.marker)
|
|
|
if (this.marker) {
|
|
|
- this.map.remove(this.marker);
|
|
|
+ this.map.remove(this.marker)
|
|
|
}
|
|
|
if (!this.searchAddr) {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
- this.marker = new AMap.Marker();
|
|
|
+ this.marker = new AMap.Marker()
|
|
|
this.geocoder.getLocation(this.searchAddr, (status, result) => {
|
|
|
if (status === 'complete' && result.geocodes.length) {
|
|
|
- var lnglat = result.geocodes[0].location;
|
|
|
- this.marker.setPosition(lnglat);
|
|
|
- this.map.add(this.marker);
|
|
|
- this.map.setFitView(this.marker);
|
|
|
+ var lnglat = result.geocodes[0].location
|
|
|
+ this.marker.setPosition(lnglat)
|
|
|
+ this.map.add(this.marker)
|
|
|
+ this.map.setFitView(this.marker)
|
|
|
} else {
|
|
|
- this.$message.error('根据地址查询位置失败');
|
|
|
+ this.$message.error('根据地址查询位置失败')
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
deleteBase(data) {
|
|
|
- this.currentRowData = data;
|
|
|
+ this.currentRowData = data
|
|
|
this.$confirm('确定要删除当前基地吗?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
- .then(_ => {
|
|
|
+ .then((_) => {
|
|
|
this.$axios({
|
|
|
method: 'POST',
|
|
|
url: '/api/api_gateway?method=home.homes.delete_project_area',
|
|
|
data: this.qs.stringify({
|
|
|
project_id: this.currentRowData.project_id
|
|
|
})
|
|
|
- }).then(res => {
|
|
|
+ }).then((res) => {
|
|
|
if (res.data && res.data.data) {
|
|
|
- this.$resetMessage.success('删除成功!');
|
|
|
- this.addBaseDialogVisible = false;
|
|
|
- this.isDrawing = false;
|
|
|
- this.base_name = '';
|
|
|
- this.overlays = '';
|
|
|
- this.getProjectList();
|
|
|
+ this.$resetMessage.success('删除成功!')
|
|
|
+ this.addBaseDialogVisible = false
|
|
|
+ this.isDrawing = false
|
|
|
+ this.base_name = ''
|
|
|
+ this.overlays = ''
|
|
|
+ this.getProjectList()
|
|
|
} else {
|
|
|
- this.$resetMessage.error(res.data.message);
|
|
|
+ this.$resetMessage.error(res.data.message)
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
})
|
|
|
- .catch(_ => {});
|
|
|
+ .catch((_) => {})
|
|
|
},
|
|
|
drawBaseEnd(e) {
|
|
|
- let arr = e.obj.getPath();
|
|
|
- let overlays = arr.map(item => {
|
|
|
- return [item.lng, item.lat];
|
|
|
- });
|
|
|
+ let arr = e.obj.getPath()
|
|
|
+ let overlays = arr.map((item) => {
|
|
|
+ return [item.lng, item.lat]
|
|
|
+ })
|
|
|
// console.log(overlays)
|
|
|
- this.overlays = overlays;
|
|
|
- this.addBaseDialogVisible = true;
|
|
|
+ this.overlays = overlays
|
|
|
+ this.addBaseDialogVisible = true
|
|
|
},
|
|
|
setAdmin() {
|
|
|
- var city = '';
|
|
|
- var tier = '';
|
|
|
+ var city = ''
|
|
|
+ var tier = ''
|
|
|
if (this.address.qu != '') {
|
|
|
- tier = 'district';
|
|
|
- city = this.address.qu;
|
|
|
+ tier = 'district'
|
|
|
+ city = this.address.qu
|
|
|
} else if (this.address.shi != '') {
|
|
|
- tier = 'city';
|
|
|
- city = this.address.shi;
|
|
|
+ tier = 'city'
|
|
|
+ city = this.address.shi
|
|
|
} else if (this.address.sheng != '') {
|
|
|
- tier = 'province';
|
|
|
- city = this.address.sheng;
|
|
|
+ tier = 'province'
|
|
|
+ city = this.address.sheng
|
|
|
} else {
|
|
|
- return;
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
- var district = null;
|
|
|
+ var district = null
|
|
|
if (!district) {
|
|
|
// 实例化DistrictSearch
|
|
|
var opts = {
|
|
|
subdistrict: 0, // 获取边界不需要返回下级行政区
|
|
|
extensions: 'all', // 返回行政区边界坐标组等具体信息
|
|
|
level: 'district' // 查询行政级别为 市
|
|
|
- };
|
|
|
- district = new AMap.DistrictSearch(opts);
|
|
|
+ }
|
|
|
+ district = new AMap.DistrictSearch(opts)
|
|
|
}
|
|
|
- district.setLevel(tier);
|
|
|
+ district.setLevel(tier)
|
|
|
district.search(city, (status, result) => {
|
|
|
if (this.polygon) {
|
|
|
- this.map.remove(this.polygon); // 清除上次结果
|
|
|
- this.polygon = null;
|
|
|
+ this.map.remove(this.polygon) // 清除上次结果
|
|
|
+ this.polygon = null
|
|
|
}
|
|
|
- var bounds = result.districtList[0].boundaries;
|
|
|
+ var bounds = result.districtList[0].boundaries
|
|
|
if (bounds) {
|
|
|
// 生成行政区划polygon
|
|
|
for (var i = 0; i < bounds.length; i += 1) {
|
|
|
// 构造MultiPolygon的path
|
|
|
- bounds[i] = [bounds[i]];
|
|
|
+ bounds[i] = [bounds[i]]
|
|
|
}
|
|
|
this.polygon = new AMap.Polygon({
|
|
|
strokeWeight: 2,
|
|
|
@@ -641,143 +599,139 @@ export default {
|
|
|
// strokeColor: '#0064fc'
|
|
|
fillColor: '#000',
|
|
|
strokeColor: '#0064fc'
|
|
|
- });
|
|
|
- this.map.add(this.polygon);
|
|
|
+ })
|
|
|
+ this.map.add(this.polygon)
|
|
|
if (this.isAdd) {
|
|
|
// 新增
|
|
|
- this.map.setFitView(this.polygon); // 视口自适应
|
|
|
+ this.map.setFitView(this.polygon) // 视口自适应
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
clear(val) {
|
|
|
if (val == 'sheng') {
|
|
|
- this.address.shi = '';
|
|
|
- this.address.qu = '';
|
|
|
+ this.address.shi = ''
|
|
|
+ this.address.qu = ''
|
|
|
}
|
|
|
if (val == 'shi') {
|
|
|
- this.address.qu = '';
|
|
|
+ this.address.qu = ''
|
|
|
}
|
|
|
},
|
|
|
resetForm() {
|
|
|
- this.$refs.userMsgRef.resetFields();
|
|
|
+ this.$refs.userMsgRef.resetFields()
|
|
|
},
|
|
|
getRoleList() {
|
|
|
- let that = this;
|
|
|
+ let that = this
|
|
|
this.$axios({
|
|
|
method: 'POST',
|
|
|
url: '/api/api_gateway?method=home.homes.personal_center',
|
|
|
data: this.qs.stringify({
|
|
|
username: localStorage.getItem('cUsername')
|
|
|
})
|
|
|
- }).then(res => {
|
|
|
+ }).then((res) => {
|
|
|
if (res.data.message == '') {
|
|
|
- var obj = res.data.data;
|
|
|
- var a = res.data.data.image;
|
|
|
- var b = a.replace('/api/', '');
|
|
|
- obj['image'] = b;
|
|
|
+ var obj = res.data.data
|
|
|
+ var a = res.data.data.image
|
|
|
+ var b = a.replace('/api/', '')
|
|
|
+ obj['image'] = b
|
|
|
|
|
|
- that.userMsg = res.data.data;
|
|
|
+ that.userMsg = res.data.data
|
|
|
// console.log(that.cityValue);
|
|
|
if (res.data.data.district == '') {
|
|
|
- that.cityValue = [res.data.data.province, res.data.data.city];
|
|
|
- that.address.sheng = res.data.data.province;
|
|
|
- that.address.shi = res.data.data.city;
|
|
|
+ that.cityValue = [res.data.data.province, res.data.data.city]
|
|
|
+ that.address.sheng = res.data.data.province
|
|
|
+ that.address.shi = res.data.data.city
|
|
|
} else {
|
|
|
- that.cityValue = [
|
|
|
- res.data.data.province,
|
|
|
- res.data.data.city,
|
|
|
- res.data.data.district
|
|
|
- ];
|
|
|
- that.address.sheng = res.data.data.province;
|
|
|
- that.address.shi = res.data.data.city;
|
|
|
- that.address.qu = res.data.data.district;
|
|
|
+ that.cityValue = [res.data.data.province, res.data.data.city, res.data.data.district]
|
|
|
+ that.address.sheng = res.data.data.province
|
|
|
+ that.address.shi = res.data.data.city
|
|
|
+ that.address.qu = res.data.data.district
|
|
|
}
|
|
|
|
|
|
// console.log(that.cityValue);
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
saveUserMsg() {
|
|
|
- this.$refs.userMsgRef.validate(valid => {
|
|
|
+ this.$refs.userMsgRef.validate((valid) => {
|
|
|
// console.log(11111);
|
|
|
if (valid) {
|
|
|
- this.userMsg.ret = 'change';
|
|
|
+ this.userMsg.ret = 'change'
|
|
|
this.$axios({
|
|
|
method: 'POST',
|
|
|
url: '/api/api_gateway?method=home.homes.personal_center',
|
|
|
data: this.qs.stringify(this.userMsg)
|
|
|
- }).then(res => {
|
|
|
+ }).then((res) => {
|
|
|
if (res.data.message == '') {
|
|
|
- this.$resetMessage.success('修改成功!');
|
|
|
+ this.$resetMessage.success('修改成功!')
|
|
|
// this.$message.success("修改成功!");
|
|
|
} else {
|
|
|
- this.$resetMessage.error(res.data.message);
|
|
|
+ this.$resetMessage.error(res.data.message)
|
|
|
// this.$message.error("修改失败!");
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
// 上传按钮 限制图片大小
|
|
|
changeUpload(file, fileList) {
|
|
|
- const isLt4M = file.size / 1024 / 1024 < 4;
|
|
|
+ const isLt4M = file.size / 1024 / 1024 < 4
|
|
|
if (!isLt4M) {
|
|
|
- this.$message.error('上传文件大小不能超过 4MB!');
|
|
|
- return false;
|
|
|
+ this.$message.error('上传文件大小不能超过 4MB!')
|
|
|
+ return false
|
|
|
}
|
|
|
// 上传成功后将图片地址赋值给裁剪框显示图片
|
|
|
this.$nextTick(() => {
|
|
|
- this.photo.img = URL.createObjectURL(file.raw);
|
|
|
- this.cropperVisible = true;
|
|
|
- });
|
|
|
+ this.photo.img = URL.createObjectURL(file.raw)
|
|
|
+ this.cropperVisible = true
|
|
|
+ })
|
|
|
},
|
|
|
// 点击裁剪,这一步是可以拿到处理后的地址
|
|
|
finish() {
|
|
|
// 获取截图的base64 数据
|
|
|
- this.$refs.cropper.getCropBlob(data => {
|
|
|
- var form = new FormData();
|
|
|
- let resFile = this.blobToFile(data, 'filename.jpg');
|
|
|
+ this.$refs.cropper.getCropBlob((data) => {
|
|
|
+ var form = new FormData()
|
|
|
+ let resFile = this.blobToFile(data, 'filename.jpg')
|
|
|
// console.log(resFile);
|
|
|
- form.append('image', resFile);
|
|
|
- form.append('username', localStorage.getItem('cUsername'));
|
|
|
+ form.append('image', resFile)
|
|
|
+ form.append('username', localStorage.getItem('cUsername'))
|
|
|
// console.log(form);
|
|
|
- this.cropperVisible = false;
|
|
|
+ this.cropperVisible = false
|
|
|
this.$axios({
|
|
|
method: 'POST',
|
|
|
url: '/api/api_gateway?method=home.homes.personal_photo',
|
|
|
data: form
|
|
|
- }).then(res => {
|
|
|
+ }).then((res) => {
|
|
|
if (res.data.data.src != 0 && res.data.message == '') {
|
|
|
// this.userMsg.image = `/api/${res.data.data.src}`
|
|
|
- this.userMsg.image = res.data.data.src;
|
|
|
+ this.userMsg.image = res.data.data.src
|
|
|
} else {
|
|
|
this.$message({
|
|
|
message: '上传失败',
|
|
|
type: 'error'
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
- });
|
|
|
- });
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
// 转成file
|
|
|
blobToFile(Blob, fileName) {
|
|
|
- Blob.lastModifiedDate = new Date();
|
|
|
- Blob.name = fileName;
|
|
|
- return Blob;
|
|
|
+ Blob.lastModifiedDate = new Date()
|
|
|
+ Blob.name = fileName
|
|
|
+ return Blob
|
|
|
},
|
|
|
handleChange(value) {
|
|
|
// //console.log(value)
|
|
|
// //console.log(this.options[value[0]])
|
|
|
- this.userMsg.province = value[0];
|
|
|
- this.userMsg.city = value[1];
|
|
|
- this.userMsg.district = value[2];
|
|
|
+ this.userMsg.province = value[0]
|
|
|
+ this.userMsg.city = value[1]
|
|
|
+ this.userMsg.district = value[2]
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|