<template>
|
<div class="product">
|
<div class="property">
|
<p class="title">
|
<span></span>
|
物业明细信息
|
</p>
|
<el-tabs v-model="tabIndex" type="card" @tab-remove="delProperty">
|
<el-tab-pane
|
v-for="(item, index) in propertyForm"
|
:key="index"
|
:label="`物业${index+1}`"
|
:name="index+''"
|
:closable="propertyForm.length!=1&&writeAble"
|
>
|
<p class="btn">
|
<el-button
|
type="text"
|
@click="qryProjectInfoList"
|
v-if="applyInfo.phaseNo == '0010' || applyInfo.phaseNo == '0040'"
|
>查看项目清单</el-button>
|
<el-button type="text" @click="getBroomInfo" v-if="showBtns">查看代理交易信息</el-button>
|
<el-button
|
type="text"
|
@click="getProjectInfo(propertyForm[index])"
|
v-if="showBtns"
|
>查看项目信息</el-button>
|
</p>
|
<el-form
|
:model="propertyForm[index]"
|
:rules="rules"
|
ref="propertyForm"
|
inline
|
size="small"
|
label-width="165px"
|
>
|
<el-input v-model="propertyForm[index].serialno" v-show="false"></el-input>
|
<el-form-item
|
label="小区/项目名称"
|
v-if="propertyArr[index].buildingprojectid.visible"
|
prop="buildingprojectid"
|
:class="{'isDifferent':propertyArr[index].buildingprojectid.isDifferent}"
|
>
|
<el-select
|
v-model="propertyForm[index].buildingprojectid"
|
:disabled="!propertyArr[index].buildingprojectid.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
@change="selectBuildingproject(propertyForm,index)"
|
>
|
<el-option
|
v-for="(item,index) in projectList"
|
:key="index"
|
:label="item.projectname"
|
:value="item.serialno"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="项目类型"
|
v-if="propertyArr[index].projecttype.visible"
|
prop="projecttype"
|
:class="{'isDifferent':propertyArr[index].projecttype.isDifferent}"
|
>
|
<el-select
|
v-model="propertyForm[index].projecttype"
|
:disabled="!propertyArr[index].projecttype.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
>
|
<el-option
|
v-for="(item,index) in projectTypeList"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="楼栋单元或车位楼层"
|
v-if="propertyArr[index].buildingorunit.visible"
|
prop="buildingorunit"
|
:class="{'isDifferent':propertyArr[index].buildingorunit.isDifferent}"
|
>
|
<el-select
|
v-model="propertyForm[index].buildingorunit"
|
:disabled="!propertyArr[index].buildingorunit.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
@change="selectBuildingorunit(propertyForm,index)"
|
>
|
<el-option
|
v-for="(item,index) in propertyArr[index].buildList"
|
:key="index"
|
:label="item.buildname"
|
:value="item.serialno"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="房号/车位号"
|
v-if="propertyArr[index].houseorparkingid.visible&&propertyArr[index].isSelf"
|
prop="houseorparkingid"
|
:class="{'isDifferent':propertyArr[index].houseorparkingid.isDifferent}"
|
>
|
<el-select
|
v-model="propertyForm[index].houseorparkingid"
|
:disabled="!propertyArr[index].houseorparkingid.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
>
|
<el-option
|
v-for="(item,index) in propertyArr[index].roomList"
|
:key="index"
|
:label="item.roomname"
|
:value="item.roomid"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="房号/车位号"
|
v-if="propertyArr[index].houseorparkingname.visible&&!propertyArr[index].isSelf"
|
prop="houseorparkingname"
|
:class="{'isDifferent':propertyArr[index].houseorparkingname.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].houseorparkingname"
|
:disabled="!propertyArr[index].houseorparkingname.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="物业类型"
|
v-if="propertyArr[index].propertytype.visible"
|
prop="propertytype"
|
:class="{'isDifferent':propertyArr[index].propertytype.isDifferent}"
|
>
|
<el-input v-model="propertyForm[index].propertytype" v-show="false"></el-input>
|
<el-input v-model="propertyForm[index].propertytypename" disabled></el-input>
|
</el-form-item>
|
<el-form-item
|
label="房产成交总金额"
|
v-if="propertyArr[index].totalamount.visible"
|
prop="totalamount"
|
:class="{'isDifferent':propertyArr[index].totalamount.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].totalamount"
|
@blur="propertyForm[index].totalamount = formatMoney(propertyForm[index].totalamount)"
|
:disabled="!propertyArr[index].totalamount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="房产面积(㎡)"
|
v-if="propertyArr[index].coveredArea.visible"
|
prop="coveredArea"
|
:class="{'isDifferent':propertyArr[index].coveredArea.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].coveredArea"
|
@blur="propertyForm[index].coveredArea = formatMoney(propertyForm[index].coveredArea)"
|
:disabled="!propertyArr[index].coveredArea.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="实际首付金额"
|
v-if="propertyArr[index].downpaymentamount.visible"
|
prop="downpaymentamount"
|
:class="{'isDifferent':propertyArr[index].downpaymentamount.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].downpaymentamount"
|
@blur="propertyForm[index].downpaymentamount = formatMoney(propertyForm[index].downpaymentamount)"
|
:disabled="!propertyArr[index].downpaymentamount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="首付比例"
|
v-if="propertyArr[index].downpaymentratio.visible"
|
prop="downpaymentratio"
|
:class="{'isDifferent':propertyArr[index].downpaymentratio.isDifferent}"
|
>
|
<el-select
|
v-model="propertyForm[index].downpaymentratio"
|
:disabled="!propertyArr[index].downpaymentratio.writeAble"
|
clearable
|
filterable
|
placeholder="支持输入搜索选择"
|
>
|
<el-option
|
v-for="(item,index) in downpaymentRatiolist"
|
:key="index"
|
:label="item.itemname"
|
:value="item.itemno"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="是否产权人"
|
v-if="propertyArr[index].isowner.visible"
|
prop="isowner"
|
:class="{'isDifferent':propertyArr[index].isowner.isDifferent}"
|
>
|
<el-select
|
v-model="propertyForm[index].isowner"
|
clearable
|
:disabled="!propertyArr[index].isowner.writeAble"
|
placeholder="支持输入搜索选择"
|
>
|
<el-option label="是" value="1"></el-option>
|
<el-option label="否" value="0"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item
|
label="房产地址(省)"
|
v-if="propertyArr[index].houseprovince.visible"
|
prop="houseprovince"
|
:class="{'isDifferent':propertyArr[index].houseprovince.isDifferent}"
|
>
|
<el-input v-show="false" v-model="propertyForm[index].houseprovince" disabled></el-input>
|
<el-input v-model="propertyForm[index].houseprovinceDesc" disabled></el-input>
|
</el-form-item>
|
<el-form-item
|
label="房产地址(市)"
|
v-if="propertyArr[index].housecity.visible"
|
prop="housecity"
|
:class="{'isDifferent':propertyArr[index].housecity.isDifferent}"
|
>
|
<el-input v-show="false" v-model="propertyForm[index].housecity" disabled></el-input>
|
<el-input v-model="propertyForm[index].housecityDesc" disabled></el-input>
|
</el-form-item>
|
<el-form-item
|
label="房产地址(区)"
|
v-if="propertyArr[index].housecounty.visible"
|
prop="housecounty"
|
:class="{'isDifferent':propertyArr[index].housecounty.isDifferent}"
|
>
|
<el-input v-show="false" v-model="propertyForm[index].housecounty" disabled></el-input>
|
<el-input v-model="propertyForm[index].housecountyDesc" disabled></el-input>
|
</el-form-item>
|
<el-form-item
|
label="房产地址(街道/小区 名/单元/房号)"
|
v-if="propertyArr[index].houseaddress.visible"
|
prop="houseaddress"
|
:class="{'isDifferent':propertyArr[index].houseaddress.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].houseaddress"
|
:disabled="!propertyArr[index].houseaddress.writeAble"
|
></el-input>
|
</el-form-item>
|
<div class="form">
|
<el-form-item
|
label="装修总金额"
|
v-if="propertyArr[index].decorateamount.visible"
|
prop="decorateamount"
|
:class="{'isDifferent':propertyArr[index].decorateamount.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].decorateamount"
|
@blur="propertyForm[index].decorateamount = formatMoney(propertyForm[index].decorateamount)"
|
:disabled="!propertyArr[index].decorateamount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="定金缴纳日期"
|
v-if="propertyArr[index].depositpaymentdate.visible"
|
prop="depositpaymentdate"
|
:class="{'isDifferent':propertyArr[index].depositpaymentdate.isDifferent}"
|
>
|
<el-date-picker
|
v-model="propertyForm[index].depositpaymentdate"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
size="small"
|
placeholder="选择日期"
|
:disabled="!propertyArr[index].depositpaymentdate.writeAble"
|
></el-date-picker>
|
</el-form-item>
|
<el-form-item
|
label="装修首付金额"
|
v-if="propertyArr[index].downpaydecorateamount.visible"
|
prop="downpaydecorateamount"
|
:class="{'isDifferent':propertyArr[index].downpaydecorateamount.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].downpaydecorateamount"
|
@blur="propertyForm[index].downpaydecorateamount = formatMoney(propertyForm[index].downpaydecorateamount)"
|
:disabled="!propertyArr[index].downpaydecorateamount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="首付缴完日期"
|
v-if="propertyArr[index].downpaymentdate.visible"
|
prop="downpaymentdate"
|
:class="{'isDifferent':propertyArr[index].downpaymentdate.isDifferent}"
|
>
|
<el-date-picker
|
v-model="propertyForm[index].downpaymentdate"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
size="small"
|
placeholder="选择日期"
|
:disabled="!propertyArr[index].downpaymentdate.writeAble"
|
></el-date-picker>
|
</el-form-item>
|
<el-form-item
|
label="车位首付"
|
v-if="propertyArr[index].downpayparkingamount.visible"
|
prop="downpayparkingamount"
|
:class="{'isDifferent':propertyArr[index].downpayparkingamount.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].downpayparkingamount"
|
@blur="propertyForm[index].downpayparkingamount = formatMoney(propertyForm[index].downpayparkingamount)"
|
:disabled="!propertyArr[index].downpayparkingamount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="交房日期"
|
v-if="propertyArr[index].handoverdate.visible"
|
prop="handoverdate"
|
:class="{'isDifferent':propertyArr[index].handoverdate.isDifferent}"
|
>
|
<el-date-picker
|
v-model="propertyForm[index].handoverdate"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
size="small"
|
placeholder="选择日期"
|
:disabled="!propertyArr[index].handoverdate.writeAble"
|
></el-date-picker>
|
</el-form-item>
|
<el-form-item
|
label="车位实际成交总价"
|
v-if="propertyArr[index].parkingamount.visible"
|
prop="parkingamount"
|
:class="{'isDifferent':propertyArr[index].parkingamount.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].parkingamount"
|
@blur="propertyForm[index].parkingamount = formatMoney(propertyForm[index].parkingamount)"
|
:disabled="!propertyArr[index].parkingamount.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="产权年限"
|
v-if="propertyArr[index].propertyyears.visible"
|
prop="propertyyears"
|
:class="{'isDifferent':propertyArr[index].propertyyears.isDifferent}"
|
>
|
<el-input
|
v-model="propertyForm[index].propertyyears"
|
:disabled="!propertyArr[index].propertyyears.writeAble"
|
></el-input>
|
</el-form-item>
|
<el-form-item
|
label="认购书日期"
|
v-if="propertyArr[index].subscriptionbookdate.visible"
|
prop="subscriptionbookdate"
|
:class="{'isDifferent':propertyArr[index].subscriptionbookdate.isDifferent}"
|
>
|
<el-date-picker
|
v-model="propertyForm[index].subscriptionbookdate"
|
type="date"
|
format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd"
|
size="small"
|
placeholder="选择日期"
|
:disabled="!propertyArr[index].subscriptionbookdate.writeAble"
|
></el-date-picker>
|
</el-form-item>
|
</div>
|
</el-form>
|
<Owner
|
v-if="applyInfo.phaseNo>='0040'"
|
:index="index"
|
:show="propertyArr[index].buildingprojectid.writeAble"
|
:propertyData="propertyForm[index]"
|
@sendPropertyForm="sendPropertyForm"
|
></Owner>
|
<Agent
|
v-if="showAgent"
|
:visible="showAgent"
|
:houseorparkingid="propertyForm[index].houseorparkingid"
|
@closeAgent="closeDialog"
|
></Agent>
|
</el-tab-pane>
|
</el-tabs>
|
</div>
|
<div :class="[applyInfo.phaseNo >= '0040' ? 'fixedBtn':'btn']">
|
<el-button size="medium" plain @click="addProperty" v-if="writeAble">添加物业信息</el-button>
|
<el-button
|
size="medium"
|
plain
|
@click="saveDraft(propertyForm)"
|
v-if="applyInfo.phaseNo=='0040'||applyInfo.phaseNo=='0010'"
|
>保存草稿</el-button>
|
<el-button
|
size="medium"
|
plain
|
@click="prevStep"
|
v-if="applyInfo.phaseNo=='0040'||applyInfo.phaseNo=='0010'"
|
>上一步</el-button>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="submit(propertyForm)"
|
v-if="applyInfo.phaseNo=='0040'||applyInfo.phaseNo=='0010'"
|
>下一步</el-button>
|
<el-button
|
size="medium"
|
plain
|
@click="save(propertyForm)"
|
v-if="applyInfo.phaseNo>'0040'&&writeAble"
|
>保存</el-button>
|
<el-button
|
size="medium"
|
plain
|
@click="prevStep"
|
v-if="applyInfo.phaseNo!='0040'&&applyInfo.phaseNo!='0010'"
|
>上一页</el-button>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="nextPage()"
|
v-if="applyInfo.phaseNo!='0040'&&applyInfo.phaseNo!='0010'"
|
>下一页</el-button>
|
</div>
|
</div>
|
</template>
|
<script>
|
import {
|
qryHouseList,
|
getAllProjectList,
|
qryProjectAndBuildList,
|
qryBuildList,
|
qryRoomList,
|
getDictionaryList,
|
delHouse,
|
saveMultipleHouse,
|
submitMultipleHouse,
|
projectManageDetail
|
} from "@/api/product";
|
import { setStorage, getStorage } from "@/utils/storage";
|
import common from "@/utils/common";
|
import Owner from "@views/product/components/Owner";
|
import Agent from "@views/product/components/Agent";
|
export default {
|
data() {
|
return {
|
applyInfo: this.$store.state.product.applyInfo,
|
applyMenu: this.$store.state.product.applyMenu,
|
initialArr: [], //初始数据
|
propertyForm: [],
|
propertyArr: [],
|
projectList: [],
|
houseadds: [],
|
projectTypeList: [],
|
downpaymentRatiolist: [],
|
showAgent: false,
|
writeAble: false,
|
tabIndex: "0",
|
rules: {}
|
};
|
},
|
async created() {
|
this.$parent._data.loading = true;
|
// 查询物业信息
|
let result = await this.getHouseList();
|
result = this.compareFields(result);
|
this.getPropertyData(result);
|
// 获取项目名称下拉
|
getAllProjectList({}).then(res => {
|
this.projectList = res.result;
|
});
|
//获取项目类型列表
|
this.projectTypeList = await this.qryDictionaryList(
|
"ZYorSH"
|
);
|
//获取首付比例
|
this.downpaymentRatiolist = await this.qryDictionaryList(
|
"downpaymentRatio"
|
);
|
this.$parent._data.loading = false;
|
},
|
computed: {
|
showBtns() {
|
return (
|
this.applyInfo.phaseNo == "0060" ||
|
this.applyInfo.phaseNo == "0070" ||
|
this.applyInfo.phaseNo == "0080" ||
|
this.applyInfo.phaseNo == "0090" ||
|
this.applyInfo.phaseNo == "0110" ||
|
this.applyInfo.phaseNo == "0120" ||
|
this.applyInfo.phaseNo == "0130"
|
);
|
}
|
},
|
components: {
|
Owner,
|
Agent
|
},
|
methods: {
|
compareFields(result) {
|
const { applyInfo } = this;
|
const { refuseFlag, phaseNo } = applyInfo;
|
if (refuseFlag == 1) {
|
const { houseInfoBatch } = this.$store.state.product.fields;
|
houseInfoBatch.forEach((val, index) => {
|
for (const key in val) {
|
if (key != "propertyList" && result[index][key].value != val[key]) {
|
result[index][key]["isDifferent"] = true;
|
}
|
}
|
});
|
}
|
return result;
|
},
|
// 点击查看项目清单
|
qryProjectInfoList() {
|
parent.tabDelete("项目管理");
|
parent.getMenuByParent("风险管理", "项目管理");
|
},
|
// 金额格式化
|
formatMoney(value) {
|
if (value) {
|
value =
|
parseFloat((value + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
|
if (value == "NaN") return;
|
let l = value
|
.split(".")[0]
|
.split("")
|
.reverse();
|
let r = value.split(".")[1];
|
let t = "";
|
for (let i = 0; i < l.length; i++) {
|
t += l[i] + ((i + 1) % 3 === 0 && i + 1 !== l.length ? "," : "");
|
}
|
return (
|
t
|
.split("")
|
.reverse()
|
.join("") +
|
"." +
|
r
|
);
|
}
|
},
|
closeDialog(data) {
|
this.showAgent = data;
|
},
|
// 查询代理交易
|
getBroomInfo() {
|
this.showAgent = true;
|
},
|
// 查看项目信息
|
getProjectInfo(form) {
|
projectManageDetail({
|
serialno: form.buildingprojectid,
|
objectType: this.applyInfo.objectType
|
}).then(res => {
|
if (res.code == "00") {
|
const { href } = this.$router.resolve({
|
name: "detailsProjectInfo",
|
query: {
|
type: "details",
|
dataType: res.result.dataType,
|
objectNo: res.result.objectNo,
|
objectType: res.result.objectType,
|
projectFlag: res.result.projectFlag,
|
projectType: res.result.projectType
|
}
|
});
|
window.open(
|
href,
|
"newwindow",
|
"height=700px, width=1280px, top=100px,left=400px, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no"
|
);
|
}
|
});
|
},
|
// 处理数据,将数据重新排列
|
getPropertyData(result) {
|
const { applyInfo } = this;
|
const { productID, phaseNo } = applyInfo;
|
this.propertyArr = result;
|
this.propertyForm = [];
|
this.initialArr = [];
|
this.propertyArr.forEach((val, index) => {
|
// 取数组第一个值作为校验规则
|
if (index == 0) {
|
for (const key in val) {
|
this.rules[key] = [];
|
// 自定义规则校验,涉及金额会进行格式化
|
switch (key) {
|
case "propertyyears":
|
this.rules[key].push(common.validate("number"));
|
break;
|
default:
|
break;
|
}
|
// 必填校验
|
if (val[key].required) {
|
this.rules[key].push({
|
required: true,
|
message: `请输入${val[key].filedDescription}`,
|
trigger: "change"
|
});
|
}
|
}
|
}
|
//将数据重新排列
|
const obj = {};
|
for (const key in val) {
|
delete obj["propertyList"];
|
// 金额格式化
|
if (
|
key == "totalamount" ||
|
key == "coveredArea" ||
|
key == "downpaymentamount" ||
|
key == "decorateamount" ||
|
key == "downpaydecorateamount" ||
|
key == "parkingamount" ||
|
key == "downpayparkingamount"
|
) {
|
obj[key] = this.formatMoney(val[key].value);
|
} else {
|
obj[key] = val[key].value;
|
}
|
// 如果是车位贷直接填充车位
|
if (this.applyInfo.productID == "CW") {
|
obj.propertytype = "06";
|
obj.propertytypename = "车位";
|
} else {
|
obj.propertytypename = val.propertytype.valueDesc;
|
}
|
// 判断是不是贷款申请
|
if (this.applyInfo.phaseNo >= "0040") {
|
obj.houseprovince = val.houseprovince.value;
|
obj.houseprovinceDesc = val.houseprovince.valueDesc;
|
obj.housecity = val.housecity.value;
|
obj.housecityDesc = val.housecity.valueDesc;
|
obj.housecounty = val.housecounty.value;
|
obj.housecountyDesc = val.housecounty.valueDesc;
|
obj.houseaddress = val.houseaddress.value;
|
}
|
}
|
// 正常赋值
|
this.propertyForm.push(obj);
|
// 将每个对象进行浅克隆在赋值
|
this.initialArr.push(Object.assign({}, obj));
|
});
|
this.propertyArr.forEach((val, index) => {
|
for (const key in val) {
|
// 根据项目名称获取楼栋,是否自营
|
if (key == "buildingprojectid" && val[key].value) {
|
this.getProjectAndBuildList(index);
|
}
|
// 初始化value为空
|
if (
|
key != "customername" &&
|
key != "certid" &&
|
key != "cuscerttype"
|
) {
|
val[key].value = "";
|
}
|
}
|
});
|
// 根据与借款人关系判断页面是否都是只读
|
this.writeAble = this.propertyArr[0].houseorparkingid.writeAble;
|
},
|
// 查询物业信息
|
getHouseList() {
|
return new Promise(resolve => {
|
qryHouseList({
|
businessNo: this.applyInfo.serialNo,
|
customerId: this.applyInfo.customerid
|
}).then(res => {
|
resolve(res.result);
|
});
|
});
|
},
|
qryDictionaryList(code) {
|
return new Promise(resolve => {
|
getDictionaryList({
|
codeNo: code
|
}).then(res => {
|
resolve(res.result);
|
});
|
});
|
},
|
// 根据项目id查询项目是否自营
|
selectBuildingproject(arr, index) {
|
if (!arr[index].buildingprojectid) return;
|
// 清空楼栋和房号,物业类型
|
arr[index].buildingorunit = "";
|
arr[index].houseorparkingid = "";
|
arr[index].houseorparkingname = "";
|
arr[index].propertytype = "";
|
arr[index].propertytypename = "";
|
arr[index].projecttype = "";
|
this.getProjectAndBuildList(index, arr[index].buildingprojectid);
|
// 判断如果是贷款就要添加下面的逻辑
|
if (this.applyInfo.phaseNo >= "0040") {
|
// 获取项目下面的房产地址
|
getAllProjectList({
|
projectserialno: arr[index].buildingprojectid
|
}).then(res => {
|
arr[index].houseprovince = res.result[0].provincecode;
|
arr[index].houseprovinceDesc = res.result[0].provincecodeDesc;
|
arr[index].housecity = res.result[0].citycode;
|
arr[index].housecityDesc = res.result[0].citycodeDesc;
|
arr[index].housecounty = res.result[0].countycode;
|
arr[index].housecountyDesc = res.result[0].countycodeDesc;
|
arr[index].projecttype = res.result[0].projecttype;
|
});
|
}
|
},
|
// 根据楼栋查询房号和物业类型
|
selectBuildingorunit(arr, index) {
|
// 获取物业类型
|
qryBuildList({
|
buildingProjectId: arr[index].buildingprojectid,
|
buildId: arr[index].buildingorunit
|
}).then(res => {
|
if (this.applyInfo.productID != "CW") {
|
arr[index].propertytype = res.result[0].propertytype;
|
arr[index].propertytypename = res.result[0].propertytypeDesc;
|
} else {
|
arr[index].propertytype = "06";
|
arr[index].propertytypename = "车位";
|
}
|
});
|
arr[index].houseorparkingid = "";
|
arr[index].houseorparkingname = "";
|
this.getRoomList(index);
|
},
|
//获取房号下拉列表
|
getRoomList(index) {
|
qryRoomList({
|
projectId: this.propertyForm[index].buildingprojectid,
|
buildingId: this.propertyForm[index].buildingorunit
|
}).then(res => {
|
this.propertyArr[index].roomList = res.result;
|
this.$set(this.propertyArr, index, this.propertyArr[index]);
|
});
|
},
|
//项目准入状态
|
projectAccess(status) {
|
switch (status) {
|
case "0010":
|
this.$message.warning("该项目准入申请中,请重新选择");
|
break;
|
case "0020":
|
this.$message.warning("该项目准入审核中,请重新选择");
|
break;
|
case "1000":
|
break;
|
case "8000":
|
this.$message.warning("该项目准入已拒绝,请重新选择");
|
break;
|
case "3000":
|
this.$message.warning("该项目已准出,请重新选择");
|
break;
|
default:
|
break;
|
}
|
},
|
// 根据项目id查询项目是否自营
|
getProjectAndBuildList(index) {
|
qryProjectAndBuildList({
|
buildingProjectId: this.propertyForm[index].buildingprojectid,
|
applySerialNo: this.applyInfo.serialNo
|
}).then(res => {
|
// 获取楼栋下拉列表
|
if (
|
res.result.autotrophyInfoQryInfo.flowstatus == "1000" &&
|
res.result.hadApplyProduct
|
) {
|
this.propertyArr[index].buildList = res.result.buildListQryInfoList;
|
// 根据楼栋获取房号
|
if (this.propertyForm[index].buildingorunit) {
|
this.getRoomList(index);
|
}
|
} else {
|
this.propertyForm[index].buildingorunit = "";
|
this.propertyForm[index].houseorparkingid = "";
|
this.propertyForm[index].houseorparkingname = "";
|
this.propertyArr[index].buildList = [];
|
this.propertyArr[index].roomList = [];
|
}
|
this.$set(this.propertyArr, index, this.propertyArr[index]);
|
// 如果是1代表是自营
|
if (res.result.autotrophyInfoQryInfo.projecttype == 1) {
|
this.propertyArr[index].isSelf = true;
|
} else {
|
this.propertyArr[index].isSelf = false;
|
}
|
if (!res.result.hadApplyProduct) {
|
this.$message.warning("该项目未准入该产品,请重新选择");
|
}
|
//判断项目是否准入
|
this.projectAccess(res.result.autotrophyInfoQryInfo.flowstatus);
|
});
|
},
|
// 添加物业信息
|
addProperty() {
|
const validateForm = common.validateForm(this.$refs.propertyForm);
|
this.tabIndex =
|
validateForm.index === undefined
|
? this.tabIndex
|
: "" + validateForm.index;
|
if (!validateForm.flag) return;
|
const obj = {};
|
for (const key in this.propertyArr[0]) {
|
obj[key] = this.propertyArr[0][key].value;
|
if (this.applyInfo.productID == "CW") {
|
obj.propertytype = "06";
|
obj.propertytypename = "车位";
|
}
|
delete obj["propertyList"];
|
}
|
this.propertyForm.push(obj);
|
this.initialArr.push(Object.assign({}, obj));
|
const copyObj = Object.assign({}, this.propertyArr[0]);
|
copyObj.buildList = [];
|
copyObj.roomList = [];
|
this.propertyArr.push(copyObj);
|
this.tabIndex = `${this.propertyForm.length - 1}`;
|
},
|
// 保存接口
|
saveMultipleProperty(arr) {
|
return new Promise(resolve => {
|
saveMultipleHouse({ houseInfoList: arr }).then(res => {
|
resolve(res);
|
});
|
});
|
},
|
// 提交接口
|
submitMultipleProperty(array) {
|
return new Promise(resolve => {
|
submitMultipleHouse({ houseInfoList: array }).then(res => {
|
resolve(res);
|
});
|
});
|
},
|
// 物业信息保存并校验数据完整性
|
async save(array) {
|
const validateForm = common.validateForm(this.$refs.propertyForm);
|
this.tabIndex =
|
validateForm.index === undefined
|
? this.tabIndex
|
: "" + validateForm.index;
|
if (!validateForm.flag) return;
|
for (let i = 0; i < array.length; i++) {
|
array[i].applyserialno = this.applyInfo.serialNo;
|
if (
|
array[i + 1] &&
|
array[i].buildingprojectid != array[i + 1].buildingprojectid
|
) {
|
this.$message.warning("同一申请单的小区/项目名称必须相同");
|
return;
|
}
|
if (this.applyInfo.phaseNo >= "0040") {
|
if (!array[i].propertyList || !array[i].propertyList.length) {
|
this.$message.warning("每个申请单至少填写一个产权人信息");
|
return;
|
}
|
}
|
}
|
this.$parent._data.loading = true;
|
const res = await this.saveMultipleProperty(array);
|
if (res.code == "00") {
|
const result = await this.getHouseList();
|
this.getPropertyData(result);
|
this.$message.success("保存成功");
|
}
|
this.$parent._data.loading = false;
|
},
|
// 物业信息保存草稿
|
async saveDraft(array) {
|
// 保存需要校验多个物业的项目名称都是一样的并且项目名称不能为空,最后重新调用查询物业信息渲染页面
|
for (let i = 0; i < array.length; i++) {
|
array[i].applyserialno = this.applyInfo.serialNo;
|
if (!array[i].buildingprojectid) {
|
this.$message.warning("项目名称不能为空");
|
return;
|
}
|
if (
|
array[i + 1] &&
|
array[i].buildingprojectid != array[i + 1].buildingprojectid
|
) {
|
this.$message.warning("同一申请单的小区/项目名称必须相同");
|
return;
|
}
|
}
|
this.$parent._data.loading = true;
|
const res = await this.saveMultipleProperty(array);
|
if (res.code == "00") {
|
const result = await this.getHouseList();
|
this.getPropertyData(result);
|
this.$message.success("保存成功");
|
// 保存草稿需要调用父组件的查询左侧tab的方法
|
this.$parent.getApplyTabTree();
|
}
|
this.$parent._data.loading = false;
|
},
|
// 上一步
|
prevStep() {
|
this.applyMenu.forEach((val, index) => {
|
if (val.tabname == "物业信息") {
|
common.tabInfo(
|
this.applyMenu[index - 1].tabname,
|
this.applyInfo.flowno,
|
this
|
);
|
}
|
});
|
},
|
// 下一页
|
nextPage() {
|
// 调用父组件的查询左侧tab的方法
|
this.$parent.updateApplyTabTree("物业信息");
|
},
|
// 下一步提交并且需要校验每个物业申请单的产权人至少一个
|
async submit(array) {
|
const validateForm = common.validateForm(this.$refs.propertyForm);
|
this.tabIndex =
|
validateForm.index === undefined
|
? this.tabIndex
|
: "" + validateForm.index;
|
if (!validateForm.flag) return;
|
for (let i = 0; i < array.length; i++) {
|
array[i].applyserialno = this.applyInfo.serialNo;
|
if (
|
array[i + 1] &&
|
array[i].buildingprojectid != array[i + 1].buildingprojectid
|
) {
|
this.$message.warning("同一申请单的小区/项目名称必须相同");
|
return;
|
}
|
if (this.applyInfo.phaseNo >= "0040") {
|
if (!array[i].propertyList || !array[i].propertyList.length) {
|
this.$message.warning("每个申请单至少填写一个产权人信息");
|
return;
|
}
|
}
|
}
|
this.$parent._data.loading = true;
|
const res = await this.submitMultipleProperty(array);
|
if (res.code == "00") {
|
const result = await this.getHouseList();
|
this.getPropertyData(result);
|
this.nextPage();
|
}
|
this.$parent._data.loading = false;
|
},
|
// 删除物业信息
|
delProperty(index) {
|
if (this.propertyForm[index].serialno) {
|
common.comfirm(
|
"提示",
|
`请确认是否需要删除物业信息(小区/项目名称:${this.propertyForm[index].buildingprojectname},房号/车位号:${this.propertyForm[index].houseorparkingname})?`,
|
() => {
|
delHouse({ serialNo: this.propertyForm[index].serialno }).then(
|
res => {
|
if (res.code == "00") {
|
this.$message.success("删除成功");
|
this.propertyForm.splice(index, 1);
|
this.propertyArr.splice(index, 1);
|
this.tabIndex = `${index - 1 >= 0 ? index - 1 : index}`;
|
}
|
}
|
);
|
}
|
);
|
} else {
|
this.propertyForm.splice(index, 1);
|
this.propertyArr.splice(index, 1);
|
this.tabIndex = `${index - 1 >= 0 ? index - 1 : index}`;
|
}
|
},
|
sendPropertyForm(data) {
|
this.propertyForm[data.index] = data;
|
}
|
},
|
beforeRouteLeave(to, from, next) {
|
for (let i = 0; i < this.propertyForm.length; i++) {
|
for (const key in this.propertyForm[i]) {
|
if (this.initialArr[i].hasOwnProperty(key)) {
|
if (this.propertyForm[i][key] != this.initialArr[i][key]) {
|
// 页面有数据未保存
|
common.comfirm(
|
"提示",
|
"当前页面有数据未保存,是否放弃保存?",
|
() => {
|
next();
|
}
|
);
|
return;
|
}
|
}
|
}
|
}
|
next();
|
}
|
};
|
</script>
|