performanceIndex.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <el-container>
  3. <LoadingAll :isType="3">
  4. <el-container>
  5. <el-aside>
  6. <div style="padding: 20px;padding-left: 20px;font-weight: 600;border-bottom: 1px solid #f1f1f1;font-size: 16px;">绩效系统</div>
  7. <el-menu :default-active="activeIndex" class="el-menu-vertical-demo" ref="elMenu" :router="true" @select="activeRouter" :unique-opened="true">
  8. <template v-for="(item, index) in routers">
  9. <div v-if="item.children.length != 0" :key="index">
  10. <el-menu-item :index="returnIndex(index, 0)" :route="item.children[0].path" :ref="item.children[0].path" v-if="item.label=='工作台' || item.label=='我的绩效'">
  11. <div class="flex-box-ce">
  12. <svg-icon :icon-class="item.icon" class="svgIcon"></svg-icon>
  13. <span slot="title" style="margin-left: 5px;">{{ item.children[0].label }}</span>
  14. </div>
  15. </el-menu-item>
  16. <el-submenu :index="index.toString()" :key="index" v-else>
  17. <template slot="title">
  18. <div class="flex-box-ce">
  19. <svg-icon :icon-class="item.icon" class="svgIcon"></svg-icon>
  20. <span style="margin-left: 5px;">{{ item.label }}</span>
  21. </div>
  22. </template>
  23. <template v-for="(item2, index2) in item.children">
  24. <el-menu-item :index="returnIndex(index, index2)" :ref="item2.path" :route="item2.path" :key="index2" class="font-flex-word">
  25. <span slot="title" style="margin-left: 10px;width:120px">
  26. {{ item2.label }}
  27. <span :class="item2.label=='考核明细'? 'tio2':'tio'" v-if="getRole && (item2.label=='考核明细' || item2.label=='考核表设置')">
  28. {{item2.label=='考核明细' ? '再发起' : '先配置'}}
  29. </span>
  30. </span>
  31. </el-menu-item>
  32. </template>
  33. </el-submenu>
  34. </div>
  35. </template>
  36. </el-menu>
  37. </el-aside>
  38. <el-main>
  39. <keep-alive :include="keepAliveView"><router-view/></keep-alive>
  40. </el-main>
  41. </el-container>
  42. </LoadingAll>
  43. <el-dialog :visible.sync="usingTheStrategy" width="680px" :before-close="navDialog" :close-on-click-modal="false">
  44. <div>
  45. <img style="width: 100%;" :src="'static/images/' + navList[navNew].image + '.png'" alt="" />
  46. <div class="flex-box flex-d-center">
  47. <el-button @click="navPath(navList[navNew].paths)" type="primary" plain>{{ navList[navNew].name }}</el-button>
  48. <div>
  49. <el-button v-if="navNew > 0" @click="navNew--">上一页</el-button>
  50. <el-button v-if="navNew < 3" @click="navNew++" type="primary">下一页</el-button>
  51. <el-button v-if="navNew == 3" type="primary" @click="usingTheStrategy = false">开始使用</el-button>
  52. </div>
  53. </div>
  54. </div>
  55. </el-dialog>
  56. </el-container>
  57. </template>
  58. <script>
  59. import {mapGetters} from 'vuex';
  60. import LoadingAll from '@/components/LoadingAll';
  61. export default {
  62. components:{LoadingAll},
  63. data() {
  64. return {
  65. usingTheStrategy: false,
  66. tutorialsvisible: false,
  67. navList: [
  68. { name: '去"新建考核模板"', image: 'nav_jx_1', paths: 'evaluate' },
  69. { name: '去"发起考核"', image: 'nav_jx_2', paths: 'sponsorAssess' },
  70. { name: '看"考核管理"', image: 'nav_jx_3', paths: 'assessManagement' },
  71. { name: '看"绩效报表"', image: 'nav_jx_4', paths: 'statement' }
  72. ],
  73. navNew: 0,
  74. activeIndex: '0-0',
  75. routers: [],
  76. url: '',
  77. profile: this.$store.getters.user_info,
  78. getRole: this.$getRole(1),
  79. keepAliveView:['job','management','score','assessManagement','assessDetails','statement','set'], //需要缓存的组件名称列表,用逗号分隔
  80. keepAliveView2:['job','management','score','assessManagement','assessDetails','statement','set'], //需要缓存的组件名称列表,用逗号分隔
  81. userInfo: this.$userInfo(), //绩效接口人员信息
  82. };
  83. },
  84. watch: {
  85. $route(to,form) {
  86. // console.log(to.name,form.name)
  87. // 缓存页面,达到缓存页面条件的效果
  88. if(to.name=='job'&&form.name=='assessManagement'){//首页
  89. this.returnArr('job')
  90. }else if(to.name=='management'&&form.name=='job'){//我管理的-更多
  91. this.returnArr('management')
  92. }else if(to.name=='score'&&form.name=='job'){//我评分的-更多
  93. this.returnArr('score')
  94. }else if(to.name=='assessManagement'&&form.name=='myPerformance'){//考核管理
  95. this.returnArr('assessManagement')
  96. }else if(to.name=='assessDetails'&&form.name=='assessManagement'){//考核管理2
  97. this.returnArr('assessDetails')
  98. }else if(to.name=='assessDetails'&&form.name=='sponsorAssess'){//发起考核进入-考核管理
  99. this.returnArr('assessDetails')
  100. }else if(to.name=='assessDetails'&&form.name=='analyse'){//结果分析-考核管理
  101. this.returnArr('assessDetails')
  102. }else if(to.name=='statement'&&form.name=='myPerformance'){//绩效报表
  103. this.returnArr('statement')
  104. }else if(to.name=='set'&&form.name=='statement'){//设置
  105. this.returnArr('set')
  106. }else if(to.name=='set'&&form.name=='job'){//设置
  107. this.returnArr('set')
  108. }else{
  109. this.keepAliveView=JSON.parse(JSON.stringify(this.keepAliveView2));
  110. }
  111. var str = to.path;
  112. this.routers.map((item, index) => {
  113. if (item.path == str) {
  114. this.activeIndex = index + '-' + index;
  115. this.$setCache('performance_path', index + '-' + index);
  116. }
  117. item.children.map((item2, index2) => {
  118. if (item2.path == str) {
  119. this.activeIndex = index + '-' + index2;
  120. this.$setCache('performance_path', index + '-' + index2);
  121. }
  122. });
  123. });
  124. }
  125. },
  126. computed: {
  127. ...mapGetters(['site_info'])
  128. },
  129. created() {
  130. this.setRouters();
  131. },
  132. mounted() {
  133. this.getRole=this.$getRole(1);
  134. // this.$nextTick(() => {
  135. // if (!this.$getCache('newNav') && this.getRole) {
  136. // this.usingTheStrategy = true;
  137. // this.$setCache('newNav', true);
  138. // }
  139. // });
  140. },
  141. methods: {
  142. returnArr(str){
  143. this.keepAliveView=this.keepAliveView.filter(item=>{
  144. return item!=str;
  145. })
  146. setTimeout(()=>{
  147. this.keepAliveView=JSON.parse(JSON.stringify(this.keepAliveView2));
  148. },1000)
  149. },
  150. returnIndex(str, str2) {
  151. return str + '-' + str2;
  152. },
  153. //当刷新页面是控制左边导航栏的选中
  154. activeRouter(index, indexPath) {
  155. this.$setCache('setUrlName', null); //清空set页面的保存展示页面
  156. this.$setCache('performance_path', indexPath[1] ? indexPath[1] : indexPath[0]);
  157. },
  158. navPath(paths) {
  159. this.usingTheStrategy = false;
  160. this.$router.push({ name: paths });
  161. },
  162. strategys() {
  163. this.usingTheStrategy = true;
  164. this.tutorialsvisible = false;
  165. },
  166. navDialog(done) {
  167. done();
  168. this.tutorialsvisible = true;
  169. },
  170. openHome() {
  171. this.$router.push({ path: '/job' });
  172. },
  173. returnRoutersArr(str,routers) {
  174. var routersArr = [];
  175. routers.forEach(item => {
  176. if (item.meta.groupCode == str) {
  177. //获取对应模块的路由
  178. routersArr.push(item);
  179. }
  180. });
  181. return routersArr;
  182. },
  183. setRouters() {
  184. // 刚进入来清除一些缓存
  185. this.$removeCache(['isVariationJx', 'assessDetails', 'cache_s_m', 'indexSet', 'staffAssDet']);
  186. let main = this.userInfo.per_permission.main;
  187. let per_role = this.userInfo.per_permission.per_role; //用户的身份
  188. let childrenRouter = [];
  189. let routers=[];
  190. this.$router.options.routes[0].children.some((item, i) => {
  191. if (item.name == 'performanceIndex') {
  192. childrenRouter = item.children.filter(e => {
  193. if (e.meta) {
  194. return e;
  195. }
  196. });
  197. return true;
  198. }
  199. });
  200. if (per_role == 'manager') {
  201. if (main == 1) {//主管理员
  202. this.setRole('masterAdministrator');
  203. routers=childrenRouter
  204. } else {//子管理员
  205. this.setRole('childAdministrator');
  206. routers = this.getChildRouter(childrenRouter, 'childAdministrator');
  207. }
  208. } else {
  209. //员工||部门管理员
  210. if (this.userInfo.employee_detail.manage_dept_ids.length > 0) {
  211. this.setRole('deptManager');
  212. routers = this.getChildRouter(childrenRouter, 'deptManager');
  213. } else {
  214. this.setRole('employee');
  215. routers = this.getChildRouter(childrenRouter, 'employee');
  216. }
  217. }
  218. let routersArr = [
  219. { label: '工作台', children: this.returnRoutersArr('job',routers), icon: '#icon-gongzuotai1'},
  220. { label: '绩效管理', children: this.returnRoutersArr('assessManagement',routers), icon: '#icon-tongxunlu_tianjiabumen'},
  221. { label: '绩效报表', children: this.returnRoutersArr('statement',routers), icon: '#icon-shezhi_jiaose'},
  222. { label: '我的绩效', children: this.returnRoutersArr('myPerformance',routers), icon: '#icon-yonghu'},
  223. { label: '设置', children: this.returnRoutersArr('set',routers), icon: '#icon-shezhi_jichushezhi'},
  224. ];
  225. this.$setCache('performance_routers',routersArr);
  226. this.routers=routersArr
  227. let performance_path=this.$getCache('performance_path');
  228. if (performance_path) {
  229. this.activeIndex =performance_path;
  230. if(performance_path=='0-0'){
  231. this.$router.push({ path:'/job'});
  232. }
  233. }
  234. let performanceIndex=this.$getCache('performanceIndex');
  235. if (performanceIndex) {
  236. this.$router.push({ path:performanceIndex});
  237. this.$removeCache('performanceIndex')
  238. }
  239. },
  240. setRole(str) {
  241. this.$setCache('role', str);
  242. },
  243. //获取路由
  244. getChildRouter(routerChildren, str) {
  245. let permission = this.userInfo.per_permission.permission; //用户的权限
  246. let routers = {}; //过滤后的路由,顺便去重
  247. routerChildren.forEach(item => {
  248. let role = item.meta.role;
  249. let jurisdiction = item.meta.jurisdiction;
  250. if (item.meta) {
  251. //当没设置meta时不显示在导航栏上
  252. if (role.indexOf(str) >= 0) {
  253. if (str == 'employee' || str == 'deptManager') {
  254. //当是员工||创始人||部门主管时,不需要验证权限
  255. routers[item.name] = item;
  256. return;
  257. }
  258. //当登录人是7.0部门管理者时写死显示绩效报表
  259. if (item.name == 'statement' && this.$userInfo().employee_detail.manage_dept_ids.length > 0) {
  260. routers[item.name] = item;
  261. return;
  262. }
  263. permission.forEach(roleItem => {
  264. if (jurisdiction) {
  265. if (jurisdiction.indexOf(roleItem.id) >= 0) {
  266. routers[item.name] = item;
  267. }
  268. }
  269. });
  270. }
  271. }
  272. });
  273. let routersArr = [];
  274. for (let s in routers) {
  275. routersArr.push(routers[s]);
  276. }
  277. return routersArr;
  278. },
  279. }
  280. };
  281. </script>
  282. <style scoped="scoped" lang="scss">
  283. .tio{
  284. font-size: 12px;
  285. background-color: #FFF2CC;
  286. border-radius: 5px;
  287. color: #98683C;
  288. padding: 0 2px;
  289. }
  290. .tio2{
  291. font-size: 12px;
  292. background-color: #D4E4FF;
  293. border-radius: 5px;
  294. color: #409EFF;
  295. padding: 0 2px;
  296. }
  297. .appImg {
  298. width: 200px;
  299. height: 200px;
  300. }
  301. .data-all {
  302. margin-bottom: 10%;
  303. color: #595959;
  304. text-align: center;
  305. }
  306. ::v-deep .el-dialog__header {
  307. border-bottom: none;
  308. }
  309. .svgIcon {
  310. font-size: 20px;
  311. color: #99a9bf;
  312. }
  313. .el-menu-vertical-demo:not(.el-menu--collapse) {
  314. width: 180px;
  315. }
  316. .el-header {
  317. background-color: #fff;
  318. padding: 0 !important;
  319. border-bottom: 1px solid #f1f1f1;
  320. position: relative;
  321. box-sizing: border-box;
  322. height: 60px;
  323. }
  324. .el-menu-vertical-demo:not(.el-menu--collapse) {
  325. width: 180px;
  326. }
  327. .el-menu {
  328. overflow: hidden;
  329. border: none;
  330. }
  331. .el-aside {
  332. transition: width 0.28s;
  333. width: 180px !important;
  334. background-color: #fff;
  335. height: calc(100vh - 80px);
  336. border-radius: 5px;
  337. }
  338. .el-aside::-webkit-scrollbar {
  339. width: 0px;
  340. background-color: #fff;
  341. }
  342. .el-aside::-webkit-scrollbar-thumb {
  343. background-color: #ccc;
  344. }
  345. .container-all {
  346. background-color: #f4f6f9;
  347. height: 100%;
  348. overflow: hidden;
  349. }
  350. .el-main {
  351. height: calc(100vh - 80px);
  352. overflow-y: scroll;
  353. padding: 0 10px;
  354. min-width: 1100px;
  355. }
  356. .logo-box {
  357. max-width: 400px;
  358. min-width: 180px;
  359. }
  360. .logo-box .logo {
  361. width: 30px;
  362. height: 30px;
  363. margin-right: 5px;
  364. border-radius: 6px;
  365. }
  366. .logo-box div {
  367. font-size: 16px;
  368. font-weight: 600;
  369. }
  370. .wn {
  371. height: 26px;
  372. width: 26px;
  373. margin-right: 12px;
  374. cursor: pointer;
  375. }
  376. .hea-right {
  377. padding: 0 20px;
  378. }
  379. .upgrade {
  380. margin-left: 10px;
  381. margin-right: 10px;
  382. }
  383. .PCtutorials {
  384. width: 100px;
  385. color: #409EFF;
  386. cursor: pointer;
  387. border-radius: 3px;
  388. text-align: center;
  389. box-shadow: 1px 1px 0px 0px #ccc;
  390. height: 35px;
  391. line-height: 35px;
  392. font-weight: 500;
  393. text-align: center;
  394. border: 2px solid #409EFF;
  395. // background-image: linear-gradient(117deg, #00c6fb 0%, #005bea 100%);
  396. }
  397. // .PCtutorials:hover {
  398. // background-color: #0055ff;
  399. // }
  400. </style>