<template>
|
<div class="product">
|
<div class="borrower">
|
<p class="title">
|
<span></span>
|
待认领资金
|
</p>
|
<FormList
|
v-if="projectCompany.phaseno !== '0070'"
|
:info="claimedFormInfo"
|
:isShowDetail="claimedIsShowDetail"
|
@handleClick="claimedIsShowDetail = !claimedIsShowDetail"
|
@updateValue="claimedUpdateValue"
|
@onSubmit="claimedOnSubmit"
|
@setValueInfo="claimedSetValueInfo"
|
:isChangeArray="false"
|
@resetValue="claimedResetValue"
|
></FormList>
|
<TableList
|
v-if="projectCompany.phaseno !== '0070'"
|
:pageInfo="claimedPageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="claimedHandleCurrentChange"
|
@handleSizeChange="claimedHandleSizeChange"
|
@handleSelectionChange="claimedHandleSelectionChange"
|
:isMultipleSelect="true"
|
:activeIndex="claimedActiveIndex"
|
:isAutoIndex="false"
|
:isPaddingRight="false"
|
ref="claimedTableRef"
|
:list="claimedRecords"
|
:header="claimedTableHeader"
|
:height="tableHeight"
|
:loading="claimedLoading"
|
:isReserve="true"
|
:rowKey="'trxnBr'"
|
></TableList>
|
<KeysTable
|
v-if="projectCompany.phaseno === '0070'"
|
:list="claimedCheckInfoList"
|
:header="claimedTableHeader"
|
:isShowPages="false"
|
title="认领流水"
|
></KeysTable>
|
<div class="btn">
|
<el-button
|
v-if="projectCompany.phaseno === '0060'"
|
size="medium"
|
type="primary"
|
:loading="mainSubmitLoading"
|
@click="savePage()"
|
>保存</el-button
|
>
|
<el-button size="medium" plain @click="prevPage()">上一页</el-button>
|
<el-button
|
size="medium"
|
:loading="mainSubmitLoading"
|
type="primary"
|
@click="nextPage()"
|
>下一页</el-button
|
>
|
</div>
|
</div>
|
<Dialog
|
v-model="isShowSubmit"
|
title="信息确认"
|
:buttons="[{ text: '取消' }, { text: '确定', type: 'primary' }]"
|
@handleClick="clickAgainEnter"
|
:contentText="`选中流水,请再次确认!`"
|
></Dialog>
|
</div>
|
</template>
|
<script>
|
import FormList from "../../../../comprehensiveTransaction/components/FormList.vue";
|
import TableList from "../../../../comprehensiveTransaction/components/TableList.vue";
|
import KeysTable from "../../../../comprehensiveTransaction/components/KeysTable";
|
import Dialog from "../../../../comprehensiveTransaction/components/Dialog.vue";
|
import {
|
loanMarginManagementClaimSearch,
|
loanMarginManagementToBeClaimedSearch,
|
} from "@comprehensive/utils/formItems";
|
import {
|
loanMarginManagementClaimHeader,
|
loanMarginManagementToBeClaimHeader,
|
} from "@comprehensive/utils/tableHeaders";
|
import {
|
qryProdList,
|
queryDepositList,
|
queryBankWaterInfo,
|
qryTrxnbrList,
|
} from "@comprehensive/serve/public";
|
import { addTrxnbrRelative, qryTrxnbrRelative } from "@/api/product";
|
import common from "@/utils/common";
|
|
export default {
|
data() {
|
return {
|
projectCompany: this.$store.state.product.projectCompany,
|
applyMenu: this.$store.state.product.applyMenu,
|
//待认领资金data
|
claimedFormInfo: [],
|
claimedIsShowDetail: false,
|
// 表单结果数据
|
claimedValueInfo: {},
|
//表单数据
|
claimedRecords: [],
|
//选中的list
|
claimedCheckInfoList: [],
|
//初始选中的list
|
initClaimedCheckInfoList: [],
|
claimedTableHeader: [...loanMarginManagementToBeClaimHeader],
|
tableHeight: "560px",
|
claimedLoading: false,
|
mainSubmitLoading: false,
|
//页码
|
claimedPageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0,
|
},
|
// 查询过滤字段
|
formInfoFilter: [],
|
isShowSubmit: false,
|
isSaveClick: false,
|
};
|
},
|
computed: {
|
claimedActiveIndex() {
|
const arr = [];
|
this.claimedRecords.forEach((item, i) => {
|
this.claimedCheckInfoList.forEach((val) => {
|
if (item.trxnBr == val.trxnBr) {
|
arr.push(i);
|
}
|
});
|
});
|
return arr;
|
},
|
},
|
components: {
|
FormList,
|
TableList,
|
Dialog,
|
KeysTable,
|
},
|
async created() {
|
this.init();
|
},
|
methods: {
|
init() {
|
const { formInfoFilter } = this;
|
//待认领资金data
|
this.claimedFormInfo = loanMarginManagementToBeClaimedSearch.filter(
|
({ name }) => !formInfoFilter.includes(name)
|
);
|
this.claimedLoanList(() => {
|
this.requestQryTrxnbrRelative();
|
});
|
},
|
// 获取当前数据列表
|
async claimedLoanList(callBack) {
|
this.claimedLoading = true;
|
let { claimedValueInfo, claimedPageInfo, serialNo } = this;
|
const res = await qryTrxnbrList({
|
...claimedValueInfo,
|
...claimedPageInfo,
|
projectSerialNo: this.projectCompany.serialno,
|
});
|
this.claimedLoading = false;
|
|
const { records = [], total, pages } = res.result;
|
this.claimedRecords = records.reduce((pre, curr) => {
|
const { status, statusDesc } = curr;
|
pre.push({
|
...curr,
|
});
|
return pre;
|
}, []);
|
this.claimedPageInfo = {
|
...claimedPageInfo,
|
total: parseInt(total),
|
};
|
callBack ? callBack() : "";
|
},
|
//获取已选中的流水数据列表
|
async requestQryTrxnbrRelative() {
|
//初审时,不勾选默认流水
|
// if (this.projectCompany.phaseno === "0060") {
|
// return;
|
// }
|
this.claimedLoading = true;
|
const resp = await qryTrxnbrRelative({
|
projectSerialNo: this.projectCompany.serialno,
|
});
|
this.claimedLoading = false;
|
if (resp.code == "00") {
|
if (resp.result.records.length > 0) {
|
this.claimedCheckInfoList = resp.result.records;
|
this.initClaimedCheckInfoList = resp.result.records;
|
}
|
}
|
const arr = [];
|
//如果是复审,则只展示已匹配流水
|
if (this.projectCompany.phaseno >= "0070") {
|
this.claimedRecords.forEach((item, i) => {
|
this.claimedCheckInfoList.forEach((val) => {
|
if (item.trxnBr == val.trxnBr) {
|
arr.push(item);
|
}
|
});
|
});
|
console.log("有匹配的流水就只展示匹配的流水", arr);
|
if (arr.length > 0) {
|
this.claimedRecords = arr;
|
}
|
}
|
},
|
|
//待认领资金更新
|
claimedUpdateValue(value, item) {
|
let { name } = item;
|
this.claimedSetOrGetFormInfo(name, { value });
|
},
|
// 设置表单结果数据
|
claimedSetValueInfo(info = {}) {
|
this.claimedValueInfo = info;
|
},
|
// 重置表单
|
claimedResetValue() {
|
this.claimedPageInfo.currentPage = 1;
|
this.claimedLoanList();
|
},
|
//2- 待认领资金data
|
claimedSetOrGetFormInfo(nameKey, newInfo) {
|
let { claimedFormInfo } = this;
|
let index = claimedFormInfo.findIndex(({ name }) => name === nameKey);
|
let result = {};
|
if (!isNaN(index)) {
|
this.$set(this.claimedFormInfo, index, {
|
...claimedFormInfo[index],
|
...newInfo,
|
});
|
result = this.claimedFormInfo[index];
|
}
|
if (typeof newInfo === "undefined") {
|
return result;
|
}
|
},
|
claimedOnSubmit(val) {
|
this.claimedPageInfo.currentPage = 1;
|
if (val == "reset") {
|
this.claimedFormInfo = loanMarginManagementToBeClaimedSearch.filter(
|
({ name }) => !this.formInfoFilter.includes(name)
|
);
|
this.claimedValueInfo = {};
|
}
|
|
this.claimedLoanList();
|
},
|
|
doAction(name, item, index) {},
|
// 修改翻页数
|
claimedHandleCurrentChange(val) {
|
this.claimedPageInfo.currentPage = val;
|
this.claimedLoanList();
|
},
|
// 修改翻页条数
|
claimedHandleSizeChange(val) {
|
this.claimedPageInfo.pageSize = val;
|
this.claimedLoanList();
|
},
|
// 选中的数据
|
claimedHandleSelectionChange(array) {
|
// if (this.claimedCheckInfoList.length > 0) {
|
|
// }else {
|
|
// }
|
this.claimedCheckInfoList = array;
|
},
|
//项目认领保证金
|
async requestAddTrxnbrRelative(callback) {
|
this.claimedCheckInfoList = this.claimedCheckInfoList.reduce(
|
(pre, curr) => {
|
let coreBalanceNumber = 0;
|
let coreCrtAmt = 0;
|
if (curr.coreBalance) {
|
let cleanCoreBalanceStr = curr.coreBalance.replace(/,/g, "");
|
coreBalanceNumber = parseFloat(cleanCoreBalanceStr);
|
}
|
if (curr.crtAmt) {
|
let cleanCrtAmtStr = curr.crtAmt.replace(/,/g, "");
|
coreCrtAmt = parseFloat(cleanCrtAmtStr);
|
}
|
|
pre.push({
|
...curr,
|
coreBalance: coreBalanceNumber,
|
crtAmt: coreCrtAmt,
|
});
|
return pre;
|
},
|
[]
|
);
|
this.mainSubmitLoading = true;
|
const resp = await addTrxnbrRelative({
|
infoList: this.claimedCheckInfoList,
|
projectSerialNo: this.projectCompany.serialno,
|
});
|
this.mainSubmitLoading = false;
|
if (resp.code == "00") {
|
this.initClaimedCheckInfoList = this.claimedCheckInfoList
|
this.$message.success("认领流水成功");
|
callback ? callback() : "";
|
}
|
},
|
async clickAgainEnter(index) {
|
this.isShowSubmit = false;
|
if (index === 1) {
|
this.requestAddTrxnbrRelative(() => {
|
if (!this.isSaveClick) {
|
this.$parent.updateApplyTabTree("认领流水");
|
}
|
});
|
}
|
},
|
savePage() {
|
this.isSaveClick = true;
|
if (this.claimedCheckInfoList.length > 0) {
|
this.isShowSubmit = true;
|
} else {
|
this.$message.warning("请选择流水");
|
return;
|
}
|
},
|
prevPage() {
|
this.applyMenu.forEach((val, index) => {
|
if (val.tabname == "认领流水") {
|
common.workerTabInfo(
|
this.applyMenu[index - 1].tabname,
|
"CreditFlowPublic",
|
this
|
);
|
}
|
});
|
},
|
|
nextPage() {
|
this.isSaveClick = false;
|
if (this.projectCompany.phaseno >= "0070") {
|
this.$parent.updateApplyTabTree("认领流水");
|
return;
|
}
|
if (this.claimedCheckInfoList.length == 0) {
|
this.$message.warning("请选择流水");
|
return;
|
}
|
this.$parent.updateApplyTabTree("认领流水");
|
// this.isShowSubmit = true
|
// this.claimedCheckInfoIsChange(() => {
|
// this.isShowSubmit = true
|
// },(type) => {
|
// if (type === 'noChange') {
|
// this.$parent.updateApplyTabTree("认领流水");
|
// }
|
// })
|
},
|
arraysEqual(a, b) {
|
const set1 = new Set(a.map((item) => item.trxnBr));
|
const set2 = new Set(b.map((item) => item.trxnBr));
|
|
const isEqual =
|
set1.size === set2.size && [...set1].every((val) => set2.has(val));
|
return isEqual;
|
},
|
claimedCheckInfoIsChange(confirmCallBack, cancelCallBack) {
|
const isEqual = this.arraysEqual(
|
this.initClaimedCheckInfoList,
|
this.claimedCheckInfoList
|
);
|
if (!isEqual) {
|
this.$confirm(`当前页面存在未保存的数据,是否保存数据?`, "提示", {
|
confirmButtonText: "是",
|
cancelButtonText: "否",
|
customClass: "building_messages_box",
|
confirmButtonClass: "building_messages_box_confirm",
|
cancelButtonClass: "building_messages_box_cancel",
|
center: true,
|
})
|
.then(() => {
|
confirmCallBack ? confirmCallBack() : "";
|
// this.isShowSubmit = true;
|
})
|
.catch(() => {
|
cancelCallBack ? cancelCallBack('cancel') : "";
|
});
|
} else {
|
// this.isShowSubmit = true;
|
cancelCallBack ? cancelCallBack('noChange') : "";
|
}
|
},
|
},
|
beforeRouteLeave(to, from, next) {
|
this.claimedCheckInfoIsChange(
|
() => {
|
if (this.claimedCheckInfoList.length == 0) {
|
this.$message.warning("请选择流水");
|
return;
|
}
|
this.requestAddTrxnbrRelative(() => {
|
next();
|
});
|
},
|
(type) => {
|
next();
|
}
|
);
|
},
|
};
|
</script>
|
|
<style lang="postcss" scoped>
|
.detail-header {
|
display: flex;
|
& .header-right {
|
flex: 1;
|
}
|
& .header-right-inner {
|
display: flex;
|
background: #f9f9f9;
|
align-items: center;
|
margin: 0 0 10px;
|
background: #fff;
|
padding: 20px 20px 20px 10px;
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
& .header-steps {
|
flex: 1;
|
}
|
& .detail-header-control {
|
margin-left: 30px;
|
& >>> .el-button {
|
padding: 4px 5px;
|
border-radius: 2px;
|
border: 1px solid rgba(238, 238, 238, 1);
|
font-size: 12px;
|
color: rgba(119, 119, 119, 1);
|
}
|
}
|
|
& >>> .el-button--text {
|
padding-top: 20px;
|
}
|
}
|
}
|
|
.el-container .el-main {
|
padding: 16px 0;
|
}
|
.el-container .el-header {
|
padding: 0;
|
}
|
.main-tab {
|
padding: 20px;
|
}
|
.main-buttons {
|
display: flex;
|
width: 100%;
|
justify-content: center;
|
padding-top: 80px;
|
& >>> .el-button {
|
padding: 8px 41px;
|
}
|
& >>> .el-button--default {
|
margin-right: 33px;
|
}
|
}
|
.empty-tab {
|
width: 100%;
|
min-height: 550px;
|
}
|
|
.scroll-content {
|
display: flex;
|
& .tab-scroll {
|
width: 128px;
|
padding: 0 16px;
|
overflow-y: auto;
|
list-style: none;
|
font-size: 14px;
|
background: #fff;
|
&::-webkit-scrollbar {
|
width: 0px;
|
height: 10px;
|
}
|
& .tab-list {
|
padding: 0 10px 34px 0;
|
& a {
|
cursor: pointer;
|
font-weight: 400;
|
color: #222222;
|
&:hover {
|
color: #409eff;
|
}
|
}
|
|
&.active {
|
& a {
|
color: #0081f0;
|
}
|
}
|
}
|
& .back-section {
|
background: #fff;
|
border-radius: 0px 4px 0px 0px;
|
padding: 16px 16px 30px 0;
|
& >>> .el-button {
|
padding: 5px 9.5px;
|
border: none;
|
background: rgba(238, 238, 238, 1);
|
border-radius: 12px;
|
font-weight: 400;
|
color: #333333;
|
}
|
& >>> .el-button span {
|
margin-left: 2px;
|
font-size: 12px;
|
}
|
& >>> .el-button i {
|
font-weight: bold;
|
}
|
}
|
}
|
& .content-scroll {
|
flex: 1;
|
overflow-y: auto;
|
position: relative;
|
margin: 0 0 0 20px;
|
& .scroll-inner {
|
background: #fff;
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
margin-bottom: 20px;
|
& .scroll-title {
|
font-size: 16px;
|
border-bottom: solid 2px #eeeeee;
|
color: #000;
|
padding: 16px 20px;
|
margin-bottom: 10px;
|
font-weight: 500;
|
}
|
& .inner-content {
|
padding: 0 0 20px 20px;
|
& >>> .el-tabs__header {
|
margin: 0;
|
}
|
}
|
& .tab-form-buttons {
|
display: flex;
|
justify-content: center;
|
padding: 60px 0 30px 0;
|
& p {
|
margin: 0 40px 0 0;
|
}
|
& p:last-child {
|
margin-right: 0;
|
}
|
}
|
}
|
&::-webkit-scrollbar {
|
width: 0;
|
height: 10px;
|
}
|
& .last-scroll-inner {
|
min-height: 620px;
|
}
|
}
|
}
|
.apply-top-button {
|
& >>> .el-button {
|
margin-left: 20px;
|
}
|
}
|
.apply-info {
|
& >>> .clearCheckAll {
|
.el-table__header-wrapper .el-checkbox {
|
display: none;
|
}
|
}
|
}
|
|
.qrcode-content {
|
text-align: center;
|
& .qrode-close {
|
margin: 0;
|
padding: 0;
|
margin-bottom: 10px;
|
& i {
|
cursor: pointer;
|
font-size: 18px;
|
}
|
/* text-align: right; */
|
}
|
}
|
</style>
|