homePage.vue 23 KB

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