@@ -118,7 +118,6 @@ export default { | |||||
// 验证表单项输入是否正确,返回一个包含所有错误信息的数组 | // 验证表单项输入是否正确,返回一个包含所有错误信息的数组 | ||||
verifyForm() { | verifyForm() { | ||||
console.log(this.scheme) | |||||
const result = [] | const result = [] | ||||
Object.entries(this.scheme).forEach(([tableName, tableItem]) => { | Object.entries(this.scheme).forEach(([tableName, tableItem]) => { | ||||
if ('__GIRDTABLE__' in tableItem) { | if ('__GIRDTABLE__' in tableItem) { | ||||
@@ -12,57 +12,26 @@ | |||||
<view class="customlist-item" v-for="item of list" :key="item.Id"> | <view class="customlist-item" v-for="item of list" :key="item.Id"> | ||||
<view class="customlist-item-field"> | <view class="customlist-item-field"> | ||||
<text class="customlist-item-field-title">学年度:</text> | |||||
{{ displayListItem(item, 'AcademicYearNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">学期:</text> | |||||
{{ displayListItem(item, 'Semester') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">学号:</text> | |||||
{{ displayListItem(item, 'StuNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">姓名:</text> | |||||
{{ displayListItem(item, 'StuName') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">年级:</text> | |||||
{{ displayListItem(item, 'Grade') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">系所码:</text> | |||||
{{ displayListItem(item, 'DeptNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">系名:</text> | |||||
{{ displayListItem(item, 'DeptName') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">专业码:</text> | |||||
{{ displayListItem(item, 'MajorNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">专业名:</text> | |||||
{{ displayListItem(item, 'MajorName') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">所在行政班号:</text> | |||||
{{ displayListItem(item, 'ClassNo') }} | |||||
</view> | |||||
<l-customlist-action showButton buttonText="审核" @join="action('check',item.Id)" @view="action('view', item.Id)" /> | |||||
<text class="customlist-item-field-title">请假类型:</text> | |||||
{{ displayListItem(item, 'LeaveType') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">请假时间:</text> | |||||
{{ displayListItem(item, 'StartTime') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">返校时间:</text> | |||||
{{ displayListItem(item, 'EndTime') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">请假天数:</text> | |||||
{{ displayListItem(item, 'LeaveDay') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">审核状态:</text> | |||||
{{ displayListItem(item, 'CheckStatus') || '--' }} | |||||
</view> | |||||
<l-customlist-action :showButton="!checkDisable&&!item.CheckStatus&&item.CheckStatus!==0" buttonText="审核" @join="action('check',item)" showEdit @edit="action('edit', item.Id)" showDelete @delete="action('delete', item.Id)" @view="action('view', item.Id)" /> | |||||
</view> | </view> | ||||
</l-customlist> | </l-customlist> | ||||
</l-scroll-list> | </l-scroll-list> | ||||
@@ -77,7 +46,7 @@ | |||||
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | ||||
<view v-if="ready" class="padding"> | <view v-if="ready" class="padding"> | ||||
<l-input | |||||
<!-- <l-input | |||||
v-model="queryData.StuNo" | v-model="queryData.StuNo" | ||||
@change="searchChange" | @change="searchChange" | ||||
title ="学号" | title ="学号" | ||||
@@ -88,7 +57,23 @@ | |||||
@change="searchChange" | @change="searchChange" | ||||
title ="姓名" | title ="姓名" | ||||
placeholder="按姓名查询" | placeholder="按姓名查询" | ||||
/> | |||||
/> --> | |||||
<l-select | |||||
@input="(e)=>{queryData.LeaveType = e}" | |||||
:value="queryData.LeaveType" | |||||
@change="searchChange" | |||||
:range="dataSource.LeaveType" | |||||
title="请假类型" | |||||
/> | |||||
<l-select | |||||
@input="(e)=>{queryData.CheckStatus = e}" | |||||
:value="queryData.CheckStatus" | |||||
@change="searchChange" | |||||
:range="dataSource.CheckStatus" | |||||
title="审核状态" | |||||
/> | |||||
<!-- 重置查询条件按钮 --> | <!-- 重置查询条件按钮 --> | ||||
<view class="padding-tb"> | <view class="padding-tb"> | ||||
@@ -98,7 +83,17 @@ | |||||
</scroll-view> | </scroll-view> | ||||
<l-customlist-add v-if="!sideOpen" @click="action('add')" /> | <l-customlist-add v-if="!sideOpen" @click="action('add')" /> | ||||
<l-modal v-model="modal" @close="selectItem = null" type="bottom"> | |||||
<view slot="action" class="text-center" style="width: 100%;"> | |||||
审核 | |||||
</view> | |||||
<l-button @click="action('checkAgree','1')" color="blue" class="block" block>同意</l-button> | |||||
<l-button @click="action('checkAgree','2')" color="red" class="block margin-top-sm" block>不同意</l-button> | |||||
<l-button @click="modal = false" line="blue" class="block margin-top-sm" block>取消</l-button> | |||||
</l-modal> | |||||
</view> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
@@ -131,28 +126,28 @@ export default { | |||||
return { | return { | ||||
// 数据项的数据类型、结构 | // 数据项的数据类型、结构 | ||||
scheme: { | scheme: { | ||||
AcademicYearNo: { type: 'text' }, | |||||
Semester: { type: 'text' }, | |||||
StuNo: { type: 'text' }, | |||||
StuName: { type: 'text' }, | |||||
Grade: { type: 'text' }, | |||||
DeptNo: { type: 'text' }, | |||||
DeptName: { type: 'text' }, | |||||
MajorNo: { type: 'text' }, | |||||
MajorName: { type: 'text' }, | |||||
ClassNo: { type: 'text' }, | |||||
LeaveType:{ type: 'select', title: '请假类型' }, | |||||
StartTime:{ type: 'datetime', title: '开始时间', dateformat: '1' }, | |||||
EndTime:{ type: 'datetime', title: '返校时间', dateformat: '1' }, | |||||
LeaveDay:{ type: 'text', title: '请假天数' }, | |||||
// Files:{ type: 'upload', title: '附件上传'}, | |||||
// LeaveReason:{ type: 'textarea', title: '请假事由'} | |||||
CheckStatus:{ type: 'select', title: '审核状态' }, | |||||
}, | }, | ||||
// 查询条件 | // 查询条件 | ||||
searchData: {}, | searchData: {}, | ||||
defaultQueryData: {}, | defaultQueryData: {}, | ||||
queryData: { | |||||
StuNo: '', | |||||
StuName: '', | |||||
}, | |||||
queryData: { | |||||
CheckStatus:'', | |||||
LeaveType:'' | |||||
}, | |||||
// 数据源 | // 数据源 | ||||
dataSource: { | dataSource: { | ||||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | |||||
// CheckStatus:Object.values(this.GET_GLOBAL('dataDictionary').AuditStatus).map(t => ({ value: t.value, text: t.text })), | |||||
CheckStatus:[{text:'草稿',value:'0'},{text:'审核中',value:'1'},{text:'通过',value:'2'},{text:'不通过',value:'3'}] | |||||
}, | }, | ||||
// 页面相关参数 | // 页面相关参数 | ||||
@@ -164,7 +159,12 @@ export default { | |||||
// 列表与分页信息 | // 列表与分页信息 | ||||
page: 1, | page: 1, | ||||
total: 2, | total: 2, | ||||
list: [] | |||||
list: [], | |||||
checkDisable:true, | |||||
// 审核弹框 | |||||
modal:false, | |||||
selectItem:'', | |||||
} | } | ||||
}, | }, | ||||
@@ -178,6 +178,10 @@ export default { | |||||
methods: { | methods: { | ||||
// 页面初始化 | // 页面初始化 | ||||
async init() { | async init() { | ||||
console.log(this.GET_GLOBAL('loginUser')) | |||||
if(['教师','管理员'].includes(this.GET_GLOBAL('loginUser').Description)){ | |||||
this.checkDisable = false | |||||
} | |||||
this.ON('EducationalAdministrationStuAttendanceLeave-list-change', this.refreshList) | this.ON('EducationalAdministrationStuAttendanceLeave-list-change', this.refreshList) | ||||
// 拉取加载列表和数据源 | // 拉取加载列表和数据源 | ||||
@@ -193,15 +197,15 @@ export default { | |||||
}, | }, | ||||
// 拉取列表 | // 拉取列表 | ||||
async fetchList() { | |||||
async fetchList(isConcat=true) { | |||||
if (this.page > this.total) { return } | if (this.page > this.total) { return } | ||||
const result = await this.HTTP_GET( | const result = await this.HTTP_GET( | ||||
'learun/adms/EducationalAdministration/StuAttendanceLeave/pagelist', | |||||
'learun/adms/stuleavemanagement/pagelist', | |||||
{ | { | ||||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | ||||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | ||||
pagination: { rows: 10, page: this.page, sidx: 'Id', sord: 'DESC' }, | |||||
pagination: { rows: 10, page: this.page, sidx: 'CreateTime', sord: 'DESC' }, | |||||
queryJson: JSON.stringify(this.searchData) | queryJson: JSON.stringify(this.searchData) | ||||
}, | }, | ||||
'加载数据时出错' | '加载数据时出错' | ||||
@@ -211,19 +215,19 @@ export default { | |||||
this.total = result.total | this.total = result.total | ||||
this.page = result.page + 1 | this.page = result.page + 1 | ||||
this.list = this.list.concat(result.rows) | |||||
this.list = isConcat?this.list.concat(result.rows):result.rows; | |||||
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项` | this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项` | ||||
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多' | this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多' | ||||
}, | }, | ||||
// 刷新清空列表 | // 刷新清空列表 | ||||
async refreshList() { | |||||
async refreshList(isConcat=true) { | |||||
this.page = 1 | this.page = 1 | ||||
this.total = 2 | this.total = 2 | ||||
this.list = [] | this.list = [] | ||||
await this.fetchList() | |||||
await this.fetchList(isConcat) | |||||
}, | }, | ||||
// 列表下拉 | // 列表下拉 | ||||
@@ -242,7 +246,7 @@ export default { | |||||
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t))) | Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t))) | ||||
this.searchData = result | this.searchData = result | ||||
await this.refreshList() | |||||
await this.refreshList(false) | |||||
}, | }, | ||||
// 点击「清空查询条件」按钮 | // 点击「清空查询条件」按钮 | ||||
@@ -271,12 +275,29 @@ export default { | |||||
return | return | ||||
} | } | ||||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/delete', id, '删除失败').then(success => { | |||||
this.HTTP_POST('learun/adms/stuleavemanagement/delete', id, '删除失败').then(success => { | |||||
if(!success) { return } | if(!success) { return } | ||||
this.TOAST('删除成功', 'success') | this.TOAST('删除成功', 'success') | ||||
this.refreshList() | this.refreshList() | ||||
}) | }) | ||||
return | return | ||||
case 'check': | |||||
this.selectItem = id | |||||
this.modal = true | |||||
return | |||||
case 'checkAgree': | |||||
// if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||||
// return | |||||
// } | |||||
this.modal = false | |||||
this.HTTP_POST('learun/adms/stuleavemanagement/savecheck', {...this.selectItem,CheckStatus:id}, '提交失败').then(success => { | |||||
if(!success) { return } | |||||
this.TOAST('提交成功', 'success') | |||||
this.refreshList() | |||||
}) | |||||
return | |||||
default: | default: | ||||
return | return | ||||
@@ -1,146 +1,58 @@ | |||||
<template> | <template> | ||||
<view class="page"> | <view class="page"> | ||||
<view v-if="ready"> | <view v-if="ready"> | ||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.AcademicYearNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.AcademicYearNo')" | |||||
:disabled="!edit" | |||||
title="学年度" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.Semester', $event)" | |||||
:value="getValue('StuAttendanceLeave.Semester')" | |||||
:disabled="!edit" | |||||
title="学期" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.StuNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.StuNo')" | |||||
:disabled="!edit" | |||||
title="学号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.StuName', $event)" | |||||
:value="getValue('StuAttendanceLeave.StuName')" | |||||
:disabled="!edit" | |||||
title="姓名" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.Grade', $event)" | |||||
:value="getValue('StuAttendanceLeave.Grade')" | |||||
:disabled="!edit" | |||||
title="年级" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.EmpNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.EmpNo')" | |||||
:disabled="!edit" | |||||
title="教师号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.DeptNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.DeptNo')" | |||||
:disabled="!edit" | |||||
title="系所码" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.DeptName', $event)" | |||||
:value="getValue('StuAttendanceLeave.DeptName')" | |||||
:disabled="!edit" | |||||
title="系名" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.MajorNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.MajorNo')" | |||||
:disabled="!edit" | |||||
title="专业码" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.MajorName', $event)" | |||||
:value="getValue('StuAttendanceLeave.MajorName')" | |||||
:disabled="!edit" | |||||
title="专业名" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.ClassNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.ClassNo')" | |||||
:disabled="!edit" | |||||
title="所在行政班号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.ClassName', $event)" | |||||
:value="getValue('StuAttendanceLeave.ClassName')" | |||||
:disabled="!edit" | |||||
title="班级名称" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonNo')" | |||||
:disabled="!edit" | |||||
title="课程号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonName', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonName')" | |||||
:disabled="!edit" | |||||
title="课程名称" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonSortNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonSortNo')" | |||||
:disabled="!edit" | |||||
title="课程类别码" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonSortName', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonSortName')" | |||||
:disabled="!edit" | |||||
title="课程类别" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonDate', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonDate')" | |||||
:disabled="!edit" | |||||
title="原上课日期" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonTime', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonTime')" | |||||
:disabled="!edit" | |||||
title="上课时间" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.PlanWeek', $event)" | |||||
:value="getValue('StuAttendanceLeave.PlanWeek')" | |||||
:disabled="!edit" | |||||
title="教学周次" | |||||
/> | |||||
<l-select | <l-select | ||||
@input="setValue('StuAttendanceLeave.LeaveType', $event)" | |||||
:value="getValue('StuAttendanceLeave.LeaveType')" | |||||
@input="setValue('StuMail.LeaveType', $event)" | |||||
:value="getValue('StuMail.LeaveType')" | |||||
:disabled="!edit" | :disabled="!edit" | ||||
:range="dataSource.StuAttendanceLeave.LeaveType" | |||||
:range="dataSource.StuMail.LeaveType" | |||||
title="请假类型" | title="请假类型" | ||||
/> | /> | ||||
<l-datetime-picker | |||||
@input="setValue('StuMail.StartTime', $event)" | |||||
:value="getValue('StuMail.StartTime')" | |||||
:disabled="!edit" | |||||
:range="dataSource.StuMail.StartTime" | |||||
title="请假时间" | |||||
/> | |||||
<l-datetime-picker | |||||
@input="setValue('StuMail.EndTime', $event)" | |||||
:value="getValue('StuMail.EndTime')" | |||||
:disabled="!edit" | |||||
:range="dataSource.StuMail.EndTime" | |||||
title="返校时间" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuMail.LeaveDay', $event)" | |||||
:value="getValue('StuMail.LeaveDay')" | |||||
:disabled="!edit" | |||||
title="请假天数" | |||||
/> | |||||
<!-- <l-input | |||||
@input="setValue('StuMail.num', $event)" | |||||
:value="getValue('StuMail.num')" | |||||
:disabled="!edit" | |||||
title="未销假次数" | |||||
/> --> | |||||
<l-upload-file | |||||
@input="setValue('StuMail.Files', $event)" | |||||
:value="getValue('StuMail.Files')" | |||||
:readonly="!edit" | |||||
title="附件上传" | |||||
/> | |||||
<l-textarea | <l-textarea | ||||
@input="setValue('StuAttendanceLeave.Remark', $event)" | |||||
:value="getValue('StuAttendanceLeave.Remark')" | |||||
@input="setValue('StuMail.LeaveReason', $event)" | |||||
:value="getValue('StuMail.LeaveReason')" | |||||
:readonly="!edit" | :readonly="!edit" | ||||
title="备注" | |||||
/> | |||||
<l-select | |||||
@input="setValue('StuAttendanceLeave.IsCheck', $event)" | |||||
:value="getValue('StuAttendanceLeave.IsCheck')" | |||||
:disabled="!edit" | |||||
:range="dataSource.StuAttendanceLeave.IsCheck" | |||||
title="下拉框" | |||||
/> | |||||
<l-textarea | |||||
@input="setValue('StuAttendanceLeave.TecRemark', $event)" | |||||
:value="getValue('StuAttendanceLeave.TecRemark')" | |||||
:readonly="!edit" | |||||
title="备注" | |||||
/> | |||||
title="请假事由" | |||||
/> | |||||
<!-- <l-select | |||||
@input="setValue('StuMail.CheckStatus', $event)" | |||||
:value="getValue('StuMail.CheckStatus')" | |||||
:disabled="!edit" | |||||
:range="dataSource.StuMail.CheckStatus" | |||||
title="审核状态" | |||||
/> --> | |||||
</view> | </view> | ||||
<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;"> | <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;"> | ||||
@@ -156,7 +68,7 @@ | |||||
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block> | <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block> | ||||
删除 | 删除 | ||||
</l-button> | </l-button> | ||||
</view> | |||||
</view> | |||||
</view> | </view> | ||||
</template> | </template> | ||||
@@ -173,7 +85,7 @@ | |||||
/** | /** | ||||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | ||||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | * 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | ||||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/single", "style": { "navigationBarTitleText": "表单详情页" } } | |||||
* { "path": "pages/EducationalAdministration/StuMail/single", "style": { "navigationBarTitleText": "表单详情页" } } | |||||
* | * | ||||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | * (navigationBarTitleText 字段为本页面的标题文本,可以修改) | ||||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | ||||
@@ -201,39 +113,23 @@ export default { | |||||
// 表单项数据结构 | // 表单项数据结构 | ||||
scheme: { | scheme: { | ||||
StuAttendanceLeave: { | |||||
AcademicYearNo: { type: 'text', title: '学年度' }, | |||||
Semester: { type: 'text', title: '学期' }, | |||||
StuNo: { type: 'text', title: '学号' }, | |||||
StuName: { type: 'text', title: '姓名' }, | |||||
Grade: { type: 'text', title: '年级' }, | |||||
EmpNo: { type: 'text', title: '教师号' }, | |||||
DeptNo: { type: 'text', title: '系所码' }, | |||||
DeptName: { type: 'text', title: '系名' }, | |||||
MajorNo: { type: 'text', title: '专业码' }, | |||||
MajorName: { type: 'text', title: '专业名' }, | |||||
ClassNo: { type: 'text', title: '所在行政班号' }, | |||||
ClassName: { type: 'text', title: '班级名称' }, | |||||
LessonNo: { type: 'text', title: '课程号' }, | |||||
LessonName: { type: 'text', title: '课程名称' }, | |||||
LessonSortNo: { type: 'text', title: '课程类别码' }, | |||||
LessonSortName: { type: 'text', title: '课程类别' }, | |||||
LessonDate: { type: 'text', title: '原上课日期' }, | |||||
LessonTime: { type: 'text', title: '上课时间' }, | |||||
PlanWeek: { type: 'text', title: '教学周次' }, | |||||
LeaveType: { type: 'select', title: '请假类型', itemCode: 'LeaveType', dataSource: '0' }, | |||||
Remark: { type: 'textarea', title: '备注' }, | |||||
IsCheck: { type: 'select', title: '下拉框', itemCode: 'LeaveCheck', dataSource: '0' }, | |||||
TecRemark: { type: 'textarea', title: '备注' }, | |||||
StuMail: { | |||||
LeaveType:{ type: 'select', title: '请假类型', verify: 'NotNull' }, | |||||
StartTime:{ type: 'datetime', title: '开始时间', dateformat: '1' }, | |||||
EndTime:{ type: 'datetime', title: '返校时间', dateformat: '1' }, | |||||
LeaveDay:{ title: '请假天数', verify: 'Num' }, | |||||
Files:{ type: 'upload', title: '附件上传'}, | |||||
LeaveReason:{ type: 'textarea', title: '请假事由'}, | |||||
// CheckStatus:{ type: 'select', title: '审核状态' }, | |||||
}, | }, | ||||
}, | }, | ||||
// 数据源 | // 数据源 | ||||
dataSource: { | dataSource: { | ||||
StuAttendanceLeave: { | |||||
StuMail: { | |||||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | ||||
IsCheck: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({ value: t.value, text: t.text })), | |||||
// CheckStatus:Object.values(this.GET_GLOBAL('dataDictionary').AuditStatus).map(t => ({ value: t.value, text: t.text })), | |||||
}, | }, | ||||
} | } | ||||
@@ -270,7 +166,7 @@ export default { | |||||
if (this.mode === 'create') { | if (this.mode === 'create') { | ||||
this.origin = await this.getDefaultForm() | this.origin = await this.getDefaultForm() | ||||
} else { | } else { | ||||
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/StuAttendanceLeave/form', this.id) | |||||
const result = await this.HTTP_GET('learun/adms/stuleavemanagement/form', this.id) | |||||
this.origin = await this.formatFormData(result) | this.origin = await this.formatFormData(result) | ||||
} | } | ||||
this.current = this.COPY(this.origin) | this.current = this.COPY(this.origin) | ||||
@@ -290,6 +186,7 @@ export default { | |||||
case 'save': | case 'save': | ||||
const verifyResult = this.verifyForm() | const verifyResult = this.verifyForm() | ||||
console.log(this.scheme) | |||||
if (verifyResult.length > 0) { | if (verifyResult.length > 0) { | ||||
this.CONFIRM('表单验证失败', verifyResult.join('\n')) | this.CONFIRM('表单验证失败', verifyResult.join('\n')) | ||||
return | return | ||||
@@ -302,7 +199,7 @@ export default { | |||||
this.LOADING('正在提交...') | this.LOADING('正在提交...') | ||||
const postData = await this.getPostData(this.id) | const postData = await this.getPostData(this.id) | ||||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/save', postData, '表单提交保存失败').then(success => { | |||||
this.HTTP_POST('learun/adms/stuleavemanagement/save', postData, '表单提交保存失败').then(success => { | |||||
this.HIDE_LOADING() | this.HIDE_LOADING() | ||||
if (!success) { | if (!success) { | ||||
return | return | ||||
@@ -320,7 +217,7 @@ export default { | |||||
} | } | ||||
this.LOADING('提交删除中...') | this.LOADING('提交删除中...') | ||||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/delete', this.id, '删除失败').then(success => { | |||||
this.HTTP_POST('learun/adms/stuleavemanagement/delete', this.id, '删除失败').then(success => { | |||||
this.HIDE_LOADING() | this.HIDE_LOADING() | ||||
if (!success) { | if (!success) { | ||||
return | return | ||||
@@ -0,0 +1,322 @@ | |||||
<template> | |||||
<view class="page"> | |||||
<!-- 主列表页 --> | |||||
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;"> | |||||
<!-- 顶部条目/分页信息栏 --> | |||||
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner> | |||||
<!-- 滚动列表,跨端支持上拉/下拉 --> | |||||
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list"> | |||||
<l-customlist :tips="loadState" showTips> | |||||
<!-- 单条记录 --> | |||||
<view class="customlist-item" v-for="item of list" :key="item.Id"> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">学年度:</text> | |||||
{{ displayListItem(item, 'AcademicYearNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">学期:</text> | |||||
{{ displayListItem(item, 'Semester') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">学号:</text> | |||||
{{ displayListItem(item, 'StuNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">姓名:</text> | |||||
{{ displayListItem(item, 'StuName') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">年级:</text> | |||||
{{ displayListItem(item, 'Grade') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">系所码:</text> | |||||
{{ displayListItem(item, 'DeptNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">系名:</text> | |||||
{{ displayListItem(item, 'DeptName') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">专业码:</text> | |||||
{{ displayListItem(item, 'MajorNo') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">专业名:</text> | |||||
{{ displayListItem(item, 'MajorName') }} | |||||
</view> | |||||
<view class="customlist-item-field"> | |||||
<text class="customlist-item-field-title">所在行政班号:</text> | |||||
{{ displayListItem(item, 'ClassNo') }} | |||||
</view> | |||||
<l-customlist-action showButton buttonText="审核" @join="action('check',item.Id)" @view="action('view', item.Id)" /> | |||||
</view> | |||||
</l-customlist> | |||||
</l-scroll-list> | |||||
</view> | |||||
<!-- 关闭侧边抽屉按钮 --> | |||||
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose"> | |||||
<l-icon type="pullright" color="blue" /> | |||||
</view> | |||||
<!-- 侧边栏,用于设置查询条件 --> | |||||
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y> | |||||
<view v-if="ready" class="padding"> | |||||
<l-input | |||||
v-model="queryData.StuNo" | |||||
@change="searchChange" | |||||
title ="学号" | |||||
placeholder="按学号查询" | |||||
/> | |||||
<l-input | |||||
v-model="queryData.StuName" | |||||
@change="searchChange" | |||||
title ="姓名" | |||||
placeholder="按姓名查询" | |||||
/> | |||||
<!-- 重置查询条件按钮 --> | |||||
<view class="padding-tb"> | |||||
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button> | |||||
</view> | |||||
</view> | |||||
</scroll-view> | |||||
<l-customlist-add v-if="!sideOpen" @click="action('add')" /> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
/* | |||||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||||
* 创建人:超级管理员 | |||||
* 日 期:2020-10-20 15:22 | |||||
* 描 述:aaa | |||||
*/ | |||||
/** | |||||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/list", "style": { "navigationBarTitleText": "表单列表页" } } | |||||
* | |||||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||||
*/ | |||||
import moment from 'moment' | |||||
import get from 'lodash/get' | |||||
import set from 'lodash/set' | |||||
import pickBy from 'lodash/pickBy' | |||||
import mapValues from 'lodash/mapValues' | |||||
export default { | |||||
data() { | |||||
return { | |||||
// 数据项的数据类型、结构 | |||||
scheme: { | |||||
AcademicYearNo: { type: 'text' }, | |||||
Semester: { type: 'text' }, | |||||
StuNo: { type: 'text' }, | |||||
StuName: { type: 'text' }, | |||||
Grade: { type: 'text' }, | |||||
DeptNo: { type: 'text' }, | |||||
DeptName: { type: 'text' }, | |||||
MajorNo: { type: 'text' }, | |||||
MajorName: { type: 'text' }, | |||||
ClassNo: { type: 'text' }, | |||||
}, | |||||
// 查询条件 | |||||
searchData: {}, | |||||
defaultQueryData: {}, | |||||
queryData: { | |||||
StuNo: '', | |||||
StuName: '', | |||||
}, | |||||
// 数据源 | |||||
dataSource: { | |||||
}, | |||||
// 页面相关参数 | |||||
ready: false, | |||||
tips: '加载中...', | |||||
loadState: '向下翻以加载更多', | |||||
sideOpen: false, | |||||
// 列表与分页信息 | |||||
page: 1, | |||||
total: 2, | |||||
list: [] | |||||
} | |||||
}, | |||||
async onLoad() { | |||||
await this.init() | |||||
}, | |||||
onUnload() { | |||||
this.OFF('EducationalAdministrationStuAttendanceLeave-list-change') | |||||
}, | |||||
methods: { | |||||
// 页面初始化 | |||||
async init() { | |||||
this.ON('EducationalAdministrationStuAttendanceLeave-list-change', this.refreshList) | |||||
// 拉取加载列表和数据源 | |||||
await Promise.all([ | |||||
() => {} | |||||
]) | |||||
await this.fetchList() | |||||
// 初始化查询条件 | |||||
this.defaultQueryData = this.COPY(this.queryData) | |||||
this.ready = true | |||||
}, | |||||
// 拉取列表 | |||||
async fetchList() { | |||||
if (this.page > this.total) { return } | |||||
const result = await this.HTTP_GET( | |||||
'learun/adms/EducationalAdministration/StuAttendanceLeave/pagelist', | |||||
{ | |||||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||||
pagination: { rows: 10, page: this.page, sidx: 'Id', sord: 'DESC' }, | |||||
queryJson: JSON.stringify(this.searchData) | |||||
}, | |||||
'加载数据时出错' | |||||
) | |||||
if (!result) { return } | |||||
this.total = result.total | |||||
this.page = result.page + 1 | |||||
this.list = this.list.concat(result.rows) | |||||
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项` | |||||
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多' | |||||
}, | |||||
// 刷新清空列表 | |||||
async refreshList() { | |||||
this.page = 1 | |||||
this.total = 2 | |||||
this.list = [] | |||||
await this.fetchList() | |||||
}, | |||||
// 列表下拉 | |||||
pullDown() { | |||||
this.refreshList().then(() => { | |||||
this.$refs.list.stopPullDown() | |||||
}) | |||||
}, | |||||
// 设置搜索条件 | |||||
async searchChange() { | |||||
const result = {} | |||||
// 将其他查询项添加到查询 JSON 中 | |||||
const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t)) | |||||
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t))) | |||||
this.searchData = result | |||||
await this.refreshList() | |||||
}, | |||||
// 点击「清空查询条件」按钮 | |||||
reset() { | |||||
this.queryData = this.COPY(this.defaultQueryData) | |||||
this.searchChange() | |||||
}, | |||||
// 点击「编辑」、「查看」、「添加」、「删除」按钮 | |||||
async action(type, id = '') { | |||||
switch (type) { | |||||
case 'view': | |||||
this.NAV_TO(`./single?type=view&id=${id}`) | |||||
return | |||||
case 'add': | |||||
this.NAV_TO('./single?type=create') | |||||
return | |||||
case 'edit': | |||||
this.NAV_TO(`./single?type=edit&id=${id}`) | |||||
return | |||||
case 'delete': | |||||
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { | |||||
return | |||||
} | |||||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/delete', id, '删除失败').then(success => { | |||||
if(!success) { return } | |||||
this.TOAST('删除成功', 'success') | |||||
this.refreshList() | |||||
}) | |||||
return | |||||
default: | |||||
return | |||||
} | |||||
}, | |||||
// 显示列表中的标题项 | |||||
displayListItem(item, field) { | |||||
const fieldItem = this.scheme[field] | |||||
const value = item[field] | |||||
switch (fieldItem.type) { | |||||
case 'currentInfo': | |||||
case 'organize': | |||||
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '') | |||||
case 'radio': | |||||
case 'select': | |||||
const selectItem = this.dataSource[field].find(t => t.value === String(value)) | |||||
return get(selectItem, 'text', '') | |||||
case 'checkbox': | |||||
if (!value || value.split(',').length <= 0) { return '' } | |||||
const checkboxItems = value.split(',') | |||||
return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',') | |||||
case 'datetime': | |||||
if (!value) { return '' } | |||||
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm') | |||||
default: return value === null || value === undefined ? '' : value | |||||
} | |||||
} | |||||
} | |||||
} | |||||
</script> | |||||
<style lang="less" scoped> | |||||
@import '~@/common/css/sidepage.less'; | |||||
@import '~@/common/css/customlist.less'; | |||||
</style> |
@@ -0,0 +1,350 @@ | |||||
<template> | |||||
<view class="page"> | |||||
<view v-if="ready"> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.AcademicYearNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.AcademicYearNo')" | |||||
:disabled="!edit" | |||||
title="学年度" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.Semester', $event)" | |||||
:value="getValue('StuAttendanceLeave.Semester')" | |||||
:disabled="!edit" | |||||
title="学期" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.StuNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.StuNo')" | |||||
:disabled="!edit" | |||||
title="学号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.StuName', $event)" | |||||
:value="getValue('StuAttendanceLeave.StuName')" | |||||
:disabled="!edit" | |||||
title="姓名" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.Grade', $event)" | |||||
:value="getValue('StuAttendanceLeave.Grade')" | |||||
:disabled="!edit" | |||||
title="年级" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.EmpNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.EmpNo')" | |||||
:disabled="!edit" | |||||
title="教师号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.DeptNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.DeptNo')" | |||||
:disabled="!edit" | |||||
title="系所码" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.DeptName', $event)" | |||||
:value="getValue('StuAttendanceLeave.DeptName')" | |||||
:disabled="!edit" | |||||
title="系名" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.MajorNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.MajorNo')" | |||||
:disabled="!edit" | |||||
title="专业码" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.MajorName', $event)" | |||||
:value="getValue('StuAttendanceLeave.MajorName')" | |||||
:disabled="!edit" | |||||
title="专业名" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.ClassNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.ClassNo')" | |||||
:disabled="!edit" | |||||
title="所在行政班号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.ClassName', $event)" | |||||
:value="getValue('StuAttendanceLeave.ClassName')" | |||||
:disabled="!edit" | |||||
title="班级名称" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonNo')" | |||||
:disabled="!edit" | |||||
title="课程号" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonName', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonName')" | |||||
:disabled="!edit" | |||||
title="课程名称" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonSortNo', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonSortNo')" | |||||
:disabled="!edit" | |||||
title="课程类别码" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonSortName', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonSortName')" | |||||
:disabled="!edit" | |||||
title="课程类别" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonDate', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonDate')" | |||||
:disabled="!edit" | |||||
title="原上课日期" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.LessonTime', $event)" | |||||
:value="getValue('StuAttendanceLeave.LessonTime')" | |||||
:disabled="!edit" | |||||
title="上课时间" | |||||
/> | |||||
<l-input | |||||
@input="setValue('StuAttendanceLeave.PlanWeek', $event)" | |||||
:value="getValue('StuAttendanceLeave.PlanWeek')" | |||||
:disabled="!edit" | |||||
title="教学周次" | |||||
/> | |||||
<l-select | |||||
@input="setValue('StuAttendanceLeave.LeaveType', $event)" | |||||
:value="getValue('StuAttendanceLeave.LeaveType')" | |||||
:disabled="!edit" | |||||
:range="dataSource.StuAttendanceLeave.LeaveType" | |||||
title="请假类型" | |||||
/> | |||||
<l-textarea | |||||
@input="setValue('StuAttendanceLeave.Remark', $event)" | |||||
:value="getValue('StuAttendanceLeave.Remark')" | |||||
:readonly="!edit" | |||||
title="备注" | |||||
/> | |||||
<l-select | |||||
@input="setValue('StuAttendanceLeave.LeaveType', $event)" | |||||
:value="getValue('StuAttendanceLeave.LeaveType')" | |||||
:disabled="!edit" | |||||
:range="dataSource.StuAttendanceLeave.LeaveType" | |||||
title="下拉框" | |||||
/> | |||||
<l-textarea | |||||
@input="setValue('StuAttendanceLeave.TecRemark', $event)" | |||||
:value="getValue('StuAttendanceLeave.TecRemark')" | |||||
:readonly="!edit" | |||||
title="备注" | |||||
/> | |||||
</view> | |||||
<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;"> | |||||
<l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block> | |||||
提交保存 | |||||
</l-button> | |||||
<l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block> | |||||
编辑本页 | |||||
</l-button> | |||||
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block> | |||||
取消编辑 | |||||
</l-button> | |||||
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block> | |||||
删除 | |||||
</l-button> | |||||
</view> | |||||
</view> | |||||
</template> | |||||
<script> | |||||
/* | |||||
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn) | |||||
* Copyright (c) 2013-2020 上海力软信息技术有限公司 | |||||
* 创建人:超级管理员 | |||||
* 日 期:2020-10-20 15:34 | |||||
* 描 述:aaa | |||||
*/ | |||||
/** | |||||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||||
* { "path": "pages/EducationalAdministration/StuAttendanceLeave/single", "style": { "navigationBarTitleText": "表单详情页" } } | |||||
* | |||||
* (navigationBarTitleText 字段为本页面的标题文本,可以修改) | |||||
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件) | |||||
*/ | |||||
import get from 'lodash/get' | |||||
import set from 'lodash/set' | |||||
import moment from 'moment' | |||||
import customPageMixins from '@/common/custompage.js' | |||||
export default { | |||||
mixins: [customPageMixins], | |||||
data() { | |||||
return { | |||||
// 页面相关参数 | |||||
id: null, | |||||
mode: null, | |||||
edit: null, | |||||
ready: false, | |||||
// 表单数据 | |||||
current: {}, | |||||
origin: {}, | |||||
// 表单项数据结构 | |||||
scheme: { | |||||
StuAttendanceLeave: { | |||||
AcademicYearNo: { type: 'text', title: '学年度' }, | |||||
Semester: { type: 'text', title: '学期' }, | |||||
StuNo: { type: 'text', title: '学号' }, | |||||
StuName: { type: 'text', title: '姓名' }, | |||||
Grade: { type: 'text', title: '年级' }, | |||||
EmpNo: { type: 'text', title: '教师号' }, | |||||
DeptNo: { type: 'text', title: '系所码' }, | |||||
DeptName: { type: 'text', title: '系名' }, | |||||
MajorNo: { type: 'text', title: '专业码' }, | |||||
MajorName: { type: 'text', title: '专业名' }, | |||||
ClassNo: { type: 'text', title: '所在行政班号' }, | |||||
ClassName: { type: 'text', title: '班级名称' }, | |||||
LessonNo: { type: 'text', title: '课程号' }, | |||||
LessonName: { type: 'text', title: '课程名称' }, | |||||
LessonSortNo: { type: 'text', title: '课程类别码' }, | |||||
LessonSortName: { type: 'text', title: '课程类别' }, | |||||
LessonDate: { type: 'text', title: '原上课日期' }, | |||||
LessonTime: { type: 'text', title: '上课时间' }, | |||||
PlanWeek: { type: 'text', title: '教学周次' }, | |||||
LeaveType: { type: 'select', title: '请假类型', itemCode: 'LeaveType', dataSource: '0' }, | |||||
Remark: { type: 'textarea', title: '备注' }, | |||||
LeaveType: { type: 'select', title: '下拉框', itemCode: 'LeaveCheck', dataSource: '0' }, | |||||
TecRemark: { type: 'textarea', title: '备注' }, | |||||
}, | |||||
}, | |||||
// 数据源 | |||||
dataSource: { | |||||
StuAttendanceLeave: { | |||||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | |||||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({ value: t.value, text: t.text })), | |||||
}, | |||||
} | |||||
} | |||||
}, | |||||
async onLoad({ type, id }) { | |||||
await this.init(type, id) | |||||
}, | |||||
methods: { | |||||
// 页面初始化 | |||||
async init(type, id) { | |||||
this.LOADING('加载数据中...') | |||||
this.id = id | |||||
this.mode = type | |||||
this.edit = ['create', 'edit'].includes(this.mode) | |||||
// 拉取表单数据,同时拉取所有来自数据源的选单数据 | |||||
await Promise.all([ | |||||
() => {} | |||||
]) | |||||
await this.fetchForm() | |||||
this.ready = true | |||||
this.HIDE_LOADING() | |||||
}, | |||||
// 加载表单数据 | |||||
async fetchForm() { | |||||
if (this.mode === 'create') { | |||||
this.origin = await this.getDefaultForm() | |||||
} else { | |||||
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/StuAttendanceLeave/form', this.id) | |||||
this.origin = await this.formatFormData(result) | |||||
} | |||||
this.current = this.COPY(this.origin) | |||||
}, | |||||
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮 | |||||
async action(type) { | |||||
switch (type) { | |||||
case 'edit': | |||||
this.edit = true | |||||
break | |||||
case 'reset': | |||||
this.current = this.COPY(this.origin) | |||||
this.edit = false | |||||
break | |||||
case 'save': | |||||
const verifyResult = this.verifyForm() | |||||
if (verifyResult.length > 0) { | |||||
this.CONFIRM('表单验证失败', verifyResult.join('\n')) | |||||
return | |||||
} | |||||
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) { | |||||
return | |||||
} | |||||
this.LOADING('正在提交...') | |||||
const postData = await this.getPostData(this.id) | |||||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/save', postData, '表单提交保存失败').then(success => { | |||||
this.HIDE_LOADING() | |||||
if (!success) { | |||||
return | |||||
} | |||||
this.EMIT('EducationalAdministrationStuAttendanceLeave-list-change') | |||||
this.NAV_BACK() | |||||
this.TOAST('提交保存成功') | |||||
}) | |||||
break | |||||
case 'delete': | |||||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||||
return | |||||
} | |||||
this.LOADING('提交删除中...') | |||||
this.HTTP_POST('learun/adms/EducationalAdministration/StuAttendanceLeave/delete', this.id, '删除失败').then(success => { | |||||
this.HIDE_LOADING() | |||||
if (!success) { | |||||
return | |||||
} | |||||
this.EMIT('EducationalAdministrationStuAttendanceLeave-list-change') | |||||
this.NAV_BACK() | |||||
this.this.TOAST('删除成功', 'success') | |||||
}) | |||||
break | |||||
default: break | |||||
} | |||||
}, | |||||
// 获取表单值 | |||||
getValue(path) { | |||||
return get(this.current, path) | |||||
}, | |||||
// 设置表单值 | |||||
setValue(path, val) { | |||||
set(this.current, path, val) | |||||
} | |||||
} | |||||
} | |||||
</script> |