This commit is contained in:
宋伟佳
2021-06-30 19:32:31 +08:00
8 changed files with 138 additions and 101 deletions
@@ -2,24 +2,18 @@
<template>
<div id="accessStandardsAndRegulations" class="v-class">
<el-tabs v-model="tabValue" style="height: 100%;">
<el-tab-pane label="国家/地区清单" name="listOfCountries">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-of-countries v-if="tabValue === 'listOfCountries'"></list-of-countries>
<el-tab-pane v-for="(item,index) in list" :key="index" :label="item.label" :name="item.name">
<div v-if="tabValue === 'listOfCountries'" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-of-countries></list-of-countries>
</div>
</el-tab-pane>
<el-tab-pane label="项目类清单" name="listProject">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-project v-if="tabValue === 'listProject'"></list-project>
<div v-else-if="tabValue === 'listProject'" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-project></list-project>
</div>
</el-tab-pane>
<!-- <el-tab-pane label="重点标准跟踪清单" name="listTracking">-->
<!-- <div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">-->
<!-- <list-tracking v-if="tabValue === 'listTracking'"></list-tracking>-->
<!-- </div>-->
<!-- </el-tab-pane>-->
<el-tab-pane label="其他清单" name="listOther">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-other v-if="tabValue === 'listOther'"></list-other>
<div v-else-if="tabValue === 'listTracking'" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-tracking></list-tracking>
</div>
<div v-else-if="tabValue === 'listOther'" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<list-other></list-other>
</div>
</el-tab-pane>
</el-tabs>
@@ -27,90 +21,113 @@
</template>
<script>
import listOfCountries from "../accessStandardsAndRegulations/page/listOfCountries";
import listProject from "../accessStandardsAndRegulations/page/listProject";
import listTracking from "../accessStandardsAndRegulations/page/listTracking";
import listOther from "../accessStandardsAndRegulations/page/listOther";
export default {
name: "AccessStandardsAndRegulations",
data() {
return {
tabValue: "listOfCountries"
};
},
methods: {},
components: {
listOfCountries,
listProject,
listTracking,
listOther
},
props: {},
computed: {},
watch: {},
mounted() {
},
beforeRouteLeave(to, from, next) {
const toName = ['ListOfStandardsAndRegulationsDetails', 'Details', 'ProjectAddEit', 'OtherAddEit']
// 离开此页面之前,记录tabName以便返回使用,如果将要访问的页面不是这两个,则清空tabName
if (toName.includes(to.name)) {
this.$store.commit('SET_ACCESS_STANDARD_REG_TABS', this.tabValue)
} else {
this.$store.commit('SET_ACCESS_STANDARD_REG_TABS')
}
setTimeout(() => {
next()
}, 100)
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (vm.$store.state.accessStandRegTabName !== '') {
vm.tabValue = vm.$store.state.accessStandRegTabName
import listOfCountries from "../accessStandardsAndRegulations/page/listOfCountries";
import listProject from "../accessStandardsAndRegulations/page/listProject";
import listTracking from "../accessStandardsAndRegulations/page/listTracking";
import listOther from "../accessStandardsAndRegulations/page/listOther";
export default {
name: "AccessStandardsAndRegulations",
data() {
return {
list: [],
tabValue: ''
};
},
methods: {},
components: {
listOfCountries,
listProject,
listTracking,
listOther
},
props: {},
computed: {},
watch: {},
mounted() {
var list = []
const menuList = this.$store.getters.getMenuList
menuList.forEach(item => {
if (item.id === '8e3894cbd5507008aaf949394b7d198b') {
list.push({
label: '国家/地区清单',
name: 'listOfCountries'
})
} else if (item.id === 'f4f95a8b9a02845c8dc0331dbe41e80c') {
list.push({
label: '项目类清单',
name: 'listProject'
})
} else if (item.id === 'df227899442db20b31b7cb0b2ac6f5e7') {
list.push({
label: '重点标准跟踪清单',
name: 'listTracking'
})
} else if (item.id === 'f19255f8e94f04fd85a33a23f4d1fc85') {
list.push({
label: '其他清单',
name: 'listOther'
})
}
})
this.list = list
this.tabValue = this.list[0].name
},
beforeRouteLeave(to, from, next) {
const toName = ['ListOfStandardsAndRegulationsDetails', 'Details', 'ProjectAddEit', 'OtherAddEit']
// 离开此页面之前,记录tabName以便返回使用,如果将要访问的页面不是这两个,则清空tabName
if (toName.includes(to.name)) {
this.$store.commit('SET_ACCESS_STANDARD_REG_TABS', this.tabValue)
} else {
this.$store.commit('SET_ACCESS_STANDARD_REG_TABS')
}
})
}
};
setTimeout(() => {
next()
}, 100)
},
beforeRouteEnter(to, from, next) {
next(vm => {
if (vm.$store.state.accessStandRegTabName !== '') {
vm.tabValue = vm.$store.state.accessStandRegTabName
}
})
}
};
</script>
<style lang="less" scoped>
@import '~@/assets/styles/style';
@import '~@/assets/styles/mixins';
@import '~@/assets/styles/style';
@import '~@/assets/styles/mixins';
#accessStandardsAndRegulations {
height: 100%;
padding: 0 10px;
background: #fff;
display: flex;
flex-direction: column;
/deep/ .el-tabs {
flex: auto;
#accessStandardsAndRegulations {
height: 100%;
padding: 0 10px;
background: #fff;
display: flex;
flex-direction: column;
/deep/ .el-tabs__header {
margin: 0 !important;
}
.el-tabs__content {
height: 100% !important;
/deep/ .el-tabs {
flex: auto;
position: relative;
display: flex;
flex-direction: column;
.el-tab-pane {
height: 100%;
/deep/ .el-tabs__header {
margin: 0 !important;
}
.el-tabs__content {
height: 100% !important;
flex: auto;
position: relative;
display: flex;
flex-direction: column;
.el-tab-pane {
height: 100%;
flex: auto;
display: flex;
flex-direction: column;
}
}
}
}
}
</style>