Browse Source

小区查看

jly/task002
tianqian 2 years ago
parent
commit
08efe541e8
  1. 508
      src/views/modules/base/communityYantai/communityDetail.vue
  2. 886
      src/views/modules/base/communityYantai/communityForm.vue

508
src/views/modules/base/communityYantai/communityDetail.vue

@ -1,263 +1,253 @@
<template> <template>
<div> <div>
<div class="dialog-h-content scroll-h"> <div class="dialog-h-content scroll-h">
<div v-if="initLoading" class="m-row">
<div v-if="initLoading" <div class="m-info">
class="m-row"> <div class="info-prop">
<div class="m-info"> <span class="info-title-2">所属组织</span>
<div class="info-prop"> <span>{{ dataForm.agencyName }}</span>
<span class="info-title-2">所属组织</span> </div>
<span>{{ dataForm.agencyName }}</span> <div class="info-prop">
</div> <span class="info-title-2">所属网格</span>
<span>{{ dataForm.gridName?dataForm.gridName:'--' }}</span>
<div class="info-prop"> </div>
<span class="info-title-2">所属网格</span> <div class="info-prop">
<span>{{ dataForm.gridName?dataForm.gridName:'--' }}</span> <span class="info-title-2">小区/自然村名称</span>
</div> <span>{{ dataForm.neighborHoodName?dataForm.neighborHoodName:'--' }}</span>
</div>
<div class="info-prop"> <div class="info-prop">
<span class="info-title-2">小区名称</span> <span class="info-title-2">小区/自然村类型</span>
<span>{{ dataForm.neighborHoodName}}</span> <span>{{ dataForm.viliageType?dataForm.viliageType:'--' }}</span>
</div> </div>
<div class="info-prop">
<div class="info-prop"> <span class="info-title-2">小区编码</span>
<span class="info-title-2">小区编码</span> <span>{{ dataForm.coding?dataForm.coding:'--'}}</span>
<span>{{ dataForm.coding?dataForm.coding:'--'}}</span> </div>
</div> <div class="info-prop">
<span class="info-title-2">面积</span>
<div v-if="dataForm.qrcodeUrl" <span>{{ dataForm.area?dataForm.area:'--'}}</span>
style="display: flex;flex-direction: column;"> </div>
<img style="margin-left: 70px;width: 200px;" <div class="info-prop">
:src="dataForm.qrcodeUrl"> <span class="info-title-2">开放类型</span>
<a style="margin-left: 80px" <span>{{ dataForm.openType?dataForm.openType:'--'}}</span>
:href="dataForm.qrcodeUrl" </div>
target="_blank">下载</a> <div class="info-prop">
</div> <span class="info-title-2">建筑年代</span>
<span>{{ dataForm.buildYear?dataForm.buildYear:'--'}}</span>
<div class="info-prop"> </div>
<span class="info-title-2">关联物业</span> <div v-if="dataForm.qrcodeUrl" style="display: flex;flex-direction: column;">
<span>{{ dataForm.propertyShow?dataForm.propertyShow:'--'}}</span> <img style="margin-left: 70px;width: 200px;" :src="dataForm.qrcodeUrl">
</div> <a style="margin-left: 80px" :href="dataForm.qrcodeUrl" target="_blank">下载</a>
<div class="info-prop"> </div>
<span class="info-title-2">实有楼栋</span> <div class="info-prop">
<span>{{dataForm.realBuilding?dataForm.realBuilding:0 }}</span> <span class="info-title-2">关联物业</span>
</div> <span>{{ dataForm.propertyShow?dataForm.propertyShow:'--'}}</span>
</div>
<div class="info-prop"> <div class="info-prop">
<span class="info-title-2">详细地址</span> <span class="info-title-2">实有楼栋</span>
<span>{{ dataForm.address }}</span> <span>{{dataForm.realBuilding?dataForm.realBuilding:0 }}</span>
</div> </div>
<div class="info-prop">
<div class="info-prop"> <span class="info-title-2">详细地址</span>
<span class="info-title-2">地图位置</span> <span>{{ dataForm.address }}</span>
<div class="div_map"> </div>
<div class="info-prop">
<div id="app_detail_community"></div> <span class="info-title-2">地图位置</span>
<div class="div_map">
</div> <div id="app_detail_community"></div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div>
</div> <div class="div-btn">
<div class="div-btn"> <el-button size="small" @click="handleCancle"> </el-button>
<el-button size="small" </div>
@click="handleCancle"> </el-button> </div>
</div>
</div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import {
import { Loading } from 'element-ui' // Loading mapGetters
import { requestPost } from '@/js/dai/request' } from 'vuex'
import daiMap from "@/utils/dai-map"; import {
var map Loading
var search } from 'element-ui' // Loading
var markers import {
var infoWindowList requestPost
let loading // } from '@/js/dai/request'
export default { import daiMap from "@/utils/dai-map";
data () { var map
return { var search
var markers
btnDisable: false, var infoWindowList
initLoading: false, let loading //
export default {
dataForm: { data() {
neighborHoodName: '', // 50 return {
agencyId: '', // ID btnDisable: false,
agencyName: '', initLoading: false,
gridId: '', //ID dataForm: {
propertyId: '', // neighborHoodName: '', // 50
address: '', // agencyId: '', // ID
remark: '', //500 agencyName: '',
location: '', // gridId: '', //ID
longitude: '', // propertyId: '', //
latitude: '', // address: '', //
realBuilding: 0, remark: '', //500
coding: '', location: '', //
sysCoding: '' longitude: '', //
}, latitude: '', //
realBuilding: 0,
coding: '',
} sysCoding: ''
}, },
components: {}, }
mounted () { },
components: {},
}, mounted() {},
methods: {
methods: { handleCancle() {
handleCancle () { this.diaDestroy()
this.diaDestroy() this.$emit('diaDetailClose')
this.$emit('diaDetailClose') },
diaDestroy() {
}, if (map) {
diaDestroy () { // map.destroy()
if (map) { }
// map.destroy() },
} async initForm(row) {
}, this.dataForm = JSON.parse(JSON.stringify(row))
let propertyShowList = []
async initForm (row) { this.dataForm.propertyList.forEach(element => {
this.dataForm = JSON.parse(JSON.stringify(row)) propertyShowList.push(element.name)
});
let propertyShowList = [] this.dataForm.propertyShow = propertyShowList.join(',')
this.dataForm.propertyList.forEach(element => { this.initLoading = true
propertyShowList.push(element.name) let {
}); latitude,
longitude
this.dataForm.propertyShow = propertyShowList.join(',') } = this.$store.state.user;
console.log('lat' + latitude + ',lon' + longitude)
this.initLoading = true if (this.dataForm.latitude && this.dataForm.longitude) {
let { latitude, longitude } = this.$store.state.user; latitude = this.dataForm.latitude
console.log('lat' + latitude + ',lon' + longitude) longitude = this.dataForm.longitude
if (this.dataForm.latitude && this.dataForm.longitude) { }
latitude = this.dataForm.latitude if (!latitude || latitude == "" || latitude == "0") {
longitude = this.dataForm.longitude latitude = 39.9088810666821;
} longitude = 116.39743841556731;
if (!latitude || latitude == "" || latitude == "0") { }
latitude = 39.9088810666821; this.$nextTick(() => {
longitude = 116.39743841556731; if (!map) {
} this.initMap(latitude, longitude)
} else {
this.$nextTick(() => { map.setCenter(latitude, longitude);
if (!map) { map.setMarker(latitude, longitude);
this.initMap(latitude, longitude) }
} else { })
map.setCenter(latitude, longitude); },
map.setMarker(latitude, longitude); // init
} initMap(latitude, longitude) {
map = new daiMap(document.getElementById("app_detail_community"), {
}) latitude,
longitude
}, }, {
zoom: 16.2, //
// init pitch: 43.5, //
initMap (latitude, longitude) { rotation: 45, //
});
map = new daiMap( // //
document.getElementById("app_detail_community"), // map.on("dragend", (e) => {
{ latitude, longitude }, // this.handleMoveCenter(e);
{ // });
zoom: 16.2, // map.setCenter(latitude, longitude);
pitch: 43.5, // map.setMarker(latitude, longitude);
rotation: 45, // },
} resetData() {
); this.dataForm = {
neighborHoodName: '', // 50
// // agencyId: '', // ID
// map.on("dragend", (e) => { agencyName: '',
// this.handleMoveCenter(e); gridId: '', //ID
// }); propertyId: '', //
address: '', //
map.setCenter(latitude, longitude); remark: '', //500
map.setMarker(latitude, longitude); location: '', //
longitude: '', //
}, latitude: '', //
realBuilding: 0,
coding: '',
sysCoding: ''
resetData () { }
},
this.dataForm = { //
neighborHoodName: '', // 50 startLoading() {
agencyId: '', // ID loading = Loading.service({
agencyName: '', lock: true, //
gridId: '', //ID text: '正在加载……', //
propertyId: '', // background: 'rgba(0,0,0,.7)' //
address: '', // })
remark: '', //500 },
location: '', // //
longitude: '', // endLoading() {
latitude: '', // // clearTimeout(timer);
realBuilding: 0, if (loading) {
coding: '', loading.close()
sysCoding: '' }
} }
},
}, computed: {
// dataRule() {
startLoading () { return {
loading = Loading.service({ neighborHoodName: [{
lock: true, // required: true,
text: '正在加载……', // message: '小区名称不能为空',
background: 'rgba(0,0,0,.7)' // trigger: 'blur'
}) }, {
}, min: 1,
// max: 50,
endLoading () { message: '小区名称长度在 1 到 50个字符',
// clearTimeout(timer); trigger: 'blur'
if (loading) { }],
loading.close() agencyId: [{
} required: true,
} message: '所属组织不能为空',
}, trigger: 'blur'
computed: { }],
dataRule () { gridId: [{
return { required: true,
neighborHoodName: [ message: '所属网格不能为空',
{ required: true, message: '小区名称不能为空', trigger: 'blur' }, trigger: 'blur'
{ }],
min: 1, coding: [{
max: 50, required: true,
message: '小区名称长度在 1 到 50个字符', message: '小区编码不能为空',
trigger: 'blur' trigger: 'blur'
} }],
], address: [{
agencyId: [ required: true,
{ required: true, message: '所属组织不能为空', trigger: 'blur' } message: '详细地址不能为空',
], trigger: 'blur'
gridId: [ }],
{ required: true, message: '所属网格不能为空', trigger: 'blur' } longitude: [{
], required: true,
coding: [ message: '坐标不能为空',
{ required: true, message: '小区编码不能为空', trigger: 'blur' } trigger: 'blur'
], }]
address: [ }
{ required: true, message: '详细地址不能为空', trigger: 'blur' } },
], propertyRule() {
longitude: [ name: [{
{ required: true, message: '坐标不能为空', trigger: 'blur' } required: true,
] message: '物业名称不能为空',
} trigger: 'blur'
}, }
propertyRule () { // { min: 1, max: 50, message: ' 1 50', trigger: 'blur' }
name: [ ]
{ required: true, message: '物业名称不能为空', trigger: 'blur' } }
// { min: 1, max: 50, message: ' 1 50', trigger: 'blur' } },
] props: {}
} }
},
props: {}
}
</script> </script>
<style lang="scss" scoped > <style lang="scss" scoped>
@import "@/assets/scss/modules/management/detail-main.scss"; @import "@/assets/scss/modules/management/detail-main.scss";
</style> </style>

886
src/views/modules/base/communityYantai/communityForm.vue

@ -8,7 +8,8 @@
</el-form-item> </el-form-item>
<el-form-item label="所属网格" prop="gridId" label-width="150px" style="display: block"> <el-form-item label="所属网格" prop="gridId" label-width="150px" style="display: block">
<el-select class="item_width_1" v-model="dataForm.gridId" placeholder="请选择" clearable> <el-select class="item_width_1" v-model="dataForm.gridId" placeholder="请选择" clearable>
<el-option v-for="item in gridList" :key="item.gridId" :label="item.gridName" :value="item.gridId"></el-option> <el-option v-for="item in gridList" :key="item.gridId" :label="item.gridName"
:value="item.gridId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- /** <!-- /**
@ -29,91 +30,79 @@
private String buildYear; --> private String buildYear; -->
<!--小区/自然村类型 面积 开放类型 建筑年代 tianqian --> <!--小区/自然村类型 面积 开放类型 建筑年代 tianqian -->
<el-form-item label="小区/自然村名称" prop="neighborHoodName" label-width="150px" style="display: block"> <el-form-item label="小区/自然村名称" prop="neighborHoodName" label-width="150px" style="display: block">
<el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入小区/自然村名称" v-model="dataForm.neighborHoodName"></el-input> <el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入小区/自然村名称"
v-model="dataForm.neighborHoodName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="小区/自然村类型" prop="viliageType" label-width="150px" style="display: block"> <el-form-item label="小区/自然村类型" prop="viliageType" label-width="150px" style="display: block">
<el-select v-model="dataForm.viliageType" clearable placeholder="小区/自然村类型"> <el-select v-model="dataForm.viliageType" clearable placeholder="小区/自然村类型">
<el-option v-for="item in viliageTypeList" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in viliageTypeList" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="小区编码" prop="coding" label-width="150px" style="display: block"> <el-form-item label="小区编码" prop="coding" label-width="150px" style="display: block">
<el-input class="item_width_2" maxlength="50" placeholder="请输入楼栋编码" v-model="dataForm.coding"></el-input> <el-input class="item_width_2" maxlength="50" placeholder="请输入楼栋编码"
<el-button style="margin-left: 10px" type="primary" size="small" @click="handleCode">生成</el-button> v-model="dataForm.coding"></el-input>
<el-button style="margin-left: 10px" type="primary" size="small"
@click="handleCode">生成</el-button>
</el-form-item> </el-form-item>
<div v-if="dataForm.qrcodeUrl" style="display: flex;flex-direction: column;"> <div v-if="dataForm.qrcodeUrl" style="display: flex;flex-direction: column;">
<img style="margin-left: 70px;width: 200px;" :src="dataForm.qrcodeUrl" /> <img style="margin-left: 70px;width: 200px;" :src="dataForm.qrcodeUrl" />
<a style="margin-left: 80px" :href="dataForm.qrcodeUrl" target="_blank">下载</a> <a style="margin-left: 80px" :href="dataForm.qrcodeUrl" target="_blank">下载</a>
</div> </div>
<!-- 面积 开放类型 建筑年代 tianqian --> <!-- 面积 开放类型 建筑年代 tianqian -->
<el-form-item label="面积" prop="area" label-width="150px" style="display: block"> <el-form-item label="面积" prop="area" label-width="150px" style="display: block">
<el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入面积" v-model="dataForm.area"></el-input> <el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入面积"
v-model="dataForm.area"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="开放类型" prop="openType" label-width="150px" style="display: block"> <el-form-item label="开放类型" prop="openType" label-width="150px" style="display: block">
<el-select v-model="dataForm.openType" clearable placeholder="开放类型"> <el-select v-model="dataForm.openType" clearable placeholder="开放类型">
<el-option v-for="item in openTypeList" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in openTypeList" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="建筑年代" prop="buildYear" label-width="150px" style="display: block"> <el-form-item label="建筑年代" prop="buildYear" label-width="150px" style="display: block">
<el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入建筑年代" v-model="dataForm.buildYear"></el-input> <el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入建筑年代"
v-model="dataForm.buildYear"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="关联物业" prop="propertyId" label-width="150px" style="display: block"> <el-form-item label="关联物业" prop="propertyId" label-width="150px" style="display: block">
<el-select class="item_width_2" v-model="dataForm.propertyId" placeholder="请选择" filterable clearable> <el-select class="item_width_2" v-model="dataForm.propertyId" placeholder="请选择" filterable
<el-option v-for="item in propertyList" :key="item.propertyId" :label="item.propertyName" :value="item.propertyId"></el-option> clearable>
<el-option v-for="item in propertyList" :key="item.propertyId" :label="item.propertyName"
:value="item.propertyId"></el-option>
</el-select> </el-select>
<el-button style="margin-left: 10px" type="primary" size="small"
<el-button style="margin-left: 10px" type="primary" size="small" @click="handleAddProperty">添加物业</el-button> @click="handleAddProperty">添加物业</el-button>
</el-form-item> </el-form-item>
<el-form-item label="实有楼栋" style="display: block" prop="realBuilding" label-width="150px"> <el-form-item label="实有楼栋" style="display: block" prop="realBuilding" label-width="150px">
<el-input-number class="item_width_4" v-model="dataForm.realBuilding" :min="0" :max="9999" label="总户数"></el-input-number> <el-input-number class="item_width_4" v-model="dataForm.realBuilding" :min="0" :max="9999"
label="总户数"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="地图位置" prop="longitude" label-width="150px" style="display: block"> <el-form-item label="地图位置" prop="longitude" label-width="150px" style="display: block">
<div style="width: 500px"> <div style="width: 500px">
<el-select <el-select v-model="searchValue" filterable style="width: 500px" remote
v-model="searchValue" :reserve-keyword="true" placeholder="请输入关键词" :remote-method="remoteMethod"
filterable :loading="loading">
style="width: 500px" <el-option v-for="(item, index) in searchOptions" @click.native="handleClickKey(index)"
remote :key="item.value" :label="item.label" :value="item.value"></el-option>
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading"
>
<el-option
v-for="(item, index) in searchOptions"
@click.native="handleClickKey(index)"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select> </el-select>
<div id="app_community" class="div_map"></div> <div id="app_community" class="div_map"></div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="详细地址" prop="address" label-width="150px" style="display: block"> <el-form-item label="详细地址" prop="address" label-width="150px" style="display: block">
<el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入详细地址" v-model="dataForm.address"></el-input> <el-input class="item_width_1" maxlength="50" show-word-limit placeholder="请输入详细地址"
v-model="dataForm.address"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark" label-width="150px" style="display: block"> <el-form-item label="备注" prop="remark" label-width="150px" style="display: block">
<el-input <el-input class="item_width_1" type="textarea" maxlength="500" show-word-limit :rows="3"
class="item_width_1" placeholder="请输入备注,不超过500字" v-model="dataForm.remark"></el-input>
type="textarea"
maxlength="500"
show-word-limit
:rows="3"
placeholder="请输入备注,不超过500字"
v-model="dataForm.remark"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div v-show="propertyFormShow"> <div v-show="propertyFormShow">
<el-form :inline="false" :model="propertyForm" :rules="propertyRule" class="form"> <el-form :inline="false" :model="propertyForm" :rules="propertyRule" class="form">
<el-form-item label="物业名称" prop="name" label-width="150px" style="display: block"> <el-form-item label="物业名称" prop="name" label-width="150px" style="display: block">
<el-input class="item_width_1" maxlength="10" placeholder="请输入小区名称" v-model="propertyForm.name"></el-input> <el-input class="item_width_1" maxlength="10" placeholder="请输入小区名称"
v-model="propertyForm.name"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -124,409 +113,446 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import {
import { Loading } from 'element-ui'; // Loading mapGetters
import { requestPost } from '@/js/dai/request'; } from 'vuex';
import daiMap from '@/utils/dai-map'; import {
var map; Loading
var search; } from 'element-ui'; // Loading
var markers; import {
var infoWindowList; requestPost
let loading; // } from '@/js/dai/request';
export default { import daiMap from '@/utils/dai-map';
data() { var map;
return { var search;
formType: 'add', // addeditdetail var markers;
searchOptions: [], var infoWindowList;
searchValue: '', let loading; //
resultList: [], export default {
loading: false, data() {
return {
gridList: [], formType: 'add', // addeditdetail
propertyList: [], searchOptions: [],
btnDisable: false, searchValue: '',
resultList: [],
neighborHoodId: '', //ID loading: false,
dataForm: { gridList: [],
neighborHoodName: '', // 50 propertyList: [],
agencyId: '', // ID btnDisable: false,
agencyName: '', neighborHoodId: '', //ID
gridId: '', //ID dataForm: {
propertyId: '', // neighborHoodName: '', // 50
address: '', // agencyId: '', // ID
remark: '', //500 agencyName: '',
location: '', // gridId: '', //ID
longitude: '', // propertyId: '', //
latitude: '', // address: '', //
realBuilding: 0, remark: '', //500
coding: '', location: '', //
sysCoding: '', longitude: '', //
viliageType: '', latitude: '', //
area: '', realBuilding: 0,
openType: '', coding: '',
buildYear: '', sysCoding: '',
}, viliageType: '',
area: '',
propertyFormShow: false, openType: '',
propertyForm: { buildYear: '',
name: '' },
}, propertyFormShow: false,
propertyForm: {
keyWords: '', name: ''
agencyObj: {}, },
viliageTypeList: [], keyWords: '',
openTypeList: [] agencyObj: {},
}; viliageTypeList: [],
}, openTypeList: []
components: {}, };
mounted() {},
methods: {
async initForm(type, row, agencyObj) {
this.$refs.ref_form.resetFields();
this.agencyObj = agencyObj;
let { latitude, longitude } = this.$store.state.user;
this.formType = type;
if (row) {
this.dataForm = JSON.parse(JSON.stringify(row));
this.dataForm.neighborHoodId = this.dataForm.id;
this.neighborHoodId = this.dataForm.neighborHoodId;
} else {
this.dataForm.latitude = latitude;
this.dataForm.longitude = longitude;
}
if (!map) {
this.initMap(this.dataForm.latitude, this.dataForm.longitude);
} else {
map.setCenter(this.dataForm.latitude, this.dataForm.longitude);
map.setMarker(this.dataForm.latitude, this.dataForm.longitude);
}
await this.loadAgency();
await this.loadGrid();
await this.loadProperty();
await this.getViliageTypeList();
await this.getOpenTypeList();
}, },
// init components: {},
initMap(latitude, longitude) { mounted() {},
map = new daiMap( methods: {
document.getElementById('app_community'), async initForm(type, row, agencyObj) {
{ latitude, longitude }, this.$refs.ref_form.resetFields();
{ this.agencyObj = agencyObj;
let {
latitude,
longitude
} = this.$store.state.user;
this.formType = type;
if (row) {
this.dataForm = JSON.parse(JSON.stringify(row));
this.dataForm.neighborHoodId = this.dataForm.id;
this.neighborHoodId = this.dataForm.neighborHoodId;
} else {
this.dataForm.latitude = latitude;
this.dataForm.longitude = longitude;
}
if (!map) {
this.initMap(this.dataForm.latitude, this.dataForm.longitude);
} else {
map.setCenter(this.dataForm.latitude, this.dataForm.longitude);
map.setMarker(this.dataForm.latitude, this.dataForm.longitude);
}
await this.loadAgency();
await this.loadGrid();
await this.loadProperty();
await this.getViliageTypeList();
await this.getOpenTypeList();
},
// init
initMap(latitude, longitude) {
map = new daiMap(document.getElementById('app_community'), {
latitude,
longitude
}, {
zoom: 16.2, // zoom: 16.2, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45 // rotation: 45 //
});
//
map.on('dragend', e => {
this.handleMoveCenter(e);
});
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
},
async handleMoveCenter() {
//
const {
lat,
lng
} = map.getCenter();
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
map.setMarker(lat, lng);
let {
msg,
data
} = await map.getAddress(lat, lng);
if (msg == 'success') {
this.dataForm.address = data.address;
this.searchValue = data.address;
this.searchOptions = [];
} }
); },
async remoteMethod(query) {
// if (query !== '') {
map.on('dragend', e => { this.loading = true;
this.handleMoveCenter(e); const {
}); msg,
data
map.setCenter(latitude, longitude); } = await map.searchNearby(query);
map.setMarker(latitude, longitude); this.loading = false;
}, this.resultList = [];
if (msg == 'success' && data.resultList && data.resultList.length > 0) {
async handleMoveCenter() { if (data.resultList && data.resultList.length > 0) {
// this.resultList = data.resultList;
const { lat, lng } = map.getCenter(); this.searchOptions = this.resultList.map(item => {
this.dataForm.latitude = lat; return {
this.dataForm.longitude = lng; value: `${item.hotPointID}`,
map.setMarker(lat, lng); label: `${item.address + item.name}`
};
let { msg, data } = await map.getAddress(lat, lng); });
if (msg == 'success') { }
this.dataForm.address = data.address; } else {
this.searchValue = data.address; this.searchOptions = [{
this.searchOptions = [];
}
},
async remoteMethod(query) {
if (query !== '') {
this.loading = true;
const { msg, data } = await map.searchNearby(query);
this.loading = false;
this.resultList = [];
if (msg == 'success' && data.resultList && data.resultList.length > 0) {
if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList;
this.searchOptions = this.resultList.map(item => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` };
});
}
} else {
this.searchOptions = [
{
value: '0', value: '0',
label: '未检索到结果' label: '未检索到结果'
}];
}
} else {
this.searchOptions = [];
}
},
handleClickKey(index) {
let selPosition = this.resultList[index];
let lonlat = selPosition.lonlat.split(' ');
map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]);
this.dataForm.latitude = lonlat[1];
this.dataForm.longitude = lonlat[0];
this.dataForm.address = selPosition.address + selPosition.name;
},
async handleCode() {
if (!this.dataForm.gridId) return this.$message.error('请选择网格');
const {
data,
code,
msg
} = await requestPost('/gov/org/houseInformation/getNeighborHoodCoding/' + this.dataForm.gridId);
if (msg == 'success' && code == 0) {
this.dataForm.coding = data.coding;
this.dataForm.sysCoding = data.sysCoding;
}
},
//
async loadAgency() {
const url = '/epmetuser/customerstaff/staffbasicinfo';
let params = {};
const {
data,
code,
msg
} = await requestPost(url, params);
if (code === 0) {
this.dataForm.agencyId = data.agencyId;
this.dataForm.agencyName = data.agencyName;
} else {
this.$message.error(msg);
}
},
//
async loadGrid() {
const url = '/gov/org/grid/allgridsnopermission ';
// const url = "https://epmet-dev.elinkservice.cn:7082/api/apimock-v2/95518686fa128a53f64c678906848062/gov/org/grid/allgrids"
let params = {
agencyId: this.dataForm.agencyId
};
const {
data,
code,
msg
} = await requestPost(url, params);
if (code === 0) {
this.gridList = data;
} else {
this.$message.error(msg);
}
},
async getViliageTypeList() {
const url = '/sys/dict/data/dictlist';
let params = {
dictType: 'neighbor_hood_type'
};
const {
data,
code,
msg
} = await requestPost(url, params);
if (code === 0) {
this.viliageTypeList = data;
} else {
this.$message.error(msg);
}
},
async getOpenTypeList() {
const url = '/sys/dict/data/dictlist';
let params = {
dictType: 'open_type'
};
const {
data,
code,
msg
} = await requestPost(url, params);
if (code === 0) {
this.openTypeList = data;
} else {
this.$message.error(msg);
}
},
//
async loadProperty() {
const url = '/gov/org/propertymanagement/list';
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/list"
let params = {};
const {
data,
code,
msg
} = await requestPost(url, params);
if (code === 0) {
this.propertyList = data;
} else {
this.$message.error(msg);
}
},
handleAddProperty() {
this.propertyForm.name = '';
this.propertyFormShow = true;
},
async handleComfirm() {
if (this.propertyFormShow) {
this.addProperty();
} else {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false;
}, 10000);
this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj);
this.btnDisable = false;
} else {
this.addCommunity();
} }
]; });
} }
} else { },
this.searchOptions = []; async addCommunity() {
} let url = '';
}, if (this.formType === 'add') {
url = '/gov/org/neighborhood/neighborhoodadd';
handleClickKey(index) { // url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd"
let selPosition = this.resultList[index]; } else {
let lonlat = selPosition.lonlat.split(' '); url = '/gov/org/neighborhood/neighborhoodupdate';
map.setCenter(lonlat[1], lonlat[0]); this.dataForm.neighborHoodId = this.neighborHoodId;
map.setMarker(lonlat[1], lonlat[0]); }
this.dataForm.latitude = lonlat[1]; console.log("this.dataForm", this.dataForm)
this.dataForm.longitude = lonlat[0]; const {
this.dataForm.address = selPosition.address + selPosition.name; data,
}, code,
msg
async handleCode() { } = await requestPost(url, this.dataForm);
if (!this.dataForm.gridId) return this.$message.error('请选择网格'); if (code === 0) {
const { data, code, msg } = await requestPost('/gov/org/houseInformation/getNeighborHoodCoding/' + this.dataForm.gridId); this.$message({
if (msg == 'success' && code == 0) { type: 'success',
this.dataForm.coding = data.coding; message: '操作成功'
this.dataForm.sysCoding = data.sysCoding; });
} this.resetData();
}, this.$emit('dialogOk');
//
async loadAgency() {
const url = '/epmetuser/customerstaff/staffbasicinfo';
let params = {};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.dataForm.agencyId = data.agencyId;
this.dataForm.agencyName = data.agencyName;
} else {
this.$message.error(msg);
}
},
//
async loadGrid() {
const url = '/gov/org/grid/allgridsnopermission ';
// const url = "https://epmet-dev.elinkservice.cn:7082/api/apimock-v2/95518686fa128a53f64c678906848062/gov/org/grid/allgrids"
let params = {
agencyId: this.dataForm.agencyId
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.gridList = data;
} else {
this.$message.error(msg);
}
},
async getViliageTypeList() {
const url = '/sys/dict/data/dictlist';
let params = {
dictType: 'neighbor_hood_type'
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.viliageTypeList = data;
} else {
this.$message.error(msg);
}
},
async getOpenTypeList() {
const url = '/sys/dict/data/dictlist';
let params = {
dictType: 'open_type'
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.openTypeList = data;
} else {
this.$message.error(msg);
}
},
//
async loadProperty() {
const url = '/gov/org/propertymanagement/list';
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/list"
let params = {};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.propertyList = data;
} else {
this.$message.error(msg);
}
},
handleAddProperty() {
this.propertyForm.name = '';
this.propertyFormShow = true;
},
async handleComfirm() {
if (this.propertyFormShow) {
this.addProperty();
} else {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false; this.btnDisable = false;
}, 10000); } else {
this.$refs['ref_form'].validate((valid, messageObj) => { this.btnDisable = false;
if (!valid) { this.$message.error(msg);
app.util.validateRule(messageObj); }
this.btnDisable = false; },
} else { async addProperty() {
this.addCommunity(); if (!this.propertyForm.name || this.propertyForm.name === '') {
} this.$message({
}); type: 'error',
} message: '物业名称不能为空'
}, });
async addCommunity() { return false;
let url = ''; }
if (this.formType === 'add') { const url = '/gov/org/propertymanagement/add';
url = '/gov/org/neighborhood/neighborhoodadd'; // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/add"
// url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd" let params = {
} else { name: this.propertyForm.name
url = '/gov/org/neighborhood/neighborhoodupdate'; };
const {
this.dataForm.neighborHoodId = this.neighborHoodId; data,
} code,
msg
const { data, code, msg } = await requestPost(url, this.dataForm); } = await requestPost(url, params);
if (code === 0) {
if (code === 0) { this.$message({
this.$message({ type: 'success',
type: 'success', message: '操作成功'
message: '操作成功' });
}); this.propertyForm.name = '';
this.resetData(); this.propertyFormShow = false;
this.$emit('dialogOk'); this.loadProperty();
this.btnDisable = false; } else {
} else { this.$message.error(msg);
this.btnDisable = false; }
this.$message.error(msg); },
} handleCancle() {
}, if (this.propertyFormShow) {
async addProperty() { this.propertyForm.name = '';
if (!this.propertyForm.name || this.propertyForm.name === '') { this.propertyFormShow = false;
this.$message({ } else {
type: 'error', this.resetData();
message: '物业名称不能为空' this.$emit('dialogCancle');
}); }
return false; },
} resetData() {
const url = '/gov/org/propertymanagement/add'; this.searchValue = '';
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/add" this.searchOptions = [];
let params = { this.resultList = [];
name: this.propertyForm.name this.neighborHoodId = ''; //ID
}; this.dataForm = {
neighborHoodName: '', // 50
const { data, code, msg } = await requestPost(url, params); agencyId: '', // ID
agencyName: '',
if (code === 0) { gridId: '', //ID
this.$message({ propertyId: '', //
type: 'success', address: '', //
message: '操作成功' remark: '', //500
}); location: '', //
longitude: '', //
this.propertyForm.name = ''; latitude: '', //
this.propertyFormShow = false; realBuilding: 0,
this.loadProperty(); coding: '',
} else { sysCoding: '',
this.$message.error(msg); viliageType: '',
} area: '',
}, openType: '',
handleCancle() { buildYear: '',
if (this.propertyFormShow) { };
this.propertyForm.name = '';
this.propertyFormShow = false; this.propertyFormShow = false;
} else { },
this.resetData(); //
this.$emit('dialogCancle'); startLoading() {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
});
},
//
endLoading() {
// clearTimeout(timer);
if (loading) {
loading.close();
}
} }
}, },
resetData() { computed: {
this.searchValue = ''; dataRule() {
this.searchOptions = []; return {
this.resultList = []; neighborHoodName: [{
this.neighborHoodId = ''; //ID required: true,
this.dataForm = { message: '小区名称不能为空',
neighborHoodName: '', // 50 trigger: 'blur'
agencyId: '', // ID }, {
agencyName: '',
gridId: '', //ID
propertyId: '', //
address: '', //
remark: '', //500
location: '', //
longitude: '', //
latitude: '', //
realBuilding: 0,
coding: '',
sysCoding: '',
viliageType: '',
area: '',
openType: '',
buildYear: '',
};
this.propertyFormShow = false;
},
//
startLoading() {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
});
},
//
endLoading() {
// clearTimeout(timer);
if (loading) {
loading.close();
}
}
},
computed: {
dataRule() {
return {
neighborHoodName: [
{ required: true, message: '小区名称不能为空', trigger: 'blur' },
{
min: 1, min: 1,
max: 50, max: 50,
message: '小区名称长度在 1 到 50个字符', message: '小区名称长度在 1 到 50个字符',
trigger: 'blur' trigger: 'blur'
}],
agencyId: [{
required: true,
message: '所属组织不能为空',
trigger: 'blur'
}],
gridId: [{
required: true,
message: '所属网格不能为空',
trigger: 'blur'
}],
coding: [{
required: true,
message: '小区编码不能为空',
trigger: 'blur'
}],
address: [{
required: true,
message: '详细地址不能为空',
trigger: 'blur'
}],
longitude: [{
required: true,
message: '坐标不能为空',
trigger: 'blur'
}]
};
},
propertyRule() {
name: [{
required: true,
message: '物业名称不能为空',
trigger: 'blur'
} }
], // { min: 1, max: 50, message: ' 1 50', trigger: 'blur' }
agencyId: [{ required: true, message: '所属组织不能为空', trigger: 'blur' }], ];
gridId: [{ required: true, message: '所属网格不能为空', trigger: 'blur' }], }
coding: [{ required: true, message: '小区编码不能为空', trigger: 'blur' }],
address: [{ required: true, message: '详细地址不能为空', trigger: 'blur' }],
longitude: [{ required: true, message: '坐标不能为空', trigger: 'blur' }]
};
}, },
propertyRule() { props: {}
name: [ };
{ required: true, message: '物业名称不能为空', trigger: 'blur' }
// { min: 1, max: 50, message: ' 1 50', trigger: 'blur' }
];
}
},
props: {}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/assets/scss/modules/visual/communityManageForm.scss'; @import '@/assets/scss/modules/visual/communityManageForm.scss';
</style> </style>
Loading…
Cancel
Save