@@ -223,6 +223,7 @@ | |||
<Compile Include="Modules\StuEnrollApi.cs" /> | |||
<Compile Include="Modules\StuInfoBasicApi.cs" /> | |||
<Compile Include="Modules\StatisticsApi.cs" /> | |||
<Compile Include="Modules\StuLeaveManagementApi.cs" /> | |||
<Compile Include="Modules\StuScoreApi.cs" /> | |||
<Compile Include="Modules\TaiGang\TUserApi.cs" /> | |||
<Compile Include="Modules\TeacherWorkloadApi.cs" /> | |||
@@ -0,0 +1,204 @@ | |||
using Nancy; | |||
using Learun.Util; | |||
using System.Collections.Generic; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using static Learun.Application.WebApi.Modules.StuInfoFreshApi; | |||
using System; | |||
using System.IO; | |||
using System.Linq; | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.OA; | |||
using Learun.Application.OA.File.FileInfo; | |||
using Learun.Application.TwoDevelopment.LogisticsManagement; | |||
using Learun.Application.TwoDevelopment.LR_Desktop; | |||
using Learun.Application.WorkFlow; | |||
using Microsoft.Ajax.Utilities; | |||
namespace Learun.Application.WebApi | |||
{ | |||
///2022.11.14 | |||
/// <summary> | |||
/// 学生请假 | |||
/// </summary> | |||
public class StuLeaveManagementApi : BaseApi | |||
{ | |||
private StuLeaveManagementIBLL stuLeaveManagementIBLL = new StuLeaveManagementBLL(); | |||
/// <summary> | |||
/// 注册接口 | |||
/// <summary> | |||
public StuLeaveManagementApi() | |||
: base("/Learun/adms/EducationalAdministration/StuLeaveManagement") | |||
{ | |||
Get["/pagelist"] = GetPageList; | |||
Get["/form"] = GetForm; | |||
Post["/delete"] = DeleteForm; | |||
Post["/save"] = SaveForm; | |||
//判断是否可以审核 | |||
Get["/ischeck"] = IsCheck; | |||
//学生请假--教师审核列表 | |||
Get["/checkpagelist"] = GetCheckPageList; | |||
//审核学生请假 | |||
Post["/savecheck"] = SaveCheckForm; | |||
} | |||
#region 获取数据 | |||
/// <summary> | |||
/// 获取页面显示列表分页数据 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response GetPageList(dynamic _) | |||
{ | |||
ReqPageParam parameter = this.GetReqData<ReqPageParam>(); | |||
var data = stuLeaveManagementIBLL.GetPageList(parameter.pagination, parameter.queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
total = parameter.pagination.total, | |||
page = parameter.pagination.page, | |||
records = parameter.pagination.records | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 学生请假--教师审核列表 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response GetCheckPageList(dynamic _) | |||
{ | |||
ReqPageParam parameter = this.GetReqData<ReqPageParam>(); | |||
var data = stuLeaveManagementIBLL.GetCheckPageList(parameter.pagination, parameter.queryJson); | |||
var jsonData = new | |||
{ | |||
rows = data, | |||
total = parameter.pagination.total, | |||
page = parameter.pagination.page, | |||
records = parameter.pagination.records | |||
}; | |||
return Success(jsonData); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response GetForm(dynamic _) | |||
{ | |||
string keyValue = this.GetReqData(); | |||
var StuLeaveManagementData = stuLeaveManagementIBLL.GetStuLeaveManagementEntity(keyValue); | |||
var jsonData = new | |||
{ | |||
StuLeaveManagement = StuLeaveManagementData, | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
#region 提交数据 | |||
/// <summary> | |||
/// 删除实体数据 | |||
/// <param name="_"></param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response DeleteForm(dynamic _) | |||
{ | |||
string keyValue = this.GetReqData(); | |||
stuLeaveManagementIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="_"></param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response SaveForm(dynamic _) | |||
{ | |||
var loginInfo = LoginUserInfo.Get(); | |||
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>(); | |||
StuLeaveManagementEntity entity = parameter.strEntity.ToObject<StuLeaveManagementEntity>(); | |||
if (string.IsNullOrEmpty(parameter.keyValue)) | |||
{ | |||
entity.CreateUserId = loginInfo.userId; | |||
entity.CreateUserNo = loginInfo.account; | |||
entity.CreateTime = DateTime.Now; | |||
} | |||
stuLeaveManagementIBLL.SaveEntity(parameter.keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 判断是否可以审核 | |||
/// <summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response IsCheck(dynamic _) | |||
{ | |||
string keyValue = this.GetReqData(); | |||
var stuLeaveManagementData = stuLeaveManagementIBLL.GetStuLeaveManagementEntity(keyValue); | |||
bool isDeptDirector = false; //登录用户是否是系主任标识 | |||
var deptDirectorRoleId = Config.GetValue("DeptDirectorRoleId"); | |||
var loginInfoRoleIds = LoginUserInfo.Get().roleIds; | |||
if (loginInfoRoleIds.IndexOf(',') == -1) | |||
{ | |||
if (loginInfoRoleIds == deptDirectorRoleId) | |||
{ | |||
isDeptDirector = true; | |||
} | |||
} | |||
else | |||
{ | |||
if (loginInfoRoleIds.Split(',').Contains(deptDirectorRoleId)) | |||
{ | |||
isDeptDirector = true; | |||
} | |||
} | |||
if (stuLeaveManagementData.LeaveDay > 2 && !isDeptDirector) | |||
{ | |||
return Fail("该请假申请大于2天,需要由系主任审核!"); | |||
} | |||
return Success(""); | |||
} | |||
/// <summary> | |||
/// 审核学生请假 | |||
/// <param name="_"></param> | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response SaveCheckForm(dynamic _) | |||
{ | |||
var loginInfo = LoginUserInfo.Get(); | |||
ReqFormEntity parameter = this.GetReqData<ReqFormEntity>(); | |||
StuLeaveManagementEntity entity = parameter.strEntity.ToObject<StuLeaveManagementEntity>(); | |||
entity.CheckUserId = loginInfo.userId; | |||
entity.CheckUserNo = loginInfo.account; | |||
entity.CheckTime = DateTime.Now; | |||
stuLeaveManagementIBLL.SaveEntity(parameter.keyValue, entity); | |||
return Success("保存成功!"); | |||
} | |||
#endregion | |||
#region 私有类 | |||
/// <summary> | |||
/// 表单实体类 | |||
/// <summary> | |||
private class ReqFormEntity | |||
{ | |||
public string keyValue { get; set; } | |||
public string strEntity { get; set; } | |||
} | |||
#endregion | |||
} | |||
} |
@@ -107,5 +107,7 @@ | |||
<add key="QJUrl" value="www.qj.com"/> | |||
<!-- 报名选修课的最大课程数 --> | |||
<add key="ElectiveLessonApplyMax" value="2" /> | |||
<!--系主任角色Id--> | |||
<add key="DeptDirectorRoleId" value="cccde0ce-ebfe-41f2-9a78-e49aaa21cd5a" /> | |||
</appSettings> |
@@ -43,6 +43,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
/// <summary> | |||
/// 学生请假教师审核列表 | |||
/// </summary> | |||
/// <param name="pagination"></param> | |||
/// <param name="queryJson"></param> | |||
/// <returns></returns> | |||
public IEnumerable<StuLeaveManagementEntity> GetCheckPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
return stuLeaveManagementService.GetCheckPageList(pagination, queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取StuLeaveManagement表实体数据 | |||
/// </summary> | |||
@@ -90,7 +115,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -142,7 +166,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 提交实体数据 | |||
/// </summary> | |||
@@ -212,5 +235,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -21,13 +21,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="queryJson">查询参数</param> | |||
/// <returns></returns> | |||
IEnumerable<StuLeaveManagementEntity> GetPageList(Pagination pagination, string queryJson); | |||
IEnumerable<StuLeaveManagementEntity> GetCheckPageList(Pagination pagination, string queryJson); | |||
/// <summary> | |||
/// 获取StuLeaveManagement表实体数据 | |||
/// </summary> | |||
/// <param name="keyValue">主键</param> | |||
/// <returns></returns> | |||
StuLeaveManagementEntity GetStuLeaveManagementEntity(string keyValue); | |||
/// <summary> | |||
/// 获取主表实体数据 | |||
/// </summary> | |||
@@ -49,7 +49,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="keyValue">主键</param> | |||
/// <param name="entity">实体</param> | |||
void SaveEntity(string keyValue, StuLeaveManagementEntity entity); | |||
/// <summary> | |||
/// 提交实体数据 | |||
/// </summary> | |||
@@ -64,5 +63,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
#endregion | |||
int Num(string CreateUserNo); | |||
} | |||
} |
@@ -31,11 +31,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT t.*,s.StuName as CreateUserName "); | |||
//strSql.Append("SELECT t.*,s.StuName as CreateUserName,s.ClassNo,s.DeptNo,s.MajorNo,c.ClassDiredctorNo,c.ClassTutorNo "); | |||
strSql.Append(" FROM StuLeaveManagement t "); | |||
strSql.Append(" left join StuInfoBasic s on t.CreateUserNo=s.StuNo "); | |||
//strSql.Append(" left join ClassInfo c on s.ClassNo=c.ClassNo "); | |||
strSql.Append("SELECT t.*,s.StuName as CreateUserName,s.ClassNo,s.DeptNo,s.MajorNo,c.ClassDiredctorNo,c.ClassTutorNo "); | |||
strSql.Append(" FROM StuLeaveManagement t left join StuInfoBasic s on t.CreateUserNo=s.StuNo left join ClassInfo c on s.ClassNo=c.ClassNo "); | |||
strSql.Append(" WHERE 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
@@ -56,43 +53,124 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
strSql.Append(" AND t.CreateUserNo = @StuNo "); | |||
} | |||
//班级班主任/辅导员/系主任 | |||
//if (!queryParam["ClassManagerNo"].IsEmpty()) | |||
//{ | |||
// dp.Add("ClassManagerNo", queryParam["ClassManagerNo"].ToString(), DbType.String); | |||
// strSql.Append(" AND (c.ClassDiredctorNo = @ClassManagerNo or c.ClassTutorNo = @ClassManagerNo "); | |||
// //登录用户是否是系主任:若是,展示大于2天的请假记录; | |||
// var deptDirectorRoleId = Config.GetValue("DeptDirectorRoleId"); | |||
// if (deptDirectorRoleId != null) | |||
// { | |||
// var loginInfoRoleIds = LoginUserInfo.Get().roleIds; | |||
// if (loginInfoRoleIds.IndexOf(',') == -1) | |||
// { | |||
// if (loginInfoRoleIds == deptDirectorRoleId) | |||
// { | |||
// strSql.Append(" or t.LeaveDay>2 )"); | |||
// } | |||
// else | |||
// { | |||
// strSql.Append(" ) "); | |||
// } | |||
// } | |||
// else | |||
// { | |||
// if (loginInfoRoleIds.Split(',').Contains(deptDirectorRoleId)) | |||
// { | |||
// strSql.Append(" or t.LeaveDay>2 )"); | |||
// } | |||
// else | |||
// { | |||
// strSql.Append(" ) "); | |||
// } | |||
// } | |||
// } | |||
// else | |||
// { | |||
// strSql.Append(" ) "); | |||
// } | |||
//} | |||
if (!queryParam["ClassManagerNo"].IsEmpty()) | |||
{ | |||
dp.Add("ClassManagerNo", queryParam["ClassManagerNo"].ToString(), DbType.String); | |||
strSql.Append(" AND (c.ClassDiredctorNo = @ClassManagerNo or c.ClassTutorNo = @ClassManagerNo "); | |||
//登录用户是否是系主任:若是,展示大于2天的请假记录; | |||
var deptDirectorRoleId = Config.GetValue("DeptDirectorRoleId"); | |||
if (deptDirectorRoleId != null) | |||
{ | |||
var loginInfoRoleIds = LoginUserInfo.Get().roleIds; | |||
if (loginInfoRoleIds.IndexOf(',') == -1) | |||
{ | |||
if (loginInfoRoleIds == deptDirectorRoleId) | |||
{ | |||
strSql.Append(" or t.LeaveDay>2 )"); | |||
} | |||
else | |||
{ | |||
strSql.Append(" ) "); | |||
} | |||
} | |||
else | |||
{ | |||
if (loginInfoRoleIds.Split(',').Contains(deptDirectorRoleId)) | |||
{ | |||
strSql.Append(" or t.LeaveDay>2 )"); | |||
} | |||
else | |||
{ | |||
strSql.Append(" ) "); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
strSql.Append(" ) "); | |||
} | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public IEnumerable<StuLeaveManagementEntity> GetCheckPageList(Pagination pagination, string queryJson) | |||
{ | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT t.*,s.StuName as CreateUserName,s.ClassNo,s.DeptNo,s.MajorNo,c.ClassDiredctorNo,c.ClassTutorNo "); | |||
strSql.Append(" FROM StuLeaveManagement t left join StuInfoBasic s on t.CreateUserNo=s.StuNo left join ClassInfo c on s.ClassNo=c.ClassNo "); | |||
strSql.Append(" WHERE 1=1 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["LeaveType"].IsEmpty()) | |||
{ | |||
dp.Add("LeaveType", queryParam["LeaveType"].ToString(), DbType.String); | |||
strSql.Append(" AND t.LeaveType = @LeaveType "); | |||
} | |||
if (!queryParam["CheckStatus"].IsEmpty()) | |||
{ | |||
dp.Add("CheckStatus", queryParam["CheckStatus"].ToString(), DbType.String); | |||
strSql.Append(" AND t.CheckStatus = @CheckStatus "); | |||
} | |||
if (!queryParam["StuNo"].IsEmpty()) | |||
{ | |||
dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); | |||
strSql.Append(" AND t.CreateUserNo = @StuNo "); | |||
} | |||
//班级班主任/辅导员/系主任 | |||
var ClassManagerNo = LoginUserInfo.Get().account; | |||
if (!string.IsNullOrEmpty(ClassManagerNo)) | |||
{ | |||
dp.Add("ClassManagerNo", ClassManagerNo, DbType.String); | |||
strSql.Append(" AND (c.ClassDiredctorNo = @ClassManagerNo or c.ClassTutorNo = @ClassManagerNo "); | |||
//登录用户是否是系主任:若是,展示大于2天的请假记录; | |||
var deptDirectorRoleId = Config.GetValue("DeptDirectorRoleId"); | |||
if (deptDirectorRoleId != null) | |||
{ | |||
var loginInfoRoleIds = LoginUserInfo.Get().roleIds; | |||
if (loginInfoRoleIds.IndexOf(',') == -1) | |||
{ | |||
if (loginInfoRoleIds == deptDirectorRoleId) | |||
{ | |||
strSql.Append(" or t.LeaveDay>2 )"); | |||
} | |||
else | |||
{ | |||
strSql.Append(" ) "); | |||
} | |||
} | |||
else | |||
{ | |||
if (loginInfoRoleIds.Split(',').Contains(deptDirectorRoleId)) | |||
{ | |||
strSql.Append(" or t.LeaveDay>2 )"); | |||
} | |||
else | |||
{ | |||
strSql.Append(" ) "); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
strSql.Append(" ) "); | |||
} | |||
} | |||
return this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(strSql.ToString(), dp, pagination); | |||
} | |||
catch (Exception ex) | |||
@@ -117,7 +195,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository("CollegeMIS").FindEntity<StuLeaveManagementEntity>(keyValue); | |||
var data = this.BaseRepository("CollegeMIS").FindEntity<StuLeaveManagementEntity>(keyValue); | |||
if (data != null) | |||
{ | |||
var studentlist = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(x => x.StuNo == data.CreateUserNo).FirstOrDefault(); | |||
if (studentlist != null) | |||
{ | |||
data.DeptNo = studentlist.DeptNo; | |||
data.MajorNo = studentlist.MajorNo; | |||
data.ClassNo = studentlist.ClassNo; | |||
data.CreateUserName = studentlist.StuName; | |||
} | |||
var classlist = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>(x =>x.ClassNo == data.ClassNo).FirstOrDefault(); | |||
if (classlist!=null) | |||
{ | |||
data.ClassDiredctorNo = classlist.ClassDiredctorNo; | |||
data.ClassTutorNo = classlist.ClassTutorNo; | |||
} | |||
} | |||
return data; | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -155,7 +251,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 提交数据 | |||
@@ -190,21 +285,147 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <param name="entity">实体</param> | |||
public void SaveEntity(string keyValue, StuLeaveManagementEntity entity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS"); | |||
try | |||
{ | |||
db.BeginTrans(); | |||
if (!string.IsNullOrEmpty(keyValue)) | |||
{ | |||
entity.Modify(keyValue); | |||
this.BaseRepository("CollegeMIS").Update(entity); | |||
db.Update(entity); | |||
if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null) | |||
{ | |||
//请假审核通过后,该学生的对应日期的课表改为请假 | |||
var model = this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>( | |||
$"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault(); | |||
//请假开始时间和结束时间 | |||
var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00"); | |||
var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59"); | |||
//排课数据 | |||
var arrangeLessonTermList = db.FindList<ArrangeLessonTermEntity>($@"select a.*,b.StuName,b.Grade,b.GenderNo from [dbo].[ArrangeLessonTerm] a | |||
join stuinfobasic b on a.teachclassno=b.classno | |||
where b.stuno='{model.CreateUserNo}' | |||
and a.lessondate between '{startTime}' and '{endTime}'"); | |||
var deptList = this.BaseRepository("CollegeMIS").FindList<CdDeptEntity>(); | |||
var majorList = this.BaseRepository("CollegeMIS").FindList<CdMajorEntity>(); | |||
var classInfoList = this.BaseRepository("CollegeMIS").FindList<ClassInfoEntity>(); | |||
var classRoomList = this.BaseRepository("CollegeMIS").FindList<ClassroomInfoEntity>().ToList(); | |||
var lessonSortList = this.BaseRepository("CollegeMIS").FindList<CdLessonSortEntity>().ToList(); | |||
foreach (var arrangeLessonTerm in arrangeLessonTermList) | |||
{ | |||
StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity(); | |||
stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; | |||
stuAttendanceLeave.Semester = arrangeLessonTerm.Semester; | |||
stuAttendanceLeave.StuNo = model.CreateUserNo; | |||
//stuAttendanceLeave.StuName = arrangeLessonTerm.StuName; | |||
//stuAttendanceLeave.Grade = arrangeLessonTerm.Grade; | |||
stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo; | |||
stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) | |||
.FirstOrDefault()?.DeptName; | |||
stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo; | |||
stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo) | |||
.FirstOrDefault()?.MajorName; | |||
stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo; | |||
stuAttendanceLeave.ClassName = classInfoList | |||
.Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; | |||
stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo; | |||
stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName; | |||
stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo; | |||
stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo; | |||
stuAttendanceLeave.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName; | |||
stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate; | |||
stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime; | |||
stuAttendanceLeave.LeaveType = entity.LeaveType; | |||
stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo; | |||
stuAttendanceLeave.TecRemark = "按天请假"; | |||
stuAttendanceLeave.UpdateDate = DateTime.Now; | |||
stuAttendanceLeave.IsCheck = "1"; | |||
stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo; | |||
stuAttendanceLeave.ClassRoomName = classRoomList.FirstOrDefault(x => x.ClassroomNo == arrangeLessonTerm.ClassroomNo)?.ClassroomName; | |||
//去重 | |||
var isExistModel = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceLeaveEntity>(x => | |||
x.AcademicYearNo == stuAttendanceLeave.AcademicYearNo && x.Semester == stuAttendanceLeave.Semester && | |||
x.StuNo == stuAttendanceLeave.StuNo &&x.LessonNo == stuAttendanceLeave.LessonNo && x.TeachClassNo == stuAttendanceLeave.TeachClassNo && | |||
x.LessonSortNo == stuAttendanceLeave.LessonSortNo &&x.LessonDate == stuAttendanceLeave.LessonDate && x.LessonTime == stuAttendanceLeave.LessonTime && | |||
x.EmpNo == stuAttendanceLeave.EmpNo &&x.ClassRoomNo == stuAttendanceLeave.ClassRoomNo | |||
); | |||
if (isExistModel!=null) | |||
{ | |||
stuAttendanceLeave.Modify(isExistModel.ID); | |||
db.Update(stuAttendanceLeave); | |||
} | |||
else | |||
{ | |||
stuAttendanceLeave.Create(); | |||
db.Insert(stuAttendanceLeave); | |||
} | |||
//学生考勤 | |||
StuAttendanceEntity stuAttendanceEntity = new StuAttendanceEntity(); | |||
stuAttendanceEntity.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; | |||
stuAttendanceEntity.Semester = arrangeLessonTerm.Semester; | |||
stuAttendanceEntity.StuNo = model.CreateUserNo; | |||
//stuAttendanceEntity.StuName = arrangeLessonTerm.StuName; | |||
//stuAttendanceEntity.Gender = arrangeLessonTerm.GenderNo.ToLower()=="true"?"男":"女"; | |||
//stuAttendanceEntity.Grade = arrangeLessonTerm.Grade; | |||
stuAttendanceEntity.DeptNo = arrangeLessonTerm.DeptNo; | |||
stuAttendanceEntity.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) | |||
.FirstOrDefault()?.DeptName; | |||
stuAttendanceEntity.MajorNo = arrangeLessonTerm.MajorNo; | |||
stuAttendanceEntity.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo).FirstOrDefault()?.MajorName; | |||
stuAttendanceEntity.ClassNo = arrangeLessonTerm.TeachClassNo; | |||
stuAttendanceEntity.ClassName = classInfoList | |||
.Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; | |||
stuAttendanceEntity.LessonNo = arrangeLessonTerm.LessonNo; | |||
stuAttendanceEntity.LessonName = arrangeLessonTerm.LessonName; | |||
stuAttendanceEntity.TeachClassNo = arrangeLessonTerm.TeachClassNo; | |||
stuAttendanceEntity.LessonSortNo = arrangeLessonTerm.LessonSortNo; | |||
stuAttendanceEntity.LessonSortName = lessonSortList.Find(m => m.LessonSortNo == arrangeLessonTerm.LessonSortNo)?.LessonSortName; | |||
stuAttendanceEntity.LessonDate = arrangeLessonTerm.LessonDate; | |||
stuAttendanceEntity.PlanWeek = null; | |||
stuAttendanceEntity.LessonTime = arrangeLessonTerm.LessonTime; | |||
stuAttendanceEntity.AttendOrNo = "否"; | |||
stuAttendanceEntity.Sort = Convert.ToInt32(entity.LeaveType) == 2 ? "病假" : "事假"; | |||
stuAttendanceEntity.EmpNo = arrangeLessonTerm.EmpNo; | |||
stuAttendanceEntity.Remark = "按天请假"; | |||
stuAttendanceEntity.CheckMarkDept = ""; | |||
stuAttendanceEntity.CheckMark = ""; | |||
stuAttendanceEntity.InertDate = DateTime.Now; | |||
stuAttendanceEntity.ClassRoomNo = arrangeLessonTerm.ClassroomNo; | |||
stuAttendanceEntity.ClassRoomName = classRoomList.FirstOrDefault(x => x.ClassroomNo == arrangeLessonTerm.ClassroomNo)?.ClassroomName; | |||
//去重 | |||
var isExistModel2 = this.BaseRepository("CollegeMIS").FindEntity<StuAttendanceEntity>(x => | |||
x.AcademicYearNo == stuAttendanceEntity.AcademicYearNo && x.Semester == stuAttendanceEntity.Semester && x.StuNo == stuAttendanceEntity.StuNo && | |||
x.LessonNo == stuAttendanceEntity.LessonNo && x.TeachClassNo == stuAttendanceEntity.TeachClassNo && x.LessonSortNo == stuAttendanceEntity.LessonSortNo && | |||
x.LessonDate == stuAttendanceEntity.LessonDate && x.LessonTime == stuAttendanceEntity.LessonTime && x.EmpNo == stuAttendanceEntity.EmpNo && x.ClassRoomNo == stuAttendanceEntity.ClassRoomNo); | |||
if (isExistModel2 != null) | |||
{ | |||
stuAttendanceEntity.Modify(isExistModel2.ID); | |||
db.Update(stuAttendanceEntity); | |||
} | |||
else | |||
{ | |||
stuAttendanceEntity.Create(); | |||
db.Insert(stuAttendanceEntity); | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
entity.Create(); | |||
this.BaseRepository("CollegeMIS").Insert(entity); | |||
db.Insert(entity); | |||
} | |||
db.Commit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.Rollback(); | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
@@ -293,5 +514,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
throw; | |||
} | |||
} | |||
} | |||
} |
@@ -886,6 +886,25 @@ | |||
"navigationBarTitleText": "学生签到" | |||
} | |||
}, | |||
// 按天请假管理 | |||
{ | |||
"path": "pages/EducationalAdministration/StuLeaveManagement/list", | |||
"style": { | |||
"navigationBarTitleText": "按天请假管理" | |||
} | |||
}, | |||
{ | |||
"path": "pages/EducationalAdministration/StuLeaveManagement/single", | |||
"style": { | |||
"navigationBarTitleText": "详情" | |||
} | |||
}, | |||
{ | |||
"path": "pages/EducationalAdministration/StuLeaveManagement/Check/list", | |||
"style": { | |||
"navigationBarTitleText": "学生按天请假审核" | |||
} | |||
}, | |||
//教学工作量 | |||
{ | |||
"path": "pages/TeacherWorkload/list", | |||
@@ -0,0 +1,503 @@ | |||
<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> | |||
{{ CheckStatusitem(displayListItem(item, "CheckStatus")) }} | |||
<!-- {{ CheckStatusitem(item, "CheckStatus") }} --> | |||
</view> | |||
<!-- <view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">审核备注:</text> | |||
{{ displayListItem(item, "CheckRemark") }} | |||
</view> --> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">审核时间:</text> | |||
{{ displayListItem(item, "CheckTime") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">审核人:</text> | |||
{{ displayListItem(item, "CheckUserNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">请假类型:</text> | |||
{{ displayListItem(item, "LeaveType") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">开始时间:</text> | |||
{{ itmeDel(displayListItem(item, "StartTime"))}} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">结束时间:</text> | |||
{{ itmeDel(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, "LeaveReason") }} | |||
</view> --> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学号:</text> | |||
{{ displayListItem(item, "CreateUserNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">姓名:</text> | |||
{{ displayListItem(item, "CreateUserName") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">申请时间:</text> | |||
{{ displayListItem(item, "CreateTime") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">班级:</text> | |||
{{ displayListItem(item, "ClassNo") }} | |||
</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, "MajorNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">班主任:</text> | |||
{{ displayListItem(item, "ClassDiredctorNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">辅导员:</text> | |||
{{ displayListItem(item, "ClassTutorNo") }} | |||
</view> | |||
<l-customlist-action :showButton="!item.CheckStatus" 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-select v-model="queryData.LeaveType" @change="searchChange" :range="dataSource.LeaveType" | |||
title="请假类型" placeholder="按请假类型查询" /> | |||
<l-select v-model="queryData.CheckStatus" @change="searchChange" :range="dataSource.CheckStatus" | |||
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-2021 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-02-21 10:07 | |||
* 描 述:会议管理 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/MeetingManagement/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: { | |||
CheckStatus: { | |||
type: "text", | |||
// type: "select",dataSource: '1', dataSourceId: 'CheckStatus' | |||
}, | |||
CheckRemark: { | |||
type: "text" | |||
}, | |||
CheckTime: { | |||
type: "text" | |||
}, | |||
CheckUserNo: { | |||
type: "select", | |||
dataSource: '1', | |||
dataSourceId: 'CheckUserNo' | |||
}, | |||
LeaveType: { | |||
type: "select", | |||
dataSource: '1', | |||
dataSourceId: 'LeaveType' | |||
}, | |||
StartTime: { | |||
type: "text" | |||
}, | |||
EndTime: { | |||
type: "text" | |||
}, | |||
LeaveDay: { | |||
type: "text" | |||
}, | |||
LeaveReason: { | |||
type: "text" | |||
}, | |||
CreateUserNo: { | |||
type: "text" | |||
}, | |||
CreateUserName: { | |||
type: "text" | |||
}, | |||
CreateTime: { | |||
type: "text" | |||
}, | |||
ClassNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'ClassNo' | |||
}, | |||
DeptNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'DeptNo' | |||
}, | |||
MajorNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'MajorNo' | |||
}, | |||
ClassDiredctorNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'ClassDiredctorNo' | |||
}, | |||
ClassTutorNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'ClassTutorNo' | |||
} | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
LeaveType: "", | |||
CheckStatus: '', | |||
// CreateUser: "", | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
ClassNo:[], | |||
DeptNo:[], | |||
MajorNo:[], | |||
ClassDiredctorNo:[], | |||
CheckUserNo:[], | |||
ClassTutorNo:[], | |||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ | |||
value: t.value, | |||
text: t.text | |||
})), | |||
CheckStatus: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({ | |||
value: t.value, | |||
text: t.text | |||
})), | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: "加载中...", | |||
loadState: "向下翻以加载更多", | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [], | |||
user: null, | |||
}; | |||
}, | |||
async onLoad() { | |||
await this.init(); | |||
}, | |||
onUnload() { | |||
this.OFF("EducationalAdministrationStuLeaveManagementCheck-list-change"); | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON( | |||
"EducationalAdministrationStuLeaveManagementCheck-list-change", | |||
this.refreshList | |||
); | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
this.dataSource.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno })) | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.ClassTutorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.CheckUserNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })); | |||
}), | |||
]); | |||
await this.fetchList(); | |||
// 初始化查询条件 | |||
this.defaultQueryData = this.COPY(this.queryData); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList(isConcat = true) { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
const result = await this.HTTP_GET( | |||
"/Learun/adms/EducationalAdministration/StuLeaveManagement/checkpagelist", { | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { | |||
rows: 10, | |||
page: this.page, | |||
sidx: "CreateTime", | |||
sord: "DESC" | |||
}, | |||
queryJson: JSON.stringify(this.searchData), | |||
}, | |||
"加载数据时出错" | |||
); | |||
if (!result) { | |||
return; | |||
} | |||
this.total = result.total; | |||
this.page = result.page + 1; | |||
this.list = isConcat ? this.list.concat(result.rows) : result.rows; | |||
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${ | |||
result.total | |||
} 页,共 ${result.records} 项`; | |||
this.loadState = | |||
result.page >= result.total ? "已加载所有项目" : "向下翻以加载更多"; | |||
}, | |||
// 刷新清空列表 | |||
async refreshList(isConcat = true) { | |||
this.page = 1; | |||
this.total = 2; | |||
this.list = []; | |||
await this.fetchList(isConcat); | |||
}, | |||
// 列表下拉 | |||
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(false); | |||
}, | |||
// 点击「清空查询条件」按钮 | |||
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 "join": | |||
// console.log(123); | |||
this.NAV_TO(`/pages/EducationalAdministration/StuLeaveManagement/Check/list?meetId=${id}`); | |||
return; | |||
case "delete": | |||
if (!(await this.CONFIRM("删除项目", "确定要删除该项吗?", true))) { | |||
return; | |||
} | |||
this.HTTP_POST( | |||
"/Learun/adms/EducationalAdministration/StuLeaveManagement/delete", | |||
id, | |||
"删除失败" | |||
).then((success) => { | |||
if (!success) { | |||
return; | |||
} | |||
this.TOAST("删除成功", "success"); | |||
this.refreshList(); | |||
}); | |||
return; | |||
case 'check': | |||
await this.HTTP_GET('/Learun/adms/EducationalAdministration/StuLeaveManagement/ischeck', id) | |||
.then(res => { | |||
if (res) { | |||
this.NAV_TO(`./single?type=edit&id=${id}`) | |||
return | |||
} else { | |||
return; | |||
} | |||
}) | |||
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; | |||
} | |||
}, | |||
// 审核状态 | |||
CheckStatusitem(data) { | |||
if (data) { | |||
return data == '1' ? '通过' : '不通过' | |||
} else { | |||
return '申请中' | |||
} | |||
}, | |||
// 请假类型审核 | |||
LeaveTypeItem(data) { | |||
}, | |||
itmeDel(data){ | |||
var newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(data) | |||
return newDate[0] | |||
} | |||
}, | |||
created() { | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import "~@/common/css/sidepage.less"; | |||
@import "~@/common/css/customlist.less"; | |||
</style> |
@@ -0,0 +1,358 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.CheckStatus', $event)" | |||
:value="getValue('StuLeaveManagement.CheckStatus')" | |||
:range="dataSource.StuLeaveManagement.CheckStatus" | |||
title="审核状态" | |||
:disabled="!edit" | |||
required | |||
/> | |||
<l-textarea | |||
@input="setValue('StuLeaveManagement.CheckRemark', $event)" | |||
:value="getValue('StuLeaveManagement.CheckRemark')" | |||
title="审核备注" | |||
:readonly="!edit" | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CheckTime', $event)" | |||
:value="getValue('StuLeaveManagement.CheckTime')" | |||
title="审核时间" | |||
v-if="!edit" | |||
:disabled="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.CheckUserNo', $event)" | |||
:value="getValue('StuLeaveManagement.CheckUserNo')" | |||
:range="dataSource.StuLeaveManagement.CheckUserNo" | |||
title="审核人" | |||
v-if="!edit" | |||
:disabled="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.LeaveType', $event)" | |||
:value="getValue('StuLeaveManagement.LeaveType')" | |||
:range="dataSource.StuLeaveManagement.LeaveType" | |||
title="请假类型" | |||
required | |||
disabled | |||
/> | |||
<l-datetime-picker | |||
@input="setValue('StuLeaveManagement.StartTime', $event)" | |||
:value="getValue('StuLeaveManagement.StartTime')" | |||
title="开始时间" | |||
required | |||
disabled | |||
/> | |||
<l-datetime-picker | |||
@input="setValue('StuLeaveManagement.EndTime', $event)" | |||
:value="getValue('StuLeaveManagement.EndTime')" | |||
title="结束时间" | |||
required | |||
disabled | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.LeaveDay', $event)" | |||
:value="getValue( String('StuLeaveManagement.LeaveDay'))" | |||
type="number" | |||
title="请假天数" | |||
disabled | |||
/> | |||
<l-textarea | |||
@input="setValue('StuLeaveManagement.LeaveReason', $event)" | |||
:value="getValue('StuLeaveManagement.LeaveReason')" | |||
title="请假事由" | |||
readonly | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CreateUserNo', $event)" | |||
:value="getValue('StuLeaveManagement.CreateUserNo')" | |||
:readonly="!edit" | |||
title="学号" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CreateUserName', $event)" | |||
:value="getValue('StuLeaveManagement.CreateUserName')" | |||
title="姓名" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CreateTime', $event)" | |||
:value="getValue('StuLeaveManagement.CreateTime')" | |||
title="申请时间" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.ClassNo', $event)" | |||
:value="getValue('StuLeaveManagement.ClassNo')" | |||
:range="dataSource.StuLeaveManagement.ClassNo" | |||
title="班级" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.DeptNo', $event)" | |||
:value="getValue('StuLeaveManagement.DeptNo')" | |||
:range="dataSource.StuLeaveManagement.DeptNo" | |||
title="系部" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.MajorNo', $event)" | |||
:value="getValue('StuLeaveManagement.MajorNo')" | |||
:range="dataSource.StuLeaveManagement.MajorNo" | |||
title="专业" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.ClassDiredctorNo', $event)" | |||
:value="getValue('StuLeaveManagement.ClassDiredctorNo')" | |||
:range="dataSource.StuLeaveManagement.ClassDiredctorNo" | |||
title="班主任" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.ClassTutorNo', $event)" | |||
:value="getValue('StuLeaveManagement.ClassTutorNo')" | |||
:range="dataSource.StuLeaveManagement.ClassTutorNo" | |||
title="辅导员" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
</view> | |||
<view v-if="ready&&(origin.StuLeaveManagement.CheckStatus=='0'||edit)" 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-2021 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-02-21 10:07 | |||
* 描 述:会议管理 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/StuLeaveManagement/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: { | |||
StuLeaveManagement: { | |||
CheckStatus: { type: 'select', title: '审核状态', dataSource: '0',verify:"NotNull" }, | |||
CheckRemark: { type: 'texteditor', title: '审核备注', }, | |||
CheckTime:{ type: 'text', title: '审核人' }, | |||
CheckUserNo: { type: 'select', title: '审核人',dataSource: '1' }, | |||
LeaveType: { type: 'select', title: '请假类型', dataSource: '0' }, | |||
StartTime: { type: 'datetime', title: '开始时间', dateformat: '0' }, | |||
EndTime: { type: 'datetime', title: '结束时间', dateformat: '0' }, | |||
LeaveDay: { type: 'number', title: '请假天数',verify:"NumOrNull" }, | |||
LeaveReason: { type: 'texteditor', title: '请假事由' }, | |||
CreateUserNo: { type: 'text', title: '学号' }, | |||
CreateUserName: { type: 'text', title: '姓名' }, | |||
CreateTime: { type: 'text', title: '申请时间' }, | |||
ClassNo: { type: 'select', title: '班级', dataSource: '1', dataSourceId: 'bjsj,classname,classno' }, | |||
DeptNo: { type: 'select', title: '系部', dataSource: '1', }, | |||
MajorNo: { type: 'select', title: '专业', dataSource: '1', }, | |||
ClassDiredctorNo: { type: 'select', title: '班主任',dataSource: '1', }, | |||
ClassTutorNo: { type: 'select', title: '辅导员',dataSource: '1', }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuLeaveManagement:{ | |||
ClassNo:[], | |||
DeptNo:[], | |||
MajorNo:[], | |||
ClassTutorNo:[], | |||
ClassDiredctorNo:[], | |||
CheckUserNo:[], | |||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | |||
CheckStatus: 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([ | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
console.log(result) | |||
this.dataSource.StuLeaveManagement.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno })) | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.ClassTutorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.CheckUserNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
console.log() | |||
this.dataSource.StuLeaveManagement.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })); | |||
}), | |||
]) | |||
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/StuLeaveManagement/form', this.id) | |||
this.origin = await this.formatFormData(result) | |||
// console.log(this.origin,this.origin.prototype) | |||
} | |||
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': | |||
// console.log(this.current) | |||
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/StuLeaveManagement/savecheck', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuLeaveManagementCheck-list-change') | |||
// this.NAV_BACK() | |||
uni.navigateBack({}) | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/Learun/adms/EducationalAdministration/StuLeaveManagement/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuLeaveManagementCheck-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> | |||
@@ -0,0 +1,484 @@ | |||
<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> | |||
{{ CheckStatusitem(displayListItem(item, "CheckStatus")) }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">审核备注:</text> | |||
{{ displayListItem(item, "CheckRemark") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">审核人:</text> | |||
{{ displayListItem(item, "CheckUserNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">请假类型:</text> | |||
{{ displayListItem(item, "LeaveType") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">开始时间:</text> | |||
{{ itmeDel(displayListItem(item, "StartTime")) }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">结束时间:</text> | |||
{{ itmeDel(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, "LeaveReason") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">学号:</text> | |||
{{ displayListItem(item, "CreateUserNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">姓名:</text> | |||
{{ displayListItem(item, "CreateUserName") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">申请时间:</text> | |||
{{ displayListItem(item, "CreateTime") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">班级:</text> | |||
{{ displayListItem(item, "ClassNo") }} | |||
</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, "MajorNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">班主任:</text> | |||
{{ displayListItem(item, "ClassDiredctorNo") }} | |||
</view> | |||
<view class="customlist-item-field"> | |||
<text class="customlist-item-field-title">辅导员:</text> | |||
{{ displayListItem(item, "ClassTutorNo") }} | |||
</view> | |||
<l-customlist-action @join="action('join', item.Id)" :showEdit="!item.CheckStatus" | |||
@edit="action('edit', item.Id)" :showDelete="!item.CheckStatus" | |||
@delete="action('delete', 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-select v-model="queryData.LeaveType" @change="searchChange" :range="dataSource.LeaveType" | |||
title="请假类型" placeholder="按请假类型查询" /> | |||
<l-select v-model="queryData.CheckStatus" @change="searchChange" :range="dataSource.CheckStatus" | |||
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-2021 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-02-21 10:07 | |||
* 描 述:会议管理 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/MeetingManagement/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: { | |||
CheckStatus: { | |||
type: "text" | |||
}, | |||
CheckRemark: { | |||
type: "text" | |||
}, | |||
CheckTime: { | |||
type: "text" | |||
}, | |||
CheckUserNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'CheckUserNo' | |||
}, | |||
LeaveType: { | |||
type: "select",dataSource: '1', dataSourceId: 'LeaveType' | |||
}, | |||
StartTime: { | |||
type: "text" | |||
}, | |||
EndTime: { | |||
type: "text" | |||
}, | |||
LeaveDay: { | |||
type: "text" | |||
}, | |||
LeaveReason: { | |||
type: "text" | |||
}, | |||
CreateUserNo: { | |||
type: "text" | |||
}, | |||
CreateUserName: { | |||
type: "text" | |||
}, | |||
CreateTime: { | |||
type: "text" | |||
}, | |||
ClassNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'ClassNo' | |||
}, | |||
DeptNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'DeptNo' | |||
}, | |||
MajorNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'MajorNo' | |||
}, | |||
ClassDiredctorNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'ClassDiredctorNo' | |||
}, | |||
ClassTutorNo: { | |||
type: "select",dataSource: '1', dataSourceId: 'ClassTutorNo' | |||
} | |||
}, | |||
// 查询条件 | |||
searchData: {}, | |||
defaultQueryData: {}, | |||
queryData: { | |||
LeaveType: "", | |||
CheckStatus: '', | |||
// CreateUser: "", | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
ClassNo:[], | |||
DeptNo:[], | |||
MajorNo:[], | |||
ClassDiredctorNo:[], | |||
CheckUserNo:[], | |||
ClassTutorNo:[], | |||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ | |||
value: t.value, | |||
text: t.text | |||
})), | |||
CheckStatus: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({ | |||
value: t.value, | |||
text: t.text | |||
})), | |||
}, | |||
// 页面相关参数 | |||
ready: false, | |||
tips: "加载中...", | |||
loadState: "向下翻以加载更多", | |||
sideOpen: false, | |||
// 列表与分页信息 | |||
page: 1, | |||
total: 2, | |||
list: [], | |||
user: null, | |||
}; | |||
}, | |||
async onLoad() { | |||
await this.init(); | |||
}, | |||
onUnload() { | |||
this.OFF("EducationalAdministrationStuLeaveManagement-list-change"); | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.ON( | |||
"EducationalAdministrationStuLeaveManagement-list-change", | |||
this.refreshList | |||
); | |||
// 拉取加载列表和数据源 | |||
await Promise.all([ | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
this.dataSource.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno })) | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.ClassTutorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.CheckUserNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })); | |||
}), | |||
]); | |||
await this.fetchList(); | |||
// 初始化查询条件 | |||
this.defaultQueryData = this.COPY(this.queryData); | |||
this.ready = true; | |||
}, | |||
// 拉取列表 | |||
async fetchList(isConcat = true) { | |||
if (this.page > this.total) { | |||
return; | |||
} | |||
const result = await this.HTTP_GET( | |||
"/Learun/adms/EducationalAdministration/StuLeaveManagement/pagelist", { | |||
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) | |||
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 | |||
pagination: { | |||
rows: 10, | |||
page: this.page, | |||
sidx: "CreateTime", | |||
sord: "DESC" | |||
}, | |||
queryJson: JSON.stringify(Object.assign(this.searchData, { | |||
StuNo: this.user.account | |||
})), | |||
}, | |||
"加载数据时出错" | |||
); | |||
if (!result) { | |||
return; | |||
} | |||
this.total = result.total; | |||
this.page = result.page + 1; | |||
this.list = isConcat ? this.list.concat(result.rows) : result.rows; | |||
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${ | |||
result.total | |||
} 页,共 ${result.records} 项`; | |||
this.loadState = | |||
result.page >= result.total ? "已加载所有项目" : "向下翻以加载更多"; | |||
}, | |||
// 刷新清空列表 | |||
async refreshList(isConcat = true) { | |||
this.page = 1; | |||
this.total = 2; | |||
this.list = []; | |||
await this.fetchList(isConcat); | |||
}, | |||
// 列表下拉 | |||
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(false); | |||
}, | |||
// 点击「清空查询条件」按钮 | |||
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 "join": | |||
// console.log(123); | |||
this.NAV_TO(`/pages/EducationalAdministration/StuLeaveManagement/list?meetId=${id}`); | |||
return; | |||
case "delete": | |||
if (!(await this.CONFIRM("删除项目", "确定要删除该项吗?", true))) { | |||
return; | |||
} | |||
this.HTTP_POST( | |||
"/Learun/adms/EducationalAdministration/StuLeaveManagement/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; | |||
} | |||
}, | |||
// 审核状态 | |||
CheckStatusitem(data) { | |||
if (data) { | |||
return data == '1' ? '通过' : '不通过' | |||
} else { | |||
return '申请中' | |||
} | |||
}, | |||
// 请假类型审核 | |||
LeaveTypeItem(data) { | |||
}, | |||
itmeDel(data){ | |||
var newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(data) | |||
return newDate[0] | |||
} | |||
}, | |||
created() { | |||
this.user = this.GET_GLOBAL('loginUser'); | |||
} | |||
}; | |||
</script> | |||
<style lang="less" scoped> | |||
@import "~@/common/css/sidepage.less"; | |||
@import "~@/common/css/customlist.less"; | |||
</style> |
@@ -0,0 +1,382 @@ | |||
<template> | |||
<view class="page"> | |||
<view v-if="ready"> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.CheckStatus', $event)" | |||
:value="getValue('StuLeaveManagement.CheckStatus')" | |||
:range="dataSource.StuLeaveManagement.CheckStatus" | |||
title="审核状态" | |||
:disabled="!edit" | |||
v-if="!edit" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuLeaveManagement.CheckRemark', $event)" | |||
:value="getValue('StuLeaveManagement.CheckRemark')" | |||
title="审核备注" | |||
v-if="!edit" | |||
:readonly="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.CheckUserNo', $event)" | |||
:value="getValue('StuLeaveManagement.CheckUserNo')" | |||
:range="dataSource.StuLeaveManagement.CheckUserNo" | |||
title="审核人" | |||
v-if="!edit" | |||
:disabled="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.LeaveType', $event)" | |||
:value="getValue('StuLeaveManagement.LeaveType')" | |||
:range="dataSource.StuLeaveManagement.LeaveType" | |||
title="请假类型" | |||
required | |||
:disabled="!edit" | |||
/> | |||
<l-date-picker | |||
@input="setValue('StuLeaveManagement.StartTime', $event)" | |||
:value="getValue('StuLeaveManagement.StartTime')" | |||
:disabled="!edit" | |||
required | |||
title="开始时间" | |||
/> | |||
<l-date-picker | |||
@input="setValue('StuLeaveManagement.EndTime', $event)" | |||
:value="getValue('StuLeaveManagement.EndTime')" | |||
:disabled="!edit" | |||
required | |||
title="结束时间" | |||
/> | |||
<!-- <l-datetime-picker | |||
@input="setValue('StuLeaveManagement.StartTime', $event)" | |||
:value="getValue('StuLeaveManagement.StartTime')" | |||
title="开始时间" | |||
required | |||
:disabled="!edit" | |||
/> | |||
<l-datetime-picker | |||
@input="setValue('StuLeaveManagement.EndTime', $event)" | |||
:value="getValue('StuLeaveManagement.EndTime')" | |||
title="结束时间" | |||
required | |||
:disabled="!edit" | |||
/> --> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.LeaveDay', $event)" | |||
:value="getValue( String('StuLeaveManagement.LeaveDay'))" | |||
type="number" | |||
title="请假天数" | |||
:disabled="!edit" | |||
/> | |||
<l-textarea | |||
@input="setValue('StuLeaveManagement.LeaveReason', $event)" | |||
:value="getValue('StuLeaveManagement.LeaveReason')" | |||
title="请假事由" | |||
:readonly="!edit" | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CreateUserNo', $event)" | |||
:value="getValue('StuLeaveManagement.CreateUserNo')" | |||
:readonly="!edit" | |||
title="学号" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CreateUserName', $event)" | |||
:value="getValue('StuLeaveManagement.CreateUserName')" | |||
title="姓名" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-input | |||
@input="setValue('StuLeaveManagement.CreateTime', $event)" | |||
:value="getValue('StuLeaveManagement.CreateTime')" | |||
title="申请时间" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.ClassNo', $event)" | |||
:value="getValue('StuLeaveManagement.ClassNo')" | |||
:range="dataSource.StuLeaveManagement.ClassNo" | |||
title="班级" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.DeptNo', $event)" | |||
:value="getValue('StuLeaveManagement.DeptNo')" | |||
:range="dataSource.StuLeaveManagement.DeptNo" | |||
title="系部" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.MajorNo', $event)" | |||
:value="getValue('StuLeaveManagement.MajorNo')" | |||
:range="dataSource.StuLeaveManagement.MajorNo" | |||
title="专业" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.ClassDiredctorNo', $event)" | |||
:value="getValue('StuLeaveManagement.ClassDiredctorNo')" | |||
:range="dataSource.StuLeaveManagement.ClassDiredctorNo" | |||
title="班主任" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
<l-select | |||
@input="setValue('StuLeaveManagement.ClassTutorNo', $event)" | |||
:value="getValue('StuLeaveManagement.ClassTutorNo')" | |||
:range="dataSource.StuLeaveManagement.ClassTutorNo" | |||
title="辅导员" | |||
disabled | |||
v-if="!edit" | |||
/> | |||
</view> | |||
<view v-if="ready&&(origin.StuLeaveManagement.CheckStatus=='0'||edit)" 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-2021 上海力软信息技术有限公司 | |||
* 创建人:超级管理员 | |||
* 日 期:2021-02-21 10:07 | |||
* 描 述:会议管理 | |||
*/ | |||
/** | |||
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用 | |||
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录: | |||
* { "path": "pages/PersonnelManagement/StuLeaveManagement/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: { | |||
StuLeaveManagement: { | |||
CheckStatus: { type: 'select', title: '审核状态', dataSource: '0' }, | |||
CheckRemark: { type: 'texteditor', title: '审核备注', }, | |||
CreateUserNo: { type: 'text', title: '学号' }, | |||
LeaveType: { type: 'select', title: '请假类型', dataSource: '0',verify:"NotNull" }, | |||
StartTime: { type: 'datetime', title: '开始时间',verify:"NotNull", dateformat: '0' }, | |||
EndTime:{type: 'datetime', title: '结束时间', verify:"NotNull",dateformat: '0'}, | |||
// StartTime: { type: 'datetime', title: '开始时间', dateformat: '1',verify:"NotNull" }, | |||
// EndTime: { type: 'datetime', title: '结束时间',dateformat: '1', verify:"NotNull" }, | |||
LeaveDay: { type: 'number', title: '请假天数',verify:"NumOrNull" }, | |||
LeaveReason: { type: 'texteditor', title: '请假事由' }, | |||
CheckUserNo: { type: 'select', title: '审核人',dataSource: '1' }, | |||
CreateUserName: { type: 'text', title: '姓名' }, | |||
CreateTime: { type: 'text', title: '申请时间' }, | |||
ClassNo: { type: 'select', title: '班级', dataSource: '1', dataSourceId: 'bjsj,classname,classno' }, | |||
DeptNo: { type: 'select', title: '系部', dataSource: '1', }, | |||
MajorNo: { type: 'select', title: '专业', dataSource: '1', }, | |||
ClassDiredctorNo: { type: 'select', title: '班主任',dataSource: '1', }, | |||
ClassTutorNo: { type: 'select', title: '辅导员',dataSource: '1', }, | |||
}, | |||
}, | |||
// 数据源 | |||
dataSource: { | |||
StuLeaveManagement:{ | |||
ClassNo:[], | |||
DeptNo:[], | |||
MajorNo:[], | |||
ClassTutorNo:[], | |||
ClassDiredctorNo:[], | |||
CheckUserNo:[], | |||
LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({ value: t.value, text: t.text })), | |||
CheckStatus: 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([ | |||
// this.FETCH_DATASOURCE('ConferenceRoom').then(result => { | |||
// this.dataSource.StuLeaveManagement.CheckStatus = result.data.map(t => ({ text: t.name, value: t.id })) | |||
// }), | |||
this.FETCH_DATASOURCE('bjsj').then(result => { | |||
console.log(result) | |||
this.dataSource.StuLeaveManagement.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno })) | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.ClassTutorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('EmpInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.CheckUserNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdDeptInfo').then(result => { | |||
this.dataSource.StuLeaveManagement.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno })); | |||
}), | |||
this.FETCH_DATASOURCE('CdMajorInfo').then(result => { | |||
console.log() | |||
this.dataSource.StuLeaveManagement.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno })); | |||
}), | |||
]) | |||
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/StuLeaveManagement/form', this.id) | |||
this.origin = await this.formatFormData(result) | |||
// console.log(this.origin,this.origin.prototype) | |||
} | |||
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 | |||
this.EMIT('EducationalAdministrationStuLeaveManagement-list-change') | |||
// this.NAV_BACK() | |||
uni.navigateBack({}) | |||
break | |||
case 'save': | |||
const verifyResult = this.verifyForm() | |||
if (verifyResult.length > 0) { | |||
this.CONFIRM('表单验证失败', verifyResult.join('\n')) | |||
return | |||
} | |||
let StartTime = Date.parse(this.current.StuLeaveManagement.StartTime) | |||
let EndTime = Date.parse(this.current.StuLeaveManagement.EndTime) | |||
if(StartTime > EndTime){ | |||
this.TOAST('结束时间不能早于开始时间') | |||
return | |||
} | |||
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) { | |||
return | |||
} | |||
this.LOADING('正在提交...') | |||
const postData = await this.getPostData(this.id) | |||
this.HTTP_POST('/Learun/adms/EducationalAdministration/StuLeaveManagement/save', postData, '表单提交保存失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuLeaveManagement-list-change') | |||
// this.NAV_BACK() | |||
uni.navigateBack({}) | |||
this.TOAST('提交保存成功') | |||
}) | |||
break | |||
case 'delete': | |||
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) { | |||
return | |||
} | |||
this.LOADING('提交删除中...') | |||
this.HTTP_POST('/Learun/adms/EducationalAdministration/StuLeaveManagement/delete', this.id, '删除失败').then(success => { | |||
this.HIDE_LOADING() | |||
if (!success) { | |||
return | |||
} | |||
this.EMIT('EducationalAdministrationStuLeaveManagement-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> | |||