homePage.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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,apiGetUserPostList,
  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. // {
  179. // index: '/assessment/assessmentApplication',
  180. // name: '月度绩效考核结果申报'
  181. // },
  182. // {
  183. // index: '/assessment/evaluationDeptRating',
  184. // name: '月度绩效考核结果查询'
  185. // },
  186. // {
  187. // index: '/assessment/evaluationDeptStart',
  188. // name: '年度业绩指标计划申报',
  189. // },
  190. // {
  191. // index: '/assessment/evaluationDeptBusiness',
  192. // name: '年度业绩指标完成情况'
  193. // },
  194. // ]
  195. // },
  196. // {
  197. // index: '5',
  198. // name: '基础信息配置',
  199. // img: quanxianImg,
  200. // children: [{
  201. // index: '/baseInfomation/baseDataDictionary',
  202. // name: '数据字典配置',
  203. // },{
  204. // index: '/baseInfomation/baseBinSection',
  205. // name: '业务属性配置',
  206. // },
  207. // {
  208. // index: '/baseInfomation/baseBinStage',
  209. // name: '业务阶段配置',
  210. // },
  211. // {
  212. // index: '/baseInfomation/baseIndicatorType',
  213. // name: '指标分类配置',
  214. // },
  215. // {
  216. // index: '',
  217. // href: '',
  218. // name: '人员权限配置',
  219. // },
  220. // {
  221. // index: '',
  222. // name: '工作流程配置',
  223. // }
  224. // ]
  225. // },
  226. // {
  227. // index: '6',
  228. // name: '对标考评规则',
  229. // img: zhishikuImg,
  230. // children: [{
  231. // index: '/evaluationknowledge/scoringRules',
  232. // name: '考评得分规则',
  233. // },
  234. // {
  235. // index: '/evaluationknowledge/evalRatingRules',
  236. // name: '考评评级规则',
  237. // },
  238. // {
  239. // index: '/evaluationknowledge/earlyWarningRule',
  240. // name: '考评预警规则',
  241. // }
  242. // ]
  243. // },
  244. // ]
  245. if (window.sessionStorage.getItem('routeTags')) {
  246. this.routeTags = JSON.parse(window.sessionStorage.getItem('routeTags'))
  247. if (this.$route?.path === '/') {
  248. this.$router.push({
  249. path: this.routeTags[0].index
  250. })
  251. }
  252. } else {
  253. this.routeTags = [{
  254. index: '/home',
  255. name: '考评首页'
  256. }]
  257. this.$router.push({
  258. path: this.routeTags[0].index
  259. })
  260. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  261. }
  262. if (window.sessionStorage.getItem('user')) {
  263. let obj = JSON.parse(window.sessionStorage.getItem('user'))
  264. this.userName = obj.name
  265. this.getPersonMsg(obj.id)
  266. }
  267. },
  268. mounted() {
  269. },
  270. computed: {
  271. mainHeight() {
  272. return {
  273. // 'height': document.documentElement.clientHeight-50 + 'px'
  274. 'height': '100vh'
  275. }
  276. },
  277. allHeight() {
  278. return {
  279. 'width': '100%',
  280. // 'height': document.documentElement.clientHeight-40 + 'px'
  281. 'height': '100vh'
  282. }
  283. },
  284. viewHeight() {
  285. return {
  286. 'width': '100%',
  287. // 'height': document.documentElement.clientHeight-40 + 'px'
  288. 'height': '91vh'
  289. }
  290. }
  291. },
  292. methods: {
  293. // 获取菜单数据
  294. getMenuData() {
  295. let that = this
  296. that.isSinglePoint = window.localStorage.getItem('singlePoint') === 'singlePoint' ? false : true
  297. apiGetMenuData().then(datas => {
  298. if (datas && datas.data) {
  299. let arrDef = [{
  300. index: '/home',
  301. name: '考评首页',
  302. img: homeImg
  303. },
  304. {
  305. index: '/taskCenter',
  306. name: '任务中心',
  307. img: taskImg
  308. }
  309. ]
  310. let arr = []
  311. for (let i = 0; i < datas.data.length; i++) {
  312. let item = datas.data[i]
  313. let obj = {
  314. index: item.href,
  315. name: item.name
  316. }
  317. // if (item.name === '考评首页') {
  318. // obj.img = homeImg
  319. // } else if (item.name === '任务中心') {
  320. // obj.img = taskImg
  321. // } else
  322. if (item.name === '通告管理') {
  323. obj.img = tonggaoImg
  324. } else if (item.name === '考评体系配置') {
  325. obj.img = tixiImg
  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 = benbuImg
  332. obj.children = that.changeMenuData(item.children)
  333. } else if (item.name === '本部人员考评') {
  334. obj.img = renyuanImg
  335. obj.children = that.changeMenuData(item.children)
  336. } else if (item.name === '基础信息配置') {
  337. obj.img = quanxianImg
  338. obj.children = that.changeMenuData(item.children)
  339. } else if (item.name === '对标考评规则') {
  340. obj.img = zhishikuImg
  341. obj.children = that.changeMenuData(item.children)
  342. }
  343. arr.push(obj)
  344. }
  345. that.forecastDatas = arrDef.concat(arr)
  346. }
  347. })
  348. },
  349. // 获取人员岗位信息
  350. getPersonMsg(id) {
  351. window.sessionStorage.setItem('ispersonDept', false)
  352. let params = {
  353. userId: id,
  354. current: 1,
  355. size: 10
  356. }
  357. apiGetUserPostList(params).then(datas =>{
  358. if (datas.data && datas.data.records.length>0) {
  359. datas.data.records.forEach(it =>{
  360. if (it.posName.indexOf('组织人事部') !== -1 || it.deptName.indexOf('组织人事部') !== -1) {
  361. window.sessionStorage.setItem('ispersonDept', true)
  362. }
  363. })
  364. }
  365. })
  366. },
  367. changeMenuData(data) {
  368. let childArr = []
  369. data.forEach(item => {
  370. let obj = {
  371. index: item.href,
  372. name: item.name
  373. }
  374. childArr.push(obj)
  375. })
  376. return childArr
  377. },
  378. getBac(val) {
  379. let strWea = ''
  380. debugger
  381. if (val) {
  382. strWea = 'changeBacksty'
  383. } else {
  384. strWea = 'defaultBacksty'
  385. }
  386. return strWea
  387. },
  388. changeRoute(item) {
  389. if (item.index) {
  390. this.$router.push({
  391. path: item.index
  392. })
  393. }
  394. },
  395. closeSys() {
  396. let that = this
  397. apiPostremoveByToken(window.localStorage.getItem('token')).then(datas => {
  398. if (datas.code === 200) {
  399. // removeToken('token')
  400. // removeToken('code')
  401. // removeToken('purview')
  402. window.localStorage.removeItem('code')
  403. window.localStorage.removeItem('purview')
  404. window.localStorage.removeItem('token')
  405. window.sessionStorage.clear()
  406. that.$router.push({
  407. path: "/login"
  408. })
  409. }
  410. })
  411. },
  412. handleNodeClick(index, indexPath) {
  413. if (indexPath) {
  414. this.forecastDatas.forEach(it => {
  415. if (it.index !== '') {
  416. if (it.index === indexPath[0]) {
  417. if (!it.children) {
  418. let showM = 0
  419. this.routeTags.forEach(item => {
  420. if (item.name === it.name) {
  421. showM++
  422. }
  423. })
  424. if (showM === 0) {
  425. let obj = {
  426. index: it.index,
  427. name: it.name
  428. }
  429. this.routeTags.push(obj)
  430. }
  431. } else {
  432. it.children.forEach(iv => {
  433. if (iv.index !== '') {
  434. if (iv.index === indexPath[1]) {
  435. let showM = 0
  436. this.routeTags.forEach(item => {
  437. if (item.name === iv.name) {
  438. showM++
  439. }
  440. })
  441. if (showM === 0) {
  442. this.routeTags.push(iv)
  443. }
  444. }
  445. }
  446. })
  447. }
  448. }
  449. }
  450. })
  451. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  452. }
  453. },
  454. handleClose(tag) {
  455. if (this.routeTags.length > 1) {
  456. this.routeTags.splice(this.routeTags.indexOf(tag), 1)
  457. this.$router.push({
  458. path: this.routeTags[this.routeTags.length - 1].index
  459. })
  460. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  461. }
  462. },
  463. handleShowPage(tag) {
  464. this.$router.push({
  465. path: tag.index
  466. })
  467. }
  468. }
  469. }
  470. </script>
  471. <style lang="less">
  472. .homePage {
  473. display: flex;
  474. .leftMenu {
  475. width: 70px;
  476. .logoSty {
  477. padding: 10px 0 0 10px;
  478. img {
  479. width: 35px;
  480. height: 35px;
  481. }
  482. }
  483. .firstLevel {
  484. margin-top: 30px;
  485. .firstLevel_icon {
  486. margin-bottom: 30px;
  487. cursor: pointer;
  488. .firstLevel_img {
  489. width: 35px;
  490. height: 37px;
  491. text-align: center;
  492. border-radius: 5px;
  493. position: relative;
  494. left: 10px;
  495. img {
  496. position: relative;
  497. top: 6px;
  498. width: 20px;
  499. height: 20px;
  500. }
  501. &:hover {
  502. background: rgba(255, 255, 255, .2);
  503. }
  504. }
  505. .changeBacksty {
  506. background: rgba(255, 255, 255, .2);
  507. }
  508. .defaultBacksty {
  509. background: rgba(255, 255, 255, 0);
  510. }
  511. .firstLevel_title {
  512. margin-left: 5px;
  513. span {
  514. font-size: 12px;
  515. color: #fff;
  516. }
  517. }
  518. }
  519. }
  520. }
  521. .frameMain {
  522. // background: #f3f7f8;
  523. border-radius: 30px;
  524. display: flex;
  525. .menuList {
  526. width: 13vw;
  527. height: 100vh;
  528. background-color: #184FB4;
  529. .el-menu {
  530. .el-sub-menu {
  531. .el-menu--inline {
  532. .el-menu-item {
  533. height: 30px;
  534. margin-bottom: 10px;
  535. border-radius: 15px 0 0 15px;
  536. width: 90%;
  537. position: relative;
  538. left: 12%;
  539. padding-left: 15px;
  540. }
  541. .el-menu-item:hover,
  542. .el-menu-item.is-active {
  543. background-color: #fff;
  544. border-radius: 15px 0 0 15px;
  545. color: #2778FF;
  546. width: 90%;
  547. position: relative;
  548. left: 12%;
  549. padding-left: 15px;
  550. }
  551. .el-sub-menu__title:hover {
  552. background-color: #1063CB !important;
  553. }
  554. }
  555. }
  556. }
  557. }
  558. .homeMain {
  559. width: 86vw;
  560. .homeMain_tag {
  561. height: 60px;
  562. border-bottom: 1px solid #D6DBEA;
  563. display: flex;
  564. .tagArr {
  565. height: 33px;
  566. margin-left: 10px;
  567. cursor: pointer;
  568. position: relative;
  569. top: 28px;
  570. }
  571. .el-tag--dark {
  572. background-color: #184FB4;
  573. border: 1px solid #184FB4;
  574. }
  575. .el-tag--info {
  576. background-color: #E6EBF5;
  577. border: 1px solid #E6EBF5;
  578. color: #9DA5BE;
  579. .el-tag__close {
  580. color: #9DA5BE;
  581. }
  582. }
  583. .settingMsg {
  584. width: 10%;
  585. padding-top: 20px;
  586. span {
  587. // width: 80%;
  588. // display: inline-block;
  589. position: relative;
  590. top: -5px;
  591. font-size: 18px;
  592. font-family: '微软雅黑';
  593. font-weight: bold;
  594. color: #171e28;
  595. }
  596. img {
  597. position: relative;
  598. left: 10px;
  599. cursor: pointer
  600. }
  601. }
  602. }
  603. .mainMessage {
  604. width: 100%;
  605. height: 91vh;
  606. // padding: 0 10px;
  607. // background: #fff;
  608. border-radius: 20px;
  609. }
  610. }
  611. }
  612. }
  613. </style>