homePage.vue 24 KB

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