<template>
|
<div class="product">
|
<div class="borrower" v-for="(item, index) in contractArr" :key="index">
|
<p class="title">
|
<span></span>
|
基础合同信息
|
</p>
|
<el-form :model="contractForm[index]" :rules="rules" ref="contractForm" size="small" inline label-width="165px">
|
<div class="form">
|
<el-form-item label="基础合同签署方名称" v-if="contractArr[index].signatoryName.visible" prop="signatoryName"
|
:class="{ isDifferent: item.signatoryName.isDifferent }">
|
<el-input v-model="contractForm[index].signatoryName"
|
:disabled="!contractArr[index].signatoryName.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="基础合同签署方统一信用代码" v-if="contractArr[index].signatoryCode.visible" prop="signatoryCode"
|
:class="{ isDifferent: item.signatoryCode.isDifferent }">
|
<el-input v-model="contractForm[index].signatoryCode"
|
:disabled="!contractArr[index].signatoryCode.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="基础合同签署方法人名称" v-if="contractArr[index].signatoryUserName.visible" prop="signatoryUserName"
|
:class="{ isDifferent: item.signatoryUserName.isDifferent }">
|
<el-input v-model="contractForm[index].signatoryUserName"
|
:disabled="!contractArr[index].signatoryUserName.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="基础合同签署方法人身份证" v-if="contractArr[index].signatoryCertId.visible" prop="signatoryCertId"
|
:class="{ isDifferent: item.signatoryCertId.isDifferent }">
|
<el-input v-model="contractForm[index].signatoryCertId"
|
:disabled="!contractArr[index].signatoryCertId.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="基础合同签署方法人手机号" v-if="contractArr[index].signatoryPhone.visible" prop="signatoryPhone"
|
:class="{ isDifferent: item.signatoryPhone.isDifferent }">
|
<el-input v-model="contractForm[index].signatoryPhone"
|
:disabled="!contractArr[index].signatoryPhone.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="收款人名称" v-if="contractArr[index].receivingName.visible" prop="receivingName"
|
:class="{ isDifferent: item.receivingName.isDifferent }">
|
<el-input v-model="contractForm[index].receivingName"
|
:disabled="!contractArr[index].receivingName.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="收款人银行账户名称" v-if="contractArr[index].receivingBankName.visible" prop="receivingBankName"
|
:class="{ isDifferent: item.receivingBankName.isDifferent }">
|
<el-input v-model="contractForm[index].receivingBankName"
|
:disabled="!contractArr[index].receivingBankName.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="收款人银行账户开户行" v-if="contractArr[index].receivingBank.visible" prop="receivingBank"
|
:class="{ isDifferent: item.receivingBank.isDifferent }">
|
<el-input v-model="contractForm[index].receivingBank"
|
:disabled="!contractArr[index].receivingBank.writeAble"></el-input>
|
</el-form-item>
|
<el-form-item label="收款人银行账户账号" v-if="contractArr[index].receivingAccount.visible" prop="receivingAccount"
|
:class="{ isDifferent: item.receivingAccount.isDifferent }">
|
<el-input v-model="contractForm[index].receivingAccount"
|
:disabled="!contractArr[index].receivingAccount.writeAble"></el-input>
|
</el-form-item>
|
|
|
<!-- 通讯地址(省) -->
|
<el-form-item label="签署方地址(省份)" v-if="contractArr[index].signatoryProvince.visible" prop="signatoryProvince"
|
:class="{ isDifferent: item.signatoryProvince.isDifferent }">
|
<el-select v-model="contractForm[index].signatoryProvince" filterable clearable
|
:disabled="!contractArr[index].signatoryProvince.writeAble" placeholder="支持输入搜索选择" @change="
|
getprovince(
|
contractForm[index].signatoryProvince,
|
'signatoryCityList',
|
contractForm[index],
|
function (arr) {
|
signatoryCityList = arr;
|
}
|
)
|
">
|
<el-option v-for="(item, index) in provinceList" :key="index" :label="item.itemname" :value="item.itemno">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
<!-- 通讯地址(市) -->
|
<el-form-item label="签署方地址(城市)" v-if="contractArr[index].signatoryCity.visible" prop="signatoryCity"
|
:class="{ isDifferent: item.signatoryCity.isDifferent }">
|
<el-select v-model="contractForm[index].signatoryCity" filterable clearable
|
:disabled="!contractArr[index].signatoryCity.writeAble" placeholder="支持输入搜索选择">
|
<el-option v-for="(item, index) in signatoryCityList" :key="index" :label="item.itemname"
|
:value="item.itemno"></el-option>
|
</el-select>
|
</el-form-item>
|
|
<!-- 通讯地址(详细) -->
|
<el-form-item label="签署方详细地址" v-if="contractArr[index].signatoryAddress.visible" prop="signatoryAddress"
|
:class="{ isDifferent: item.signatoryAddress.isDifferent }">
|
<el-input v-model="contractForm[index].signatoryAddress"
|
:disabled="!contractArr[index].signatoryAddress.writeAble"></el-input>
|
</el-form-item>
|
</div>
|
|
</el-form>
|
|
<el-button type="primary" icon="el-icon-circle-plus-outline" v-if="applyInfo.phaseNo <= '0060' && !isReadonly"
|
@click="addContractLine" size="medium">新增</el-button>
|
<el-table stripe :data="contractInfoList" style="margin-top: 30px" highlight-current-row :cell-style="cell"
|
:header-cell-style="{ background: '#f5f5f5', color: '#222222' }">
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">合同编号</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.contractNo
|
}}</span>
|
<el-input style="padding-left: 15px" size="small" v-show="row.isEdit" v-model="row.contractNo"
|
placeholder="请输入"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<!-- <span class="red-star">*</span> -->
|
<span style="padding-left: 8px">合同名称</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 8px" v-show="!row.isEdit">{{
|
row.contractName
|
}}</span>
|
<el-input style="padding-left: 15px" size="small" v-show="row.isEdit" v-model="row.contractName"
|
placeholder="请输入"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">应收账款债务人</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.obligorName
|
}}</span>
|
<!-- <el-input style="padding-left: 15px" size="small" v-show="row.isEdit" v-model="row.obligorName"
|
placeholder="请输入"></el-input> -->
|
|
|
<el-select size="small" v-show="row.isEdit" v-model="row.obligorNo" @change="changeObligor(row)" filterable placeholder="请选择">
|
<el-option
|
v-for="(item,index) in enpAdmitInList"
|
:key="index"
|
:label="item.enterprisename"
|
:value="item.serialno">
|
</el-option>
|
</el-select>
|
<!-- <el-select></el-select> -->
|
</template>
|
</el-table-column>
|
<!-- <el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">签署方地址(省份)</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.signatoryProvinceCn
|
}}</span>
|
<el-select v-show="row.isEdit" v-model="row.signatoryProvince" filterable clearable placeholder="支持输入搜索选择"
|
@change="
|
getprovince(
|
row.signatoryProvince,
|
'signatoryCityList',
|
row,
|
function (arr) {
|
signatoryCityList = arr;
|
}
|
)
|
">
|
<el-option v-for="(item, index) in provinceList" :key="index" :label="item.itemname" :value="item.itemno">
|
</el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">签署方地址(城市)</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.signatoryCityCn
|
}}</span>
|
<el-select v-show="row.isEdit" v-model="row.signatoryCity" filterable clearable placeholder="支持输入搜索选择">
|
<el-option v-for="(item, index) in signatoryCityList" :key="index" :label="item.itemname"
|
:value="item.itemno"></el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">签署方详细地址</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.signatoryAddress
|
}}</span>
|
<el-input v-show="row.isEdit" v-model="row.signatoryAddress"></el-input>
|
</template>
|
</el-table-column> -->
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">合同金额</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<!-- <span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.contactAmount
|
}}</span>
|
<el-input v-show="row.isEdit" v-model="row.contactAmount"></el-input> -->
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.contactAmount !== '' ? formatMoney(row.contactAmount) : "--"
|
}}</span>
|
<el-input size="small" v-show="row.isEdit" v-model="row.contactAmount" placeholder="请输入"
|
@blur="row.contactAmount = formatMoney(row.contactAmount)"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">基础交易合同暂定总价</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<!-- <span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.tempTotalAmt
|
}}</span>
|
<el-input v-show="row.isEdit" v-model="row.tempTotalAmt "></el-input> -->
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.tempTotalAmt !== '' ? formatMoney(row.tempTotalAmt) : "--"
|
}}</span>
|
<el-input size="small" v-show="row.isEdit" v-model="row.tempTotalAmt" placeholder="请输入"
|
@blur="row.tempTotalAmt = formatMoney(row.tempTotalAmt)">
|
</el-input>
|
</template>
|
</el-table-column>
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">签署日期</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.signedDate
|
}}</span>
|
<el-date-picker v-show="row.isEdit" v-model="row.signedDate" type="date" format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd" placeholder="选择日期">
|
</el-date-picker>
|
</template>
|
</el-table-column>
|
|
<el-table-column min-width="200">
|
<template slot="header">
|
<span>
|
<span style="padding-left: 8px">合同有效截止日期</span>
|
</span>
|
</template>
|
<template slot-scope="{ row }">
|
<span style="padding-left: 15px" v-show="!row.isEdit">{{
|
row.signedEndDate
|
}}</span>
|
<el-date-picker v-show="row.isEdit" v-model="row.signedEndDate" type="date" format="yyyy/MM/dd"
|
value-format="yyyy/MM/dd" placeholder="选择日期">
|
</el-date-picker>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" min-width="110" v-if="applyInfo.phaseNo <= '0060' && !isReadonly">
|
<template slot-scope="scope">
|
<el-button type="text" @click.native="handleEdit(scope.row)" v-if="!scope.row.isEdit">修改</el-button>
|
<el-button type="text" @click.native="handleSave(scope.row, scope.$index)" v-else>保存</el-button>
|
<el-button type="text" @click.native="handleCancel(scope.row, scope.$index)" v-if="scope.row.isCancel">取消
|
</el-button>
|
<el-button type="text" @click.native="handleDelete(scope.row, scope.$index)" v-else>删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div style="height:30px"></div>
|
<!-- 贷款合同信息 -->
|
<!-- <loanContactList :applyInfo="applyInfo" v-if="applyInfo.phaseNo == '0060'" /> -->
|
|
<!-- 中登网登记信息 -->
|
<registerInfo :applyInfo="applyInfo" v-if="applyInfo.phaseNo >= '0060'" />
|
|
<div :class="[applyInfo.phaseNo >= '0040' ? 'fixedBtn' : 'btn']">
|
<el-button size="medium" plain @click="saveDraft"
|
v-if="(applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010') && !isReadonly">保存草稿</el-button>
|
<el-button size="medium" plain @click="save" v-if="applyInfo.phaseNo > '0040' && writeAble">保存</el-button>
|
<el-button size="medium" plain @click="prevStep"
|
v-if="(applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010' || applyInfo.phaseNo == '0060') && !isReadonly">
|
上一步</el-button>
|
<el-button size="medium" plain @click="prevStep" v-else>上一步
|
</el-button>
|
<el-button size="medium" type="primary" @click="submit()"
|
v-if="(applyInfo.phaseNo == '0040' || applyInfo.phaseNo == '0010' || applyInfo.phaseNo == '0060') && !isReadonly">
|
下一步</el-button>
|
<el-button size="medium" type="primary" @click="nextPage()" v-else>下一步
|
</el-button>
|
</div>
|
</div>
|
</template>
|
<script>
|
// 基础合同信息
|
import {
|
qryBaseContractDetail,
|
qryBaseContractList,
|
getDictionaryList,
|
updateBaseContract,
|
getProvinceCodeList,
|
delBaseContractInfo,
|
saveOrUpdateBaseInfo,
|
submitBaseInfo,
|
qryEnterpriseList
|
} from "@/api/product";
|
import common from "@/utils/common";
|
import loanContactList from "./loanContactList";
|
import registerInfo from "./registerInfo";
|
|
export default {
|
components: { loanContactList, registerInfo },
|
data() {
|
return {
|
applyInfo: this.$store.state.product.applyInfo,
|
applyMenu: this.$store.state.product.applyMenu,
|
isUploadAble: false,
|
initialArr: [], //初始化数据
|
contractForm: [],
|
contractArr: [],
|
// borrowertypeList: [],
|
provinceList: [],
|
signatoryCityList: [],
|
receivingBankNameList: [],//银行名称列表,下拉选项
|
rules: {},
|
writeAble: false,
|
contractInfoList: [],
|
enpAdmitInList: [],
|
};
|
},
|
computed: {
|
isReadonly() {
|
return this.$parent._data.applyMenu[this.$parent._data.activeIndex].readonly == 'Y'
|
}
|
},
|
async created() {
|
const { applyInfo } = this;
|
this.$parent._data.loading = true;
|
this.isUploadAble = applyInfo.phaseNo <= "0040" ? false : true;
|
// 查询基础合同信息信息
|
let result = await this.getBaseContractDetail();
|
result = this.compareFields(result);
|
this.getBorrowerData(result);
|
|
this.contractInfoList = await this.getBaseContractList()
|
|
this.writeAble = this.contractArr[0].signatoryName.writeAble || this.contractArr[0].signatoryUserName.writeAble;
|
//基础合同信息类型选项
|
// this.borrowertypeList = await this.qryDictionaryList("BorrowerType");
|
// this.receivingBankNameList = await this.qryDictionaryList("receivingBankName");
|
this.qryEnterpriseList()
|
this.$parent._data.loading = false;
|
},
|
methods: {
|
//单元格css
|
cell({ row, column, rowIndex, columnIndex }) {
|
const { applyInfo, index } = this;
|
const { refuseFlag } = applyInfo;
|
if (refuseFlag == 1) {
|
const { houseInfoBatch } = this.$store.state.product.fields;
|
const { propertyList } = houseInfoBatch[index];
|
for (let i = 0; i < propertyList.length; i++) {
|
const object = propertyList[i];
|
for (const key in object) {
|
if (row[key] != object[key] && column.property == key) {
|
return { color: "#222", "font-weight": "700" };
|
}
|
}
|
}
|
}
|
},
|
// 金额格式化
|
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;
|
} else {
|
return value
|
}
|
},
|
//金额变成数字
|
moneyFomatNumber(number, n) {
|
if (!number) return ''
|
if (typeof number == 'number') return number
|
if (number != null && number != "" && number != undefined) {
|
number = number.replace(/,/g, ""); //去除千分位的','
|
if (isNaN(number)) {
|
//判断是否是数字
|
number = "0";
|
} else {
|
number = Math.round(number * Math.pow(10, n)) / Math.pow(10, n); //n幂
|
number = number.toString();
|
}
|
} else {
|
number = "0";
|
}
|
//a.indexOf(x,y);返回x值在a字符串值中从y位置开始检索首次出现的位置
|
var numLength = number.indexOf(".");
|
//判断传递的值是整数增加小数点再补"0"
|
if (numLength < 0) {
|
numLength = number.length;
|
number += ".";
|
}
|
//不足n位小数的,循环补"0"
|
while (number.length <= numLength + n) {
|
number += "0";
|
}
|
return number;
|
},
|
|
async qryEnterpriseList() {
|
const enpAdmitInList = await qryEnterpriseList({})
|
this.enpAdmitInList = enpAdmitInList.result
|
},
|
changeObligor(row) {
|
let data = this.enpAdmitInList.find(res=> res.serialno == row.obligorNo)
|
row.obligorName = data.enterprisename
|
},
|
compareFields(result) {
|
const { applyInfo } = this;
|
const { refuseFlag } = applyInfo;
|
if (refuseFlag == 1) {
|
const { customerInfo } = this.$store.state.product.fields;
|
for (const key in customerInfo) {
|
if (result[key].value != customerInfo[key]) {
|
result[key]["isDifferent"] = true;
|
}
|
}
|
}
|
return result;
|
},
|
// 处理数据,将数据重新排列
|
async getBorrowerData(result) {
|
const { applyInfo } = this;
|
const { phaseNo } = applyInfo;
|
this.contractForm = [];
|
this.initialArr = [];
|
this.contractArr = [];
|
this.contractArr.push(result);
|
// 取数组第一个作为校验规则
|
this.contractArr.forEach((val, index) => {
|
if (index == 0) {
|
for (const key in val) {
|
this.rules[key] = [];
|
// 自定义规则校验
|
switch (key) {
|
// case "contactAmount":
|
// this.rules[key].push(common.validate("amount"));
|
// break;
|
case "signedDate":
|
this.rules[key].push({
|
required: true,
|
message: "请输入日期",
|
trigger: "change",
|
});
|
break;
|
default:
|
break;
|
}
|
// 必填校验
|
if (val[key].required) {
|
this.rules[key].push({
|
required: true,
|
message: `请输入${val[key].filedDescription}`,
|
trigger: "change",
|
});
|
}
|
if (this.isReadonly) {
|
val[key].writeAble = false
|
}
|
}
|
}
|
const obj = {};
|
for (const key in val) {
|
obj[key] = val[key].value;
|
}
|
this.contractForm.push(obj);
|
this.initialArr.push(Object.assign({}, obj));
|
});
|
// 判断如果是贷款就要添加下面的逻辑
|
if (phaseNo >= "0040") {
|
// 获取省枚举值
|
getProvinceCodeList({}).then((res) => {
|
this.provinceList = res.result;
|
});
|
// 根据省获取市
|
this.contractForm[0].signatoryProvince
|
? (this.signatoryCityList = await common.qryCityCodeList(
|
this.contractForm[0].signatoryProvince
|
))
|
: "";
|
}
|
},
|
// 查询基础合同信息
|
getBaseContractDetail() {
|
return new Promise((resolve) => {
|
qryBaseContractDetail({
|
relativeSerialNo: this.applyInfo.serialNo,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
// 查询基础合同信息
|
getBaseContractList() {
|
return new Promise((resolve) => {
|
qryBaseContractList({
|
relativeSerialNo: this.applyInfo.serialNo,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
// 保存基础合同信息接口
|
handleUpdateBaseContract(form) {
|
// form.applyserialno = this.applyInfo.serialNo;
|
form.relativeSerialNo = this.applyInfo.serialNo;
|
return new Promise((resolve) => {
|
updateBaseContract(form).then((res) => {
|
resolve(res);
|
});
|
});
|
},
|
|
// 保存基础合同信息草稿
|
handleSubmitBaseInfo(form) {
|
// form.applyserialno = this.applyInfo.serialNo;
|
form.relativeSerialNo = this.applyInfo.serialNo;
|
return new Promise((resolve) => {
|
submitBaseInfo(form).then((res) => {
|
resolve(res);
|
});
|
});
|
},
|
handleSaveOrUpdateBaseInfo(form) {
|
// form.applyserialno = this.applyInfo.serialNo;
|
form.relativeSerialNo = this.applyInfo.serialNo;
|
return new Promise((resolve) => {
|
saveOrUpdateBaseInfo(form).then((res) => {
|
resolve(res);
|
});
|
});
|
},
|
qryDictionaryList(code) {
|
return new Promise((resolve) => {
|
getDictionaryList({
|
codeNo: code,
|
}).then((res) => {
|
resolve(res.result);
|
});
|
});
|
},
|
addContractLine() {
|
for (let i = 0; i < this.contractInfoList.length; i++) {
|
if (this.contractInfoList[i].isEdit) {
|
this.$message.warning("请先保存当前凭证信息再新增");
|
return;
|
}
|
}
|
this.contractInfoList.unshift({
|
"contractNo": "",
|
"contractName": "",
|
"obligorName": "",
|
"contactAmount": "",
|
"tempTotalAmt": "",
|
"signedDate": "",
|
"tempTotalAmt": '4,000,000.00',
|
"signedEndDate": "",
|
"isEdit": true,
|
});
|
},
|
//保存选中应收账款明细
|
async handleSave(row, index) {
|
// if (!row.contractNo) {
|
// this.$message.warning("应收账款名称不能为空");
|
// return;
|
// }
|
// if (!row.pjpamentendday) {
|
// this.$message.warning("应收账款到期日不能为空");
|
// return;
|
// }
|
|
for (let i = 0; i < this.contractInfoList.length; i++) {
|
if (
|
index != i &&
|
row.billname == this.contractInfoList[i].contractNo &&
|
row.billtype == this.contractInfoList[i].contractName
|
) {
|
this.$message.warning("合同已存在,请重新填写");
|
return;
|
}
|
}
|
if (this.applyInfo.serialNo) {
|
row.relativeSerialNo = this.applyInfo.serialNo;
|
|
row.contactAmount = this.moneyFomatNumber(row.contactAmount, 2);
|
row.tempTotalAmt = this.moneyFomatNumber(row.tempTotalAmt, 2);
|
// 同步返回保存是否成功
|
const res = await this.handleUpdateBaseContract(row);
|
if (res.code == "00") {
|
this.contractInfoList = await this.getBaseContractList()
|
this.$message.success("保存成功");
|
} else {
|
return;
|
}
|
}
|
},
|
|
//修改选中应收账款明细
|
handleEdit(row) {
|
for (let i = 0; i < this.contractInfoList.length; i++) {
|
if (this.contractInfoList.length > 1 && this.contractInfoList[i].isEdit) {
|
this.$message.warning("请先保存当前合同");
|
return;
|
}
|
}
|
this.$set(row, "isEdit", true);
|
this.$set(row, "isCancel", true);
|
},
|
|
//取消选中应收账款明细
|
handleCancel(row, index) {
|
const arr = [];
|
for (let i = 0; i < this.initialArr.length; i++) {
|
if (i == index) {
|
for (const key in row) {
|
if (
|
key != "isEdit" &&
|
key != "isCancel" &&
|
row[key] != this.initialArr[i][key]
|
) {
|
arr.push(key);
|
}
|
}
|
}
|
}
|
if (arr.length) {
|
common.comfirm("提示", "当前有数据未保存,是否放弃保存?", () => {
|
this.$set(row, "isEdit", false);
|
this.$set(row, "isCancel", false);
|
arr.forEach((val) => {
|
for (const key in this.initialArr[index]) {
|
if (this.initialArr[index].hasOwnProperty(val)) {
|
this.creditLineArray[index][key] = this.initialArr[index][key];
|
}
|
}
|
});
|
});
|
} else {
|
this.$set(row, "isEdit", false);
|
this.$set(row, "isCancel", false);
|
}
|
},
|
//删除选中应收账款明细
|
async handleDelete(row, index) {
|
if (!row.isEdit) {
|
common.comfirm(
|
"提示",
|
`请确认是否需要删除:${row.contractNo}?`,
|
async () => {
|
if (row.contractNo) {
|
const res = await this.del(row.contractId);
|
if (res.code == "00") {
|
this.$message.success("删除成功");
|
this.contractInfoList = await this.getBaseContractList()
|
}
|
}
|
}
|
);
|
} else {
|
this.contractInfoList = await this.getBaseContractList()
|
}
|
},
|
// 删除接口
|
del(contractId) {
|
return new Promise((resolve) => {
|
delBaseContractInfo({
|
contractId: contractId,
|
}).then((res) => {
|
resolve(res);
|
});
|
});
|
},
|
// 下一页
|
nextPage() {
|
// 调用父组件的查询左侧tab的方法
|
this.$parent.updateApplyTabTree("基础合同信息");
|
},
|
// 提交
|
async submit() {
|
if (!common.validateForm(this.$refs.contractForm).flag) return;
|
this.$parent._data.loading = true;
|
const res = await this.handleSaveOrUpdateBaseInfo(this.contractForm[0]);
|
if (res.code == "00") {
|
const result = await this.getBaseContractDetail();
|
this.getBorrowerData(result);
|
this.nextPage();
|
}
|
this.$parent._data.loading = false;
|
},
|
// 保存需要校验数据完整性
|
async save() {
|
if (!common.validateForm(this.$refs.contractForm).flag) return;
|
this.$parent._data.loading = true;
|
// 保存
|
const res = await this.handleSaveOrUpdateBaseInfo(this.contractForm[0]);
|
// 保存成功查询列表数据
|
if (res.code == "00") {
|
const result = await this.getBaseContractDetail();
|
// 将数据重新排列
|
this.getBorrowerData(result);
|
this.$message.success("保存成功");
|
}
|
this.$parent._data.loading = false;
|
},
|
// 保存草稿
|
async saveDraft() {
|
this.$parent._data.loading = true;
|
const params = this.contractForm[0];
|
|
const res = await this.handleSubmitBaseInfo({
|
...params,
|
relativeSerialNo: params.applyserialno,
|
});
|
// 保存成功查询列表数据
|
if (res.code == "00") {
|
const result = await this.getBaseContractDetail();
|
// 将数据重新排列
|
this.getBorrowerData(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
|
);
|
}
|
});
|
},
|
},
|
|
beforeRouteLeave(to, from, next) {
|
for (let i = 0; i < this.contractForm.length; i++) {
|
for (const key in this.contractForm[i]) {
|
if (this.initialArr[i].hasOwnProperty(key)) {
|
if (this.contractForm[i][key] != this.initialArr[i][key]) {
|
// 页面有数据未保存
|
common.comfirm(
|
"提示",
|
"当前页面有数据未保存,是否放弃保存?",
|
() => {
|
next();
|
}
|
);
|
return;
|
}
|
}
|
}
|
}
|
next();
|
},
|
};
|
</script>
|
|
|
|