homePage.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <div class="homePage">
  3. <!-- <div class="leftMenu">
  4. <div class="logoSty">
  5. <img src="../assets/logoG.png" alt="">
  6. </div>
  7. <div class="firstLevel">
  8. <div class="firstLevel_icon" v-for="item in leftLevelData" :key="item.index" @click="changeRoute(item)">
  9. <div class="firstLevel_img" :class="getBac(item.showBac)">
  10. <img :src="item.image">
  11. </div>
  12. <div class="firstLevel_title">
  13. <span>{{item.name}}</span>
  14. </div>
  15. </div>
  16. </div>
  17. </div> -->
  18. <div class="frameMain" :style="allHeight">
  19. <div class="treeList">
  20. <p>全业务域对标考评系统</p>
  21. <el-tree ref="tree" :data="forecastDatas" :props="defaultProps" highlight-current node-key="id"
  22. :default-expanded-keys="expendData" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
  23. <template #default="{ node, data }">
  24. <span class="custom-tree-node">
  25. <el-icon size="small" v-if="node.level === 1 && data.id !== '0'"><FolderOpened /></el-icon>
  26. <span v-if="data.id === '0'" style="margin-left:17px;font-size:14px;line-height:35px;display:inline-block">{{node.label}}</span>
  27. <span v-else style="margin-left:5px;font-size:14px;line-height:35px;display:inline-block">{{node.label}}</span>
  28. </span>
  29. </template>
  30. </el-tree>
  31. </div>
  32. <div class="homeMain" :style="mainHeight">
  33. <div style="height:40px">
  34. <el-tag
  35. v-for="tag in routeTags"
  36. :key="tag.name"
  37. closable
  38. size="large"
  39. class="tagArr"
  40. effect="dark"
  41. :type="tag.type"
  42. @close="handleClose(tag)"
  43. @click="handleShowPage(tag)"
  44. >
  45. <span>{{ tag.name }}</span>
  46. </el-tag>
  47. </div>
  48. <div class="mainMessage">
  49. <router-view></router-view>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import Assessment from "../assets/indexIcon/Assessment.png"
  57. export default {
  58. data() {
  59. return {
  60. leftLevelData: [],
  61. forecastDatas: [],
  62. expendData: ['0'],
  63. routeTags: [],
  64. defaultProps: {
  65. children: 'children',
  66. label: 'label',
  67. }
  68. }
  69. },
  70. created(){
  71. this.leftLevelData = [
  72. // {
  73. // index: '/index',
  74. // name: '系统门户',
  75. // image: gateway,
  76. // showBac: true
  77. // },
  78. // {
  79. // index: '/benchmark',
  80. // name: '对标业务',
  81. // image: benchmarking
  82. // },
  83. {
  84. index: '/assessment',
  85. name: '考评业务',
  86. image: Assessment
  87. },
  88. // {
  89. // index: '/configure',
  90. // name: '系统配置',
  91. // image: configure
  92. // }
  93. ]
  94. this.forecastDatas = [
  95. // {
  96. // id: '0',
  97. // label: '系统首页',
  98. // path: '/home'
  99. // },
  100. {
  101. id: '1',
  102. label: '对标业务',
  103. children: [
  104. {
  105. id: '1-1',
  106. label: '排行榜',
  107. },
  108. {
  109. id: '1-2',
  110. label: '分类对标',
  111. },
  112. {
  113. id: '1-3',
  114. label: '综合对标',
  115. },
  116. {
  117. id: '1-4',
  118. label: '立标管理',
  119. },
  120. {
  121. id: '1-5',
  122. label: '寻标管理',
  123. },
  124. {
  125. id: '1-6',
  126. label: '达标管理',
  127. },
  128. {
  129. id: '1-7',
  130. label: '超标管理',
  131. },
  132. {
  133. id: '1-8',
  134. label: '对标报告'
  135. }
  136. ]
  137. },
  138. {
  139. id: '2',
  140. label: '考评业务',
  141. children: [
  142. {
  143. id: '2-1',
  144. label: '考评总览'
  145. },
  146. {
  147. id: '2-2',
  148. label: '考评启动',
  149. path: '/assessment/evaluationStart'
  150. },
  151. {
  152. id: '2-3',
  153. label: '考评修订'
  154. },
  155. {
  156. id: '2-4',
  157. label: '考评目标分解'
  158. },
  159. {
  160. id: '2-5',
  161. label: '月/季度考评'
  162. },
  163. {
  164. id: '2-6',
  165. label: '考评项对标'
  166. },
  167. {
  168. id: '2-7',
  169. label: '考评项预警'
  170. },
  171. {
  172. id: '2-8',
  173. label: '年度考评'
  174. },
  175. {
  176. id: '2-9',
  177. label: '人员考评'
  178. },
  179. {
  180. id: '2-10',
  181. label: '任期考评'
  182. },
  183. {
  184. id: '2-11',
  185. label: '考评监督'
  186. },
  187. {
  188. id: '2-12',
  189. label: '考评评级'
  190. },
  191. {
  192. id: '2-13',
  193. label: '考评报告'
  194. },
  195. {
  196. id: '2-14',
  197. label: '考评公告'
  198. },
  199. {
  200. id: '2-15',
  201. label: '奖金及薪资总额调整'
  202. },
  203. ]
  204. },
  205. {
  206. id: '3',
  207. label: '对标考评知识库',
  208. children: [
  209. {
  210. id: '3-1',
  211. label: '对标指标标准',
  212. },
  213. {
  214. id: '3-2',
  215. label: '对标算法规则',
  216. },
  217. {
  218. id: '3-3',
  219. label: '对标预警规则',
  220. },
  221. {
  222. id: '3-4',
  223. label: '考评得分规则',
  224. path: '/knowledgePage/scoringRules'
  225. },
  226. {
  227. id: '3-5',
  228. label: '考评评级规则',
  229. },
  230. {
  231. id: '3-6',
  232. label: '考评预警规则',
  233. },
  234. ]
  235. },
  236. {
  237. id: '4',
  238. label: '对标体系配置',
  239. children: [
  240. {
  241. id: '4-1',
  242. label: '对标指标管理',
  243. },
  244. {
  245. id: '4-2',
  246. label: '指标规则配置',
  247. },
  248. {
  249. id: '4-3',
  250. label: '对标结构配置',
  251. },
  252. ]
  253. },
  254. {
  255. id: '5',
  256. label: '考评体系配置',
  257. children: [
  258. {
  259. id: '5-1',
  260. label: '考评指标管理',
  261. path: '/evaluationSystem/evaluationIndex'
  262. },
  263. {
  264. id: '5-2',
  265. label: '考评规则配置',
  266. path: '/evaluationSystem/evaluationRules'
  267. },
  268. {
  269. id: '5-3',
  270. label: '考评单位配置',
  271. path: '/evaluationSystem/company'
  272. },
  273. {
  274. id: '5-4',
  275. label: '考评部门配置',
  276. path: '/evaluationSystem/department'
  277. },
  278. {
  279. id: '5-5',
  280. label: '考评人员配置',
  281. path: '/evaluationSystem/personnel'
  282. },
  283. ]
  284. },
  285. {
  286. id: '6',
  287. label: '基础信息配置',
  288. children: [
  289. {
  290. id: '6-1',
  291. label: '人员权限配置',
  292. },
  293. {
  294. id: '6-2',
  295. label: '工作流程配置',
  296. }
  297. ]
  298. }
  299. ]
  300. if (window.localStorage.getItem('routeTags')) {
  301. this.routeTags = JSON.parse(window.localStorage.getItem('routeTags'))
  302. if (this.$route?.path === '/') {
  303. this.$router.push({ path: this.routeTags[0].path})
  304. }
  305. // this.$nextTick(() =>{
  306. // if (this.$refs.tree) {
  307. // this.$refs.tree.setCurrentKey(this.routeTags[0].id)
  308. // this.expendData = [this.routeTags[0].id]
  309. // }
  310. // })
  311. } else {
  312. this.routeTags = [
  313. {
  314. id: '5-1',
  315. label: '考评指标管理',
  316. path: '/evaluationSystem/evaluationIndex'
  317. }
  318. ]
  319. window.localStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  320. }
  321. },
  322. mounted() {
  323. this.$nextTick(() => {
  324. if (this.$route?.path) {
  325. let path = this.$route.path
  326. this.expendData = []
  327. for(let i =0; i<this.forecastDatas.length; i++) {
  328. let item = this.forecastDatas[i]
  329. if (item.id !== '0') {
  330. for(let j =0; j<item.children.length; j++) {
  331. let it = item.children[j]
  332. if (it.path === path) {
  333. if (this.$refs.tree) {
  334. this.$refs.tree.setCurrentKey(it.id)
  335. this.expendData = [item.id]
  336. }
  337. }
  338. }
  339. } else {
  340. if (this.$refs.tree) {
  341. this.$refs.tree.setCurrentKey(item.id)
  342. this.expendData = [item.id]
  343. }
  344. }
  345. }
  346. }
  347. })
  348. },
  349. computed:{
  350. mainHeight() {
  351. return {
  352. // 'height': document.documentElement.clientHeight-50 + 'px'
  353. 'width': '84%',
  354. 'height': '95vh'
  355. }
  356. },
  357. allHeight() {
  358. return {
  359. 'width': '100%',
  360. // 'height': document.documentElement.clientHeight-40 + 'px'
  361. 'height': '96vh'
  362. }
  363. },
  364. },
  365. methods:{
  366. getBac(val) {
  367. let strWea = ''
  368. debugger
  369. if (val) {
  370. strWea = 'changeBacksty'
  371. } else {
  372. strWea = 'defaultBacksty'
  373. }
  374. return strWea
  375. },
  376. changeRoute(item) {
  377. if (item.index) {
  378. this.$router.push({ path: item.index})
  379. }
  380. },
  381. handleNodeClick(val) {
  382. if (val.path) {
  383. this.$router.push({ path: val.path})
  384. let showM = 0
  385. this.routeTags.forEach(item =>{
  386. if (item.name === val.label) {
  387. showM++
  388. }
  389. })
  390. if (showM === 0) {
  391. this.routeTags.push({
  392. id: val.id,
  393. name: val.label,
  394. path: val.path
  395. })
  396. }
  397. window.localStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  398. }
  399. if (val.id === '0') {
  400. let node = this.$refs.tree.getNode(val)
  401. this.handleNodeExpand(val, node)
  402. }
  403. },
  404. handleNodeExpand(data, node) {
  405. node.parent.childNodes.forEach(item =>{
  406. if (data.id !== item.data.id) {
  407. item.expanded = false
  408. }
  409. })
  410. },
  411. handleClose(tag) {
  412. if (this.routeTags.length > 1) {
  413. this.routeTags.splice(this.routeTags.indexOf(tag), 1)
  414. window.localStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  415. }
  416. },
  417. handleShowPage(tag) {
  418. this.$router.push({ path: tag.path})
  419. let node = this.$refs.tree.getNode(tag)
  420. this.handleNodeExpand(tag, tag.id === '0'?node:node.parent)
  421. this.$refs.tree.setCurrentKey(tag.id)
  422. this.expendData = [tag.id]
  423. }
  424. }
  425. }
  426. </script>
  427. <style lang="less">
  428. .homePage{
  429. display: flex;
  430. padding: 10px 10px;
  431. .leftMenu{
  432. width: 70px;
  433. .logoSty{
  434. padding: 10px 0 0 10px;
  435. img{
  436. width: 35px;
  437. height: 35px;
  438. }
  439. }
  440. .firstLevel{
  441. margin-top: 30px;
  442. .firstLevel_icon{
  443. margin-bottom: 30px;
  444. cursor: pointer;
  445. .firstLevel_img{
  446. width: 35px;
  447. height: 37px;
  448. text-align: center;
  449. border-radius: 5px;
  450. position: relative;
  451. left: 10px;
  452. img{
  453. position: relative;
  454. top: 6px;
  455. width: 20px;
  456. height: 20px;
  457. }
  458. &:hover{
  459. background: rgba(255,255,255,.2);
  460. }
  461. }
  462. .changeBacksty{
  463. background: rgba(255,255,255,.2);
  464. }
  465. .defaultBacksty{
  466. background: rgba(255,255,255,0);
  467. }
  468. .firstLevel_title{
  469. margin-left: 5px;
  470. span{
  471. font-size: 12px;
  472. color: #fff;
  473. }
  474. }
  475. }
  476. }
  477. }
  478. .frameMain{
  479. background: #f3f7f8;
  480. border-radius: 30px;
  481. padding: 10px 0;
  482. display: flex;
  483. .treeList{
  484. margin-left: 5px;
  485. width: 15%;
  486. // background: #fff;
  487. border-radius: 20px;
  488. p{
  489. font-size: 18px;
  490. font-family: '微软雅黑';
  491. font-weight: bold;
  492. color: #171e28;
  493. position: relative;
  494. left: 30px;
  495. top: 5px;
  496. letter-spacing: 1px;
  497. }
  498. .el-tree{
  499. position: relative;
  500. top: 30px;
  501. padding: 0 0 0 20px;
  502. background: transparent;
  503. .el-tree-node{
  504. .el-tree-node__content{
  505. height: 35px;
  506. .custom-tree-node{
  507. height: 35px;
  508. }
  509. }
  510. .el-tree-node__children{
  511. .el-tree-node__content{
  512. height: 35px;
  513. .custom-tree-node{
  514. height: 35px;
  515. }
  516. }
  517. }
  518. }
  519. }
  520. .el-tree--highlight-current
  521. .el-tree-node.is-current
  522. > .el-tree-node__content {
  523. background-color: rgba(135, 206, 235, 0.2);
  524. color: #007aab;
  525. font-weight: bold;
  526. border-radius: 5px;
  527. }
  528. }
  529. .homeMain{
  530. .tagArr{
  531. height: 25px;
  532. margin-right: 10px;
  533. cursor: pointer;
  534. }
  535. .mainMessage{
  536. width: 100%;
  537. padding-top: 10px;
  538. background: #fff;
  539. border-radius: 20px;
  540. }
  541. }
  542. }
  543. }
  544. </style>