<template>
|
<el-container style="background: rgba(0, 0, 0, 0.02)">
|
<el-main style="margin: 0;padding: 0;">
|
<ScrollToTab
|
:tabId="`#${tabScroll}`"
|
:contentId="`#${contentScroll}`"
|
:tabIndex="tabIndex"
|
ref="scrollTab"
|
>
|
<!-- @changeTab="changeTab" -->
|
<div class="scroll-content" :class="{'detail-content': !isEdit}">
|
<!-- <div class="tab-scroll">
|
<p class="back-section" v-if="!isBack">
|
<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>-->
|
<p class="back-section" v-if="!isBack">
|
<el-button size="small" icon="el-icon-back" round @click="goBack">返回列表</el-button>
|
</p>
|
<ul class="content-scroll" :id="contentScroll">
|
<li
|
v-for="(item, index) in tabTree"
|
:key="index"
|
class="content-list"
|
:class="{'content-list-isShow': isCheck && controllerCheck}"
|
>
|
<div class="scroll-inner" v-if="item.visible === 'Y'">
|
<!-- :class="{'last-scroll-inner': index === tabTree.length - 1}" -->
|
<!-- <p class="scroll-title" v-if="!isEdit">{{item.tabName}}</p> -->
|
<div class="inner-content">
|
<TabContent
|
:ref="`tabContent${index}`"
|
:info="item"
|
:index="index"
|
@goBack="goBack"
|
@showCheck="showCheck"
|
></TabContent>
|
<!-- {{tabTree.some(({edit})=> edit === 'Y')}} {{index === tabTree.length - 1}} {{index}} {{tabTree.length - 1}} -->
|
<div
|
class="tab-form-buttons"
|
v-if="tabTree.some(({edit})=> edit === 'Y') && index === 0"
|
>
|
<p>
|
<el-button class="comm-button" @click="goBack">返回</el-button>
|
</p>
|
<p>
|
<el-button class="comm-button" @click="resetForm">重置</el-button>
|
</p>
|
<p>
|
<el-button class="comm-button" @click="checkData" :disabled="!isSubmit">核对</el-button>
|
</p>
|
<p>
|
<el-button
|
class="comm-button"
|
type="primary"
|
@click="submit"
|
:disabled="isSubmit"
|
>提交</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,
|
tabScroll: 'tab_scroll',
|
contentScroll: 'content_scroll',
|
controllerCheck: true,
|
isSubmit: true
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
this.controllerCheck = true
|
const { query } = this.$route
|
this.query = query
|
this.keepAlive = true
|
// this.queryLoanTransUtilTabTree()
|
},
|
|
// 贷后交易名称下拉列表
|
async queryLoanTransUtilTabTree(name) {
|
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 } = query
|
if (from === 'cts') {
|
window.history.go(-1)
|
} else {
|
this.setSerialNo('')
|
this.showCheck(true)
|
this.$router.go(-1)
|
}
|
},
|
|
showCheck(bool) {
|
if (!bool) {
|
this.isSubmit = false
|
this.controllerCheck = false
|
} else {
|
this.isSubmit = true
|
this.controllerCheck = true
|
}
|
},
|
checkSonFunc(funcName) {
|
const { tabTree } = this
|
const submitNames = ['基本信息']
|
submitNames.forEach(name => {
|
const index = tabTree.findIndex(({ tabName }) => tabName === name)
|
if (
|
index > -1 &&
|
typeof this.$refs[`tabContent${index}`][0][funcName] === 'function'
|
) {
|
this.keepAlive = false
|
this.$refs[`tabContent${index}`][0][funcName]()
|
}
|
})
|
},
|
submit() {
|
this.checkSonFunc('submit')
|
},
|
resetForm() {
|
this.checkSonFunc('resetForm')
|
},
|
checkData() {
|
this.checkSonFunc('checkData')
|
},
|
setTree() {},
|
...mapMutations(['setTabTree', 'setSerialNo']),
|
...mapActions(['queryTabTree'])
|
},
|
computed: {
|
currTabItem() {
|
let { tabIndex, tabTree } = this
|
return tabTree[tabIndex] || {}
|
},
|
isBack() {
|
const { isHideBack = '0' } = this.$route.query
|
return isHideBack === '1'
|
},
|
tabTree() {
|
const { isApplyPhase } = this.$route.query
|
// const { serialNo } = this
|
if (isApplyPhase === '2') {
|
return [
|
{
|
tabName: '基本信息',
|
edit: 'N',
|
visible: 'Y'
|
},
|
{
|
tabName: '核对结果',
|
edit: 'N',
|
visible: 'Y'
|
},
|
{
|
tabName: '业务交易明细',
|
edit: 'N',
|
visible: 'Y'
|
},
|
{
|
tabName: '财务分录明细',
|
edit: 'N',
|
visible: 'Y'
|
}
|
]
|
} else {
|
return [
|
{
|
tabName: '基本信息',
|
edit: 'Y',
|
visible: 'Y'
|
},
|
{
|
tabName: '核对结果',
|
edit: 'Y',
|
visible: 'Y'
|
},
|
{
|
tabName: '业务交易明细',
|
edit: 'Y',
|
visible: 'Y'
|
},
|
{
|
tabName: '财务分录明细',
|
edit: 'Y',
|
visible: 'Y'
|
}
|
]
|
}
|
},
|
isCheck() {
|
const { query } = this.$route
|
const { isApplyPhase } = query
|
if (isApplyPhase === '1') {
|
return true
|
} else {
|
return false
|
}
|
},
|
// ...mapState(['tabTree']),
|
...mapState(['serialNo']),
|
...mapGetters(['isEdit'])
|
},
|
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()
|
}
|
}
|
</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;
|
flex-direction: column;
|
& .tab-scroll {
|
width: 139px;
|
max-height: 864px;
|
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;
|
}
|
}
|
}
|
}
|
& .back-section {
|
/* width: 128px; */
|
background: #fff;
|
border-radius: 0px 4px 0px 0px;
|
padding: 14px 0 20px 0px;
|
margin: 0 0 0 20px;
|
& >>> .el-button {
|
padding: 5px 9.5px;
|
border: none;
|
background: rgba(238, 238, 238, 1);
|
border-radius: 12px;
|
font-weight: 400;
|
color: #333333;
|
margin-left: 20px;
|
}
|
& >>> .el-button span {
|
margin-left: 2px;
|
font-size: 12px;
|
}
|
& >>> .el-button i {
|
font-weight: bold;
|
}
|
}
|
& .content-scroll {
|
flex: 1;
|
max-height: 864px;
|
overflow-y: auto;
|
position: relative;
|
margin: 0 0 0 0;
|
list-style: none;
|
padding: 0 0 0 29px;
|
background: #fff;
|
& .content-list {
|
& .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: 0 0 30px 0;
|
& p {
|
margin: 0 40px 0 0;
|
}
|
& p:last-child {
|
margin-right: 0;
|
}
|
}
|
}
|
&.content-list-isShow:not(:first-child) {
|
display: none;
|
}
|
}
|
&::-webkit-scrollbar {
|
width: 0;
|
height: 10px;
|
}
|
& .last-scroll-inner {
|
min-height: 920px;
|
}
|
}
|
}
|
.detail-content {
|
& .content-scroll {
|
background: none;
|
padding-left: 20px;
|
& .scroll-inner {
|
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.03);
|
& .inner-content {
|
padding-left: 20px;
|
}
|
}
|
}
|
}
|
</style>
|