老产品前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

359 lines
10 KiB

4 years ago
<template>
<div>
<div>
<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.communityName }}{{agencyObj.label}}</span>
</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="所属家庭"
required>
<div class="resi-cell-value">
<div class="resi-cell-col">
<el-form-item prop="VILLAGE_ID">
<el-select v-model.trim="form.VILLAGE_ID"
placeholder="请选择小区"
size="small"
clearable
class="resi-cell-select"
@change="handleChangeV">
<el-option v-for="item in optionsV"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="BUILD_ID">
<el-select v-model.trim="form.BUILD_ID"
placeholder="请选择楼号"
size="small"
clearable
class="resi-cell-select resi-cell-select-middle"
@change="handleChangeB">
<el-option v-for="item in optionsB"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="UNIT_ID">
<el-select v-model.trim="form.UNIT_ID"
placeholder="请选择单元"
size="small"
clearable
class="resi-cell-select resi-cell-select-middle"
@change="handleChangeD">
<el-option v-for="item in optionsD"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="HOME_ID">
<el-select v-model.trim="form.HOME_ID"
placeholder="请选择房号"
size="small"
clearable
class="resi-cell-select resi-cell-select-middle">
<el-option v-for="item in optionsH"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
</el-form-item>
</el-form>
</div>
<div class="div_btn">
<el-button @click="handleCancle"> </el-button>
<el-button 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'
let loading // 加载动画
export default {
data () {
return {
btnDisable: false,
dataForm: {
icUserId: '', // 被调动人ID
type: '',//操作类型【客户外out,客户内in】
newAgencyId: '',//调动到的组织Id
newGridId: '',//调动到的网格Id
newNeighborHoodId: '',//调动到的小区ID
newBuildingId: '',//调动到的楼宇Id
newBuildingUnitId: 1,//调动到的单元Id
newHouseId: '', //调动到的房屋Id
transferTime: '', //调动时间【日期类型】
remark: '' //备注
},
staffId: '',//人员id
rootAgency: {}
}
},
components: {},
mounted () {
},
methods: {
async initForm (row, agencyObj) {
this.$refs.ref_form.resetFields();
this.staffId = row.staffId
await this.loadRootAgency()
},
//根据人员id获取根组织信息
async loadRootAgency () {
const url = '/gov/org/customeragency/root-orglist-by-staffid'
let params = {
staffId: this.staffId
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
if (data && data.length > 0) {
this.rootAgency = data[0]
}
} else {
this.$message.error(msg)
}
},
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()
}
})
},
getValiheList () {
this.$http
.post('/gov/org/icneighborhood/neighborhoodoption', { gridId: this.form.GRID_ID, agencyId: this.agencyId })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsV = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getBuildList () {
this.$http
.post('/gov/org/icbuilding/buildingoption', { neighborHoodId: this.form.VILLAGE_ID })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsB = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getUniList () {
this.$http
.post('/gov/org/icbuildingunit/unitoption', { buildingId: this.form.BUILD_ID })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsD = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
},
getHouseList () {
this.$http
.post('/gov/org/ichouse/houseoption', { unitId: this.form.UNIT_ID })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} else {
console.log('获取查询详情成功', res.data)
this.optionsH = res.data
}
})
.catch(() => {
return this.$message.error('网络错误')
})
}
handleCancle () {
this.resetData()
this.$emit('dialogCancle')
},
resetData () {
this.houseId = '' //房屋ID
this.houseType = '1'
this.purpose = '1'
this.rentFlag = 1
this.dataForm = {
neighborHoodId: '', // 所属小区ID
buildingId: '',//所属楼栋ID
buildingUnitId: '',//所属单元ID
doorName: '',//门牌号
houseType: '1',//房屋类型【楼房,平房,别墅】
purpose: '1',//房屋用途【住宅,商业,办公,工业,仓储,商住混用,其他】
rentFlag: 1,//是否出租【是:1,否:0】
ownerPhone: '', //房主电话
ownerName: '', //房主名字
ownerIdCard: '' //房主身份证
}
},
// 开启加载动画
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' }
],
houseType: [
{ required: true, message: '房屋类型不能为空', trigger: 'blur' }
],
purpose: [
{ required: true, message: '房屋用途不能为空', trigger: 'blur' }
],
rentFlag: [
{ required: true, message: '是否出租不能为空', trigger: 'blur' }
],
ownerPhone: [
{ required: true, message: '房主电话不能为空', trigger: 'blur' }
],
ownerName: [
{ required: true, message: '房主姓名不能为空', trigger: 'blur' }
],
ownerIdCard: [
{ required: true, message: '房主身份证号不能为空', trigger: 'blur' }
],
}
},
},
props: {}
}
</script>
<style lang="scss" scoped>
.item_width_1 {
width: 500px;
}
.item_width_2 {
width: 400px;
}
.item_width_3 {
margin-left: 10px;
width: 200px;
}
.div_btn {
display: flex;
justify-content: flex-end;
}
.el-tabs {
margin: 0 20px;
}
.el-upload__tip {
color: rgb(155, 155, 155);
margin: 0;
}
.form {
margin-top: 30px;
}
</style>
<style>
.el-dialog__body {
padding: 0 10px 20px !important;
}
</style>