<template>
|
<el-container style="background: rgba(0, 0, 0, 0.02)">
|
<el-main class="detail-main" :style="{ height: `${clientHeight}px` }">
|
<ScrollToTab
|
:tabId="`#${tabScroll}`"
|
:contentId="`#${contentScroll}`"
|
:tabIndex="tabIndex"
|
@changeTab="changeTab"
|
ref="scrollTab"
|
>
|
<div class="scroll-content" :class="{ 'detail-content': !isEdit }">
|
<div class="tab-scroll">
|
<p class="back-section" v-if="!isNoBack">
|
<el-button size="small" icon="el-icon-back" round @click="goBack"
|
>返回列表</el-button
|
>
|
</p>
|
<ul :id="tabScroll">
|
<li
|
v-for="(item, index) in tabTree"
|
:key="index"
|
@click="changeTab(index, true)"
|
class="tab-list"
|
:class="{ active: tabIndex === index }"
|
>
|
<a>{{ item.tabName }}</a>
|
</li>
|
</ul>
|
</div>
|
|
<ul class="content-scroll" :id="contentScroll">
|
<li
|
v-for="(item, index) in tabTree"
|
:key="index"
|
class="content-list"
|
>
|
<div
|
class="scroll-inner"
|
:style="{
|
minHeight:
|
index === tabTree.length - 1
|
? `${clientHeight - 18}px`
|
: 'auto',
|
}"
|
>
|
<p class="scroll-title" v-if="!isEdit">{{ item.tabName }}</p>
|
<div class="inner-content">
|
<TabContent
|
:ref="`tabContent${index}`"
|
:info="item"
|
:index="index"
|
@goBack="goBack"
|
></TabContent>
|
<div
|
class="tab-form-buttons"
|
v-if="
|
tabTree.some(({ edit }) => edit === 'Y') &&
|
index === tabTree.length - 1 &&
|
!isNoButton
|
"
|
>
|
<p>
|
<el-button class="comm-button" @click="goBack"
|
>返回</el-button
|
>
|
</p>
|
<p>
|
<el-button
|
v-if="isShowSaveButton"
|
class="comm-button"
|
type="primary"
|
@click="save"
|
>保存</el-button
|
>
|
</p>
|
<p>
|
<el-button
|
class="comm-button"
|
type="primary"
|
@click="submit"
|
:loading="submitLoading"
|
>提交</el-button
|
>
|
</p>
|
</div>
|
</div>
|
</div>
|
</li>
|
</ul>
|
</div>
|
</ScrollToTab>
|
</el-main>
|
</el-container>
|
</template>
|
<script>
|
/**
|
* 贷款申请查询详情页
|
*/
|
import ScrollToTab from "@/components/ScrollToTab";
|
import TabContent from "@/components/TabContent";
|
import { mapActions, mapState, mapGetters, mapMutations } from "vuex";
|
|
export default {
|
components: {
|
TabContent,
|
// HeaderSteps,
|
ScrollToTab,
|
},
|
data() {
|
return {
|
keepAlive: true,
|
query: {},
|
loading: false,
|
tabIndex: 0,
|
clientHeight: 600,
|
tabScroll: "tab_scroll",
|
contentScroll: "content_scroll",
|
};
|
},
|
created() {
|
this.init();
|
},
|
mounted() {
|
this.setEleHeight();
|
window.addEventListener("resize", this.setEleHeight);
|
},
|
methods: {
|
init() {
|
const { query } = this.$route;
|
const { isShowSaveButton } = query;
|
this.query = query;
|
this.isShowSaveButton = isShowSaveButton === "1";
|
this.keepAlive = true;
|
this.queryLoanTransUtilTabTree();
|
},
|
|
setEleHeight() {
|
const clientHeight = document.documentElement.clientHeight;
|
this.clientHeight = clientHeight || 600;
|
},
|
|
// 贷后交易名称下拉列表
|
async queryLoanTransUtilTabTree() {
|
const { query } = this;
|
const { applySerialno, tabName, tabIndex, isEdit, ...other } = query;
|
const { parameterMap } = query;
|
const temp =
|
typeof parameterMap === "string"
|
? { parameterMap: JSON.parse(parameterMap) }
|
: {};
|
this.queryTabTree({
|
...other,
|
...temp,
|
loanSerialno: applySerialno,
|
});
|
|
// console.log(list.some(({ edit }) => edit === 'Y'))
|
// 初始定位有bug
|
// if (typeof tabIndex !== 'undefined' && tabIndex < item.length) {
|
// this.$nextTick(() => this.changeTab(tabIndex))
|
// }
|
// if (typeof tabName !== 'undefined') {
|
// const index = item.findIndex(
|
// ({ tabName: itemName }) => itemName === tabName
|
// )
|
// if (index > -1) {
|
// this.$nextTick(() => this.changeTab(index))
|
// }
|
// }
|
},
|
|
// 切换tab的处理
|
changeTab(index, flg = false) {
|
this.tabIndex = index;
|
this.$refs.scrollTab.setScrollTop(index, flg);
|
this.$nextTick(() => this.$refs.scrollTab.setTabScrollTop());
|
},
|
|
// 返回列表
|
goBack() {
|
const { query } = this;
|
const { from, transCode } = query;
|
|
if (from === "cts") {
|
window.history.go(-1);
|
} else {
|
if (transCode === "T1004") {
|
this.keepAlive = false;
|
// this.setIsRefresh(transCode)
|
}
|
this.$router.go(-1);
|
}
|
},
|
|
save() {
|
this.submit(1);
|
},
|
// 是否为保存
|
submit(isSave = 0) {
|
const { tabTree, query } = this;
|
const { isSubmitBack } = query;
|
const submitNames = [
|
"申请信息",
|
"审批意见",
|
"退款申请信息",
|
"还款申请信息",
|
"认领撤销申请信息",
|
"待结算贴息信息",
|
"变更申请信息",
|
// '还款计划变更申请信息',
|
"提前部分还款试算",
|
"待认领资金",
|
"开票基本信息",
|
"基本信息",
|
"补开发票信息",
|
"利息开票关联信息",
|
];
|
submitNames.forEach((name) => {
|
const index = tabTree.findIndex(({ tabName }) => tabName === name);
|
if (
|
index > -1 &&
|
typeof this.$refs[`tabContent${index}`][0].submit === "function"
|
) {
|
this.keepAlive = false;
|
this.$refs[`tabContent${index}`][0].submit(isSave);
|
}
|
});
|
this.$nextTick(() => {
|
if (Number(isSubmitBack) === 1) {
|
this.goBack();
|
}
|
});
|
},
|
// ...mapMutations(['setTabTree','setIsRefresh']),
|
...mapMutations(["setTabTree"]),
|
...mapActions(["queryTabTree"]),
|
},
|
computed: {
|
currTabItem() {
|
let { tabIndex, tabTree } = this;
|
|
return tabTree[tabIndex] || {};
|
},
|
isNoBack() {
|
const { isHideBack } = this.query;
|
return Number(isHideBack) === 1;
|
},
|
isNoButton() {
|
const { isHideButton } = this.query;
|
return Number(isHideButton) === 1;
|
},
|
...mapState(["tabTree"]),
|
...mapGetters(["isEdit"]),
|
...mapState({
|
submitLoading: state => state.tabsModule.submitLoading,
|
}),
|
},
|
watch: {
|
$route(to, from) {
|
const { path } = to;
|
if (/\/comm\/apply$/.test(path)) {
|
this.init();
|
}
|
},
|
|
},
|
beforeRouteLeave(to, from, next) {
|
const { keepAlive } = this;
|
// this.tabTree = []
|
this.setTabTree([]);
|
if (to.meta.keepAlive) {
|
to.meta.keepAlive = keepAlive;
|
}
|
next();
|
},
|
beforeDestroy() {
|
window.removeEventListener("resize", this.setEleHeight);
|
sessionStorage.setItem("NewDebitSelectItem", null);
|
},
|
};
|
</script>
|
|
<style lang="postcss" scoped>
|
.detail-header {
|
display: flex;
|
& .header-right {
|
flex: 1;
|
}
|
& .header-right-inner {
|
display: flex;
|
background: #f9f9f9;
|
align-items: center;
|
margin: 10px 20px 14px 20px;
|
background: #fff;
|
padding: 20px 20px 20px 10px;
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
border-radius: 4px;
|
& .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;
|
height: 100%;
|
& .tab-scroll {
|
width: 139px;
|
height: 100%;
|
overflow-y: auto;
|
list-style: none;
|
font-size: 14px;
|
background: #fff;
|
margin-right: 2px;
|
& ul {
|
margin: 0;
|
padding: 0;
|
list-style: none;
|
}
|
& .back-section {
|
width: 128px;
|
background: #fff;
|
border-radius: 0px 4px 0px 0px;
|
padding: 14px 0 20px 0px;
|
margin: 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;
|
}
|
}
|
&::-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;
|
}
|
}
|
}
|
}
|
& .content-scroll {
|
flex: 1;
|
height: 100%;
|
overflow-y: auto;
|
position: relative;
|
margin: 0 0 0 0;
|
list-style: none;
|
padding: 0 0 0 29px;
|
background: #fff;
|
& .scroll-inner {
|
background: #fff;
|
margin-bottom: 20px;
|
& .scroll-title {
|
font-size: 16px;
|
border-bottom: solid 2px #eeeeee;
|
color: #000;
|
padding: 16px 20px;
|
font-weight: 500;
|
margin: 0;
|
}
|
& .inner-content {
|
padding: 0 0 20px 0;
|
overflow: hidden;
|
& >>> .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;
|
}
|
}
|
}
|
.detail-content {
|
& .content-scroll {
|
background: none;
|
padding-left: 20px;
|
height: 100%;
|
& .scroll-inner {
|
height: 100%;
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
& .inner-content {
|
padding-left: 20px;
|
}
|
}
|
}
|
}
|
.detail-main {
|
margin: 0;
|
padding: 0;
|
overflow: hidden;
|
}
|
</style>
|