homePage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <template>
  2. <div class="homePage">
  3. <div class="frameMain" :style="allHeight">
  4. <div class="menuList">
  5. <el-menu
  6. :default-active="$route.path"
  7. router
  8. :unique-opened="true"
  9. :default-openeds="openeds"
  10. @select="handleNodeClick"
  11. text-color="#fff"
  12. background-color="#184FB4"
  13. active-text-color="#fff">
  14. <!-- 引入组件 -->
  15. <menu-tree :menuData="forecastDatas"></menu-tree>
  16. </el-menu>
  17. </div>
  18. <div class="homeMain" :style="mainHeight">
  19. <div class="homeMain_tag">
  20. <div style="width: 90%;overflow: hidden;">
  21. <el-tag
  22. v-for="tag in routeTags"
  23. :key="tag.index"
  24. closable
  25. size="large"
  26. class="tagArr"
  27. effect="dark"
  28. :type="tag.index === $route.path ? '': 'info'"
  29. @close="handleClose(tag)"
  30. @click="handleShowPage(tag)"
  31. >
  32. <span>{{ tag.name }}</span>
  33. </el-tag>
  34. </div>
  35. <div class="settingMsg">
  36. <span>{{userName}}</span>
  37. <img :src="closeBtn" @click="closeSys" >
  38. </div>
  39. </div>
  40. <div class="mainMessage" :style="$route.path === '/home' ? '': 'padding: 0 10px;'">
  41. <router-view></router-view>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import MenuTree from '../components/menuTreeconfig.vue'
  49. import homeImg from '../assets/menuImg/home.png'
  50. import taskImg from '../assets/menuImg/task.png'
  51. import yewuImg from '../assets/menuImg/yewu.png'
  52. import tixiImg from '../assets/menuImg/tixi.png'
  53. import zhishikuImg from '../assets/menuImg/zhishiku.png'
  54. import quanxianImg from '../assets/menuImg/quanxian.png'
  55. import closeBtn from '../assets/getwayImg/closeBtn.png'
  56. import { getToken, removeToken } from '../api/auth'
  57. import {apiPostremoveByToken, apiGetMenuData} from '../api/api'
  58. export default {
  59. components: {MenuTree},
  60. // inject: ['reload'],
  61. data() {
  62. return {
  63. forecastDatas: [],
  64. expendData: ['0'],
  65. openeds:[],
  66. routeTags: [],
  67. defaultProps: {
  68. children: 'children',
  69. label: 'label',
  70. },
  71. closeBtn: closeBtn,
  72. userName: ''
  73. }
  74. },
  75. created(){
  76. this.getMenuData()
  77. // this.forecastDatas = [
  78. // {
  79. // index: '/home',
  80. // name: '考评首页',
  81. // img: homeImg
  82. // },
  83. // {
  84. // index: '/taskCenter',
  85. // name: '任务中心',
  86. // img: taskImg
  87. // },
  88. // {
  89. // index: '/notification',
  90. // name: '通告管理',
  91. // img: taskImg
  92. // },
  93. // {
  94. // index: '1',
  95. // name: '考评体系配置',
  96. // img: tixiImg,
  97. // children: [
  98. // {
  99. // index: '/evaluationSystem/evaluationIndex',
  100. // name: '考评指标管理',
  101. // },
  102. // {
  103. // index: '/evaluationSystem/evaluationRules',
  104. // name: '考评规则配置',
  105. // },
  106. // {
  107. // index: '/evaluationSystem/company',
  108. // name: '单位权重配置',
  109. // },
  110. // {
  111. // index: '',
  112. // name: '单位季度营业收入',
  113. // },
  114. // {
  115. // index: '/evaluationSystem/achievementK',
  116. // name: '业绩考核系数配置',
  117. // },
  118. // {
  119. // index: '/evaluationSystem/partyBuildingK',
  120. // name: '党建考核系数配置',
  121. // },
  122. // {
  123. // index: '/evaluationSystem/department',
  124. // name: '部门考评配置',
  125. // },
  126. // {
  127. // index: '/evaluationSystem/personnel',
  128. // name: '人员考评配置',
  129. // },
  130. // ]
  131. // },
  132. // {
  133. // index: '2',
  134. // name: '单位考评业务',
  135. // img: yewuImg,
  136. // children: [
  137. // {
  138. // index: '/assessment/evaluationStart',
  139. // name: '单位考评目标启动',
  140. // },
  141. // {
  142. // index: '/assessment/evaluationAmendment',
  143. // name: '单位考评目标修订',
  144. // },
  145. // {
  146. // index: '/assessment/evaluationMonth',
  147. // name: '单位月度考评'
  148. // },
  149. // {
  150. // index: '/assessment/evaluationQuarter',
  151. // name: '单位季度考评'
  152. // },
  153. // {
  154. // index: '/assessment/evaluationYear',
  155. // name: '单位年度考评'
  156. // },
  157. // {
  158. // index: '/assessment/evaluationBenchmarkingIndic',
  159. // name: '考评对标分析'
  160. // },
  161. // {
  162. // index: '',
  163. // name: '考评预警'
  164. // },
  165. // {
  166. // index: '',
  167. // name: '单位考评评级'
  168. // },
  169. // {
  170. // index: '',
  171. // name: '考评监督管理'
  172. // },
  173. // {
  174. // index: '/assessment/evaluationReport',
  175. // name: '考评报告'
  176. // },
  177. // {
  178. // index: '',
  179. // name: '单位考核结果应用'
  180. // }
  181. // ]
  182. // },
  183. // {
  184. // index: '3',
  185. // name: '本部考评业务',
  186. // img: yewuImg,
  187. // children: [
  188. // {
  189. // index: '/assessment/evaluationDeptStart',
  190. // name: '业绩指标计划',
  191. // },
  192. // {
  193. // index: '/assessment/evaluationDeptBusiness',
  194. // name: '业绩指标考评'
  195. // },
  196. // {
  197. // index: '/assessment/evaluationDeptRating',
  198. // name: '部门考评评级'
  199. // },
  200. // {
  201. // index: '',
  202. // name: '绩效结果考核申报'
  203. // }
  204. // ]
  205. // },
  206. // {
  207. // index: '4',
  208. // name: '本部人员考评',
  209. // img: yewuImg,
  210. // children: [
  211. // {
  212. // index: '',
  213. // name: '人员考评结果',
  214. // },
  215. // {
  216. // index: '',
  217. // name: '任期考评结果'
  218. // },
  219. // {
  220. // index: '',
  221. // name: '人员考评评级'
  222. // }
  223. // ]
  224. // },
  225. // {
  226. // index: '5',
  227. // name: '基础信息配置',
  228. // img: quanxianImg,
  229. // children: [
  230. // {
  231. // index: '',
  232. // name: '人员权限配置',
  233. // },
  234. // {
  235. // index: '',
  236. // name: '工作流程配置',
  237. // }
  238. // ]
  239. // },
  240. // {
  241. // index: '6',
  242. // name: '对标考评知识库',
  243. // img: zhishikuImg,
  244. // children: [
  245. // {
  246. // index: '/evaluationknowledge/scoringRules',
  247. // name: '考评得分规则',
  248. // },
  249. // {
  250. // name: '考评评级规则',
  251. // },
  252. // {
  253. // name: '考评预警规则',
  254. // }
  255. // ]
  256. // },
  257. // ]
  258. if (window.sessionStorage.getItem('routeTags')) {
  259. this.routeTags = JSON.parse(window.sessionStorage.getItem('routeTags'))
  260. if (this.$route?.path === '/') {
  261. this.$router.push({ path: this.routeTags[0].index})
  262. }
  263. } else {
  264. this.routeTags = [
  265. {
  266. index: '/home',
  267. name: '考评首页'
  268. }
  269. ]
  270. this.$router.push({ path: this.routeTags[0].index})
  271. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  272. }
  273. if (window.sessionStorage.getItem('user')) {
  274. let obj = JSON.parse(window.sessionStorage.getItem('user'))
  275. this.userName = obj.name
  276. }
  277. },
  278. mounted() {
  279. },
  280. computed:{
  281. mainHeight() {
  282. return {
  283. // 'height': document.documentElement.clientHeight-50 + 'px'
  284. 'height': '100vh'
  285. }
  286. },
  287. allHeight() {
  288. return {
  289. 'width': '100%',
  290. // 'height': document.documentElement.clientHeight-40 + 'px'
  291. 'height': '100vh'
  292. }
  293. },
  294. viewHeight() {
  295. return {
  296. 'width': '100%',
  297. // 'height': document.documentElement.clientHeight-40 + 'px'
  298. 'height': '91vh'
  299. }
  300. }
  301. },
  302. methods:{
  303. // 获取菜单数据
  304. getMenuData() {
  305. let that = this
  306. apiGetMenuData().then(datas =>{
  307. if (datas && datas.data) {
  308. let arr = []
  309. for(let i =0; i<datas.data.length; i++) {
  310. let item = datas.data[i]
  311. let obj = {
  312. index: item.href,
  313. name: item.name
  314. }
  315. if (item.name === '考评首页') {
  316. obj.img = homeImg
  317. } else if(item.name === '任务中心') {
  318. obj.img = taskImg
  319. } else if(item.name === '通告管理') {
  320. obj.img = taskImg
  321. } else if(item.name === '考评体系配置') {
  322. obj.img = tixiImg
  323. obj.children = that.changeMenuData(item.children)
  324. } else if(item.name === '单位考评业务') {
  325. obj.img = yewuImg
  326. obj.children = that.changeMenuData(item.children)
  327. } else if(item.name === '本部考评业务') {
  328. obj.img = yewuImg
  329. obj.children = that.changeMenuData(item.children)
  330. } else if(item.name === '本部人员考评') {
  331. obj.img = yewuImg
  332. obj.children = that.changeMenuData(item.children)
  333. } else if(item.name === '基础信息配置') {
  334. obj.img = quanxianImg
  335. obj.children = that.changeMenuData(item.children)
  336. } else if(item.name === '对标考评知识库') {
  337. obj.img = zhishikuImg
  338. obj.children = that.changeMenuData(item.children)
  339. }
  340. arr.push(obj)
  341. }
  342. that.forecastDatas = arr
  343. }
  344. })
  345. },
  346. changeMenuData(data) {
  347. let childArr = []
  348. data.forEach(item =>{
  349. let obj = {
  350. index: item.href,
  351. name: item.name
  352. }
  353. childArr.push(obj)
  354. })
  355. return childArr
  356. },
  357. getBac(val) {
  358. let strWea = ''
  359. debugger
  360. if (val) {
  361. strWea = 'changeBacksty'
  362. } else {
  363. strWea = 'defaultBacksty'
  364. }
  365. return strWea
  366. },
  367. changeRoute(item) {
  368. if (item.index) {
  369. this.$router.push({ path: item.index})
  370. }
  371. },
  372. closeSys() {
  373. let that = this
  374. apiPostremoveByToken(window.localStorage.getItem('token')).then(datas =>{
  375. if (datas.code === 200) {
  376. // removeToken('token')
  377. // removeToken('code')
  378. // removeToken('purview')
  379. window.localStorage.removeItem('code')
  380. window.localStorage.removeItem('purview')
  381. window.localStorage.removeItem('token')
  382. window.sessionStorage.clear()
  383. that.$router.push({ path: "/login"})
  384. }
  385. })
  386. },
  387. handleNodeClick(index, indexPath) {
  388. if (indexPath) {
  389. this.forecastDatas.forEach(it =>{
  390. if (it.index !== '') {
  391. if (it.index === indexPath[0]) {
  392. if (!it.children) {
  393. let showM = 0
  394. this.routeTags.forEach(item =>{
  395. if (item.name === it.name) {
  396. showM++
  397. }
  398. })
  399. if (showM === 0) {
  400. let obj = {
  401. index: it.index,
  402. name: it.name
  403. }
  404. this.routeTags.push(obj)
  405. }
  406. } else {
  407. it.children.forEach(iv =>{
  408. if (iv.index !== '') {
  409. if (iv.index === indexPath[1]) {
  410. let showM = 0
  411. this.routeTags.forEach(item =>{
  412. if (item.name === iv.name) {
  413. showM++
  414. }
  415. })
  416. if (showM === 0) {
  417. this.routeTags.push(iv)
  418. }
  419. }
  420. }
  421. })
  422. }
  423. }
  424. }
  425. })
  426. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  427. }
  428. },
  429. handleClose(tag) {
  430. if (this.routeTags.length > 1) {
  431. this.routeTags.splice(this.routeTags.indexOf(tag), 1)
  432. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  433. }
  434. },
  435. handleShowPage(tag) {
  436. this.$router.push({ path: tag.index})
  437. }
  438. }
  439. }
  440. </script>
  441. <style lang="less">
  442. .homePage{
  443. display: flex;
  444. .leftMenu{
  445. width: 70px;
  446. .logoSty{
  447. padding: 10px 0 0 10px;
  448. img{
  449. width: 35px;
  450. height: 35px;
  451. }
  452. }
  453. .firstLevel{
  454. margin-top: 30px;
  455. .firstLevel_icon{
  456. margin-bottom: 30px;
  457. cursor: pointer;
  458. .firstLevel_img{
  459. width: 35px;
  460. height: 37px;
  461. text-align: center;
  462. border-radius: 5px;
  463. position: relative;
  464. left: 10px;
  465. img{
  466. position: relative;
  467. top: 6px;
  468. width: 20px;
  469. height: 20px;
  470. }
  471. &:hover{
  472. background: rgba(255,255,255,.2);
  473. }
  474. }
  475. .changeBacksty{
  476. background: rgba(255,255,255,.2);
  477. }
  478. .defaultBacksty{
  479. background: rgba(255,255,255,0);
  480. }
  481. .firstLevel_title{
  482. margin-left: 5px;
  483. span{
  484. font-size: 12px;
  485. color: #fff;
  486. }
  487. }
  488. }
  489. }
  490. }
  491. .frameMain{
  492. // background: #f3f7f8;
  493. border-radius: 30px;
  494. display: flex;
  495. .menuList{
  496. width: 13vw;
  497. height: 100vh;
  498. background-color: #184FB4;
  499. .el-menu{
  500. .el-sub-menu{
  501. .el-menu--inline{
  502. .el-menu-item{
  503. height: 30px;
  504. margin-bottom: 10px;
  505. border-radius: 15px 0 0 15px;
  506. width: 90%;
  507. position: relative;
  508. left: 12%;
  509. padding-left: 15px;
  510. }
  511. .el-menu-item:hover, .el-menu-item.is-active{
  512. background-color: #fff;
  513. border-radius: 15px 0 0 15px;
  514. color: #2778FF;
  515. width: 90%;
  516. position: relative;
  517. left: 12%;
  518. padding-left: 15px;
  519. }
  520. .el-sub-menu__title:hover{
  521. background-color: #1063CB !important;
  522. }
  523. }
  524. }
  525. }
  526. }
  527. .homeMain{
  528. width: 86vw;
  529. .homeMain_tag{
  530. height:60px;
  531. border-bottom: 1px solid #D6DBEA;
  532. display: flex;
  533. .tagArr{
  534. height: 33px;
  535. margin-left: 10px;
  536. cursor: pointer;
  537. position: relative;
  538. top: 28px;
  539. }
  540. .el-tag--dark{
  541. background-color: #184FB4;
  542. border: 1px solid #184FB4;
  543. }
  544. .el-tag--info{
  545. background-color: #E6EBF5;
  546. border: 1px solid #E6EBF5;
  547. color: #9DA5BE;
  548. .el-tag__close{
  549. color: #9DA5BE;
  550. }
  551. }
  552. .settingMsg{
  553. width: 10%;
  554. padding-top:20px;
  555. span{
  556. // width: 80%;
  557. // display: inline-block;
  558. position: relative;
  559. top: -5px;
  560. font-size: 18px;
  561. font-family: '微软雅黑';
  562. font-weight: bold;
  563. color: #171e28;
  564. }
  565. img{
  566. position: relative;
  567. left: 10px;
  568. cursor:pointer
  569. }
  570. }
  571. }
  572. .mainMessage{
  573. width: 100%;
  574. height: 91vh;
  575. // padding: 0 10px;
  576. // background: #fff;
  577. border-radius: 20px;
  578. }
  579. }
  580. }
  581. }
  582. </style>