Browse Source

房屋打点

master
dai 2 years ago
parent
commit
0f9db4fa98
  1. 23
      public/index.html
  2. 21
      src/utils/dai-map.js
  3. 472
      src/utils/dai-map2.js
  4. 2
      src/views/modules/base/community/buildTable.vue
  5. 2
      src/views/modules/base/community/communityTable.vue
  6. 624
      src/views/modules/base/community/roomForm.vue
  7. 4
      src/views/modules/base/community/roomTable.vue

23
public/index.html

@ -37,16 +37,23 @@
document.getElementsByTagName('head')[0].appendChild(js); document.getElementsByTagName('head')[0].appendChild(js);
} }
if (SITE_CONFIG['nodeEnv'] == 'dev_tdt') {
toLoadJs('http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926') toLoadJs('https://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926')
} else if (SITE_CONFIG['nodeEnv'] == 'dev_sdtdt') {
toLoadJs('http://www.sdmap.gov.cn/api/olapi/ol/openlayers.js')
} else if (SITE_CONFIG['nodeEnv'] == 'yantai_zhengwu_prod') {
toLoadJs('http://59.206.203.34/api/olapi/ol/openlayers.js')
} else {
toLoadJs('https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO') toLoadJs('https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO')
toLoadJs('https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77') toLoadJs('https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77')
}
// if (SITE_CONFIG['nodeEnv'] == 'dev_tdt') {
// toLoadJs('http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926')
// } else if (SITE_CONFIG['nodeEnv'] == 'dev_sdtdt') {
// toLoadJs('http://www.sdmap.gov.cn/api/olapi/ol/openlayers.js')
// } else if (SITE_CONFIG['nodeEnv'] == 'prod') {
// toLoadJs('http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926')
// toLoadJs('https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO')
// toLoadJs('https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77')
// } else {
// toLoadJs('https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO')
// toLoadJs('https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77')
// }
console.log('============调试版本:1.0.3') console.log('============调试版本:1.0.3')
console.log('nodeEnv', window.SITE_CONFIG['nodeEnv']) console.log('nodeEnv', window.SITE_CONFIG['nodeEnv'])

21
src/utils/dai-map.js

@ -1,12 +1,14 @@
import nextTick from "dai-js/tools/nextTick"; import nextTick from "dai-js/tools/nextTick";
import { requestGet } from "@/js/dai/request"; import { requestGet } from "@/js/dai/request";
export const mapType = // export const mapType =
typeof window.TMap !== "undefined" // typeof window.TMap !== "undefined"
? "qq" // ? "qq"
: typeof window.T !== "undefined" // : typeof window.T !== "undefined"
? "td" // ? "td"
: "tdzw"; // : "tdzw";
export const mapType = "qq";
const urlSdtdt = (() => { const urlSdtdt = (() => {
if (window.SITE_CONFIG["nodeEnv"] == "dev_sdtdt") { if (window.SITE_CONFIG["nodeEnv"] == "dev_sdtdt") {
@ -293,7 +295,9 @@ export default function init(ele, position, params) {
this.geocoder = new TDMap.Geocoder(); // 新建一个正逆地址解析类 this.geocoder = new TDMap.Geocoder(); // 新建一个正逆地址解析类
this.getAddress = async function (lat, lng) { this.getAddress = async function (lat, lng) {
return new Promise((reslove) => { return new Promise((reslove) => {
this.geocoder.getLocation(new TDMap.LngLat(lng, lat), (result) => { this.geocoder.getLocation(
new TDMap.LngLat(lng, lat),
(result) => {
if (result) { if (result) {
console.log("this.geocoder.getLocation", result); console.log("this.geocoder.getLocation", result);
let status = result.getStatus(); let status = result.getStatus();
@ -309,7 +313,8 @@ export default function init(ele, position, params) {
error: "解析失败", error: "解析失败",
}); });
} }
}); }
);
}); });
}; };

472
src/utils/dai-map2.js

@ -0,0 +1,472 @@
import nextTick from "dai-js/tools/nextTick";
import { requestGet } from "@/js/dai/request";
// export const mapType =
// typeof window.TMap !== "undefined"
// ? "qq"
// : typeof window.T !== "undefined"
// ? "td"
// : "tdzw";
export const mapType = "td";
const urlSdtdt = (() => {
if (window.SITE_CONFIG["nodeEnv"] == "dev_sdtdt") {
return {
search: "https://service.sdmap.gov.cn/search",
geo: "https://service.sdmap.gov.cn/geodecode",
};
} else {
return {
search: "http://172.20.46.177/map_search_proxy/search",
geo: "http://172.20.46.177/epmet-map-proxy/GeoDecodeService.ashx",
};
}
})();
export const QQMap = window.TMap;
export const TDMap = window.T;
export function searchNearby(map, keyword) {
if (mapType == "qq") {
return new Promise((reslove) => {
const search = new QQMap.service.Search(map, { pageSize: 10 });
search
.searchNearby({
keyword,
radius: 1000,
autoExtend: true,
center: map.getCenter(),
})
.then((result) => {
let { data } = result;
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng },
address,
} = data[0];
reslove({
msg: "success",
data: {
lng,
lat,
address,
resultList: data.map((item, index) => {
const {
location: { lat, lng },
} = item;
item.lonlat = lng + " " + lat;
item.name = item.name || "";
item.hotPointID = "hotPointID" + index;
return item;
}),
},
});
} else {
reslove({
msg: "failed",
error: "未检索到相关位置坐标",
});
}
})
.catch((error) => {
reslove({
msg: "failed",
error,
});
});
});
} else if (mapType == "td") {
return new Promise(async (reslove) => {
const search = new TDMap.LocalSearch(map, { pageCapacity: 10 });
search.setQueryType(1);
search.searchNearby(keyword, map.getCenter(), 1000000000);
await nextTick(1000);
const result = search.getResults();
const data = result ? result.getPois() : null;
console.log("检索结果", data);
if (Array.isArray(data) && data.length > 0) {
const { lonlat, address, name } = data[0];
const lng = lonlat.split(" ")[0];
const lat = lonlat.split(" ")[1];
reslove({
msg: "success",
data: {
lng,
lat,
address: address + name,
resultList: data.map((item, index) => {
item.hotPointID = "hotPointID" + index;
return item;
}),
},
});
} else {
reslove({
msg: "failed",
error: "未检索到相关位置坐标",
});
}
});
} else if (mapType == "tdzw") {
return new Promise(async (reslove) => {
const center = map.getCenter();
const url = urlSdtdt.search;
const { status, result } = await requestGet(url, {
area: `CIRCLE(${center.lon} ${center.lat} 1000000)`,
words: keyword,
city: "烟台",
uid: "navinfo",
st: "LocalSearch",
tk: "e758167d5b90c351b70a979c0820840c",
});
if (
status == "ok" &&
result &&
Array.isArray(result.features) &&
result.features.length > 0
) {
const { lng, lat, address, name } = result.features[0];
reslove({
msg: "success",
data: {
lng,
lat,
address: address + name,
resultList: result.features.map((item, index) => {
const { lng, lat } = item;
item.lonlat = lng + " " + lat;
item.name = item.name || "";
item.hotPointID = "hotPointID" + index;
return item;
}),
},
});
} else {
reslove({
msg: "failed",
error: "未检索到相关位置坐标",
});
}
});
}
}
// 封装了地图相关函数,兼容天地图、腾讯地图常用api
export default function init(ele, position, params) {
this.mapType = mapType;
this.map = null;
this.marker = null;
this.markers = null;
this.getCenter = function () {
return {
lat: 0,
lng: 0,
};
};
this.setCenter = function (lat, lng) {};
this.setMarker = function (lat, lng, title) {};
this.getAddress = async function (lat, lng) {};
this.on = function (eventType, fn) {};
let { latitude, longitude } = position;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
longitude = 116.39743841556731;
}
latitude = parseFloat(latitude);
longitude = parseFloat(longitude);
if (mapType != "qq") {
if (typeof ele == "string") {
ele = document.getElementById("app");
}
let width = ele.offsetWidth;
let height = ele.offsetHeight;
if (height == 0) {
ele.style.height = width * 0.5 + "px";
}
}
if (mapType == "qq") {
let center = new QQMap.LatLng(latitude, longitude);
this.map = new QQMap.Map(ele, {
center,
...params,
});
this.markers = new QQMap.MultiMarker({
map: this.map,
geometries: [],
});
this.getCenter = function () {
const center = this.map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
return { lat, lng };
};
this.setCenter = function (lat, lng) {
this.map.setCenter(new QQMap.LatLng(lat, lng));
};
this.setMarker = function (lat, lng, title = "位置") {
this.markers.setGeometries([]);
this.markers.add([
{
id: "4",
styleId: "marker",
position: new QQMap.LatLng(lat, lng),
properties: {
title,
},
},
]);
};
this.geocoder = new QQMap.service.Geocoder(); // 新建一个正逆地址解析类
this.getAddress = async function (lat, lng) {
return new Promise((reslove) => {
this.geocoder
.getAddress({ location: new QQMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
.then((result) => {
reslove({
msg: "success",
data: {
address: result.result.address,
},
});
})
.catch((error) => {
reslove({
msg: "failed",
error,
});
});
});
};
this.on = function (eventType, fn) {
// 加载天地图底图
var imageTileLayer = new QQMap.ImageTileLayer({
getTileUrl: function (x, y, z) {
return `http://t4.tianditu.com/DataServer?T=img_w&tk=8a08c117ab9ee45d508686b01cc8d397&x=${x}&y=${y}&l=${z}`;
},
tileSize: 256, //瓦片像素尺寸
minZoom: 6, //显示自定义瓦片的最小级别
maxZoom: 18, //显示自定义瓦片的最大级别
visible: true, //是否可见
zIndex: 5000, //层级高度(z轴)
opacity: 0.95, //图层透明度:1不透明,0为全透明
map: this.map, //设置图层显示到哪个地图实例中
});
if (eventType == "dragend") {
this.map.on("moveend", (e) => {
// console.log("dragend", e);
if (e && e.originalEvent) {
fn(e);
}
});
} else {
this.map.on(eventType, fn);
}
};
} else if (mapType == "td") {
var imageURL =
"http://t5.tianditu.gov.cn/img_w/wmts?" +
"SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
"&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=8a08c117ab9ee45d508686b01cc8d397";
var imageURL2 =
"http://t6.tianditu.gov.cn/cia_w/wmts?" +
"SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
"&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=8a08c117ab9ee45d508686b01cc8d397";
//创建自定义图层对象
let lay = new TDMap.TileLayer(imageURL, { minZoom: 1, maxZoom: 18 });
let lay2 = new TDMap.TileLayer(imageURL2, { minZoom: 1, maxZoom: 18 });
let center = new TDMap.LngLat(longitude, latitude);
this.map = new TDMap.Map(ele, {
center,
...params,
layers: [lay, lay2],
});
this.getCenter = function () {
const center = this.map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
return { lat, lng };
};
this.setCenter = function (lat, lng) {
this.map.panTo(new TDMap.LngLat(lng, lat));
};
this.setMarker = function (lat, lng, title = "位置") {
let lnglat = new TDMap.LngLat(lng, lat);
if (!this.marker) {
this.marker = new TDMap.Marker(lnglat, {
title,
});
this.map.addOverLay(this.marker);
} else {
this.marker.setLngLat(lnglat);
}
};
this.geocoder = new TDMap.Geocoder(); // 新建一个正逆地址解析类
this.getAddress = async function (lat, lng) {
return new Promise((reslove) => {
this.geocoder.getLocation(
new TDMap.LngLat(lng, lat),
(result) => {
if (result) {
console.log("this.geocoder.getLocation", result);
let status = result.getStatus();
reslove({
msg: "success",
data: {
address: result.getAddress(),
},
});
} else {
reslove({
msg: "failed",
error: "解析失败",
});
}
}
);
});
};
this.on = function (eventType, fn) {
if (eventType == "dragend") {
this.map.on("dragend", (e) => {
console.log("dragend", e);
fn(e);
});
} else {
this.map.on(eventType, fn);
}
};
} else if (mapType == "tdzw") {
this.map = new OpenLayers.Map(ele, {
allOverlays: true,
numZoomLevels: 19,
displayProjection: "EPSG:4490",
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.ArgParser(),
new OpenLayers.Control.Attribution(),
],
});
this.map.addLayer(new SDTDTLayer());
this.getCenter = function () {
const center = this.map.getCenter();
const lat = center.lat;
const lng = center.lon;
return { lat, lng };
};
this.setCenter = function (lat, lng) {
lat = parseFloat(lat);
lng = parseFloat(lng);
this.map.setCenter(new OpenLayers.LonLat(lng, lat), 16);
};
this.setCenter(latitude, longitude);
this.setMarker = function (lat, lng, title = "位置") {
lat = parseFloat(lat);
lng = parseFloat(lng);
const style = {
externalGraphic: require("@/assets/img/common/map-poi.png"),
graphicWidth: 32,
graphicHeight: 32,
};
if (!this.marker) {
//创建矢量图层
this.markerLayer = new OpenLayers.Layer.Vector("graphicLayer", {
style: OpenLayers.Util.extend(
{},
OpenLayers.Feature.Vector.style["default"]
),
});
this.map.addLayer(this.markerLayer);
this.marker = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(lng, lat),
null,
style
);
this.markerLayer.addFeatures([this.marker]);
} else {
console.log("this marker", this.marker);
this.marker.geometry.x = 0;
this.marker.geometry.y = 0;
this.marker.geometry.destroy();
this.markerLayer.removeFeatures([this.marker]);
this.marker = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(lng, lat),
null,
style
);
// this.markerLayer.addFeatures([this.marker]);
this.markerLayer.redraw();
console.log("redraw", this.marker);
}
};
this.getAddress = async function (lat, lng) {
return new Promise(async (reslove) => {
const url = urlSdtdt.geo;
const { status, result } = await requestGet(url, {
point: lng + "," + lat,
type: "11",
st: "Rgc2",
output: "json",
// tk: "e758167d5b90c351b70a979c0820840c",
});
if (status == "ok" && result.address) {
reslove({
msg: "success",
data: {
address: result.address,
},
});
} else {
reslove({
msg: "failed",
error: "解析失败",
});
}
});
};
this.on = function (eventType, fn) {
if (eventType == "dragend") {
this.map.events.register("moveend", null, (e) => {
console.log("dragend", e);
fn(e);
});
} else {
this.map.events.register(eventType, null, moveendHandler);
}
};
}
this.searchNearby = async function (keyword) {
const ret = await searchNearby(this.map, keyword);
return ret;
};
return this;
}

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

@ -391,7 +391,7 @@ export default {
item.sort = parseInt(item.sort) || 0; item.sort = parseInt(item.sort) || 0;
item.sort = item.sort.toFixed(2) item.sort = item.sort.toFixed(2)
item.isChange = false item.isChange = false
if (item.agencyId === this.staffAgencyId) { if (true || item.agencyId === this.staffAgencyId) {
item.showBtn = true item.showBtn = true
this.validTableDataNum++ this.validTableDataNum++
} else { } else {

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

@ -387,7 +387,7 @@ export default {
this.validTableDataNum = 0 this.validTableDataNum = 0
this.total = data.total this.total = data.total
data.list.forEach(item => { data.list.forEach(item => {
if (item.agencyId === this.staffAgencyId) { if (true || item.agencyId === this.staffAgencyId) {
item.showBtn = true item.showBtn = true
this.validTableDataNum++ this.validTableDataNum++
} else { } else {

624
src/views/modules/base/community/roomForm.vue

@ -1,78 +1,111 @@
<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="false" :inline="false"
: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.neighborHoodName }}-{{agencyObj.label}}</span> >
<span
>{{ agencyObj.neighborHoodName }}-{{
agencyObj.label
}}</span
>
</el-form-item> </el-form-item>
<el-form-item label="单元号" <el-form-item
label="单元号"
prop="buildingUnitId" prop="buildingUnitId"
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.buildingUnitId" v-model="dataForm.buildingUnitId"
placeholder="请选择" placeholder="请选择"
clearable> clearable
<el-option v-for="item in unitList" >
<el-option
v-for="item in unitList"
:key="item.id" :key="item.id"
:label="item.unitName" :label="item.unitName"
:value="item.id"> :value="item.id"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="门牌号" <el-form-item
label="门牌号"
prop="doorName" prop="doorName"
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.doorName"> v-model="dataForm.doorName"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="formType != 'detail'" <el-form-item
v-if="formType != 'detail'"
label="房屋编码" 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="formType === 'detail'"> <div v-if="formType === 'detail'">
<el-form-item label="房屋编码" <el-form-item
label="房屋编码"
prop="houseCode" prop="houseCode"
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="30" maxlength="30"
v-model="dataForm.houseCode"> v-model="dataForm.houseCode"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<div v-if="dataForm.houseQrcodeUrl" <div
style="display: flex;flex-direction: column;"> v-if="dataForm.houseQrcodeUrl"
<img style="margin-left: 70px;width: 200px;" style="display: flex; flex-direction: column"
:src="dataForm.houseQrcodeUrl"> >
<a style="margin-left: 80px" <img
style="margin-left: 70px; width: 200px"
:src="dataForm.houseQrcodeUrl"
/>
<a
style="margin-left: 80px"
:href="dataForm.houseQrcodeUrl" :href="dataForm.houseQrcodeUrl"
target="_blank">下载</a> target="_blank"
>下载</a
>
</div> </div>
</div> </div>
<!-- <el-form-item label="居住人数" <!-- <el-form-item label="居住人数"
@ -85,24 +118,26 @@
: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="houseType" prop="houseType"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
>
<el-radio-group v-model="houseType"> <el-radio-group v-model="houseType">
<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>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="房屋用途" <el-form-item
label="房屋用途"
prop="purpose" prop="purpose"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
>
<el-radio-group v-model="purpose"> <el-radio-group v-model="purpose">
<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>
@ -113,131 +148,183 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="房屋状态" <el-form-item
label="房屋状态"
prop="rentFlag" prop="rentFlag"
label-width="150px" label-width="150px"
style="display: block"> style="display: block"
>
<el-radio-group v-model="rentFlag"> <el-radio-group v-model="rentFlag">
<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="0">自住</el-radio> <el-radio :label="0">自住</el-radio>
<el-radio :label="3">未出售</el-radio> <el-radio :label="3">未出售</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="房主姓名" <el-form-item
label="房主姓名"
prop="ownerName" prop="ownerName"
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="30" maxlength="30"
placeholder="请输入房主姓名" placeholder="请输入房主姓名"
v-model="dataForm.ownerName"> v-model="dataForm.ownerName"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系方式" <el-form-item
label="联系方式"
prop="ownerPhone" prop="ownerPhone"
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.ownerPhone"> v-model="dataForm.ownerPhone"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="房主身份证" <el-form-item
label="房主身份证"
prop="ownerIdCard" prop="ownerIdCard"
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.ownerIdCard"> v-model="dataForm.ownerIdCard"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注"
<el-form-item
label="地图位置"
prop="longitude"
label-width="150px"
style="display: block"
>
<div style="width: 500px">
<el-select
v-model="searchValue"
filterable
style="width: 500px"
remote
: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>
<div id="map" class="div_map"></div>
</div>
</el-form-item>
<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"
maxlength="30" maxlength="30"
placeholder="请输入备注" placeholder="请输入备注"
v-model="dataForm.remark"> v-model="dataForm.remark"
>
</el-input> </el-input>
</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, requestGet } from '@/js/dai/request' import { requestPost, requestGet } from "@/js/dai/request";
import daiMap from "@/utils/dai-map2";
var map;
let loading; //
let loading //
export default { export default {
data() { data() {
return { return {
formType: 'add', // addeditdetail formType: "add", // addeditdetail
btnDisable: false, btnDisable: false,
unitList: [], unitList: [],
houseId: '', //ID houseId: "", //ID
houseType: '1', houseType: "1",
purpose: '1', purpose: "1",
rentFlag: 0, rentFlag: 0,
dataForm: { dataForm: {
neighborHoodId: '', // ID neighborHoodId: "", // ID
buildingId: '',//ID buildingId: "", //ID
buildingUnitId: '',//ID buildingUnitId: "", //ID
doorName: '',// doorName: "", //
houseType: '',// houseType: "", //
purpose: '',// purpose: "", //
rentFlag: 0, //10 12 0 rentFlag: 0, //10 12 0
ownerPhone: '', // ownerPhone: "", //
ownerName: '', // ownerName: "", //
ownerIdCard: '', // ownerIdCard: "", //
remark: '', remark: "",
latitude: "",
longitude: "",
// realPerson: 0, // realPerson: 0,
coding: '', coding: "",
sysCoding: '' sysCoding: "",
}, },
keyWords: '', keyWords: "",
agencyObj: {}, agencyObj: {},
} searchOptions: [],
}, searchValue: "",
components: {}, loading: false,
mounted () {
mapLoaded: false,
};
}, },
components: {},
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;
this.formType = type this.formType = type;
console.log('agencyObj-----', agencyObj) console.log("agencyObj-----", agencyObj);
if (row) { if (row) {
this.houseId = row.houseId;
this.houseId = row.houseId await this.loadHouseInfo();
await this.loadHouseInfo()
// this.dataForm = JSON.parse(JSON.stringify(row)) // this.dataForm = JSON.parse(JSON.stringify(row))
// this.houseId = this.dataForm.houseId // this.houseId = this.dataForm.houseId
@ -246,221 +333,334 @@ export default {
// this.houseType = this.dataForm.houseTypeKey // this.houseType = this.dataForm.houseTypeKey
// this.purpose = this.dataForm.purposeKey // this.purpose = this.dataForm.purposeKey
// this.rentFlag = parseInt(this.dataForm.rentFlagKey) // this.rentFlag = parseInt(this.dataForm.rentFlagKey)
} else {
this.dataForm.neighborHoodId = this.agencyObj.neighborHoodId;
this.dataForm.buildingId = this.agencyObj.id;
}
let { latitude, longitude } = this.$store.state.user;
latitude = this.dataForm.latitude || latitude;
longitude = this.dataForm.longitude || longitude;
if (!this.mapLoaded) {
this.initMap(latitude || latitude, longitude);
this.mapLoaded = true;
} else { } else {
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
}
await this.loadUnitList();
},
this.dataForm.neighborHoodId = this.agencyObj.neighborHoodId // init
this.dataForm.buildingId = this.agencyObj.id initMap(latitude, longitude) {
map = new daiMap(
document.getElementById("map"),
{ latitude, longitude },
{
zoom: 18, //
// pitch: 43.5, //
// rotation: 45, //
// layers: "img_c,cva_c",
} }
);
//
map.on("dragend", (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.setMarker(latitude, longitude);
},
async handleMoveCenter(lat, lng) {
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
map.setMarker(lat, lng);
await this.loadUnitList() 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 !== "") {
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",
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 loadHouseInfo() { async loadHouseInfo() {
const url = "/gov/org/ichouse/" + this.houseId;
const url = "/gov/org/ichouse/" + this.houseId const { data, code, msg } = await requestGet(url);
const { data, code, msg } = await requestGet(url)
if (code === 0) { if (code === 0) {
// debugger // debugger
this.dataForm = { ...data } this.dataForm = { ...data };
this.houseType = this.dataForm.houseType
this.purpose = this.dataForm.purpose
this.rentFlag = parseInt(this.dataForm.rentFlag)
this.houseType = this.dataForm.houseType;
this.purpose = this.dataForm.purpose;
this.rentFlag = parseInt(this.dataForm.rentFlag);
} else { } else {
this.$message.error(msg) this.$message.error(msg);
} }
}, },
// //
async loadUnitList() { async loadUnitList() {
const url = '/gov/org/building/buildingunitlist' const url = "/gov/org/building/buildingunitlist";
let params = { let params = {
buildingId: this.dataForm.buildingId buildingId: this.dataForm.buildingId,
} };
const { data, code, msg } = await requestPost(url, params) const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
this.unitList = data this.unitList = data;
} else { } else {
this.$message.error(msg) this.$message.error(msg);
} }
}, },
async handleCode() { async handleCode() {
if (!this.dataForm.buildingUnitId) return this.$message.error('请选择单元') if (!this.dataForm.buildingUnitId)
return this.$message.error("请选择单元");
const { data, code, msg } = await requestPost( const { data, code, msg } = await requestPost(
"/gov/org/houseInformation/getHouseCoding/" + this.dataForm.buildingUnitId); "/gov/org/houseInformation/getHouseCoding/" +
this.dataForm.buildingUnitId
);
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 handleComfirm() { async handleComfirm() {
this.btnDisable = true this.btnDisable = true;
setTimeout(() => { setTimeout(() => {
this.btnDisable = false this.btnDisable = false;
}, 10000) }, 10000);
this.dataForm.houseType = this.houseType this.dataForm.houseType = this.houseType;
this.dataForm.purpose = this.purpose this.dataForm.purpose = this.purpose;
this.dataForm.rentFlag = this.rentFlag this.dataForm.rentFlag = this.rentFlag;
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.addRoom() this.addRoom();
} }
});
})
}, },
async addRoom() { async addRoom() {
const regCard = /(^\d{15}$)|(^\d{17}(\d|X)$)/; //1518151817X const regCard = /(^\d{15}$)|(^\d{17}(\d|X)$)/; //1518151817X
if (this.dataForm.ownerIdCard && regCard.test(this.dataForm.ownerIdCard) === false) { if (
this.btnDisable = false this.dataForm.ownerIdCard &&
regCard.test(this.dataForm.ownerIdCard) === false
) {
this.btnDisable = false;
this.$message({ this.$message({
type: 'warning', type: "warning",
message: '请输入正确的身份证号码' message: "请输入正确的身份证号码",
}) });
return false; return false;
} }
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.ownerPhone && regPhone.test(this.dataForm.ownerPhone) === false) { if (
this.btnDisable = false this.dataForm.ownerPhone &&
regPhone.test(this.dataForm.ownerPhone) === 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/house/houseadd' url = "/gov/org/house/houseadd";
} else { } else {
url = '/gov/org/house/houseupdate' url = "/gov/org/house/houseupdate";
this.dataForm.houseId = this.houseId this.dataForm.houseId = this.houseId;
} }
const { data, code, msg } = await requestPost(url, this.dataForm) const { data, code, msg } = await requestPost(url, this.dataForm);
this.btnDisable = false this.btnDisable = false;
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");
} else { } else {
this.$message.error(msg);
this.$message.error(msg)
} }
}, },
handleCancle() { handleCancle() {
this.resetData() this.resetData();
this.$emit('dialogCancle') this.$emit("dialogCancle");
}, },
resetData() { resetData() {
this.houseId = '' //ID this.houseId = ""; //ID
this.houseType = '1' this.houseType = "1";
this.purpose = '1' this.purpose = "1";
this.rentFlag = 0 this.rentFlag = 0;
this.dataForm = { this.dataForm = {
neighborHoodId: '', // ID neighborHoodId: "", // ID
buildingId: '',//ID buildingId: "", //ID
buildingUnitId: '',//ID buildingUnitId: "", //ID
doorName: '',// doorName: "", //
houseType: '1',// houseType: "1", //
purpose: '1',// purpose: "1", //
rentFlag: 0, //10 rentFlag: 0, //10
ownerPhone: '', // ownerPhone: "", //
ownerName: '', // ownerName: "", //
ownerIdCard: '', // ownerIdCard: "", //
remark: '', // remark: "", //
coding: '', latitude: "",
sysCoding: '' longitude: "",
} coding: "",
sysCoding: "",
};
}, },
// //
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 {
buildingUnitId: [ buildingUnitId: [
{ required: true, message: '所属单元不能为空', trigger: 'blur' }, {
required: true,
message: "所属单元不能为空",
trigger: "blur",
},
], ],
doorName: [ doorName: [
{ required: true, message: '门牌号不能为空', trigger: 'blur' } {
required: true,
message: "门牌号不能为空",
trigger: "blur",
},
], ],
coding: [ coding: [
{ required: true, message: '房屋编码不能为空', trigger: 'blur' } {
required: true,
message: "房屋编码不能为空",
trigger: "blur",
},
], ],
houseType: [ houseType: [
{ required: true, message: '房屋类型不能为空', trigger: 'blur' } {
required: true,
message: "房屋类型不能为空",
trigger: "blur",
},
], ],
purpose: [ purpose: [
{ required: true, message: '房屋用途不能为空', trigger: 'blur' } {
required: true,
message: "房屋用途不能为空",
trigger: "blur",
},
], ],
rentFlag: [ rentFlag: [
{ required: true, message: '是否出租不能为空', trigger: 'blur' } {
], required: true,
ownerPhone: [ message: "是否出租不能为空",
{ required: false } trigger: "blur",
], },
ownerName: [
{ required: false }
],
ownerIdCard: [
{ required: false }
],
remark: [
{ required: false }
], ],
} ownerPhone: [{ required: false }],
ownerName: [{ required: false }],
ownerIdCard: [{ required: false }],
remark: [{ required: false }],
};
}, },
}, },
props: { props: {
view_real_data: {// view_real_data: {
//
type: Boolean, type: Boolean,
default: false, default: false,
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/assets/scss/modules/visual/communityManageForm.scss"; @import "@/assets/scss/modules/visual/communityManageForm.scss";

4
src/views/modules/base/community/roomTable.vue

@ -189,6 +189,7 @@
width="900px" width="900px"
top="5vh" top="5vh"
class="dialog-h" class="dialog-h"
v-if="formShow"
@closed="diaClose"> @closed="diaClose">
<room-form ref="ref_form" <room-form ref="ref_form"
:view_real_data="btnAuths.ic_house_view_real_data" :view_real_data="btnAuths.ic_house_view_real_data"
@ -223,6 +224,7 @@ import { Loading } from "element-ui"; // 引入Loading服务
import baobiao from "@/views/modules/cpts/baobiao"; import baobiao from "@/views/modules/cpts/baobiao";
let loading; // let loading; //
export default { export default {
data () { data () {
return { return {
@ -465,7 +467,7 @@ export default {
item.unitNum + item.unitNum +
item.doorName; item.doorName;
if (item.agencyId === this.staffAgencyId) { if (true || item.agencyId === this.staffAgencyId) {
item.showBtn = true; item.showBtn = true;
this.validTableDataNum++; this.validTableDataNum++;
} else { } else {

Loading…
Cancel
Save