blob: 919aef497bcbbc3fce8f685c963db4b7f06c5972 [file] [log] [blame]
import Mock from 'mockjs'
import { param2Obj } from '@/utils'
import dept from './department'
const clsList = Mock.mock({
'list|26': [{
'id': '@increment',
'node|1': ['后勤处', '财务处', '学生处'],
'studentNumber': '@word(8)',
'name': '@cword(2, 3)',
'department|1': ['教育学院', '经管学院', '人文学院', '数学学院', '计算机学院', '电子学院', '电气学院', '生命科学院'],
'major': '@cword(6, 7)',
'clazz': '@cword(6, 7)',
'auditResult|1': ['待审核', '审核通过', '审核不通过'],
'auditOpinion': '@cword(6, 10)',
'rownum': '@id',
'leaveSchoolBatch': '@cword(6, 7)',
'studentType': '@cword(6, 7)',
'leaveSchoolType': '@cword(6, 7)',
'graduateYear': '@cword(6, 7)',
'graduateMonth': '@cword(6, 7)',
'allowedLeave|1': ['准予', '不准予'],
'auditLogList|4': [{
'auditNode|1': ['后勤处', '财务处', '学生处', '图书馆'],
'auditResult|1': ['通过', '不通过'],
'auditOpinionList|3': [{
'auditResult|1': ['通过', '不通过'],
'auditTime': '@datetime',
'auditor': '@cword(2, 3)',
'auditOpinion': '@cword(6, 10)'
}]
}],
'nodelist': [{
'auditNode': '后勤处',
'auditResult|1': ['—', '×', '√']
},
{
'auditNode': '财务处',
'auditResult|1': ['—', '×', '√']
},
{
'auditNode': '学生处',
'auditResult|1': ['—', '×', '√']
},
{
'auditNode': '图书馆',
'auditResult|1': ['—', '×', '√']
}]
}]
}).list
const leaveSchoolBatchList = Mock.mock(
[{
'value': '2018',
'label': '2018年'
},
{
'value': '2017',
'label': '2017年'
},
{
'value': '2016',
'label': '2016年'
}]
)
const studentTypeList = Mock.mock(
[{
'value': '1',
'label': '研究生'
},
{
'value': '2',
'label': '本专科生'
}]
)
const leaveSchoolTypeList = Mock.mock(
[{
'value': '1',
'label': '毕业离校'
},
{
'value': '2',
'label': '其他'
}]
)
const auditResultList = Mock.mock(
[{
'value': 'TO_BE_AUDITED',
'label': '待审核'
},
{
'value': 'APPROVED',
'label': '审核通过'
},
{
'value': 'NOT_PASSED',
'label': '审核不通过'
}]
)
export default{
getList: config => {
const { studentNumber, name, department, major, clazz,
leaveSchoolBatch, studentType, leaveSchoolType, graduateYear, graduateMonth,
auditNode, allowedLeave, auditResult,
pageIndex = 1, pageSize = 20 } = param2Obj(config.url)
const mockList = clsList.filter(item => {
if (studentNumber && item.studentNumber && item.studentNumber !== studentNumber) return false
if (name && item.name && item.name !== name) return false
if (department && item.department && item.department !== department) return false
if (major && item.major && item.major !== major) return false
if (clazz && item.clazz && item.clazz !== clazz) return false
if (leaveSchoolBatch && item.leaveSchoolBatch && item.leaveSchoolBatch !== leaveSchoolBatch) return false
if (studentType && item.studentType && item.studentType !== studentType) return false
if (leaveSchoolType && item.leaveSchoolType && item.leaveSchoolType !== leaveSchoolType) return false
if (graduateYear && item.graduateYear && item.graduateYear !== graduateYear) return false
if (graduateMonth && item.graduateMonth && item.graduateMonth !== graduateMonth) return false
if (auditNode && item.auditNode && item.auditNode !== auditNode) return false
if (allowedLeave && item.allowedLeave && item.allowedLeave !== allowedLeave) return false
if (auditResult && item.auditResult && item.auditResult !== auditResult) return false
return true
})
const pageList = mockList.filter((item, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1))
return {
departmentList: dept.getDeptList().items,
leaveSchoolTypeList: leaveSchoolTypeList,
studentTypeList: studentTypeList,
leaveSchoolBatchList: leaveSchoolBatchList,
auditResultList: auditResultList,
items: pageList,
recordCount: mockList.length,
code: 200
}
},
saveAudit: config => {
return {
code: 200
}
}
}