1179 lines
65 KiB
TypeScript
1179 lines
65 KiB
TypeScript
|
|
const schema = {
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'tabs',
|
|||
|
|
className: '',
|
|||
|
|
tabs: [
|
|||
|
|
{
|
|||
|
|
title: '日程一览',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
title: '表单',
|
|||
|
|
className: '',
|
|||
|
|
submitOnChange: true,
|
|||
|
|
submitOnInit: true,
|
|||
|
|
reload:
|
|||
|
|
'manage_loc?course_id=$course_id&project_id=$project_id&teacher_id=$teacher_id&location_id=$location_id&date=$date&no_tch=$no_tch&public=$public',
|
|||
|
|
initApi: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/users?role=eq.teacher&id=eq.${user.id}&order=code',
|
|||
|
|
requestAdaptor: '',
|
|||
|
|
adaptor:
|
|||
|
|
"if (payload.data.items.length !== 0) {\r\n return {\r\n teacher_id: 'eq.'.concat(payload.data.items[0].id)\r\n }\r\n} else {\r\n return {}\r\n}",
|
|||
|
|
},
|
|||
|
|
wrapWithPanel: false,
|
|||
|
|
mode: 'inline',
|
|||
|
|
name: 'filter',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'group',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
label: '课程',
|
|||
|
|
type: 'select',
|
|||
|
|
name: 'course_id',
|
|||
|
|
mode: 'inline',
|
|||
|
|
clearable: true,
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/courses?organization_id=eq.$centre_id&semester_id=eq.$currentSemester&order=code',
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: payload.data.items.map(item => {\r\n return {\r\n label: `${item.name}(${item.code})`,\r\n value: "eq.".concat(item.id)\r\n }\r\n })\r\n}',
|
|||
|
|
},
|
|||
|
|
checkAll: false,
|
|||
|
|
size: 'md',
|
|||
|
|
searchable: true,
|
|||
|
|
inputClassName: 'm-l-xs',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'select',
|
|||
|
|
label: '实验',
|
|||
|
|
name: 'project_id',
|
|||
|
|
mode: 'inline',
|
|||
|
|
clearable: true,
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/projects?organization_id=eq.$centre_id&semester_id=eq.$currentSemester&order=code',
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: payload.data.items.map(item => {\r\n return {\r\n label: item.name,\r\n value: "eq.".concat(item.id)\r\n }\r\n })\r\n}',
|
|||
|
|
},
|
|||
|
|
checkAll: false,
|
|||
|
|
size: 'md',
|
|||
|
|
searchable: true,
|
|||
|
|
className: 'm-l-sm',
|
|||
|
|
inputClassName: 'm-l-xs',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'group',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'input-date-range',
|
|||
|
|
label: '日期',
|
|||
|
|
name: 'date',
|
|||
|
|
mode: 'inline',
|
|||
|
|
clearable: true,
|
|||
|
|
value: '',
|
|||
|
|
format: 'YYYY-MM-DD',
|
|||
|
|
ranges:
|
|||
|
|
'yesterday,today,7daysago,prevweek,thismonth,prevmonth,prevquarter',
|
|||
|
|
inputClassName: 'm-l-xs',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'select',
|
|||
|
|
label: '地点',
|
|||
|
|
name: 'location_id',
|
|||
|
|
mode: 'inline',
|
|||
|
|
clearable: true,
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/locations?organization_id=eq.$centre_id&order=code',
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: payload.data.items.map(item => {\r\n return {\r\n label: item.name,\r\n value: "eq.".concat(item.id)\r\n }\r\n })\r\n}',
|
|||
|
|
},
|
|||
|
|
checkAll: false,
|
|||
|
|
size: 'md',
|
|||
|
|
searchable: true,
|
|||
|
|
className: 'm-l-sm',
|
|||
|
|
inputClassName: 'm-l-xs',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '教师',
|
|||
|
|
type: 'select',
|
|||
|
|
name: 'teacher_id',
|
|||
|
|
mode: 'inline',
|
|||
|
|
clearable: true,
|
|||
|
|
checkAll: false,
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/users?role=eq.teacher&order=code',
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: payload.data.items.map(item => {\r\n return {\r\n label: `${item.name}(${item.code})`,\r\n value: "eq.".concat(item.id)\r\n }\r\n })\r\n}',
|
|||
|
|
},
|
|||
|
|
size: 'md',
|
|||
|
|
searchable: true,
|
|||
|
|
inputClassName: 'm-l-xs',
|
|||
|
|
className: 'm-l-sm',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'group',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'switch',
|
|||
|
|
name: 'no_tch',
|
|||
|
|
option: '显示无教师场次',
|
|||
|
|
mode: 'inline',
|
|||
|
|
optionAtLeft: false,
|
|||
|
|
trueValue: 1,
|
|||
|
|
falseValue: 0,
|
|||
|
|
value: 0,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'switch',
|
|||
|
|
name: 'public',
|
|||
|
|
option: '显示公共场次',
|
|||
|
|
mode: 'inline',
|
|||
|
|
optionAtLeft: false,
|
|||
|
|
trueValue: 1,
|
|||
|
|
falseValue: 0,
|
|||
|
|
value: 0,
|
|||
|
|
inputClassName: 'm-l-sm',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{ type: 'divider', lineStyle: 'solid' },
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/schedule_stats?organization_id=eq.$centre_id&semester_id=eq.$currentSemester&is_publish=is.true&order=project_name,date,period_name,location_name,teacher_name',
|
|||
|
|
data: { page: '$page', perPage: '$perPage', '&': '$$' },
|
|||
|
|
adaptor:
|
|||
|
|
"let supportDateTimeFormat = typeof(Intl.DateTimeFormat) === 'function';\r\nlet today = new Date().getTime()\r\npayload.data.items.forEach(item => {\r\n item.day = supportDateTimeFormat ? `${item.date}(${new Intl.DateTimeFormat('zh-CN', { weekday: 'short'}).format(new Date(item.date))})` : item.date;\r\n let schedule_time = new Date(\r\n item.date.concat(' ', item.start_time)\r\n ).getTime()\r\n\r\n if (schedule_time > today) {\r\n item.schedule_not_start = 1\r\n } else {\r\n item.schedule_not_start = 0\r\n }\r\n\r\n item.stu_num = \"\".concat(\r\n item.current_student_number, \"/\", item.max_student_number\r\n )\r\n item.stu_num_status =\r\n item.current_student_number === item.max_student_number\r\n ? 1\r\n : 0\r\n item.selected_schedule_id = item.id\r\n item.stu_title = item.project_name.concat(\r\n ' :: ', item.date, ' ', item.period_name,\r\n ' :: ', item.location_name,\r\n ' :: ', item.teacher_name ? item.teacher_name : '无教师认领'\r\n )\r\n})\r\n\r\nreturn {\r\n ...payload\r\n}",
|
|||
|
|
requestAdaptor:
|
|||
|
|
"if (api.body.course_id === '') {\r\n api.url = api.url.replace(/&course_id=/g, '')\r\n}\r\nif (api.body.project_id === '') {\r\n api.url = api.url.replace(/&project_id=/g, '')\r\n}\r\nif (api.body.date === '') {\r\n api.url = api.url.replace(/&date=/g, '')\r\n}\r\nif (api.body.location_id === '') {\r\n api.url = api.url.replace(/&location_id=/g, '')\r\n}\r\nif (api.body.teacher_id === '') {\r\n api.url = api.url.replace(/&teacher_id=/g, '')\r\n}\r\nif (api.body.no_tch === 0) {\r\n api.url = api.url.replace(/&no_tch=0/g, '')\r\n}\r\nif (api.body.public === 0) {\r\n api.url = api.url.replace(/&public=0/g, '')\r\n}\r\nconst pattern = /(?:date=)(\\d+-\\d+-\\d+)%2C(\\d+-\\d+-\\d+)/g\r\nconst result = pattern.exec(api.url)\r\nif (result && result[1] === result[2]) {\r\n api.url = api.url.replace(result[0], 'date=eq.'.concat(result[1]))\r\n} else if (result) {\r\n api.url = api.url.replace(result[0], 'date=gte.'.concat(result[1], '&date=lte.', result[2]))\r\n}\r\nconst is_no_tch = /no_tch=1/g.test(api.url)\r\nconst has_teacher = /teacher_id=.+?(?=&)/g.test(api.url)\r\nif (is_no_tch && has_teacher) {\r\n const teacher = /teacher_id=.+?(?=&)/g.exec(api.url)\r\n api.url = api.url.replace(teacher, 'or=('.concat(teacher, ',teacher_id.is.null)')).replace('teacher_id=', 'teacher_id.')\r\n api.url = api.url.replace(/no_tch=1/g, '')\r\n} else if (is_no_tch && !has_teacher) {\r\n api.url = api.url.replace(/no_tch=1/g, 'teacher_id=is.null')\r\n}\r\nconst is_public = /public=1/g.test(api.url)\r\nconst has_course = /course_id=.+?(?=&)/g.test(api.url)\r\nif (is_public && has_course) {\r\n const course = /course_id=.+?(?=&)/g.exec(api.url)\r\n api.url = api.url.replace(course, 'or=('.concat(course, ',course_id.is.null)')).replace('course_id=', 'course_id.')\r\n api.url = api.url.replace(/public=1/g, '')\r\n} else if (is_public && !has_course) {\r\n api.url = api.url.replace(/public=1/g, 'course_id=is.null')\r\n}\r\nreturn {\r\n ...api\r\n}",
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
type: 'tpl',
|
|||
|
|
label: '实验',
|
|||
|
|
tpl: '<% if(!this.course_id) { %>\n <span class="label label-info">公共</span><span> <%= this.project_name %> <span>\n<% } else {%>\n <span> <%= this.project_name %> <span>\n<% } %>',
|
|||
|
|
inline: false,
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{ name: 'day', label: '日期', type: 'text', placeholder: '-' },
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '节次',
|
|||
|
|
name: 'period_name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '地点',
|
|||
|
|
name: 'location_name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '教师',
|
|||
|
|
name: 'teacher_name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'button-group',
|
|||
|
|
label: '操作',
|
|||
|
|
placeholder: '-',
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
type: 'button',
|
|||
|
|
label: '成绩信息',
|
|||
|
|
actionType: 'dialog',
|
|||
|
|
dialog: {
|
|||
|
|
type: 'dialog',
|
|||
|
|
title: '成绩信息',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
title: '表单',
|
|||
|
|
reload: 'grade?org=$org&empty=$empty',
|
|||
|
|
submitOnChange: true,
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
label: '班级',
|
|||
|
|
type: 'tree-select',
|
|||
|
|
name: 'org',
|
|||
|
|
options: [],
|
|||
|
|
mode: 'inline',
|
|||
|
|
size: 'md',
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/orgs?select=*&path=cd.root&order=code.asc',
|
|||
|
|
adaptor:
|
|||
|
|
"const recursive = id => {\r\n let nodes = payload.data.items.filter(x => {\r\n return x.parent === id\r\n })\r\n return nodes.map(item => {\r\n return {\r\n ...item,\r\n label: item.name,\r\n value: `${item.id}`,\r\n children: recursive(item.id)\r\n }\r\n })\r\n}\r\nlet school = payload.data.items.find(x => x.type === 'school');\r\nreturn {\r\n ...payload,\r\n data: [{\r\n label: school.name,\r\n value: `${school.id}`,\r\n children: recursive(school.id)\r\n }]\r\n}",
|
|||
|
|
},
|
|||
|
|
heightAuto: true,
|
|||
|
|
virtualThreshold: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'switch',
|
|||
|
|
option: '仅显示缺失成绩',
|
|||
|
|
name: 'empty',
|
|||
|
|
value: false,
|
|||
|
|
mode: 'inline',
|
|||
|
|
optionAtLeft: false,
|
|||
|
|
trueValue: true,
|
|||
|
|
falseValue: false,
|
|||
|
|
className: '',
|
|||
|
|
id: 'u:31842909c573',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{ type: 'divider', lineStyle: 'solid' },
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/user2projects_ex?select=*,users:users!user2project_student_id_fkey(code)&schedule_status=in.(elected,free_schedule)&project_id=eq.$project_id&schedule_id=eq.$id&order=organization_name,user_name',
|
|||
|
|
adaptor: '',
|
|||
|
|
data: {
|
|||
|
|
page: '$page',
|
|||
|
|
perPage: '$perPage',
|
|||
|
|
organization_id: 'eq.$org',
|
|||
|
|
empty: '$empty',
|
|||
|
|
},
|
|||
|
|
requestAdaptor:
|
|||
|
|
"if (api.body.organization_id === 'eq.') {\r\n api.url = api.url.replace('&organization_id=eq.', '')\r\n}\r\n\r\nif (api.body.empty === '') {\r\n api.url = api.url.replace('&empty=', '')\r\n} else if (api.body.empty) {\r\n api.url = api.url.replace('&empty=true', '')\r\n api.url += '&project_score->>notebook_score=is.null'\r\n} else {\r\n api.url = api.url.replace('&empty=false', '')\r\n}\r\n\r\nreturn {\r\n ...api\r\n}",
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
name: 'users.code',
|
|||
|
|
label: '学号',
|
|||
|
|
type: 'text',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'user_name',
|
|||
|
|
label: '姓名',
|
|||
|
|
type: 'text',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '班级',
|
|||
|
|
name: 'organization_name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '在线学习成绩',
|
|||
|
|
name: 'project_score.notebook_score',
|
|||
|
|
placeholder: '-',
|
|||
|
|
quickEdit: {
|
|||
|
|
mode: 'popOver',
|
|||
|
|
saveImmediately: {
|
|||
|
|
api: {
|
|||
|
|
method: 'post',
|
|||
|
|
url: 'rest/project_scores?on_conflict=project_id,user_id,item',
|
|||
|
|
data: {
|
|||
|
|
score:
|
|||
|
|
'${project_score.notebook_score}',
|
|||
|
|
user_id: '$user_id',
|
|||
|
|
project_id: '$project_id',
|
|||
|
|
item: 'exp_notebook',
|
|||
|
|
},
|
|||
|
|
headers: {
|
|||
|
|
Prefer: 'resolution=merge-duplicates',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
type: 'input-number',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
affixHeader: false,
|
|||
|
|
syncLocation: false,
|
|||
|
|
name: 'grade',
|
|||
|
|
headerToolbar: [
|
|||
|
|
{
|
|||
|
|
type: 'tpl',
|
|||
|
|
tpl: '${stu_title}',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'button',
|
|||
|
|
label: '导入',
|
|||
|
|
actionType: 'dialog',
|
|||
|
|
dialog: {
|
|||
|
|
type: 'dialog',
|
|||
|
|
title: '成绩导入',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
title: '表单',
|
|||
|
|
controls: [
|
|||
|
|
{
|
|||
|
|
label: '学生有两个成绩时',
|
|||
|
|
type: 'select',
|
|||
|
|
name: 'mode',
|
|||
|
|
mode: 'inline',
|
|||
|
|
options: [
|
|||
|
|
{
|
|||
|
|
label: '使用旧成绩',
|
|||
|
|
value: 'old',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '使用导入成绩',
|
|||
|
|
value: 'new',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
size: 'sm',
|
|||
|
|
checkAll: false,
|
|||
|
|
required: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'excel-import',
|
|||
|
|
name: 'excel',
|
|||
|
|
label: '',
|
|||
|
|
mode: 'inline',
|
|||
|
|
visibleOn: 'this.mode',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'hidden',
|
|||
|
|
name: 'score_item',
|
|||
|
|
value: 'exp_notebook',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'table',
|
|||
|
|
name: 'excel',
|
|||
|
|
label: '',
|
|||
|
|
columns: [
|
|||
|
|
{ label: '学号', name: 'code' },
|
|||
|
|
{ label: '姓名', name: 'user' },
|
|||
|
|
{
|
|||
|
|
label: '当前成绩',
|
|||
|
|
name: 'old_score',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '导入成绩',
|
|||
|
|
name: 'new_score',
|
|||
|
|
quickEdit: {
|
|||
|
|
type: 'number',
|
|||
|
|
mode: 'inline',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
mode: 'normal',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
api: {
|
|||
|
|
method: 'post',
|
|||
|
|
url: 'rest/project_scores?on_conflict=project_id,user_id,item',
|
|||
|
|
data: {
|
|||
|
|
mode: '$mode',
|
|||
|
|
excel: '$excel',
|
|||
|
|
},
|
|||
|
|
requestAdaptor:
|
|||
|
|
"if (api.data.mode === 'old') {\r\n return {\r\n ...api,\r\n data: api.data.excel.filter(\r\n f_item => f_item.new_score && f_item.old_score === null\r\n ).map(item => {\r\n return {\r\n project_id: item.project_id,\r\n user_id: item.user_id,\r\n item: item.item,\r\n score: Number(item.new_score)\r\n }\r\n })\r\n }\r\n} else if (api.data.mode === 'new') {\r\n return {\r\n ...api,\r\n data: api.data.excel.filter(\r\n f_item => f_item.new_score\r\n ).map(item => {\r\n return {\r\n project_id: item.project_id,\r\n user_id: item.user_id,\r\n item: item.item,\r\n score: Number(item.new_score)\r\n }\r\n })\r\n }\r\n}",
|
|||
|
|
},
|
|||
|
|
initApi: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/user2projects_ex?select=*,users:users!user2project_student_id_fkey(code)&schedule_status=in.(elected,free_schedule)&project_id=eq.$project_id&schedule_id=eq.$id&att_status=in.(att_y,att_y_late,att_y_unclean)&order=organization_name,user_name',
|
|||
|
|
data: null,
|
|||
|
|
},
|
|||
|
|
reload: 'grade',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
closeOnEsc: true,
|
|||
|
|
showCloseButton: true,
|
|||
|
|
size: 'xl',
|
|||
|
|
},
|
|||
|
|
level: 'primary',
|
|||
|
|
align: 'right',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
footerToolbar: [
|
|||
|
|
{ type: 'pagination' },
|
|||
|
|
{ type: 'switch-per-page', tpl: '内容' },
|
|||
|
|
],
|
|||
|
|
hideQuickSaveBtn: true,
|
|||
|
|
pageField: 'page',
|
|||
|
|
perPageField: 'perPage',
|
|||
|
|
perPageAvailable: [10, 20, 30, 40, 50],
|
|||
|
|
visibleOn:
|
|||
|
|
'this.user.role === "dev" || this.user.role === "admin" || this.user.role === "centreadmin" || (this.user.role === "teacher" && this.user.id===this.teacher_id)',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/user2projects_ex?select=*,users:users!user2project_student_id_fkey(code)&schedule_status=in.(elected,free_schedule)&project_id=eq.$project_id&schedule_id=eq.$id&order=organization_name,user_name',
|
|||
|
|
adaptor: '',
|
|||
|
|
data: {
|
|||
|
|
page: '$page',
|
|||
|
|
perPage: '$perPage',
|
|||
|
|
organization_id: 'eq.$org',
|
|||
|
|
empty: '$empty',
|
|||
|
|
},
|
|||
|
|
requestAdaptor:
|
|||
|
|
"if (api.body.organization_id === 'eq.') {\r\n api.url = api.url.replace('&organization_id=eq.', '')\r\n}\r\n\r\nif (api.body.empty === '') {\r\n api.url = api.url.replace('&empty=', '')\r\n} else if (api.body.empty) {\r\n api.url = api.url.replace('&empty=true', '')\r\n api.url += '&project_score->>notebook_score=is.null'\r\n} else {\r\n api.url = api.url.replace('&empty=false', '')\r\n}\r\n\r\nreturn {\r\n ...api\r\n}",
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
name: 'users.code',
|
|||
|
|
label: '学号',
|
|||
|
|
type: 'text',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'user_name',
|
|||
|
|
label: '姓名',
|
|||
|
|
type: 'text',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '班级',
|
|||
|
|
name: 'organization_name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '在线学习成绩',
|
|||
|
|
name: 'project_score.notebook_score',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
affixHeader: false,
|
|||
|
|
syncLocation: false,
|
|||
|
|
name: 'grade',
|
|||
|
|
headerToolbar: [
|
|||
|
|
{
|
|||
|
|
type: 'tpl',
|
|||
|
|
tpl: '${stu_title}',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
footerToolbar: [
|
|||
|
|
{ type: 'pagination' },
|
|||
|
|
{ type: 'switch-per-page', tpl: '内容' },
|
|||
|
|
],
|
|||
|
|
hideQuickSaveBtn: true,
|
|||
|
|
pageField: 'page',
|
|||
|
|
perPageField: 'perPage',
|
|||
|
|
perPageAvailable: [10, 20, 30, 40, 50],
|
|||
|
|
visibleOn:
|
|||
|
|
'this.user.role === "teacher" && this.user.id!==this.teacher_id',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
size: 'lg',
|
|||
|
|
actions: [],
|
|||
|
|
closeOnEsc: true,
|
|||
|
|
showCloseButton: true,
|
|||
|
|
closeOnOutside: false,
|
|||
|
|
},
|
|||
|
|
level: 'primary',
|
|||
|
|
size: 'xs',
|
|||
|
|
visibleOn: '',
|
|||
|
|
className: 'm-r-xs',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
syncLocation: false,
|
|||
|
|
pageField: 'page',
|
|||
|
|
perPageField: 'perPage',
|
|||
|
|
headerToolbar: [],
|
|||
|
|
footerToolbar: [
|
|||
|
|
{ type: 'pagination', tpl: '内容' },
|
|||
|
|
{ type: 'switch-per-page', tpl: '内容' },
|
|||
|
|
],
|
|||
|
|
name: 'manage_loc',
|
|||
|
|
perPageAvailable: [10, 20, 30, 40, 50],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
className: 'p-t-none',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '自由安排',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
columns: [
|
|||
|
|
{ type: 'text', label: '编号', name: 'code' },
|
|||
|
|
{ name: 'name', type: 'text', label: '课程' },
|
|||
|
|
{
|
|||
|
|
type: 'button-group',
|
|||
|
|
label: '操作',
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
type: 'button',
|
|||
|
|
label: '查看项目',
|
|||
|
|
actionType: 'dialog',
|
|||
|
|
dialog: {
|
|||
|
|
type: 'dialog',
|
|||
|
|
title: '项目信息',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/course2projects?select=*,projects(*)&course_id=eq.$id',
|
|||
|
|
data: { page: '$page', perPage: '$perPage' },
|
|||
|
|
adaptor:
|
|||
|
|
'let free, not_free\r\nfree = payload.data.items.filter(\r\n item => item.projects.free_schedule\r\n ).sort(\r\n (a, b) => a.projects.code.localeCompare(b.projects.code)\r\n )\r\nnot_free = payload.data.items.filter(\r\n item => !item.projects.free_schedule\r\n ).sort(\r\n (a, b) => a.projects.code.localeCompare(b.projects.code)\r\n )\r\nreturn {\r\n ...payload,\r\n data: {\r\n ...payload.data,\r\n items: not_free.concat(free)\r\n }\r\n}',
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
name: 'projects.code',
|
|||
|
|
label: '编号',
|
|||
|
|
type: 'text',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'projects.name',
|
|||
|
|
label: '项目',
|
|||
|
|
type: 'tpl',
|
|||
|
|
placeholder: '-',
|
|||
|
|
tpl: '<% if(this.projects && this.projects.free_schedule) { %>\n <span class="label label-info">自由安排</span><span><%= this.projects.name %></span>\n<% } else if(this.projects) { %>\n <span><%= this.projects.name %></span>\n<% } %>',
|
|||
|
|
inline: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'button-group',
|
|||
|
|
label: '操作',
|
|||
|
|
placeholder: '-',
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
type: 'button',
|
|||
|
|
label: '成绩信息',
|
|||
|
|
actionType: 'dialog',
|
|||
|
|
dialog: {
|
|||
|
|
type: 'dialog',
|
|||
|
|
title: '成绩信息',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
title: '表单',
|
|||
|
|
submitOnChange: true,
|
|||
|
|
reload: 'grade?org=$org&empty=$empty',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'tree-select',
|
|||
|
|
label: '班级',
|
|||
|
|
name: 'org',
|
|||
|
|
mode: 'inline',
|
|||
|
|
options: [],
|
|||
|
|
size: 'md',
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/orgs?select=*&path=cd.root&order=code.asc',
|
|||
|
|
adaptor:
|
|||
|
|
"const recursive = id => {\r\n let nodes = payload.data.items.filter(x => {\r\n return x.parent === id\r\n })\r\n return nodes.map(item => {\r\n return {\r\n ...item,\r\n label: item.name,\r\n value: `${item.id}`,\r\n children: recursive(item.id)\r\n }\r\n })\r\n}\r\nlet school = payload.data.items.find(x => x.type === 'school');\r\nreturn {\r\n ...payload,\r\n data: [{\r\n label: school.name,\r\n value: `${school.id}`,\r\n children: recursive(school.id)\r\n }]\r\n}",
|
|||
|
|
},
|
|||
|
|
heightAuto: true,
|
|||
|
|
virtualThreshold: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'switch',
|
|||
|
|
option: '仅显示缺失成绩',
|
|||
|
|
name: 'empty',
|
|||
|
|
value: false,
|
|||
|
|
mode: 'inline',
|
|||
|
|
optionAtLeft: false,
|
|||
|
|
trueValue: true,
|
|||
|
|
falseValue: false,
|
|||
|
|
className: '',
|
|||
|
|
id: 'u:31842909c573',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{ type: 'divider', lineStyle: 'solid' },
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/user2projects_ex?select=*,users:users!user2project_student_id_fkey(code)&schedule_status=in.(elected,free_schedule)&project_id=eq.$project_id&course_id=eq.$selected_course_id&semester_id=eq.$currentSemester&order=organization_name,user_name',
|
|||
|
|
adaptor: '',
|
|||
|
|
data: {
|
|||
|
|
page: '$page',
|
|||
|
|
perPage: '$perPage',
|
|||
|
|
organization_id: 'eq.$org',
|
|||
|
|
empty: '$empty'
|
|||
|
|
},
|
|||
|
|
requestAdaptor:
|
|||
|
|
"if (api.body.organization_id === 'eq.') {\r\n api.url = api.url.replace('&organization_id=eq.', '')\r\n}\r\n\r\nif (api.body.empty === '') {\r\n api.url = api.url.replace('&empty=', '')\r\n} else if (api.body.empty) {\r\n api.url = api.url.replace('&empty=true', '')\r\n api.url += '&project_score->>notebook_score=is.null'\r\n} else {\r\n api.url = api.url.replace('&empty=false', '')\r\n}\r\n\r\nreturn {\r\n ...api\r\n}",
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
label: '学号',
|
|||
|
|
type: 'text',
|
|||
|
|
name: 'users.code',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'user_name',
|
|||
|
|
label: '姓名',
|
|||
|
|
type: 'text',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
name: 'organization_name',
|
|||
|
|
label: '班级',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
name: 'project_score.notebook_score',
|
|||
|
|
label: '在线学习成绩',
|
|||
|
|
placeholder: '-',
|
|||
|
|
quickEdit: {
|
|||
|
|
mode: 'popOver',
|
|||
|
|
saveImmediately: {
|
|||
|
|
api: {
|
|||
|
|
method: 'post',
|
|||
|
|
url: 'rest/project_scores?on_conflict=project_id,user_id,item',
|
|||
|
|
data: {
|
|||
|
|
score:
|
|||
|
|
'${project_score.notebook_score}',
|
|||
|
|
user_id: '$user_id',
|
|||
|
|
project_id: '$project_id',
|
|||
|
|
item: 'exp_notebook',
|
|||
|
|
},
|
|||
|
|
headers: {
|
|||
|
|
Prefer:
|
|||
|
|
'resolution=merge-duplicates',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
type: 'input-number',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
syncLocation: false,
|
|||
|
|
pageField: 'page',
|
|||
|
|
perPageField: 'perPage',
|
|||
|
|
headerToolbar: [
|
|||
|
|
{
|
|||
|
|
type: 'button',
|
|||
|
|
label: '导入',
|
|||
|
|
actionType: 'dialog',
|
|||
|
|
dialog: {
|
|||
|
|
type: 'dialog',
|
|||
|
|
title: '成绩导入',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
title: '表单',
|
|||
|
|
controls: [
|
|||
|
|
{
|
|||
|
|
label:
|
|||
|
|
'学生有两个成绩时',
|
|||
|
|
type: 'select',
|
|||
|
|
name: 'mode',
|
|||
|
|
mode: 'inline',
|
|||
|
|
options: [
|
|||
|
|
{
|
|||
|
|
label: '使用旧成绩',
|
|||
|
|
value: 'old',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label:
|
|||
|
|
'使用导入成绩',
|
|||
|
|
value: 'new',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
size: 'sm',
|
|||
|
|
checkAll: false,
|
|||
|
|
required: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'excel-import',
|
|||
|
|
name: 'excel',
|
|||
|
|
label: '',
|
|||
|
|
mode: 'inline',
|
|||
|
|
visibleOn: 'this.mode',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'hidden',
|
|||
|
|
name: 'score_item',
|
|||
|
|
value: 'exp_notebook',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'table',
|
|||
|
|
name: 'excel',
|
|||
|
|
label: '',
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
label: '学号',
|
|||
|
|
name: 'code',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '姓名',
|
|||
|
|
name: 'user',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '当前成绩',
|
|||
|
|
name: 'old_score',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
label: '导入成绩',
|
|||
|
|
name: 'new_score',
|
|||
|
|
quickEdit: {
|
|||
|
|
type: 'number',
|
|||
|
|
mode: 'inline',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
mode: 'normal',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
api: {
|
|||
|
|
method: 'post',
|
|||
|
|
url: 'rest/project_scores?on_conflict=project_id,user_id,item',
|
|||
|
|
data: {
|
|||
|
|
excel: '$excel',
|
|||
|
|
mode: '$mode',
|
|||
|
|
},
|
|||
|
|
requestAdaptor:
|
|||
|
|
"if (api.data.mode === 'old') {\r\n return {\r\n ...api,\r\n data: api.data.excel.filter(\r\n f_item => f_item.new_score && f_item.old_score === null\r\n ).map(item => {\r\n return {\r\n project_id: item.project_id,\r\n user_id: item.user_id,\r\n item: item.item,\r\n score: Number(item.new_score)\r\n }\r\n })\r\n }\r\n} else if (api.data.mode === 'new') {\r\n return {\r\n ...api,\r\n data: api.data.excel.filter(\r\n f_item => f_item.new_score\r\n ).map(item => {\r\n return {\r\n project_id: item.project_id,\r\n user_id: item.user_id,\r\n item: item.item,\r\n score: Number(item.new_score)\r\n }\r\n })\r\n }\r\n}",
|
|||
|
|
},
|
|||
|
|
initApi: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/user2projects_ex?select=*,users:users!user2project_student_id_fkey(code)&schedule_status=in.(elected,free_schedule)&project_id=eq.$project_id&course_id=eq.$selected_course_id&semester_id=eq.$currentSemester&order=organization_name,user_name',
|
|||
|
|
data: null,
|
|||
|
|
},
|
|||
|
|
reload: 'grade',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
closeOnEsc: true,
|
|||
|
|
showCloseButton: true,
|
|||
|
|
size: 'xl',
|
|||
|
|
},
|
|||
|
|
level: 'primary',
|
|||
|
|
align: 'right',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
footerToolbar: [
|
|||
|
|
{ type: 'pagination' },
|
|||
|
|
{
|
|||
|
|
type: 'switch-per-page',
|
|||
|
|
tpl: '内容',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
name: 'grade',
|
|||
|
|
affixHeader: false,
|
|||
|
|
hideQuickSaveBtn: true,
|
|||
|
|
perPageAvailable: [
|
|||
|
|
10, 20, 30, 40, 50,
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
size: 'lg',
|
|||
|
|
actions: [],
|
|||
|
|
closeOnEsc: true,
|
|||
|
|
showCloseButton: true,
|
|||
|
|
},
|
|||
|
|
size: 'xs',
|
|||
|
|
level: 'primary',
|
|||
|
|
visibleOn: 'this.projects.free_schedule',
|
|||
|
|
className: 'm-r-xs',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
syncLocation: false,
|
|||
|
|
headerToolbar: [],
|
|||
|
|
affixHeader: false,
|
|||
|
|
name: 'project_view',
|
|||
|
|
footerToolbar: [{ type: 'pagination' }],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
size: 'lg',
|
|||
|
|
actions: [],
|
|||
|
|
closeOnEsc: true,
|
|||
|
|
showCloseButton: true,
|
|||
|
|
},
|
|||
|
|
level: 'primary',
|
|||
|
|
size: 'xs',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/courses?organization_id=eq.$centre_id&semester_id=eq.$currentSemester&order=code',
|
|||
|
|
data: { page: '$page', perPage: '$perPage' },
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: {\r\n ...payload.data,\r\n items: payload.data.items.map(item => {\r\n return {\r\n ...item,\r\n selected_course_id: item.id\r\n }\r\n })\r\n }\r\n}',
|
|||
|
|
},
|
|||
|
|
messages: {},
|
|||
|
|
syncLocation: false,
|
|||
|
|
pageField: 'page',
|
|||
|
|
perPageField: 'perPage',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
className: 'p-t-none',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: '学生一览',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'grid',
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
md: 3,
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
reload:
|
|||
|
|
'stu?parent=${tree}&tree=${tree}&org_name=${name}&type=${type}&filter=${filter}',
|
|||
|
|
data: { parentId: 1 },
|
|||
|
|
wrapWithPanel: false,
|
|||
|
|
title: '表单',
|
|||
|
|
submitOnChange: true,
|
|||
|
|
target: '',
|
|||
|
|
resetAfterSubmit: false,
|
|||
|
|
initApi: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/orgs?type=eq.school',
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: {\r\n tree: payload.data.id\r\n }\r\n}',
|
|||
|
|
headers: {
|
|||
|
|
Accept: 'application/vnd.pgrst.object+json',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'service',
|
|||
|
|
name: 'service',
|
|||
|
|
messages: {},
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/orgs/${tree}',
|
|||
|
|
sendOn: 'this.tree',
|
|||
|
|
},
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
label: '部门类型',
|
|||
|
|
name: 'type',
|
|||
|
|
visibleOn: 'false',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
label: '部门名称',
|
|||
|
|
name: 'name',
|
|||
|
|
visibleOn: 'false',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
label: '部门Path',
|
|||
|
|
name: 'path',
|
|||
|
|
visibleOn: 'false',
|
|||
|
|
value: 'root',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
label: '过滤条件',
|
|||
|
|
name: 'filter',
|
|||
|
|
visibleOn: 'false',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'formula',
|
|||
|
|
name: 'filter',
|
|||
|
|
formula:
|
|||
|
|
"'org_path.cd.' + data.path + '.' + data.tree + ',org_id.eq.' + data.tree",
|
|||
|
|
condition: 'data.tree',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'formula',
|
|||
|
|
name: 'filter',
|
|||
|
|
formula: "'org_path.cd.root'",
|
|||
|
|
condition: '!data.tree',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'input-tree',
|
|||
|
|
label: '',
|
|||
|
|
name: 'tree',
|
|||
|
|
inputClassName: 'partment-height',
|
|||
|
|
creatable: false,
|
|||
|
|
removable: false,
|
|||
|
|
editable: false,
|
|||
|
|
deleteApi: 'rest/orgs/$id',
|
|||
|
|
rootCreatable: false,
|
|||
|
|
unfoldedLevel: 1,
|
|||
|
|
initiallyOpen: false,
|
|||
|
|
virtualThreshold: false,
|
|||
|
|
source: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/orgs?select=*&path=cd.root&order=code.asc',
|
|||
|
|
adaptor:
|
|||
|
|
"const recursive = id => {\r\n let nodes = payload.data.items.filter(x => {\r\n return x.parent === id\r\n })\r\n return nodes.map(item => {\r\n return {\r\n ...item,\r\n label: item.name,\r\n value: `${item.id}`,\r\n children: recursive(item.id)\r\n }\r\n })\r\n}\r\nlet school = payload.data.items.find(x => x.type === 'school');\r\nreturn {\r\n ...payload,\r\n data: [{\r\n label: school.name,\r\n value: `${school.id}`,\r\n children: recursive(school.id)\r\n }]\r\n}",
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
md: 9,
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
name: 'service',
|
|||
|
|
type: 'service',
|
|||
|
|
messages: {},
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/orgs/${tree}',
|
|||
|
|
sendOn: 'this.tree',
|
|||
|
|
adaptor:
|
|||
|
|
"let role_items = [];\r\nif(payload.data.type === '')\r\nreturn {\r\n ...payload,\r\n data: {\r\n ...payload.data,\r\n role_items: payload.data.\r\n }\r\n}",
|
|||
|
|
},
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
label: '部门类型',
|
|||
|
|
name: 'type',
|
|||
|
|
visibleOn: 'false',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
label: '部门名称',
|
|||
|
|
name: 'name',
|
|||
|
|
visibleOn: 'false',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
name: 'stu',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/users_ex?and=(or(${filter}),or(code.like.*${keywords}*,name.like.*${keywords}*),role.eq.student)&org_type=eq.class&order=code',
|
|||
|
|
adaptor:
|
|||
|
|
'return {\r\n ...payload,\r\n data: {\r\n ...payload.data,\r\n items: payload.data.items.map(item => {\r\n return {\r\n ...item,\r\n stu_id: item.id\r\n }\r\n })\r\n }\r\n}',
|
|||
|
|
data: { page: '$page', perPage: '${perPage}' },
|
|||
|
|
requestAdaptor:
|
|||
|
|
'api.url = api.url.replace(/and=([^&]*?)&/g, (match, p1) => {\r\n let encodeAnd = window.btoa(p1);\r\n\treturn `encodeAnd=${encodeAnd}&`;\r\n});',
|
|||
|
|
sendOn: 'this.filter',
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
name: 'code',
|
|||
|
|
type: 'text',
|
|||
|
|
label: '账号',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '姓名',
|
|||
|
|
name: 'name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '部门',
|
|||
|
|
name: 'org_name',
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'button-group',
|
|||
|
|
label: '操作',
|
|||
|
|
buttons: [
|
|||
|
|
{
|
|||
|
|
type: 'button',
|
|||
|
|
label: '成绩明细',
|
|||
|
|
actionType: 'dialog',
|
|||
|
|
dialog: {
|
|||
|
|
type: 'dialog',
|
|||
|
|
title: '成绩明细',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'crud',
|
|||
|
|
api: {
|
|||
|
|
method: 'get',
|
|||
|
|
url: 'rest/user2projects_ex?select=*,courses:courses!user2project_course_id_fkey(*),projects:projects!user2project_project_id_fkey(*)&user_id=eq.${id}&schedule_status=in.(elected,free_schedule)&semester_id=eq.$currentSemester&order=created_at.asc',
|
|||
|
|
data: {
|
|||
|
|
page: '$page',
|
|||
|
|
perPage: '$perPage',
|
|||
|
|
},
|
|||
|
|
adaptor: '',
|
|||
|
|
},
|
|||
|
|
columns: [
|
|||
|
|
{
|
|||
|
|
name: 'courses.name',
|
|||
|
|
label: '课程',
|
|||
|
|
type: 'text',
|
|||
|
|
placeholder: '-',
|
|||
|
|
inline: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
name: 'projects.name',
|
|||
|
|
label: '项目',
|
|||
|
|
type: 'text',
|
|||
|
|
placeholder: '-',
|
|||
|
|
inline: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'text',
|
|||
|
|
label: '在线学习成绩',
|
|||
|
|
name: 'project_score.notebook_score',
|
|||
|
|
placeholder: '-',
|
|||
|
|
quickEdit: {
|
|||
|
|
mode: 'popOver',
|
|||
|
|
saveImmediately: {
|
|||
|
|
api: {
|
|||
|
|
method: 'post',
|
|||
|
|
url: 'rest/project_scores?on_conflict=project_id,user_id,item',
|
|||
|
|
data: {
|
|||
|
|
score:
|
|||
|
|
'${project_score.notebook_score}',
|
|||
|
|
user_id: '$user_id',
|
|||
|
|
project_id: '$project_id',
|
|||
|
|
item: 'exp_notebook',
|
|||
|
|
},
|
|||
|
|
headers: {
|
|||
|
|
Prefer:
|
|||
|
|
'resolution=merge-duplicates',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
type: 'input-number',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
syncLocation: false,
|
|||
|
|
affixHeader: false,
|
|||
|
|
headerToolbar: [],
|
|||
|
|
name: 'stu_view',
|
|||
|
|
loadDataOnce: false,
|
|||
|
|
hideQuickSaveBtn: true,
|
|||
|
|
perPageAvailable: [10, 20, 30, 40, 50],
|
|||
|
|
footerToolbar: [
|
|||
|
|
{ type: 'pagination' },
|
|||
|
|
{
|
|||
|
|
type: 'switch-per-page',
|
|||
|
|
tpl: '内容',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
actions: [],
|
|||
|
|
closeOnEsc: true,
|
|||
|
|
showCloseButton: true,
|
|||
|
|
size: 'lg',
|
|||
|
|
},
|
|||
|
|
level: 'primary',
|
|||
|
|
size: 'xs',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
placeholder: '-',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
messages: {},
|
|||
|
|
className: '',
|
|||
|
|
headerToolbar: [],
|
|||
|
|
md: 9,
|
|||
|
|
syncLocation: false,
|
|||
|
|
footerToolbar: [
|
|||
|
|
{
|
|||
|
|
type: 'form',
|
|||
|
|
wrapWithPanel: false,
|
|||
|
|
reload: 'stu?perPage=${perPage}',
|
|||
|
|
submitOnChange: true,
|
|||
|
|
submitOnInit: false,
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'select',
|
|||
|
|
name: 'perPage',
|
|||
|
|
value: '10',
|
|||
|
|
options: [
|
|||
|
|
{ label: '默认', value: '17' },
|
|||
|
|
{ label: '10', value: '10' },
|
|||
|
|
{ label: '20', value: '20' },
|
|||
|
|
{ label: '50', value: '50' },
|
|||
|
|
{ label: '100', value: '100' },
|
|||
|
|
{ label: '500', value: '500' },
|
|||
|
|
],
|
|||
|
|
label: '每页显示',
|
|||
|
|
mode: 'inline',
|
|||
|
|
checkAll: false,
|
|||
|
|
className: 'm-t-sm',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
{ type: 'pagination' },
|
|||
|
|
],
|
|||
|
|
perPageAvailable: '',
|
|||
|
|
columnsTogglable: 'auto',
|
|||
|
|
filter: {
|
|||
|
|
title: '',
|
|||
|
|
affixFooter: false,
|
|||
|
|
actions: [],
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'input-group',
|
|||
|
|
name: 'keywords',
|
|||
|
|
label: '学号或姓名 ',
|
|||
|
|
body: [
|
|||
|
|
{
|
|||
|
|
type: 'input-text',
|
|||
|
|
placeholder: '',
|
|||
|
|
inputClassName: 'b-r-none p-r-none',
|
|||
|
|
name: 'keywords',
|
|||
|
|
size: 'md',
|
|||
|
|
clearable: true,
|
|||
|
|
value: '',
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
type: 'control',
|
|||
|
|
label: '',
|
|||
|
|
body: {
|
|||
|
|
type: 'submit',
|
|||
|
|
level: 'primary',
|
|||
|
|
actionType: 'submit',
|
|||
|
|
label: '搜索',
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
bulkActions: [],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
name: 'header',
|
|||
|
|
type: 'wrapper',
|
|||
|
|
size: 'xs',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
className: 'partment-grid',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
tabsMode: 'line',
|
|||
|
|
tabClassName: '',
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
type: 'page',
|
|||
|
|
title: '',
|
|||
|
|
messages: {},
|
|||
|
|
bodyClassName: '',
|
|||
|
|
className: '',
|
|||
|
|
headerClassName: '',
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
export { schema };
|