|
|
|
<template>
|
|
|
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '140px' : '100px'">
|
|
|
|
<div>房屋信息</div>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="所在镇街" prop="streetId">
|
|
|
|
<el-select :disabled="dataForm.id" v-model="dataForm.streetId" @change="selectModel($event)" placeholder="请选择">
|
|
|
|
<el-option
|
|
|
|
v-for="item in streetArr"
|
|
|
|
:key="item.deptId"
|
|
|
|
:label="item.name"
|
|
|
|
:value="item.deptId"
|
|
|
|
>
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="所在村居"
|
|
|
|
prop="communityId">
|
|
|
|
<el-select :disabled="dataForm.id" v-model="dataForm.communityId" @change="selectGrid($event)"
|
|
|
|
placeholder="请选择"
|
|
|
|
>
|
|
|
|
<el-option v-for="item in communitys"
|
|
|
|
:key="item.deptId"
|
|
|
|
:label="item.name"
|
|
|
|
:value="item.deptId">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="所在网格"
|
|
|
|
prop="gridId">
|
|
|
|
<el-select :disabled="dataForm.id" v-model="dataForm.gridId" @change="selectPlot($event)"
|
|
|
|
placeholder="请选择"
|
|
|
|
>
|
|
|
|
<el-option v-for="item in grids"
|
|
|
|
:key="item.deptId"
|
|
|
|
:label="item.name"
|
|
|
|
:value="item.deptId">
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="所在街/路" prop="roadName">
|
|
|
|
<el-input v-model="dataForm.roadName" placeholder="如:某某路几号"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="所在小区" prop="plotId">
|
|
|
|
<el-select :disabled="dataForm.id" v-model="dataForm.plotId" @change="selectBuilding($event)" placeholder="请选择">
|
|
|
|
<el-option
|
|
|
|
v-for="item in plotArr"
|
|
|
|
:key="item.dictValue"
|
|
|
|
:label="item.dictName"
|
|
|
|
:value="item.dictValue"
|
|
|
|
>
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="楼栋" prop="buildingId">
|
|
|
|
<el-select :disabled="dataForm.id" v-model="dataForm.buildingId" clearable placeholder="请选择">
|
|
|
|
<el-option
|
|
|
|
v-for="item in buildingArr"
|
|
|
|
:key="item.dictValue"
|
|
|
|
:label="item.dictName"
|
|
|
|
:value="item.dictValue"
|
|
|
|
>
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="单元" prop="unit">
|
|
|
|
<el-input :disabled="dataForm.id" v-model="dataForm.unit" placeholder="单元"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="门牌号" prop="roomNo">
|
|
|
|
<el-input :disabled="dataForm.id" v-model="dataForm.roomNo" placeholder="门牌号"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="房屋类型" prop="roomType">
|
|
|
|
<el-select v-model="dataForm.roomType" placeholder="请选择" clearable >
|
|
|
|
<el-option v-for="item in roomTypeArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="房屋用途" prop="roomUse">
|
|
|
|
<el-select v-model="dataForm.roomUse" placeholder="请选择" clearable >
|
|
|
|
<el-option v-for="item in roomUseArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="房屋现状" prop="roomStatus">
|
|
|
|
<el-select v-model="dataForm.roomStatus" placeholder="请选择" clearable >
|
|
|
|
<el-option v-for="item in roomStatusArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="8">
|
|
|
|
<el-form-item label="居住情况" prop="livingStatus">
|
|
|
|
<el-select v-model="dataForm.livingStatus" placeholder="请选择" clearable @change="selectLivingStatus($event)">
|
|
|
|
<el-option v-for="item in livingStatusArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row v-if="dataForm.id">
|
|
|
|
<el-form-item label="房屋码" prop="roomCodeShow">
|
|
|
|
<el-input v-model="dataForm.roomCodeShow" placeholder="房屋码"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-row>
|
|
|
|
<div v-if="dataForm.owners.length > 0">房主信息</div>
|
|
|
|
<div v-for="(item, index) in dataForm.owners" :key="index">
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="10">
|
|
|
|
<el-form-item label="身份证号">
|
|
|
|
<el-input @blur="blurIdCard(item.idCard, index)" v-model="item.idCard" placeholder="身份证号"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="10">
|
|
|
|
<el-form-item label="房主姓名">
|
|
|
|
<el-input v-model="item.ownerName" placeholder="房主姓名"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="10">
|
|
|
|
<el-form-item label="联系电话">
|
|
|
|
<el-input v-model="item.mobile" placeholder="联系电话"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="10">
|
|
|
|
<el-form-item label="现住址">
|
|
|
|
<el-input v-model="item.address" placeholder="现住址"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="2">
|
|
|
|
<div @click="delOwners(item.idCard)" class="add-owners">
|
|
|
|
<i class="el-icon-circle-close"></i>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
<el-col v-if="index === 0" :span="2">
|
|
|
|
<div @click="addOwners" class="add-owners">
|
|
|
|
<i class="el-icon-circle-plus-outline"></i>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
|
|
|
<div>出租信息</div>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label="是否出租" prop="isRental">
|
|
|
|
<el-select v-model="dataForm.isRental" @change="selectYn($event)" placeholder="请选择" clearable >
|
|
|
|
<el-option v-for="item in yNArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item v-show="dataForm.isRental==='0'" label="出租用途" prop="rentalPurpose">
|
|
|
|
<el-select v-model="dataForm.rentalPurpose" placeholder="请选择" clearable >
|
|
|
|
<el-option v-for="item in rentalPurposeArr" :key="item.dictValue" :label="item.dictName" :value="item.dictValue" >
|
|
|
|
</el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item v-show="dataForm.isRental==='0'" label="承租人姓名" prop="lesseeName">
|
|
|
|
<el-input v-model="dataForm.lesseeName" placeholder="承租人姓名"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item v-show="dataForm.isRental==='0'" label="承租人电话" prop="lesseeMobile">
|
|
|
|
<el-input v-model="dataForm.lesseeMobile" placeholder="承租人电话"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item label-width="130px" v-show="dataForm.isRental==='0'" label="承租人身份证号" prop="lesseeIdCard">
|
|
|
|
<el-input v-model="dataForm.lesseeIdCard" placeholder="承租人身份证号"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item v-show="dataForm.isRental==='0'" label="承租单位" prop="lesseeUnit">
|
|
|
|
<el-input v-model="dataForm.lesseeUnit" placeholder="承租单位"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12"></el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item v-show="dataForm.isRental==='0'" label="承租日期" prop="lesseeDate">
|
|
|
|
<el-date-picker
|
|
|
|
v-model="dataForm.lesseeDate"
|
|
|
|
type="date"
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
format="yyyy-MM-dd"
|
|
|
|
style="width: 200px"
|
|
|
|
placeholder="选择日期">
|
|
|
|
</el-date-picker>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="12">
|
|
|
|
<el-form-item v-show="dataForm.isRental==='0'" label="承租期限" prop="lesseeTime">
|
|
|
|
<el-input v-model="dataForm.lesseeTime" placeholder="承租期限" style="width: 200px"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
<template slot="footer">
|
|
|
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
|
|
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import debounce from 'lodash/debounce'
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
visible: false,
|
|
|
|
buildingArr: [],
|
|
|
|
roomTypeArr: [],
|
|
|
|
roomUseArr: [],
|
|
|
|
rentalPurposeArr: [],
|
|
|
|
yNArr: [],
|
|
|
|
roomStatusArr: [],
|
|
|
|
livingStatusArr: [],
|
|
|
|
dataForm: {
|
|
|
|
id: '',
|
|
|
|
buildingId: '',
|
|
|
|
unit: '',
|
|
|
|
roomNo: '',
|
|
|
|
roadName: '',
|
|
|
|
roomType: '',
|
|
|
|
roomUse: '',
|
|
|
|
owners: [{
|
|
|
|
ownerName: '',
|
|
|
|
idCard: '',
|
|
|
|
mobile: '',
|
|
|
|
address: ''
|
|
|
|
}],
|
|
|
|
isRental: '1',
|
|
|
|
rentalPurpose: '',
|
|
|
|
lesseeName: '',
|
|
|
|
lesseeIdCard: '',
|
|
|
|
lesseeMobile: '',
|
|
|
|
lesseeUnit: '',
|
|
|
|
lesseeTime: '',
|
|
|
|
lesseeDate: '',
|
|
|
|
plotId: '',
|
|
|
|
streetId: '',
|
|
|
|
communityId: '',
|
|
|
|
gridId: '',
|
|
|
|
streetName: '',
|
|
|
|
communityName: '',
|
|
|
|
gridName: '',
|
|
|
|
roomStatus: '',
|
|
|
|
livingStatus: ''
|
|
|
|
},
|
|
|
|
streetArr: [],
|
|
|
|
communitys: [],
|
|
|
|
plotArr: [],
|
|
|
|
grids: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
dataRule () {
|
|
|
|
return {
|
|
|
|
gridId: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
streetId: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
communityId: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
ownerName: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
idCard: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
mobile: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
roomNo: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
],
|
|
|
|
roomType: [
|
|
|
|
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
init () {
|
|
|
|
this.getOptions()
|
|
|
|
this.getDailyTypeArrInfo()
|
|
|
|
this.visible = true
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs['dataForm'].resetFields()
|
|
|
|
this.dataForm.owners = [{
|
|
|
|
ownerName: '',
|
|
|
|
idCard: '',
|
|
|
|
mobile: '',
|
|
|
|
address: ''
|
|
|
|
}]
|
|
|
|
this.dataForm.streetName = ''
|
|
|
|
this.dataForm.communityName = ''
|
|
|
|
this.dataForm.gridName = ''
|
|
|
|
if (this.dataForm.id) {
|
|
|
|
this.getInfo()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取信息
|
|
|
|
getInfo () {
|
|
|
|
this.$http.get(`/custom/epidemicbuildingunit/${this.dataForm.id}`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.dataForm = {
|
|
|
|
...this.dataForm,
|
|
|
|
...res.data
|
|
|
|
}
|
|
|
|
this.queryComm(this.dataForm.streetId)
|
|
|
|
this.queryGrid(this.dataForm.communityId)
|
|
|
|
this.queryPlot()
|
|
|
|
if (this.dataForm.plotId != null) {
|
|
|
|
this.queryBuilding()
|
|
|
|
}
|
|
|
|
}).catch(() => {})
|
|
|
|
},
|
|
|
|
queryComm (event) {
|
|
|
|
this.$http.get(`sys/dept/deptInfo?deptPid=${event}`).then(({ data: res }) => {
|
|
|
|
this.communitys = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
},
|
|
|
|
queryGrid (event) {
|
|
|
|
this.$http.get(`sys/dept/deptInfo?deptPid=${event}`).then(({ data: res }) => {
|
|
|
|
this.grids = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
},
|
|
|
|
queryPlot () {
|
|
|
|
this.$http
|
|
|
|
.get(`/custom/epidemicplotcoordinate/getPlotOption?streetId=${this.dataForm.streetId}&communityId=${this.dataForm.communityId}&gridId=${this.dataForm.gridId}`)
|
|
|
|
.then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.plotArr = res.data
|
|
|
|
})
|
|
|
|
},
|
|
|
|
queryBuilding () {
|
|
|
|
this.$http
|
|
|
|
.get(`/custom/epidemicplotbuilding/getBuildingOption?plotId=${this.dataForm.plotId}`)
|
|
|
|
.then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.buildingArr = res.data
|
|
|
|
})
|
|
|
|
.catch(() => {})
|
|
|
|
},
|
|
|
|
// 获取乡镇下拉信息(传参:4代表查“街道”)
|
|
|
|
getDailyTypeArrInfo () {
|
|
|
|
this.$http.get(`sys/dept/deptInfo?tags=street_party`).then(({ data: res }) => {
|
|
|
|
this.streetArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
},
|
|
|
|
selectYn (event) {
|
|
|
|
if (event === '1') {
|
|
|
|
this.dataForm.rentalPurpose = ''
|
|
|
|
this.dataForm.lesseeName = ''
|
|
|
|
this.dataForm.lesseeIdCard = ''
|
|
|
|
this.dataForm.lesseeMobile = ''
|
|
|
|
this.dataForm.lesseeUnit = ''
|
|
|
|
this.dataForm.lesseeTime = ''
|
|
|
|
this.dataForm.lesseeDate = null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selectModel (event) {
|
|
|
|
this.dataForm.communityId = ''
|
|
|
|
this.streetArr.find((item) => {
|
|
|
|
if (item.deptId === event) {
|
|
|
|
this.dataForm.streetId = item.deptId
|
|
|
|
this.dataForm.streetName = item.name
|
|
|
|
this.queryComm(event)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
selectGrid (event) {
|
|
|
|
this.dataForm.gridId = ''
|
|
|
|
this.communitys.find((item) => {
|
|
|
|
if (item.deptId === event) {
|
|
|
|
this.dataForm.communityId = item.deptId
|
|
|
|
this.dataForm.communityName = item.name
|
|
|
|
this.queryGrid(event)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
selectPlot (event) {
|
|
|
|
this.dataForm.plotId = ''
|
|
|
|
this.grids.find((item) => {
|
|
|
|
if (item.deptId === event) {
|
|
|
|
this.dataForm.gridId = item.deptId
|
|
|
|
this.dataForm.gridName = item.name
|
|
|
|
this.queryPlot()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
selectBuilding (event) {
|
|
|
|
this.dataForm.buildingId = ''
|
|
|
|
this.plotArr.find((item) => {
|
|
|
|
if (item.dictValue === event) {
|
|
|
|
this.dataForm.plotId = item.dictValue
|
|
|
|
this.queryBuilding()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
selectLivingStatus (event) {
|
|
|
|
console.log(event)
|
|
|
|
},
|
|
|
|
getOptions () {
|
|
|
|
// this.$http
|
|
|
|
// .get(`/epidemicplotbuilding/getBuildingOption?plotId=${this.dataForm.plotId}`)
|
|
|
|
// .then(({ data: res }) => {
|
|
|
|
// if (res.code !== 0) {
|
|
|
|
// return this.$message.error(res.msg)
|
|
|
|
// }
|
|
|
|
// this.buildingArr = res.data
|
|
|
|
// })
|
|
|
|
// .catch(() => {})
|
|
|
|
this.$http.get(`/sys/dict/listSimple/room_type`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.roomTypeArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
this.$http.get(`/sys/dict/listSimple/room_use`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.roomUseArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
this.$http.get(`/sys/dict/listSimple/rental_purpose`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.rentalPurposeArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
this.$http.get(`/sys/dict/listSimple/epmet_y_n`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.yNArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
// 房屋现状
|
|
|
|
this.$http.get(`/sys/dict/listSimple/house_status`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.roomStatusArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
// 居住情况
|
|
|
|
this.$http.get(`/sys/dict/listSimple/house_purpose`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.livingStatusArr = res.data
|
|
|
|
}).catch(() => {})
|
|
|
|
},
|
|
|
|
// 当事人点击添加一条输入数据
|
|
|
|
addOwners () {
|
|
|
|
var nowOwners = this.dataForm.owners[this.dataForm.owners.length - 1]
|
|
|
|
if (!nowOwners.ownerName) {
|
|
|
|
return this.$message.error('请填写房主姓名')
|
|
|
|
} else if (!nowOwners.mobile) {
|
|
|
|
return this.$message.error('请填写联系电话')
|
|
|
|
} else if (!nowOwners.idCard) {
|
|
|
|
return this.$message.error('请填写身份证号')
|
|
|
|
}
|
|
|
|
this.dataForm.owners.push({
|
|
|
|
ownerName: '',
|
|
|
|
idCard: '',
|
|
|
|
mobile: '',
|
|
|
|
address: ''
|
|
|
|
})
|
|
|
|
},
|
|
|
|
delOwners (e) {
|
|
|
|
this.dataForm.owners.some((item, i) => {
|
|
|
|
if (item.idCard === e) {
|
|
|
|
this.dataForm.owners.splice(i, 1)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
if (this.dataForm.owners.length === 0) {
|
|
|
|
this.dataForm.owners.push({
|
|
|
|
ownerName: '',
|
|
|
|
idCard: '',
|
|
|
|
mobile: '',
|
|
|
|
address: ''
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
blurIdCard (idCard, index) {
|
|
|
|
this.$http.get(`custom/epidemicuserinfo/getOwner?idCard=${idCard}`).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
if (res.data) {
|
|
|
|
this.$set(this.dataForm.owners[index], 'ownerName', res.data.ownerName)
|
|
|
|
this.$set(this.dataForm.owners[index], 'mobile', res.data.mobile)
|
|
|
|
this.$set(this.dataForm.owners[index], 'address', res.data.address)
|
|
|
|
} else {
|
|
|
|
this.$set(this.dataForm.owners[index], 'ownerName', '')
|
|
|
|
this.$set(this.dataForm.owners[index], 'mobile', '')
|
|
|
|
this.$set(this.dataForm.owners[index], 'address', '')
|
|
|
|
}
|
|
|
|
}).catch(() => {})
|
|
|
|
},
|
|
|
|
// 表单提交
|
|
|
|
dataFormSubmitHandle: debounce(function () {
|
|
|
|
var nowOwners = this.dataForm.owners[0]
|
|
|
|
if (!nowOwners.ownerName) {
|
|
|
|
return this.$message.error('请填写房主姓名')
|
|
|
|
} else if (!nowOwners.mobile) {
|
|
|
|
return this.$message.error('请填写联系电话')
|
|
|
|
} else if (!nowOwners.idCard) {
|
|
|
|
return this.$message.error('请填写身份证号')
|
|
|
|
}
|
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
|
if (!valid) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/custom/epidemicbuildingunit/', this.dataForm).then(({ data: res }) => {
|
|
|
|
if (res.code !== 0) {
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
}
|
|
|
|
this.$message({
|
|
|
|
message: this.$t('prompt.success'),
|
|
|
|
type: 'success',
|
|
|
|
duration: 500,
|
|
|
|
onClose: () => {
|
|
|
|
this.visible = false
|
|
|
|
this.$emit('refreshDataList')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}).catch(() => {})
|
|
|
|
})
|
|
|
|
}, 1000, { 'leading': true, 'trailing': false })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.add-owners{
|
|
|
|
width: 40%;
|
|
|
|
height: 40px;
|
|
|
|
padding: 0 10px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.add-owners i{
|
|
|
|
width: 30px;
|
|
|
|
height: 30px;
|
|
|
|
font-size: 30px;
|
|
|
|
}
|
|
|
|
</style>
|