|
|
@@ -2,6 +2,21 @@
|
|
|
<template>
|
|
|
<div class="maintainbox">
|
|
|
<div class="maintainbox_search">
|
|
|
+ <el-select
|
|
|
+ v-model="point_type"
|
|
|
+ placeholder="请选择监测点类型"
|
|
|
+ size="mini"
|
|
|
+ clearable
|
|
|
+ @change="search"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in pointTypeOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
<el-input
|
|
|
v-model="monitorname"
|
|
|
placeholder="请输入监测点名称"
|
|
|
@@ -20,24 +35,34 @@
|
|
|
</div>
|
|
|
<el-card class="box-card" style="margin-top: 15px">
|
|
|
<div class="cbdboxs_table" v-loading="loading">
|
|
|
- <el-table :data="tableData" style="width: 100%" :stripe="true" :height="48*13" ref="gridTable">
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ style="width: 100%"
|
|
|
+ :stripe="true"
|
|
|
+ :height="48 * 13"
|
|
|
+ ref="gridTable"
|
|
|
+ >
|
|
|
<el-table-column prop="index" label="序号">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ ((page-1)*20)+scope.row.index}}</span>
|
|
|
- </template>
|
|
|
+ <span>{{ (page - 1) * 20 + scope.row.index }}</span>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="point_name"
|
|
|
label="监测点名称"
|
|
|
></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="point_type_name"
|
|
|
+ label="监测点类型"
|
|
|
+ ></el-table-column>
|
|
|
<el-table-column prop="lng" label="经度">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ ToDegrees(scope.row.lng, "lng") }}</span>
|
|
|
+ <span>{{ ToDegrees(scope.row.lng, 'lng') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="lat" label="纬度">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ ToDegrees(scope.row.lat, "lat") }}</span>
|
|
|
+ <span>{{ ToDegrees(scope.row.lat, 'lat') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="messages" label="简介"></el-table-column>
|
|
|
@@ -85,19 +110,42 @@
|
|
|
<el-form-item label="监测点名称" prop="point_name">
|
|
|
<el-input v-model="ruleForm.point_name"></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="监测点类型" prop="point_type">
|
|
|
+ <el-select
|
|
|
+ v-model="point_type"
|
|
|
+ placeholder="请选择监测点类型"
|
|
|
+ size="mini"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in pointTypeOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<div class="addtrapbox">
|
|
|
<el-form-item label="所在经度" prop="lng">
|
|
|
<el-input v-model="ruleForm.lng"></el-input>
|
|
|
<p style="height: 24px; padding-left: 16px">
|
|
|
<!-- {{ ToDegrees(ruleForm.lng, "lng") }} -->
|
|
|
- {{ isNaN(ruleForm.lng)?ToDigital(ruleForm.lng, "lng"):ToDegrees(ruleForm.lng, "lng") }}
|
|
|
+ {{
|
|
|
+ isNaN(ruleForm.lng)
|
|
|
+ ? ToDigital(ruleForm.lng, 'lng')
|
|
|
+ : ToDegrees(ruleForm.lng, 'lng')
|
|
|
+ }}
|
|
|
</p>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所在纬度" prop="lat">
|
|
|
<el-input v-model="ruleForm.lat"></el-input>
|
|
|
<p style="height: 24px; padding-left: 16px">
|
|
|
<!-- {{ ToDegrees(ruleForm.lat, "lat") }} -->
|
|
|
- {{ isNaN(ruleForm.lat)?ToDigital(ruleForm.lat, "lat"):ToDegrees(ruleForm.lat, "lat") }}
|
|
|
+ {{
|
|
|
+ isNaN(ruleForm.lat)
|
|
|
+ ? ToDigital(ruleForm.lat, 'lat')
|
|
|
+ : ToDegrees(ruleForm.lat, 'lat')
|
|
|
+ }}
|
|
|
</p>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
@@ -113,9 +161,12 @@
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="resetForm('ruleForm')" size="mini">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')" size="mini"
|
|
|
- :disabled="releaseTF"
|
|
|
- >{{ releaseTF ? "发布中..." : "确 定" }}</el-button
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('ruleForm')"
|
|
|
+ size="mini"
|
|
|
+ :disabled="releaseTF"
|
|
|
+ >{{ releaseTF ? '发布中...' : '确 定' }}</el-button
|
|
|
>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
@@ -163,7 +214,12 @@
|
|
|
>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="导入监测点" :visible.sync="downloadtf" width="500px" :close-on-click-modal="false">
|
|
|
+ <el-dialog
|
|
|
+ title="导入监测点"
|
|
|
+ :visible.sync="downloadtf"
|
|
|
+ width="500px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
<div class="downloadbox">
|
|
|
<div class="downloadbox_item">
|
|
|
<p class="title">导入监测点</p>
|
|
|
@@ -201,6 +257,7 @@
|
|
|
|
|
|
<script>
|
|
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
+import { pointTypeOptions } from '@/util/constants';
|
|
|
|
|
|
export default {
|
|
|
//import引入的组件需要注入到对象中才能使用
|
|
|
@@ -208,55 +265,61 @@ export default {
|
|
|
data() {
|
|
|
var checklnglat = (rule, value, callback) => {
|
|
|
if (isNaN(value)) {
|
|
|
- callback(new Error("请输入数字"));
|
|
|
+ callback(new Error('请输入数字'));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
//这里存放数据
|
|
|
return {
|
|
|
- monitorname: "", //搜索 监测点名称
|
|
|
+ point_type: '',
|
|
|
+ monitorname: '', //搜索 监测点名称
|
|
|
addtraptf: false, //添加框
|
|
|
loading: false, //加载框
|
|
|
page: 1, //页码
|
|
|
total: 10, //数据总条数,
|
|
|
tableData: [],
|
|
|
ruleForm: {
|
|
|
- point_name: "",
|
|
|
- lng: "",
|
|
|
- lat: "",
|
|
|
- messages: "",
|
|
|
+ point_name: '',
|
|
|
+ point_type: '',
|
|
|
+ lng: '',
|
|
|
+ lat: '',
|
|
|
+ messages: ''
|
|
|
},
|
|
|
rules: {
|
|
|
point_name: [
|
|
|
- { required: true, message: "请输入诱捕器名称", trigger: "blur" },
|
|
|
+ { required: true, message: '请输入诱捕器名称', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ point_type: [
|
|
|
+ { required: true, message: '请选择监测点类型', trigger: 'change' }
|
|
|
],
|
|
|
lng: [
|
|
|
- { required: true, message: "请输入经度", trigger: "blur" },
|
|
|
+ { required: true, message: '请输入经度', trigger: 'blur' }
|
|
|
// { validator: checklnglat, trigger: "blur" },
|
|
|
],
|
|
|
lat: [
|
|
|
- { required: true, message: "请输入纬度", trigger: "blur" },
|
|
|
+ { required: true, message: '请输入纬度', trigger: 'blur' }
|
|
|
// { validator: checklnglat, trigger: "blur" },
|
|
|
- ],
|
|
|
+ ]
|
|
|
// messages: [
|
|
|
// { required: true, message: "请输入监测点描述", trigger: "blur" },
|
|
|
// ],
|
|
|
},
|
|
|
- addtitle: "新增监测点",
|
|
|
- point_id: "",
|
|
|
+ addtitle: '新增监测点',
|
|
|
+ point_id: '',
|
|
|
//地图属性
|
|
|
addLocationDialogVisible: false,
|
|
|
locationForm: {
|
|
|
- lng: "",
|
|
|
- lat: "",
|
|
|
+ lng: '',
|
|
|
+ lat: ''
|
|
|
},
|
|
|
- addr: "", //搜索栏地址
|
|
|
- address: "", //地图上标签地址
|
|
|
+ addr: '', //搜索栏地址
|
|
|
+ address: '', //地图上标签地址
|
|
|
center: [114.05, 22.55],
|
|
|
- releaseTF:false,
|
|
|
- downloadinput:"",
|
|
|
- downloadtf:false
|
|
|
+ releaseTF: false,
|
|
|
+ downloadinput: '',
|
|
|
+ downloadtf: false,
|
|
|
+ pointTypeOptions
|
|
|
};
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
|
@@ -268,20 +331,21 @@ export default {
|
|
|
getmaintainlist() {
|
|
|
this.loading = true;
|
|
|
this.$axios({
|
|
|
- method: "POST",
|
|
|
- url: "/api/api_gateway?method=monitor_manage.maintain.checkpoint_list",
|
|
|
+ method: 'POST',
|
|
|
+ url: '/api/api_gateway?method=monitor_manage.maintain.checkpoint_list',
|
|
|
data: this.qs.stringify({
|
|
|
+ point_type: this.point_type,
|
|
|
page_item: 20,
|
|
|
page: this.page,
|
|
|
- point_name: this.monitorname, // 非必传(string) 诱剂名称 搜索项
|
|
|
- }),
|
|
|
- }).then((res) => {
|
|
|
+ point_name: this.monitorname // 非必传(string) 诱剂名称 搜索项
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
this.loading = false;
|
|
|
console.log(res.data.data);
|
|
|
this.total = res.data.data.total_item;
|
|
|
this.tableData = res.data.data.page_list;
|
|
|
for (var i = 0; i < this.tableData.length; i++) {
|
|
|
- this.tableData[i]["index"] = i + 1;
|
|
|
+ this.tableData[i]['index'] = i + 1;
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.gridTable.bodyWrapper.scrollTop = 0;
|
|
|
@@ -289,7 +353,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
search() {
|
|
|
- this.page = 1
|
|
|
+ this.page = 1;
|
|
|
this.getmaintainlist();
|
|
|
},
|
|
|
pageChange(e) {
|
|
|
@@ -300,84 +364,87 @@ export default {
|
|
|
},
|
|
|
submitForm(formName) {
|
|
|
console.log(this.ruleForm);
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
+ this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (this.addtitle == "新增监测点") {
|
|
|
- this.releaseTF = true
|
|
|
+ if (this.addtitle == '新增监测点') {
|
|
|
+ this.releaseTF = true;
|
|
|
this.$axios({
|
|
|
- method: "POST",
|
|
|
- url: "/api/api_gateway?method=monitor_manage.maintain.checkpoint_add",
|
|
|
+ method: 'POST',
|
|
|
+ url:
|
|
|
+ '/api/api_gateway?method=monitor_manage.maintain.checkpoint_add',
|
|
|
data: this.qs.stringify({
|
|
|
point_name: this.ruleForm.point_name, // 非必传(num) 诱捕器id 修改项
|
|
|
- lat: this.ToDegrees(this.ruleForm.lat,"lat"), // 必传(string) 纬度
|
|
|
- lng: this.ToDegrees(this.ruleForm.lng,"lng"), // 必传(string) 经度
|
|
|
+ lat: this.ToDegrees(this.ruleForm.lat, 'lat'), // 必传(string) 纬度
|
|
|
+ lng: this.ToDegrees(this.ruleForm.lng, 'lng'), // 必传(string) 经度
|
|
|
messages: this.ruleForm.messages,
|
|
|
- }),
|
|
|
- }).then((res) => {
|
|
|
+ point_type: this.ruleForm.point_type
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
console.log(res);
|
|
|
if (res.data.data) {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "添加成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '添加成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
}
|
|
|
this.addtraptf = false;
|
|
|
this.getmaintainlist();
|
|
|
} else {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "添加失败" + res.data.message,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '添加失败' + res.data.message,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- this.releaseTF = false
|
|
|
+ this.releaseTF = false;
|
|
|
});
|
|
|
- } else if (this.addtitle == "修改监测点") {
|
|
|
- this.releaseTF = true
|
|
|
+ } else if (this.addtitle == '修改监测点') {
|
|
|
+ this.releaseTF = true;
|
|
|
this.$axios({
|
|
|
- method: "POST",
|
|
|
- url: "/api/api_gateway?method=monitor_manage.maintain.checkpoint_modify",
|
|
|
+ method: 'POST',
|
|
|
+ url:
|
|
|
+ '/api/api_gateway?method=monitor_manage.maintain.checkpoint_modify',
|
|
|
data: this.qs.stringify({
|
|
|
point_id: this.point_id,
|
|
|
point_name: this.ruleForm.point_name, // 非必传(num) 诱捕器id 修改项
|
|
|
- lat: this.ToDegrees(this.ruleForm.lat,"lat"), // 必传(string) 纬度
|
|
|
- lng: this.ToDegrees(this.ruleForm.lng,"lng"), // 必传(string) 经度
|
|
|
- messages: this.ruleForm.messages,
|
|
|
- }),
|
|
|
- }).then((res) => {
|
|
|
+ lat: this.ToDegrees(this.ruleForm.lat, 'lat'), // 必传(string) 纬度
|
|
|
+ lng: this.ToDegrees(this.ruleForm.lng, 'lng'), // 必传(string) 经度
|
|
|
+ messages: this.ruleForm.messages
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
console.log(res);
|
|
|
if (res.data.data) {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "修改成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '修改成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
}
|
|
|
this.addtraptf = false;
|
|
|
this.getmaintainlist();
|
|
|
} else {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "修改失败" + res.data.message,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '修改失败' + res.data.message,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- this.releaseTF = false
|
|
|
+ this.releaseTF = false;
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- message: "请将信息填写完全",
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '请将信息填写完全',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
@@ -387,7 +454,7 @@ export default {
|
|
|
this.addtraptf = false;
|
|
|
this.$refs[formName].resetFields();
|
|
|
for (var key in this.ruleForm) {
|
|
|
- this.ruleForm[key] = "";
|
|
|
+ this.ruleForm[key] = '';
|
|
|
}
|
|
|
},
|
|
|
alter(data) {
|
|
|
@@ -396,73 +463,74 @@ export default {
|
|
|
this.ruleForm.lng = data.lng;
|
|
|
this.ruleForm.lat = data.lat;
|
|
|
this.ruleForm.messages = data.messages;
|
|
|
- this.addtitle = "修改监测点";
|
|
|
+ this.addtitle = '修改监测点';
|
|
|
this.addtraptf = true;
|
|
|
this.point_id = data.point_id;
|
|
|
},
|
|
|
deletemain(data) {
|
|
|
- var str = "您确定删除编号为<" + data.point_name + ">的监测点吗?";
|
|
|
- this.$confirm(str, "删除监测点", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- closeOnClickModal: false,
|
|
|
+ var str = '您确定删除编号为<' + data.point_name + '>的监测点吗?';
|
|
|
+ this.$confirm(str, '删除监测点', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ closeOnClickModal: false
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.$axios({
|
|
|
- method: "POST",
|
|
|
- url: "/api/api_gateway?method=monitor_manage.maintain.checkpoint_delete",
|
|
|
+ method: 'POST',
|
|
|
+ url:
|
|
|
+ '/api/api_gateway?method=monitor_manage.maintain.checkpoint_delete',
|
|
|
data: this.qs.stringify({
|
|
|
- point_id: data.point_id,
|
|
|
- }),
|
|
|
- }).then((res) => {
|
|
|
+ point_id: data.point_id
|
|
|
+ })
|
|
|
+ }).then(res => {
|
|
|
console.log(res);
|
|
|
if (res.data.data) {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "删除成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '删除成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
}
|
|
|
this.getmaintainlist();
|
|
|
} else {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- showClose: true,
|
|
|
- message: "删除失败," + res.data.message,
|
|
|
- type: "warning",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '删除失败,' + res.data.message,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message({
|
|
|
- type: "info",
|
|
|
- message: "已取消删除",
|
|
|
- });
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
init() {
|
|
|
- // console.log(document.getElementById("mapContainer2"));
|
|
|
- var map = new AMap.Map("mapContainer2", {
|
|
|
+ // console.log(document.getElementById("mapContainer2"));
|
|
|
+ var map = new AMap.Map('mapContainer2', {
|
|
|
center: this.center,
|
|
|
resizeEnable: true,
|
|
|
zoom: 10,
|
|
|
- lang: "en",
|
|
|
+ lang: 'en'
|
|
|
});
|
|
|
- AMap.plugin(["AMap.ToolBar", "AMap.Geocoder"], () => {
|
|
|
+ AMap.plugin(['AMap.ToolBar', 'AMap.Geocoder'], () => {
|
|
|
map.addControl(new AMap.ToolBar());
|
|
|
this.geocoder = new AMap.Geocoder({
|
|
|
- city: "全国",
|
|
|
- radius: 1000,
|
|
|
+ city: '全国',
|
|
|
+ radius: 1000
|
|
|
});
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
var marker = new AMap.Marker({
|
|
|
- position: this.center,
|
|
|
+ position: this.center
|
|
|
});
|
|
|
console.log(this.center);
|
|
|
marker.setMap(map);
|
|
|
@@ -474,45 +542,45 @@ export default {
|
|
|
//位置搜索
|
|
|
var marker = new AMap.Marker();
|
|
|
this.geocoder.getLocation(this.addr, (status, result) => {
|
|
|
- if (status === "complete" && result.geocodes.length) {
|
|
|
+ if (status === 'complete' && result.geocodes.length) {
|
|
|
var lnglat = result.geocodes[0].location;
|
|
|
marker.setPosition(lnglat);
|
|
|
this.map.add(marker);
|
|
|
this.map.setFitView(marker);
|
|
|
this.locationForm = {
|
|
|
lat: lnglat.lat,
|
|
|
- lng: lnglat.lng,
|
|
|
+ lng: lnglat.lng
|
|
|
};
|
|
|
} else {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message.error("根据地址查询位置失败");
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message.error('根据地址查询位置失败');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 地图点击事件
|
|
|
testevent() {
|
|
|
- this.map.on("click", (ev) => {
|
|
|
+ this.map.on('click', ev => {
|
|
|
var lnglat = [ev.lnglat.lng, ev.lnglat.lat];
|
|
|
this.locationForm = { lng: lnglat[0], lat: lnglat[1] };
|
|
|
this.map.clearMap();
|
|
|
var marker = new AMap.Marker({
|
|
|
- position: lnglat,
|
|
|
+ position: lnglat
|
|
|
});
|
|
|
marker.setMap(this.map);
|
|
|
this.getAddress(lnglat);
|
|
|
setTimeout(() => {
|
|
|
new AMap.InfoWindow({
|
|
|
- content: "<h5>" + "当前选中地址" + "</h5>" + this.address,
|
|
|
- offset: new AMap.Pixel(0, -32),
|
|
|
+ content: '<h5>' + '当前选中地址' + '</h5>' + this.address,
|
|
|
+ offset: new AMap.Pixel(0, -32)
|
|
|
}).open(this.map, lnglat);
|
|
|
}, 100);
|
|
|
});
|
|
|
},
|
|
|
getAddress(lnglat) {
|
|
|
- AMap.plugin("AMap.Geocoder", () => {
|
|
|
+ AMap.plugin('AMap.Geocoder', () => {
|
|
|
this.geocoder.getAddress(lnglat, (status, result) => {
|
|
|
- if (status === "complete" && result.info === "OK") {
|
|
|
+ if (status === 'complete' && result.info === 'OK') {
|
|
|
this.address = result.regeocode.formattedAddress;
|
|
|
}
|
|
|
});
|
|
|
@@ -534,32 +602,32 @@ export default {
|
|
|
if (this.locationForm.lat && this.locationForm.lng) {
|
|
|
let lnglat = [this.locationForm.lng, this.locationForm.lat];
|
|
|
var marker = new AMap.Marker({
|
|
|
- position: lnglat,
|
|
|
+ position: lnglat
|
|
|
});
|
|
|
marker.setMap(this.map);
|
|
|
} else {
|
|
|
- if (document.getElementsByClassName("el-message").length == 0) {
|
|
|
- this.$message.warning("请输入经纬度!");
|
|
|
+ if (document.getElementsByClassName('el-message').length == 0) {
|
|
|
+ this.$message.warning('请输入经纬度!');
|
|
|
}
|
|
|
// return fasle;
|
|
|
}
|
|
|
},
|
|
|
dingwei(data) {
|
|
|
- if (this.ruleForm.lng != "" && this.ruleForm.lng != 0) {
|
|
|
+ if (this.ruleForm.lng != '' && this.ruleForm.lng != 0) {
|
|
|
if (isNaN(this.ruleForm.lng)) {
|
|
|
this.center[0] = this.ToDigital(this.ruleForm.lng);
|
|
|
} else {
|
|
|
this.center[0] = this.ruleForm.lng;
|
|
|
}
|
|
|
}
|
|
|
- if (this.ruleForm.lat != "" && this.ruleForm.lat != 0) {
|
|
|
+ if (this.ruleForm.lat != '' && this.ruleForm.lat != 0) {
|
|
|
if (isNaN(this.ruleForm.lat)) {
|
|
|
this.center[1] = this.ToDigital(this.ruleForm.lat);
|
|
|
} else {
|
|
|
this.center[1] = this.ruleForm.lat;
|
|
|
}
|
|
|
}
|
|
|
- console.log(this.center)
|
|
|
+ console.log(this.center);
|
|
|
this.addLocationDialogVisible = true;
|
|
|
setTimeout(() => {
|
|
|
// console.log(this.center);
|
|
|
@@ -568,35 +636,35 @@ export default {
|
|
|
},
|
|
|
//度转度°分′秒″
|
|
|
ToDegrees(val, type) {
|
|
|
- if (typeof val == "undefined" || val == "" || isNaN(val)) {
|
|
|
+ if (typeof val == 'undefined' || val == '' || isNaN(val)) {
|
|
|
return val;
|
|
|
}
|
|
|
- val = val.toString()
|
|
|
- var A = "";
|
|
|
- if (type == "lng") {
|
|
|
- A = val > 0 ? "E" : "W";
|
|
|
- } else if (type == "lat") {
|
|
|
- A = val > 0 ? "N" : "S";
|
|
|
+ val = val.toString();
|
|
|
+ var A = '';
|
|
|
+ if (type == 'lng') {
|
|
|
+ A = val > 0 ? 'E' : 'W';
|
|
|
+ } else if (type == 'lat') {
|
|
|
+ A = val > 0 ? 'N' : 'S';
|
|
|
}
|
|
|
- var i = val.indexOf(".");
|
|
|
+ var i = val.indexOf('.');
|
|
|
var strDu = i < 0 ? val : val.substring(0, i); //获取度
|
|
|
var strFen = 0;
|
|
|
var strMiao = 0;
|
|
|
if (i > 0) {
|
|
|
- var strFen = "0" + val.substring(i);
|
|
|
- strFen = strFen * 60 + "";
|
|
|
- i = strFen.indexOf(".");
|
|
|
+ var strFen = '0' + val.substring(i);
|
|
|
+ strFen = strFen * 60 + '';
|
|
|
+ i = strFen.indexOf('.');
|
|
|
if (i > 0) {
|
|
|
- strMiao = "0" + strFen.substring(i);
|
|
|
+ strMiao = '0' + strFen.substring(i);
|
|
|
strFen = strFen.substring(0, i); //获取分
|
|
|
- strMiao = strMiao * 60 + "";
|
|
|
- i = strMiao.indexOf(".");
|
|
|
+ strMiao = strMiao * 60 + '';
|
|
|
+ i = strMiao.indexOf('.');
|
|
|
strMiao = strMiao.substring(0, i + 4); //取到小数点后面三位
|
|
|
strMiao = parseFloat(strMiao).toFixed(2); //精确小数点后面两位
|
|
|
}
|
|
|
}
|
|
|
// console.log(strDu, strFen, strMiao);
|
|
|
- return strDu + "°" + strFen + "′" + strMiao + "″" + A;
|
|
|
+ return strDu + '°' + strFen + '′' + strMiao + '″' + A;
|
|
|
},
|
|
|
//度°分′秒″转度
|
|
|
ToDigital(lnglat) {
|
|
|
@@ -605,26 +673,26 @@ export default {
|
|
|
}
|
|
|
console.log(lnglat);
|
|
|
var strDu, strFen, strMiao;
|
|
|
- var duindex = lnglat.indexOf("°"); //字符度的下标
|
|
|
- var fenindex = lnglat.indexOf("′"); //字符分的下标
|
|
|
- var miaoindex = lnglat.indexOf("″"); //字符秒的下标
|
|
|
+ var duindex = lnglat.indexOf('°'); //字符度的下标
|
|
|
+ var fenindex = lnglat.indexOf('′'); //字符分的下标
|
|
|
+ var miaoindex = lnglat.indexOf('″'); //字符秒的下标
|
|
|
strDu = lnglat.slice(0, duindex);
|
|
|
strFen = lnglat.slice(duindex + 1, fenindex);
|
|
|
strMiao = lnglat.slice(fenindex + 1, miaoindex);
|
|
|
// len = len > 6 || typeof len == "undefined" ? 6 : len; //精确到小数点后最多六位
|
|
|
strDu =
|
|
|
- typeof strDu == "undefined" || strDu == "" ? 0 : parseFloat(strDu);
|
|
|
+ typeof strDu == 'undefined' || strDu == '' ? 0 : parseFloat(strDu);
|
|
|
strFen =
|
|
|
- typeof strFen == "undefined" || strFen == ""
|
|
|
+ typeof strFen == 'undefined' || strFen == ''
|
|
|
? 0
|
|
|
: parseFloat(strFen) / 60;
|
|
|
strMiao =
|
|
|
- typeof strMiao == "undefined" || strMiao == ""
|
|
|
+ typeof strMiao == 'undefined' || strMiao == ''
|
|
|
? 0
|
|
|
: parseFloat(strMiao) / 3600;
|
|
|
var digital = strDu + strFen + strMiao;
|
|
|
if (digital == 0) {
|
|
|
- return "";
|
|
|
+ return '';
|
|
|
} else {
|
|
|
return digital.toFixed(6);
|
|
|
}
|
|
|
@@ -632,36 +700,34 @@ export default {
|
|
|
handle(ev) {
|
|
|
this.downloadinput = ev.name;
|
|
|
var datas = new FormData();
|
|
|
- datas.append("username", localStorage.getItem("username"));
|
|
|
- datas.append("file", ev.raw);
|
|
|
+ datas.append('username', localStorage.getItem('username'));
|
|
|
+ datas.append('file', ev.raw);
|
|
|
this.$axios({
|
|
|
- method: "POST",
|
|
|
- url: "/api/monitor_point_export",
|
|
|
+ method: 'POST',
|
|
|
+ url: '/api/monitor_point_export',
|
|
|
data: datas,
|
|
|
- responseType: "blob",
|
|
|
- }).then((res) => {
|
|
|
+ responseType: 'blob'
|
|
|
+ }).then(res => {
|
|
|
console.log(res);
|
|
|
- this.downloadFile(res, "allot_result.xls");
|
|
|
+ this.downloadFile(res, 'allot_result.xls');
|
|
|
});
|
|
|
},
|
|
|
download() {
|
|
|
//下载模板
|
|
|
- console.log(22222)
|
|
|
+ console.log(22222);
|
|
|
// http://192.168.1.17:12345
|
|
|
- window.location.href =
|
|
|
- this.$deriveData +
|
|
|
- "/api/monitor_point_export";
|
|
|
+ window.location.href = this.$deriveData + '/api/monitor_point_export';
|
|
|
},
|
|
|
downloadFile(res, name) {
|
|
|
- let link = document.createElement("a");
|
|
|
+ let link = document.createElement('a');
|
|
|
link.href = window.URL.createObjectURL(new Blob([res.data]));
|
|
|
- link.target = "_blank";
|
|
|
+ link.target = '_blank';
|
|
|
//文件名和格式
|
|
|
link.download = name;
|
|
|
document.body.appendChild(link);
|
|
|
link.click();
|
|
|
document.body.removeChild(link);
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
@@ -675,7 +741,7 @@ export default {
|
|
|
updated() {}, //生命周期 - 更新之后
|
|
|
beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
destroyed() {}, //生命周期 - 销毁完成
|
|
|
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+ activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
@@ -723,6 +789,7 @@ export default {
|
|
|
|
|
|
// 文本域样式更改
|
|
|
/deep/.el-textarea__inner {
|
|
|
- font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
|
|
|
+ font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
|
|
|
+ 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|