2021-12-14 18:36:19 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="add-block">
|
|
|
|
|
|
<ai-detail>
|
|
|
|
|
|
<template #title>
|
|
|
|
|
|
<ai-title
|
2021-12-24 15:09:16 +08:00
|
|
|
|
:title="title"
|
|
|
|
|
|
:isShowBack="true"
|
|
|
|
|
|
:isShowBottomBorder="true"
|
|
|
|
|
|
@onBackClick="cancel(false)"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></ai-title>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #content>
|
2021-12-24 15:09:16 +08:00
|
|
|
|
<ai-card title="层级信息">
|
2021-12-14 18:36:19 +08:00
|
|
|
|
<template slot="content">
|
2021-12-24 15:09:16 +08:00
|
|
|
|
<ai-wrapper label-width="120px" :columnsNumber="2" style="margin-top: 16px">
|
2021-12-14 18:36:19 +08:00
|
|
|
|
<ai-info-item label="上级层级单位:"><span>{{ forms.parentGirdName }}</span></ai-info-item>
|
|
|
|
|
|
</ai-wrapper>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-card>
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
<el-form
|
2021-12-24 15:09:16 +08:00
|
|
|
|
ref="rules"
|
|
|
|
|
|
:model="forms"
|
|
|
|
|
|
:rules="formRules"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
label-suffix=":"
|
|
|
|
|
|
label-width="120px"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
2021-12-24 15:09:16 +08:00
|
|
|
|
<ai-card title="基础信息">
|
2021-12-14 18:36:19 +08:00
|
|
|
|
<template slot="content">
|
|
|
|
|
|
<div class="above">
|
|
|
|
|
|
<div class="left">
|
|
|
|
|
|
<el-form-item label="网格名称" prop="girdName">
|
|
|
|
|
|
<el-input
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.girdName"
|
|
|
|
|
|
placeholder="请输入…"
|
|
|
|
|
|
maxlength="10"
|
|
|
|
|
|
show-word-limit
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="网格类型" prop="girdType">
|
|
|
|
|
|
<el-select
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.girdType"
|
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
|
clearable
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-for="(item, i) in dict.getDict('girdType')"
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
:label="item.dictName"
|
|
|
|
|
|
:value="item.dictValue"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="是否最后一级" prop="isLastLevel">
|
|
|
|
|
|
<el-select
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.isLastLevel"
|
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
|
:disabled="isEdit"
|
|
|
|
|
|
clearable
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-for="(item, i) in dict.getDict('isLastLevel')"
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
:label="item.dictName"
|
|
|
|
|
|
:value="item.dictValue"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="right">
|
|
|
|
|
|
<el-form-item label="网格编码" prop="girdCode">
|
|
|
|
|
|
<el-input
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.girdCode"
|
|
|
|
|
|
placeholder="请输入…"
|
|
|
|
|
|
maxlength="30"
|
|
|
|
|
|
show-word-limit
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="网格层级" prop="girdLevel">
|
|
|
|
|
|
<el-select
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.girdLevel"
|
|
|
|
|
|
placeholder="请选择"
|
|
|
|
|
|
:disabled="isEdit"
|
|
|
|
|
|
clearable
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-option
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-for="(item, i) in dict.getDict('girdLevel')"
|
|
|
|
|
|
:key="i"
|
|
|
|
|
|
:label="item.dictName"
|
|
|
|
|
|
:value="item.dictValue"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-option>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-card>
|
|
|
|
|
|
|
2021-12-24 15:09:16 +08:00
|
|
|
|
<ai-card title="其他信息">
|
2021-12-14 18:36:19 +08:00
|
|
|
|
<template slot="content">
|
|
|
|
|
|
<div class="above">
|
|
|
|
|
|
<div class="left">
|
|
|
|
|
|
<!-- <el-form-item label="事件上报主体" prop="eventReportUnitId">
|
|
|
|
|
|
<el-cascader
|
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
|
:options="unitOps"
|
|
|
|
|
|
ref="cascader"
|
|
|
|
|
|
v-model="forms.eventReportUnitId"
|
|
|
|
|
|
:props="unitProps"
|
|
|
|
|
|
:show-all-levels="false"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-form-item> -->
|
|
|
|
|
|
<el-form-item label="初始日期" prop="startDate">
|
|
|
|
|
|
<el-date-picker
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.startDate"
|
|
|
|
|
|
type="date"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
|
placeholder="选择日期"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="终止日期" prop="endDate">
|
|
|
|
|
|
<el-date-picker
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.endDate"
|
|
|
|
|
|
type="date"
|
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
|
placeholder="选择日期"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
</el-date-picker>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="right">
|
|
|
|
|
|
<el-form-item label="面积" prop="area">
|
|
|
|
|
|
<el-input
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="forms.area"
|
|
|
|
|
|
placeholder="面积㎡"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-form-item label="网格地址" prop="address">
|
|
|
|
|
|
<el-input v-model="forms.address" placeholder="限200字" maxlength="200"></el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="网格范围" prop="enclosure">
|
|
|
|
|
|
<el-button size="small" @click="showMap = true">地图标绘</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</template>
|
2021-12-24 15:09:16 +08:00
|
|
|
|
</ai-card>
|
2021-12-14 18:36:19 +08:00
|
|
|
|
</el-form>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<el-button @click="cancel(false)" class="delete-btn footer-btn">
|
|
|
|
|
|
取 消
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
<el-button type="primary" @click="save()" class="footer-btn">
|
|
|
|
|
|
提 交
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</ai-detail>
|
|
|
|
|
|
<ai-dialog
|
2021-12-24 15:09:16 +08:00
|
|
|
|
title="网格范围"
|
|
|
|
|
|
:visible.sync="showMap"
|
|
|
|
|
|
:customFooter="true"
|
|
|
|
|
|
:destroyOnClose="true"
|
|
|
|
|
|
@opened="beforeSelectMap"
|
|
|
|
|
|
border
|
|
|
|
|
|
width="850px"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<div class="map">
|
|
|
|
|
|
<div class="tipinput">
|
|
|
|
|
|
<el-input
|
2021-12-24 15:09:16 +08:00
|
|
|
|
v-model="searchAddress"
|
|
|
|
|
|
@change="addressChange"
|
|
|
|
|
|
clearable
|
|
|
|
|
|
placeholder="请输入关键字"
|
|
|
|
|
|
id="tipinput"
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
style="width: 200px"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
></el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="panel"></div>
|
|
|
|
|
|
<div class="container" id="container"></div>
|
|
|
|
|
|
<el-button-group
|
2021-12-24 15:09:16 +08:00
|
|
|
|
style="margin-top: 8px"
|
|
|
|
|
|
v-if="forms.plottingStatus == 1"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-button type="primary" size="mini" @click="polyEditor.open()"
|
2021-12-24 15:09:16 +08:00
|
|
|
|
>开始编辑
|
|
|
|
|
|
</el-button
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-button size="mini" @click="polyEditor.close()"
|
2021-12-24 15:09:16 +08:00
|
|
|
|
>结束编辑
|
|
|
|
|
|
</el-button
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
</el-button-group>
|
|
|
|
|
|
<el-button-group
|
2021-12-24 15:09:16 +08:00
|
|
|
|
style="margin-top: 8px"
|
|
|
|
|
|
v-if="forms.plottingStatus == 0"
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<el-button size="mini" @click="draw('polygon')"
|
2021-12-24 15:09:16 +08:00
|
|
|
|
>开始绘制多边形
|
|
|
|
|
|
</el-button
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
<!-- <el-button size="mini" @click="close()">关闭绘制</el-button> -->
|
|
|
|
|
|
<el-button size="mini" @click="clear()">清除绘制</el-button>
|
|
|
|
|
|
</el-button-group>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="dialog-footer" slot="footer">
|
|
|
|
|
|
<el-button size="medium" @click="showMap = false">取消</el-button>
|
|
|
|
|
|
<el-button type="primary" size="medium" @click="surePotting()"
|
2021-12-24 15:09:16 +08:00
|
|
|
|
>确认
|
|
|
|
|
|
</el-button
|
2021-12-14 18:36:19 +08:00
|
|
|
|
>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</ai-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import AMapLoader from "@amap/amap-jsapi-loader";
|
2021-12-24 15:09:16 +08:00
|
|
|
|
import {mapState} from "vuex";
|
|
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: "addBlock",
|
|
|
|
|
|
props: {
|
|
|
|
|
|
instance: Function,
|
|
|
|
|
|
dict: Object,
|
|
|
|
|
|
params: Object,
|
|
|
|
|
|
isEdit: Boolean
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
forms: {
|
|
|
|
|
|
address: "",
|
|
|
|
|
|
area: "",
|
|
|
|
|
|
points: [],
|
|
|
|
|
|
endDate: "",
|
|
|
|
|
|
eventReportUnit: "",
|
|
|
|
|
|
eventReportUnitId: "",
|
|
|
|
|
|
girdCode: "",
|
|
|
|
|
|
girdLevel: "",
|
|
|
|
|
|
girdList: [],
|
|
|
|
|
|
girdName: "",
|
|
|
|
|
|
girdType: "",
|
|
|
|
|
|
isLastLevel: "",
|
|
|
|
|
|
parentGirdId: "",
|
|
|
|
|
|
parentGirdName: "",
|
|
|
|
|
|
startDate: "",
|
|
|
|
|
|
plottingStatus: "0",
|
|
|
|
|
|
},
|
|
|
|
|
|
showMap: false,
|
|
|
|
|
|
map: "",
|
|
|
|
|
|
mouseTool: "",
|
|
|
|
|
|
searchAddress: "",
|
|
|
|
|
|
placeSearch: "",
|
|
|
|
|
|
overlays: [],
|
|
|
|
|
|
options: [],
|
|
|
|
|
|
path: [],
|
|
|
|
|
|
polyEditor: "",
|
|
|
|
|
|
title: "添加网格区块",
|
|
|
|
|
|
parentGirdInfo: {},
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
...mapState(["user"]),
|
|
|
|
|
|
formRules() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
girdName: [
|
2021-12-24 15:09:16 +08:00
|
|
|
|
{required: true, message: "请填写网格名称", trigger: "change"},
|
2021-12-14 18:36:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
girdCode: [
|
2021-12-24 15:09:16 +08:00
|
|
|
|
{required: true, message: "请填写网格编码", trigger: "change"},
|
2021-12-14 18:36:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
girdType: [
|
2021-12-24 15:09:16 +08:00
|
|
|
|
{required: true, message: "请选择网格类型", trigger: "change"},
|
2021-12-14 18:36:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
isLastLevel: [
|
2021-12-24 15:09:16 +08:00
|
|
|
|
{required: true, message: "请选择是否最后一级", trigger: "change"},
|
2021-12-14 18:36:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
girdLevel: [
|
2021-12-24 15:09:16 +08:00
|
|
|
|
{required: true, message: "请选择网格层级", trigger: "change"},
|
2021-12-14 18:36:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
eventReportUnitId: [
|
2021-12-24 15:09:16 +08:00
|
|
|
|
{required: true, message: "请选择事件上报主体", trigger: "change"},
|
2021-12-14 18:36:19 +08:00
|
|
|
|
],
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
unitProps() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: "id",
|
|
|
|
|
|
checkStrictly: true,
|
|
|
|
|
|
emitPath: false,
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
unitOps() {
|
|
|
|
|
|
let initData = JSON.parse(JSON.stringify(this.options)),
|
2021-12-24 15:09:16 +08:00
|
|
|
|
ops = initData.filter((e) => !e.parentId);
|
2021-12-14 18:36:19 +08:00
|
|
|
|
ops.map((e) => this.addChild(e, initData));
|
|
|
|
|
|
return ops;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
if (this.isEdit) {
|
|
|
|
|
|
this.title = "编辑网格区块";
|
|
|
|
|
|
this.searchDetail();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.forms.parentGirdId = this.params.id;
|
|
|
|
|
|
this.forms.parentGirdName = this.params.girdName;
|
|
|
|
|
|
// this.forms.girdLevel = Number(this.info.girdLevel) + 1 +'';
|
|
|
|
|
|
// this.forms.isLastLevel = ['0','1'].includes(this.forms.girdLevel)?'0':'1';
|
|
|
|
|
|
this.title = "添加网格区块";
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
// this.getAllUnit(this.user.info.areaId);
|
2021-12-14 18:36:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2021-12-24 15:09:16 +08:00
|
|
|
|
cancel(isRefresh) {
|
2021-12-14 18:36:19 +08:00
|
|
|
|
this.$emit('change', {
|
|
|
|
|
|
type: 'list',
|
2021-12-24 15:09:16 +08:00
|
|
|
|
isRefresh: !!isRefresh,
|
2021-12-14 18:36:19 +08:00
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取所有单位
|
|
|
|
|
|
getAllUnit(data) {
|
|
|
|
|
|
this.options = [];
|
2021-12-24 15:09:16 +08:00
|
|
|
|
this.instance.post("/admin/sysunit/getAll", null, {
|
|
|
|
|
|
params: {areaId: data},
|
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
if (res?.data) {
|
2021-12-14 18:36:19 +08:00
|
|
|
|
res.data = res.data.map((a) => {
|
2021-12-24 15:09:16 +08:00
|
|
|
|
return {...a, label: a.name}
|
2021-12-14 18:36:19 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.options = res.data.filter((e) => !e.parentId);
|
|
|
|
|
|
this.options.map((t) => this.addChild(t, res.data));
|
2021-12-24 15:09:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2021-12-14 18:36:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
beforeSelectMap() {
|
|
|
|
|
|
AMapLoader.load({
|
|
|
|
|
|
key: "b553334ba34f7ac3cd09df9bc8b539dc", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
|
|
|
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
|
|
|
plugins: ["AMap.MouseTool", "AMap.PlaceSearch", "AMap.PolygonEditor"], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
|
|
|
|
AMapUI: {
|
|
|
|
|
|
// 是否加载 AMapUI,缺省不加载
|
|
|
|
|
|
version: "1.1", // AMapUI 缺省 1.1
|
|
|
|
|
|
plugins: [], // 需要加载的 AMapUI ui插件
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
2021-12-24 15:09:16 +08:00
|
|
|
|
.then((AMap) => {
|
|
|
|
|
|
this.map = new AMap.Map("container", {
|
|
|
|
|
|
resizeEnable: true,
|
2021-12-14 18:36:19 +08:00
|
|
|
|
});
|
2021-12-24 15:09:16 +08:00
|
|
|
|
if (this.forms.plottingStatus == 1) {
|
|
|
|
|
|
let path = [];
|
|
|
|
|
|
this.forms.points.map((e, index) => {
|
|
|
|
|
|
path[index] = [e.lng, e.lat];
|
|
|
|
|
|
});
|
|
|
|
|
|
let polygon = new AMap.Polygon({
|
|
|
|
|
|
path: path,
|
|
|
|
|
|
strokeColor: "#FF33FF",
|
|
|
|
|
|
strokeWeight: 6,
|
|
|
|
|
|
strokeOpacity: 0.2,
|
|
|
|
|
|
fillOpacity: 0.4,
|
|
|
|
|
|
fillColor: "#1791fc",
|
|
|
|
|
|
zIndex: 50,
|
|
|
|
|
|
bubble: true,
|
|
|
|
|
|
});
|
|
|
|
|
|
this.map.add([polygon]);
|
|
|
|
|
|
this.map.setFitView();
|
|
|
|
|
|
this.polyEditor = new AMap.PolygonEditor(this.map, polygon);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.mouseTool = new AMap.MouseTool(this.map);
|
|
|
|
|
|
// this.map.add(new AMap.Marker({
|
|
|
|
|
|
// position:this.map.getCenter()
|
|
|
|
|
|
// }));
|
|
|
|
|
|
this.placeSearch = new AMap.PlaceSearch({
|
|
|
|
|
|
pageSize: 3, // 单页显示结果条数
|
|
|
|
|
|
pageIndex: 1, // 页码
|
|
|
|
|
|
city: "", // 兴趣点城市
|
|
|
|
|
|
citylimit: false, //是否强制限制在设置的城市内搜索
|
|
|
|
|
|
map: this.map, // 展现结果的地图实例
|
|
|
|
|
|
panel: "panel", // 结果列表将在此容器中进行展示。
|
|
|
|
|
|
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
|
|
|
|
|
|
});
|
|
|
|
|
|
this.map.setZoomAndCenter(14, [117.147097, 36.72081], false, 600);
|
|
|
|
|
|
this.eventOn();
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
|
console.log(e);
|
|
|
|
|
|
});
|
2021-12-14 18:36:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
//地图事件绑定
|
|
|
|
|
|
eventOn() {
|
|
|
|
|
|
this.path = [];
|
|
|
|
|
|
this.overlays = [];
|
2021-12-24 15:09:16 +08:00
|
|
|
|
this.map.on("mousemove", null, this);
|
|
|
|
|
|
this.mouseTool.on("draw", ({obj}) => {
|
2021-12-14 18:36:19 +08:00
|
|
|
|
obj.getPath().map((e) => {
|
2021-12-24 15:09:16 +08:00
|
|
|
|
this.path.push({lat: e.getLat(), lng: e.getLng()});
|
2021-12-14 18:36:19 +08:00
|
|
|
|
});
|
|
|
|
|
|
this.overlays.push(obj);
|
2021-12-24 15:09:16 +08:00
|
|
|
|
})
|
2021-12-14 18:36:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
//map搜索
|
|
|
|
|
|
addressChange(val) {
|
|
|
|
|
|
this.placeSearch.search(val);
|
|
|
|
|
|
},
|
|
|
|
|
|
close() {
|
|
|
|
|
|
this.mouseTool.close(true);
|
|
|
|
|
|
},
|
|
|
|
|
|
clear() {
|
|
|
|
|
|
this.map.remove(this.overlays);
|
|
|
|
|
|
this.overlays = [];
|
|
|
|
|
|
this.path = [];
|
|
|
|
|
|
},
|
|
|
|
|
|
draw(type) {
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
|
case "marker": {
|
|
|
|
|
|
this.mouseTool.marker({
|
|
|
|
|
|
//同Marker的Option设置
|
|
|
|
|
|
});
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case "polyline": {
|
|
|
|
|
|
this.mouseTool.polyline({
|
|
|
|
|
|
strokeColor: "#80d8ff",
|
|
|
|
|
|
//同Polyline的Option设置
|
|
|
|
|
|
});
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case "polygon": {
|
|
|
|
|
|
this.mouseTool.polygon({
|
|
|
|
|
|
fillColor: "#00b0ff",
|
|
|
|
|
|
strokeColor: "#80d8ff",
|
|
|
|
|
|
borderWeight: 2,
|
|
|
|
|
|
strokeWeight: 4,
|
|
|
|
|
|
//同Polygon的Option设置
|
|
|
|
|
|
});
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case "rectangle": {
|
|
|
|
|
|
this.mouseTool.rectangle({
|
|
|
|
|
|
fillColor: "#00b0ff",
|
|
|
|
|
|
strokeColor: "#80d8ff",
|
|
|
|
|
|
//同Polygon的Option设置
|
|
|
|
|
|
});
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
case "circle": {
|
|
|
|
|
|
this.mouseTool.circle({
|
|
|
|
|
|
fillColor: "#00b0ff",
|
|
|
|
|
|
strokeColor: "#80d8ff",
|
|
|
|
|
|
//同Circle的Option设置
|
|
|
|
|
|
});
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
surePotting() {
|
|
|
|
|
|
this.forms.points = [];
|
|
|
|
|
|
// this.forms.eventReportUnit = this.$refs.cascader.getCheckedNodes().label;
|
|
|
|
|
|
if (this.forms.plottingStatus == 1) {
|
|
|
|
|
|
this.polyEditor
|
2021-12-24 15:09:16 +08:00
|
|
|
|
.getTarget()
|
|
|
|
|
|
.getPath()
|
|
|
|
|
|
.map((e) => {
|
|
|
|
|
|
this.forms.points.push({lng: e.lng, lat: e.lat});
|
|
|
|
|
|
});
|
2021-12-14 18:36:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.forms.points = [...this.path];
|
|
|
|
|
|
}
|
|
|
|
|
|
this.showMap = false;
|
|
|
|
|
|
},
|
|
|
|
|
|
save() {
|
|
|
|
|
|
this.$refs["rules"].validate((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.instance
|
2021-12-24 15:09:16 +08:00
|
|
|
|
.post(
|
2021-12-14 18:36:19 +08:00
|
|
|
|
`/app/appgirdinfo/addOrUpdate`,
|
|
|
|
|
|
{
|
|
|
|
|
|
...this.forms,
|
|
|
|
|
|
},
|
|
|
|
|
|
null
|
2021-12-24 15:09:16 +08:00
|
|
|
|
)
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
this.cancel(true)
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2021-12-14 18:36:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
console.log("error submit!!");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
searchDetail() {
|
2021-12-24 15:09:16 +08:00
|
|
|
|
this.instance.post(`/app/appgirdinfo/queryDetailById`, null, {
|
|
|
|
|
|
params: {id: this.params.id},
|
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
if (res?.data) {
|
|
|
|
|
|
this.forms = {...res.data};
|
|
|
|
|
|
this.parentGirdInfo = this.forms.parentGirdInfo;
|
|
|
|
|
|
this.forms.parentGirdName = this.parentGirdInfo.girdName;
|
|
|
|
|
|
// this.forms.isLastLevel =this.forms.girdLevel;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2021-12-14 18:36:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.add-block {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.above {
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
padding: 8px 0;
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.left {
|
|
|
|
|
|
width: 380px;
|
|
|
|
|
|
float: left;
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.right {
|
|
|
|
|
|
width: 380px;
|
|
|
|
|
|
float: right;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.footer-btn {
|
|
|
|
|
|
width: 92px;
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.map {
|
|
|
|
|
|
width: 780px;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
overflow: hidden;
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.container {
|
|
|
|
|
|
width: 760px;
|
|
|
|
|
|
height: 420px;
|
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
|
border: 1px solid #d0d4dc;
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
#panel {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
height: 400px;
|
|
|
|
|
|
right: 30px;
|
|
|
|
|
|
top: 20px;
|
|
|
|
|
|
width: 280px;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
z-index: 10000;
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
|
2021-12-14 18:36:19 +08:00
|
|
|
|
.tipinput {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
width: 200px;
|
|
|
|
|
|
height: 38px;
|
|
|
|
|
|
left: 20px;
|
|
|
|
|
|
top: 20px;
|
|
|
|
|
|
z-index: 10000;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-12-24 15:09:16 +08:00
|
|
|
|
</style>
|