Browse Source

楼宇

master
dai 2 years ago
parent
commit
3a62045f53
  1. 519
      src/views/modules/base/community/buildForm.vue
  2. 1
      src/views/modules/base/community/buildTable.vue
  3. 616
      src/views/modules/base/community/communityForm.vue
  4. 1
      src/views/modules/base/community/communityTable.vue

519
src/views/modules/base/community/buildForm.vue

@ -1,50 +1,68 @@
<template> <template>
<div> <div>
<div class="dialog-h-content scroll-h"> <div class="dialog-h-content scroll-h">
<el-form
<el-form ref="ref_form" ref="ref_form"
:inline="true" :inline="true"
:model="dataForm" :model="dataForm"
:rules="dataRule" :rules="dataRule"
:disabled="formType === 'detail'" :disabled="formType === 'detail'"
class="form"> class="form"
<el-form-item label="所属小区" >
<el-form-item
label="所属小区"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
<span>{{ agencyObj.agencyName }}{{ agencyObj.gridName }}{{ agencyObj.label }}</span> >
<span
>{{ agencyObj.agencyName }}{{ agencyObj.gridName }}{{
agencyObj.label
}}</span
>
</el-form-item> </el-form-item>
<el-form-item label="楼栋名称" <el-form-item
label="楼栋名称"
prop="buildingName" prop="buildingName"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
<el-input class="item_width_1" >
<el-input
class="item_width_1"
maxlength="10" maxlength="10"
placeholder="请输入楼栋名称" placeholder="请输入楼栋名称"
v-model="dataForm.buildingName"> v-model="dataForm.buildingName"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="楼栋编码" <el-form-item
label="楼栋编码"
prop="coding" prop="coding"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
<el-input class="item_width_2" >
<el-input
class="item_width_2"
maxlength="50" maxlength="50"
placeholder="请输入楼栋编码" placeholder="请输入楼栋编码"
v-model="dataForm.coding"> v-model="dataForm.coding"
>
</el-input> </el-input>
<el-button style="margin-left: 10px" <el-button
style="margin-left: 10px"
type="primary" type="primary"
size="small" size="small"
@click="handleCode">生成</el-button> @click="handleCode"
>生成</el-button
>
</el-form-item> </el-form-item>
<el-form-item label="楼栋类型" <el-form-item
label="楼栋类型"
prop="type" prop="type"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
>
<el-radio-group v-model="buildType"> <el-radio-group v-model="buildType">
<el-radio :label="'1'">商品房</el-radio> <el-radio :label="'1'">商品房</el-radio>
<el-radio :label="'2'">自建房</el-radio> <el-radio :label="'2'">自建房</el-radio>
<el-radio :label="'3'">别墅</el-radio> <el-radio :label="'3'">别墅</el-radio>
@ -58,337 +76,387 @@
v-model="dataForm.sort" v-model="dataForm.sort"
label="排序"></el-input-number> label="排序"></el-input-number>
</el-form-item> --> </el-form-item> -->
<el-form-item label="单元数" <el-form-item
label="单元数"
style="display: block" style="display: block"
prop="totalUnitNum" prop="totalUnitNum"
label-width="150px"> label-width="150px"
<el-input-number class="item_width_4" >
<el-input-number
class="item_width_4"
v-model="dataForm.totalUnitNum" v-model="dataForm.totalUnitNum"
:min="1" :min="1"
:max="9999" :max="9999"
label="单元数"></el-input-number> label="单元数"
></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="层数" <el-form-item
label="层数"
style="display: block" style="display: block"
prop="totalFloorNum" prop="totalFloorNum"
label-width="150px"> label-width="150px"
<el-input-number class="item_width_4" >
<el-input-number
class="item_width_4"
v-model="dataForm.totalFloorNum" v-model="dataForm.totalFloorNum"
:min="0" :min="0"
:max="9999" :max="9999"
label="层数"></el-input-number> label="层数"
></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="总户数" <el-form-item
label="总户数"
style="display: block" style="display: block"
prop="totalHouseNum" prop="totalHouseNum"
label-width="150px"> label-width="150px"
<el-input-number class="item_width_4" >
<el-input-number
class="item_width_4"
v-model="dataForm.totalHouseNum" v-model="dataForm.totalHouseNum"
:min="0" :min="0"
:max="9999" :max="9999"
label="总户数"></el-input-number> label="总户数"
></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="人口数" <el-form-item
label="人口数"
style="display: block" style="display: block"
prop="realPerson" prop="realPerson"
label-width="150px"> label-width="150px"
<el-input-number class="item_width_4" >
<el-input-number
class="item_width_4"
v-model="dataForm.realPerson" v-model="dataForm.realPerson"
:min="0" :min="0"
:max="9999" :max="9999"
label="人口数"></el-input-number> label="人口数"
></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="楼长姓名" <el-form-item
label="楼长姓名"
prop="buildingLeaderName" prop="buildingLeaderName"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
<el-input class="item_width_1" >
<el-input
class="item_width_1"
placeholder="请输入楼长姓名" placeholder="请输入楼长姓名"
v-model="dataForm.buildingLeaderName"> v-model="dataForm.buildingLeaderName"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="楼长电话" <el-form-item
label="楼长电话"
prop="buildingLeaderMobile" prop="buildingLeaderMobile"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
<el-input class="item_width_1" >
type='number' <el-input
class="item_width_1"
type="number"
placeholder="请输入楼长电话" placeholder="请输入楼长电话"
v-model="dataForm.buildingLeaderMobile"> v-model="dataForm.buildingLeaderMobile"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="地图位置" <el-form-item
label="地图位置"
prop="longitude" prop="longitude"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
>
<div style="width: 500px"> <div style="width: 500px">
<el-select v-model="searchValue" <el-select
v-model="searchValue"
filterable filterable
style="width: 500px" style="width: 500px"
remote remote
:reserve-keyword="true" :reserve-keyword="true"
placeholder="请输入关键词" placeholder="请输入关键词"
:remote-method="remoteMethod" :remote-method="remoteMethod"
:loading="loading"> :loading="loading"
<el-option v-for="(item,index) in searchOptions" >
<el-option
v-for="(item, index) in searchOptions"
@click.native="handleClickKey(index)" @click.native="handleClickKey(index)"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
<div id="app_build" <div id="map" class="div_map"></div>
class="div_map"></div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="楼栋地址" <el-form-item
label="楼栋地址"
prop="coordinatePosition" prop="coordinatePosition"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
>
<!-- <span>{{ dataForm.coordinatePosition }}</span> --> <!-- <span>{{ dataForm.coordinatePosition }}</span> -->
<el-input class="item_width_1" <el-input
class="item_width_1"
placeholder="请选择楼栋地址" placeholder="请选择楼栋地址"
v-model="dataForm.coordinatePosition" /> v-model="dataForm.coordinatePosition"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="div_btn"> <div class="div_btn">
<el-button size="small" <el-button size="small" @click="handleCancle"> </el-button>
@click="handleCancle"> </el-button> <el-button
<el-button size="small" size="small"
v-if="formType != 'detail'" v-if="formType != 'detail'"
type="primary" type="primary"
:disabled="btnDisable" :disabled="btnDisable"
@click="handleComfirm"> </el-button> @click="handleComfirm"
> </el-button
>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from "vuex";
import { Loading } from 'element-ui' // Loading import { Loading } from "element-ui"; // Loading
import { requestPost } from '@/js/dai/request' import { requestPost } from "@/js/dai/request";
import daiMap from "@/utils/dai-map"; import daiMap from "@/utils/dai-map2";
var map
var search var map;
var markers let loading; //
var infoWindowList
let loading //
export default { export default {
data() { data() {
return { return {
formType: 'add', // addeditdetail formType: "add", // addeditdetail
searchOptions: [], searchOptions: [],
searchValue: '', searchValue: "",
resultList: [], resultList: [],
loading: false, loading: false,
btnDisable: false, btnDisable: false,
buildingId: '', //ID buildingId: "", //ID
buildType: "1", buildType: "1",
dataForm: { dataForm: {
agencyId: '', // ID agencyId: "", // ID
agencyName: '', agencyName: "",
gridId: '', //ID gridId: "", //ID
neighborHoodId: '',//id neighborHoodId: "", //id
buildingName: '',// buildingName: "", //
// sort: 0,// // sort: 0,//
totalUnitNum: 1, // totalUnitNum: 1, //
totalFloorNum: 0, // totalFloorNum: 0, //
totalHouseNum: 0, // totalHouseNum: 0, //
realPerson: 0, realPerson: 0,
buildingLeaderName: '',// buildingLeaderName: "", //
buildingLeaderMobile: '',// buildingLeaderMobile: "", //
type: '',// type: "", //
coordinatePosition: '', coordinatePosition: "",
sysCoding: '', sysCoding: "",
coding: '', coding: "",
location: '', // location: "", //
longitude: '', // longitude: "", //
latitude: '' // latitude: "", //
}, },
keyWords: '', keyWords: "",
agencyObj: {}, agencyObj: {},
} mapLoaded: false,
};
}, },
components: {}, components: {},
mounted () { mounted() {},
},
methods: { methods: {
async initForm(type, row, agencyObj) { async initForm(type, row, agencyObj) {
this.$refs.ref_form.resetFields(); this.$refs.ref_form.resetFields();
let { latitude, longitude } = this.$store.state.user; let { latitude, longitude } = this.$store.state.user;
this.agencyObj = agencyObj this.agencyObj = agencyObj;
this.dataForm.agencyId = agencyObj.agencyId this.dataForm.agencyId = agencyObj.agencyId;
this.dataForm.gridId = agencyObj.gridId this.dataForm.gridId = agencyObj.gridId;
this.dataForm.neighborHoodId = agencyObj.id this.dataForm.neighborHoodId = agencyObj.id;
this.formType = type this.formType = type;
if (row) { if (row) {
this.dataForm = JSON.parse(JSON.stringify(row)) this.dataForm = JSON.parse(JSON.stringify(row));
this.buildingId = this.dataForm.buildingId this.buildingId = this.dataForm.buildingId;
// this.buildType = this.dataForm.buildingTypeKey // this.buildType = this.dataForm.buildingTypeKey
this.buildType = this.dataForm.type this.buildType = this.dataForm.type;
} else { } else {
this.dataForm.latitude = latitude this.dataForm.latitude = latitude;
this.dataForm.longitude = longitude this.dataForm.longitude = longitude;
} }
this.$nextTick(() => { this.$nextTick(() => {
if (!map) { latitude =
this.initMap(this.dataForm.latitude, this.dataForm.longitude); this.dataForm.latitude && this.dataForm.latitude != "0"
? this.dataForm.latitude
: latitude;
longitude =
this.dataForm.longitude && this.dataForm.longitude != "0"
? this.dataForm.longitude
: longitude;
if (!this.mapLoaded) {
this.initMap(latitude || latitude, longitude);
this.mapLoaded = true;
} else { } else {
map.setCenter(this.dataForm.latitude, this.dataForm.longitude); map.setCenter(latitude, longitude);
map.setMarker(this.dataForm.latitude, this.dataForm.longitude); map.setMarker(latitude, longitude);
} }
}) });
}, },
async handleComfirm() { async handleComfirm() {
this.btnDisable = true this.btnDisable = true;
setTimeout(() => { setTimeout(() => {
this.btnDisable = false this.btnDisable = false;
}, 10000) }, 10000);
this.dataForm.type = this.buildType this.dataForm.type = this.buildType;
this.$refs['ref_form'].validate((valid, messageObj) => { this.$refs["ref_form"].validate((valid, messageObj) => {
if (!valid) { if (!valid) {
this.btnDisable = false this.btnDisable = false;
app.util.validateRule(messageObj) app.util.validateRule(messageObj);
} else { } else {
this.addBuild() this.addBuild();
} }
});
})
}, },
async handleCode() { async handleCode() {
const { data, code, msg } = await requestPost( const { data, code, msg } = await requestPost(
"/gov/org/houseInformation/getBuildingCoding/" + this.dataForm.neighborHoodId); "/gov/org/houseInformation/getBuildingCoding/" +
console.log('data----', data) this.dataForm.neighborHoodId
console.log('code----', code) );
console.log('msg----', msg) console.log("data----", data);
console.log("code----", code);
console.log("msg----", msg);
if (msg == "success" && code == 0) { if (msg == "success" && code == 0) {
this.dataForm.coding = data.coding this.dataForm.coding = data.coding;
this.dataForm.sysCoding = data.sysCoding this.dataForm.sysCoding = data.sysCoding;
} }
}, },
async addBuild() { async addBuild() {
if (this.dataForm.buildingLeaderMobile) { if (this.dataForm.buildingLeaderMobile) {
const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/; // const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/; //
if (this.dataForm.buildingLeaderMobile && regPhone.test(this.dataForm.buildingLeaderMobile) === false) { if (
this.btnDisable = false this.dataForm.buildingLeaderMobile &&
regPhone.test(this.dataForm.buildingLeaderMobile) === false
) {
this.btnDisable = false;
this.$message({ this.$message({
type: 'warning', type: "warning",
message: '请输入正确的楼主手机' message: "请输入正确的楼主手机",
}) });
return false; return false;
} }
} }
let url = '' let url = "";
if (this.formType === 'add') { if (this.formType === "add") {
url = '/gov/org/building/buildingadd' url = "/gov/org/building/buildingadd";
} else { } else {
url = '/gov/org/building/buildingupdate' url = "/gov/org/building/buildingupdate";
this.dataForm.buildingId = this.buildingId this.dataForm.buildingId = this.buildingId;
} }
const { data, code, msg } = await requestPost(url, this.dataForm) const { data, code, msg } = await requestPost(url, this.dataForm);
if (code === 0) { if (code === 0) {
this.$message({ this.$message({
type: 'success', type: "success",
message: '操作成功' message: "操作成功",
}) });
this.resetData() this.resetData();
this.btnDisable = false this.btnDisable = false;
this.$emit('dialogOk') this.$emit("dialogOk");
} else { } else {
this.btnDisable = false this.btnDisable = false;
this.$message.error(msg) this.$message.error(msg);
} }
}, },
handleCancle() { handleCancle() {
this.resetData() this.resetData();
this.$emit('dialogCancle') this.$emit("dialogCancle");
}, },
// init // init
initMap(latitude, longitude) { initMap(latitude, longitude) {
map = new daiMap( map = new daiMap(
document.getElementById("app_build"), document.getElementById("map"),
{ latitude, longitude }, { latitude, longitude },
{ {
zoom: 16.2, // zoom: 16.2, //
pitch: 43.5, // // pitch: 43.5, //
rotation: 45, // // rotation: 45, //
// layers: "img_c,cva_c",
} }
); );
// //
map.on("dragend", (e) => { map.on("dragend", (e) => {
this.handleMoveCenter(e); //
const { lat, lng } = map.getCenter();
this.handleMoveCenter(lat, lng);
});
//
map.on("click", (e) => {
const {
lnglat: { lat, lng },
} = e;
this.handleMoveCenter(lat, lng);
}); });
map.setCenter(latitude, longitude); map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude); map.setMarker(latitude, longitude);
}, },
async handleMoveCenter(lat, lng) {
async handleMoveCenter () {
//
const { lat, lng } = map.getCenter();
this.dataForm.latitude = lat; this.dataForm.latitude = lat;
this.dataForm.longitude = lng; this.dataForm.longitude = lng;
map.setMarker(lat, lng); map.setMarker(lat, lng);
let { msg, data } = await map.getAddress(lat, lng); let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") { if (msg == "success") {
this.dataForm.coordinatePosition = data.address this.dataForm.address = data.address;
this.searchValue = data.address this.searchValue = data.address;
this.searchOptions = [] this.searchOptions = [];
} }
}, },
async remoteMethod(query) { async remoteMethod(query) {
if (query !== "") {
if (query !== '') {
this.loading = true; this.loading = true;
const { msg, data } = await map.searchNearby(query); const { msg, data } = await map.searchNearby(query);
this.loading = false; this.loading = false;
this.resultList = [] this.resultList = [];
if (msg == "success" && data.resultList && data.resultList.length > 0) {
if (
msg == "success" &&
data.resultList &&
data.resultList.length > 0
) {
if (data.resultList && data.resultList.length > 0) { if (data.resultList && data.resultList.length > 0) {
this.resultList = data.resultList this.resultList = data.resultList;
this.searchOptions = this.resultList.map(item => { this.searchOptions = this.resultList.map((item) => {
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; return {
value: `${item.hotPointID}`,
label: `${item.address + item.name}`,
};
}); });
} }
} else { } else {
this.searchOptions = [ this.searchOptions = [
{ {
value: '0', value: "0",
label: '未检索到结果' label: "未检索到结果",
} },
] ];
} }
} else { } else {
this.searchOptions = []; this.searchOptions = [];
@ -396,81 +464,97 @@ export default {
}, },
handleClickKey(index) { handleClickKey(index) {
let selPosition = this.resultList[index] let selPosition = this.resultList[index];
let lonlat = selPosition.lonlat.split(" ") let lonlat = selPosition.lonlat.split(" ");
map.setCenter(lonlat[1], lonlat[0]); map.setCenter(lonlat[1], lonlat[0]);
map.setMarker(lonlat[1], lonlat[0]); map.setMarker(lonlat[1], lonlat[0]);
this.dataForm.latitude = lonlat[1]; this.dataForm.latitude = lonlat[1];
this.dataForm.longitude = lonlat[0]; this.dataForm.longitude = lonlat[0];
this.dataForm.coordinatePosition = selPosition.address + selPosition.name this.dataForm.coordinatePosition =
selPosition.address + selPosition.name;
}, },
resetData() { resetData() {
this.searchValue = '' this.searchValue = "";
this.searchOptions = [] this.searchOptions = [];
this.resultList = [] this.resultList = [];
this.buildingId = '' //ID this.buildingId = ""; //ID
this.buildType = '1' this.buildType = "1";
this.dataForm = { this.dataForm = {
agencyId: '', // ID agencyId: "", // ID
agencyName: '', agencyName: "",
gridId: '', //ID gridId: "", //ID
neighborHoodId: '',//id neighborHoodId: "", //id
buildingName: '',// buildingName: "", //
// sort: 0,// // sort: 0,//
totalUnitNum: 1, // totalUnitNum: 1, //
totalFloorNum: 0, // totalFloorNum: 0, //
totalHouseNum: 0, // totalHouseNum: 0, //
realPerson: 0, realPerson: 0,
buildingLeaderName: '',// buildingLeaderName: "", //
buildingLeaderMobile: '',// buildingLeaderMobile: "", //
type: '',// type: "", //
location: '', // location: "", //
longitude: '', // longitude: "", //
latitude: '', // latitude: "", //
coding: '', coding: "",
sysCoding: '', sysCoding: "",
coordinatePosition: '' coordinatePosition: "",
} };
}, },
// //
startLoading() { startLoading() {
loading = Loading.service({ loading = Loading.service({
lock: true, // lock: true, //
text: '正在加载……', // text: "正在加载……", //
background: 'rgba(0,0,0,.7)' // background: "rgba(0,0,0,.7)", //
}) });
}, },
// //
endLoading() { endLoading() {
// clearTimeout(timer); // clearTimeout(timer);
if (loading) { if (loading) {
loading.close() loading.close();
}
} }
}, },
},
computed: { computed: {
dataRule() { dataRule() {
return { return {
buildingName: [ buildingName: [
{ required: true, message: '楼栋名称不能为空', trigger: 'blur' }, {
required: true,
message: "楼栋名称不能为空",
trigger: "blur",
},
{ {
min: 1, min: 1,
max: 10, max: 10,
message: '小区名称长度在 1 到 10个字符', message: "小区名称长度在 1 到 10个字符",
trigger: 'blur' trigger: "blur",
} },
], ],
type: [ type: [
{ required: true, message: '楼栋类型不能为空', trigger: 'blur' } {
required: true,
message: "楼栋类型不能为空",
trigger: "blur",
},
], ],
totalUnitNum: [ totalUnitNum: [
{ required: true, message: '单元数不能为空', trigger: 'blur' } {
required: true,
message: "单元数不能为空",
trigger: "blur",
},
], ],
coding: [ coding: [
{ required: true, message: '楼栋编码不能为空', trigger: 'blur' } {
] required: true,
message: "楼栋编码不能为空",
trigger: "blur",
},
],
// totalFloorNum: [ // totalFloorNum: [
// { required: true, message: '', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
// ], // ],
@ -480,12 +564,11 @@ export default {
// longitude: [ // longitude: [
// { required: true, message: '', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
// ], // ],
} };
}, },
}, },
props: {} 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";

1
src/views/modules/base/community/buildTable.vue

@ -191,6 +191,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
:title="formTitle" :title="formTitle"
v-if="formShow"
top="5vh" top="5vh"
width="900px" width="900px"
class="dialog-h" class="dialog-h"

616
src/views/modules/base/community/communityForm.vue

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

1
src/views/modules/base/community/communityTable.vue

@ -205,6 +205,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
:title="formTitle" :title="formTitle"
v-if="formShow"
width="850px" width="850px"
top="5vh" top="5vh"
class="dialog-h" class="dialog-h"

Loading…
Cancel
Save