homePage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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: 95%">
  21. <el-tag
  22. v-for="tag in routeTags"
  23. :key="tag.name"
  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 style="width: 5%;padding-top:20px">
  36. <!-- <el-icon @click="closeSys" :size="20" color="#F65177"><SwitchButton /></el-icon> -->
  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} from '../api/api'
  58. export default {
  59. components: {MenuTree},
  60. data() {
  61. return {
  62. forecastDatas: [],
  63. expendData: ['0'],
  64. openeds:[],
  65. routeTags: [],
  66. defaultProps: {
  67. children: 'children',
  68. label: 'label',
  69. },
  70. closeBtn: closeBtn
  71. }
  72. },
  73. created(){
  74. this.forecastDatas = [
  75. {
  76. index: '/home',
  77. name: '考评首页',
  78. img: homeImg
  79. },
  80. {
  81. index: '/taskCenter',
  82. name: '任务中心',
  83. img: taskImg
  84. },
  85. {
  86. index: '1',
  87. name: '考评业务',
  88. img: yewuImg,
  89. children: [
  90. {
  91. index: '/assessment/evaluationStart',
  92. name: '考评目标启动',
  93. },
  94. {
  95. index: '/assessment/monthQuarter',
  96. name: '月/季度目标考评'
  97. },
  98. {
  99. index: '/assessment/evaluationYear',
  100. name: '年度目标考评'
  101. },
  102. {
  103. index: '',
  104. name: '考评项对标'
  105. },
  106. {
  107. index: '',
  108. name: '考评项预警'
  109. },
  110. {
  111. index: '',
  112. name: '人员考评'
  113. },
  114. {
  115. index: '',
  116. name: '任期考评'
  117. },
  118. {
  119. index: '',
  120. name: '考评监督'
  121. },
  122. {
  123. index: '',
  124. name: '考评评级'
  125. },
  126. {
  127. index: '',
  128. name: '考评报告'
  129. },
  130. {
  131. index: '',
  132. name: '考评公告'
  133. },
  134. {
  135. index: '',
  136. name: '单位考核结果应用'
  137. },
  138. {
  139. index: '',
  140. name: '部门考核结果应用'
  141. }
  142. ]
  143. },
  144. {
  145. index: '2',
  146. name: '考评体系配置',
  147. img: tixiImg,
  148. children: [
  149. {
  150. index: '/evaluationSystem/evaluationIndex',
  151. name: '考评指标管理',
  152. },
  153. {
  154. index: '/evaluationSystem/evaluationRules',
  155. name: '考评规则配置',
  156. },
  157. {
  158. index: '/evaluationSystem/company',
  159. name: '单位权重配置',
  160. },
  161. {
  162. index: '/evaluationSystem/department',
  163. name: '考评部门配置',
  164. },
  165. {
  166. index: '/evaluationSystem/personnel',
  167. name: '考评人员配置',
  168. },
  169. {
  170. index: '/evaluationSystem/achievementK',
  171. name: '业绩考核系数配置',
  172. },
  173. {
  174. index: '',
  175. name: '党建考核系数配置',
  176. },
  177. ]
  178. },
  179. {
  180. index: '3',
  181. name: '考评知识库',
  182. img: zhishikuImg,
  183. children: [
  184. {
  185. index: '/knowledgePage/scoringRules',
  186. name: '考评得分规则',
  187. },
  188. {
  189. name: '考评评级规则',
  190. },
  191. {
  192. name: '考评预警规则',
  193. }
  194. ]
  195. },
  196. {
  197. index: '4',
  198. name: '基础信息配置',
  199. img: quanxianImg,
  200. children: [
  201. {
  202. index: '',
  203. name: '人员权限配置',
  204. },
  205. {
  206. index: '',
  207. name: '工作流程配置',
  208. }
  209. ]
  210. }
  211. ]
  212. if (window.sessionStorage.getItem('routeTags')) {
  213. this.routeTags = JSON.parse(window.sessionStorage.getItem('routeTags'))
  214. if (this.$route?.path === '/') {
  215. this.$router.push({ path: this.routeTags[0].index})
  216. }
  217. } else {
  218. this.routeTags = [
  219. {
  220. index: '/home',
  221. name: '考评首页'
  222. }
  223. ]
  224. this.$router.push({ path: this.routeTags[0].index})
  225. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  226. }
  227. },
  228. mounted() {
  229. },
  230. computed:{
  231. mainHeight() {
  232. return {
  233. // 'height': document.documentElement.clientHeight-50 + 'px'
  234. 'height': '100vh'
  235. }
  236. },
  237. allHeight() {
  238. return {
  239. 'width': '100%',
  240. // 'height': document.documentElement.clientHeight-40 + 'px'
  241. 'height': '100vh'
  242. }
  243. },
  244. viewHeight() {
  245. return {
  246. 'width': '100%',
  247. // 'height': document.documentElement.clientHeight-40 + 'px'
  248. 'height': '91vh'
  249. }
  250. }
  251. },
  252. methods:{
  253. getBac(val) {
  254. let strWea = ''
  255. debugger
  256. if (val) {
  257. strWea = 'changeBacksty'
  258. } else {
  259. strWea = 'defaultBacksty'
  260. }
  261. return strWea
  262. },
  263. changeRoute(item) {
  264. if (item.index) {
  265. this.$router.push({ path: item.index})
  266. }
  267. },
  268. closeSys() {
  269. let that = this
  270. apiPostremoveByToken(getToken()).then(datas =>{
  271. if (datas.code === 200) {
  272. removeToken('token')
  273. this.$router.push({ path: "/login"})
  274. }
  275. })
  276. },
  277. handleNodeClick(index, indexPath) {
  278. if (indexPath) {
  279. this.forecastDatas.forEach(it =>{
  280. if (it.index !== '') {
  281. if (it.index === indexPath[0]) {
  282. if (!it.children) {
  283. let showM = 0
  284. this.routeTags.forEach(item =>{
  285. if (item.name === it.name) {
  286. showM++
  287. }
  288. })
  289. if (showM === 0) {
  290. this.routeTags.push(it)
  291. }
  292. } else {
  293. it.children.forEach(iv =>{
  294. if (iv.index !== '') {
  295. if (iv.index === indexPath[1]) {
  296. let showM = 0
  297. this.routeTags.forEach(item =>{
  298. if (item.name === iv.name) {
  299. showM++
  300. }
  301. })
  302. if (showM === 0) {
  303. this.routeTags.push(iv)
  304. }
  305. }
  306. }
  307. })
  308. }
  309. }
  310. }
  311. })
  312. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  313. }
  314. },
  315. handleClose(tag) {
  316. if (this.routeTags.length > 1) {
  317. this.routeTags.splice(this.routeTags.indexOf(tag), 1)
  318. window.sessionStorage.setItem('routeTags', JSON.stringify(this.routeTags))
  319. }
  320. },
  321. handleShowPage(tag) {
  322. this.$router.push({ path: tag.index})
  323. }
  324. }
  325. }
  326. </script>
  327. <style lang="less">
  328. .homePage{
  329. display: flex;
  330. .leftMenu{
  331. width: 70px;
  332. .logoSty{
  333. padding: 10px 0 0 10px;
  334. img{
  335. width: 35px;
  336. height: 35px;
  337. }
  338. }
  339. .firstLevel{
  340. margin-top: 30px;
  341. .firstLevel_icon{
  342. margin-bottom: 30px;
  343. cursor: pointer;
  344. .firstLevel_img{
  345. width: 35px;
  346. height: 37px;
  347. text-align: center;
  348. border-radius: 5px;
  349. position: relative;
  350. left: 10px;
  351. img{
  352. position: relative;
  353. top: 6px;
  354. width: 20px;
  355. height: 20px;
  356. }
  357. &:hover{
  358. background: rgba(255,255,255,.2);
  359. }
  360. }
  361. .changeBacksty{
  362. background: rgba(255,255,255,.2);
  363. }
  364. .defaultBacksty{
  365. background: rgba(255,255,255,0);
  366. }
  367. .firstLevel_title{
  368. margin-left: 5px;
  369. span{
  370. font-size: 12px;
  371. color: #fff;
  372. }
  373. }
  374. }
  375. }
  376. }
  377. .frameMain{
  378. // background: #f3f7f8;
  379. border-radius: 30px;
  380. display: flex;
  381. .menuList{
  382. width: 13vw;
  383. height: 100vh;
  384. background-color: #184FB4;
  385. .el-menu{
  386. .el-sub-menu{
  387. .el-menu--inline{
  388. .el-menu-item{
  389. height: 30px;
  390. margin-bottom: 10px;
  391. border-radius: 15px 0 0 15px;
  392. width: 90%;
  393. position: relative;
  394. left: 12%;
  395. padding-left: 15px;
  396. }
  397. .el-menu-item:hover, .el-menu-item.is-active{
  398. background-color: #fff;
  399. border-radius: 15px 0 0 15px;
  400. color: #2778FF;
  401. width: 90%;
  402. position: relative;
  403. left: 12%;
  404. padding-left: 15px;
  405. }
  406. .el-sub-menu__title:hover{
  407. background-color: #1063CB !important;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .homeMain{
  414. width: 86vw;
  415. .homeMain_tag{
  416. height:60px;
  417. border-bottom: 1px solid #D6DBEA;
  418. display: flex;
  419. .tagArr{
  420. height: 33px;
  421. margin-left: 10px;
  422. cursor: pointer;
  423. position: relative;
  424. top: 28px;
  425. }
  426. .el-tag--dark{
  427. background-color: #184FB4;
  428. border: 1px solid #184FB4;
  429. }
  430. .el-tag--info{
  431. background-color: #E6EBF5;
  432. border: 1px solid #E6EBF5;
  433. color: #9DA5BE;
  434. .el-tag__close{
  435. color: #9DA5BE;
  436. }
  437. }
  438. }
  439. .mainMessage{
  440. width: 100%;
  441. height: 91vh;
  442. // padding: 0 10px;
  443. // background: #fff;
  444. border-radius: 20px;
  445. }
  446. }
  447. }
  448. }
  449. </style>