<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" :disabled="btnLoading" >提交</el-button>
|
</p>
|
</div>
|
</div>
|
</div>
|
</li>
|
</ul>
|
</div>
|
</ScrollToTab>
|
</el-main>
|
<Dialog
|
v-model="isShowSucc"
|
icon="succ"
|
iconText="提交成功"
|
:close="false"
|
:buttons="[{text: '确定', type: 'primary'}]"
|
@handleClick="sureSucc"
|
></Dialog>
|
</el-container>
|
</template>
|
<script>
|
/**
|
* 贷款申请查询详情页
|
*/
|
import ScrollToTab from '@/components/ScrollToTab'
|
import TabContent from '@/components/TabContent'
|
import Dialog from '@/components/Dialog'
|
import uptFundRouterManageInfo from '@/controller/uptFundRouterManageInfo'
|
import { mapActions, mapState, mapGetters, mapMutations } from 'vuex'
|
|
export default {
|
components: {
|
TabContent,
|
ScrollToTab,
|
Dialog
|
},
|
data() {
|
return {
|
keepAlive: true,
|
query: {},
|
loading: false,
|
tabIndex: 0,
|
clientHeight: 600,
|
tabScroll: 'tab_scroll',
|
contentScroll: 'content_scroll',
|
uptFundRouterManageInfoModel: null,
|
loadnCount: 0,
|
isShowSucc: false,
|
btnLoading: false
|
}
|
},
|
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()
|
this.uptFundRouterManageInfoModel = uptFundRouterManageInfo()
|
},
|
|
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)
|
},
|
// 是否为保存
|
async submit(isSave = 0) {
|
const {
|
tabTree,
|
query,
|
baseInfo,
|
personLimit,
|
uptFundRouterManageInfoModel,
|
} = this
|
const { operationMenu, operation, submitType } = query
|
const submitNames = [
|
'贷款机构信息',
|
'贷款机构优先级',
|
]
|
submitNames.forEach(async name => {
|
const index = tabTree.findIndex(({ tabName }) => tabName === name)
|
//因为贷款机构信息,不需要提交任何信息,所以,直接从贷款机构优先级开始,index > 0
|
if (
|
index > 0 &&
|
typeof this.$refs[`tabContent${index}`][0].submit === 'function'
|
) {
|
this.keepAlive = false
|
const res = this.$refs[`tabContent${index}`][0].submit(isSave)
|
this.loadnCount++
|
if (this.loadnCount === 1) {
|
if (operationMenu === 'paymentRoutingManagement') {
|
const {
|
fundRouteManageInfoReq,
|
} = this
|
if (
|
Object.keys(fundRouteManageInfoReq).length === 0
|
) {
|
this.$message.warning('当前页面有必填数据未填写')
|
this.loadnCount = 0
|
this.setControlFuncArr([])
|
return
|
}
|
|
//贷款机构优先级校验
|
// if ( fundRouteManageInfoReq) {
|
// console.log('贷款机构优先级校验',1)
|
// }
|
try {
|
this.btnLoading = true
|
|
const res = await uptFundRouterManageInfoModel.request({
|
...fundRouteManageInfoReq,
|
submitType
|
})
|
this.btnLoading = false
|
this.isShowSucc = true
|
this.loadnCount = 0
|
} catch (error) {
|
this.setControlFuncArr([])
|
this.btnLoading = false
|
this.loadnCount = 0
|
}
|
this.loadnCount = 0
|
}
|
setTimeout(() => {
|
this.loadnCount = 0
|
}, 1000)
|
}
|
}
|
})
|
|
// this.$nextTick(() => {
|
// if (Number(isSubmitBack) === 1) {
|
// this.goBack()
|
// }
|
// })
|
},
|
|
sureSucc() {
|
this.isShowSucc = false
|
this.goBack()
|
},
|
// ...mapMutations(['setTabTree','setIsRefresh']),
|
...mapMutations(['setTabTree', 'setControlFuncArr']),
|
...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: state => state.tabTree,
|
fundRouteManageInfoReq: state => state.loanInstitution.fundRouteManageInfoReq,
|
}),
|
...mapGetters(['isEdit'])
|
},
|
watch: {
|
$route(to, from) {
|
const { path } = to
|
if (/\/comm\/applyForPaymentRouing$/.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)
|
}
|
}
|
</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>
|