|
@@ -13,29 +13,103 @@
|
|
|
<el-button type="primary" @click="closeDialog">确定</el-button>
|
|
|
</el-dialog>
|
|
|
<el-dialog title="区域坐标" :visible.sync="showLongitudeq" @close='close' width="80%">
|
|
|
+ <div style="width: 100%; display: flex;">
|
|
|
+ <div style="width: 20%; float: left;">
|
|
|
+ <el-table ref="table" v-loading="loading" :data="tableData" style="width: 100%; max-height: 100%;overflow-y: auto;" v-if="sign===3" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column prop="flagType" label="区域序号" width="180"></el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div style="width: 80%; float: left;">
|
|
|
<Supermap ref="areaSupermap" style="width: 100%;height:75vh"
|
|
|
:mapDiv="uuid" :mapSite="{doubleClickZoom:false}" :codes="['9fa5']"
|
|
|
:isSideBySide="false" :showAreaLatLng="showAreaLatLng"></Supermap>
|
|
|
- <el-button type="primary" @click="closeDialog">确定</el-button>
|
|
|
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-button type="primary" @click="closeDialog">确定</el-button>
|
|
|
+ <el-button @click="clearAway">清除</el-button>
|
|
|
</el-dialog>
|
|
|
<el-dialog :title="(sign===1?'经纬度':(sign===2?'线坐标':'区域坐标'))" :visible.sync="visible" append-to-body
|
|
|
width="90%"
|
|
|
height="60%"
|
|
|
@close='close'>
|
|
|
- <supermap ref="supermap" style="width: 100%; height: 75vh" :putSmUserID_layer="putSmUserID_layer"
|
|
|
- @showLatLng="showLatLng"></supermap>
|
|
|
+ <div style="width: 100%; display: flex;">
|
|
|
+ <div style="width: 20%; float: left;">
|
|
|
+ <el-table ref="table" v-loading="loading" :data="tableData" height="100%" v-if="sign===3" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column prop="name" label="区域名称" width="180"></el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['farm:farmland:edit']"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div style="width: 80%; float: left;">
|
|
|
+ <supermap ref="supermap" style="width: 100%; height: 75vh;" :putSmUserID_layer="putSmUserID_layer" @showLatLng="showLatLng"></supermap>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<el-button type="primary" @click="closeDialog">确定</el-button>
|
|
|
- </el-dialog></div>
|
|
|
+ <el-button @click="clearAway">清除</el-button>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
+ <el-dialog :title="title" :visible.sync="visibleName" append-to-body width="400px">
|
|
|
+ <el-form ref="obj" :model="obj" :rules="rules" label-width="100px">
|
|
|
+ <el-form-item label="区域名称" prop="name">
|
|
|
+ <el-input v-model="obj.name" placeholder="请输入区域名称" maxlength="20"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+</div>
|
|
|
</template>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
import {getConfigKey} from "@/api/system/config";
|
|
|
+
|
|
|
+import {
|
|
|
+ delRegionalFlagByFlagType,
|
|
|
+ getRegionalFlag,
|
|
|
+ updateInfo,
|
|
|
+ updateRegionalFlag
|
|
|
+} from '@/api/data/digitalresources/info'
|
|
|
import request from '@/utils/request'
|
|
|
const uuidv4 = require("uuid/v4")
|
|
|
import supermap from '@/views/components/supermap-2.5d';
|
|
|
import Supermap from './supermap';
|
|
|
+import { delFarmland, getFarmland, updateFarmland } from '@/api/data/digitalresources/farmland'
|
|
|
export default {
|
|
|
name: "ISuperMapArearAndCameras",
|
|
|
components: {supermap, Supermap},
|
|
@@ -44,6 +118,13 @@ export default {
|
|
|
// },
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ eventId:null,
|
|
|
+ visibleName:false,
|
|
|
+ id:null,
|
|
|
+ arr:[],
|
|
|
+ tableData:[],
|
|
|
cameraMarkersList:[],
|
|
|
visuForestCloudCameraBOList:[],
|
|
|
visuForestCloudCameraBOListSearch:[],
|
|
@@ -58,9 +139,18 @@ export default {
|
|
|
longitude: undefined,
|
|
|
latitude: undefined,
|
|
|
xiantude: undefined,
|
|
|
+ name:undefined,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ name: [
|
|
|
+ {required: true, message: "区域名称不能为空", trigger: "change" }
|
|
|
+ ],
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.getRegionalFlag();
|
|
|
+ },
|
|
|
methods: {
|
|
|
putSmUserID_layer: function (entity) {
|
|
|
|
|
@@ -68,6 +158,25 @@ export default {
|
|
|
showAreaLatLng: function (latlng) {
|
|
|
this.obj.xiantude = JSON.stringify(latlng);
|
|
|
},
|
|
|
+
|
|
|
+ /** 区域标记按钮操作 */
|
|
|
+ getRegionalFlag() {
|
|
|
+ this.loading = true;
|
|
|
+ getRegionalFlag(this.eventId).then(response => {
|
|
|
+ this.tableData = response.data;
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //删除
|
|
|
+ handleDelete(row){
|
|
|
+ this.$modal.confirm('是否确认删除选中的数据项?').then(function () {
|
|
|
+ return delRegionalFlagByFlagType(row.eventId,row.flagType);
|
|
|
+ }).then(() => {
|
|
|
+ this.getRegionalFlag();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
showLatLng: function (val) {
|
|
|
if (this.sign === 1) {
|
|
|
this.obj.longitude = val.longitude;
|
|
@@ -81,12 +190,18 @@ export default {
|
|
|
this.obj.latitude = lat;
|
|
|
this.obj.longitude = lng;
|
|
|
},
|
|
|
- initP(sign, form) {
|
|
|
+ clearAway(){
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ this.$refs.supermap.clearAllByQin(this.sign)
|
|
|
+ this.obj.xiantude = null;
|
|
|
+ },
|
|
|
+ initP(sign, form,eventId) {
|
|
|
getConfigKey('supermapKey').then(response => {
|
|
|
let isN = response.msg;
|
|
|
if (isN === 'true') this.visible = true;
|
|
|
if (isN === 'false') sign === 2 ? this.showLongitudex = true : (sign === 1 ? this.showLongitude = true : this.showLongitudeq = true);
|
|
|
this.sign = sign;
|
|
|
+ this.eventId = eventId
|
|
|
this.uuid = uuidv4();
|
|
|
this.$nextTick(() => {
|
|
|
//2d 点
|
|
@@ -115,15 +230,12 @@ export default {
|
|
|
}
|
|
|
//2.5d 线/区域
|
|
|
if ((this.sign === 2 && this.visible === true) || (this.sign === 3 && this.visible === true)) {
|
|
|
- const arr = JSON.parse(form.xiantude == undefined || form.xiantude == null ? "[]" : form.xiantude);
|
|
|
- const array = [];
|
|
|
- for (let i = 0; i < arr.length; i++) {
|
|
|
- array.push(arr[i].lng);
|
|
|
- array.push(arr[i].lat);
|
|
|
- }
|
|
|
+ // const arr = JSON.parse(form.xiantude == undefined || form.xiantude == null ? "[]" : form.xiantude);
|
|
|
+ // console.log(arr)
|
|
|
+ this.getRegionalFlag();
|
|
|
setTimeout(() => {
|
|
|
this.$refs.supermap.superMapInfo(this.sign, {
|
|
|
- graphicsList: array && array.length > 0 ? array : [],
|
|
|
+ graphicsList: this.arr && this.arr.length > 0 ? this.arr : [],
|
|
|
color: "rgba(250,4,4,0)",
|
|
|
withAlpha: 0.8
|
|
|
});
|
|
@@ -138,10 +250,11 @@ export default {
|
|
|
}
|
|
|
//2d 区域
|
|
|
if (this.sign === 3 && this.showLongitudeq === true) {
|
|
|
- const arr = JSON.parse(form.xiantude);
|
|
|
+ this.getRegionalFlag();
|
|
|
+ // const arr = JSON.parse(form.xiantude);
|
|
|
setTimeout(() => {
|
|
|
this.$refs.areaSupermap.setGraphicsList(
|
|
|
- arr && arr.length > 0 ? arr : [],
|
|
|
+ this.arr && this.arr.length > 0 ? this.arr : [],
|
|
|
"#1a1919");
|
|
|
}, 2000)
|
|
|
}
|
|
@@ -149,13 +262,58 @@ export default {
|
|
|
)
|
|
|
})
|
|
|
},
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ if ((this.sign === 2 && this.visible === true) || (this.sign === 3 && this.visible === true)) {
|
|
|
+ this.$refs.supermap.entityHandler(1);
|
|
|
+ this.$refs.supermap.setGraphicsList1(selection, "rgba(250,4,4,0)", 0.8);
|
|
|
+ }
|
|
|
+ if (this.sign === 3 && this.showLongitudeq === true) {
|
|
|
+ this.$refs.supermap.setGraphicsList(selection, "#1a1919");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submitForm(){
|
|
|
+ this.$refs["obj"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.id) {
|
|
|
+ updateRegionalFlag(this.obj).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.getRegionalFlag();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$emit('send', this.obj);
|
|
|
+ }
|
|
|
|
|
|
+ this.visibleName = false;
|
|
|
+ this.clearAway();
|
|
|
+ // this.visible = false;
|
|
|
+ this.showLongitude = false;
|
|
|
+ this.showLongitudex = false;
|
|
|
+ this.showLongitudeq = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ cancel(){
|
|
|
+ this.obj.name = null;
|
|
|
+ this.visibleName = false;
|
|
|
+ this.clearAway();
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.obj.name=null,
|
|
|
+ this.resetForm("obj");
|
|
|
+ },
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ this.obj.eventId = this.eventId
|
|
|
+ this.obj.flagType = row.flagType
|
|
|
+ this.id = 1;//修改表标识
|
|
|
+ this.visibleName = true;
|
|
|
+ this.title = "修改区域标记";
|
|
|
+ },
|
|
|
closeDialog() {
|
|
|
- if (this.obj.longitude || (this.obj.xiantude && JSON.parse(this.obj.xiantude).length > 0)) this.$emit('send', this.obj);
|
|
|
- this.visible = false;
|
|
|
- this.showLongitude = false;
|
|
|
- this.showLongitudex = false;
|
|
|
- this.showLongitudeq = false;
|
|
|
+ this.reset();
|
|
|
+ this.id = null;
|
|
|
+ this.title = "添加区域标记";
|
|
|
+ if (this.obj.longitude || (this.obj.xiantude && JSON.parse(this.obj.xiantude).length > 0))this.visibleName = true;
|
|
|
},
|
|
|
closeDialogsend() {
|
|
|
this.$emit('send', 666);
|