1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
// @ts-nocheck
import Vue from 'vue'
import VueRouter from 'vue-router'
// import Layout from '@/components/layout'
import Layout from '@/components/layout/Layout.vue'
import store from '@/store'
import { getToken, removeToken, getType, setType } from '@/views/utils/auth'
// 进度条
import NProgress from 'nprogress'
import { ConsoleSqlOutlined } from '@ant-design/icons'
import api from '@/api'
NProgress.inc(0.2)
NProgress.configure({
easing: 'ease',
speed: 600,
showSpinner: false,
trickle: false,
})
// NProgress.configure({ parent: '.main' });
Vue.use(VueRouter)
export const routes = [
{
path: '/',
component: Layout,
redirect: '/home',
hidden: true,
children: [
{
path: '/home',
component: () => import('@/views/home/index'),
name: 'home',
meta: { title: '首页', icon: '', affix: true }
}
]
},
{
path: '/sys',
component: () => import('@/views/systemType/index.vue'),
hidden: true
},
{
path: '/web',
component: () => import('@/views/web/index.vue'),
hidden: true
},
{
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: '/redirect/:path(.*)',
component: () => import('@/views/redirect/index')
}
]
},
{
path: '/error',
component: Layout,
redirect: 'noRedirect',
name: 'ErrorPages',
hidden: true,
children: [
{ path: '/403', component: () => import('@/views/errorPage/403.vue'), name: '403', meta: { title: '403', noCache: true } },
{ path: '/404', component: () => import('@/views/errorPage/404.vue'), name: '404', meta: { title: '404', noCache: true } }
]
},
{
path: '/login',
component: () => import('@/views/login/login'),
hidden: true
},
{
path: '/register',
name: 'register',
component: () => import('@/views/register/Index'),
hidden: true
},
{
path: '/reset',
name: 'reset',
component: () => import('@/views/reset/index'),
hidden: true
},
{
path: '/personInfo',
name: 'personInfo',
component: Layout,
meta: { title: '个人设置', icon: 'el-icon-user' },
hidden: false,
children: [
{ path: '/person/info', name: '个人设置', component: () => import('@/views/basicSetting/person/index.vue'), meta: { title: '个人设置', icon: '', noCache: true } },
]
},
{
path: '/unitInfo',
name: 'unitInfo',
component: Layout,
meta: { title: '单位设置', icon: 'el-icon-user' },
hidden: false,
children: [
{ path: '/unit/info', name: '单位基础信息设置', component: () => import('@/views/basicSetting/unit/index.vue'), meta: { title: '单位基础信息设置', icon: '', noCache: true } },
]
},
{
path: '/personal',
name: 'report',
component: Layout,
meta: { title: '个人中心', icon: 'el-icon-user' },
hidden: false,
children: [
{ path: '/report/project', name: '项目申报', component: () => import('@/views/report/project/Index.vue'), meta: { title: '项目申报', icon: '', noCache: true } },
{ path: '/report/task', name: '任务书填报1', component: () => import('@/views/report/task/Index.vue'), meta: { title: '任务书填报1', icon: '', noCache: true } },
{ path: '/report/projectTask', name: '任务书填报2', component: () => import('@/views/report/task/projectTask.vue'), meta: { title: '任务书填报2', icon: '', noCache: true } },
{ path: '/report/check', name: '中期考核填报', component: () => import('@/views/report/check/Index.vue'), meta: { title: '中期考核填报', icon: '', noCache: true } },
{ path: '/report/conclusion', name: '项目结题', component: () => import('@/views/conclusion/index.vue'), meta: { title: '项目结题', icon: '', noCache: true } },
{ path: '/project/create', name: '项目创建', component: () => import('@/views/report/project/components/projectCreate'), meta: { title: '项目创建', icon: '', noCache: true } },
{ path: '/query/project', name: '项目申报查询1', component: () => import('@/views/query/project/Index.vue'), meta: { title: '项目申报查询', icon: '', noCache: true } },
{ path: '/query/task', name: '任务书上报查询1', component: () => import('@/views/query/task/Index.vue'), meta: { title: '任务书上报查询', icon: '', noCache: true } },
{ path: '/query/check', name: '中期考核上报查询1', component: () => import('@/views/query/check/Index.vue'), meta: { title: '中期考核上报查询', icon: '', noCache: true } },
]
},
{
path: '/project',
name: 'project',
component: Layout,
meta: { title: '项目管理', icon: 'component' },
hidden: false,
children: [
{ path: '/audit/project', name: '项目审核', component: () => import('@/views/audit/project/Index.vue'), meta: { title: '项目审核', icon: '', noCache: true } },
{ path: '/audit/preliminary', name: '项目预审', component: () => import('@/views/audit/project/Index.vue'), meta: { title: '项目预审', icon: '', noCache: true } },
{ path: '/audit/final', name: '项目终审', component: () => import('@/views/audit/project/final.vue'), meta: { title: '项目审核', icon: '', noCache: true } },
{ path: '/audit/taskAudit', name: '任务书审核', component: () => import('@/views/audit/task/Index.vue'), meta: { title: '任务书审核', icon: '', noCache: true } },
{ path: '/audit/checkAudit', name: '中期考核表审核', component: () => import('@/views/audit/check/Index.vue'), meta: { title: '中期考核表审核', icon: '', noCache: true } },
// { path: '/peAssign', name: '项目组分配', component: () => import('@/views/peAssign/index.vue'), meta: { title: '项目分配', icon: '', noCache: true } },
{ path: '/peAssign', name: '项目组分配1', component: () => import('@/views/peAssign/projAssign.vue'), meta: { title: '项目分配', icon: '', noCache: true } },
{ path: '/assign', name: '项目组分配2', component: () => import('@/views/assign/assignProjectGroup.vue'), meta: { title: '项目分配', icon: '', noCache: true } },
{ path: '/project/assign', name: '项目分配', component: () => import('@/views/assign/assignProject.vue'), meta: { title: '项目分配', icon: '', noCache: true } },
{ path: '/expert/evaluation', name: '项目评分', component: () => import('@/views/evaluation/index.vue'), meta: { title: '项目评分', icon: '', noCache: true } },
{ path: '/expert/evaluation1', name: '项目评审', component: () => import('@/views/evaluation/evaluation.vue'), meta: { title: '项目评审', icon: '', noCache: true } },
{ path: '/audit/conclusion', name: '项目结题审核', component: () => import('@/views/audit/conclusion/index.vue'), meta: { title: '项目结题审核', icon: '', noCache: true } },
]
},
{
path: '/thesis',
name: 'thesis',
component: Layout,
meta: { title: '论文管理', icon: 'search' },
hidden: false,
children: [
{ path: '/thesis/audit', name: '论文审核', component: () => import('@/views/audit/thesis/index.vue'), meta: { title: '论文审核', icon: '', noCache: true } },
{ path: '/thesis/list', name: '论文管理', component: () => import('@/views/thesis/index.vue'), meta: { title: '论文管理', icon: '', noCache: true } },
]
},
{
path: '/user',
name: 'user',
component: Layout,
meta: { title: '用户人员管理', icon: 'search' },
hidden: false,
children: [
{ path: '/manager/user', name: '用户管理', component: () => import('@/views/manager/user/index.vue'), meta: { title: '用户管理', icon: '', noCache: true } },
{ path: '/manager/person', name: '人员管理(后台)', component: () => import('@/views/manager/person/index.vue'), meta: { title: '人员管理(后台)', icon: '', noCache: true } },
]
},
{
path: '/person',
name: 'person',
component: Layout,
meta: { title: '人员管理', icon: 'search' },
hidden: false,
children: [
{ path: '/person/list', name: '人员管理', component: () => import('@/views/person/index.vue'), meta: { title: '人员管理', icon: '', noCache: true } },
{ path: '/person/audit', name: '人员审核', component: () => import('@/views/person/audit.vue'), meta: { title: '人员审核', icon: '', noCache: true } },
]
},
{
path: '/unit',
name: 'unit',
component: Layout,
meta: { title: '单位管理', icon: 'search' },
hidden: false,
children: [
{ path: '/unit/list', name: '单位管理', component: () => import('@/views/unit/Index.vue'), meta: { title: '单位管理', icon: '', noCache: true } },
{ path: '/unit/audit', name: '单位审核', component: () => import('@/views/unit/audit.vue'), meta: { title: '单位审核', icon: '', noCache: true } },
{ path: '/manager/unit', name: '单位管理(后台)', component: () => import('@/views/manager/unit/index.vue'), meta: { title: '单位管理(后台)', icon: '', noCache: true } },
]
},
{
path: '/notice',
name: 'notice',
component: Layout,
meta: { title: '通知公告', icon: 'search' },
hidden: false,
children: [
{ path: '/notice/list', name: '通知发布', component: () => import('@/views/notice/index.vue'), meta: { title: '通知发布', icon: '', noCache: true } },
]
},
{
path: '/manager',
name: 'manager',
component: Layout,
meta: { title: '项目管理(后台)', icon: 'search' },
hidden: false,
children: [
{ path: '/manager/project', name: '项目管理(后台)', component: () => import('@/views/manager/project/index.vue'), meta: { title: '项目管理(后台)', icon: '', noCache: true } },
]
},
{
path: '/statistic',
name: 'statistic',
component: Layout,
meta: { title: '统计查询', icon: 'search' },
hidden: false,
children: [
{ path: '/statistic/project', name: '项目申报查询', component: () => import('@/views/statistic/project/Index.vue'), meta: { title: '项目申报查询', icon: '', noCache: true } },
{ path: '/statistic/task', name: '任务书上报查询', component: () => import('@/views/statistic/task/Index.vue'), meta: { title: '任务书上报查询', icon: '', noCache: true } },
{ path: '/statistic/check', name: '中期考核上报查询', component: () => import('@/views/statistic/check/Index.vue'), meta: { title: '中期考核上报查询', icon: '', noCache: true } },
{ path: '/expert/evaluationQuery', name: '评分项目查询', component: () => import('@/views/evaluation/query.vue'), meta: { title: '评分项目查询', icon: '', noCache: true } },
]
},
{
path: '/expert',
name: 'expert',
component: Layout,
meta: { title: '专家管理', icon: 'solution' },
hidden: false,
children: [
{ path: '/expert/list', name: '专家管理', component: () => import('@/views/expert/index.vue'), meta: { title: '专家管理', icon: '', noCache: true } },
{ path: '/expert/expertBRegister', name: '专家导入', component: () => import('@/views/expert/components/expertImport.vue'), meta: { title: '专家导入', icon: '', noCache: true } },
{ path: '/expert/group', name: '专家组管理', component: () => import('@/views/expertGroup/expertBatch.vue'), meta: { title: '专家组管理', icon: '', noCache: true } },
{ path: '/expert/group/members', name: '专家组成员管理', component: () => import('@/views/expertGroup/expertGroupMembers.vue'), meta: { title: '专家组成员管理', icon: '', noCache: true } },
{ path: '/expert/report', name: '专家推荐', component: () => import('@/views/expert/index.vue'), meta: { title: '专家推荐', icon: '', noCache: true } },
]
},
{
path: '/systemSet',
name: 'timeSet',
component: Layout,
meta: { title: '系统设置', icon: 'el-icon-s-tools' },
hidden: false,
children: [
{ path: '/timeSet/projectTimeSet', name: '申报时间设置', component: () => import('@/views/timeSet/projectTimeSet/Index.vue'), meta: { title: '申报时间设置', icon: '', noCache: true } },
{ path: '/timeSet/taskTimeSet', name: '任务书时间设置', component: () => import('@/views/timeSet/taskTimeSet/Index.vue'), meta: { title: '任务书时间设置', icon: '', noCache: true } },
{ path: '/timeSet/checkTimeSet', name: '中期考核时间设置', component: () => import('@/views/timeSet/checkTimeSet/Index.vue'), meta: { title: '中期考核时间设置', icon: '', noCache: true } },
{ path: '/setting/batch', name: '申报批次设置', component: () => import('@/views/timeSet/batch/Index.vue'), meta: { title: '申报批次设置', icon: '', noCache: true } },
{ path: '/setting/count', name: '申报名额配比', component: () => import('@/views/projAcountSet/projAcountSet.vue'), meta: { title: '申报名额配比管理', icon: '', noCache: true } },
{ path: '/system/evaluationStandard', name: '年度评审标准设置', component: () => import('@/views/system/evaluationStandard/index.vue'), meta: { title: '年度评审标准设置', icon: '', noCache: true } },
//后台
{ path: '/system/role', name: '角色管理', component: () => import('@/views/system/role/index.vue'), meta: { title: '角色管理', icon: '', noCache: true } },
{ path: '/system/menu/', name: '菜单管理', component: () => import('@/views/system/menu/index.vue'), meta: { title: '菜单管理', icon: '', noCache: true } },
{ path: '/system/role/menu', name: '角色菜单管理', component: () => import('@/views/system/role/roleRight.vue'), meta: { title: '角色权限管理', icon: '', noCache: true } },
{ path: '/system/evaluation', name: '评审表设置', component: () => import('@/views/system/evaluation/index.vue'), meta: { title: '评审表设置', icon: '', noCache: true } },
{ path: '/system/set', name: '系统设置', component: () => import('@/views/system/set/index.vue'), meta: { title: '系统配置', icon: '', noCache: true } },
]
},
{
path: '/log',
name: 'log',
component: Layout,
meta: { title: '日志管理', icon: 'education' },
hidden: false,
children: [
{ path: '/log/login', name: '登录日志', component: () => import('@/views/log/login.vue'), meta: { title: '登录日志', icon: '', noCache: true } },
{ path: '/log/operation', name: '操作日志', component: () => import('@/views/log/operation.vue'), meta: { title: '操作日志', icon: '', noCache: true } },
{ path: '/log/exception', name: '异常日志', component: () => import('@/views/log/exception.vue'), meta: { title: '异常日志', icon: '', noCache: true } },
{ path: '/log/login/exception', name: '异常登录日志', component: () => import('@/views/log/loginException.vue'), meta: { title: '异常登录日志', icon: '', noCache: true } },
]
},
{
path: '/para',
name: 'parameter',
component: Layout,
meta: { title: '字典管理', icon: 'excel' },
hidden: false,
children: [
{ path: '/parameter', name: '字典管理', component: () => import('@/views/system/parameter/index.vue'), meta: { title: '字典管理', icon: '', noCache: true } },
{ path: '/parameter/type', name: '字典类型管理', component: () => import('@/views/system/parameterType/index.vue'), meta: { title: '字典类型管理', icon: '', noCache: true } },
]
},
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () =>
new VueRouter({
// mode: 'history', // require service support
mode: 'hash',
base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }),
routes
})
const router = createRouter()
export function resetRouter () {
const newRouter = createRouter()
router.matcher = newRouter.matcher
}
export function changeProjType (type) {
new Promise(async (resolve, reject) => {
try {
this.$store.commit('app/clearStore')
setType(type + '')
this.$store.commit('app/setProjType', type)
let menuList = JSON.parse(window.sessionStorage.getItem('menuList'))
this.$store.commit('app/initStore', [menuList[0].id])
this.$router.push('/')
resolve(true)
} catch (e) {
reject(false)
}
})
}
const whiteList = ['/login', '/register', '/reset', '/web']
router.beforeEach(async (to, from, next) => {
document.title = process.env.VUE_APP_SYSTEM_TITLE
NProgress.start()
const token = getToken()
if (token) {
try {
if (whiteList.indexOf(to.path) !== -1) {
next({ path: '/' })
NProgress.done()
} else {
const hasUser = JSON.parse(window.sessionStorage.getItem('user'))
const hasMenu = JSON.parse(window.sessionStorage.getItem('menuList'))
if (hasUser && hasMenu) {
if (hasUser.type === '3' && !!!hasUser.projType && hasUser.roles != '4') {
if (to.path === '/sys') {
next()
NProgress.done()
} else {
next(`/sys`)
NProgress.done()
}
} else {
await store.dispatch('app/auth', to.path)
next()
NProgress.done()
}
} else {
await store.dispatch('user/getUser')
next({ ...to, replace: true })
NProgress.done()
}
}
} catch (error) {
removeToken()
next(`/login`)
NProgress.done()
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next()
NProgress.done()
} else {
// next(`/login?redirect=${to.path}`)
next(`/login`)
NProgress.done()
}
}
})
router.afterEach((to, form, next) => {
NProgress.done()
})
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
return originalPush.call(this, location).catch((err) => err)
}
export default router