13 changed files with 6274 additions and 136 deletions
@ -0,0 +1,271 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
|
|||
<div v-if="initLoading" |
|||
class="m-row"> |
|||
<div class="m-info"> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">所属小区:</span> |
|||
<span>{{ agencyObj.agencyName }}—{{ agencyObj.gridName }}—{{ agencyObj.label }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">楼栋名称:</span> |
|||
<span>{{ dataForm.buildingName?dataForm.buildingName:'--' }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">楼栋编码:</span> |
|||
<span>{{ dataForm.coding?dataForm.coding:'--'}}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">楼栋类型:</span> |
|||
<span>{{ dataForm.typeName?dataForm.typeName:'--'}}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">单元数:</span> |
|||
<span>{{dataForm.totalUnitNum?dataForm.totalUnitNum:0 }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">层数:</span> |
|||
<span>{{dataForm.totalFloorNum?dataForm.totalFloorNum:0 }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">总户数:</span> |
|||
<span>{{dataForm.totalHouseNum?dataForm.totalHouseNum:0 }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">人口数:</span> |
|||
<span>{{dataForm.realPerson?dataForm.realPerson:0 }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">楼长姓名:</span> |
|||
<span>{{ dataForm.buildingLeaderName?dataForm.buildingLeaderName:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">楼长电话:</span> |
|||
<span>{{ dataForm.buildingLeaderMobile?dataForm.buildingLeaderMobile:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">详细地址:</span> |
|||
<span>{{ dataForm.coordinatePosition?dataForm.coordinatePosition:'--' }}</span> |
|||
</div> |
|||
|
|||
<div v-show="dataForm.coordinatePosition" |
|||
class="info-prop"> |
|||
<span class="info-title-2">地图位置:</span> |
|||
<div class="div_map"> |
|||
|
|||
<div id="app_detail_build"></div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="div-btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">关 闭</el-button> |
|||
|
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from '@/js/dai/request' |
|||
import daiMap from "@/utils/dai-map"; |
|||
var map |
|||
var search |
|||
var markers |
|||
var infoWindowList |
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
|
|||
btnDisable: false, |
|||
initLoading: false, |
|||
|
|||
dataForm: { |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
neighborHoodId: '',//所属小区id |
|||
buildingName: '',//房屋名称 |
|||
// sort: 0,//排序 |
|||
totalUnitNum: 1,//单元数 |
|||
totalFloorNum: 0,//层数 |
|||
totalHouseNum: 0,//总户数 |
|||
realPerson: 0, |
|||
buildingLeaderName: '',//楼长姓名 |
|||
buildingLeaderMobile: '',//楼长电话 |
|||
type: '',//房屋类型 |
|||
coordinatePosition: '', |
|||
sysCoding: '', |
|||
coding: '', |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '' //纬度 |
|||
}, |
|||
|
|||
agencyObj: {}, |
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
handleCancle () { |
|||
this.diaDestroy() |
|||
this.$emit('diaDetailClose') |
|||
|
|||
}, |
|||
diaDestroy () { |
|||
if (map) { |
|||
// map.destroy() |
|||
} |
|||
}, |
|||
async initForm (row, agencyObj) { |
|||
|
|||
this.dataForm = JSON.parse(JSON.stringify(row)) |
|||
this.agencyObj = agencyObj |
|||
|
|||
this.initLoading = true |
|||
let { latitude, longitude } = this.$store.state.user; |
|||
console.log('lat' + latitude + ',lon' + longitude) |
|||
if (this.dataForm.latitude && this.dataForm.longitude) { |
|||
latitude = this.dataForm.latitude |
|||
longitude = this.dataForm.longitude |
|||
} |
|||
if (!latitude || latitude == "" || latitude == "0") { |
|||
latitude = 39.9088810666821; |
|||
longitude = 116.39743841556731; |
|||
} |
|||
if (this.dataForm.coordinatePosition) { |
|||
this.$nextTick(() => { |
|||
if (!map) { |
|||
this.initMap(latitude, longitude) |
|||
} else { |
|||
map.setCenter(latitude, longitude); |
|||
map.setMarker(latitude, longitude); |
|||
} |
|||
|
|||
}) |
|||
} |
|||
}, |
|||
|
|||
|
|||
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|||
initMap (latitude, longitude) { |
|||
|
|||
map = new daiMap( |
|||
document.getElementById("app_detail_build"), |
|||
{ latitude, longitude }, |
|||
{ |
|||
zoom: 16.2, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
rotation: 45, // 设置地图旋转角度 |
|||
} |
|||
); |
|||
|
|||
// // 监听地图平移结束 |
|||
// map.on("dragend", (e) => { |
|||
// this.handleMoveCenter(e); |
|||
// }); |
|||
|
|||
map.setCenter(latitude, longitude); |
|||
map.setMarker(latitude, longitude); |
|||
|
|||
}, |
|||
|
|||
resetData () { |
|||
|
|||
this.buildType = '1' |
|||
this.dataForm = { |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
neighborHoodId: '',//所属小区id |
|||
buildingName: '',//房屋名称 |
|||
// sort: 0,//排序 |
|||
totalUnitNum: 1,//单元数 |
|||
totalFloorNum: 0,//层数 |
|||
totalHouseNum: 0,//总户数 |
|||
realPerson: 0, |
|||
buildingLeaderName: '',//楼长姓名 |
|||
buildingLeaderMobile: '',//楼长电话 |
|||
type: '',//房屋类型 |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '', //纬度 |
|||
coding: '', |
|||
sysCoding: '', |
|||
coordinatePosition: '' |
|||
} |
|||
}, |
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
buildingName: [ |
|||
{ required: true, message: '楼栋名称不能为空', trigger: 'blur' }, |
|||
{ |
|||
min: 1, |
|||
max: 10, |
|||
message: '小区名称长度在 1 到 10个字符', |
|||
trigger: 'blur' |
|||
} |
|||
], |
|||
type: [ |
|||
{ required: true, message: '楼栋类型不能为空', trigger: 'blur' } |
|||
], |
|||
totalUnitNum: [ |
|||
{ required: true, message: '单元数不能为空', trigger: 'blur' } |
|||
], |
|||
coding: [ |
|||
{ required: true, message: '楼栋编码不能为空', trigger: 'blur' } |
|||
] |
|||
// totalFloorNum: [ |
|||
// { required: true, message: '层数不能为空', trigger: 'blur' } |
|||
// ], |
|||
// totalHouseNum: [ |
|||
// { required: true, message: '户数不能为空', trigger: 'blur' } |
|||
// ], |
|||
// longitude: [ |
|||
// { required: true, message: '坐标不能为空', trigger: 'blur' } |
|||
// ], |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
props: {} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/management/detail-main.scss"; |
|||
</style> |
|||
@ -0,0 +1,492 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
|
|||
<el-form ref="ref_form" |
|||
:inline="true" |
|||
:model="dataForm" |
|||
:rules="dataRule" |
|||
:disabled="formType === 'detail'" |
|||
class="form"> |
|||
<el-form-item label="所属小区" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<span>{{ agencyObj.agencyName }}—{{ agencyObj.gridName }}—{{ agencyObj.label }}</span> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="楼栋名称" |
|||
prop="buildingName" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
maxlength="10" |
|||
placeholder="请输入楼栋名称" |
|||
v-model="dataForm.buildingName"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<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-button style="margin-left: 10px" |
|||
type="primary" |
|||
size="small" |
|||
@click="handleCode">生成</el-button> |
|||
</el-form-item> |
|||
<el-form-item label="楼栋类型" |
|||
prop="type" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-radio-group v-model="buildType"> |
|||
|
|||
<el-radio :label="'1'">商品房</el-radio> |
|||
<el-radio :label="'2'">自建房</el-radio> |
|||
<el-radio :label="'3'">别墅</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
<!-- <el-form-item label="排序" |
|||
prop="sort" |
|||
style="display: block" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_1" |
|||
v-model="dataForm.sort" |
|||
label="排序"></el-input-number> |
|||
</el-form-item> --> |
|||
<el-form-item label="单元数" |
|||
style="display: block" |
|||
prop="totalUnitNum" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_4" |
|||
v-model="dataForm.totalUnitNum" |
|||
:min="1" |
|||
:max="9999" |
|||
label="单元数"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="层数" |
|||
style="display: block" |
|||
prop="totalFloorNum" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_4" |
|||
v-model="dataForm.totalFloorNum" |
|||
:min="0" |
|||
:max="9999" |
|||
label="层数"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="总户数" |
|||
style="display: block" |
|||
prop="totalHouseNum" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_4" |
|||
v-model="dataForm.totalHouseNum" |
|||
:min="0" |
|||
:max="9999" |
|||
label="总户数"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="人口数" |
|||
style="display: block" |
|||
prop="realPerson" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_4" |
|||
v-model="dataForm.realPerson" |
|||
:min="0" |
|||
:max="9999" |
|||
label="人口数"></el-input-number> |
|||
</el-form-item> |
|||
<el-form-item label="楼长姓名" |
|||
prop="buildingLeaderName" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
placeholder="请输入楼长姓名" |
|||
v-model="dataForm.buildingLeaderName"> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="楼长电话" |
|||
prop="buildingLeaderMobile" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
type='number' |
|||
placeholder="请输入楼长电话" |
|||
v-model="dataForm.buildingLeaderMobile"> |
|||
</el-input> |
|||
</el-form-item> |
|||
|
|||
<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="app_build" |
|||
class="div_map"></div> |
|||
</div> |
|||
</el-form-item> |
|||
<el-form-item label="楼栋地址" |
|||
prop="coordinatePosition" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<!-- <span>{{ dataForm.coordinatePosition }}</span> --> |
|||
<el-input class="item_width_1" |
|||
placeholder="请选择楼栋地址" |
|||
v-model="dataForm.coordinatePosition" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">取 消</el-button> |
|||
<el-button size="small" |
|||
v-if="formType != 'detail'" |
|||
type="primary" |
|||
:disabled="btnDisable" |
|||
@click="handleComfirm">确 定</el-button> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from '@/js/dai/request' |
|||
import daiMap from "@/utils/dai-map"; |
|||
var map |
|||
var search |
|||
var markers |
|||
var infoWindowList |
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
searchOptions: [], |
|||
searchValue: '', |
|||
resultList: [], |
|||
loading: false, |
|||
|
|||
btnDisable: false, |
|||
buildingId: '', //楼栋ID |
|||
buildType: "1", |
|||
dataForm: { |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
neighborHoodId: '',//所属小区id |
|||
buildingName: '',//房屋名称 |
|||
// sort: 0,//排序 |
|||
totalUnitNum: 1,//单元数 |
|||
totalFloorNum: 0,//层数 |
|||
totalHouseNum: 0,//总户数 |
|||
realPerson: 0, |
|||
buildingLeaderName: '',//楼长姓名 |
|||
buildingLeaderMobile: '',//楼长电话 |
|||
type: '',//房屋类型 |
|||
coordinatePosition: '', |
|||
sysCoding: '', |
|||
coding: '', |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '' //纬度 |
|||
}, |
|||
|
|||
keyWords: '', |
|||
agencyObj: {}, |
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
async initForm (type, row, agencyObj) { |
|||
this.$refs.ref_form.resetFields(); |
|||
let { latitude, longitude } = this.$store.state.user; |
|||
this.agencyObj = agencyObj |
|||
this.dataForm.agencyId = agencyObj.agencyId |
|||
this.dataForm.gridId = agencyObj.gridId |
|||
this.dataForm.neighborHoodId = agencyObj.id |
|||
|
|||
this.formType = type |
|||
if (row) { |
|||
this.dataForm = JSON.parse(JSON.stringify(row)) |
|||
this.buildingId = this.dataForm.buildingId |
|||
// this.buildType = this.dataForm.buildingTypeKey |
|||
this.buildType = this.dataForm.type |
|||
|
|||
} else { |
|||
this.dataForm.latitude = latitude |
|||
this.dataForm.longitude = longitude |
|||
} |
|||
this.$nextTick(() => { |
|||
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); |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
async handleComfirm () { |
|||
this.btnDisable = true |
|||
setTimeout(() => { |
|||
this.btnDisable = false |
|||
}, 10000) |
|||
this.dataForm.type = this.buildType |
|||
this.$refs['ref_form'].validate((valid, messageObj) => { |
|||
if (!valid) { |
|||
this.btnDisable = false |
|||
app.util.validateRule(messageObj) |
|||
} else { |
|||
this.addBuild() |
|||
} |
|||
|
|||
}) |
|||
}, |
|||
async handleCode () { |
|||
const { data, code, msg } = await requestPost( |
|||
"/gov/org/houseInformation/getBuildingCoding/" + this.dataForm.neighborHoodId); |
|||
console.log('data----', data) |
|||
console.log('code----', code) |
|||
console.log('msg----', msg) |
|||
if (msg == "success" && code == 0) { |
|||
this.dataForm.coding = data.coding |
|||
this.dataForm.sysCoding = data.sysCoding |
|||
|
|||
} |
|||
}, |
|||
async addBuild () { |
|||
if (this.dataForm.buildingLeaderMobile) { |
|||
const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/; //手机号码 |
|||
if (this.dataForm.buildingLeaderMobile && regPhone.test(this.dataForm.buildingLeaderMobile) === false) { |
|||
this.btnDisable = false |
|||
this.$message({ |
|||
type: 'warning', |
|||
message: '请输入正确的楼主手机' |
|||
}) |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
let url = '' |
|||
if (this.formType === 'add') { |
|||
url = '/gov/org/building/buildingadd' |
|||
} else { |
|||
url = '/gov/org/building/buildingupdate' |
|||
|
|||
this.dataForm.buildingId = this.buildingId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.dataForm) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '操作成功' |
|||
}) |
|||
this.resetData() |
|||
this.btnDisable = false |
|||
this.$emit('dialogOk') |
|||
|
|||
} else { |
|||
this.btnDisable = false |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleCancle () { |
|||
this.resetData() |
|||
this.$emit('dialogCancle') |
|||
|
|||
}, |
|||
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|||
initMap (latitude, longitude) { |
|||
|
|||
map = new daiMap( |
|||
document.getElementById("app_build"), |
|||
{ latitude, longitude }, |
|||
{ |
|||
zoom: 16.2, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
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.coordinatePosition = 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.coordinatePosition = selPosition.address + selPosition.name |
|||
}, |
|||
|
|||
|
|||
resetData () { |
|||
this.searchValue = '' |
|||
this.searchOptions = [] |
|||
this.resultList = [] |
|||
this.buildingId = '' //楼栋ID |
|||
this.buildType = '1' |
|||
this.dataForm = { |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
neighborHoodId: '',//所属小区id |
|||
buildingName: '',//房屋名称 |
|||
// sort: 0,//排序 |
|||
totalUnitNum: 1,//单元数 |
|||
totalFloorNum: 0,//层数 |
|||
totalHouseNum: 0,//总户数 |
|||
realPerson: 0, |
|||
buildingLeaderName: '',//楼长姓名 |
|||
buildingLeaderMobile: '',//楼长电话 |
|||
type: '',//房屋类型 |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '', //纬度 |
|||
coding: '', |
|||
sysCoding: '', |
|||
coordinatePosition: '' |
|||
} |
|||
}, |
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
buildingName: [ |
|||
{ required: true, message: '楼栋名称不能为空', trigger: 'blur' }, |
|||
{ |
|||
min: 1, |
|||
max: 10, |
|||
message: '小区名称长度在 1 到 10个字符', |
|||
trigger: 'blur' |
|||
} |
|||
], |
|||
type: [ |
|||
{ required: true, message: '楼栋类型不能为空', trigger: 'blur' } |
|||
], |
|||
totalUnitNum: [ |
|||
{ required: true, message: '单元数不能为空', trigger: 'blur' } |
|||
], |
|||
coding: [ |
|||
{ required: true, message: '楼栋编码不能为空', trigger: 'blur' } |
|||
] |
|||
// totalFloorNum: [ |
|||
// { required: true, message: '层数不能为空', trigger: 'blur' } |
|||
// ], |
|||
// totalHouseNum: [ |
|||
// { required: true, message: '户数不能为空', trigger: 'blur' } |
|||
// ], |
|||
// longitude: [ |
|||
// { required: true, message: '坐标不能为空', trigger: 'blur' } |
|||
// ], |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
props: {} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManageForm.scss"; |
|||
</style> |
|||
@ -0,0 +1,886 @@ |
|||
<template> |
|||
<div> |
|||
|
|||
<div class="div_btn"> |
|||
|
|||
<el-button style="float:left" |
|||
class="diy-button--add" |
|||
size="small" |
|||
@click="handleAdd">新增楼栋</el-button> |
|||
<div class="btn_upload" |
|||
v-if="showImportBtn"> |
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('building')">下载楼栋模板</el-button> |
|||
|
|||
<el-upload :headers="$getElUploadHeaders()" |
|||
style="" |
|||
ref="upload_building" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'building')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'building')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入楼栋数据</el-button> |
|||
</el-upload> |
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule('room')">下载房屋模板</el-button> |
|||
|
|||
<el-upload :headers="$getElUploadHeaders()" |
|||
style="" |
|||
ref="upload_room" |
|||
:multiple='false' |
|||
:show-file-list='false' |
|||
:before-upload="((file)=>{beforeUpload(file, 'room')})" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:http-request="(()=>{uploadFile( 'room')})"> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--delete">导入房屋数据</el-button> |
|||
</el-upload> |
|||
</div> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="handleExport">导出</el-button> |
|||
<el-button style="float:left;margin-left:10px" |
|||
class="diy-button--more" |
|||
size="small" |
|||
@click="deleteBatch">批量删除</el-button> |
|||
<el-button style=";margin-left:10px" |
|||
class="diy-button--export" |
|||
size="small" |
|||
:disabled="yihuyidangDisabled" |
|||
@click="handleExportYihuyidang()">导出一户一档</el-button> |
|||
<el-button size="small" |
|||
v-if="displayedBaobiaoBtn" |
|||
class="diy-button--add" |
|||
@click="reportForm">智能填报</el-button> |
|||
</div> |
|||
|
|||
<div class="div_table_item"> |
|||
<el-table ref="ref_table" |
|||
:data="tableData" |
|||
:header-cell-style="{background:'#2195FE',color:'#FFFFFF'}" |
|||
border |
|||
@sort-change="handleSortOrderChange" |
|||
:height="tableHeight" |
|||
v-loading="tableLoading" |
|||
style="width: 100%" |
|||
@select-all="selectAll" |
|||
@selection-change="selectionChange"> |
|||
<el-table-column type="selection" |
|||
:selectable="checkSelect" |
|||
width="55"> |
|||
</el-table-column> |
|||
<el-table-column fixed="left" |
|||
width="55" |
|||
type="index" |
|||
label="序号" |
|||
:index="indexMethod"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="buildingName" |
|||
fixed="left" |
|||
label="楼栋名称" |
|||
min-width="180"> |
|||
<template slot-scope="scope"> |
|||
<a class="name-a" |
|||
@click="handleToNextLevel(scope.row)"> |
|||
{{ scope.row.buildingName }} |
|||
</a> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="neighborHoodName" |
|||
label="所属小区" |
|||
min-width="160"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingType" |
|||
label="楼栋类型" |
|||
min-width="110"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingLeaderName" |
|||
label="楼长姓名" |
|||
min-width="90"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingLeaderMobile" |
|||
label="楼长电话" |
|||
min-width="110"> |
|||
</el-table-column> |
|||
<el-table-column prop="totalUnitNum" |
|||
label="单元数"> |
|||
</el-table-column> |
|||
<el-table-column prop="totalFloorNum" |
|||
label="层数"> |
|||
</el-table-column> |
|||
<el-table-column prop="realTotalHouseNum" |
|||
label="实际录入总数"> |
|||
</el-table-column> |
|||
<el-table-column prop="totalHouseNum" |
|||
label="总户数"> |
|||
</el-table-column> |
|||
<el-table-column prop="sort" |
|||
sortable="custom" |
|||
min-width="140" |
|||
label="排序"> |
|||
<template slot-scope="scope"> |
|||
<div @click="handleEditSort(scope.row)"> |
|||
<span v-if="!scope.row.isChange">{{scope.row.sort}}</span> |
|||
<el-input-number v-else |
|||
@change="handleChangeSort(scope.row)" |
|||
v-model="scope.row.sort" |
|||
class="item_width_4" |
|||
:precision="2" |
|||
size="small" |
|||
:min="0" |
|||
:max="9999" |
|||
label="描述文字"></el-input-number> |
|||
</div> |
|||
|
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="140" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
|
|||
<el-button type="text" |
|||
class="div-table-button--detail" |
|||
size="small" |
|||
@click="handleDetail(scope.row)">查看</el-button> |
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleEdit(scope.row)">修改</el-button> |
|||
|
|||
<el-button v-if="scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--delete" |
|||
size="small" |
|||
@click="handleDelete(scope.row)">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div> |
|||
<el-pagination @size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="pageSize" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total"> |
|||
</el-pagination> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<!-- 修改弹出框 --> |
|||
<el-dialog :visible.sync="formShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="formTitle" |
|||
top="5vh" |
|||
width="900px" |
|||
class="dialog-h" |
|||
@closed="diaClose"> |
|||
<build-form ref="ref_form" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></build-form> |
|||
</el-dialog> |
|||
<!-- 详情弹出框 --> |
|||
<el-dialog :visible.sync="detailShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="'楼栋详情'" |
|||
top="5vh" |
|||
width="900px" |
|||
class="dialog-h" |
|||
@closed="detailFormCancle"> |
|||
<build-detail ref="ref_form_detail" |
|||
@diaDetailClose="detailFormCancle"></build-detail> |
|||
</el-dialog> |
|||
|
|||
<baobiao ref="baobiao" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
import BuildForm from './buildForm' |
|||
import BuildDetail from './buildDetail' |
|||
|
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import baobiao from "@/views/modules/cpts/baobiao"; |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
importBuildingLoading: false, |
|||
importRoomLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
sortType: 'asc',//asc:正,desc:倒 |
|||
tableLoading: true, |
|||
tableData: [], |
|||
|
|||
agencyObj: {},//树所选的小区对象 |
|||
|
|||
validTableDataNum: 0,//有效的数据数量,即有权限操作的数据数量 |
|||
selection: [], |
|||
|
|||
|
|||
//form相关 |
|||
formShow: false, |
|||
formTitle: '新增楼栋', |
|||
detailShow: false, |
|||
|
|||
yihuyidangDisabled: false, |
|||
|
|||
displayedBaobiaoBtn: false, |
|||
} |
|||
}, |
|||
components: { |
|||
baobiao, |
|||
BuildForm, |
|||
BuildDetail |
|||
}, |
|||
async mounted () { |
|||
this.displayedBaobiaoBtn = await this.$refs.baobiao.existsTemplate({ |
|||
elseParams: { |
|||
categoryKeys: ['house_info'], categoryKey: 'house_info', |
|||
} |
|||
}); |
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
|
|||
return this.$store.state.inIframe ? this.clientHeight - 425 + this.iframeHeight : this.clientHeight - 425 |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
methods: { |
|||
reportForm () { |
|||
let paramMap = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
level: this.agencyObj.level, |
|||
id: this.agencyObj.id, |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentFlag: this.rentFlag, |
|||
purpose: this.purpose, |
|||
remark: this.remark, |
|||
sortType: this.sortType, |
|||
updateStartDate: this.updateStartDate, |
|||
updateEndDate: this.updateEndDate, |
|||
}; |
|||
this.$refs.baobiao.init({ |
|||
elseParams: { |
|||
categoryKeys: ['house_info'], categoryKey: 'house_info', paramMap |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
indexMethod (index) { |
|||
return index + 1; |
|||
}, |
|||
handleSortOrderChange (value) { |
|||
console.log(value.column, value.prop, value.order) |
|||
this.sortType = value.order === 'ascending' ? 'asc' : 'desc' |
|||
this.loadTable() |
|||
|
|||
}, |
|||
// handleChangeSort(row){ |
|||
|
|||
// }, |
|||
|
|||
handleEditSort (row) { |
|||
if (!row.isChange) { |
|||
row.isChange = true |
|||
} |
|||
|
|||
}, |
|||
|
|||
|
|||
async handleChangeSort (row, index) { |
|||
// row.isChange = false |
|||
console.log(row.sort) |
|||
let params = { |
|||
id: row.buildingId, |
|||
sort: row.sort, |
|||
type: 'building', |
|||
} |
|||
|
|||
let url = '/gov/org/house/update-sort' |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
// this.$message({ |
|||
// type: 'success', |
|||
// message: '操作成功' |
|||
// }) |
|||
|
|||
|
|||
} else { |
|||
|
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
checkSelect (row, index) { |
|||
let isChecked = false; |
|||
if (row.showBtn) { // 判断里面是否存在某个参数 |
|||
isChecked = true |
|||
} else { |
|||
isChecked = false |
|||
} |
|||
return isChecked |
|||
}, |
|||
|
|||
async loadTable (fromTree, treeObj) { |
|||
this.tableLoading = true |
|||
if (fromTree) { |
|||
this.sortType = 'asc' |
|||
|
|||
this.agencyObj = treeObj |
|||
|
|||
} |
|||
|
|||
|
|||
console.log(this.agencyObj) |
|||
const url = "/gov/org/building/buildinglist" |
|||
let params = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
sortType: this.sortType, |
|||
neighborHoodId: this.agencyObj.id |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.validTableDataNum = 0 |
|||
this.total = data.total |
|||
data.list.forEach(item => { |
|||
item.sort = parseInt(item.sort) || 0; |
|||
item.sort = item.sort.toFixed(2) |
|||
item.isChange = false |
|||
if (item.agencyId === this.staffAgencyId) { |
|||
item.showBtn = true |
|||
this.validTableDataNum++ |
|||
} else { |
|||
item.showBtn = false |
|||
} |
|||
|
|||
}); |
|||
this.tableData = data.list |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.tableLoading = false |
|||
}, |
|||
|
|||
diaClose () { |
|||
this.$refs.ref_form.resetData() |
|||
this.formShow = false |
|||
}, |
|||
|
|||
async handleDetail (row) { |
|||
|
|||
|
|||
this.detailShow = true |
|||
|
|||
const _data = await this.detail(row) |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form_detail.initForm(_data, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
detailFormCancle () { |
|||
this.$refs.ref_form_detail.diaDestroy() |
|||
this.detailShow = false |
|||
}, |
|||
|
|||
handleAdd () { |
|||
this.formTitle = '新增楼栋' |
|||
this.formShow = true |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('add', null, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
async handleEdit (row) { |
|||
this.formTitle = '修改楼栋' |
|||
this.formShow = true |
|||
const _data = await this.detail(row) |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm('edit', _data, this.agencyObj) |
|||
}) |
|||
}, |
|||
|
|||
handleToNextLevel (row) { |
|||
this.$emit('toNextLevel', row, 'building') |
|||
}, |
|||
|
|||
addFormCancle () { |
|||
this.formShow = false |
|||
}, |
|||
addFormOk () { |
|||
this.formShow = false |
|||
this.loadTable() |
|||
this.$emit('refreshTree') |
|||
}, |
|||
|
|||
|
|||
deleteBatch () { |
|||
if (this.selection.length > 0) { |
|||
this.$confirm("确认删除选择的楼栋?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteCommunityBatch() |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
} else { |
|||
this.$message.warning('请先选择要删除的楼栋') |
|||
} |
|||
}, |
|||
selectAll (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
selectionChange (selection) { |
|||
this.selection = selection |
|||
|
|||
}, |
|||
async handleDelete (row) { |
|||
|
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning" |
|||
}) |
|||
.then(() => { |
|||
this.deleteBuild(row) |
|||
}) |
|||
.catch(err => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
}, |
|||
|
|||
async deleteCommunityBatch () { |
|||
let ids = [] |
|||
this.selection.forEach(element => { |
|||
|
|||
ids.push(element.buildingId) |
|||
}); |
|||
|
|||
const url = "/gov/org/house/delete" |
|||
|
|||
let params = { |
|||
type: 'building', |
|||
ids: ids |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else if (code > 8000) { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: msg, |
|||
duration: 0 |
|||
}) |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
async deleteBuild (row) { |
|||
const url = "/gov/org/building/buildingdel" |
|||
|
|||
let params = { |
|||
buildingId: row.buildingId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功" |
|||
}); |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
async detail (row) { |
|||
const url = "/gov/org/houseInformation/getBuildingDetail/" + row.buildingId |
|||
|
|||
|
|||
const { data, code, msg } = await requestPost(url) |
|||
|
|||
if (code === 0) { |
|||
return data |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//导出表格 |
|||
async handleExport () { |
|||
let title = this.agencyObj.label |
|||
title = title + '—楼栋列表' |
|||
|
|||
const url = "/gov/org/building/exportbuildinginfo" |
|||
let params = { |
|||
|
|||
neighborHoodId: this.agencyObj.id |
|||
} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
|
|||
}, |
|||
|
|||
// 下载文件 |
|||
download (data, fileName) { |
|||
if (!data) { |
|||
return |
|||
} |
|||
|
|||
var csvData = new Blob([data]) |
|||
|
|||
if (window.navigator && window.navigator.msSaveOrOpenBlob) { |
|||
window.navigator.msSaveOrOpenBlob(csvData, fileName); |
|||
} |
|||
// for Non-IE (chrome, firefox etc.) |
|||
else { |
|||
var a = document.createElement('a'); |
|||
document.body.appendChild(a); |
|||
a.style = 'display: none'; |
|||
var url = window.URL.createObjectURL(csvData); |
|||
a.href = url; |
|||
a.download = fileName; |
|||
a.click(); |
|||
a.remove(); |
|||
window.URL.revokeObjectURL(url); |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleExportModule (type) { |
|||
|
|||
let title = '' |
|||
let url = "" |
|||
if (type === 'building') { |
|||
title = '楼栋导入模板' |
|||
url = '/gov/org/building/exporttemplate' |
|||
|
|||
} else if (type === 'room') { |
|||
title = '房屋导入模板' |
|||
url = '/gov/org/house/exporttemplate' |
|||
} |
|||
|
|||
|
|||
let params = {} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
}, |
|||
|
|||
//导出一户一档 |
|||
handleExportYihuyidang () { |
|||
this.yihuyidangDisabled = true |
|||
let title = this.agencyObj.label |
|||
title = title + '-一户一档' |
|||
let url = "/gov/org/house/exportHouseUser" |
|||
|
|||
|
|||
let params = { |
|||
agencyId: '', |
|||
gridId: '', |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentFlag: this.rentFlag, |
|||
purpose: this.purpose, |
|||
remark: this.remark, |
|||
updateStartDate: this.updateStartDate, |
|||
updateEndDate: this.updateEndDate, |
|||
neighborHoodId: this.agencyObj.id |
|||
|
|||
} |
|||
|
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
|
|||
this.download(data, title + '.xls') |
|||
this.yihuyidangDisabled = false |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
this.yihuyidangDisabled = false |
|||
} |
|||
); |
|||
}, |
|||
|
|||
|
|||
// 上传文件之前的钩子 |
|||
beforeUpload (file, type) { |
|||
this.files = file; |
|||
|
|||
const isText = file.type === 'application/vnd.ms-excel' |
|||
const isTextComputer = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
|||
|
|||
if (!isText && !isTextComputer) { |
|||
this.$message.error('请选择正确格式的文件') |
|||
this.files = null |
|||
this.fileName = '' |
|||
return false |
|||
} else { |
|||
this.fileName = file.name; |
|||
return true |
|||
} |
|||
|
|||
}, |
|||
// 上传文件个数超过定义的数量 |
|||
handleExceed (files, fileList) { |
|||
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) |
|||
}, |
|||
|
|||
async uploadFile (type) { |
|||
if (this.fileName == "") { |
|||
this.$message.warning('请选择要上传的文件!') |
|||
return false |
|||
} |
|||
this.$message({ |
|||
showClose: true, |
|||
message: '导入中,请到系统管理-导入记录中查看进度', |
|||
duration: 0 |
|||
}) |
|||
|
|||
|
|||
//清空上传列表 |
|||
let url = '' |
|||
let params = {} |
|||
let fileFormData = new FormData(); |
|||
fileFormData.append('file', this.files);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgId', this.agencyObj.id);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append('orgType', this.agencyObj.level);//filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
|
|||
// params.file = fileFormData |
|||
// params.orgId = this.agencyObj.id |
|||
// params.orgType = this.agencyObj.level |
|||
|
|||
if (type === 'building') { |
|||
this.$refs['upload_building'].clearFiles() |
|||
// url = 'http://192.168.51.26:8080/api/gov/org/building/buildingimport' |
|||
url = '/gov/org/building/buildingimport' |
|||
this.importBuildingLoading = true |
|||
|
|||
} else if (type === 'room') { |
|||
this.$refs['upload_room'].clearFiles() |
|||
// url = 'http://192.168.51.26:8080/api/gov/org/house/houseimport' |
|||
url = '/gov/org/house/houseimport' |
|||
this.importRoomLoading = true |
|||
} |
|||
|
|||
window.app.ajax.post2(url, fileFormData, |
|||
(data, rspMsg) => { |
|||
|
|||
if (data.code === 0 && data.msg == 'success') { |
|||
// this.$message.success('导入成功') |
|||
} else { |
|||
// this.$message({ |
|||
// showClose: true, |
|||
// message: rspMsg, |
|||
// duration: 0, |
|||
// type: "error" |
|||
// }) |
|||
// this.$message.error(rspMsg) |
|||
} |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
if (type === 'building') { |
|||
this.importBuildingLoading = false |
|||
|
|||
} else if (type === 'room') { |
|||
this.importRoomLoading = false |
|||
} |
|||
}, |
|||
(rspMsg, data) => { |
|||
if (type === 'building') { |
|||
this.importBuildingLoading = false |
|||
|
|||
} else if (type === 'room') { |
|||
this.importRoomLoading = false |
|||
} |
|||
}, { headers: { 'Content-Type': 'multipart/form-data' } }) |
|||
|
|||
}, |
|||
|
|||
showMessage (msg) { |
|||
this.$alert(msg, '操作结果', { |
|||
confirmButtonText: '关闭', |
|||
callback: action => { |
|||
this.$emit('refreshTree') |
|||
this.loadTable() |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
handleSizeChange (val) { |
|||
this.pageSize = val |
|||
this.pageNo = 1 |
|||
this.loadTable() |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val |
|||
this.loadTable() |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
|
|||
}, |
|||
props: { |
|||
staffAgencyId: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
showImportBtn: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
ownerName: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
ownerPhone: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
rentFlag: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
purpose: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
remark: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
updateStartDate: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
updateEndDate: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|||
|
|||
.item_width_4 { |
|||
width: 120px; |
|||
} |
|||
|
|||
/deep/.el-input-number--medium .el-input-number__decrease, |
|||
/deep/.el-input-number--medium .el-input-number__increase { |
|||
width: 26px; |
|||
} |
|||
/deep/.el-input-number--medium .el-input__inner { |
|||
padding-left: 0px; |
|||
padding-right: 0px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,721 @@ |
|||
<template> |
|||
<div class="div_main"> |
|||
|
|||
<div :style="{height:rowHeight}" |
|||
class="div_tree"> |
|||
<!-- <el-input placeholder="输入关键字进行过滤" |
|||
v-model="filterText"> |
|||
</el-input> --> |
|||
<el-scrollbar :style="{height:treeHeight}" |
|||
class="scrollar"> |
|||
<el-tree ref="ref_tree" |
|||
v-loading="treeLoading" |
|||
class="filter_tree" |
|||
:data="treeData" |
|||
:props="defaultProps" |
|||
:highlight-current="true" |
|||
node-key="id" |
|||
:default-expanded-keys="openNodes" |
|||
:expand-on-click-node="false" |
|||
:filter-node-method="filterNode" |
|||
@node-click="handleNodeClick" |
|||
lazy |
|||
:load="lazyLoadTree"> |
|||
|
|||
<span slot-scope="{ node, data }" |
|||
class="custom-tree-node"> |
|||
<span :id="data.id">{{ data.showName }}</span> |
|||
</span> |
|||
</el-tree> |
|||
</el-scrollbar> |
|||
|
|||
</div> |
|||
|
|||
<div :style="{height:rowHeight}" |
|||
class=div_left> |
|||
|
|||
<div class="div_search marginl-20"> |
|||
<el-form :inline="true" |
|||
ref="ref_searchform" |
|||
:label-width="'80px'"> |
|||
<div> |
|||
|
|||
<el-form-item label="所属组织" |
|||
prop="ownerName"> |
|||
<el-cascader class="customer_cascader" |
|||
ref="myCascader" |
|||
size="small" |
|||
v-model="agencyIdArray" |
|||
:options="orgOptions" |
|||
:props="orgOptionProps" |
|||
:show-all-levels="false" |
|||
@change="handleChangeAgency"></el-cascader> |
|||
</el-form-item> |
|||
<el-form-item label="房主姓名" |
|||
prop="ownerName"> |
|||
<el-input v-model="ownerName" |
|||
class="item_width_2" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入内容"> |
|||
|
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="联系方式" |
|||
prop="ownerPhone"> |
|||
<el-input v-model="ownerPhone" |
|||
class="item_width_2" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入手机"> |
|||
</el-input> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房屋状态" |
|||
prop="rentFlag"> |
|||
<el-select class="item_width_2" |
|||
v-model="rentFlag" |
|||
placeholder="请选择" |
|||
size="small" |
|||
clearable> |
|||
<el-option v-for="item in rentList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房屋用途" |
|||
prop="purpose"> |
|||
<el-select v-model="purpose" |
|||
class="item_width_2" |
|||
placeholder="请选择" |
|||
size="small" |
|||
clearable> |
|||
<el-option v-for="item in purposeArr" |
|||
:key="item.dictValue" |
|||
:label="item.dictName" |
|||
:value="item.dictValue"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</el-form-item> |
|||
|
|||
<el-form-item label="备注" |
|||
prop="remark"> |
|||
<el-input v-model="remark" |
|||
class="item_width_2" |
|||
size="small" |
|||
clearable |
|||
placeholder="请输入备注"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="更新时间" |
|||
prop="updateStartDate"> |
|||
<el-date-picker v-model="updateStartDate" |
|||
:picker-options="startPickerOptions" |
|||
class="item_width_2" |
|||
size="small" |
|||
type="date" |
|||
value-format="yyyyMMdd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="开始时间"> |
|||
</el-date-picker> |
|||
<span class="data-tag">至</span> |
|||
<el-date-picker v-model="updateEndDate" |
|||
:picker-options="endPickerOptions" |
|||
class="item_width_2 data-tag" |
|||
size="small" |
|||
type="date" |
|||
value-format="yyyyMMdd" |
|||
value="yyyy-MM-dd" |
|||
placeholder="结束时间"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
|
|||
<el-button style="margin-left:30px" |
|||
size="small" |
|||
class="diy-button--search" |
|||
@click="handleSearch">查询</el-button> |
|||
<el-button style="margin-left:10px" |
|||
size="small" |
|||
class="diy-button--reset" |
|||
@click="resetSearch">重置</el-button> |
|||
</div> |
|||
</el-form> |
|||
</div> |
|||
<div class=div_left_table> |
|||
<build-table v-if="selTreeObj.level==='neighborHood'&&!showRoomTable" |
|||
ref="ref_neighTable" |
|||
:staffAgencyId="staffAgencyId" |
|||
:showImportBtn="showImportBtn" |
|||
:ownerName="ownerName" |
|||
:ownerPhone="ownerPhone" |
|||
:rentFlag="rentFlag" |
|||
:purpose="purpose" |
|||
:remark="remark" |
|||
:updateStartDate="updateStartDate" |
|||
:updateEndDate="updateEndDate" |
|||
@toNextLevel="toNextLevel" |
|||
@refreshTree="refreshTree"></build-table> |
|||
|
|||
<room-table v-if="showRoomTable||selTreeObj.level==='building'" |
|||
:staffAgencyId="staffAgencyId" |
|||
:showImportBtn="showImportBtn" |
|||
:ownerName="ownerName" |
|||
:ownerPhone="ownerPhone" |
|||
:rentFlag="rentFlag" |
|||
:purpose="purpose" |
|||
:remark="remark" |
|||
:updateStartDate="updateStartDate" |
|||
:updateEndDate="updateEndDate" |
|||
:orgType="orgType" |
|||
:orgId="orgId" |
|||
ref="ref_buildingTable" |
|||
@refreshTree="refreshTree"></room-table> |
|||
|
|||
<community-table v-if="selTreeObj.level!=='building'&&selTreeObj.level!=='neighborHood'&&!showRoomTable" |
|||
@toNextLevel="toNextLevel" |
|||
:staffAgencyId="staffAgencyId" |
|||
:ownerName="ownerName" |
|||
:ownerPhone="ownerPhone" |
|||
:rentFlag="rentFlag" |
|||
:purpose="purpose" |
|||
:remark="remark" |
|||
:updateStartDate="updateStartDate" |
|||
:updateEndDate="updateEndDate" |
|||
ref="ref_communityTable" |
|||
@refreshTree="refreshTree"></community-table> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import CDialog from '@c/CDialog' |
|||
import communityTable from './communityTable' |
|||
import buildTable from './buildTable' |
|||
import roomTable from './roomTable' |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import nextTick from 'dai-js/tools/nextTick' |
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
let endDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
if (this.updateStartDate) { |
|||
let startTime = new Date(this.updateStartDate) |
|||
return time.getTime() > nowData || time.getTime() < startTime || time.getTime() === startTime |
|||
} else { |
|||
return time.getTime() > nowData |
|||
} |
|||
|
|||
} |
|||
let startDisabledDate = (time) => {//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now() |
|||
return time.getTime() > nowData |
|||
} |
|||
return { |
|||
// filterText: '', |
|||
treeLoading: true, |
|||
treeData: [], |
|||
openNodes: [], |
|||
defaultProps: { |
|||
children: 'children', |
|||
label: 'showName' |
|||
}, |
|||
orgOptions: [], |
|||
orgOptionProps: { |
|||
multiple: false, |
|||
value: 'agencyId', |
|||
label: 'agencyName', |
|||
children: 'subAgencyList', |
|||
checkStrictly: true |
|||
}, |
|||
agencyIdArray: [], |
|||
orgType: '', |
|||
orgId: '', |
|||
|
|||
selTreeObj: {}, |
|||
|
|||
centerPoint: [], |
|||
staffAgencyId: localStorage.getItem("agencyId"), |
|||
showImportBtn: false, |
|||
|
|||
rentList: [ |
|||
{ |
|||
value: '1', |
|||
label: '出租' |
|||
}, |
|||
{ |
|||
value: '2', |
|||
label: '闲置' |
|||
}, |
|||
{ |
|||
value: '0', |
|||
label: '自住' |
|||
}, |
|||
{ |
|||
value: '3', |
|||
label: '未出售' |
|||
}, |
|||
], |
|||
ownerName: '', |
|||
ownerPhone: '', |
|||
rentFlag: '', |
|||
purpose: '', |
|||
remark: '', |
|||
updateStartDate: '', |
|||
updateEndDate: '', |
|||
showRoomTable: false, |
|||
selObj: {}, |
|||
purposeArr: [ |
|||
{ dictValue: '1', dictName: '住宅' }, |
|||
{ dictValue: '2', dictName: '商业' }, |
|||
{ dictValue: '3', dictName: '办公' }, |
|||
{ dictValue: '4', dictName: '工业' }, |
|||
{ dictValue: '5', dictName: '仓储' }, |
|||
{ dictValue: '6', dictName: '商住混用' }, |
|||
{ dictValue: '7', dictName: '其他' } |
|||
], |
|||
endPickerOptions: { |
|||
disabledDate: endDisabledDate |
|||
}, |
|||
startPickerOptions: { |
|||
disabledDate: startDisabledDate |
|||
}, |
|||
|
|||
selGridId: '', |
|||
selAgencyId: '', |
|||
|
|||
|
|||
} |
|||
}, |
|||
components: { |
|||
CDialog |
|||
}, |
|||
async mounted () { |
|||
this.treeLoading = true |
|||
|
|||
await this.loadOrgData() |
|||
await this.loadTree() |
|||
await this.getOrgTreeList() |
|||
|
|||
await this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) |
|||
if (this.treeData.length > 0) { |
|||
this.$nextTick(() => { |
|||
// ref_tree 元素的ref value 绑定的node-key |
|||
this.$refs.ref_tree.setCurrentKey(this.treeData[0].id); |
|||
}); |
|||
} |
|||
this.treeLoading = false |
|||
|
|||
}, |
|||
computed: { |
|||
rowHeight () { |
|||
return this.$store.state.inIframe ? this.clientHeight - 140 + this.iframeHeight + 'px' : this.clientHeight - 140 + 'px' |
|||
|
|||
}, |
|||
treeHeight () { |
|||
return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px' |
|||
|
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
methods: { |
|||
async getOrgTreeList () { |
|||
let url = '/gov/org/customeragency/agencygridtree' |
|||
let params = {} |
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.orgOptions = [] |
|||
this.orgOptions.push(data) |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
handleChangeAgency (val) { |
|||
let obj = this.$refs["myCascader"].getCheckedNodes()[0].data |
|||
if (obj) { |
|||
|
|||
this.orgType = obj.level === 'grid' ? 'grid' : 'agency' |
|||
this.orgId = obj.agencyId |
|||
|
|||
} else { |
|||
this.orgType = '' |
|||
this.orgId = '' |
|||
} |
|||
|
|||
|
|||
}, |
|||
async lazyLoadTree (node, resolve) { |
|||
console.log(node) |
|||
// debugger |
|||
if (node.level !== 0) { |
|||
const url = "/gov/org/building/next-tree-node" |
|||
let params = { |
|||
id: node.data.id, |
|||
level: node.data.level |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
resolve(data) |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
} |
|||
|
|||
}, |
|||
|
|||
|
|||
handleSearch () { |
|||
// if (this.ownerName || this.ownerPhone || this.rentFlag || this.purpose || this.remark) { |
|||
this.showRoomTable = true |
|||
|
|||
this.$nextTick(() => { |
|||
this.$refs['ref_buildingTable'].loadTable('search', this.selTreeObj) |
|||
}) |
|||
// } else { |
|||
// this.$message.warning('请输入查询条件') |
|||
// } |
|||
|
|||
|
|||
}, |
|||
|
|||
//重置搜索条件 |
|||
resetSearch () { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
this.rentFlag = '' |
|||
this.purpose = '' |
|||
this.remark = '' |
|||
this.updateStartDate = '' |
|||
this.updateEndDate = '' |
|||
this.orgType = '' |
|||
this.orgId = '' |
|||
|
|||
this.pageSize = 10 |
|||
this.pageNo = 1 |
|||
|
|||
this.agencyIdArray = [] |
|||
|
|||
}, |
|||
|
|||
async loadTree (isRefresh) { |
|||
const url = "/gov/org/building/treeinit" |
|||
let params = {} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.openNodes = [] |
|||
this.openNodes.push(data.id) |
|||
|
|||
this.treeData = [] |
|||
this.treeData.push(data) |
|||
|
|||
if (!isRefresh && data) { |
|||
|
|||
this.selTreeObj = data |
|||
if (!this.selTreeObj.latitude) { |
|||
this.selTreeObj.latitude = this.centerPoint[0] |
|||
} |
|||
|
|||
if (!this.selTreeObj.longitude) { |
|||
this.selTreeObj.longitude = this.centerPoint[1] |
|||
} |
|||
} |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
//加载组织数据 |
|||
async loadOrgData () { |
|||
const url = "/gov/org/agency/maporg" |
|||
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg" |
|||
let params = {} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.centerPoint = [] |
|||
|
|||
this.centerPoint.push(data.latitude) |
|||
this.centerPoint.push(data.longitude) |
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
async handleNodeClick (obj) { |
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
this.rentFlag = '' |
|||
this.purpose = '' |
|||
this.remark = '' |
|||
this.updateStartDate = '' |
|||
this.updateEndDate = '' |
|||
this.showRoomTable = false |
|||
|
|||
this.selObj = JSON.parse(JSON.stringify(obj)) |
|||
this.getTreeObj(obj) |
|||
await nextTick(1000) |
|||
|
|||
if (obj.level === 'building') {//点击楼栋 |
|||
|
|||
this.selAgencyId = '' |
|||
this.selGridId = '' |
|||
|
|||
this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj) |
|||
|
|||
|
|||
} else if (obj.level === 'neighborHood') {//点击小区 |
|||
|
|||
this.selAgencyId = '' |
|||
this.selGridId = '' |
|||
|
|||
this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj) |
|||
|
|||
} else { |
|||
this.$refs['ref_communityTable'].loadTable(true, this.selTreeObj) |
|||
|
|||
if (obj.level === 'grid') { |
|||
this.selAgencyId = '' |
|||
this.selGridId = this.selTreeObj.id |
|||
} else { |
|||
this.selAgencyId = this.selTreeObj.id |
|||
this.selGridId = '' |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
//添加小区结束 |
|||
async refreshTree () { |
|||
this.treeLoading = true |
|||
await this.loadTree(this.selTreeObj.id) |
|||
this.$nextTick(() => { |
|||
// ref_tree 元素的ref value 绑定的node-key |
|||
this.$refs.ref_tree.setCurrentKey(this.selTreeObj.id); |
|||
}); |
|||
this.treeLoading = false |
|||
}, |
|||
|
|||
//进入下一级 |
|||
async toNextLevel (row, level) { |
|||
console.log(row) |
|||
if (level === 'community') { |
|||
this.selTreeObj.id = row.neighborHoodId |
|||
this.selTreeObj.label = row.neighborHoodName |
|||
this.selTreeObj.latitude = row.latitude |
|||
this.selTreeObj.level = 'neighborHood' |
|||
this.selTreeObj.longitude = row.longitude |
|||
|
|||
} else { |
|||
this.selTreeObj.id = row.buildingId |
|||
this.selTreeObj.label = row.buildingName |
|||
this.selTreeObj.latitude = row.latitude |
|||
this.selTreeObj.level = "building" |
|||
this.selTreeObj.longitude = row.longitude |
|||
} |
|||
|
|||
console.log(this.selTreeObj) |
|||
|
|||
this.ownerName = '' |
|||
this.ownerPhone = '' |
|||
this.rentFlag = '' |
|||
this.purpose = '' |
|||
this.remark = '' |
|||
this.updateStartDate = '' |
|||
this.updateEndDate = '' |
|||
this.showRoomTable = false |
|||
|
|||
this.selObj = JSON.parse(JSON.stringify(this.selTreeObj)) |
|||
// this.getTreeObj(obj) |
|||
await nextTick(1000) |
|||
|
|||
if (this.selObj.level === 'building') {//点击楼栋 |
|||
this.selAgencyId = '' |
|||
this.selGridId = '' |
|||
|
|||
this.$refs['ref_buildingTable'].loadTable('tree', this.selTreeObj) |
|||
|
|||
} else if (this.selObj.level === 'neighborHood') {//点击小区 |
|||
this.selAgencyId = '' |
|||
this.selGridId = '' |
|||
|
|||
this.$refs['ref_neighTable'].loadTable(true, this.selTreeObj) |
|||
|
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
//解析树数据 |
|||
getTreeObj (obj) { |
|||
// 树接口: |
|||
// 组织:组织id、组织名称、type、经度、纬度 |
|||
// 小区:小区id、小区名称、type、所属网格id、所属网格名称、所属组织id、所属组织名称、经度、纬度 |
|||
// 楼:楼id、楼名称、type、所属小区id、所属小区名称 |
|||
if (obj.level === 'building') {//点击楼栋 |
|||
let neighborHoodNode = this.$refs.ref_tree.getNode(obj.pid)//所属小区 |
|||
|
|||
let gridNode = this.$refs.ref_tree.getNode(neighborHoodNode.data.pid)//所属网格 |
|||
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid)//所属社区 |
|||
obj.agencyId = agencyNode.data.id |
|||
obj.agencyName = agencyNode.data.label |
|||
obj.gridId = gridNode.data.id |
|||
obj.gridName = gridNode.data.label |
|||
obj.neighborHoodId = neighborHoodNode.data.id |
|||
obj.neighborHoodName = neighborHoodNode.data.label |
|||
if (obj.agencyId === this.staffAgencyId) { |
|||
this.showImportBtn = true |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
|
|||
} else if (obj.level === 'neighborHood') {//点击小区 |
|||
let gridNode = this.$refs.ref_tree.getNode(obj.pid) |
|||
let agencyNode = this.$refs.ref_tree.getNode(gridNode.data.pid) |
|||
obj.gridId = gridNode.data.id |
|||
obj.gridName = gridNode.data.label |
|||
obj.agencyId = agencyNode.data.id |
|||
obj.agencyName = agencyNode.data.label |
|||
if (obj.agencyId === this.staffAgencyId) { |
|||
this.showImportBtn = true |
|||
} else { |
|||
this.showImportBtn = false |
|||
} |
|||
|
|||
} else { |
|||
|
|||
} |
|||
|
|||
if (!obj.latitude) { |
|||
obj.latitude = this.centerPoint[0] |
|||
} |
|||
|
|||
if (!obj.longitude) { |
|||
obj.longitude = this.centerPoint[1] |
|||
} |
|||
this.selTreeObj = obj |
|||
console.log('selTreeObj', this.selTreeObj) |
|||
|
|||
}, |
|||
|
|||
filterNode (value, data) { |
|||
if (!value) return true; |
|||
return data.label.indexOf(value) !== -1; |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
// filterText (val) { |
|||
// this.$refs.ref_tree.filter(val); |
|||
// } |
|||
}, |
|||
components: { |
|||
communityTable, buildTable, roomTable |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
|
|||
<style> |
|||
/* .aui-content > .el-tabs > .el-tabs__content { |
|||
padding: 0px; |
|||
} */ |
|||
|
|||
.el-tree-node:focus > .el-tree-node__content { |
|||
/* background-color: #ccc !important; */ |
|||
color: #2195fe; |
|||
} |
|||
</style> |
|||
<style lang="scss" scoped> |
|||
.div_tree { |
|||
/deep/ .el-scrollbar__wrap { |
|||
overflow-x: hidden !important; |
|||
} |
|||
} |
|||
</style> |
|||
|
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
</style> |
|||
|
|||
<style lang="scss" scoped > |
|||
.div_main { |
|||
display: flex; |
|||
} |
|||
.scrollar { |
|||
margin-top: 10px; |
|||
} |
|||
|
|||
.div_tree { |
|||
flex: 0 0 280px; |
|||
background-color: #ffffff; |
|||
border-radius: 5px; |
|||
padding: 10px; |
|||
overflow-y: hidden; |
|||
} |
|||
.filter_tree { |
|||
overflow-x: auto; |
|||
} |
|||
|
|||
// .div_table { |
|||
// margin-left: 15px; |
|||
// // flex: 1; |
|||
// width: calc(100% - 300px); |
|||
// background-color: #ffffff; |
|||
// border-radius: 5px; |
|||
// padding: 10px; |
|||
// } |
|||
.div_left { |
|||
// flex: 1; |
|||
width: calc(100% - 300px); |
|||
} |
|||
.div_left_table { |
|||
margin-top: 10px; |
|||
margin-left: 15px; |
|||
background-color: #ffffff; |
|||
border-radius: 5px; |
|||
padding: 10px; |
|||
} |
|||
</style> |
|||
|
|||
|
|||
@ -0,0 +1,263 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
|
|||
<div v-if="initLoading" |
|||
class="m-row"> |
|||
<div class="m-info"> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">所属组织:</span> |
|||
<span>{{ dataForm.agencyName }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">所属网格:</span> |
|||
<span>{{ dataForm.gridName?dataForm.gridName:'--' }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">小区名称:</span> |
|||
<span>{{ dataForm.neighborHoodName}}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">小区编码:</span> |
|||
<span>{{ dataForm.coding?dataForm.coding:'--'}}</span> |
|||
</div> |
|||
|
|||
<div v-if="dataForm.qrcodeUrl" |
|||
style="display: flex;flex-direction: column;"> |
|||
<img style="margin-left: 70px;width: 200px;" |
|||
:src="dataForm.qrcodeUrl"> |
|||
<a style="margin-left: 80px" |
|||
:href="dataForm.qrcodeUrl" |
|||
target="_blank">下载</a> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">关联物业:</span> |
|||
<span>{{ dataForm.propertyShow?dataForm.propertyShow:'--'}}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">实有楼栋:</span> |
|||
<span>{{dataForm.realBuilding?dataForm.realBuilding:0 }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">详细地址:</span> |
|||
<span>{{ dataForm.address }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">地图位置:</span> |
|||
<div class="div_map"> |
|||
|
|||
<div id="app_detail_community"></div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="div-btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">关 闭</el-button> |
|||
|
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from '@/js/dai/request' |
|||
import daiMap from "@/utils/dai-map"; |
|||
var map |
|||
var search |
|||
var markers |
|||
var infoWindowList |
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
|
|||
btnDisable: false, |
|||
initLoading: false, |
|||
|
|||
dataForm: { |
|||
neighborHoodName: '', // 小区名称【不超过50字】 |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
propertyId: '', //关联物业 |
|||
address: '', //详细地址 |
|||
remark: '', //备注【最大500字】 |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '', //纬度 |
|||
realBuilding: 0, |
|||
coding: '', |
|||
sysCoding: '' |
|||
}, |
|||
|
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
handleCancle () { |
|||
this.diaDestroy() |
|||
this.$emit('diaDetailClose') |
|||
|
|||
}, |
|||
diaDestroy () { |
|||
if (map) { |
|||
// map.destroy() |
|||
} |
|||
}, |
|||
|
|||
async initForm (row) { |
|||
this.dataForm = JSON.parse(JSON.stringify(row)) |
|||
|
|||
let propertyShowList = [] |
|||
this.dataForm.propertyList.forEach(element => { |
|||
propertyShowList.push(element.name) |
|||
}); |
|||
|
|||
this.dataForm.propertyShow = propertyShowList.join(',') |
|||
|
|||
this.initLoading = true |
|||
let { latitude, longitude } = this.$store.state.user; |
|||
console.log('lat' + latitude + ',lon' + longitude) |
|||
if (this.dataForm.latitude && this.dataForm.longitude) { |
|||
latitude = this.dataForm.latitude |
|||
longitude = this.dataForm.longitude |
|||
} |
|||
if (!latitude || latitude == "" || latitude == "0") { |
|||
latitude = 39.9088810666821; |
|||
longitude = 116.39743841556731; |
|||
} |
|||
|
|||
this.$nextTick(() => { |
|||
if (!map) { |
|||
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, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
rotation: 45, // 设置地图旋转角度 |
|||
} |
|||
); |
|||
|
|||
// // 监听地图平移结束 |
|||
// map.on("dragend", (e) => { |
|||
// this.handleMoveCenter(e); |
|||
// }); |
|||
|
|||
map.setCenter(latitude, longitude); |
|||
map.setMarker(latitude, longitude); |
|||
|
|||
}, |
|||
|
|||
|
|||
|
|||
resetData () { |
|||
|
|||
this.dataForm = { |
|||
neighborHoodName: '', // 小区名称【不超过50字】 |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
propertyId: '', //关联物业 |
|||
address: '', //详细地址 |
|||
remark: '', //备注【最大500字】 |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '', //纬度 |
|||
realBuilding: 0, |
|||
coding: '', |
|||
sysCoding: '' |
|||
} |
|||
|
|||
}, |
|||
// 开启加载动画 |
|||
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, |
|||
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 () { |
|||
name: [ |
|||
{ required: true, message: '物业名称不能为空', trigger: 'blur' } |
|||
// { min: 1, max: 50, message: '小区名称长度在 1 到 50个字符', trigger: 'blur' } |
|||
] |
|||
} |
|||
}, |
|||
props: {} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/management/detail-main.scss"; |
|||
</style> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,576 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
<div v-show="!propertyFormShow"> |
|||
<el-form ref="ref_form" |
|||
:inline="true" |
|||
:model="dataForm" |
|||
:rules="dataRule" |
|||
class="form"> |
|||
|
|||
<el-form-item label="所属组织" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<span>{{ dataForm.agencyName }}</span> |
|||
</el-form-item> |
|||
<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-option v-for="item in gridList" |
|||
:key="item.gridId" |
|||
:label="item.gridName" |
|||
:value="item.gridId"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<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-form-item> |
|||
<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-button style="margin-left: 10px" |
|||
type="primary" |
|||
size="small" |
|||
@click="handleCode">生成</el-button> |
|||
</el-form-item> |
|||
|
|||
<div v-if="dataForm.qrcodeUrl" |
|||
style="display: flex;flex-direction: column;"> |
|||
<img style="margin-left: 70px;width: 200px;" |
|||
:src="dataForm.qrcodeUrl"> |
|||
<a style="margin-left: 80px" |
|||
:href="dataForm.qrcodeUrl" |
|||
target="_blank">下载</a> |
|||
</div> |
|||
<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-option v-for="item in propertyList" |
|||
:key="item.propertyId" |
|||
:label="item.propertyName" |
|||
:value="item.propertyId"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
<el-button style="margin-left: 10px" |
|||
type="primary" |
|||
size="small" |
|||
@click="handleAddProperty">添加物业</el-button> |
|||
</el-form-item> |
|||
<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-form-item> |
|||
|
|||
<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="app_community" |
|||
class="div_map"></div> |
|||
</div> |
|||
</el-form-item> |
|||
|
|||
<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-form-item> |
|||
|
|||
<el-form-item label="备注" |
|||
prop="remark" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
type="textarea" |
|||
maxlength="500" |
|||
show-word-limit |
|||
:rows="3" |
|||
placeholder="请输入备注,不超过500字" |
|||
v-model="dataForm.remark"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
</div> |
|||
|
|||
<div v-show="propertyFormShow"> |
|||
<el-form :inline="false" |
|||
:model="propertyForm" |
|||
:rules="propertyRule" |
|||
class="form"> |
|||
<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-form-item> |
|||
</el-form> |
|||
</div> |
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">取 消</el-button> |
|||
<el-button size="small" |
|||
type="primary" |
|||
:disabled="btnDisable" |
|||
@click="handleComfirm">确 定</el-button> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost } from '@/js/dai/request' |
|||
import daiMap from "@/utils/dai-map"; |
|||
var map |
|||
var search |
|||
var markers |
|||
var infoWindowList |
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
searchOptions: [], |
|||
searchValue: '', |
|||
resultList: [], |
|||
loading: false, |
|||
|
|||
|
|||
gridList: [], |
|||
propertyList: [], |
|||
btnDisable: false, |
|||
|
|||
neighborHoodId: '', //小区ID |
|||
dataForm: { |
|||
neighborHoodName: '', // 小区名称【不超过50字】 |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
propertyId: '', //关联物业 |
|||
address: '', //详细地址 |
|||
remark: '', //备注【最大500字】 |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '', //纬度 |
|||
realBuilding: 0, |
|||
coding: '', |
|||
sysCoding: '' |
|||
}, |
|||
|
|||
propertyFormShow: false, |
|||
propertyForm: { |
|||
name: '' |
|||
}, |
|||
|
|||
keyWords: '', |
|||
agencyObj: {} |
|||
} |
|||
}, |
|||
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() |
|||
}, |
|||
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|||
initMap (latitude, longitude) { |
|||
|
|||
map = new daiMap( |
|||
document.getElementById("app_community"), |
|||
{ latitude, longitude }, |
|||
{ |
|||
zoom: 16.2, // 设置地图缩放级别 |
|||
pitch: 43.5, // 设置俯仰角 |
|||
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 !== '') { |
|||
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 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 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() |
|||
} |
|||
|
|||
}) |
|||
|
|||
} |
|||
}, |
|||
async addCommunity () { |
|||
|
|||
let url = '' |
|||
if (this.formType === 'add') { |
|||
url = '/gov/org/neighborhood/neighborhoodadd' |
|||
// url = "http://yapi.elinkservice.cn/mock/245/gov/org/neighborhood/neighborhoodadd" |
|||
} else { |
|||
url = '/gov/org/neighborhood/neighborhoodupdate' |
|||
|
|||
this.dataForm.neighborHoodId = this.neighborHoodId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.dataForm) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '操作成功' |
|||
}) |
|||
this.resetData() |
|||
this.$emit('dialogOk') |
|||
this.btnDisable = false |
|||
} else { |
|||
this.btnDisable = false |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
async addProperty () { |
|||
if (!this.propertyForm.name || this.propertyForm.name === '') { |
|||
this.$message({ |
|||
type: 'error', |
|||
message: '物业名称不能为空' |
|||
}) |
|||
return false |
|||
} |
|||
const url = '/gov/org/propertymanagement/add' |
|||
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/propertymanagement/add" |
|||
let params = { |
|||
name: this.propertyForm.name |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '操作成功' |
|||
}) |
|||
|
|||
|
|||
this.propertyForm.name = '' |
|||
this.propertyFormShow = false |
|||
this.loadProperty() |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
handleCancle () { |
|||
if (this.propertyFormShow) { |
|||
this.propertyForm.name = '' |
|||
this.propertyFormShow = false |
|||
} else { |
|||
this.resetData() |
|||
this.$emit('dialogCancle') |
|||
} |
|||
}, |
|||
resetData () { |
|||
this.searchValue = '' |
|||
this.searchOptions = [] |
|||
this.resultList = [] |
|||
this.neighborHoodId = '' //小区ID |
|||
this.dataForm = { |
|||
neighborHoodName: '', // 小区名称【不超过50字】 |
|||
agencyId: '', // 所属组织ID |
|||
agencyName: '', |
|||
gridId: '', //所属网格ID |
|||
propertyId: '', //关联物业 |
|||
address: '', //详细地址 |
|||
remark: '', //备注【最大500字】 |
|||
location: '', //坐标位置 |
|||
longitude: '', //经度 |
|||
latitude: '', //纬度 |
|||
realBuilding: 0, |
|||
coding: '', |
|||
sysCoding: '' |
|||
} |
|||
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, |
|||
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 () { |
|||
name: [ |
|||
{ required: true, message: '物业名称不能为空', trigger: 'blur' } |
|||
// { min: 1, max: 50, message: '小区名称长度在 1 到 50个字符', trigger: 'blur' } |
|||
] |
|||
} |
|||
}, |
|||
props: {} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManageForm.scss"; |
|||
</style> |
|||
|
|||
|
|||
|
|||
File diff suppressed because it is too large
@ -0,0 +1,303 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
<div class="div_tuomin"> |
|||
<el-button v-if="view_real_data" |
|||
size="mini" |
|||
class="diy-button--search" |
|||
@click="handleTuomin">显示脱敏信息</el-button> |
|||
</div> |
|||
<div v-if="initLoading" |
|||
class="m-row"> |
|||
<div class="m-info"> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">所属楼栋:</span> |
|||
<span>{{ agencyObj.neighborHoodName }}-{{agencyObj.label}}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">单元号:</span> |
|||
<span>{{ dataForm.unitName?dataForm.unitName:'--' }}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">门牌号:</span> |
|||
<span>{{ dataForm.doorName}}</span> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">房屋编码:</span> |
|||
<span>{{ dataForm.coding?dataForm.coding:'--'}}</span> |
|||
</div> |
|||
<div v-if="dataForm.houseQrcodeUrl" |
|||
style="display: flex;flex-direction: column;"> |
|||
<img style="margin-left: 70px;width: 200px;" |
|||
:src="dataForm.houseQrcodeUrl"> |
|||
<a style="margin-left: 80px" |
|||
:href="dataForm.houseQrcodeUrl" |
|||
target="_blank">下载</a> |
|||
</div> |
|||
|
|||
<div class="info-prop"> |
|||
<span class="info-title-2">房屋类型:</span> |
|||
<span>{{dataForm.houseTypeName?dataForm.houseTypeName:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">房屋用途:</span> |
|||
<span>{{dataForm.purposeName?dataForm.purposeName:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">房屋状态:</span> |
|||
<span>{{dataForm.rentName?dataForm.rentName:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">房主姓名:</span> |
|||
<span>{{dataForm.ownerName?dataForm.ownerName:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">联系方式:</span> |
|||
<span>{{dataForm.showOwnerPhone?dataForm.showOwnerPhone:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">房主身份证:</span> |
|||
<span>{{dataForm.showOwnerIdCard?dataForm.showOwnerIdCard:'--' }}</span> |
|||
</div> |
|||
<div class="info-prop"> |
|||
<span class="info-title-2">备注:</span> |
|||
<span>{{dataForm.remark?dataForm.remark:'--' }}</span> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
<div class="div-btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">关 闭</el-button> |
|||
|
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost, requestGet } from '@/js/dai/request' |
|||
|
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
btnDisable: false, |
|||
initLoading: false, |
|||
unitList: [], |
|||
|
|||
houseId: '', //房屋ID |
|||
houseType: '1', |
|||
purpose: '1', |
|||
rentFlag: 0, |
|||
dataForm: { |
|||
neighborHoodId: '', // 所属小区ID |
|||
buildingId: '',//所属楼栋ID |
|||
buildingUnitId: '',//所属单元ID |
|||
doorName: '',//门牌号 |
|||
houseType: '',//房屋类型【楼房,平房,别墅】 |
|||
purpose: '',//房屋用途【住宅,商业,办公,工业,仓储,商住混用,其他】 |
|||
rentFlag: 0,//房屋状态【是:1,否:0】 出租1、闲置2、自住 0 |
|||
ownerPhone: '', //联系方式 |
|||
ownerName: '', //房主名字 |
|||
ownerIdCard: '', //房主身份证 |
|||
remark: '', |
|||
// realPerson: 0, |
|||
coding: '', |
|||
sysCoding: '' |
|||
}, |
|||
|
|||
keyWords: '', |
|||
agencyObj: {}, |
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
handleCancle () { |
|||
// this.diaDestroy() |
|||
this.$emit('diaDetailClose') |
|||
|
|||
}, |
|||
diaDestroy () { |
|||
if (map) { |
|||
map.destroy() |
|||
} |
|||
}, |
|||
async initForm (row, agencyObj) { |
|||
|
|||
|
|||
// this.dataForm = JSON.parse(JSON.stringify(row)) |
|||
this.agencyObj = agencyObj |
|||
this.houseId = row.houseId |
|||
await this.loadHouseInfo() |
|||
this.initLoading = true |
|||
|
|||
|
|||
|
|||
|
|||
// this.$refs.ref_form.resetFields(); |
|||
// this.agencyObj = agencyObj |
|||
// this.formType = type |
|||
// console.log('agencyObj-----', agencyObj) |
|||
// if (row) { |
|||
|
|||
// this.houseId = row.houseId |
|||
// await this.loadHouseInfo() |
|||
|
|||
|
|||
// } else { |
|||
|
|||
// this.dataForm.neighborHoodId = this.agencyObj.neighborHoodId |
|||
// this.dataForm.buildingId = this.agencyObj.id |
|||
// } |
|||
|
|||
|
|||
// await this.loadUnitList() |
|||
|
|||
}, |
|||
|
|||
async handleTuomin () { |
|||
const url = "/data/aggregator/epmetuser/detailByType"; |
|||
|
|||
const { data, code, msg } = await requestPost(url, { |
|||
id: this.houseId, |
|||
type: "checkHouse", |
|||
}); |
|||
|
|||
if (code === 0) { |
|||
this.$set(this.dataForm, 'showOwnerPhone', data.mobile) |
|||
this.$set(this.dataForm, 'showOwnerIdCard', data.idCard) |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
|
|||
}, |
|||
|
|||
async loadHouseInfo () { |
|||
|
|||
const url = "/gov/org/ichouse/" + this.houseId |
|||
|
|||
const { data, code, msg } = await requestGet(url) |
|||
|
|||
if (code === 0) { |
|||
// debugger |
|||
this.dataForm = { ...data } |
|||
|
|||
this.houseType = this.dataForm.houseType |
|||
this.purpose = this.dataForm.purpose |
|||
this.rentFlag = parseInt(this.dataForm.rentFlag) |
|||
|
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
|
|||
resetData () { |
|||
this.houseId = '' //房屋ID |
|||
this.houseType = '1' |
|||
this.purpose = '1' |
|||
this.rentFlag = 0 |
|||
this.dataForm = { |
|||
neighborHoodId: '', // 所属小区ID |
|||
buildingId: '',//所属楼栋ID |
|||
buildingUnitId: '',//所属单元ID |
|||
doorName: '',//门牌号 |
|||
houseType: '1',//房屋类型【楼房,平房,别墅】 |
|||
purpose: '1',//房屋用途【住宅,商业,办公,工业,仓储,商住混用,其他】 |
|||
rentFlag: 0,//是否出租【是:1,否:0】 |
|||
ownerPhone: '', //联系方式 |
|||
ownerName: '', //房主名字 |
|||
ownerIdCard: '', //房主身份证 |
|||
remark: '', // 备注 |
|||
coding: '', |
|||
sysCoding: '' |
|||
} |
|||
|
|||
}, |
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
buildingUnitId: [ |
|||
{ required: true, message: '所属单元不能为空', trigger: 'blur' }, |
|||
], |
|||
doorName: [ |
|||
{ required: true, message: '门牌号不能为空', trigger: 'blur' } |
|||
], |
|||
coding: [ |
|||
{ required: true, message: '房屋编码不能为空', trigger: 'blur' } |
|||
], |
|||
houseType: [ |
|||
{ required: true, message: '房屋类型不能为空', trigger: 'blur' } |
|||
], |
|||
purpose: [ |
|||
{ required: true, message: '房屋用途不能为空', trigger: 'blur' } |
|||
], |
|||
rentFlag: [ |
|||
{ required: true, message: '是否出租不能为空', trigger: 'blur' } |
|||
], |
|||
ownerPhone: [ |
|||
{ required: false } |
|||
], |
|||
ownerName: [ |
|||
{ required: false } |
|||
], |
|||
ownerIdCard: [ |
|||
{ required: false } |
|||
], |
|||
remark: [ |
|||
{ required: false } |
|||
], |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
props: { |
|||
view_real_data: {//显示【显示脱敏信息】按钮 |
|||
type: Boolean, |
|||
default: false, |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/management/detail-main.scss"; |
|||
|
|||
.div_tuomin { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 40px; |
|||
z-index: 1000; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,473 @@ |
|||
<template> |
|||
<div> |
|||
<div class="dialog-h-content scroll-h"> |
|||
|
|||
<el-form ref="ref_form" |
|||
:inline="false" |
|||
:model="dataForm" |
|||
:rules="dataRule" |
|||
:disabled="formType === 'detail'" |
|||
class="form"> |
|||
|
|||
<el-form-item label="所属楼栋" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<span>{{ agencyObj.neighborHoodName }}-{{agencyObj.label}}</span> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="单元号" |
|||
prop="buildingUnitId" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-select class="item_width_1" |
|||
v-model="dataForm.buildingUnitId" |
|||
placeholder="请选择" |
|||
clearable> |
|||
<el-option v-for="item in unitList" |
|||
:key="item.id" |
|||
:label="item.unitName" |
|||
:value="item.id"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="门牌号" |
|||
prop="doorName" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
placeholder="请输入门牌号" |
|||
v-model="dataForm.doorName"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item v-if="formType != 'detail'" |
|||
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-button style="margin-left: 10px" |
|||
type="primary" |
|||
size="small" |
|||
@click="handleCode">生成</el-button> |
|||
</el-form-item> |
|||
<div v-if="formType === 'detail'"> |
|||
<el-form-item label="房屋编码" |
|||
prop="houseCode" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
maxlength="30" |
|||
v-model="dataForm.houseCode"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<div v-if="dataForm.houseQrcodeUrl" |
|||
style="display: flex;flex-direction: column;"> |
|||
<img style="margin-left: 70px;width: 200px;" |
|||
:src="dataForm.houseQrcodeUrl"> |
|||
<a style="margin-left: 80px" |
|||
:href="dataForm.houseQrcodeUrl" |
|||
target="_blank">下载</a> |
|||
</div> |
|||
</div> |
|||
<!-- <el-form-item label="居住人数" |
|||
style="display: block" |
|||
prop="realPerson" |
|||
label-width="150px"> |
|||
<el-input-number class="item_width_4" |
|||
v-model="dataForm.realPerson" |
|||
:min="0" |
|||
:max="9999" |
|||
label="居住人数"></el-input-number> |
|||
</el-form-item> --> |
|||
<el-form-item label="房屋类型" |
|||
prop="houseType" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-radio-group v-model="houseType"> |
|||
|
|||
<el-radio :label="'1'">楼房</el-radio> |
|||
<el-radio :label="'2'">平房</el-radio> |
|||
<el-radio :label="'3'">别墅</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房屋用途" |
|||
prop="purpose" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-radio-group v-model="purpose"> |
|||
|
|||
<el-radio :label="'1'">住宅</el-radio> |
|||
<el-radio :label="'2'">商业</el-radio> |
|||
<el-radio :label="'3'">办公</el-radio> |
|||
<el-radio :label="'4'">工业</el-radio> |
|||
<el-radio :label="'5'">仓储</el-radio> |
|||
<el-radio :label="'6'">商住混用</el-radio> |
|||
<el-radio :label="'7'">其他</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房屋状态" |
|||
prop="rentFlag" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-radio-group v-model="rentFlag"> |
|||
|
|||
<el-radio :label="1">出租</el-radio> |
|||
<el-radio :label="2">闲置</el-radio> |
|||
<el-radio :label="0">自住</el-radio> |
|||
<el-radio :label="3">未出售</el-radio> |
|||
|
|||
</el-radio-group> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="房主姓名" |
|||
prop="ownerName" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
maxlength="30" |
|||
placeholder="请输入房主姓名" |
|||
v-model="dataForm.ownerName"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="联系方式" |
|||
prop="ownerPhone" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
type='number' |
|||
placeholder="请输入联系方式" |
|||
v-model="dataForm.ownerPhone"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="房主身份证" |
|||
prop="ownerIdCard" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
placeholder="请输入房主身份证" |
|||
v-model="dataForm.ownerIdCard"> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="备注" |
|||
prop="remark" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
<el-input class="item_width_1" |
|||
maxlength="30" |
|||
placeholder="请输入备注" |
|||
v-model="dataForm.remark"> |
|||
</el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button size="small" |
|||
@click="handleCancle">取 消</el-button> |
|||
<el-button size="small" |
|||
v-if="formType != 'detail'" |
|||
type="primary" |
|||
:disabled="btnDisable" |
|||
@click="handleComfirm">确 定</el-button> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex' |
|||
import { Loading } from 'element-ui' // 引入Loading服务 |
|||
import { requestPost, requestGet } from '@/js/dai/request' |
|||
|
|||
|
|||
let loading // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|||
btnDisable: false, |
|||
unitList: [], |
|||
|
|||
houseId: '', //房屋ID |
|||
houseType: '1', |
|||
purpose: '1', |
|||
rentFlag: 0, |
|||
dataForm: { |
|||
neighborHoodId: '', // 所属小区ID |
|||
buildingId: '',//所属楼栋ID |
|||
buildingUnitId: '',//所属单元ID |
|||
doorName: '',//门牌号 |
|||
houseType: '',//房屋类型【楼房,平房,别墅】 |
|||
purpose: '',//房屋用途【住宅,商业,办公,工业,仓储,商住混用,其他】 |
|||
rentFlag: 0,//房屋状态【是:1,否:0】 出租1、闲置2、自住 0 |
|||
ownerPhone: '', //联系方式 |
|||
ownerName: '', //房主名字 |
|||
ownerIdCard: '', //房主身份证 |
|||
remark: '', |
|||
// realPerson: 0, |
|||
coding: '', |
|||
sysCoding: '' |
|||
}, |
|||
|
|||
keyWords: '', |
|||
agencyObj: {}, |
|||
|
|||
} |
|||
}, |
|||
components: {}, |
|||
mounted () { |
|||
|
|||
}, |
|||
|
|||
methods: { |
|||
|
|||
async initForm (type, row, agencyObj) { |
|||
|
|||
this.$refs.ref_form.resetFields(); |
|||
this.agencyObj = agencyObj |
|||
this.formType = type |
|||
console.log('agencyObj-----', agencyObj) |
|||
if (row) { |
|||
|
|||
this.houseId = row.houseId |
|||
await this.loadHouseInfo() |
|||
// this.dataForm = JSON.parse(JSON.stringify(row)) |
|||
// this.houseId = this.dataForm.houseId |
|||
|
|||
// this.dataForm.buildingUnitId = this.dataForm.unitNumKey |
|||
// this.dataForm = { ... this.dataForm } |
|||
// this.houseType = this.dataForm.houseTypeKey |
|||
// this.purpose = this.dataForm.purposeKey |
|||
// this.rentFlag = parseInt(this.dataForm.rentFlagKey) |
|||
|
|||
} else { |
|||
|
|||
this.dataForm.neighborHoodId = this.agencyObj.neighborHoodId |
|||
this.dataForm.buildingId = this.agencyObj.id |
|||
} |
|||
|
|||
|
|||
await this.loadUnitList() |
|||
|
|||
}, |
|||
|
|||
|
|||
async loadHouseInfo () { |
|||
|
|||
const url = "/gov/org/ichouse/" + this.houseId |
|||
|
|||
const { data, code, msg } = await requestGet(url) |
|||
|
|||
if (code === 0) { |
|||
// debugger |
|||
this.dataForm = { ...data } |
|||
|
|||
this.houseType = this.dataForm.houseType |
|||
this.purpose = this.dataForm.purpose |
|||
this.rentFlag = parseInt(this.dataForm.rentFlag) |
|||
|
|||
|
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
//加载单元 |
|||
async loadUnitList () { |
|||
const url = '/gov/org/building/buildingunitlist' |
|||
|
|||
let params = { |
|||
buildingId: this.dataForm.buildingId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.unitList = data |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
async handleCode () { |
|||
if (!this.dataForm.buildingUnitId) return this.$message.error('请选择单元') |
|||
const { data, code, msg } = await requestPost( |
|||
"/gov/org/houseInformation/getHouseCoding/" + this.dataForm.buildingUnitId); |
|||
if (msg == "success" && code == 0) { |
|||
this.dataForm.coding = data.coding |
|||
this.dataForm.sysCoding = data.sysCoding |
|||
|
|||
} |
|||
}, |
|||
|
|||
async handleComfirm () { |
|||
this.btnDisable = true |
|||
setTimeout(() => { |
|||
this.btnDisable = false |
|||
}, 10000) |
|||
|
|||
this.dataForm.houseType = this.houseType |
|||
this.dataForm.purpose = this.purpose |
|||
this.dataForm.rentFlag = this.rentFlag |
|||
this.$refs['ref_form'].validate((valid, messageObj) => { |
|||
if (!valid) { |
|||
this.btnDisable = false |
|||
app.util.validateRule(messageObj) |
|||
} else { |
|||
this.addRoom() |
|||
} |
|||
|
|||
}) |
|||
}, |
|||
|
|||
async addRoom () { |
|||
const regCard = /(^\d{15}$)|(^\d{17}(\d|X)$)/; //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X |
|||
if (this.dataForm.ownerIdCard && regCard.test(this.dataForm.ownerIdCard) === false) { |
|||
this.btnDisable = false |
|||
this.$message({ |
|||
type: 'warning', |
|||
message: '请输入正确的身份证号码' |
|||
}) |
|||
return false; |
|||
} |
|||
const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/; //手机号码 |
|||
if (this.dataForm.ownerPhone && regPhone.test(this.dataForm.ownerPhone) === false) { |
|||
this.btnDisable = false |
|||
this.$message({ |
|||
type: 'warning', |
|||
message: '请输入正确的手机号码' |
|||
}) |
|||
return false; |
|||
} |
|||
|
|||
let url = '' |
|||
|
|||
if (this.formType === 'add') { |
|||
url = '/gov/org/house/houseadd' |
|||
} else { |
|||
url = '/gov/org/house/houseupdate' |
|||
this.dataForm.houseId = this.houseId |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.dataForm) |
|||
this.btnDisable = false |
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '操作成功' |
|||
}) |
|||
this.resetData() |
|||
this.$emit('dialogOk') |
|||
|
|||
} else { |
|||
|
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
handleCancle () { |
|||
this.resetData() |
|||
this.$emit('dialogCancle') |
|||
|
|||
}, |
|||
|
|||
resetData () { |
|||
this.houseId = '' //房屋ID |
|||
this.houseType = '1' |
|||
this.purpose = '1' |
|||
this.rentFlag = 0 |
|||
this.dataForm = { |
|||
neighborHoodId: '', // 所属小区ID |
|||
buildingId: '',//所属楼栋ID |
|||
buildingUnitId: '',//所属单元ID |
|||
doorName: '',//门牌号 |
|||
houseType: '1',//房屋类型【楼房,平房,别墅】 |
|||
purpose: '1',//房屋用途【住宅,商业,办公,工业,仓储,商住混用,其他】 |
|||
rentFlag: 0,//是否出租【是:1,否:0】 |
|||
ownerPhone: '', //联系方式 |
|||
ownerName: '', //房主名字 |
|||
ownerIdCard: '', //房主身份证 |
|||
remark: '', // 备注 |
|||
coding: '', |
|||
sysCoding: '' |
|||
} |
|||
|
|||
}, |
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: '正在加载……', // 加载中需要显示的文字 |
|||
background: 'rgba(0,0,0,.7)' // 背景颜色 |
|||
}) |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close() |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
buildingUnitId: [ |
|||
{ required: true, message: '所属单元不能为空', trigger: 'blur' }, |
|||
], |
|||
doorName: [ |
|||
{ required: true, message: '门牌号不能为空', trigger: 'blur' } |
|||
], |
|||
coding: [ |
|||
{ required: true, message: '房屋编码不能为空', trigger: 'blur' } |
|||
], |
|||
houseType: [ |
|||
{ required: true, message: '房屋类型不能为空', trigger: 'blur' } |
|||
], |
|||
purpose: [ |
|||
{ required: true, message: '房屋用途不能为空', trigger: 'blur' } |
|||
], |
|||
rentFlag: [ |
|||
{ required: true, message: '是否出租不能为空', trigger: 'blur' } |
|||
], |
|||
ownerPhone: [ |
|||
{ required: false } |
|||
], |
|||
ownerName: [ |
|||
{ required: false } |
|||
], |
|||
ownerIdCard: [ |
|||
{ required: false } |
|||
], |
|||
remark: [ |
|||
{ required: false } |
|||
], |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
props: { |
|||
view_real_data: {//显示【显示脱敏信息】按钮 |
|||
type: Boolean, |
|||
default: false, |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped > |
|||
@import "@/assets/scss/modules/visual/communityManageForm.scss"; |
|||
|
|||
.div_tuomin { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 40px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,987 @@ |
|||
<template> |
|||
<div> |
|||
<div class="div_btn"> |
|||
<el-button v-if="agencyObj.level === 'building' || source !== 'search'" |
|||
v-show="btnAuths.ic_house_add" |
|||
style="float: left" |
|||
class="diy-button--add" |
|||
size="small" |
|||
@click="handleAdd">新增房屋</el-button> |
|||
<div class="btn_upload" |
|||
v-if="showImportBtn"> |
|||
<el-button :headers="$getElUploadHeaders()" |
|||
v-if="btnAuths.ic_house_import" |
|||
style="float: left" |
|||
class="diy-button--export" |
|||
size="small" |
|||
@click="handleExportModule">下载房屋模板</el-button> |
|||
<el-upload ref="upload" |
|||
v-if="btnAuths.ic_house_import" |
|||
:multiple="false" |
|||
:show-file-list="false" |
|||
:before-upload="beforeUpload" |
|||
action="" |
|||
accept=".xls,.xlsx" |
|||
:limit="1" |
|||
:on-exceed="handleExceed" |
|||
:http-request="uploadFile"> |
|||
<el-button style="margin-left: 10px" |
|||
size="small" |
|||
class="diy-button--delete">导入房屋数据</el-button> |
|||
</el-upload> |
|||
</div> |
|||
<el-button style="float: left; margin-left: 10px" |
|||
v-if="btnAuths.ic_house_export" |
|||
class="diy-button--reset" |
|||
size="small" |
|||
@click="handleExport">导出</el-button> |
|||
<el-button style="float: left; margin-left: 10px" |
|||
v-if="btnAuths.ic_house_batch_del" |
|||
class="diy-button--more" |
|||
size="small" |
|||
@click="deleteBatch">批量删除</el-button> |
|||
<el-button style="margin-left: 10px" |
|||
v-if="btnAuths.ic_house_export_yhyd" |
|||
class="diy-button--export" |
|||
size="small" |
|||
:disabled="yihuyidangDisabled" |
|||
@click="handleExportYihuyidang()">导出一户一档</el-button> |
|||
<el-button size="small" |
|||
class="diy-button--add" |
|||
v-if="btnAuths.ic_house_smart_import && displayedBaobiaoBtn" |
|||
@click="reportForm">智能填报</el-button> |
|||
</div> |
|||
|
|||
<div class="div_table_item"> |
|||
<el-table ref="ref_table" |
|||
:data="tableData" |
|||
:header-cell-style="{ background: '#2195FE', color: '#FFFFFF' }" |
|||
v-loading="tableLoading" |
|||
@sort-change="handleSortOrderChange" |
|||
border |
|||
:height="tableHeight" |
|||
style="width: 100%" |
|||
@select-all="selectAll" |
|||
@selection-change="selectionChange"> |
|||
<el-table-column type="selection" |
|||
:selectable="checkSelect" |
|||
width="55"> |
|||
</el-table-column> |
|||
<el-table-column fixed="left" |
|||
width="55" |
|||
type="index" |
|||
label="序号" |
|||
:index="indexMethod"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="houseNameShow" |
|||
label="房屋名称" |
|||
fixed="left" |
|||
min-width="160"> |
|||
</el-table-column> |
|||
<el-table-column prop="neighborHoodName" |
|||
label="所属小区" |
|||
min-width="150"> |
|||
</el-table-column> |
|||
<el-table-column prop="buildingName" |
|||
label="所属楼栋" |
|||
width="80"> |
|||
</el-table-column> |
|||
<el-table-column prop="unitNum" |
|||
label="单元号" |
|||
width="70"> |
|||
</el-table-column> |
|||
<el-table-column prop="doorName" |
|||
label="门牌号" |
|||
width="70"> |
|||
</el-table-column> |
|||
<el-table-column prop="houseType" |
|||
label="类型" |
|||
width="50"> |
|||
</el-table-column> |
|||
<el-table-column prop="purpose" |
|||
label="用途" |
|||
width="50"> |
|||
</el-table-column> |
|||
<el-table-column prop="rentFlag" |
|||
label="房屋状态" |
|||
width="80"> |
|||
</el-table-column> |
|||
<el-table-column prop="ownerName" |
|||
label="房主姓名" |
|||
width="90"> |
|||
</el-table-column> |
|||
<el-table-column prop="ownerPhone" |
|||
label="联系方式" |
|||
width="110"> |
|||
</el-table-column> |
|||
<el-table-column prop="ownerIdCard" |
|||
label="身份证" |
|||
width="170"> |
|||
</el-table-column> |
|||
<el-table-column prop="remark" |
|||
label="备注" |
|||
width="170"> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="sort" |
|||
sortable="custom" |
|||
min-width="140" |
|||
label="排序"> |
|||
<template slot-scope="scope"> |
|||
<div @click="handleEditSort(scope.row)"> |
|||
<span v-if="!scope.row.isChange">{{ scope.row.sort }}</span> |
|||
<el-input-number v-else |
|||
@change="handleChangeSort(scope.row)" |
|||
v-model="scope.row.sort" |
|||
class="item_width_4" |
|||
:precision="2" |
|||
size="small" |
|||
:min="0" |
|||
:max="9999" |
|||
label="描述文字"></el-input-number> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" |
|||
fixed="right" |
|||
width="140" |
|||
header-align="center" |
|||
align="center" |
|||
class="operate"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="text" |
|||
v-if="btnAuths.ic_house_view" |
|||
class="div-table-button--detail" |
|||
size="small" |
|||
@click="handleDetail(scope.row)">查看</el-button> |
|||
<el-button v-if="btnAuths.ic_house_update && scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--edit" |
|||
size="small" |
|||
@click="handleEdit(scope.row)">修改</el-button> |
|||
|
|||
<el-button v-if="btnAuths.ic_house_del && scope.row.showBtn" |
|||
type="text" |
|||
class="div-table-button--delete" |
|||
size="small" |
|||
@click="handleDelete(scope.row)">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div> |
|||
<el-pagination @size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="pageSize" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total"> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 修改弹出框 --> |
|||
<el-dialog :visible.sync="formShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="formTitle" |
|||
width="900px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="diaClose"> |
|||
<room-form ref="ref_form" |
|||
:view_real_data="btnAuths.ic_house_view_real_data" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></room-form> |
|||
</el-dialog> |
|||
|
|||
<!-- 详情弹出框 --> |
|||
<el-dialog :visible.sync="detailShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="'查看房屋'" |
|||
width="900px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="detailFormCancle"> |
|||
<room-detail ref="ref_form_detail" |
|||
:view_real_data="btnAuths.ic_house_view_real_data" |
|||
@diaDetailClose="detailFormCancle"></room-detail> |
|||
</el-dialog> |
|||
|
|||
<baobiao ref="baobiao" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import roomForm from "./roomForm"; |
|||
import roomDetail from "./roomDetail"; |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from "vuex"; |
|||
import { Loading } from "element-ui"; // 引入Loading服务 |
|||
import baobiao from "@/views/modules/cpts/baobiao"; |
|||
|
|||
let loading; // 加载动画 |
|||
export default { |
|||
data () { |
|||
return { |
|||
source: "tree", //来源 |
|||
importRoomLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
sortType: "asc", //asc:正,desc:倒 |
|||
tableLoading: true, |
|||
|
|||
// showImportBtn: false,//是否显示操作按钮,根据登录人所属组织判断 |
|||
|
|||
agencyObj: {}, //树所选的小区对象 |
|||
agencyLevel: "", //树对应的level, grid neighborHood building agency |
|||
|
|||
validTableDataNum: 0, //有效的数据数量,即有权限操作的数据数量 |
|||
selection: [], |
|||
showDeletBtn: false, |
|||
|
|||
tableData: [], |
|||
|
|||
//form相关 |
|||
formShow: false, |
|||
formTitle: "新增房屋", |
|||
detailShow: false, |
|||
|
|||
rentList: [ |
|||
{ |
|||
value: "1", |
|||
label: "出租", |
|||
}, |
|||
{ |
|||
value: "2", |
|||
label: "闲置", |
|||
}, |
|||
{ |
|||
value: "0", |
|||
label: "自住", |
|||
}, |
|||
], |
|||
|
|||
yihuyidangDisabled: false, |
|||
|
|||
displayedBaobiaoBtn: false, |
|||
|
|||
btnAuths: { |
|||
ic_house_add: false, //新增 |
|||
ic_house_import: false, //导入 |
|||
ic_house_export: false, //导出 |
|||
ic_house_batch_del: false, //批量删除 |
|||
ic_house_export_yhyd: false, //导出一户一档 |
|||
ic_house_smart_import: false, //智能填表 |
|||
ic_house_del: false, //删除 |
|||
ic_house_view: false, //查看 |
|||
ic_house_update: false, //修改 |
|||
ic_house_view_real_data: false, //显示脱敏信息 |
|||
}, |
|||
}; |
|||
}, |
|||
components: { |
|||
baobiao, |
|||
roomForm, |
|||
roomDetail, |
|||
}, |
|||
async mounted () { |
|||
this.updateBtnAuths(); |
|||
|
|||
console.log(this.buildingId) |
|||
|
|||
this.displayedBaobiaoBtn = await this.$refs.baobiao.existsTemplate({ |
|||
elseParams: { |
|||
categoryKeys: ["house_info"], |
|||
categoryKey: "house_info", |
|||
}, |
|||
}); |
|||
}, |
|||
computed: { |
|||
tableHeight () { |
|||
return this.$store.state.inIframe |
|||
? this.clientHeight - 425 + this.iframeHeight |
|||
: this.clientHeight - 425; |
|||
}, |
|||
|
|||
...mapGetters(["clientHeight", "iframeHeight"]), |
|||
}, |
|||
methods: { |
|||
// 更新按钮权限 |
|||
updateBtnAuths () { |
|||
let rot = this.$route; |
|||
if (Array.isArray(rot.meta.btns)) { |
|||
rot.meta.btns.forEach((item) => { |
|||
this.btnAuths[item.permissions] = true; |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
reportForm () { |
|||
let paramMap = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
level: this.agencyLevel, |
|||
id: this.agencyObj.id, |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentFlag: this.rentFlag, |
|||
purpose: this.purpose, |
|||
remark: this.remark, |
|||
sortType: this.sortType, |
|||
updateStartDate: this.updateStartDate, |
|||
updateEndDate: this.updateEndDate, |
|||
neighborHoodId: this.neighborHoodId, |
|||
buildingId: this.buildingId, |
|||
buildingUnitId: this.buildingUnitId, |
|||
houseId: this.houseId, |
|||
}; |
|||
this.$refs.baobiao.init({ |
|||
elseParams: { |
|||
categoryKeys: ["house_info"], |
|||
categoryKey: "house_info", |
|||
paramMap, |
|||
}, |
|||
}); |
|||
}, |
|||
|
|||
indexMethod (index) { |
|||
return index + 1; |
|||
}, |
|||
handleSortOrderChange (value) { |
|||
this.sortType = value.order === "ascending" ? "asc" : "desc"; |
|||
this.loadTable(); |
|||
}, |
|||
handleSortChange (value) { |
|||
this.sortType = value.order === "ascending" ? "asc" : "desc"; |
|||
this.loadTable(); |
|||
}, |
|||
|
|||
handleEditSort (row) { |
|||
if (!row.isChange) { |
|||
row.isChange = true; |
|||
} |
|||
}, |
|||
|
|||
async handleChangeSort (row, index) { |
|||
// row.isChange = false |
|||
|
|||
let params = { |
|||
id: row.houseId, |
|||
sort: row.sort, |
|||
type: "house", |
|||
}; |
|||
|
|||
let url = "/gov/org/house/update-sort"; |
|||
|
|||
const { data, code, msg } = await requestPost(url, params); |
|||
|
|||
if (code === 0) { |
|||
// this.$message({ |
|||
// type: 'success', |
|||
// message: '修改成功' |
|||
// }) |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
checkSelect (row, index) { |
|||
let isChecked = false; |
|||
if (row.showBtn) { |
|||
// 判断里面是否存在某个参数 |
|||
isChecked = true; |
|||
} else { |
|||
isChecked = false; |
|||
} |
|||
return isChecked; |
|||
}, |
|||
|
|||
loadTreeFromSearch () { }, |
|||
|
|||
async loadTable (source, treeObj) { |
|||
this.source = source; |
|||
this.tableLoading = true; |
|||
|
|||
if (source === "tree") { |
|||
//来源于tree,查询数据清空 |
|||
this.sortType = "asc"; |
|||
this.agencyObj = treeObj; |
|||
} else if (source === "search") { |
|||
//来源于查询 |
|||
this.agencyObj = treeObj; |
|||
} |
|||
|
|||
if (this.agencyObj.level === "grid") { |
|||
this.agencyLevel = "grid"; |
|||
} else if (this.agencyObj.level === "neighborHood") { |
|||
this.agencyLevel = "neighborHood"; |
|||
} else if (this.agencyObj.level === "building") { |
|||
this.agencyLevel = "building"; |
|||
} else { |
|||
this.agencyLevel = "agency"; |
|||
} |
|||
|
|||
let params = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
level: this.agencyLevel, |
|||
id: this.agencyObj.id, |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentFlag: this.rentFlag, |
|||
purpose: this.purpose, |
|||
remark: this.remark, |
|||
sortType: this.sortType, |
|||
updateStartDate: this.updateStartDate, |
|||
updateEndDate: this.updateEndDate, |
|||
// neighborHoodId: this.neighborHoodId, |
|||
// buildingId: this.buildingId, |
|||
// buildingUnitId: this.buildingUnitId, |
|||
// houseId: this.houseId, |
|||
orgType: this.orgType, |
|||
orgId: this.orgId, |
|||
}; |
|||
|
|||
const url = "/gov/org/house/houselist"; |
|||
|
|||
const { data, code, msg } = await requestPost(url, params); |
|||
|
|||
if (code === 0) { |
|||
this.total = data.total; |
|||
this.validTableDataNum = 0; |
|||
data.list.forEach((item) => { |
|||
item.sort = parseInt(item.sort) || 0; |
|||
item.sort = item.sort.toFixed(2); |
|||
item.isChange = false; |
|||
item.houseNameShow = |
|||
item.neighborHoodName + |
|||
item.buildingName + |
|||
item.unitNum + |
|||
item.doorName; |
|||
|
|||
if (item.agencyId === this.staffAgencyId) { |
|||
item.showBtn = true; |
|||
this.validTableDataNum++; |
|||
} else { |
|||
item.showBtn = false; |
|||
} |
|||
}); |
|||
this.tableData = data.list; |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
this.tableLoading = false; |
|||
}, |
|||
|
|||
diaClose () { |
|||
this.$refs.ref_form.resetData(); |
|||
this.formShow = false; |
|||
}, |
|||
|
|||
handleDetail (row) { |
|||
// this.formTitle = "房屋详情"; |
|||
// this.formShow = true; |
|||
// this.$nextTick(() => { |
|||
// this.$refs.ref_form.initForm("detail", row, this.agencyObj); |
|||
// }); |
|||
|
|||
this.detailShow = true; |
|||
|
|||
// const _data = await this.detail(row) |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form_detail.initForm(row, this.agencyObj); |
|||
}); |
|||
}, |
|||
|
|||
detailFormCancle () { |
|||
// this.$refs.ref_form_detail.diaDestroy() |
|||
this.detailShow = false; |
|||
}, |
|||
|
|||
handleAdd () { |
|||
this.formTitle = "新增房屋"; |
|||
this.formShow = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm("add", null, this.agencyObj); |
|||
}); |
|||
}, |
|||
|
|||
handleEdit (row) { |
|||
this.formTitle = "修改房屋"; |
|||
this.formShow = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_form.initForm("edit", row, this.agencyObj); |
|||
}); |
|||
}, |
|||
|
|||
addFormCancle () { |
|||
this.formShow = false; |
|||
}, |
|||
addFormOk () { |
|||
this.formShow = false; |
|||
this.loadTable(); |
|||
}, |
|||
|
|||
deleteBatch () { |
|||
if (this.selection.length > 0) { |
|||
this.$confirm("确认删除选择的房屋?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
this.deleteCommunityBatch(); |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
}); |
|||
} else { |
|||
this.$message.warning("请先选择要删除的房屋"); |
|||
} |
|||
}, |
|||
selectAll (selection) { |
|||
this.selection = selection; |
|||
}, |
|||
selectionChange (selection) { |
|||
this.selection = selection; |
|||
}, |
|||
|
|||
async handleDelete (row) { |
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
this.deleteRoom(row); |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
async deleteCommunityBatch () { |
|||
let ids = []; |
|||
this.selection.forEach((element) => { |
|||
ids.push(element.houseId); |
|||
}); |
|||
|
|||
const url = "/gov/org/house/delete"; |
|||
|
|||
let params = { |
|||
type: "house", |
|||
ids: ids, |
|||
}; |
|||
|
|||
const { data, code, msg } = await requestPost(url, params); |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功", |
|||
}); |
|||
this.$emit("refreshTree"); |
|||
this.loadTable(); |
|||
} else if (code > 8000) { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: msg, |
|||
duration: 0, |
|||
}); |
|||
this.$emit("refreshTree"); |
|||
this.loadTable(); |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
async deleteRoom (row) { |
|||
const url = "/gov/org/house/housedel"; |
|||
|
|||
let params = { |
|||
houseId: row.houseId, |
|||
}; |
|||
|
|||
const { data, code, msg } = await requestPost(url, params); |
|||
|
|||
if (code === 0) { |
|||
this.$message({ |
|||
type: "success", |
|||
message: "删除成功", |
|||
}); |
|||
this.$emit("refreshTree"); |
|||
this.loadTable(); |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
//导出表格 |
|||
async handleExport () { |
|||
let title = this.agencyObj.label; |
|||
title = title + "—房屋列表"; |
|||
|
|||
const url = "/gov/org/house/exporthouseinfo"; |
|||
let params = { |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentFlag: this.rentFlag, |
|||
purpose: this.purpose, |
|||
remark: this.remark, |
|||
updateStartDate: this.updateStartDate, |
|||
updateEndDate: this.updateEndDate, |
|||
buildingId: this.agencyObj.id, |
|||
neighborHoodId: this.neighborHoodId, |
|||
buildingId: this.buildingId, |
|||
buildingUnitId: this.buildingUnitId, |
|||
houseId: this.houseId, |
|||
}; |
|||
|
|||
if (this.agencyObj.level === "grid") { |
|||
params.gridId = this.agencyObj.id; |
|||
params.agencyId = ""; |
|||
params.buildingId = ""; |
|||
params.neighborHoodId = ""; |
|||
} else if (this.agencyObj.level === "neighborHood") { |
|||
params.neighborHoodId = this.agencyObj.id; |
|||
params.agencyId = ""; |
|||
params.buildingId = ""; |
|||
params.gridId = ""; |
|||
} else if (this.agencyObj.level === "building") { |
|||
params.buildingId = this.agencyObj.id; |
|||
params.agencyId = ""; |
|||
params.neighborHoodId = ""; |
|||
params.gridId = ""; |
|||
} else { |
|||
params.agencyId = this.agencyObj.id; |
|||
params.buildingId = ""; |
|||
params.neighborHoodId = ""; |
|||
params.gridId = ""; |
|||
} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
this.download(data, title + ".xls"); |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
}, |
|||
|
|||
// 下载文件 |
|||
download (data, fileName) { |
|||
if (!data) { |
|||
return; |
|||
} |
|||
|
|||
var csvData = new Blob([data]); |
|||
|
|||
if (window.navigator && window.navigator.msSaveOrOpenBlob) { |
|||
window.navigator.msSaveOrOpenBlob(csvData, fileName); |
|||
} |
|||
// for Non-IE (chrome, firefox etc.) |
|||
else { |
|||
var a = document.createElement("a"); |
|||
document.body.appendChild(a); |
|||
a.style = "display: none"; |
|||
var url = window.URL.createObjectURL(csvData); |
|||
a.href = url; |
|||
a.download = fileName; |
|||
a.click(); |
|||
a.remove(); |
|||
window.URL.revokeObjectURL(url); |
|||
} |
|||
}, |
|||
|
|||
handleExportModule () { |
|||
let title = ""; |
|||
title = "房屋模板"; |
|||
|
|||
const url = "/gov/org/house/exporttemplate"; |
|||
let params = {}; |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
this.download(data, title + ".xls"); |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
} |
|||
); |
|||
}, |
|||
|
|||
//导出一户一档 |
|||
handleExportYihuyidang () { |
|||
this.yihuyidangDisabled = true; |
|||
let title = this.agencyObj.label; |
|||
title = title + "-一户一档"; |
|||
let url = "/gov/org/house/exportHouseUser"; |
|||
|
|||
let params = { |
|||
agencyId: "", |
|||
gridId: "", |
|||
ownerName: this.ownerName, |
|||
ownerPhone: this.ownerPhone, |
|||
rentFlag: this.rentFlag, |
|||
purpose: this.purpose, |
|||
remark: this.remark, |
|||
updateStartDate: this.updateStartDate, |
|||
updateEndDate: this.updateEndDate, |
|||
neighborHoodId: this.neighborHoodId, |
|||
buildingId: this.buildingId, |
|||
buildingUnitId: this.buildingUnitId, |
|||
houseId: this.houseId, |
|||
buildingId: "", |
|||
neighborHoodId: "", |
|||
}; |
|||
|
|||
if (this.agencyObj.level === "grid") { |
|||
params.gridId = this.agencyObj.id; |
|||
params.agencyId = ""; |
|||
params.buildingId = ""; |
|||
params.neighborHoodId = ""; |
|||
} else if (this.agencyObj.level === "neighborHood") { |
|||
params.neighborHoodId = this.agencyObj.id; |
|||
params.agencyId = ""; |
|||
params.buildingId = ""; |
|||
params.gridId = ""; |
|||
} else if (this.agencyObj.level === "building") { |
|||
params.buildingId = this.agencyObj.id; |
|||
params.agencyId = ""; |
|||
params.neighborHoodId = ""; |
|||
params.gridId = ""; |
|||
} else { |
|||
params.agencyId = this.agencyObj.id; |
|||
params.buildingId = ""; |
|||
params.neighborHoodId = ""; |
|||
params.gridId = ""; |
|||
} |
|||
|
|||
app.ajax.exportFilePost( |
|||
url, |
|||
params, |
|||
(data, rspMsg) => { |
|||
this.download(data, title + ".xls"); |
|||
this.yihuyidangDisabled = false; |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.$message.error(rspMsg); |
|||
this.yihuyidangDisabled = false; |
|||
} |
|||
); |
|||
}, |
|||
// 上传文件之前的钩子 |
|||
beforeUpload (file) { |
|||
this.files = file; |
|||
|
|||
const isText = file.type === "application/vnd.ms-excel"; |
|||
const isTextComputer = |
|||
file.type === |
|||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
|||
|
|||
if (!isText && !isTextComputer) { |
|||
this.$message.error("请选择正确格式的文件"); |
|||
return false; |
|||
} else { |
|||
this.fileName = file.name; |
|||
return true; |
|||
} |
|||
}, |
|||
// 上传文件个数超过定义的数量 |
|||
handleExceed (files, fileList) { |
|||
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`); |
|||
}, |
|||
|
|||
async uploadFile () { |
|||
if (this.fileName == "") { |
|||
this.$message.warning("请选择要上传的文件!"); |
|||
return false; |
|||
} |
|||
|
|||
this.$message({ |
|||
showClose: true, |
|||
message: "导入中,请到系统管理-导入记录中查看进度", |
|||
duration: 0, |
|||
}); |
|||
|
|||
//清空上传列表 |
|||
this.$refs["upload"].clearFiles(); |
|||
|
|||
var url = "/gov/org/house/houseimport"; |
|||
|
|||
let fileFormData = new FormData(); |
|||
fileFormData.append("file", this.files); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append("orgId", this.agencyObj.id); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
fileFormData.append("orgType", this.agencyObj.level); //filename是键,file是值,就是要传的文件,test.zip是要传的文件名 |
|||
|
|||
this.importRoomLoading = true; |
|||
window.app.ajax.post2( |
|||
url, |
|||
fileFormData, |
|||
(data, rspMsg) => { |
|||
if (data.code === 0 && data.msg == "success") { |
|||
// this.$message.success('导入成功') |
|||
} else { |
|||
// this.$message({ |
|||
// showClose: true, |
|||
// message: rspMsg, |
|||
// duration: 0, |
|||
// type: "error" |
|||
// }) |
|||
// this.$message.error(rspMsg) |
|||
} |
|||
this.$emit("refreshTree"); |
|||
this.loadTable(); |
|||
this.importRoomLoading = false; |
|||
}, |
|||
(rspMsg, data) => { |
|||
this.importRoomLoading = false; |
|||
}, |
|||
{ headers: { "Content-Type": "multipart/form-data" } } |
|||
); |
|||
}, |
|||
|
|||
showMessage (msg) { |
|||
this.$alert(msg, "操作结果", { |
|||
confirmButtonText: "关闭", |
|||
callback: (action) => { |
|||
this.$emit("refreshTree"); |
|||
this.loadTable(); |
|||
}, |
|||
}); |
|||
}, |
|||
|
|||
handleSizeChange (val) { |
|||
this.pageSize = val; |
|||
this.pageNo = 1; |
|||
this.loadTable(); |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val; |
|||
this.loadTable(); |
|||
}, |
|||
|
|||
// 开启加载动画 |
|||
startLoading () { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: "正在加载……", // 加载中需要显示的文字 |
|||
background: "rgba(0,0,0,.7)", // 背景颜色 |
|||
}); |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading () { |
|||
// clearTimeout(timer); |
|||
if (loading) { |
|||
loading.close(); |
|||
} |
|||
}, |
|||
}, |
|||
watch: { |
|||
selection (val) { |
|||
if (val.length > 0) { |
|||
this.showDeletBtn = true; |
|||
} else { |
|||
this.showDeletBtn = false; |
|||
} |
|||
}, |
|||
}, |
|||
props: { |
|||
staffAgencyId: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
showImportBtn: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
ownerName: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
ownerPhone: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
rentFlag: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
purpose: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
remark: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
updateStartDate: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
updateEndDate: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
neighborHoodId: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
buildingId: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
buildingUnitId: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
houseId: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
orgType: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
orgId: { |
|||
type: String, |
|||
default: "", |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/modules/visual/communityManage.scss"; |
|||
|
|||
.item_width_4 { |
|||
width: 120px; |
|||
} |
|||
|
|||
/deep/.el-input-number--medium .el-input-number__decrease, |
|||
/deep/.el-input-number--medium .el-input-number__increase { |
|||
width: 26px; |
|||
} |
|||
/deep/.el-input-number--medium .el-input__inner { |
|||
padding-left: 0px; |
|||
padding-right: 0px; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue