控制 Tabs bar 显示

dev
张同海 2 years ago
parent fe8fe45b72
commit 71f0925aa7

@ -1,6 +1,12 @@
<template> <template>
<div class="booking-detail"> <div class="booking-detail">
<a-tabs size="large" :tabBarStyle="tabBarStyle" :activeKey="tabActiveKey" @change="changeTab"> <a-tabs
size="large"
:class="Showtabs ? 'Showtabs' : ''"
:tabBarStyle="tabBarStyle"
:activeKey="tabActiveKey"
@change="changeTab"
>
<a-tab-pane key="1" tab="主单信息"> <a-tab-pane key="1" tab="主单信息">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="18"> <a-col :span="18">
@ -71,7 +77,12 @@
</a-row> </a-row>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="分单信息" v-if="bookingDetails.hbList && bookingDetails.hbList.length > 0"> <a-tab-pane key="2" tab="分单信息" v-if="bookingDetails.hbList && bookingDetails.hbList.length > 0">
<sedOrder ref="sedOrder" :details="bookingDetails" :sedOrderList="bookingDetails.hbList" :isAdd="isAdd"></sedOrder> <sedOrder
ref="sedOrder"
:details="bookingDetails"
:sedOrderList="bookingDetails.hbList"
:isAdd="isAdd"
></sedOrder>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
@ -105,7 +116,7 @@ export default {
rightContent, rightContent,
basicItem, basicItem,
ediMore, ediMore,
sedOrder, sedOrder
}, },
data() { data() {
return { return {
@ -116,26 +127,36 @@ export default {
bookingDetails: {}, bookingDetails: {},
tabBarStyle: { tabBarStyle: {
background: '#fff', background: '#fff',
padding: '0 20px', padding: '0 20px'
}, },
excuteRules: [], excuteRules: [],
excuteRulesType: '', excuteRulesType: '',
isAdd: false, isAdd: false,
moreStr: '', moreStr: '',
tabActiveKey: '1', tabActiveKey: '1',
historyData: {}, historyData: {}
} }
}, },
computed: { computed: {
...mapGetters(['bookingList']), ...mapGetters(['bookingList']),
Showtabs() {
console.log(this.bookingDetails, 'bookingDetails')
let Rdata = true
if (this.bookingDetails.hbList && this.bookingDetails.hbList.length) {
Rdata = false
} else {
Rdata = true
}
return Rdata
}
}, },
watch: { watch: {
bookingDetails: { bookingDetails: {
handler(nval, oval) { handler(nval, oval) {
// console.log(' -- ', nval) // console.log(' -- ', nval)
}, },
deep: true, deep: true
}, }
}, },
created() { created() {
this.init() this.init()
@ -150,7 +171,7 @@ export default {
tabActiveKey: this.tabActiveKey, tabActiveKey: this.tabActiveKey,
type: this.type, type: this.type,
isCopy: this.isCopy, isCopy: this.isCopy,
id: this.$route.query.id, id: this.$route.query.id
} }
this.$set(this.historyData, this.$route.query.id, hisData) this.$set(this.historyData, this.$route.query.id, hisData)
} }
@ -167,7 +188,7 @@ export default {
tabActiveKey: this.tabActiveKey, tabActiveKey: this.tabActiveKey,
type: this.type, type: this.type,
isCopy: this.isCopy, isCopy: this.isCopy,
id: this.id, id: this.id
} }
this.$set(this.historyData, this.id, hisData) this.$set(this.historyData, this.id, hisData)
} }
@ -176,7 +197,7 @@ export default {
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
console.log('进入 beforeRouteEnter: to', to.name) console.log('进入 beforeRouteEnter: to', to.name)
console.log('进入 beforeRouteEnter: from', from.name) console.log('进入 beforeRouteEnter: from', from.name)
next((vm) => { next(vm => {
console.log('vm', vm) console.log('vm', vm)
console.log('进入路由之后: ', vm.$route.query.id) console.log('进入路由之后: ', vm.$route.query.id)
vm.getRouterHis() vm.getRouterHis()
@ -314,10 +335,10 @@ export default {
weiTuoFang: '', weiTuoFang: '',
ediAttn: '', ediAttn: '',
ediAttnTel: '', ediAttnTel: '',
ediAttnMail: '', ediAttnMail: ''
}, },
// //
hbList: [], hbList: []
} }
this.bookingDetails.carrier = this.enmuCarrier(this.type) this.bookingDetails.carrier = this.enmuCarrier(this.type)
} }
@ -353,9 +374,9 @@ export default {
this.inPageLoading = true this.inPageLoading = true
// this.$message.loading({ content: '...' }); // this.$message.loading({ content: '...' });
BookingOrderGet({ BookingOrderGet({
id: this.id, id: this.id
}) })
.then((res) => { .then(res => {
this.inPageLoading = false this.inPageLoading = false
this.$message.destroy() this.$message.destroy()
// this.$message.success({ content: '' }) // this.$message.success({ content: '' })
@ -368,13 +389,13 @@ export default {
weiTuoFang: '', weiTuoFang: '',
ediAttn: '', ediAttn: '',
ediAttnTel: '', ediAttnTel: '',
ediAttnMail: '', ediAttnMail: ''
} }
} }
this.$set(this, 'bookingDetails', res.data) this.$set(this, 'bookingDetails', res.data)
this.$forceUpdate() this.$forceUpdate()
}) })
.catch((err) => { .catch(err => {
console.log(err) console.log(err)
}) })
}, },
@ -394,7 +415,7 @@ export default {
delete _data.hbList delete _data.hbList
console.log(JSON.stringify(_data)) console.log(JSON.stringify(_data))
BookingOrderUpdate(_data) BookingOrderUpdate(_data)
.then((res) => { .then(res => {
if (res.success) { if (res.success) {
this.isCopy = false this.isCopy = false
this.isAdd = false this.isAdd = false
@ -405,7 +426,7 @@ export default {
this.$message.error(res.message) this.$message.error(res.message)
} }
}) })
.catch((err) => { .catch(err => {
console.log(err) console.log(err)
}) })
}, },
@ -419,21 +440,21 @@ export default {
const _data = JSON.parse(JSON.stringify(this.bookingDetails)) const _data = JSON.parse(JSON.stringify(this.bookingDetails))
delete _data.hbList delete _data.hbList
BookingOrderAdd(_data) BookingOrderAdd(_data)
.then((res) => { .then(res => {
if (res.success) { if (res.success) {
this.isAdd = false this.isAdd = false
this.id = res.data this.id = res.data
this.$message.success('保存成功') this.$message.success('保存成功')
this.$router.replace({ this.$router.replace({
name: 'BookingDetail', name: 'BookingDetail',
query: { id: res.data, type: this.bookingDetails.carrierid }, query: { id: res.data, type: this.bookingDetails.carrierid }
}) })
this.$forceUpdate() this.$forceUpdate()
} else { } else {
this.$message.error(res.message) this.$message.error(res.message)
} }
}) })
.catch((err) => { .catch(err => {
console.log(err) console.log(err)
}) })
}, },
@ -491,7 +512,7 @@ export default {
copyBookingFun() { copyBookingFun() {
this.$router.push({ this.$router.push({
name: 'BookingDetail', name: 'BookingDetail',
query: { id: this.id, isCopy: true, type: this.bookingDetails.carrierid }, query: { id: this.id, isCopy: true, type: this.bookingDetails.carrierid }
}) })
}, },
addSedList() { addSedList() {
@ -505,10 +526,16 @@ export default {
this.bookingDetails.hbList = [data] this.bookingDetails.hbList = [data]
this.tabActiveKey = '2' this.tabActiveKey = '2'
} }
}, }
} }
</script> </script>
<style lang="less"> <style lang="less">
.Showtabs {
.ant-tabs-top-bar {
display: none;
}
}
.base-tit { .base-tit {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
@ -537,13 +564,14 @@ export default {
// background: #ffffff; // background: #ffffff;
} }
.load-block{ .load-block {
border-radius: 4px; border-radius: 4px;
background:#fcfcfc; background: #fcfcfc;
margin-bottom: 10px; margin-bottom: 10px;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
&::after { /* 内容区域空状态时追加骨架屏样式 */ &::after {
/* 内容区域空状态时追加骨架屏样式 */
content: ''; content: '';
display: block; display: block;
width: 100%; width: 100%;
@ -552,7 +580,8 @@ export default {
background: linear-gradient(90deg, transparent, rgba(225, 225, 225, 0.1), transparent); background: linear-gradient(90deg, transparent, rgba(225, 225, 225, 0.1), transparent);
animation: loading 1.5s infinite; animation: loading 1.5s infinite;
} }
@keyframes loading{ /* 骨架屏的动画 */ @keyframes loading {
/* 骨架屏的动画 */
100% { 100% {
transform: translateX(100%) rotate(45deg); transform: translateX(100%) rotate(45deg);
} }

Loading…
Cancel
Save