123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528 |
- <template>
- <div class="homePage">
- <div class="frameMain" :style="allHeight">
- <div class="menuList">
- <el-menu
- :default-active="$route.path"
- router
- :unique-opened="true"
- :default-openeds="openeds"
- @select="handleNodeClick"
- text-color="#fff"
- background-color="#184FB4"
- active-text-color="#fff">
- <!-- 引入组件 -->
- <menu-tree :menuData="forecastDatas"></menu-tree>
- </el-menu>
- </div>
- <div class="homeMain" :style="mainHeight">
- <div class="homeMain_tag">
- <div style="width: 90%;overflow: hidden;">
- <el-tag
- v-for="tag in routeTags"
- :key="tag.name"
- closable
- size="large"
- class="tagArr"
- effect="dark"
- :type="tag.index === $route.path ? '': 'info'"
- @close="handleClose(tag)"
- @click="handleShowPage(tag)"
- >
- <span>{{ tag.name }}</span>
- </el-tag>
- </div>
- <div class="settingMsg">
- <span>{{userName}}</span>
- <img :src="closeBtn" @click="closeSys" >
- </div>
- </div>
- <div class="mainMessage" :style="$route.path === '/home' ? '': 'padding: 0 10px;'">
- <router-view></router-view>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import MenuTree from '../components/menuTreeconfig.vue'
- import homeImg from '../assets/menuImg/home.png'
- import taskImg from '../assets/menuImg/task.png'
- import yewuImg from '../assets/menuImg/yewu.png'
- import tixiImg from '../assets/menuImg/tixi.png'
- import zhishikuImg from '../assets/menuImg/zhishiku.png'
- import quanxianImg from '../assets/menuImg/quanxian.png'
- import closeBtn from '../assets/getwayImg/closeBtn.png'
- import { getToken, removeToken } from '../api/auth'
- import {apiPostremoveByToken, apiGetMenuData} from '../api/api'
- export default {
- components: {MenuTree},
- data() {
- return {
- forecastDatas: [],
- expendData: ['0'],
- openeds:[],
- routeTags: [],
- defaultProps: {
- children: 'children',
- label: 'label',
- },
- closeBtn: closeBtn,
- userName: ''
- }
- },
- created(){
- this.getMenuData()
- // this.forecastDatas = [
- // {
- // index: '/home',
- // name: '考评首页',
- // img: homeImg
- // },
- // {
- // index: '/taskCenter',
- // name: '任务中心',
- // img: taskImg
- // },
- // {
- // index: '1',
- // name: '考评业务',
- // img: yewuImg,
- // children: [
- // {
- // index: '/assessment/evaluationStart',
- // name: '考评目标启动',
- // },
- // {
- // index: '/assessment/monthQuarter',
- // name: '月/季度目标考评'
- // },
- // {
- // index: '/assessment/evaluationYear',
- // name: '年度目标考评'
- // },
- // {
- // index: '',
- // name: '考评项对标'
- // },
- // {
- // index: '',
- // name: '考评项预警'
- // },
- // {
- // index: '',
- // name: '人员考评'
- // },
- // {
- // index: '',
- // name: '任期考评'
- // },
- // {
- // index: '',
- // name: '考评监督'
- // },
- // {
- // index: '',
- // name: '考评评级'
- // },
- // {
- // index: '',
- // name: '考评报告'
- // },
- // {
- // index: '',
- // name: '考评公告'
- // },
- // {
- // index: '',
- // name: '单位考核结果应用'
- // },
- // {
- // index: '',
- // name: '部门考核结果应用'
- // }
- // ]
- // },
- // {
- // index: '2',
- // name: '考评体系配置',
- // img: tixiImg,
- // children: [
- // {
- // index: '/evaluationSystem/evaluationIndex',
- // name: '考评指标管理',
- // },
- // {
- // index: '/evaluationSystem/evaluationRules',
- // name: '考评规则配置',
- // },
- // {
- // index: '/evaluationSystem/company',
- // name: '单位权重配置',
- // },
- // {
- // index: '/evaluationSystem/department',
- // name: '考评部门配置',
- // },
- // {
- // index: '/evaluationSystem/personnel',
- // name: '考评人员配置',
- // },
- // {
- // index: '/evaluationSystem/achievementK',
- // name: '业绩考核系数配置',
- // },
- // {
- // index: '',
- // name: '党建考核系数配置',
- // },
- // ]
- // },
- // {
- // index: '3',
- // name: '考评知识库',
- // img: zhishikuImg,
- // children: [
- // {
- // index: '/knowledgePage/scoringRules',
- // name: '考评得分规则',
- // },
- // {
- // name: '考评评级规则',
- // },
- // {
- // name: '考评预警规则',
- // }
- // ]
- // },
- // {
- // index: '4',
- // name: '基础信息配置',
- // img: quanxianImg,
- // children: [
- // {
- // index: '',
- // name: '人员权限配置',
- // },
- // {
- // index: '',
- // name: '工作流程配置',
- // }
- // ]
- // }
- // ]
- if (window.sessionStorage.getItem('routeTags')) {
- this.routeTags = JSON.parse(window.sessionStorage.getItem('routeTags'))
- if (this.$route?.path === '/') {
- this.$router.push({ path: this.routeTags[0].index})
- }
- } else {
- this.routeTags = [
- {
- index: '/home',
- name: '考评首页'
- }
- ]
- this.$router.push({ path: this.routeTags[0].index})
- window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
- }
- if (window.sessionStorage.getItem('user')) {
- let obj = JSON.parse(window.sessionStorage.getItem('user'))
- this.userName = obj.name
- }
- },
- mounted() {
-
- },
- computed:{
- mainHeight() {
- return {
- // 'height': document.documentElement.clientHeight-50 + 'px'
- 'height': '100vh'
- }
- },
- allHeight() {
- return {
- 'width': '100%',
- // 'height': document.documentElement.clientHeight-40 + 'px'
- 'height': '100vh'
- }
- },
- viewHeight() {
- return {
- 'width': '100%',
- // 'height': document.documentElement.clientHeight-40 + 'px'
- 'height': '91vh'
- }
- }
- },
- methods:{
- // 获取菜单数据
- getMenuData() {
- let that = this
- apiGetMenuData().then(datas =>{
- if (datas && datas.data) {
- let arr = []
- for(let i =0; i<datas.data.length; i++) {
- let item = datas.data[i]
- let obj = {
- index: item.href,
- name: item.name
- }
- if (item.name === '考评首页') {
- obj.img = homeImg
- } else if(item.name === '任务中心') {
- obj.img = taskImg
- } else if(item.name === '考评业务') {
- obj.img = yewuImg
- obj.children = that.changeMenuData(item.children)
- } else if(item.name === '考评体系配置') {
- obj.img = tixiImg
- obj.children = that.changeMenuData(item.children)
- } else if(item.name === '考评知识库') {
- obj.img = zhishikuImg
- obj.children = that.changeMenuData(item.children)
- } else if(item.name === '基础信息配置') {
- obj.img = quanxianImg
- obj.children = that.changeMenuData(item.children)
- }
- arr.push(obj)
- }
- that.forecastDatas = arr
- }
- })
- },
- changeMenuData(data) {
- let childArr = []
- data.forEach(item =>{
- let obj = {
- index: item.href,
- name: item.name
- }
- childArr.push(obj)
- })
- return childArr
- },
- getBac(val) {
- let strWea = ''
- debugger
- if (val) {
- strWea = 'changeBacksty'
- } else {
- strWea = 'defaultBacksty'
- }
- return strWea
- },
- changeRoute(item) {
- if (item.index) {
- this.$router.push({ path: item.index})
- }
- },
- closeSys() {
- let that = this
- apiPostremoveByToken(getToken()).then(datas =>{
- if (datas.code === 200) {
- removeToken('token')
- removeToken('code')
- removeToken('purview')
- window.sessionStorage.removeItem('routeTags')
- window.sessionStorage.removeItem('user')
- this.$router.push({ path: "/login"})
- }
- })
- },
- handleNodeClick(index, indexPath) {
- if (indexPath) {
- this.forecastDatas.forEach(it =>{
- if (it.index !== '') {
- if (it.index === indexPath[0]) {
- if (!it.children) {
- let showM = 0
- this.routeTags.forEach(item =>{
- if (item.name === it.name) {
- showM++
- }
- })
- if (showM === 0) {
- this.routeTags.push(it)
- }
- } else {
- it.children.forEach(iv =>{
- if (iv.index !== '') {
- if (iv.index === indexPath[1]) {
- let showM = 0
- this.routeTags.forEach(item =>{
- if (item.name === iv.name) {
- showM++
- }
- })
- if (showM === 0) {
- this.routeTags.push(iv)
- }
- }
- }
- })
- }
- }
- }
- })
- window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
- }
- },
- handleClose(tag) {
- if (this.routeTags.length > 1) {
- this.routeTags.splice(this.routeTags.indexOf(tag), 1)
- window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
- }
- },
- handleShowPage(tag) {
- this.$router.push({ path: tag.index})
- }
- }
- }
- </script>
- <style lang="less">
- .homePage{
- display: flex;
- .leftMenu{
- width: 70px;
- .logoSty{
- padding: 10px 0 0 10px;
- img{
- width: 35px;
- height: 35px;
- }
- }
- .firstLevel{
- margin-top: 30px;
- .firstLevel_icon{
- margin-bottom: 30px;
- cursor: pointer;
- .firstLevel_img{
- width: 35px;
- height: 37px;
- text-align: center;
- border-radius: 5px;
- position: relative;
- left: 10px;
- img{
- position: relative;
- top: 6px;
- width: 20px;
- height: 20px;
- }
- &:hover{
- background: rgba(255,255,255,.2);
- }
- }
- .changeBacksty{
- background: rgba(255,255,255,.2);
- }
- .defaultBacksty{
- background: rgba(255,255,255,0);
- }
- .firstLevel_title{
- margin-left: 5px;
- span{
- font-size: 12px;
- color: #fff;
- }
- }
- }
- }
- }
- .frameMain{
- // background: #f3f7f8;
- border-radius: 30px;
- display: flex;
- .menuList{
- width: 13vw;
- height: 100vh;
- background-color: #184FB4;
- .el-menu{
- .el-sub-menu{
- .el-menu--inline{
- .el-menu-item{
- height: 30px;
- margin-bottom: 10px;
- border-radius: 15px 0 0 15px;
- width: 90%;
- position: relative;
- left: 12%;
- padding-left: 15px;
- }
- .el-menu-item:hover, .el-menu-item.is-active{
- background-color: #fff;
- border-radius: 15px 0 0 15px;
- color: #2778FF;
- width: 90%;
- position: relative;
- left: 12%;
- padding-left: 15px;
- }
- .el-sub-menu__title:hover{
- background-color: #1063CB !important;
- }
- }
- }
- }
- }
- .homeMain{
- width: 86vw;
- .homeMain_tag{
- height:60px;
- border-bottom: 1px solid #D6DBEA;
- display: flex;
- .tagArr{
- height: 33px;
- margin-left: 10px;
- cursor: pointer;
- position: relative;
- top: 28px;
- }
- .el-tag--dark{
- background-color: #184FB4;
- border: 1px solid #184FB4;
- }
- .el-tag--info{
- background-color: #E6EBF5;
- border: 1px solid #E6EBF5;
- color: #9DA5BE;
- .el-tag__close{
- color: #9DA5BE;
- }
- }
- .settingMsg{
- width: 10%;
- padding-top:20px;
- span{
- // width: 80%;
- // display: inline-block;
- position: relative;
- top: -5px;
- font-size: 18px;
- font-family: '微软雅黑';
- font-weight: bold;
- color: #171e28;
- }
- img{
- position: relative;
- left: 10px;
- cursor:pointer
- }
- }
- }
- .mainMessage{
- width: 100%;
- height: 91vh;
- // padding: 0 10px;
- // background: #fff;
- border-radius: 20px;
- }
- }
- }
- }
- </style>
|