This commit is contained in:
2025-09-22 20:30:34 +08:00
99 changed files with 3031 additions and 7693 deletions
@@ -146,10 +146,10 @@ public class SysHomeController {
@At
@SaCheckLogin
@ApiOperation("电脑端快速入口")
@ApiOperation("电脑端推荐应用")
@Ok("json")
public Result listQuickEntry(String platform) {
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsQuickEntry, "=", 1)
public Result listRecommendApp(String platform) {
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsRecommendApp, "=", 1)
.and(Sys_menu::getDisabled, "=", 0)
.and(Sys_menu::getShowit, "=", 1)
.and(Sys_menu::getPlatform, "=", platform)
@@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@IocBean
@At("/platform/sys/menu")
@@ -422,11 +423,16 @@ public class SysMenuController {
@At
@Ok("json")
@SaCheckPermission("sys.manager.menu")
@ApiOperation("更新快捷入口")
public Result updateQuickEntry(@Param("menuIds") String[] menuIds, String platform) {
sysMenuService.update(Chain.make("isQuickEntry", 0), Cnd.where("id", "is not", null).and("platform", "=", platform));
@ApiOperation("更新首页推荐应用或服务")
public Result updateRecommendSetting(@Param("menuIds") String[] menuIds, String platform, String type) {
String column = "";
switch (type) {
case "app" -> column = "isRecommendApp";
case "service" -> column = "isRecommendService";
}
sysMenuService.update(Chain.make(column, 0), Cnd.where("id", "is not", null).and("platform", "=", platform));
if (ArrayUtil.isNotEmpty(menuIds)) {
sysMenuService.update(Chain.make("isQuickEntry", 1), Cnd.where("id", "in", menuIds).and("platform", "=", platform));
sysMenuService.update(Chain.make(column, 1), Cnd.where("id", "in", menuIds).and("platform", "=", platform));
}
return Result.success();
}
@@ -121,11 +121,17 @@ public class Sys_menu extends BaseModel implements Serializable {
@ColDefine(type = ColType.VARCHAR, width = 32)
private String moduleId;
@Column
@Comment("是否是推荐应用")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isRecommendApp;
@Column
@Comment("是否是快捷入口")
@Comment("是否是推荐服务")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isQuickEntry;
private Boolean isRecommendService;
//按钮权限
private List<Sys_menu> buttons;
@@ -87,12 +87,10 @@ public class FamilyActivityApplyController {
cnd.andEX("`year`", "=", year);
//查询报名中
if (activityType == 2) {
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
cnd.and(new Static("now() < activitySignUpEndTime"));
}//查询已结束的
else if (activityType == 3) {
cnd.and(new Static("now() > activityEndTime"));
} else if (activityType == 4) {
cnd.and(new Static("now() < activitySignUpStartTime"));
cnd.and(new Static("now() >= activityEndTime"));
}
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
@@ -1,24 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.constant;
import com.budwk.app.base.annotation.DictEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @Author JyuHsin
* @Date 2022/11/18
* @Description
*/
@Getter
@DictEnum(key = "ColumnFormTypeEnum", name = "控件类型")
@AllArgsConstructor
public enum ColumnFormTypeEnum {
INPUT("INPUT", "输入框"),
SELECT("SELECT", "选择框"),
//RADIO("RADIO", "单选框"),//选项数组
FILE("FILE", "文件");
private String code;
private String description;
}
@@ -1,96 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.manage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @author zxy
* @Description 新建活动
* @createTime 2022年03月07日 10:16:00
*/
@Slf4j
@IocBean
@Api(tags = "新建品牌活动")
@At("/platform/literacy/manage/activity")
public class LiteracyActivityAddController {
@Inject
private Dao dao;
@Inject
private LiteracyActivityService literacySignUpActivityManageService;
@At
@Ok("json:full")
@ApiOperation("品牌活动新增/修改")
@SaCheckPermission("literacy.manage.activity")
@SLog(tag = "品牌活动-活动管理", msg = "新增/修改活动")
public Result doHandle(LiteracyActivity activity) {
if (StrUtil.isBlank(activity.getId())) {
literacySignUpActivityManageService.add(activity, null);
} else {
literacySignUpActivityManageService.edit(activity);
}
return Result.success();
}
@At
@Ok("json:full")
@ApiOperation("获取分工会人数限制")
@SaCheckPermission("literacy.manage.activity")
public Result getUnionLimit(@Param(value = "activityScopeId") String activityScopeId) {
Sql sql = Sqls.create("""
SELECT
gh.id,
gh.name,
gh.unioncode,
(select count(1) from `vw_user` where unionid = gh.id $cnd) as teacherCount,
NULL as ratio,
NULL as limitCount
FROM
sys_union gh
order by gh.unioncode
""");
if (StrUtil.isNotBlank(activityScopeId)) {
sql.setVar("cnd", "AND id in (select userId from activity_user_scope where groupId = '" + activityScopeId + "')");
}
List<NutMap> list = literacySignUpActivityManageService.listMap(sql);
return Result.success().addData(list);
}
@At
@Ok("json:full")
@ApiOperation("获取报名人员数量")
@SaCheckPermission("literacy.manage.activity")
public Result getRegisterUserCount(@Param(value = "courseId") String courseId) {
return Result.success().addData(dao.count(LiteracyUser.class, Cnd.where("courseId", "=", courseId)));
}
@At
@Ok("json:full")
@ApiOperation("获取历史活动列表")
@SaCheckPermission("literacy.manage.activity")
public Result getHistoricalActList() {
List<LiteracyActivity> query = dao.query(LiteracyActivity.class, Cnd.NEW().desc("activityStartTime"));
return Result.success().addData(query);
}
}
@@ -1,176 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.manage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_dict;
import com.budwk.app.sys.services.SysDictService;
import com.budwk.app.web.commons.auth.utils.AuthUtil;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivityCourse;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "活动报名")
@At("/platform/literacy/manage/apply")
public class LiteracyActivityApplyController {
@Inject
private LiteracyActivityService literacyActivityService;
@Inject
private SysDictService dictService;
@Inject
private LiteracyActivityStatisticsService statisticsService;
@At("")
@SaCheckPermission("literacy.manage.apply")
@Ok("beetl:/platform/zhgh/activity/literacy/apply/index.html")
public void index() {
}
@At
@ApiOperation("活动查询")
@SaCheckPermission("literacy.manage.apply")
public Result activityData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "activityType") Integer activityType) {
Cnd cnd = Cnd.NEW();
cnd.andEX("`year`", "=", year);
//查询报名中
if (activityType == 2) {
cnd.and(new Static("now() > activitySignUpStartTime and now() < activitySignUpEndTime"));
}//查询已结束的
else if (activityType == 3) {
cnd.and(new Static("now() > activityEndTime"));
}
if (AuthUtil.hasRole("H04") && !AuthUtil.hasRoleOr("sysadmin, A06")) {
cnd.and("activityMode", "=", 2).and("createdBy", "=", SecurityUtil.getUserId());
}
Pagination pagination = literacyActivityService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
List<LiteracyActivity> literacyActivities = pagination.getList();
Map<String, String> literacyTypeMap = dictService.getSubListByCode("LITERACY_SIGNUP_TYPE").stream().collect(Collectors.toMap(Sys_dict::getCode, Sys_dict::getName));
literacyActivities.forEach(v -> v.setLiteracyType(literacyTypeMap.get(v.getLiteracyType())));
return Result.success(pagination);
}
@At
@ApiOperation("分活动查询")
@SaCheckPermission("literacy.manage.apply")
public Result pageData(PageForm pageForm,
@Param(value = "courseTypeId") String courseTypeId,
@Param(value = "activityId") String activityId,
@Param(value = "assortTypes") String[] assortTypes) {
Sql sql = Sqls.create("""
SELECT
tsuc.id,
tsuc.activityId,
tsuc.courseName,
tsuc.coursePeopleNumber,
tsuc.courseLocation,
tsuc.courseType,
tsuc.courseLocationCoordinates,
tsuc.courseReservedNumber,
tsuc.courseInstructor,
tsuc.campus,
tsuc.unionLimit,
tsuc.isMobileSign,
tsuc.signType,
tsuc.isReceiveGift,
tsuc.giftType,
tsuc.reserveMode,
tsuc.waitingNum,
tsuc.assort,
type.typeName,
tsuc.courseIsLimitApply
FROM
`literacy_course` tsuc
LEFT JOIN literacy_type type ON type.id = tsuc.courseType
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("type.id", "=", courseTypeId);
cnd.and("tsuc.activityId", "=", activityId);
if(Lang.isNotEmpty(assortTypes)) {
cnd.and("tsuc.assort", "in", assortTypes);
}
List<LiteracyCourse> courseArray = literacyActivityService.dao().query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
courseArray = literacyActivityService.filterCourseByHostUnion(courseArray);
cnd.and("tsuc.id", "in", courseArray.stream().map(LiteracyCourse::getId).toList());
cnd.asc("tsuc.orderNum");
cnd.asc("type.code");
sql.setCondition(cnd);
Pagination pagination = literacyActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> courseList = pagination.getList();
courseList.forEach(c -> {
c.put("hasRegisterNum", statisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
c.put("hasWaitingNum", statisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
//当前用户是否报过
c.put("isSign", literacyActivityService.isSignCourseByUser(c.getString("id"), SecurityUtil.getUserId()));
if(StrUtil.isNotBlank(c.getString("unionLimit"))) {
List<NutMap> unionLimit = Json.fromJsonAsList(NutMap.class, c.getString("unionLimit"));
if(Lang.isNotEmpty(unionLimit)) {
NutMap nutMap = unionLimit.stream().filter(o -> o.getString("id").equals(SecurityUtil.getUnionId())).findFirst().orElse(null);
if(nutMap != null) {
c.put("coursePeopleNumber", nutMap.getInt("limitCount"));
}
}
}
});
return Result.success(pagination);
}
@At
@ApiOperation("获取分活动时间")
@SaCheckPermission("literacy.manage.apply")
public Result getCourseTime(String id) {
List<LiteracyActivityCourse> list = literacyActivityService.dao().query(LiteracyActivityCourse.class, Cnd.where("courseId", "=", id));
return Result.success(list);
}
@At
@ApiOperation("查询分类标识集合")
@SaCheckPermission("literacy.manage.apply")
public Result queryCourseAssort(String activityId) {
List<LiteracyCourse> courseList = literacyActivityService.dao().query(LiteracyCourse.class, Cnd.where(LiteracyCourse::getActivityId, "=", activityId).asc(LiteracyCourse::getOrderNum));
if(Lang.isEmpty(courseList)) {
return Result.success(new ArrayList<>());
}
List<String> assortList = courseList.stream().map(LiteracyCourse::getAssort).filter(StrUtil::isNotBlank).toList();
return Result.success(assortList);
}
}
@@ -1,144 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.manage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.zhgh.activity.literacy.models.*;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.trans.Trans;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author zxy
* @Description 培训报名 活动管理
* @createTime 2022年02月23日 09:57:00
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "活动管理")
@At("/platform/literacy/manage/activity")
public class LiteracyActivityController {
@Inject
private LiteracyActivityService literacySignUpActivityManageService;
@Inject
private Dao dao;
@At("")
@SaCheckPermission("literacy.manage.activity")
@Ok("beetl:/platform/zhgh/activity/literacy/manage/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("literacy.manage.activity")
public Result pageData(PageForm pageForm,
@Param(value = "year") Integer year,
@Param(value = "activityName") String activityName) {
Cnd cnd = Cnd.NEW();
cnd.andEX("year", "=", year);
cnd.and(Cnd.likeEX("activityName", activityName));
cnd.orderBy("createdAt", "desc");
return Result.success().addData(literacySignUpActivityManageService.pageData(pageForm, cnd));
}
@At
@ApiOperation("活动删除")
@SaCheckPermission("literacy.manage.activity")
@SLog(tag = "品牌活动-活动管理", msg = "删除活动")
public Result onDelete(String id) {
Trans.exec(() -> {
literacySignUpActivityManageService.delete(id);
dao.clear(LiteracyCourse.class, Cnd.where("activityId", "=", id));
dao.clear(LiteracyActivityCourse.class, Cnd.where("activityId", "=", id));
dao.clear(LiteracyUser.class, Cnd.where("activityId", "=", id));
dao.clear(LiteracyUserCourse.class, Cnd.where("activityId", "=", id));
dao.clear(LiteracyActivity.class, Cnd.where("id", "=", id));
dao.clear(LiteracyTypeLimit.class, Cnd.where("activityId", "=", id));
dao.delete(Sys_home_activity.class, id);
});
return Result.success();
}
@At
@ApiOperation("活动状态变更")
@SaCheckPermission("literacy.manage.activity")
public Result activityStatusChange(LiteracyActivity activity) {
literacySignUpActivityManageService.updateActivityStatus(activity);
dao.update(Sys_home_activity.class,
Chain.make("enable", !activity.isDisabled()),
Cnd.where("id", "=", activity.getId()));
return Result.success();
}
@At
@ApiOperation("查询单个活动")
@SaCheckPermission("literacy.manage.activity")
public Result findOne(@Param("id") @NotNull String id) {
NutMap dataMap = literacySignUpActivityManageService.findOne(id, null, "");
String activityStartTime = dataMap.getString("activityStartTime");
String activityEndTime = dataMap.getString("activityEndTime");
if(StrUtil.isNotBlank(activityStartTime) && StrUtil.isNotBlank(activityEndTime)) {
dataMap.put("activityTime", List.of(activityStartTime, activityEndTime));
} else {
dataMap.put("activityTime", new ArrayList<>());
}
String activitySignUpStartTime = dataMap.getString("activitySignUpStartTime");
String activitySignUpEndTime = dataMap.getString("activitySignUpEndTime");
if(StrUtil.isNotBlank(activitySignUpStartTime) && StrUtil.isNotBlank(activitySignUpEndTime)) {
dataMap.put("activitySignTime", List.of(activitySignUpStartTime, activitySignUpEndTime));
} else {
dataMap.put("activitySignTime", new ArrayList<>());
}
List<NutMap> courseList = dataMap.getList("courseList", NutMap.class);
//查询所有的课程类型
List<LiteracyType> literacySignUpTypeList = dao.query(LiteracyType.class, Cnd.NEW());
Map<String, String> typeMap = literacySignUpTypeList.stream().collect(Collectors.toMap(LiteracyType::getId, LiteracyType::getTypeName));
courseList.forEach(v -> {
List<NutMap> courseTimeList = v.getList("courseTimeList", NutMap.class);
//选择课程日期 下拉框
List<String> setUpCourseData = courseTimeList.stream().map(cd -> cd.getString("courseDate")).distinct().collect(Collectors.toList());
v.put("setUpCourseData", setUpCourseData);
courseTimeList.forEach(ct -> {
String courseStartTime = DateUtil.format(ct.getTime("courseStartTime"), "HH:mm");
String courseEndTime = DateUtil.format(ct.getTime("courseEndTime"), "HH:mm");
ct.put("courseStartTime", courseStartTime);
ct.put("courseEndTime", courseEndTime);
});
v.put("courseTypeName", typeMap.get(v.getString("courseType")));
});
return Result.success().addData(dataMap);
}
}
@@ -1,167 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.manage;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.EnumUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyMobileSignColumn;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
/**
* @Author JyuHsin
* @Date 2022/9/22
* @Description
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "活动类型管理")
@At("/platform/literacy/manage/type")
public class LiteracyTypeController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@At("")
@SaCheckPermission("literacy.manage.type")
@Ok("beetl:/platform/zhgh/activity/literacy/type/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("literacy.manage.type")
public Result pageData(PageForm pageForm,
@Param(value = "typeName") String typeName) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
select * from literacy_type $condition
""");
if (Strings.isNotBlank(typeName)) {
cnd.and("typeName", "like", "%" + typeName + "%");
}
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
} else {
cnd.asc("xh");
}
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> list = pagination.getList();
list.forEach(item -> {
Cnd c = Cnd.NEW();
c.and("typeId", "=", item.getString("id"));
c.asc("columnIndex");
List<LiteracyMobileSignColumn> signColumns = dao.query(LiteracyMobileSignColumn.class, c);
item.put("literacyMobileSignColumnList", signColumns);
});
return Result.success().addData(pagination);
}
@At
@ApiOperation("活动类型新增")
@SaCheckPermission("literacy.manage.type")
@SLog(tag = "品牌活动-类型管理", msg = "活动类型新增")
public Result doAdd(@Param("data") String data) throws Exception {
LiteracyType type = Json.fromJson(LiteracyType.class, data);
int count = dao.count(LiteracyType.class, Cnd.where("code", "=", type.getCode()));
if (count > 0) {
return Result.error("编码重复!");
}
int totalCount = dao.count(LiteracyType.class);
type.setXh(totalCount + 1);
dao.insertWith(type, "literacyMobileSignColumnList");
return Result.success();
}
@At
@ApiOperation("活动类型修改")
@SaCheckPermission("literacy.manage.type")
@SLog(tag = "品牌活动-类型管理", msg = "活动类型修改")
public Result doEdit(LiteracyType type) {
int count = dao.count(LiteracyType.class, Cnd.where("code", "=", type.getCode()).and("id", "!=", type.getId()));
if (count > 0) {
return Result.error("编码重复!");
}
dao.update(type);
dao.clear(LiteracyMobileSignColumn.class, Cnd.where("typeId", "=", type.getId()));
dao.insertLinks(type, "literacyMobileSignColumnList");
return Result.success();
}
@At
@ApiOperation("活动类型删除")
@SaCheckPermission("literacy.manage.type")
@SLog(tag = "品牌活动-类型管理", msg = "活动类型删除")
public Object doDelete(@Param(value = "id") String id) {
dao.clear(LiteracyType.class, Cnd.where("id", "=", id));
dao.clear(LiteracyMobileSignColumn.class, Cnd.where("typeId", "=", id));
return Result.success();
}
@At
@Aop(TransAop.READ_COMMITTED)
@ApiOperation("排序号变更")
@SaCheckPermission("literacy.manage.type")
public Object xhChange(String id, Integer xh, boolean toDown) {
if (toDown) {
LiteracyType next = dao.fetch(LiteracyType.class, Cnd.where("xh", "=", xh + 1));
next.setXh(next.getXh() - 1);
dao.update(next);
dao.update(LiteracyType.class, Chain.make("xh", xh + 1), Cnd.where("id", "=", id));
} else {
LiteracyType pre = dao.fetch(LiteracyType.class, Cnd.where("xh", "=", xh - 1));
pre.setXh(pre.getXh() + 1);
dao.update(pre);
dao.update(LiteracyType.class, Chain.make("xh", xh - 1), Cnd.where("id", "=", id));
}
return Result.success();
}
@At
@ApiOperation("获取所有类型")
@SaCheckLogin
public Result getAllType(@Param(value = "id") String id) {
List<LiteracyType> literacyTypeList = dao.query(LiteracyType.class, Cnd.NEW().andEX("id", "=", id).asc("xh"));
dao.fetchLinks(literacyTypeList, "literacyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
return Result.success().addData(literacyTypeList);
}
@At
@ApiOperation("自定义表单字段类型")
@SaCheckPermission("literacy.manage.type")
public Result getColumnType() {
List<String> names = EnumUtil.getNames(ColType.class);
names.add("JSON");
return Result.success(names);
}
}
@@ -1,179 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.manage;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivityCourse;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUserCourse;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.ArrayList;
import java.util.List;
/**
* @Author JyuHsin
* @Date 2022/9/21
* @Description 人员调整
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "品牌活动人员调整")
@At("/platform/literacy/manage/userAdjust")
public class LiteracyUserAdjustController {
@Inject
private Dao dao;
@Inject
private BaseService baseService;
@Inject
private LiteracyActivityService literacyActivityManageService;
@Inject
private LiteracyActivityStatisticsService literacyActivityStatisticsService;
@At("")
@SaCheckPermission("literacy.manage.activity.adjust")
@Ok("beetl:/platform/zhgh/activity/literacy/userAdjust/index.html")
public void index() {
}
/**
* 活动list
* @param year 年度
* @return
*/
@At
@ApiOperation("活动列表")
@SaCheckPermission("literacy.manage.activity.adjust")
public Result activityList(@Param(value = "year") Integer year) {
List<LiteracyActivity> activityList = dao.query(LiteracyActivity.class, Cnd.NEW().andEX("year", "=", year).andEX("isDisabled", "=", false).desc("activityStartTime"));
return Result.success(activityList);
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("literacy.manage.activity.adjust")
public Result pageData(PageForm pageForm,
@Param(value = "activityId") String activityId) {
Pagination pagination = literacyActivityStatisticsService.pageData(pageForm, activityId);
return Result.success(pagination);
}
@At
@ApiOperation("子活动查询")
@SaCheckPermission("literacy.manage.activity.adjust")
public Result getCourse(String activityId) {
Sql sql = Sqls.create("""
SELECT
tsuc.id,
tsuc.courseName,
tsuc.coursePeopleNumber,
tsuc.courseType,
tsuc.courseLocation,
tsuc.courseInstructor,
tsuc.courseReservedNumber,
tsuc.waitingNum,
tsuc.reserveMode
FROM
`literacy_course` tsuc
WHERE
tsuc.activityId = @activityId
ORDER BY courseName asc
""");
sql.setParam("activityId", activityId);
List<NutMap> courseList = baseService.listMap(sql);
courseList.forEach(c -> {
c.put("registerNum", literacyActivityStatisticsService.queryCourseCount(c.getString("id"), c.getString("courseType")));
c.put("hasWaitingNum", literacyActivityStatisticsService.queryCourseWaitCount(c.getString("id"), c.getString("courseType")));
});
return Result.success(courseList);
}
@At
@ApiOperation("报名用户列表")
@SaCheckPermission("literacy.manage.activity.adjust")
public Result registerUserList(@Param("courseId") String courseId,
@Param(value = "unionId") String unionId,
@Param(value = "unitId") String unitId,
@Param(value = "searchName") String searchName,
@Param(value = "searchKeyword") String searchKeyword) {
List<NutMap> list = literacyActivityStatisticsService.registerUserList(courseId, unionId, unitId, searchName, searchKeyword);
return Result.success(list);
}
@At
@ApiOperation("人员调整")
@SaCheckPermission("literacy.manage.activity.adjust")
@SLog(tag = "品牌活动-人员调整", msg = "人员调整")
public Result adjust(String activityId, String oldCourseId, String newCourseId, String userId) {
Cnd oldCnd = Cnd.where("activityId", "=", activityId)
.and("courseId", "=", oldCourseId).and("userId", "=", userId);
Cnd newCnd = Cnd.where("activityId", "=", activityId)
.and("courseId", "=", newCourseId).and("userId", "=", userId);
//旧的报名信息
LiteracyUser oldliteracyUser = dao.fetch(LiteracyUser.class, oldCnd);
oldliteracyUser.setCourseId(newCourseId);
oldliteracyUser.setSignUpTime(DateUtil.date());
dao.update(oldliteracyUser);
//新的课程的信息,上课时间
List<LiteracyActivityCourse> activityCourseList = dao.query(LiteracyActivityCourse.class, Cnd.where("activityId", "=", activityId)
.and("courseId", "=", newCourseId));
//先清楚旧的信息
dao.clear(LiteracyUserCourse.class, oldCnd);
//添加新的信息
List<LiteracyUserCourse> literacyUserCourseList = new ArrayList<>();
activityCourseList.forEach(item -> {
LiteracyUserCourse course = new LiteracyUserCourse();
course.setActivityCourseId(activityId);
course.setCourseId(newCourseId);
course.setUserId(userId);
course.setCourseStartTime(item.getCourseStartTime());
course.setCourseEndTime(item.getCourseEndTime());
course.setActivityCourseId(item.getId());
literacyUserCourseList.add(course);
});
dao.insert(literacyUserCourseList);
return Result.success();
}
@At
@ApiOperation("删除报名人员")
@SaCheckPermission("literacy.manage.activity.adjust")
@SLog(tag = "品牌活动-人员调整", msg = "删除报名人员")
public Result deleteSignUser(String activityId, String courseId, String userId) {
//删除
Cnd cnd = Cnd.NEW();
cnd.and("activityId", "=", activityId);
cnd.and("courseId", "=", courseId);
cnd.and("userId", "=", userId);
dao.clear(LiteracyUser.class, cnd);
dao.clear(LiteracyUserCourse.class, cnd);
return Result.success();
}
}
@@ -1,347 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.manage;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.PageUtil;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyBlackListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zxy
* @Description 人员管理
* @createTime 2022年03月07日 14:27:00
*/
@IocBean
@Ok("json:full")
@Api(tags = "亲子活动人员黑名单")
@At("/platform/literacy/userManage")
public class LiteracyUserBlackListManageController {
@Inject
private Dao dao;
@Inject
private LiteracyBlackListService literacyBlackListService;
@At("")
@SaCheckPermission("literacy.user.activity")
@Ok("beetl:/platform/zhgh/activity/literacy/userManage/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("literacy.user.activity")
public Result pageData(PageForm pageForm,
@Param(value = "activityId") String activityId,
@Param(value = "courseId") String courseId,
@Param(value = "year") Integer year,
@Param(value = "userKeyWord") String userKeyWord) {
Cnd cnd = Cnd.NEW();
cnd.andEX("tsuu.activityId", "=", activityId);
cnd.andEX("tsuu.courseId", "=", courseId);
cnd.andEX("act.year", "=", year);
if (StrUtil.isNotBlank(userKeyWord)) {
SqlExpressionGroup seg = new SqlExpressionGroup();
cnd.and(seg.andLike("u.username", userKeyWord).orLike("u.loginname", userKeyWord));
}
if(Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())){
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
}
Pagination pagination = literacyBlackListService.pageData(pageForm, cnd, activityId, courseId);
return Result.success(pagination);
}
@At
@ApiOperation("报名人员处理")
@SaCheckPermission("literacy.user.activity")
@SLog(tag = "品牌活动-人员管理", msg = "报名人员处理")
public Result doHandleUser(@Param("userId") String userId) {
literacyBlackListService.doHandleUser(userId);
return Result.success();
}
@At
@ApiOperation("根据活动Id获取子活动")
@SaCheckPermission("literacy.user.activity")
public Result getCourseByActivityId(@Param("activityId") String activityId) {
List<LiteracyCourse> list = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
return Result.success(list);
}
@At
@ApiOperation("获取子活动具体时间")
@SaCheckPermission("literacy.user.activity")
public Result attendClassRecord(String userId) {
literacyBlackListService.attendClassRecord(userId);
return Result.success();
}
@At
@ApiOperation("获取候补人员")
@SaCheckPermission("literacy.user.activity")
public Result getReserveUser(String courseId) {
Sql sql = Sqls.create("""
SELECT
uc.* ,
(select signUpTime from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
(select state from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state,
u.username,
u.loginname,
u.mobile,
u.unitName,
u.unionName
FROM
literacy_user_course uc LEFT JOIN `vw_user` u on uc.userId = u.id
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 2 order by signUpTime desc
""").setParam("courseId", courseId);
return Result.success(literacyBlackListService.listMap(sql));
}
@At
@ApiOperation("补充人员")
@SaCheckPermission("literacy.user.activity")
@SLog(tag = "品牌活动-人员管理", msg = "补充人员")
public Result reserveSingUp(String[] ids, String courseId) {
//先查询这个课程有多少个未签到的人员
Sql sql = Sqls.create("""
SELECT
uc.* ,
(select signUpTime from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as signUpTime,
(select state from literacy_user su where su.activityId=uc.activityId and su.courseId = uc.courseId and su.userId=uc.userId) as state
FROM
literacy_user_course uc
WHERE uc.courseId = @courseId and uc.isAttend = false HAVING state = 1 order by signUpTime desc
""").setParam("courseId", courseId);
List<NutMap> list = literacyBlackListService.listMap(sql);
if(ids.length > list.size()) {
return Result.error("您选择了" + ids.length + "位,未签到人员只有" + list.size() + "");
}
//ids的长度为几,就搞几个
List<NutMap> mapList = list.subList(0, ids.length);
List<String> idList = mapList.stream().map(o -> o.getString("userId")).collect(Collectors.toList());
//将这几个没签到的设置为4
dao.update(LiteracyUser.class, Chain.make("state", 4), Cnd.where("courseId", "=", courseId)
.and("userId", "in", idList));
//将补充的设置为1
dao.update(LiteracyUser.class, Chain.make("state", 1), Cnd.where("courseId", "=", courseId)
.and("userId", "in", ids));
return Result.success();
}
@At
@Ok("void")
@ApiOperation("导出签到人员")
public void exportSignPerson(@Param(value = "activityId") String activityId,
HttpServletResponse response) {
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
Sql sql = Sqls.create("""
SELECT
uc.*,
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
DATE_FORMAT(uc.attendTime, '%Y-%m-%d %H:%i:%s') as attendTimeExcel,
u.username,
u.loginname,
u.unitName,
u.unionName,
u.sex
FROM
literacy_user_course uc
left join literacy_course course on uc.courseId = course.id
left join `vw_user` u on u.id = uc.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("uc.activityId", "=", activityId);
cnd.and("course.isMobileSign", "=", true);
cnd.desc("isAttend").desc("attendTime");
sql.setCondition(cnd);
List<NutMap> userList = literacyBlackListService.listMap(sql);
List<LiteracyCourse> courseList = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
List<Map<String, Object>> sheetsList = new ArrayList<>();
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
excelCommonExportEntity.add(new ExcelExportEntity("是否签到", "isAttend", 20));
excelCommonExportEntity.add(new ExcelExportEntity("签到时间", "attendTimeExcel", 22));
for (LiteracyCourse c : courseList) {
String courseId = c.getId();
String courseName = c.getCourseName();
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
ExportParams userExportParams = new ExportParams();
userExportParams.setSheetName(courseName);
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
for (NutMap userSignData : v) {
if(!userSignData.getBoolean("isAttend")) {
userSignData.put("isAttend", "未签到");
userSignData.put("attendTimeExcel", "未签到");
}else {
userSignData.put("isAttend", "已签到");
}
}
Map<String, Object> userExportMap = new HashMap<>();
userExportMap.put("name", courseName);
userExportMap.put("title", userExportParams);
userExportMap.put("entity", currentEntities);
userExportMap.put("data", v);
sheetsList.add(userExportMap);
}
try {
String fileName = activity.getActivityName() + "签到人员名单.xls";
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", disposition);
Workbook workbook = new HSSFWorkbook();
for (Map<String, Object> map : sheetsList) {
ExcelExportService service = new ExcelExportService();
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
}
workbook.write(response.getOutputStream());
workbook.close();
} catch (Exception e) {
e.printStackTrace();
}
}
@At
@Ok("void")
@ApiOperation("导出领取人员")
public void exportGiftPerson(@Param(value = "activityId") String activityId,
HttpServletResponse response) {
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
Sql sql = Sqls.create("""
SELECT
uc.*,
DATE_FORMAT(uc.courseStartTime, '%Y-%m-%d %H:%i:%s') as courseStartTimeExcel,
DATE_FORMAT(uc.courseEndTime, '%Y-%m-%d %H:%i:%s') as courseEndTimeExcel,
DATE_FORMAT(uc.receiveTime, '%Y-%m-%d %H:%i:%s') as receiveTimeExcel,
u.username,
u.loginname,
u.unitName,
u.unionName,
u.sex
FROM
literacy_user_course uc
left join literacy_course course on uc.courseId = course.id
left join `vw_user` u on u.id = uc.userId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("uc.activityId", "=", activityId);
cnd.and("course.isReceiveGift", "=", true).and("course.giftType" ,"=", 1);
cnd.desc("isReceive").desc("receiveTime");
sql.setCondition(cnd);
List<NutMap> userList = literacyBlackListService.listMap(sql);
List<LiteracyCourse> courseList = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
List<Map<String, Object>> sheetsList = new ArrayList<>();
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
excelCommonExportEntity.add(new ExcelExportEntity("开始时间", "courseStartTimeExcel", 22));
excelCommonExportEntity.add(new ExcelExportEntity("结束时间", "courseEndTimeExcel", 22));
excelCommonExportEntity.add(new ExcelExportEntity("是否领取", "isReceive", 20));
excelCommonExportEntity.add(new ExcelExportEntity("领取时间", "receiveTimeExcel", 22));
for (LiteracyCourse c : courseList) {
String courseId = c.getId();
String courseName = c.getCourseName();
List<NutMap> v = userList.stream().filter(x -> x.getString("courseId").equals(courseId)).collect(Collectors.toList());
ExportParams userExportParams = new ExportParams();
userExportParams.setSheetName(courseName);
List<ExcelExportEntity> currentEntities = new ArrayList<>(excelCommonExportEntity);
for (NutMap userSignData : v) {
if(!userSignData.getBoolean("isReceive")) {
userSignData.put("isReceive", "未领取");
userSignData.put("receiveTimeExcel", "未领取");
}else {
userSignData.put("isReceive", "已领取");
}
}
Map<String, Object> userExportMap = new HashMap<>();
userExportMap.put("name", courseName);
userExportMap.put("title", userExportParams);
userExportMap.put("entity", currentEntities);
userExportMap.put("data", v);
sheetsList.add(userExportMap);
}
try {
String fileName = activity.getActivityName() + "礼品领取人员名单.xls";
String disposition = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", disposition);
Workbook workbook = new HSSFWorkbook();
for (Map<String, Object> map : sheetsList) {
ExcelExportService service = new ExcelExportService();
service.createSheetForMap(workbook,(ExportParams) map.get("title"),(List<ExcelExportEntity>) map.get("entity"),(Collection<?>) map.get("data"));
}
workbook.write(response.getOutputStream());
workbook.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,373 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.mobile;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.sys.models.Sys_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
import com.budwk.app.zhgh.activity.literacy.models.*;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.util.cri.Static;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/**
* @author zxy
* @Description TODO
* @createTime 2022年02月25日 13:44:00
*/
@IocBean
@Ok("json:full")
@Api(tags = "亲子活动移动端")
@At("/platform/mobile/literacyActivity")
public class MLiteracyActivityController {
private static final String REDIS_KEY_PREFIX = "m_literacy_activity";
private final ReentrantLock lock = new ReentrantLock(true);
@Inject
private Dao dao;
@Inject
private LiteracyActivityService literacyActivityService;
@Inject
private RedisService redisService;
@Inject
private LiteracyActivityStatisticsService statisticsService;
@At("/literacyList")
@Ok("beetl:/platform/zhghh5/activity/literacy/literacyList/index.html")
@SaCheckPermission("h5.literacy.sign")
public void literacyList() {
}
@At("/literacyInfo")
@Ok("beetl:/platform/zhghh5/activity/literacy/literacyInfo/index.html")
@SaCheckPermission("h5.literacy.sign")
public void literacyInfo() {
}
@At("/activityInfo")
@Ok("beetl:/platform/zhghh5/activity/literacy/activityInfo/index.html")
@SaCheckPermission("h5.literacy.sign")
public void activityInfo() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("h5.literacy.sign")
public Result pageData(PageForm pageForm,
@Param(value = "activityStatus") int activityStatus,
@Param(value = "year") Integer year,
@Param(value = "activityType") Integer activityType) {
Pagination pagination = literacyActivityService.mPageData(pageForm, year, activityStatus, activityType);
return Result.success(pagination);
}
/**
* @param id 活动id
* @param tabIndex 0全部 1我的
* @return
*/
@At
@ApiOperation("查询单个活动")
@SaCheckPermission("h5.literacy.sign")
public Result findOne(@Param("id") String id,
@Param(value = "tabIndex") Integer tabIndex,
@Param(value = "fromMode") String fromMode) {
Cnd cnd = Cnd.NEW();
if (tabIndex > 0) {
List<LiteracyUser> mySignCourseList = dao.query(LiteracyUser.class, Cnd.where("userId", "=", SecurityUtil.getUserId()).and("activityId", "=", id));
List<String> mySignCourseIdList = mySignCourseList.stream().map(LiteracyUser::getCourseId).collect(Collectors.toList());
cnd.and("id", "in", mySignCourseIdList);
}
NutMap nutMap = literacyActivityService.findOne(id, cnd, fromMode);
List<LiteracyCourse> courseList = nutMap.getAsList("courseList", LiteracyCourse.class);
courseList.forEach(v -> {
if (v.getCourseIsLimitApply() != null && v.getCourseIsLimitApply() && v.getIsSign()) {
LiteracyActivityCourse course = dao.fetch(LiteracyActivityCourse.class, Cnd.where("courseId", "=", v.getId()));
v.setCourseTimeName(DateUtil.format(course.getCourseStartTime(), "HH:mm") + "" + DateUtil.format(course.getCourseEndTime(), "HH:mm") + "");
}
});
return Result.success(nutMap);
}
@At
@ApiOperation("查询子活动时间段")
@SaCheckPermission("h5.literacy.sign")
public Object getCourseTimeSelectList(String courseId) {
// 查课程的时间段
List<LiteracyActivityCourse> courseList = dao.query(LiteracyActivityCourse.class, Cnd.where("courseId", "=", courseId));
// 查课程的报名人数
List<LiteracyUserCourse> applyUserList = dao.query(LiteracyUserCourse.class, Cnd.where("courseId", "=", courseId));
// 按照课程下面时间段去分组
Map<String, List<LiteracyUserCourse>> collectMap = applyUserList.stream().collect(Collectors.groupingBy(LiteracyUserCourse::getActivityCourseId));
List<NutMap> list = courseList.stream().map(v -> {
String id = v.getId();
NutMap nutMap = NutMap.NEW();
List<LiteracyUserCourse> literacyUserCourses = collectMap.get(id);
int remainingNum = v.getCourseLimitNum() != null ? v.getCourseLimitNum() : 0;
if (Lang.isNotEmpty(literacyUserCourses)) {
remainingNum = v.getCourseLimitNum() - literacyUserCourses.size();
}
nutMap.put("remainingNum", remainingNum);
nutMap.put("text", DateUtil.format(v.getCourseStartTime(), "HH:mm") + "" + DateUtil.format(v.getCourseEndTime(), "HH:mm") + "段(剩" + remainingNum + ")");
nutMap.put("value", id);
return nutMap;
}).filter(v-> v.getInt("remainingNum") != 0).toList();
return Result.success(list);
}
@At
@ApiOperation("活动报名")
@SaCheckPermission("h5.literacy.sign")
@SLog(tag = "品牌活动-活动报名", msg = "活动报名")
public Result doSignUp(LiteracyUser literacyUser) {
try {
lock.lock();
boolean courseByUser = literacyActivityService.isSignCourseByUser(literacyUser.getCourseId(), SecurityUtil.getUserId());
if(courseByUser) {
return Result.error("您已报过该活动");
}
//判断人数
int number = 0;
LiteracyCourse course = literacyActivityService.dao().fetch(LiteracyCourse.class, literacyUser.getCourseId());
LiteracyType type = literacyActivityService.dao().fetch(LiteracyType.class, course.getCourseType());
if(type != null) {
if(type.getIsBringFamily() && type.getIsAddFamily()) {
List<NutMap> mobileColumnsValue = literacyUser.getMobileColumnsValue();
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
number = map != null ? map.getInt("columnValue") : 0;
}
}
boolean signFull = literacyActivityService.isSignFull(course, number);
if(signFull) {
return Result.error("当前报名人数已满");
}
boolean signFullByUnionId = literacyActivityService.isSignFullByUnionId(course, number);
if(signFullByUnionId) {
return Result.error("该活动您所在的分工会名额不足");
}
literacyActivityService.doSignUp(literacyUser);
return Result.success("报名成功");
} catch (Exception e) {
e.printStackTrace();
return Result.success("报名失败");
} finally {
lock.unlock();
}
}
@At
@ApiOperation("取消报名")
@SaCheckPermission("h5.literacy.sign")
@SLog(tag = "品牌活动-活动报名", msg = "取消报名")
public Result cancelSignUp(@Param("activityId") String activityId, @Param("courseId") String courseId) {
String userId = SecurityUtil.getUserId();
//取消分两种情况
//第一种没有设置分工会人数限制,那么将候补的人按时间倒叙往上补
//第二种如果设置了分工会人数限制,那么只将本分工会的候补人员按照时间倒叙往上补,如果本分工会没有候补人员,则名额空出来,由校工会手动调整
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
LiteracyCourse course = dao.fetch(LiteracyCourse.class, courseId);
LiteracyType type = dao.fetch(LiteracyType.class, course.getCourseType());
//如果是正常报名取消了,将候补报名的按时间倒叙第一个改为正常报名
Cnd cnd = Cnd.where("activityId", "=", activityId).and("courseId", "=", courseId)
.and("state", "=", 2);
//如果设置了分工会报名人数限制,则只查本分工会
if (Lang.isNotEmpty(course.getUnionLimit())) {
cnd.and(new Static(" userId in (select id from user where unionid = '%s')".formatted(SecurityUtil.getUnionId())));
}
cnd.asc("signUpTime");
if (!type.getIsBringFamily() && course.getReserveMode() == 2) {
List<LiteracyUser> signUpUsers = dao.query(LiteracyUser.class, cnd);
int thisSignUpUserCount = dao.count(LiteracyUser.class,
Cnd.where("activityId", "=", activityId)
.and("courseId", "=", courseId).and("userId", "=", userId)
.and("state", "in", List.of(1, 3)));
if (!signUpUsers.isEmpty() && thisSignUpUserCount > 0) {
LiteracyUser literacyUser = signUpUsers.get(0);
literacyUser.setState(1);
dao.update(literacyUser);
Sys_user user = dao.fetch(Sys_user.class, literacyUser.getUserId());
//msgApi.sendTextMsg("【" + activity.getActivityName() + "】已候补成功,请按时参加活动!", user.getLoginname());
}
}
//删除报名记录
dao.clear("literacy_user_course", Cnd.where("activityId", "=", activityId)
.and("courseId", "=", courseId).and("userId", "=", userId));
dao.clear("literacy_user", Cnd.where("activityId", "=", activityId)
.and("courseId", "=", courseId).and("userId", "=", userId));
return Result.success();
}
@At
@ApiOperation("签到")
@SaCheckPermission("h5.literacy.sign")
@SLog(tag = "品牌活动-活动报名", msg = "签到")
public Result doQd(@Param("id") String id, @Param("courseId") String courseId, @Param("point") Double[] points) {
LiteracyCourse course = dao.fetch(LiteracyCourse.class, courseId);
List<Double> coursePoints = course.getCourseLocationCoordinates();
// if (Lang.isNotEmpty(coursePoints)) {
// //需要签到
// if (ArrayUtil.isEmpty(points) || ArrayUtil.hasNull(points)) {
// return Result.error().addMsg("请获取当前的坐标信息");
// }
// Double[] coursePointArray = coursePoints.toArray(new Double[]{});
// float distance = AMapUtils.calculateLineDistance(new LatLng(points[0], points[1]), new LatLng(coursePointArray[0], coursePointArray[1]));
//
// if (distance > 500) {
// return Result.error().addMsg("请到签到点位附近签到");
// }
// }
literacyActivityService.doQd(id);
return Result.success();
}
/**
* 签到信息
*
* @param activityId
* @return
*/
@At
@ApiOperation("获取签到信息")
@SaCheckPermission("h5.literacy.sign")
public Result getQdInfoList(@Param("activityId") String activityId) {
List<NutMap> list = literacyActivityService.qdInfoByUserId(SecurityUtil.getUserId(), activityId);
return Result.success(list);
}
@At
@ApiOperation("验证是否能报名")
@SaCheckPermission("h5.literacy.sign")
public Result validateSignUp(String courseId,
@Param(value = "currentFamilyNumber") Integer currentFamilyNumber) {
try {
lock.lock();
if(StrUtil.isBlank(courseId)) {
return Result.error("报名信息为空");
}
currentFamilyNumber = currentFamilyNumber != null ? currentFamilyNumber : 0;
LiteracyCourse course = dao.fetch(LiteracyCourse.class, courseId);
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, course.getActivityId());
//判断时间
if(DateUtil.compare(new Date(), activity.getActivitySignUpStartTime(), "yyyy-MM-dd HH:mm:ss") < 0) {
return Result.error("报名未开始");
}
if(DateUtil.compare(new Date(), activity.getActivitySignUpEndTime(), "yyyy-MM-dd HH:mm:ss") > 0) {
return Result.error("报名已结束");
}
//判断活动组别
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", activity.getActivityGroupId()).and("userId", "=", SecurityUtil.getUserId()));
if(count == 0) {
return Result.error("抱歉,您没有此次活动的权限");
}
//判断是否报名
boolean courseByUser = literacyActivityService.isSignCourseByUser(courseId, SecurityUtil.getUserId());
if(courseByUser) {
return Result.error("抱歉,您已经报名");
}
//判断活动人数
boolean signFull = literacyActivityService.isSignFull(course, currentFamilyNumber);
if(signFull) {
return Result.error("名额剩余数量不足");
}
//判断活动限制
boolean signCourse = literacyActivityService.isSignCourse(course, activity);
if(!signCourse) {
if(activity.getRestrictLimit() != 3) {
return Result.error("您选择的类型已达上限,不能再报该类型的了");
} else {
return Result.error(activity.getActivityName() + "限制报" + activity.getLimitNum() + "个活动,已达上限");
}
}
//判断分工会人数限制
boolean signFullByUnionId = literacyActivityService.isSignFullByUnionId(course, currentFamilyNumber);
if(signFullByUnionId) {
return Result.error("您所在的分工会名额不足");
}
return Result.success();
}catch (Exception e) {
e.printStackTrace();
return Result.error("报名失败");
} finally {
lock.unlock();
}
}
@At
@ApiOperation("验证子活动是否能报名")
@SaCheckPermission("h5.literacy.sign")
public Object validateSourceSignUp(String activityCourseId, String courseId) {
try {
lock.lock();
// 该时间段下已报名的人数
int count = dao.count(LiteracyUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
.and("courseId", "=", courseId));
// 获取改时间段下的活动课程限制报名人数
LiteracyActivityCourse course = dao.fetch(LiteracyActivityCourse.class, activityCourseId);
Integer courseLimitNum = course.getCourseLimitNum();
// 报名加上自己,如果大于了限制人数,那就无法报名
if (count + 1 > courseLimitNum) {
return Result.error("该时间段名额已报满,请选择其他时段报名");
} else {
return Result.success();
}
} catch (Exception e) {
e.printStackTrace();
return Result.error("报名失败");
} finally {
lock.unlock();
}
}
@At
@ApiOperation("二维码签到")
@SaCheckPermission("h5.literacy.sign")
@SLog(tag = "品牌活动-活动报名", msg = "二维码签到")
public Result codeSign(String id, String codeCourseId, String clickCourseId) {
if(StrUtil.isBlank(codeCourseId) || StrUtil.isBlank(clickCourseId)) {
return Result.error("签到失败,没有获取到扫描信息");
}
if(!codeCourseId.equals(clickCourseId)) {
return Result.error("签到失败,二维码与您当前签到信息不符");
}
dao.update(LiteracyUserCourse.class, Chain.make("isAttend", true)
.add("attendTime", new Date()), Cnd.where("id", "=", id));
return Result.success();
}
}
@@ -1,201 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.mobile;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* 品牌活动扫码
*/
@IocBean
@At("/platform/mobile/literacyActivityScannerQrCode")
@Ok("json:full")
@Slf4j
public class MLiteracyActivityScannerQrCodeController {
/*@Inject
private WxTokenUtil;
@Inject
private literacyActivityService literacyActivityService;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/mobile/scannerQrCode.html")
public void scannerQrCode() {
}
*//**
* 微信js验证
*
* @param url
* @return
*//*
@At("/auth/sign")
@ViReturn
@RequiresAuthentication
public Object wxAuthSign(String url) {
String jsapi_ticket = wxTokenUtil.jsTicket();
return sign(jsapi_ticket, url);
}
*//**
* 二维码信息
*
* @param userId 用户id
* @param signId 签到记录id
* @param activityId 活动id
* @return
*//*
@At("/qrCodeInfo")
@RequiresAuthentication
public Object qrCodeInfo(@Param("userId") String userId, @Param("signId") String signId, @Param("activityId") String activityId) {
if (StrUtil.isBlank(userId) || StrUtil.isBlank(signId) || StrUtil.isBlank(activityId)) {
return Result.error("参数错误");
}
try {
// Sql activitySql = Sqls.create("select activityName,cover from literacy_activity where id = @activityId");
// activitySql.setParam("activityId",activityId);
// NutMap activityMap = (NutMap) Daos.query(dao, activitySql.toString(), Sqls.callback.map());
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from literacy_user_course where id = @signId");
signSql.setParam("signId", signId);
NutMap attendInfo = (NutMap) Daos.query(dao, signSql.toString(), Sqls.callback.map());
Sql userSql = Sqls.create("select id,username,loginname,unitname,unionname,sex from `user` where id = @userId");
userSql.setParam("userId", userId);
NutMap userMap = (NutMap) Daos.query(dao, userSql.toString(), Sqls.callback.map());
return Result.success(Map.of("signInfo", attendInfo, "userInfo", userMap));
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("获取信息失败");
}
}
@At("/signInfo")
@RequiresAuthentication
public Object signInfo(@Param("signId") String signId) {
if (StrUtil.isBlank(signId)) {
return Result.error("参数错误");
}
try {
Sql signSql = Sqls.create("select isAttend,attendTime from literacy_user_course where id = @signId");
signSql.setParam("signId", signId);
NutMap signInfo = literacyActivityService.fetch(signSql);
return Result.success(signInfo);
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("获取信息失败");
}
}
*//**
* 发放礼品
*
* @param signId
* @return
*//*
@At("/grantGiftByQrCode")
@RequiresAuthentication
public Object grantGiftByQrCode(@Param("signId") String signId) {
if (StrUtil.isBlank(signId)) {
return Result.error("参数错误");
}
try {
Chain chain = Chain.make("isReceive", 1);
chain.add("receiveTime", new Date());
chain.add("giftScannerCodeUserId", ShiroUtil.getPrincipalProperty("id"));
dao.update(literacyUserCourse.class, chain, Cnd.where("id", "=", signId));
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from literacy_user_course where id = @signId");
signSql.setParam("signId", signId);
NutMap signInfo = literacyActivityService.fetch(signSql);
return Result.success(signInfo);
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("获取信息失败");
}
}
*//**
* 二维码扫描确认签到
*
* @param signId
* @return
*//*
@At("/confirmSignByQrCode")
@RequiresAuthentication
public Object confirmSignByQrCode(@Param("signId") String signId) {
if (StrUtil.isBlank(signId)) {
return Result.error("参数错误");
}
try {
Chain chain = Chain.make("isAttend", 1);
chain.add("attendTime", new Date());
chain.add("signScannerCodeUserId", ShiroUtil.getPrincipalProperty("id"));
dao.update(literacyUserCourse.class, chain, Cnd.where("id", "=", signId));
Sql signSql = Sqls.create("select isAttend,attendTime,isReceive,receiveTime from literacy_user_course where id = @signId");
signSql.setParam("signId", signId);
NutMap signInfo = literacyActivityService.fetch(signSql);
return Result.success(signInfo);
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("获取信息失败");
}
}
public static Map<String, String> sign(String jsapi_ticket, String url) {
Map<String, String> ret = new HashMap<String, String>();
String nonce_str = create_nonce_str();
String timestamp = create_timestamp();
String string1;
String signature = "";
//注意这里参数名必须全部小写,且必须有序
string1 = "jsapi_ticket=" + jsapi_ticket +
"&noncestr=" + nonce_str +
"&timestamp=" + timestamp +
"&url=" + url;
System.out.println(string1);
try {
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
crypt.reset();
crypt.update(string1.getBytes("UTF-8"));
signature = byteToHex(crypt.digest());
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
e.printStackTrace();
}
ret.put("url", url);
ret.put("jsapi_ticket", jsapi_ticket);
ret.put("nonceStr", nonce_str);
ret.put("timestamp", timestamp);
ret.put("signature", signature);
return ret;
}
private static String byteToHex(final byte[] hash) {
Formatter formatter = new Formatter();
for (byte b : hash) {
formatter.format("%02x", b);
}
String result = formatter.toString();
formatter.close();
return result;
}
private static String create_nonce_str() {
return UUID.randomUUID().toString();
}
private static String create_timestamp() {
return Long.toString(System.currentTimeMillis() / 1000);
}*/
}
@@ -1,254 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.controller.statistics;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.utils.CommonDownloadUtil;
import com.budwk.app.sys.models.Sys_file;
import com.budwk.app.sys.utils.SysFileMinIoUtil;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyMobileSignColumn;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyType;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zxy
* @Description 培训报名 统计
* @createTime 2022年02月23日 09:57:00
*/
@Slf4j
@IocBean
@Ok("json:full")
@Api(tags = "品牌活动统计")
@At("/platform/literacy/statistics/activity")
public class LiteracyActivityStatisticsController {
@Inject
private LiteracyActivityService literacyActivityManageService;
@Inject
private LiteracyActivityStatisticsService literacyActivityStatisticsService;
@Inject
private Dao dao;
@At("")
@SaCheckPermission("literacy.statistics.activity")
@Ok("beetl:/platform/zhgh/activity/literacy/statistics/index.html")
public void index() {
}
@At
@ApiOperation("分页查询")
@SaCheckPermission("literacy.statistics.activity")
public Result pageData(PageForm pageForm,
@Param(value = "activityId") String activityId) {
Pagination pagination = literacyActivityStatisticsService.pageData(pageForm, activityId);
return Result.success(pagination);
}
/**
* 活动list
*
* @param year 年度
* @return
*/
@At
@ApiOperation("活动列表")
@SaCheckPermission("literacy.statistics.activity")
public Result activityList(@Param(value = "year") Integer year) {
List<LiteracyActivity> list = dao.query(LiteracyActivity.class, Cnd.NEW().andEX("year", "=", year).desc("activityStartTime"));
return Result.success(list);
}
/**
* 培训班报名人员list
*
* @param courseId
* @return
*/
@At
@ApiOperation("报名人员列表")
@SaCheckPermission("literacy.statistics.activity")
public Result registerUserList(@Param(value = "courseId") String courseId) {
return Result.success(literacyActivityStatisticsService.registerUserList(courseId));
}
@At
@ApiOperation("报名动态列")
@SaCheckPermission("literacy.statistics.activity")
public Object getTaleColumnInfo(@Param(value = "courseId") String courseId) {
return Result.success(literacyActivityStatisticsService.getTaleColumnInfo(courseId));
}
/**
* 培训班上课签到信息
*
* @param courseId
* @return
*/
@At
@ApiOperation("获取签到信息")
@SaCheckPermission("literacy.statistics.activity")
public Result getSignInfo(@Param("courseId") String courseId) {
return Result.success(literacyActivityStatisticsService.getSignInfo(courseId));
}
@At
@ApiOperation("开放报名")
@SaCheckPermission("literacy.statistics.activity")
public Result signChange(@Param("courseId") String courseId, @Param("openOtherUnion") Boolean openOtherUnion) {
dao.update(LiteracyCourse.class, Chain.make("openOtherUnion", openOtherUnion)
, Cnd.where("id", "=", courseId));
return Result.success();
}
@At
@Ok("void")
@ApiOperation("导出签到名单")
@SaCheckPermission("literacy.statistics.activity")
public void exportSignUser(@Param(value = "activityId") String activityId,
HttpServletResponse response) throws IOException {
try {
LiteracyActivity activity = dao.fetch(LiteracyActivity.class, activityId);
Sql sql = Sqls.create("""
SELECT
ts.*,
CONCAT(DATE_FORMAT(ac.courseStartTime, '%H:%i:%s'),'至',DATE_FORMAT(ac.courseEndTime, '%H:%i:%s')) AS courseTime,
u.username,
u.loginname,
u.sex,
ifnull(ts.mobile, u.mobile) as mobile,
u.birthday,
tsc.courseName
FROM
literacy_user ts
left join literacy_activity_course ac on ts.activityCourseId = ac.id
left join `vw_user` u on u.id = ts. userId
left join literacy_course tsc on tsc.id = ts.courseId
WHERE
ts.activityId = @activityId
""").setParam("activityId", activityId);
List<NutMap> userList = literacyActivityManageService.listMap(sql);
List<LiteracyCourse> courseList = dao.query(LiteracyCourse.class, Cnd.where("activityId", "=", activityId));
List<LiteracyType> literacyTypeList = dao.query(LiteracyType.class, Cnd.NEW());
dao.fetchLinks(literacyTypeList, "literacyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
Map<String, LiteracyType> typeMap = literacyTypeList.stream().collect(Collectors.toMap(LiteracyType::getId, o -> o));
List<Map<String, Object>> sheetsList = new ArrayList<>();
List<ExcelExportEntity> excelCommonExportEntity = new ArrayList<>();
excelCommonExportEntity.add(new ExcelExportEntity("姓名", "username", 20));
excelCommonExportEntity.add(new ExcelExportEntity("工号", "loginname", 20));
excelCommonExportEntity.add(new ExcelExportEntity("单位", "unitName", 20));
excelCommonExportEntity.add(new ExcelExportEntity("分工会", "unionName", 20));
excelCommonExportEntity.add(new ExcelExportEntity("性别", "sex", 20));
excelCommonExportEntity.add(new ExcelExportEntity("手机号", "mobile", 20));
excelCommonExportEntity.add(new ExcelExportEntity("生日", "birthday", 20));
excelCommonExportEntity.add(new ExcelExportEntity("报名时段", "courseTime", 20));
for (LiteracyCourse c : courseList) {
String k = c.getCourseName();
List<NutMap> v = userList.stream().filter(x -> x.getString("courseName").equals(k)).collect(Collectors.toList());
ExportParams userExportParams = new ExportParams();
userExportParams.setSheetName(k);
userExportParams.setType(ExcelType.HSSF);
List<ExcelExportEntity> currentEntities = new ArrayList<>();
currentEntities.addAll(excelCommonExportEntity);
LiteracyType signUpType = typeMap.get(c.getCourseType());
if (Lang.isNotEmpty(signUpType.getLiteracyMobileSignColumnList())) {
for (LiteracyMobileSignColumn column : signUpType.getLiteracyMobileSignColumnList()) {
ExcelExportEntity entity = new ExcelExportEntity();
entity.setName(column.getColumnName());
entity.setKey(column.getColumnCode());
entity.setWidth(20);
if (column.getColumnFormType().equals("FILE")) {
entity.setType(2);
entity.setExportImageType(2);
}
currentEntities.add(entity);
}
}
for (NutMap userSignData : v) {
String mobileColumnsValueStr = userSignData.getString("mobileColumnsValue");
if (StrUtil.isNotBlank(mobileColumnsValueStr)) {
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, mobileColumnsValueStr);
for (NutMap cv : mobileColumnsValue) {
if (!"FILE".equals(cv.getString("columnFormType"))) {
userSignData.put(cv.getString("columnCode"), cv.getString("columnValue"));
} else {
if (StrUtil.isNotBlank(cv.getString("columnValue"))) {
List<JSONObject> columnValue = Json.fromJsonAsList(JSONObject.class, cv.getString("columnValue"));
if (columnValue.size() == 1) {
JSONObject sysFile = columnValue.get(0);
Sys_file file = dao.fetch(Sys_file.class, Cnd.where(Sys_file::getDownloadPath, "=", sysFile.get("url")));
byte[] imageBytes = SysFileMinIoUtil.getFileBytes(file.getBucket(), file.getStoragePath());
if (imageBytes.length > 0) {
userSignData.put(cv.getString("columnCode"), imageBytes);
}
}
}
}
}
}
}
Map<String, Object> userExportMap = new HashMap<>();
userExportMap.put("name", k);
userExportMap.put("title", userExportParams);
userExportMap.put("entity", currentEntities);
userExportMap.put("data", v);
sheetsList.add(userExportMap);
}
Workbook workbook = new HSSFWorkbook();
for (Map<String, Object> map : sheetsList) {
ExcelExportService service = new ExcelExportService();
service.createSheetForMap(workbook, (ExportParams) map.get("title"), (List<ExcelExportEntity>) map.get("entity"), (Collection<?>) map.get("data"));
}
workbook.write(response.getOutputStream());
workbook.close();
CommonDownloadUtil.download(activity.getActivityName() + "报名人员名单" + ".xlsx", workbook, response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,136 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import com.budwk.app.base.model.BaseModel;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.sys.services.SysHomeConvert;
import lombok.Data;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.lang.Lang;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author zxy
* @Description 培训报名活动
* @createTime 2022年02月23日 08:57:00
*/
@Table
@Data
@Accessors(chain = true)
public class LiteracyActivity extends BaseModel implements Serializable, SysHomeConvert {
@Name
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("活动名称")
private String activityName;
@Column
@ColDefine(type = ColType.INT)
@Comment("年度")
private Integer year;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("活动报名开始时间")
private Date activitySignUpStartTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("活动报名开始时间")
private Date activitySignUpEndTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("活动开始时间")
private Date activityStartTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("活动结束时间")
private Date activityEndTime;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否禁用")
private boolean isDisabled;
@Column
@ColDefine(customType = "longtext")
@Comment("活动介绍")
private String introduce;
@Column
@ColDefine(type = ColType.INT, width = 10)
@Comment("活动限制标识")
private Integer restrictLimit;
@Column
@ColDefine(type = ColType.INT, width = 10)
@Comment("活动限制报名个数")
private Integer limitNum;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("活动封面")
private String cover;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("微信群二维码")
private String wechat;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("上课前是否通知")
private boolean notice;
@Column
@Comment("活动范围Id")
@ColDefine(type = ColType.INT, width = 32)
private Integer activityGroupId;
@Column
@Comment("活动范围名称")
@ColDefine(type = ColType.VARCHAR, width = 40)
private String activityGroupName;
/**
* 所有的培训班
*/
@Many(field = "activityId")
private List<LiteracyCourse> courseList;
@Many(field = "activityId")
private List<LiteracyTypeLimit> typeLimits;
@Column
@Comment("活动类型")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String literacyType;
@Override
public Sys_home_activity covertToSysHomeActivity() {
Sys_home_activity sysHomeActivity = new Sys_home_activity();
sysHomeActivity.setId(this.getId());
sysHomeActivity.setName(this.getActivityName());
sysHomeActivity.setCover(this.getCover());
sysHomeActivity.setUrl("/platform/literacy/manage/apply");
sysHomeActivity.setH5Url("/platform/mobile/literacyActivity/literacyList");
if (Lang.isNotEmpty(this.getActivitySignUpStartTime())) {
sysHomeActivity.setStartDate(this.getActivitySignUpStartTime());
sysHomeActivity.setEndDate(this.getActivitySignUpEndTime());
}
sysHomeActivity.setAllowUserGroupId(this.getActivityGroupId());
sysHomeActivity.setEnable(!this.isDisabled());
sysHomeActivity.setClassPath(this.getClass().getPackageName() + this.getClass().getName());
return sysHomeActivity;
}
}
@@ -1,56 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import lombok.Data;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.Date;
/**
* @author zxy
* @Description 活动下的课程
* @createTime 2022年02月23日 09:26:00
*/
@Table
@Data
@Accessors(chain = true)
public class LiteracyActivityCourse {
@Name
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("活动ID")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("课程ID")
private String courseId;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("课程开始时间")
private Date courseStartTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("课程结束时间")
private Date courseEndTime;
@Column
@ColDefine(type = ColType.DATE)
@Comment("课程时间")
private Date courseDate;
@Column
@ColDefine(type = ColType.INT, width = 4)
@Comment("限制人数")
private Integer courseLimitNum;
private Integer hasRegisterNum;
}
@@ -1,31 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
/**
* @author zxy
* @Description 黑名单
* @createTime 2022年03月07日 14:32:00
*/
@Table
@Data
public class LiteracyBlackList {
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("用户id")
private String userId;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否禁用")
private Boolean isDisabled;
}
@@ -1,160 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.lang.util.NutMap;
import java.io.Serializable;
import java.util.List;
/**
* @author zxy
* @Description 培训班信息
* @createTime 2022年02月23日 09:04:00
*/
@Table
@Data
@Accessors(chain = true)
public class LiteracyCourse extends BaseModel implements Serializable {
@Name
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("活动ID")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程名称")
private String courseName;
@Column
@ColDefine(type = ColType.INT)
@Comment("课程人数")
private int coursePeopleNumber;
@Column
@ColDefine(type = ColType.INT)
@Default(value = "0")
@Comment("预留名额")
private int courseReservedNumber;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@Comment("课程地点")
private String courseLocation;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("课程类型")
private String courseType;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("课程地点坐标")
private List<Double> courseLocationCoordinates;
@Column
@ColDefine(type = ColType.VARCHAR, width = 20)
@Comment("课程讲师")
private String courseInstructor;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("校区")
private String campus;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("报名人数是否限制")
private Boolean courseIsLimitApply;
@Column
@ColDefine(type = ColType.INT)
@Comment("序号")
private int orderNum;
@Many(field = "courseId")
private List<LiteracyActivityCourse> courseTimeList;
//已报人数
private Integer hasRegisterNum;
private Boolean isBringFamily;
private Boolean isAddFamily;
//是否报过该课程
private Boolean isSign;
//还能报该类型的课程吗
private Boolean canSignThisCourseType;
@Column
@Comment("分工会人数限制")
@ColDefine(type = ColType.MYSQL_JSON)
private List<NutMap> unionLimit;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签到")
private boolean isMobileSign;
@Column
@ColDefine(type = ColType.INT)
@Comment("签到方式 1.扫描二维码签到 2.被扫 3.gps签到")
private Integer signType;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("移动端是否签收礼品")
private boolean isReceiveGift;
@Column
@ColDefine(type = ColType.INT)
@Comment("领取礼品方式 1.扫描二维码 2.线下")
private Integer giftType;
@Column
@ColDefine(type = ColType.INT)
@Comment("预留名额方式 1.报名人员减少模式 2.报名人数不变模式")
private Integer reserveMode;
@Column
@Comment("承办工会")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String hostUnionId;
@Column
@Comment("对内报名时间")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String interTime;
@Column
@Comment("是否开放给其他工会")
@ColDefine(type = ColType.BOOLEAN, width = 4)
private Boolean openOtherUnion;
@Column
@Comment("分类标识")
@ColDefine(type = ColType.VARCHAR, width = 30)
private String assort;
@Column
@ColDefine(type = ColType.INT)
@Default(value = "0")
@Comment("候补名额数")
private Integer waitingNum;
//候补已报人数
private Integer hasWaitingNum;
private String courseTimeName;
}
@@ -1,79 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
@Table("literacy_mobile_sign_column")
@Data
public class LiteracyMobileSignColumn {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
/**
* train_sign_up_type id
*/
@Column
@Comment("类型id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String typeId;
@Column
@Comment("字段名称")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String columnName;
@Column
@Comment("字段编码")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String columnCode;
@Column
@Comment("字段值")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String columnValue;
@Column
@Comment("字段类型")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String columnType;
@Column
@Comment("下拉框的值")
@ColDefine(type = ColType.MYSQL_JSON)
private List<String> selectValues;
@Column
@Comment("是否必填")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isRequired;
@Column
@Comment("控件类型")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String columnFormType;
@Column
@Comment("文件个数")
@ColDefine(type = ColType.INT)
private Integer fileNumber;
@Column
@Comment("文件类型")
@ColDefine(type = ColType.MYSQL_JSON)
private List<String> fileType;
@Column
@Comment("序号")
@ColDefine(type = ColType.INT, width = 1)
private Integer columnIndex;
}
@@ -1,68 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* TODO
*
* @author 赵欣雨
* @date 2020/8/18 9:16
*/
@Data
@Table("literacy_type")
@EqualsAndHashCode(callSuper = true)
public class LiteracyType extends BaseModel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("类型编码")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String code;
@Column
@Comment("类型名称")
@ColDefine(type = ColType.VARCHAR, width = 80)
private String typeName;
@Column
@Comment("序号")
@ColDefine(type = ColType.INT, width = 1)
private Integer xh;
@Column
@Comment("是否携带家属")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isBringFamily;
@Column
@Comment("家属纳入总人数")
@ColDefine(type = ColType.BOOLEAN)
@Default("0")
private Boolean isAddFamily;
@Column
@Comment("本人纳入总人数")
@ColDefine(type = ColType.BOOLEAN)
@Default("1")
private Boolean selfAddFamily;
@Many(field = "typeId")
private List<LiteracyMobileSignColumn> literacyMobileSignColumnList;
}
@@ -1,40 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
/**
* @Author JyuHsin
* @Date 2022/9/22
* @Description
*/
@Table("literacy_type_limit")
@Data
public class LiteracyTypeLimit implements Serializable {
private static final long serialVersionUID = 1L;
@Name
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("活动id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String activityId;
@Column
@Comment("活动类型id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String typeId;
@Column
@Comment("限制个数")
@ColDefine(type = ColType.INT, width = 10)
private int limitNum;
}
@@ -1,88 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import lombok.Data;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.lang.util.NutMap;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author zxy
* @Description 报名人员 报名记录
* @createTime 2022年02月23日 09:34:00
*/
@Table
@Data
@Accessors(chain = true)
@TableIndexes({@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSEID", fields = {"courseId"}, unique = false)})
public class LiteracyUser implements Serializable {
@Name
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("活动ID")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("课程ID")
private String courseId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("用户ID")
private String userId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("工会ID")
private String unionId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("单位ID")
private String unitId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("工会")
private String unionName;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("单位")
private String unitName;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("联系方式")
private String mobile;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("报名时间")
private Date signUpTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("活动课程时段id")
private String activityCourseId;
@Column
@ColDefine(type = ColType.MYSQL_JSON)
@Comment("手机端报名字段和值")
private List<NutMap> mobileColumnsValue;
@Column
@ColDefine(type = ColType.INT)
@Comment("用户报名状态(1.正常 2.待报名成功 3.也是正常,但是是从2变为1的 4.废弃[就是没签到的意思])")
private Integer state;
}
@@ -1,89 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.models;
import lombok.Data;
import lombok.experimental.Accessors;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
/**
* @author zxy
* @Description 用户课程表
* @createTime 2022年02月23日 09:38:00
*/
@Table
@Data
@Accessors(chain = true)
@TableIndexes({
@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSE_USERID", fields = {"userId"}, unique = false),
@Index(name = "INDEX_TRAIN_SIGN_UP_USER_COURSE_COURSEID", fields = {"courseId"}, unique = false)
})
public class LiteracyUserCourse implements Serializable {
@Name
@PrevInsert(uu32 = true)
private String id;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("活动ID")
private String activityId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("课程ID")
private String courseId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("用户ID")
private String userId;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("课程开始时间")
private Date courseStartTime;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("课程结束时间")
private Date courseEndTime;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否上课")
private boolean isAttend;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("上课打卡时间")
private Date attendTime;
@Column
@ColDefine(type = ColType.BOOLEAN)
@Comment("是否领取礼品")
private Boolean isReceive;
@Column
@ColDefine(type = ColType.DATETIME)
@Comment("领取礼品时间")
private Date receiveTime;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("签到扫码人员id(二维码模式)")
private String signScannerCodeUserId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("礼品扫码人员id(二维码模式)")
private String giftScannerCodeUserId;
@Column
@ColDefine(type = ColType.VARCHAR, width = 32)
@Comment("关联literacy_sign_up_activity_course表的id")
private String activityCourseId;
}
@@ -1,129 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyActivity;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
import org.nutz.dao.Cnd;
import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @author zxy
* @Description TODO
* @createTime 2022年02月23日 17:14:00
*/
public interface LiteracyActivityService extends BaseService<LiteracyActivity> {
/**
* 添加活动
*
* @param activity 活动信息
* @param course 培训班信息
*/
void add(LiteracyActivity activity, LiteracyCourse course);
/**
* 编辑活动
*
* @param activity 活动信息
*/
void edit(LiteracyActivity activity);
/**
* 更新活动状态
*
* @param activity 活动信息
*/
void updateActivityStatus(LiteracyActivity activity);
/**
* 查询单条活动信息
*
* @param id 活动ID
* @return 返回的数据与前端符合
*/
NutMap findOne(String id, Cnd cnd, String fromMode);
/**
* pc分页查询
*
* @param pageForm
* @param cnd
* @return
*/
Pagination pageData(PageForm pageForm, Cnd cnd);
/**
* 手机端分页查询
*
* @param pageForm 分页
* @param year 年度
* @param activityStatus 报名状态 0全部 1进行中 2结束
* @return
*/
Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType);
/**
* 手机端报名
*
* @param trainSignUpUser 活动ID
*/
void doSignUp(LiteracyUser trainSignUpUser) throws Exception;
/**
* 异步插入每个报名成功人员的课程数据
*
* @param activityId
* @param courseId
* @param userId
*/
void asyncInsertUserCourse(String activityId, String courseId, String userId);
/**
* 该培训班每个分工会名额是否报满
* @return
*/
boolean isSignFullByUnionId(LiteracyCourse course, Integer currentFamilyNumber);
/**
* 该培训班是否报满
*/
boolean isSignFull(LiteracyCourse course, Integer currentFamilyNumber);
/**
* 还能报该类型的培训班吗 比如书画班最多报一项 健身班两项
* @return
*/
boolean isSignCourse(LiteracyCourse course, LiteracyActivity activity);
/**
* 当前用户是否已报过该培训班
*
* @param courseId
* @param userId
* @return
*/
boolean isSignCourseByUser(String courseId, String userId);
/**
* 手机端签到
*
* @param id 每个培训班每节课每个用户的记录ID
*/
void doQd(String id);
/**
* 某个用户的签到信息
*
* @param userId 用户id
* @param activityId 活动id
*/
List<NutMap> qdInfoByUserId(String userId, String activityId);
List<LiteracyCourse> filterCourseByHostUnion(List<LiteracyCourse> courseList);
}
@@ -1,68 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
import org.nutz.lang.util.NutMap;
import java.util.List;
import java.util.Map;
/**
* @author zxy
* @Description 报名统计service
* @createTime 2022年03月03日 10:00:00
*/
public interface LiteracyActivityStatisticsService extends BaseService<LiteracyUser> {
/**
* 统计分页
*
* @param pageForm
* @param activityId
* @return
*/
Pagination pageData(PageForm pageForm, String activityId);
/**
* 该课程下的报名人员信息
*
* @param courseId
* @return
*/
List<NutMap> registerUserList(String courseId);
List<NutMap> getTaleColumnInfo(String courseId);
/**
* 该课程下的报名人员信息
*
* @param courseId
* @return
*/
List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword);
/**
* 获取每个课程的签到情况
*
* @param courseId
* @return k->每个培训班每节课的上课时间 v->上课记录list
*/
Map<String, List<NutMap>> getSignInfo(String courseId);
/**
* 报名人员list 导出
* @param activityId
* @return
*/
List<NutMap> baoMingUserList(String activityId);
int queryCourseCount(String courseId, String courseType);
int queryCourseWaitCount(String courseId, String courseType);
int queryCourseCount(String courseId, String courseType, String unionId);
int queryCourseWaitCount(String courseId, String courseType, String unionId);
}
@@ -1,43 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyBlackList;
import org.nutz.dao.Cnd;
import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @author zxy
* @Description TODO
* @createTime 2022年03月07日 14:29:00
*/
public interface LiteracyBlackListService extends BaseService<LiteracyBlackList> {
/**
* 分页
*
* @param pageForm 分页
* @return Pagination
*/
Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId);
/**
* 拉黑解封用户
*
* @param userId
*/
void doHandleUser(String userId);
/**
* 上课记录
*
* @param userId
* @return
*/
List<NutMap> attendClassRecord(String userId);
}
@@ -1,473 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.sys.models.Sys_home_activity;
import com.budwk.app.sys.views.View_user;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.activity.literacy.models.*;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityService;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.async.Async;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.Static;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zxy
* @Description TODO
* @createTime 2022年02月23日 17:14:00
*/
@Slf4j
@IocBean(args = {"refer:dao"})
public class LiteracyActivityServiceImpl extends BaseServiceImpl<LiteracyActivity> implements LiteracyActivityService {
@Inject
private LiteracyActivityStatisticsService statisticsService;
public LiteracyActivityServiceImpl(Dao dao) {
super(dao);
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void add(LiteracyActivity activity, LiteracyCourse course) {
dao().insert(activity);
//插入类型限制
List<LiteracyTypeLimit> typeLimits = activity.getTypeLimits();
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
dao().insert(typeLimits);
List<LiteracyCourse> courseList = activity.getCourseList();
for (LiteracyCourse v : courseList) {
v.setActivityId(activity.getId());
v.setOpenOtherUnion(false);
dao().insert(v);
this.setCourseTimeAndInsert(v);
}
if (!activity.isDisabled()) {
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
dao().insertOrUpdate(sysHomeActivity);
}
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void edit(LiteracyActivity activity) {
//修改活动
update(activity);
//修改类型限制
List<LiteracyTypeLimit> typeLimits = activity.getTypeLimits();
typeLimits.forEach(v -> v.setActivityId(activity.getId()));
if(Lang.isNotEmpty(typeLimits)) {
insertOrUpdate(typeLimits);
}
List<LiteracyCourse> courseList = activity.getCourseList();
courseList.forEach(v -> {
v.setActivityId(activity.getId());
dao().insertOrUpdate(v);
if (Lang.isNotEmpty(v.getCourseTimeList())) {
this.setCourseTimeAndInsert(v);
}
});
//查询原来的活动
List<LiteracyCourse> oldCourseList = dao().query(LiteracyCourse.class, Cnd.where("activityId", "=", activity.getId()));
//原来的培训班id
List<String> oldCourseIdList = oldCourseList.stream().map(LiteracyCourse::getId).toList();
//原来的上课时间
List<LiteracyActivityCourse> oldActCourseTimeList = dao().query(LiteracyActivityCourse.class, Cnd.where("activityId", "=", activity.getId()));
//现在的上课时间
List<String> nowCourseTimeListId = new ArrayList<>();
activity.getCourseList().forEach(v -> {
if (v.getCourseTimeList() != null) {
nowCourseTimeListId.addAll(v.getCourseTimeList().stream().map(LiteracyActivityCourse::getId).toList());
}
});
List<String> deleteCourseTimeListId = oldActCourseTimeList.stream().map(LiteracyActivityCourse::getId).filter(id -> !nowCourseTimeListId.contains(id)).collect(Collectors.toList());
List<String> courseIdList = courseList.stream().map(LiteracyCourse::getId).collect(Collectors.toList());
//删除关联的培训班
List<String> deleteIdList = oldCourseIdList.stream().filter(v -> !courseIdList.contains(v)).collect(Collectors.toList());
dao().clear(LiteracyCourse.class, Cnd.where("id", "in", deleteIdList));
dao().clear(LiteracyActivityCourse.class, Cnd.where("id", "in", deleteCourseTimeListId));
dao().clear(LiteracyUser.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
dao().clear(LiteracyUserCourse.class, Cnd.where("courseId", "not in", courseIdList).and("activityId", "=", activity.getId()));
//查询修改过培训时间的记录
Sql tsuucSql = Sqls.create("""
SELECT
tsuuc.id,
tsuac.courseStartTime,
tsuac.courseEndTime
FROM
`literacy_user_course` tsuuc
LEFT JOIN literacy_activity_course tsuac ON tsuac.id = tsuuc.activityCourseId
where tsuuc.courseStartTime != tsuac.courseStartTime or tsuuc.courseEndTime != tsuac.courseEndTime
""");
List<NutMap> tsuucList = listMap(tsuucSql);
tsuucList.forEach(v -> {
Chain chain = Chain.make("courseStartTime", v.getTime("courseStartTime"));
chain.add("courseEndTime", v.getTime("courseEndTime"));
Cnd cnd = Cnd.where("id", "=", v.getString("id"));
dao().update("literacy_user_course", chain, cnd);
});
if (!activity.isDisabled()) {
Sys_home_activity sysHomeActivity = activity.covertToSysHomeActivity();
dao().insertOrUpdate(sysHomeActivity);
} else {
dao().delete(Sys_home_activity.class, activity.getId());
}
}
private void setCourseTimeAndInsert(LiteracyCourse course) {
course.getCourseTimeList().forEach(courseTime -> {
Calendar calendar = Calendar.getInstance();
calendar.setTime(courseTime.getCourseDate());
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DATE);
Calendar startCalendar = Calendar.getInstance();
startCalendar.setTime(courseTime.getCourseStartTime());
startCalendar.set(year, month, day);
courseTime.setCourseStartTime(startCalendar.getTime());
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(courseTime.getCourseEndTime());
endCalendar.set(year, month, day);
courseTime.setCourseEndTime(endCalendar.getTime());
courseTime.setActivityId(course.getActivityId());
courseTime.setCourseId(course.getId());
dao().insertOrUpdate(courseTime);
});
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void updateActivityStatus(LiteracyActivity activity) {
updateIgnoreNull(activity);
}
@Override
public NutMap findOne(String id, Cnd cnd, String fromMode) {
if (Lang.isEmpty(cnd)) {
cnd = Cnd.NEW();
}
cnd.asc("orderNum").asc("campus").desc("courseLocation").asc("courseType").asc("courseName");
List<LiteracyCourse> courseArray = dao().query(LiteracyCourse.class, cnd.and("activityId", "=", id));
if (StrUtil.isNotBlank(fromMode) && "mobile".equals(fromMode)) {
courseArray = this.filterCourseByHostUnion(courseArray);
}
LiteracyActivity activity = fetchLinks(dao().fetch(LiteracyActivity.class, id), "^(conditionStructure|typeLimits)$");
activity.setCourseList(courseArray);
List<LiteracyCourse> courseList = activity.getCourseList();
courseList.forEach(c -> {
if (StrUtil.isNotBlank(c.getCourseType())) {
dao().fetchLinks(c, "^(courseTimeList)$", Cnd.NEW().asc("courseStartTime"));
int courseCount = statisticsService.queryCourseCount(c.getId(), c.getCourseType());
c.setHasRegisterNum(courseCount);
int courseWaitCount = statisticsService.queryCourseWaitCount(c.getId(), c.getCourseType());
c.setHasWaitingNum(courseWaitCount);
//当前用户是否报过
c.setIsSign(isSignCourseByUser(c.getId(), SecurityUtil.getUserId()));
}
});
return Lang.obj2nutmap(activity);
}
@Override
public Pagination pageData(PageForm pageForm, Cnd cnd) {
Pagination pagination = listPageLinks(pageForm.getPageNumber(), pageForm.getPageSize(), cnd, "^(courseList)$");
return pagination;
}
@Override
public Pagination mPageData(PageForm pageForm, Integer year, int activityStatus, Integer activityType) {
Cnd cnd = Cnd.NEW();
cnd.andEX("year", "=", year);
switch (activityStatus) {
case 2 -> {
cnd.and(new Static("activitySignUpStartTime < now()"));
cnd.and(new Static("activitySignUpEndTime > now()"));
}
case 3 -> {
cnd.and(new Static("activityStartTime < now()"));
cnd.and(new Static("activityEndTime > now()"));
}
case 4 -> cnd.and(new Static("activityEndTime < now()"));
case 5 -> cnd.and(new Static("activityStartTime < now()"));
case 6 -> cnd.and(new Static("activityStartTime > now()"));
}
if (activityType != null && activityType == 1) {
cnd.and(new Static("id in (select activityId from literacy_user where userId = '%s')".formatted(SecurityUtil.getUserId())));
}
cnd.and("isDisabled", "=", 0);
cnd.orderBy("activityEndTime", "desc");
cnd.orderBy("isDisabled", "desc");
cnd.orderBy("createdAt", "desc");
return listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
}
@Override
@Aop(TransAop.READ_COMMITTED)
public void doSignUp(LiteracyUser literacyUser) throws Exception {
String userId = SecurityUtil.getUserId();
//查询课程
LiteracyCourse course = dao().fetch(LiteracyCourse.class, literacyUser.getCourseId());
LiteracyType type = dao().fetch(LiteracyType.class, course.getCourseType());
//如果这个课程的预留名额方式为报名人数不变
if (course.getReserveMode() == 2) {
//如果当前报名+已报小于这个课程限制人数
//课程已报人数
int normalCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
//+1是算自己
int hasRegisterNum = type.getSelfAddFamily() ? normalCount + 1 : 0;
literacyUser.setState((hasRegisterNum + course.getCourseReservedNumber()) > course.getCoursePeopleNumber() ? 2 : 1);
} else {
literacyUser.setState(1);
}
View_user user = dao().fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
literacyUser.setUnionId(SecurityUtil.getUnionId());
literacyUser.setUnionName(user.getUnionName());
literacyUser.setUnitId(SecurityUtil.getUnitId());
literacyUser.setUnitName(user.getUnitName());
literacyUser.setUserId(userId);
literacyUser.setSignUpTime(new Date());
dao().insert(literacyUser);
if (StrUtil.isNotBlank(literacyUser.getActivityCourseId())) {
LiteracyActivityCourse fetch = dao().fetch(LiteracyActivityCourse.class, literacyUser.getActivityCourseId());
LiteracyUserCourse userCourse = new LiteracyUserCourse();
userCourse.setActivityId(literacyUser.getActivityId());
userCourse.setCourseId(literacyUser.getCourseId());
userCourse.setUserId(literacyUser.getUserId());
userCourse.setCourseStartTime(fetch.getCourseStartTime());
userCourse.setCourseEndTime(fetch.getCourseEndTime());
userCourse.setAttend(false);
userCourse.setAttendTime(null);
userCourse.setActivityCourseId(fetch.getId());
dao().insert(userCourse);
} else {
asyncInsertUserCourse(literacyUser.getActivityId(), literacyUser.getCourseId(), literacyUser.getUserId());
}
}
@Async
@Override
public void asyncInsertUserCourse(String activityId, String courseId, String userId) {
log.info("异步插入{}的上课信息,课程ID为{},活动ID为{}", userId, courseId, activityId);
List<LiteracyActivityCourse> courseList = dao().query(LiteracyActivityCourse.class, Cnd.where("courseId", "=", courseId));
List<LiteracyUserCourse> list = new ArrayList<>();
courseList.forEach(v -> {
LiteracyUserCourse userCourse = new LiteracyUserCourse();
userCourse.setActivityId(activityId);
userCourse.setCourseId(courseId);
userCourse.setUserId(userId);
userCourse.setCourseStartTime(v.getCourseStartTime());
userCourse.setCourseEndTime(v.getCourseEndTime());
userCourse.setAttend(false);
userCourse.setAttendTime(null);
userCourse.setActivityCourseId(v.getId());
list.add(userCourse);
});
dao().insert(list);
}
/**
* 该培训班每个分工会名额是否报满
* @return
*/
@Override
public boolean isSignFullByUnionId(LiteracyCourse course, Integer currentFamilyNumber) {
List<NutMap> unionLimit = course.getUnionLimit();
if (Lang.isEmpty(unionLimit)) {
return false;
}
String unionId = SecurityUtil.getUnionId();
NutMap unionLimitMap = unionLimit.stream().filter(v -> v.getString("id").equals(unionId)).findAny().orElse(null);
if (Lang.isEmpty(unionLimitMap)) {
return true;
}
LiteracyType type = dao().fetch(LiteracyType.class, course.getCourseType());
//分工会限制人数
int limitCount = unionLimitMap.getInt("limitCount");
//该课程已经报名的总人数
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType(), unionId);
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
//+1是算自己
int current = type.getSelfAddFamily() ? 1 : 0;
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
//如果还有正常名额
if(limitCount - hasSignCount > 0) {
return (hasSignCount + current + currentFamilyNumber) > limitCount;
} else {
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
}
}
@Override
public boolean isSignFull(LiteracyCourse course, Integer currentFamilyNumber) {
//课程限制人数
int coursePeopleNumber = course.getCoursePeopleNumber();
if (coursePeopleNumber == 0) {
return true;
}
//查询课程对应的类型
LiteracyType type = dao().fetch(LiteracyType.class, course.getCourseType());
//课程已报人数
int hasSignCount = statisticsService.queryCourseCount(course.getId(), course.getCourseType());
int hasWaitCount = statisticsService.queryCourseWaitCount(course.getId(), course.getCourseType());
//+1是算自己
int current = type.getSelfAddFamily() ? 1 : 0;
currentFamilyNumber = type.getIsBringFamily() && type.getIsAddFamily() ? currentFamilyNumber : 0;
//如果还有正常名额
if(coursePeopleNumber - hasSignCount > 0) {
return (hasSignCount + current + currentFamilyNumber + course.getCourseReservedNumber()) > coursePeopleNumber;
} else {
return (hasWaitCount + current + currentFamilyNumber) > course.getWaitingNum();
}
}
@Override
public boolean isSignCourse(LiteracyCourse course, LiteracyActivity activity) {
//培训班类型
String courseType = course.getCourseType();
Sql sql = Sqls.create("""
SELECT
count( tsus.id )
FROM
`literacy_user` tsus
LEFT JOIN literacy_course tsuc ON tsuc.id = tsus.courseId
WHERE
tsuc.courseType = @courseType
AND tsus.userId = @userId
AND tsus.activityId = @activityId
""");
sql.setParam("courseType", courseType);
sql.setParam("activityId", activity.getId());
sql.setParam("userId", SecurityUtil.getUserId());
int hasRegisterNum = count(sql);
//第一种无限制报名
if (activity.getRestrictLimit() == null || activity.getRestrictLimit() == 1) {
return true;
} else if (activity.getRestrictLimit() == 2) {
LiteracyTypeLimit literacyTypeLimit = dao().fetch(LiteracyTypeLimit.class, Cnd.where("typeId", "=", courseType).and("activityId", "=", activity.getId()));
if (literacyTypeLimit == null) {
return true;
}
//此类型的班最多可报几项
int personMaxRegisterNum = literacyTypeLimit.getLimitNum();
if (personMaxRegisterNum == 0) {
return true;
}
return hasRegisterNum < personMaxRegisterNum;
} else if (activity.getRestrictLimit() == 3) {
//第三种限制报几个不跟类型挂钩
int aCount = dao().count(LiteracyUser.class, Cnd.where("activityId", "=", activity.getId()).and("userId", "=", SecurityUtil.getUserId()));
return aCount < activity.getLimitNum();
}
return false;
}
@Override
public boolean isSignCourseByUser(String courseId, String userId) {
return dao().count(LiteracyUser.class, Cnd.where("courseId", "=", courseId).and("userId", "=", userId)) > 0;
}
@Override
public void doQd(String id) {
NutMap updateMap = NutMap.NEW();
updateMap.put("isAttend", true);
updateMap.put("attendTime", new Date());
dao().update(LiteracyUserCourse.class, Chain.from(updateMap), Cnd.where("id", "=", id));
}
@Override
public List<NutMap> qdInfoByUserId(String userId, String activityId) {
Sql sql = Sqls.create("""
SELECT
c.*,
t.courseLocationCoordinates,
t.isMobileSign,
t.signType,
t.isReceiveGift,
t.giftType,
(select state from literacy_user su where su.activityId = c.activityId and su.courseId = c.courseId and su.userId = c.userId) as state
FROM
`literacy_user_course` c
LEFT JOIN literacy_course t ON t.id = c.courseId
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("c.activityId", "=", activityId);
cnd.and("c.userId", "=", userId);
cnd.asc("c.courseStartTime");
sql.setCondition(cnd);
return listMap(sql);
}
@Override
public List<LiteracyCourse> filterCourseByHostUnion(List<LiteracyCourse> courseList) {
if (Lang.isEmpty(courseList)) {
return new ArrayList<>();
}
return courseList.stream().filter(o -> {
if (StrUtil.isBlank(o.getInterTime()) || o.getOpenOtherUnion() == null || o.getOpenOtherUnion()) {
return true;
} else {
if (SecurityUtil.getUnionId().equals(o.getHostUnionId())) {
return true;
} else {
int compare = cn.hutool.core.date.DateUtil.compare(cn.hutool.core.date.DateUtil.date(), cn.hutool.core.date.DateUtil.parse(o.getInterTime()), "yyyy-MM-dd HH:mm");
return compare >= 0;
}
}
}).toList();
}
}
@@ -1,260 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyMobileSignColumn;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyCourse;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyType;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyUser;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyActivityStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* @author zxy
* @Description TODO
* @createTime 2022年03月03日 10:02:00
*/
@IocBean(args = {"refer:dao"})
@Slf4j
public class LiteracyActivityStatisticsServiceImpl extends BaseServiceImpl<LiteracyUser> implements LiteracyActivityStatisticsService {
public LiteracyActivityStatisticsServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination pageData(PageForm pageForm, String activityId) {
Sql sql = Sqls.create("""
SELECT
tsuc.id,
tsuc.courseName,
tsuc.coursePeopleNumber,
tsuc.courseReservedNumber,
type.typeName as courseType,
tsuc.courseLocation,
tsuc.courseInstructor,
tsuc.reserveMode,
tsuc.isMobileSign,
tsuc.hostUnionId,
tsuc.interTime,
tsuc.waitingNum,
tsuc.openOtherUnion,
tsuc.courseType as cType
FROM
`literacy_course` tsuc
LEFT JOIN
literacy_type type on tsuc.courseType = type.id
WHERE
tsuc.activityId = @activityId
ORDER BY tsuc.orderNum
""");
sql.setParam("activityId", activityId);
Pagination pagination = listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> courseList = pagination.getList();
courseList.forEach(c -> {
c.put("registerNum", queryCourseCount(c.getString("id"), c.getString("cType")));
c.put("hasWaitingNum", queryCourseWaitCount(c.getString("id"), c.getString("cType")));
});
return pagination;
}
@Override
public List<NutMap> registerUserList(String courseId) {
Sql sql = Sqls.create("""
SELECT
u.loginname,
u.username,
u.sex,
tsuu.unionId,
tsuu.unionName,
tsuu.unitId,
tsuu.unitName,
ifnull(tsuu.mobile, u.mobile) as mobile,
tsuu.signUpTime,
tsuu.state,
tsuu.mobileColumnsValue
FROM
literacy_user tsuu
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
$condition
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("tsuu.courseId", "=", courseId);
sql.setCondition(cnd);
List<NutMap> list = listMap(sql);
list.forEach(o -> {
List<NutMap> mobileColumnsValue = Json.fromJsonAsList(NutMap.class, o.getString("mobileColumnsValue"));
if(Lang.isNotEmpty(mobileColumnsValue)) {
mobileColumnsValue.forEach(m -> {
o.put(m.getString("columnCode"), m.getString("columnValue"));
});
}
});
return list;
}
@Override
public List<NutMap> getTaleColumnInfo(String courseId) {
LiteracyCourse course = dao().fetch(LiteracyCourse.class, courseId);
LiteracyType upType = dao().fetch(LiteracyType.class, course.getCourseType());
dao().fetchLinks(upType, "literacyMobileSignColumnList", Cnd.NEW().asc("columnIndex"));
List<LiteracyMobileSignColumn> columnList = upType.getLiteracyMobileSignColumnList();
List<NutMap> columnTableList = columnList.stream().map(o -> NutMap.NEW().setv("label", o.getColumnName()).setv("prop", o.getColumnCode())).collect(Collectors.toList());
return columnTableList;
}
@Override
public List<NutMap> registerUserList(String courseId, String unionId, String unitId, String searchName, String searchKeyword) {
Sql sql = Sqls.create("""
SELECT
tsuu.id,
u.id as userId,
u.loginname,
u.username,
u.unitname,
u.unionname,
u.sex,
ifnull(tsuu.mobile, u.mobile) as mobile,
tsuu.signUpTime,
tsuu.state
FROM
literacy_user tsuu
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
$condition
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 ),u.unionid desc, u.unitid desc
""");
Cnd cnd = Cnd.NEW();
cnd.andEX("tsuu.courseId", "=", courseId);
cnd.andEX("u.unionid", "=", unionId);
cnd.andEX("u.unitid", "=", unitId);
if (StrUtil.isNotBlank(searchKeyword)) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.andLike("username", searchKeyword).orLike("loginname", searchKeyword);
cnd.and(group);
}
sql.setCondition(cnd);
return listMap(sql);
}
@Override
public Map<String, List<NutMap>> getSignInfo(String courseId) {
Sql sql = Sqls.create("""
SELECT
tsuuc.courseStartTime,
tsuuc.courseEndTime,
tsuuc.isAttend,
tsuuc.attendTime,
u.username,
u.loginname,
u.unitname,
u.unionname
FROM
`literacy_user_course` tsuuc
LEFT JOIN `vw_user` u ON u.id = tsuuc.userId
WHERE
tsuuc.courseId = @courseId
""");
sql.setParam("courseId", courseId);
List<NutMap> list = listMap(sql);
Map<String, List<NutMap>> courseTimeMap = list.stream().map(v -> {
String courseTime = v.getString("courseStartTime") + "" + v.getString("courseEndTime");
v.put("courseTime", courseTime);
return v;
}).collect(Collectors.groupingBy(v -> v.getString("courseTime")));
// 使用Stream API进行降序排序
Map<String, List<NutMap>> sortedDataMap = courseTimeMap.entrySet().stream()
.sorted(Map.Entry.comparingByKey(Comparator.reverseOrder()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
return sortedDataMap;
}
@Override
public List<NutMap> baoMingUserList(String activityId) {
Sql sql = Sqls.create("""
SELECT
u.loginname,
u.username,
u.unitname,
u.unionname,
u.sex,
u.mobile,
uc.courseName,
uc.campus
FROM
`literacy_user` uu
RIGHT JOIN literacy_course uc ON uc.id = uu.courseId
LEFT JOIN `vw_user` u ON u.id = uu.userId
WHERE
uc.activityId = @activityId
ORDER BY u.unitCode,u.unioncode,u.sex
""");
sql.setParam("activityId", activityId);
return listMap(sql);
}
@Override
public int queryCourseCount(String courseId, String courseType) {
return this.queryCourseCount(courseId, courseType, null);
}
@Override
public int queryCourseWaitCount(String courseId, String courseType) {
return this.queryCourseWaitCount(courseId, courseType, null);
}
@Override
public int queryCourseCount(String courseId, String courseType, String unionId) {
return this.calcSignCount(courseId, courseType, unionId, List.of(1, 3));
}
@Override
public int queryCourseWaitCount(String courseId, String courseType, String unionId) {
return this.calcSignCount(courseId, courseType, unionId, List.of(2));
}
private int calcSignCount(String courseId, String courseType, String unionId, List<Integer> stateList) {
if(StrUtil.isBlank(courseId) || StrUtil.isBlank(courseType)) {
return 0;
}
LiteracyType type = dao().fetch(LiteracyType.class, courseType);
AtomicInteger hasRegisterNum = new AtomicInteger();
List<LiteracyUser> signUpUsers = dao().query(LiteracyUser.class, Cnd.where("courseId", "=", courseId)
.and("state", "in", stateList)
.andEX("unionId", "=", unionId));
signUpUsers.forEach(item -> {
if (type.getSelfAddFamily()) {
hasRegisterNum.getAndIncrement();
}
if(type.getIsBringFamily() && type.getIsAddFamily()) {
List<NutMap> mobileColumnsValue = item.getMobileColumnsValue();
NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null);
int number = map != null ? map.getInt("columnValue") : 0;
hasRegisterNum.addAndGet(number);
}
});
return hasRegisterNum.get();
}
}
@@ -1,103 +0,0 @@
package com.budwk.app.zhgh.activity.literacy.service.impl;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.activity.literacy.models.LiteracyBlackList;
import com.budwk.app.zhgh.activity.literacy.service.LiteracyBlackListService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Criteria;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.List;
/**
* @author zxy
* @Description TODO
* @createTime 2022年03月07日 14:29:00
*/
@IocBean(args = {"refer:dao"})
public class LiteracyUserServiceImpl extends BaseServiceImpl<LiteracyBlackList> implements LiteracyBlackListService {
public LiteracyUserServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination pageData(PageForm pageForm, Cnd cnd, String activityId, String courseId) {
Sql sql = Sqls.create("""
SELECT
u.id AS userId,
u.username,
u.loginname,
ifnull(tsuu.mobile, u.mobile) as mobile,
u.unitname,
u.unionname,
tsuc.courseName,
tsuu.state,
( SELECT count( 1 ) FROM literacy_user_course WHERE userId = tsuu.userId $var) courseTotal,
( SELECT count( 1 ) FROM literacy_user_course WHERE userId = tsuu.userId AND isAttend = 0 and tsuu.state!=2 AND now()> courseEndTime $var) AS absentCount,
if(tsubl.isDisabled=1,true,false) isDisabled,
group_CONCAT( tsuc.courseName ) AS courseNames
FROM
`literacy_user` tsuu
LEFT JOIN `vw_user` u ON u.id = tsuu.userId
LEFT JOIN literacy_activity act on act.id = tsuu.activityId
LEFT JOIN literacy_course tsuc ON tsuc.id = tsuu.courseId
LEFT JOIN literacy_black_list tsubl on tsubl.userId = tsuu.userId
$condition
ORDER BY FIELD( tsuu.state, 1, 3, 2, 4 )
""");
cnd.groupBy("tsuu.userId");
Criteria varCnd = Cnd.cri();
varCnd.where().setTop(false);
varCnd.where().andEX("activityId", "=", activityId);
varCnd.where().andEX("courseId", "=", courseId);
if (!varCnd.where().isEmpty()) {
sql.vars().set("var", "and " + varCnd.toSql(null));
}
sql.setCondition(cnd);
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@Override
public void doHandleUser(String userId) {
LiteracyBlackList blackRecord = dao().fetch(LiteracyBlackList.class, Cnd.where("userId", "=", userId));
if (Lang.isEmpty(blackRecord)) {
LiteracyBlackList blackList = new LiteracyBlackList();
blackList.setUserId(userId);
blackList.setIsDisabled(true);
dao().insert(blackList);
} else {
// blackRecord.setIsDisabled(!blackRecord.getIsDisabled());
// dao().update(blackRecord);
dao().delete(blackRecord);
}
}
@Override
public List<NutMap> attendClassRecord(String userId) {
Sql sql = Sqls.create("""
SELECT
c.courseName,
uc.courseStartTime,
courseEndTime,
uc.isAttend,
uc.attendTime
FROM
`literacy_user_course` uc
LEFT JOIN literacy_course c ON c.id = uc.courseId
WHERE
uc.userId = @userId
""");
sql.setParam("userId", userId);
return listMap(sql);
}
}
@@ -303,6 +303,7 @@ public class SiteApplyController {
nutMap.addv("disabled", true);
nutMap.addv("tooltip", "已预约");
}
nutMap.addv("dateStr", day);
}
return Result.success(result);
}
@@ -173,6 +173,9 @@ public class TeacherCongressDelegateServiceImpl extends BaseServiceImpl<Teacher_
delegateGroupList.get(i).get(j).put("username" + j, delegateGroupList.get(i).get(j).getString("userName"));
delegateGroupList.get(i).get(j).put("sex" + j, delegateGroupList.get(i).get(j).getString("sex"));
buildMap.put("username" + j, delegateGroupList.get(i).get(j).getString("userName"));
if(StrUtil.isNotBlank(delegateGroupList.get(i).get(j).getString("sex"))) {
buildMap.put("sex" + j, "(" + delegateGroupList.get(i).get(j).getString("sex") + ")");
}
}
buildMaps.add(buildMap);
}
@@ -61,6 +61,11 @@ public class Teacher_congress_institution extends BaseModel {
@Default(value = "0")
private Integer location;
@Column
@Comment("描述")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String introduce;
//子数据
private List<Teacher_congress_institution> children;
@@ -55,6 +55,7 @@ public class TeacherCongressSessionController {
cnd.andEX("YEAR(startDate)", "=", year);
cnd.andEX("j", "=", j);
cnd.andEX("c", "=", c);
cnd.desc("startDate");
sql.setCondition(cnd);
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
return Result.success(pagination);
@@ -6,6 +6,7 @@ import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.result.Result;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.flow.constant.FlowConst;
@@ -16,18 +17,24 @@ import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
import com.budwk.app.flow.service.FlowCommonService;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.models.Dsznfmtx;
import com.budwk.app.zhgh.staffbenefit.dsznfmtx.service.DsznfmtxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@@ -49,6 +56,8 @@ public class DsznfmtxApplyController {
@Inject
private BaseService baseService;
@Inject
private DsznfmtxService dsznfmtxService;
@Inject
private FlowEngine flowEngine;
@Inject
private FlowCommonService flowCommonService;
@@ -111,6 +120,53 @@ public class DsznfmtxApplyController {
return Result.success();
}
@At
@Ok("json")
@ApiOperation("是否为退休、离休、离退休人员")
@SaCheckPermission(value = {"dsznfmtx.apply", "h5.dsznfmtx.apply"}, mode = SaMode.OR)
public Object checkRetirementStatus(HttpServletRequest req) {
Sql sql = Sqls.create("""
SELECT
info.id,
info.userState
FROM
sys_user info
$condition
""");
Cnd cnd = Cnd.NEW();
cnd.and("info.id", "=", SecurityUtil.getUserId());
sql.setCondition(cnd);
List<NutMap> map = dsznfmtxService.listMap(sql);
if (!map.isEmpty()) {
NutMap user = map.get(0);
String userState = user.getString("userState");
// 检查用户状态是否为退休相关状态
if ("退休".equals(userState) || "离休".equals(userState) || "离退休".equals(userState)) {
return Result.success(true);
}
}
return Result.success(false);
}
@At
@Ok("json")
@ApiOperation("是否已经申请过")
@SaCheckPermission(value = {"dsznfmtx.apply", "h5.dsznfmtx.apply"}, mode = SaMode.OR)
public Object checkUserApplied(HttpServletRequest req) {
try {
// 查询该用户是否已有申请记录
long count = dao.count(Dsznfmtx.class, Cnd.where("userId", "=", SecurityUtil.getUserId()));
// 返回true表示已申请false表示未申请
return Result.success(count > 0);
} catch (Exception e) {
log.error("检查用户申请状态失败", e);
return Result.error("检查用户申请状态失败");
}
}
@At
@SaCheckLogin
public Result findOne(String id) {
@@ -146,5 +146,6 @@ public class Dsznfmtx extends BaseModel implements Serializable {
@Comment("办证机关")
private String office;
}
@@ -126,7 +126,7 @@ public class MaternityLeaveCollectController {
@At
@ApiOperation("删除")
@Aop(TransAop.READ_COMMITTED)
@SaCheckPermission(value = {"maternityLeave.mine", "h5.maternityLeave.mine"}, mode = SaMode.OR)
@SaCheckPermission(value = {"maternityLeave.collect", "h5.maternityLeave.collect"}, mode = SaMode.OR)
@SLog( tag = "删除工会报销", msg = "删除工会报销")
public Result delete(@Param("id") String id) {
maternityLeaveService.delete(id);
@@ -53,7 +53,7 @@ public class MaternityLeaveSchoolAuditController {
@At
@ApiOperation("分页查询")
@SaCheckPermission(value = {"maternityLeave.unionAudit", "h5.maternityLeave.unionAudit"}, mode = SaMode.OR)
@SaCheckPermission(value = {"maternityLeave.schoolAudit", "h5.maternityLeave.schoolAudit"}, mode = SaMode.OR)
public Result pageData(PageForm pageForm,
boolean approval,
Integer year,
@@ -280,8 +280,8 @@ layout("/layouts/platform.html"){
}
},
methods: {
listQuickEntry() {
this.$axios.post("/platform/home/listQuickEntry").then((res) => {
listRecommendApp() {
this.$axios.post("/platform/home/listRecommendApp").then((res) => {
if (res.code === 0) {
this.quickEntries = res.data
}
@@ -299,7 +299,7 @@ layout("/layouts/platform.html"){
}
},
created() {
this.listQuickEntry()
this.listRecommendApp()
this.listActivity()
this.listProcessInstance()
}
@@ -44,8 +44,11 @@ layout("/layouts/platform.html"){
<table-tool>
<el-button @click="$refs.basicFormRef.onOpen(null,pageForm.platform)" size="small" type="primary" icon="el-icon-plus">新建菜单</el-button>
<el-button @click="$refs.sortRef.onOpen(pageForm.platform)" size="small" type="primary" icon="el-icon-sort">排序</el-button>
<el-button @click="$refs.quickEntryRef.onOpen(pageForm.platform)" size="small" type="primary" icon="el-icon-monitor">
首页快速入口
<el-button @click="$refs.recommendSettingRef.onOpen(pageForm.platform, 'app')" size="small" type="primary" icon="el-icon-monitor">
首页推荐应用
</el-button>
<el-button @click="$refs.recommendSettingRef.onOpen(pageForm.platform, 'service')" size="small" type="primary" icon="el-icon-monitor">
首页推荐服务
</el-button>
</table-tool>
<el-table
@@ -120,7 +123,7 @@ layout("/layouts/platform.html"){
</template>
</el-table-column>
</el-table>
<!-- 右键菜单 -->
<ul v-show="menuVisible" class="context-menu" :style="{left: menuLeft + 'px', top: menuTop + 'px'}">
<li @click="handleAddMenu(currentRow)">新建菜单</li>
@@ -128,20 +131,20 @@ layout("/layouts/platform.html"){
<li @click="handleEdit(currentRow)">编辑</li>
<li @click="handleDelete(currentRow)">删除</li>
</ul>
</el-card>
<basic-form ref="basicFormRef" @refresh="loadChildByExpandedKeys"></basic-form>
<permission-form ref="permissionFormRef" @load-child="loadChildByExpandedKeys"></permission-form>
<sort ref="sortRef" @refresh="doSearch"></sort>
<quick-entry ref="quickEntryRef" @refresh="doSearch"></quick-entry>
<recommend-setting ref="recommendSettingRef" @refresh="doSearch"></recommend-setting>
</div>
<script>
<!--#include("permissionForm.js"){}#-->
<!--#include("basicForm.js"){}#-->
<!--#include("sort.js"){}#-->
<!--#include("quickEntry.js"){}#-->
<!--#include("recommendSetting.js"){}#-->
new Vue({
el: "#app",
dicts: ["SYS_MENU_PLATFORM"],
@@ -149,7 +152,7 @@ layout("/layouts/platform.html"){
"basic-form": SYS_MENU_BASIC_FORM_COMPONENT,
"permission-form": SYS_MENU_PERMISSION_FORM_COMPONENT,
sort: SYS_MENU_SORT_COMPONENT,
"quick-entry": SYS_MENU_QUICK_ENTRY_COMPONENT
"recommend-setting": SYS_MENU_RECOMMEND_SETTING_COMPONENT
},
data: function () {
@@ -161,7 +164,7 @@ layout("/layouts/platform.html"){
// 保存展开状态的数组
expandedRowKeysRenew: [],
tableTreeRefreshTool: [],
// 右键打开菜单相关
currentRow: null,
menuVisible: false,
@@ -177,7 +180,7 @@ layout("/layouts/platform.html"){
// 阻止浏览器默认菜单
event.preventDefault();
this.currentRow = row;
this.menuVisible = true;
this.$nextTick(() => {
const menu = this.$el.querySelector('.context-menu');
@@ -1,6 +1,6 @@
const SYS_MENU_QUICK_ENTRY_COMPONENT = {
const SYS_MENU_RECOMMEND_SETTING_COMPONENT = {
template: `
<el-dialog title="快速入口" :visible.sync="dialogVisible" width="50%">
<el-dialog title="推荐配置" :visible.sync="dialogVisible" width="50%">
<el-row :gutter="20">
<el-col :span="12">
<el-tree ref="menuTree"
@@ -46,12 +46,16 @@ const SYS_MENU_QUICK_ENTRY_COMPONENT = {
},
checkedNodes: [],
checkedKeys: []
checkedKeys: [],
type: '',
}
},
methods: {
onOpen(platform) {
onOpen(platform, type) {
this.platform = platform
this.type = type
this.checkedKeys = []
this.dialogVisible = true
this.listTree()
},
@@ -74,12 +78,15 @@ const SYS_MENU_QUICK_ENTRY_COMPONENT = {
setTreeDisabled(data) {
data.forEach((item) => {
if (item.isQuickEntry) {
if ((this.type === 'service' && item.isRecommendService) || (this.type === 'app' && item.isRecommendApp)) {
this.checkedKeys.push(item.id)
}
if (!item.href && item.type === "menu") {
if (!item.href && item.type === "menu" && this.type === 'service') {
item.disabled = true
}
if (this.type === 'app') {
delete item.children
}
if (item.children && item.children.length) {
this.setTreeDisabled(item.children)
}
@@ -95,9 +102,10 @@ const SYS_MENU_QUICK_ENTRY_COMPONENT = {
type: "warning"
}).then(() => {
this.$axios
.post("/platform/sys/menu/updateQuickEntry", {
.post("/platform/sys/menu/updateRecommendSetting", {
menuIds: JSON.stringify(this.checkedNodes.map((item) => item.id)),
platform: this.platform
platform: this.platform,
type: this.type
})
.then((resp) => {
if (resp.code === 0) {
@@ -72,8 +72,7 @@ layout("/layouts/platform.html"){
<el-select v-model="pageForm.activityType" @change="doSearch" style="width: 100%"
placeholder="请选择活动状态" filterable>
<el-option :value="1" label="全部"></el-option>
<el-option :value="4" label="即将开始"></el-option>
<el-option :value="2" label="报名中"></el-option>
<el-option :value="2" label="即将开始 & 报名中"></el-option>
<el-option :value="3" label="已结束"></el-option>
</el-select>
</search-item>
@@ -108,8 +107,13 @@ layout("/layouts/platform.html"){
</el-table-column>
<el-table-column label="操作" width="300">
<template v-slot="{row}">
<el-button @click="onView(row)" size="mini" type="primary">查看介绍</el-button>
<el-button @click="onOpen(row)" size="mini" type="primary">去报名</el-button>
<template v-if="$moment().isBefore($moment(row.activitySignUpEndTime))">
<el-button @click="onView(row)" size="mini" type="primary">查看介绍</el-button>
<el-button @click="onOpen(row)" size="mini" type="primary">去报名</el-button>
</template>
<template v-if="$moment().isAfter($moment(row.activitySignUpEndTime))">
<el-button size="mini" type="info">已结束</el-button>
</template>
</template>
</el-table-column>
</el-table>
@@ -160,7 +164,7 @@ layout("/layouts/platform.html"){
return {
pageForm: {
year: this.$moment().format("YYYY"),
activityType: 4
activityType: 2
},
tableColumns: [
{ label: "活动名称", prop: "activityName", width: 600},
@@ -1,121 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
placeholder="选择年度"
type="year"
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy"
@change="doSearch"
></el-date-picker>
</search-item>
<search-item label="活动状态:" style="width: 340px">
<el-radio-group v-model="pageForm.activityType" @change="doSearch">
<el-radio-button :label="1">全部</el-radio-button>
<el-radio-button :label="2">报名中</el-radio-button>
<el-radio-button :label="3">已结束</el-radio-button>
</el-radio-group>
</search-item>
</search>
</el-card>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="活动列表"></table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:key="column.prop"
:width="column.width"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
<template v-slot="{row}" v-if="column.prop=='activitySignUpStartTime'">
<span>{{$moment(row.activitySignUpStartTime).format('MM/DD HH:mm')}}</span>
<span></span>
<span>{{$moment(row.activitySignUpEndTime).format('MM/DD HH:mm')}}</span>
</template>
<template v-slot="{row}" v-else-if="column.prop=='activityStartTime'">
<span>{{$moment(row.activityStartTime).format('MM/DD HH:mm')}}</span>
<span></span>
<span>{{$moment(row.activityEndTime).format('MM/DD HH:mm')}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="{row}">
<el-button @click="onOpen(row)" size="mini" type="primary">去报名</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<info ref="infoRef"></info>
</template>
</guava>
</div>
<script>
<!--#include('info.js'){}#-->
new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"info": info,
},
data() {
return {
pageForm: {
year: this.$moment().format("YYYY"),
activityType: "2"
},
tableColumns: [
{ label: "活动名称", prop: "activityName", width: 600},
{ label: "活动性质", prop: "literacyType"},
{ label: "报名时间", prop: "activitySignUpStartTime"},
{ label: "活动时间", prop: "activityStartTime"},
],
}
},
methods: {
onOpen(row) {
this.$refs.guava.view(() => {
this.$refs.infoRef.onOpen(row)
})
},
pageData() {
this.$axios.post("/platform/literacy/manage/apply/activityData", this.pageForm).then((res) => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
},
},
async created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -1,306 +0,0 @@
<!--#include('signForm.js'){}#-->
const info = {
template: /*language=HTML*/ `
<div>
<el-row :gutter="20">
<!--<el-col :span="5">
<div class="glow-box">
<img :src="activity.cover"/>
<div class="title">{{ activity.activityName }}</div>
<div v-html="activity.introduce"></div>
</div>
</el-col>-->
<el-col :span="24">
<el-row class="query-row">
<el-col class="query-title hidden-xs-only">&emsp;&emsp;</el-col>
<el-col class="query-content">
<el-select
v-model="pageForm.courseTypeId"
placeholder="请选择类型"
filterable
clearable
style="width: 200px"
@change="doSearch"
>
<el-option v-for="item in courseTypeList" :key="item.id" :label="item.typeName" :value="item.id"></el-option>
</el-select>
</el-col>
</el-row>
<el-row class="query-row" v-if="assortList && assortList.length > 0">
<el-col class="query-title hidden-xs-only">分类标识</el-col>
<el-col class="query-content">
<el-tag
:effect="pageForm.assortTypes.includes(item) ? 'dark' : 'plain'"
:key="item"
:type="item"
@click="tagClick('assortTypes', item)"
style="margin-right: 10px; cursor: pointer"
v-for="item in assortList"
>
{{ item }}
</el-tag>
</el-col>
</el-row>
<el-table :data="tableData" class="mt10">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:key="column.prop"
:width="column.width"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
<template v-slot="{row}" v-if="column.prop=='courseLocationCoordinates'">
<el-button style="padding: 0" @click="openViewMap(row.courseLocationCoordinates)" type="text">
{{row.courseLocation}}
</el-button>
</template>
<template v-slot="{row}" v-else-if="column.prop=='courseTime'">
<el-button style="padding: 0" @click="openViewCourseTime(row.id)" type="text">点击查看时间</el-button>
</template>
<template v-slot="{row}" v-else-if="column.prop=='applyNum'">
<span v-html="calcSignUpCount(row)"></span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="{row}">
<el-button v-if="!row.isSign" type="primary" size="mini" @click="onSign(row)">我要报名</el-button>
<el-button v-else type="danger" size="mini" @click="onCancel(row)">取消报名</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-col>
</el-row>
<el-dialog :visible.sync="courseTimeListDialog" title="时间信息" width="60%" append-to-body>
<el-table :data="courseTimeList">
<el-table-column label="日期" prop="courseDate">
<template v-slot="{row}">{{$moment(row.courseDate).format('YYYY-MM-DD')}}</template>
</el-table-column>
<el-table-column label="开始时间" prop="courseStartTime">
<template v-slot="{row}">{{$moment(row.courseStartTime).format('HH:mm')}}</template>
</el-table-column>
<el-table-column label="结束时间" prop="courseEndTime">
<template v-slot="{row}">{{$moment(row.courseEndTime).format('HH:mm')}}</template>
</el-table-column>
</el-table>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="courseTimeListDialog = false"> </el-button>
</el-row>
</el-dialog>
<el-dialog :visible.sync="viewMapDialog" title="地点" width="60%" append-to-body>
<div id="viewMap" style="width: 100%; height: 500px"></div>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="viewMapDialog = false"> </el-button>
</el-row>
</el-dialog>
<sign-form ref="signFormRef" @refresh="doSearch"></sign-form>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
mixins: [initTableMixins],
components: {
"sign-form": signForm,
},
data() {
return {
pageForm: {
assortTypes: [],
},
assortList: [],
courseTimeListDialog: false,
viewMapDialog: false,
courseTimeList: [],
tableColumns: [
{ prop: "courseName", label: "名称" },
{ prop: "typeName", label: "类型", width: 130},
{ prop: "courseLocationCoordinates", label: "地点", width: 200 },
{ prop: "courseInstructor", label: "联系人", width: 100 },
{ prop: "courseTime", label: "时间", width: 200 },
{ prop: "applyNum", label: "已报名人数", width: 200 }
],
activity: {},
courseTypeList: [],
literacyType: '',
}
},
methods: {
tagClick(key, val) {
let idx = this.pageForm[key].indexOf(val)
if (idx !== -1) {
this.pageForm[key].splice(idx, 1)
} else {
this.pageForm[key].push(val)
}
this.doSearch()
},
async onOpen(row) {
this.activity = row
this.$set(this.pageForm, 'activityId', row.id)
await this.pageData()
await this.getCourseTypeList()
this.queryCourseAssort()
},
onSign(row) {
const course = this.courseTypeList.find((v) => v.id === row.courseType)
this.$axios.post("/platform/mobile/literacyActivity/validateSignUp", {courseId: row.id})
.then((res) => {
if (res.code !== 0) {
this.$alert(res.msg, "提示", {
confirmButtonText: "确定",
type: "warning"
})
} else {
let lave = row.coursePeopleNumber - (row.hasRegisterNum + row.courseReservedNumber)
if(row.reserveMode === 2 && lave <= 0) {
this.$alert('您当前的报名为候补报名状态', "提示", {
confirmButtonText: "确定",
type: "warning"
})
}
this.$refs.signFormRef.onOpen(row, course)
}
})
},
onCancel(row) {
this.$confirm("您确定要取消吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info"
}).then(async () => {
const resp = await this.$axios.post("/platform/mobile/literacyActivity/cancelSignUp", {
activityId: row.activityId,
courseId: row.id
})
if (resp.code === 0) {
await this.pageData()
this.$message.success(resp.msg)
} else {
this.$message.warning(resp.msg)
}
})
},
async getCourseTypeList() {
const resp = await this.$axios.post("/platform/literacy/manage/type/getAllType")
if (resp.code === 0) {
this.courseTypeList = resp.data
}
},
async openViewCourseTime(id) {
const resp = await this.$axios.post(loc() + "/getCourseTime", { id: id })
this.courseTimeList = resp.data
this.courseTimeListDialog = true
},
openViewMap(point) {
if (!Array.isArray(point)) {
this.$message.warning("没有设置点位,无法通过地图查看")
return
}
this.viewMapDialog = true
this.$nextTick(() => {
const viewMap = new AMap.Map("viewMap", {
resizeEnable: true,
center: point,
zoom: 16
})
if (viewMarker) {
viewMap.remove(viewMarker)
}
viewMarker = new AMap.Marker({
position: point,
offset: new AMap.Pixel(-13, -30)
})
viewMap.add(viewMarker)
viewMap.setFitView(null, false, [150, 60, 100, 60])
})
},
calcSignUpCount(o) {
let lave = o.coursePeopleNumber - (o.hasRegisterNum + o.courseReservedNumber)
if(o.reserveMode === 2) {
let lave2 = o.waitingNum - o.hasWaitingNum
return "<span style='color: red'>余" + lave +"</span>/" + o.coursePeopleNumber + "人"
+ "<span style='color: red'>候补余" + lave2 + "</span>/" + o.waitingNum + "人"
} else {
return "<span style='color: red'>余" + lave +"</span>/" + o.coursePeopleNumber + "人"
}
},
async pageData() {
const pageForm = clone({...this.pageForm})
pageForm.assortTypes = JSON.stringify(pageForm.assortTypes)
const resp = await this.$axios.post(loc() + "/pageData", pageForm)
if (resp.code === 0) {
this.tableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
} else {
this.$message.warning(resp.msg)
}
},
queryCourseAssort() {
console.log(this.activity)
this.$axios.post(loc() + "/queryCourseAssort", {activityId: this.activity.id})
.then((resp) => {
this.assortList = resp.data
})
},
},
created() {
},
style: /*language=CSS*/ `
.glow-box {
min-height: calc(100vh - 56px - 40px - 50px - 80px);
max-height: calc(100vh - 56px - 40px - 50px - 80px);
overflow-y: auto;
background: #F0F2F5;
}
img {
width: 100%;
height: 180px;
}
.title {
background: white;
height: 20px;
}
.query-row {
display: flex;
align-items: center;
padding: 6px 0;
}
.query-row:not(:last-child) {
border-bottom: 1px dashed rgb(230, 230, 230);
}
.query-row > .query-title {
width: 100px;
max-width: 100px;
min-width: 100px;
overflow: hidden;
}
.query-row > .query-content {
min-width: 200px;
overflow: hidden;
}
.query-row > .query-content > .el-tag {
margin-bottom: 5px;
margin-top: 5px;
}
@media screen and (max-width: 992px) {
.query-row:nth-child(4) .query-content .el-col:not(:last-child) {
margin-bottom: 5px;
}
.query-title {
display: none;
}
}
`
}
@@ -1,216 +0,0 @@
const signForm = {
template: /*language=HTML*/ `
<div>
<el-dialog :close-on-click-modal="false" :visible.sync="signDialog" title="信息填写" width="50%" append-to-body>
<el-form :model="formData" ref="form" label-width="120px">
<el-row>
<el-col :span="24">
<el-form-item label="姓名" prop="username">
<el-input readonly v-model="formData.username"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="工号" prop="loginname">
<el-input readonly v-model="formData.loginname"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="所在单位" prop="unitName">
<el-input readonly v-model="formData.unitName"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="所属工会" prop="unionName">
<el-input readonly v-model="formData.unionName"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="性别" prop="sex">
<el-input readonly v-model="formData.sex"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="联系方式" prop="mobile">
<el-input v-model="formData.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="courseRow.courseIsLimitApply">
<el-col :span="24">
<el-form-item label="报名时段" prop="activityCourseId"
:rules="{ required: true, message: '请选择报名时段', trigger: 'blur'}">
<el-select style="width: 100%" v-model="formData.activityCourseId" placeholder="请选择报名时段">
<el-option v-for="item in courseTimeSelectList"
:label="item.text.substring(0, 12)"
:value="item.value"
:key="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
v-for="(column, index) in formData.literacyMobileSignColumnList"
:prop="'literacyMobileSignColumnList.' + index + '.columnValue'"
:label="column.columnName"
:key="column.columnCode"
:rules="{ required: column.isRequired,
message: (['SELECT', 'FILE'].includes(column.columnFormType) ? '请选择' : '请填写') + column.columnName,
trigger: 'blur'}"
>
<!--文本框-->
<template v-if="!['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-input
v-model="column.columnValue"
:placeholder="'请填写' + column.columnName"
:type="['INT'].includes(column.columnType) ? 'number' : ''"
></el-input>
</template>
<!--选择框-->
<template v-else-if="['SELECT'].includes(column.columnFormType) && ['VARCHAR','TEXT','INT'].includes(column.columnType)">
<el-select v-model="column.columnValue" :placeholder="'请选择' + column.columnName" style="width: 100%">
<el-option v-for="item in column.selectValues" :key="item" :label="item" :value="item"></el-option>
</el-select>
</template>
<!--时间框-->
<template v-else-if="['DATE', 'DATETIME'].includes(column.columnType)">
<el-date-picker
style="width: 100%"
v-model="column.columnValue"
:type="column.columnType === 'DATE' ? 'date' : 'datetime'"
:placeholder="'请选择' + column.columnName"
:value-format="column.columnType === 'DATE' ? 'yyyy-MM-dd' : 'yyyy-MM-dd HH:mm:ss'"
></el-date-picker>
</template>
<!--文件-->
<template v-else-if="['JSON'].includes(column.columnType)">
<file-upload :upload_number="column.fileNumber" :value.sync="column.columnValue"
:accept="column.fileType ? column.fileType.join(',') : ''"
upload_result_type="url"
complete_result upload_mode="drag"
upload_result_category="array"></file-upload>
</template>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="signDialog = false"> </el-button>
<el-button @click="onSubmit" type="primary"> </el-button>
</el-row>
</el-dialog>
</div>
`,
store,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
signDialog: false,
formData: {},
courseRow: {},
courseTimeSelectList: [],
}
},
methods: {
async getCourseTimeSelectList(o) {
const resp = await $.post('/platform/mobile/literacyActivity/getCourseTimeSelectList',{ courseId: o.id })
if (resp.code === 0) {
this.courseTimeSelectList = resp.data
} else {
this.$message.warning('获取时段信息失败,请联系管理员')
}
},
async onOpen(row, course) {
this.initData(row, course)
if (row.courseIsLimitApply) {
await this.getCourseTimeSelectList(row)
}
this.courseRow = row
this.signDialog = true
},
async onSubmit() {
//获取家属是多少人
let per = 0
this.formData.literacyMobileSignColumnList.forEach((item) => {
if (item.columnCode === "xdqsrs") {
per += Number(item.columnValue)
}
})
const res = await this.$axios.post("/platform/mobile/literacyActivity/validateSignUp", {
courseId: this.formData.courseId,
currentFamilyNumber: per
})
if (res.code !== 0) {
this.$message.warning(res.msg)
return
}
this.$refs["form"].validate(async (valid) => {
if (valid) {
if (this.courseRow.courseIsLimitApply) {
const resp = await this.$axios.post('/platform/mobile/literacyActivity/validateSourceSignUp', {
activityCourseId: this.formData.activityCourseId,
courseId: this.courseRow.id
})
if (resp.code !== 0) {
this.$message.warning(res.msg)
return
}
}
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
const mobileColumnsValue = this.formData.literacyMobileSignColumnList.map((v) => {
return {
columnName: v.columnName,
columnValue: v.columnValue,
columnCode: v.columnCode,
columnFormType: v.columnFormType
}
})
this.formData.mobileColumnsValue = JSON.stringify(mobileColumnsValue)
const resp = await this.$axios.post("/platform/mobile/literacyActivity/doSignUp", this.formData)
if (resp.code === 0) {
this.signDialog = false
this.$message.success(resp.msg)
this.$emit('refresh')
} else {
this.$message.warning(resp.msg)
}
})
}
})
},
initData(row, course) {
this.formData = {
activityId: row.activityId,
courseId: row.id,
username: this.$store.state.user.username,
loginname: this.$store.state.user.loginname,
unionName: this.$store.state.user.union.name,
unitName: this.$store.state.user.unit.name,
sex: this.$store.state.user.sex,
mobile: this.$store.state.user.mobile,
literacyMobileSignColumnList: course.literacyMobileSignColumnList
}
this.formData.literacyMobileSignColumnList.forEach((item) => {
item.columnValue = ""
})
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
},
},
style: /*language=CSS*/ `
`
}
@@ -1,593 +0,0 @@
<!--#include('courseTime.js'){}#-->
<!--#include('customForm.js'){}#-->
const basicForm = {
template: /*language=HTML*/ `
<div>
<el-form :model="formData" label-width="110px" ref="form">
<div v-show="step === 1">
<el-row :gutter="20" type="flex" v-if="!formData.id">
<el-col :span="12">
<el-form-item label="沿用活动" prop="useHistory">
<el-radio-group v-model="formData.useHistory" size="small">
<el-radio :label="true" border>沿用之前活动</el-radio>
<el-radio :label="false" border>不沿用之前活动</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="formData.useHistory">
<el-form-item label="往期活动" prop="historicalAct">
<el-select v-model="formData.historicalAct" placeholder="请选择往期活动" style="width: 100%" @change="historicalActChange">
<el-option v-for="item in historicalActList" :key="item.id" :label="item.activityName" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" type="flex">
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请输入活动名称', trigger: 'blur'}" label="活动名称" prop="activityName">
<el-input maxlength="50" v-model="formData.activityName" placeholder="请输入活动名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="literacyType + '通知'" prop="notice">
<el-radio-group v-model="formData.notice" size="small">
<el-radio :label="true" border>通知</el-radio>
<el-radio :label="false" border>不通知</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" type="flex">
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请选择活动时间', trigger: 'blur'}" label="活动时间" prop="activityTime">
<el-date-picker
:picker-options="pickerOptions"
end-placeholder="请选择活动结束日期"
range-separator="至"
start-placeholder="请选择活动开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.activityTime"
value-format="yyyy-MM-dd HH:mm"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :rules="{required:true,message: '请选择报名时间', trigger: 'blur'}" label="报名时间" prop="activitySignTime">
<el-date-picker
:disabled="false"
end-placeholder="请选择报名结束日期"
range-separator="至"
start-placeholder="请选择报名开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.activitySignTime"
value-format="yyyy-MM-dd HH:mm"
></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" type="flex">
<el-col :span="12">
<el-form-item label="面向对象" prop="joinCnd">
<div style="display: flex; justify-content: space-between">
<div style="width: 99%">
<el-select
@change="changeActivity"
clearable
filterable
placeholder="请选择可报名人员范围"
style="width: 99%"
v-model="formData.activityGroupId"
>
<el-option
:key="item.groupId"
:label="item.groupName"
:value="item.groupId"
v-for="item in activityGroupList"
></el-option>
</el-select>
</div>
<div>
<el-button @click="$refs.drawerUserScope.userScopeDialog = true" type="primary">设置</el-button>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="活动类型" prop="literacyType" :rules="{required:true,message: '请选择活动类型', trigger: 'blur'}">
<el-select @change="typeChange" filterable placeholder="请选择活动类型" style="width: 100%" v-model="formData.literacyType">
<el-option :label="item.name" :value="item.code" :key="item.code" v-for="item in dict.type.LITERACY_SIGNUP_TYPE"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item :rules="{required:true,message: '请输入活动介绍', trigger: 'blur'}" label="活动介绍" prop="introduce">
<text-editor v-model="formData.introduce"></text-editor>
</el-form-item>
<el-form-item label="封面图片" prop="cover" :rules="{required:true,message: '请上传活动移动端封面图片', trigger: 'blur'}">
<el-col :span="12">
<file-upload
:upload_number="1"
:value.sync="formData.cover"
accept=".jpg,.jpeg,.png"
complete_result
upload_mode="image"
upload_result_category="interval"
></file-upload>
</el-col>
<el-col :span="12">
<el-form-item label="微信群二维码" prop="wechat">
<file-upload
:upload_number="1"
:value.sync="formData.wechat"
accept=".jpg,.jpeg,.png"
complete_result
upload_mode="image"
upload_result_category="interval"
></file-upload>
</el-form-item>
</el-col>
</el-form-item>
</div>
<div v-show="step === 2">
<div class="left-span-label" style="display: flex; justify-content: space-between; align-items: center">
<div>{{literacyType + '信息(温馨提示:如不需要人数限制,下方人数框填写0或者不填)'}}</div>
<div>
<el-button @click="addCourse" size="mini" type="primary">添加{{ literacyType }}</el-button>
</div>
</div>
<el-table :data="formData.courseList">
<el-table-column label="序号" prop="orderNum" width="100px">
<template v-slot="{row}">
<el-input-number
v-model="row.orderNum"
@change="courseOrderNumChange"
:min="1"
:max="formData.courseList.length"
:step="1"
step-strictly
:precision="0"
controls-position="right"
style="width: 76px"
size="small"
label="序号"
></el-input-number>
</template>
</el-table-column>
<el-table-column :label="literacyType + '名称'" prop="courseName">
<template v-slot="{row}">
<el-input size="small" v-model="row.courseName" :placeholder="'请输入' + literacyType + '名称'"></el-input>
</template>
</el-table-column>
<el-table-column label="类型" prop="courseType" sortable>
<template v-slot="{row}">
<el-select size="small" v-model="row.courseType" @change="(val) => {courseTypeChange(val, row)}">
<el-option :label="c.typeName" :value="c.id" :key="c.id" v-for="c in courseTypeList"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="literacyType + '人数'" prop="coursePeopleNumber" width="110px">
<template v-slot="{row}">
<el-input-number
:controls="false"
:max="9999"
size="small"
:min="0"
:precision="0"
step-strictly
style="max-width: 80px"
@change="(c, o) => validNumber(row, null)"
v-model="row.coursePeopleNumber"
placeholder="请输入人数"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="预留名额" prop="courseReservedNumber" width="110px">
<template v-slot="{row}">
<el-input-number
:controls="false"
:max="1000"
:min="0"
size="small"
:precision="0"
step-strictly
style="max-width: 80px"
@change="(c, o) => validNumber(row, o)"
v-model="row.courseReservedNumber"
placeholder="请输入预留名额"
></el-input-number>
</template>
</el-table-column>
<el-table-column label="校区" prop="campus">
<template v-slot="{row}">
<el-select size="small" v-model="row.campus" style="width: 100%">
<el-option :label="item.name" :value="item.name" :key="item.code" v-for="item in dict.type.CAMPUS"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column :label="literacyType + '地点'" prop="courseLocation">
<template v-slot="{row}">
<el-input size="small" v-model="row.courseLocation" :placeholder="'请输入' + literacyType + '地点'"></el-input>
</template>
</el-table-column>
<el-table-column :label="literacyType + '负责人'" prop="courseInstructor">
<template v-slot="{row}">
<el-input size="small" v-model="row.courseInstructor" :placeholder="'请输入' + literacyType + '负责人'"></el-input>
</template>
</el-table-column>
<el-table-column label="分类标识" prop="assort">
<template v-slot="{row}">
<el-input size="small" v-model="row.assort" placeholder="请输入分类标识"></el-input>
</template>
</el-table-column>
<el-table-column :label="literacyType + '时间'">
<template v-slot="scope">
<el-button @click="openSetUpCourseTime(scope.$index)" type="text">设置{{ literacyType }}时间</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-button @click="openMoreInfo(scope, scope.$index)" size="mini" type="primary">自定义设置</el-button>
<el-button @click="removeTableCourse(scope.$index)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="left-span-label" style="margin-top: 20px">个人报名数量限制</div>
<el-form-item label="报名数量限制" prop="cover">
<el-radio-group v-model="formData.restrictLimit" size="small">
<el-radio border :label="1">无限制</el-radio>
<el-radio border :label="2">按类型限制</el-radio>
<el-radio border :label="3">按活动限制</el-radio>
</el-radio-group>
<div calss="limit_div">
<div v-if="formData.restrictLimit === 1" style="color: #c64120; font-size: 12px">无限制指对报名的个数不做任何限制</div>
<div v-if="formData.restrictLimit === 2" style="color: #c64120; font-size: 12px">
<div>
<el-button @click="setSignUpCondition" size="mini" type="primary">设置报名限制</el-button>
<span style="color: #c64120; font-size: 12px">按类型限制指对每个类型下的个数进行限制</span>
</div>
</div>
<div v-if="formData.restrictLimit === 3">
<div>
<el-input-number v-model="formData.limitNum" :min="1" :max="100" size="mini" label="限制报名个数"></el-input-number>
<span style="color: #c64120; font-size: 12px">按活动限制指只能报{{formData.limitNum}}不与类型关联</span>
</div>
</div>
</div>
</el-form-item>
</div>
</el-form>
<div style="float: right; margin: 20px 0">
<el-button @click="$emit('back')">取消</el-button>
<el-button v-if="step === 2" type="primary" @click="step = 1">上一步</el-button>
<el-button v-if="step === 1" type="primary" @click="step = 2">下一步</el-button>
<el-button type="primary" @click="onSave">保存</el-button>
<el-button type="primary" @click="onSubmit">提交</el-button>
</div>
<el-dialog :close-on-click-modal="false" :visible.sync="signUpDialog" title="设置报名限制" append-to-body>
<el-table :data="formData.typeLimits">
<el-table-column prop="code" label="类型编码"></el-table-column>
<el-table-column prop="typeName" label="类型名称"></el-table-column>
<el-table-column label="限制个数" width="500">
<template v-slot="{row}">
<el-input-number size="small" v-model="row.limitNum" :min="0"></el-input-number>
<span style="color: #c64120; font-size: 12px">值为空或者为0则表示此类型不限制报名个数</span>
</template>
</el-table-column>
</el-table>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="signUpDialog = false">取消</el-button>
<el-button @click="doLimitNum" type="primary">确定</el-button>
</el-row>
</el-dialog>
<drawer-user-scope
@group_change="getActivityGroup"
ref="drawerUserScope"
:group_id.sync="formData.activityGroupId">
</drawer-user-scope>
<course-time ref="courseTimeRef"></course-time>
<custom-form ref="customFormRef"></custom-form>
</div>
`,
dicts: ["CAMPUS", "LITERACY_SIGNUP_TYPE"],
data() {
return {
signUpDialog: false,
step: 1,
formData: {
notice: false,
courseList: [
{ orderNum: 1, courseName: "", courseTimeList: [], isMobileSign: false, isReceiveGift: false, reserveMode: 1, courseIsLimitApply: false },
],
conditionStructure: {
method: "AND",
conditions: [{}]
},
restrictLimit: 1,
limitNum: 1,
typeLimits: []
},
historicalActList: [],
literacyTypeList: [],
literacyType: "培训班",
activityGroupList: [],
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
}
},
campusList: [],
courseTypeList: [],
}
},
components: {
"drawer-user-scope": httpVueLoader("/components/module/activity/DrawerUserScope.vue"),
"course-time": courseTime,
"custom-form": customForm,
},
methods: {
async validNumber(row, old) {
if (GetQueryString("id") === "") {
if (row.courseReservedNumber > row.coursePeopleNumber && row.reserveMode === 1) {
this.$alert("预留人数不能大于" + this.literacyType + "人数!", "提示", {
confirmButtonText: "确定"
})
row.courseReservedNumber = 0
}
} else {
const registerUserCount = await this.getRegisterUserCount(row.id)
if (row.courseReservedNumber + registerUserCount > row.coursePeopleNumber) {
if (row.reserveMode === 1) {
let num = row.coursePeopleNumber - registerUserCount
let str =
"您设置的" +
this.literacyType +
"人数为" +
row.coursePeopleNumber +
"人,当前报名人数为" +
registerUserCount +
"人,预留名额上限为" +
num +
"人!"
this.$alert(str, "提示", {
confirmButtonText: "确定"
})
row.courseReservedNumber = 0
}
}
}
},
async getRegisterUserCount(courseId) {
const resp = await this.$axios.post("/platform/literacy/manage/activity/getRegisterUserCount", { courseId })
return resp.code === 0 ? resp.data : 0
},
courseTypeChange(val, row) {
row.reserveMode = 1
},
setSignUpCondition() {
if (this.formData.courseList !== undefined && this.formData.courseList.length > 0) {
const courseValid = this.formData.courseList.some((item, index) => {
if (item.courseType === undefined) {
this.$message.warning("请在" + (index + 1) + "行" + this.literacyType + "信息中选择类型!")
return true
}
return false
})
if (courseValid) {
return
}
const array = [...new Set(this.formData.courseList.map((o) => o.courseType))]
const typeArray = clone([...this.courseTypeList].filter((x) => array.some((y) => x.id === y)))
const arr = []
typeArray.forEach((item) => {
const t = this.formData.typeLimits.find(o => o.typeId === item.id)
if (t) {
const type = this.courseTypeList.find(o => o.id === t.typeId)
t.code = type.code
t.typeName = type.typeName
arr.push(t)
} else {
arr.push({
code: item.code,
typeName: item.typeName,
typeId: item.id,
limitNum: 0
})
}
})
this.formData.typeLimits = arr
this.signUpDialog = true
} else {
this.$message.warning("请在" + this.literacyType + "信息中选择类型!")
}
},
doLimitNum() {
this.signUpDialog = false
},
openMoreInfo(row, index) {
this.$refs.customFormRef.onOpen(this.formData, row, index)
},
async removeTableCourse(index) {
const confirm = await this.$confirm(
"请确认是否删除此" + this.literacyType + "?如果该" + this.literacyType + "已有报名人员,会随之一起删除!确定吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
if (confirm) {
this.formData.courseList.splice(index, 1)
}
},
openSetUpCourseTime(index) {
this.$refs.courseTimeRef.onOpen(this.formData, index)
},
courseOrderNumChange() {
this.formData.courseList = this.formData.courseList.sort((a, b) => a.orderNum - b.orderNum)
},
addCourse() {
this.formData.courseList.push({ courseTimeList: [], isMobileSign: false, isReceiveGift: false, reserveMode: 1, courseIsLimitApply: false })
},
async historicalActChange(val) {
const resp = await this.$axios.post("/platform/literacy/manage/activity/findOne", {id: val})
if (resp.code === 0) {
this.formData = resp.data
this.typeChange(this.formData.literacyType)
this.formData.id = ""
}
},
typeChange(val) {
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find(o => o.code === val)
this.literacyType = type?.name || "培训班"
},
changeActivity(val) {
if (val) {
const group = this.activityGroupList.find(v => v.groupId === val)
this.$set(this.formData, "activityGroupName", group.groupName)
} else {
this.$set(this.formData, "activityGroupName", "全部教职工")
}
},
async getActivityGroup() {
const { data } = await this.$axios.post("/platform/activity/basic/scope/getActivityUserScopeGroup")
return data
},
async getHistoricalActList() {
const resp = await this.$axios.post("/platform/literacy/manage/activity/getHistoricalActList", {})
return resp.data
},
async onSave() {
let valid = false
this.$refs.form.validateField("activityName", (errMsg) => {
valid = errMsg === ""
})
if (!valid) {
this.$message.warning("请输入活动名称")
return
}
await this.doHandle('保存')
},
onSubmit() {
this.$refs["form"].validate(async (valid, errMsg) => {
if (valid) {
const courseValid = this.formData.courseList.some((v, i) => {
const basicValid = v.courseName && v.coursePeopleNumber && v.courseLocation && v.courseInstructor && v.courseType
const timeValid =
v.courseTimeList.length > 0 &&
v.courseTimeList.every((x) => {
return x.courseStartTime && x.courseEndTime && x.courseStartTime < x.courseEndTime
})
if (!timeValid) {
this.$message.warning("第" + (i + 1) + "行时间填写有误,请核查")
return true
}
if (!basicValid) {
this.$message.warning("第" + (i + 1) + "行信息填写有误,请核查")
return true
}
if (v.isMobileSign === true && v.signType === 3 && (v.courseLocationCoordinates === undefined || v.courseLocationCoordinates.length < 2)) {
this.$message.warning("第" + (i + 1) + "行地点坐标填写有误,请核查")
return true
}
if (v.isMobileSign === true && v.signType === 3 && (v.signType === "" || v.signType === undefined)) {
this.$message.warning("第" + (i + 1) + "行签到方式填写有误,请核查")
return true
}
return false
})
if (courseValid) return
if (this.formData.restrictLimit === 2 && this.formData.typeLimits.length === 0) {
this.$message.warning("请设置报名限制")
return
}
this.formData.isDisabled = false
await this.doHandle('提交')
} else {
if(Object.keys(errMsg).length > 0) {
this.$message.warning(errMsg[Object.keys(errMsg)[0]][0].message)
return
}
this.$message.warning("存在必填项未填写")
}
})
},
async doHandle(type) {
const cloneData = clone(this.formData)
cloneData.activitySignUpStartTime = cloneData.activitySignTime !== undefined ? cloneData.activitySignTime[0] : null
cloneData.activitySignUpEndTime = cloneData.activitySignTime !== undefined ? cloneData.activitySignTime[1] : null
cloneData.activityStartTime = cloneData.activityTime !== undefined ? cloneData.activityTime[0] : null
cloneData.activityEndTime = cloneData.activityTime !== undefined ? cloneData.activityTime[1] : null
if (cloneData.activityStartTime !== undefined && cloneData.activityStartTime !== null) {
cloneData.year = new Date(cloneData.activityStartTime).getFullYear()
}
cloneData.typeLimits = JSON.stringify(this.formData.typeLimits)
cloneData.courseList = JSON.stringify(cloneData.courseList)
const confirm = await this.$confirm("您确定要" + type + "吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
if (confirm !== "confirm") return
const resp = await this.$axios.post("/platform/literacy/manage/activity/doHandle", cloneData)
if (resp.code === 0) {
this.$message.success(resp.msg)
this.step = 1
this.$emit('refresh')
this.$emit('back')
} else {
this.$message.warning(resp.msg)
}
},
async getAllType() {
const resp = await this.$axios.post("/platform/literacy/manage/type/getAllType", {})
return resp.data
},
async init(row) {
if (row && row.id) {
const resp = await this.$axios.post("/platform/literacy/manage/activity/findOne", {id: row.id})
if (resp.code === 0) {
this.formData = resp.data
this.typeChange(this.formData.literacyType)
}
}
},
async initData(row) {
this.activityGroupList = await this.getActivityGroup()
this.historicalActList = await this.getHistoricalActList()
this.courseTypeList = await this.getAllType()
await this.init(row)
},
},
watch: {
'formData.restrictLimit'(val) {
if (!this.formData.id) {
this.formData.limitNum = val === 3 ? 1 : ''
}
},
'formData.activityGroupId': {
async handler(newVal, oldVal) {
this.activityGroupList = await this.getActivityGroup()
this.userScopeDialog = false
},
deep: true
},
},
style: /*language=CSS*/ `
`
}
@@ -1,215 +0,0 @@
const courseTime = {
template: /*language=HTML*/ `
<div>
<el-dialog :close-on-click-modal="false" :visible.sync="setUpCourseDialog" title="设置时间" width="60%" append-to-body>
<div style="color: red; margin-bottom: 10px">温馨提示有人员报名后禁止修改下列时间如有修改请联系管理员</div>
<div class="left-span-label">选择日期</div>
<el-date-picker
v-if="formData.courseList && formData.courseList[courseIndex]"
:picker-options="setUpCoursePickerOptions"
@change="setUpCourseDataChange"
placeholder="选择一个或多个日期"
style="width: 100%"
type="dates"
v-model="formData.courseList[courseIndex].setUpCourseData"
value-format="yyyy-MM-dd"
></el-date-picker>
<div class="left-span-label">设置时间</div>
<el-row style="margin-bottom: 10px">
<el-time-select
:picker-options="{
start: '08:30',
step: '00:05',
end: '23:30'
}"
placeholder="开始时间"
size="mini"
v-model="courseTimeOneKeySet.startTime"
></el-time-select>
<el-time-select
:picker-options="{
start: '08:30',
step: '00:05',
end: '23:30'
}"
placeholder="结束时间"
size="mini"
v-model="courseTimeOneKeySet.endTime"
></el-time-select>
<el-button @click="oneKeySetStartEndTime" size="mini" type="primary">一键设置开始/结束时间</el-button>
<span style="color: #ac3111">报名人数是否限制</span>
<el-radio-group size="mini" v-model="formData.courseList[courseIndex].courseIsLimitApply">
<el-radio-button :label="true"></el-radio-button>
<el-radio-button :label="false"></el-radio-button>
</el-radio-group>
</el-row>
<el-table v-if="formData.courseList && formData.courseList[courseIndex]"
:data="formData.courseList[courseIndex].courseTimeList">
<el-table-column label="日期">
<template v-slot="{row}">
<i class="el-icon-time"></i>
{{$moment(row.courseDate).format('YYYY-MM-DD')}}
</template>
</el-table-column>
<el-table-column label="开始时间">
<template v-slot="{row}">
<el-time-select
:picker-options="{
start: '08:30',
step: '00:05',
end: '23:30'
}"
placeholder="开始时间"
style="width: 100%"
v-model="row.courseStartTime"
></el-time-select>
</template>
</el-table-column>
<el-table-column label="结束时间">
<template v-slot="{row}">
<el-time-select
:picker-options="{
start: '08:30',
step: '00:05',
end: '23:30'
}"
placeholder="结束时间"
style="width: 100%"
v-model="row.courseEndTime"
></el-time-select>
</template>
</el-table-column>
<template v-if="formData.courseList[courseIndex].courseIsLimitApply">
<el-table-column label="人数限制">
<template v-slot="{row}">
<el-input-number v-model="row.courseLimitNum" :min="1" :max="1000"
style="width: 100%"
placeholder="限制报名个数"></el-input-number>
</template>
</el-table-column>
</template>
<el-table-column label="操作" width="200">
<template v-slot="{row,$index}">
<el-button
@click="formData.courseList[courseIndex].courseTimeList.splice($index,0,{courseDate:row.courseDate,courseStartTime:'',courseEndTime:''})"
size="small"
>
新增同天时段
</el-button>
<el-button @click="removeSetUpTableCourseRow(row,$index)" size="small" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="mt20" justify="end" type="flex">
<el-button @click="doConfirmSetUpCourse" type="primary">确定</el-button>
</el-row>
</el-dialog>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
const that = this
return {
setUpCourseDialog: false,
courseIndex: 0,
formData: {},
courseTimeOneKeySet: {
startTime: "",
endTime: ""
},
setUpCoursePickerOptions: {
disabledDate(time) {
return (
time.getTime() < Date.parse(that.$moment(that.formData.activityTime[0]).format("YYYY-MM-DD") + " 00:00:00") ||
time.getTime() > Date.parse(that.$moment(that.formData.activityTime[1]).format("YYYY-MM-DD") + " 00:00:00")
)
}
},
}
},
methods: {
removeSetUpTableCourseRow(row, index) {
this.formData.courseList[this.courseIndex].courseTimeList.splice(index, 1)
//培训时间列表日期数组
const courseDateArray = this.formData.courseList[this.courseIndex].courseTimeList.map((v) =>
this.$moment(v.courseDate).format("YYYY-MM-DD")
)
//选择课程日期数组
const scdList = this.formData.courseList[this.courseIndex].setUpCourseData
this.formData.courseList[this.courseIndex].setUpCourseData = scdList.filter((v) => {
return courseDateArray.includes(this.$moment(v).format("YYYY-MM-DD"))
})
},
oneKeySetStartEndTime() {
const { startTime, endTime } = this.courseTimeOneKeySet
this.formData.courseList[this.courseIndex].courseTimeList.forEach((v) => {
this.$set(v, "courseStartTime", startTime)
this.$set(v, "courseEndTime", endTime)
})
this.$forceUpdate()
},
setUpCourseDataChange(val) {
if (!val) {
this.formData.courseList[this.courseIndex].courseTimeList = []
return
}
//培训时间日期Set
if (this.formData.courseList[this.courseIndex].courseTimeList === undefined) {
this.$set(this.formData.courseList[this.courseIndex], "courseTimeList", [])
}
const ctList = new Set(
this.formData.courseList[this.courseIndex].courseTimeList.map((v) => this.$moment(v.courseDate).format("YYYY-MM-DD"))
)
val.forEach((v) => {
if (!ctList.has(v)) {
this.formData.courseList[this.courseIndex].courseTimeList.push({
courseDate: v,
courseTime: null
})
}
})
this.formData.courseList[this.courseIndex].courseTimeList = this.formData.courseList[this.courseIndex].courseTimeList.filter((v) => {
return val.includes(this.$moment(v.courseDate).format("YYYY-MM-DD"))
})
this.formData.courseList[this.courseIndex].courseTimeList.sort((a, b) => {
return Date.parse(a["courseDate"]) - Date.parse(b["courseDate"])
})
},
//设置课程时间确定
doConfirmSetUpCourse() {
const courseTableData = this.formData.courseList[this.courseIndex].courseTimeList
if (courseTableData.length === 0) {
this.$message.warning("请填写时间!")
return
}
if (courseTableData && courseTableData.length > 0) {
const valid = courseTableData.every((v) => v.courseStartTime && v.courseEndTime && v.courseStartTime < v.courseEndTime)
if (!valid) {
this.$message.warning("时间填写不完整或者有误!")
return
}
this.setUpCourseDialog = false
}
},
onOpen(formData, index) {
this.formData = formData
this.courseIndex = index
if (!this.formData.activityTime || this.formData.activityTime.length === 0) {
this.$message.warning("请先设置活动起止时间")
return
}
this.courseIndex = index
this.setUpCourseDialog = true
},
},
created() {
if(!this.formData.courseList) {
this.formData = {courseList: [{unionLimit: []}]}
}
},
style: /*language=CSS*/ `
`
}
@@ -1,211 +0,0 @@
<!--#include('unionForm.js'){}#-->
const customForm = {
template: /*language=HTML*/ `
<div>
<el-drawer title="自定义设置" size="50%" class="my-drawer" :visible.sync="moreInfoDrawer" append-to-body>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>分工会人数限制</span>
</el-col>
<el-col :span="20">
<el-button @click="openSetUpUnionLimit(moreInfoIndex)" type="primary" size="small">
设置分工会人数限制
</el-button>
<span
v-if="formData.courseList[moreInfoIndex].unionLimit && formData.courseList[moreInfoIndex].unionLimit.length > 0"
class="text-success"
>
已设置
</span>
<span v-else class="text-danger">未设置</span>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>承办工会</span>
</el-col>
<el-col :span="20">
<el-select v-model="formData.courseList[moreInfoIndex].hostUnionId" placeholder="请选择承办工会"
style="width: 100%" clearable>
<el-option :label="item.name" :value="item.id" :key="item.id"
v-for="item in unionList"></el-option>
</el-select>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>对内报名时间</span>
</el-col>
<el-col :span="20">
<el-date-picker
placeholder="请选择对内报名时间"
style="width: 100%"
type="datetime"
v-model="formData.courseList[moreInfoIndex].interTime"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
></el-date-picker>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否签到</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].isMobileSign" size="small">
<el-radio border :label="true">签到</el-radio>
<el-radio border :label="false">不签到</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row v-if="formData.courseList[moreInfoIndex].isMobileSign === true" :gutter="50" type="flex">
<el-col :span="4">
<span>签到方式</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].signType" size="small">
<el-radio border :label="1">扫描二维码</el-radio>
<el-radio border :label="2">被扫</el-radio>
<el-radio border :label="3">GPS定位签到</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row
v-if="formData.courseList[moreInfoIndex].isMobileSign === true
&& formData.courseList[moreInfoIndex].signType == 3"
:gutter="50"
type="flex"
>
<el-col :span="4">
<span>地点坐标</span>
</el-col>
<el-col :span="20">
<el-button @click="openMap(moreInfoIndex)" type="primary" size="small">设置签到点</el-button>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>是否领取礼品</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].isReceiveGift" size="small">
<el-radio border :label="true">领取</el-radio>
<el-radio border :label="false">不领取</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row v-if="formData.courseList[moreInfoIndex].isReceiveGift === true" :gutter="50" type="flex">
<el-col :span="4">
<span>领取方式</span>
</el-col>
<el-col :span="20">
<el-radio-group v-model="formData.courseList[moreInfoIndex].giftType" size="small">
<el-radio border :label="1">扫描二维码</el-radio>
<el-radio border :label="2">面对面确认</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row :gutter="50" type="flex">
<el-col :span="4">
<span>报名方式</span>
</el-col>
<el-col :span="20">
<el-radio-group
v-model="formData.courseList[moreInfoIndex].reserveMode"
size="small"
>
<el-radio border :label="1">报名人员减少模式</el-radio>
<el-radio border :label="2">候补模式</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row :gutter="50" type="flex" v-if="formData.courseList[moreInfoIndex].reserveMode === 2">
<el-col :span="4">
<span>候补数量</span>
</el-col>
<el-col :span="20">
<el-input-number :controls="false" size="small" style="width: 100%"
:max="100"
:min="0"
:precision="0"
step-strictly
v-model="formData.courseList[moreInfoIndex].waitingNum"></el-input-number>
</el-col>
</el-row>
<div style="text-align: right">
<el-button @click="moreInfoDrawer = false"> </el-button>
<el-button type="primary" @click="moreInfoDrawer = false"> </el-button>
</div>
</el-drawer>
<el-dialog :close-on-click-modal="false" :visible.sync="mapDialog" title="位置信息" :append-to-body="true">
<map-container v-if="mapDialog" :position.sync="formData.courseList[mapIndex].courseLocationCoordinates"></map-container>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="mapDialog = false"> </el-button>
</span>
</el-dialog>
<union-form ref="unionFormRef"></union-form>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
moreInfoDrawer: false,
unionList: [],
formData: {},
moreInfoRow: {},
moreInfoIndex: 0,
mapDialog: false,
mapIndex: 0,
}
},
components: {
"union-form": unionForm,
"map-container": httpVueLoader("/components/plugins/mapContainer/MapContainer.vue?v=1.0.1")
},
methods: {
openMap(index) {
this.mapIndex = index
this.mapDialog = true
},
openSetUpUnionLimit(index) {
this.$refs.unionFormRef.onOpen(this.formData, index)
},
async onOpen(formData, chooseRow, index) {
this.formData = formData
this.moreInfoRow = chooseRow
this.moreInfoIndex = index
this.unionList = await this.$businessTool.listUnion()
this.moreInfoDrawer = true
},
},
created() {
if(!this.formData.courseList) {
this.formData = {courseList: [{unionLimit: []}]}
}
},
style: /*language=CSS*/ `
.my-drawer .el-col-4 {
text-align: right;
}
.my-drawer .el-row {
margin-bottom: 20px;
}
.el-drawer__body {
padding: 20px;
}
.el-row--flex {
align-items: center;
}
`
}
@@ -1,201 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
@change="doSearch"
placeholder="请选择年度"
type="year"
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</search-item>
<search-item label="活动名称:">
<el-input
@keyup.enter.native="doSearch"
clearable
placeholder="请输入活动名称"
clearable
style="width: 100%"
v-model="pageForm.activityName"
></el-input>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="活动列表">
<el-button @click="openAdd" size="small" type="primary">
<i class="ti-plus"></i>新建活动
</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:width="column.width"
:sortable="column.sortable"
show-overflow-tooltip
v-for="(column, index) in tableColumns"
:key="index"
>
<template v-slot="{ row }" v-if="column.prop === 'isDisabled'">
<el-switch
:active-value="false"
:inactive-value="true"
@change="(val) => { activityStatusChange(row.notice, val,row.id) }"
active-color="#13ce66"
inactive-color="#ff4949"
v-model="row.isDisabled"
></el-switch>
</template>
<template v-slot="{ row: { createdAt } }" v-else-if="column.prop === 'createdAt'">
{{ $moment(createdAt).format('YYYY-MM-DD HH:mm:ss') }}
</template>
<template v-slot="{ row }" v-else-if="column.prop === 'activityTime'">
<span>{{ $moment(row.activityStartTime).format('YYYY/MM/DD') }}</span>
<span></span>
<span>{{ $moment(row.activityEndTime).format('YYYY/MM/DD') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px">
<template v-slot="{ row }">
<el-dropdown>
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="openActivityCode(row.id)">活动二维码</el-dropdown-item>
<el-dropdown-item @click.native="makeCode(row)">签到二维码</el-dropdown-item>
<el-dropdown-item @click.native="onView(row)">查看</el-dropdown-item>
<el-dropdown-item @click.native="openEdit(row)">编辑</el-dropdown-item>
<el-dropdown-item @click.native="onDelete(row)">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #edit>
<basic-form ref="formRef" @back="back" @refresh="doSearch"></basic-form>
</template>
<template #view>
<info ref="infoRef"></info>
</template>
<make-qrcode ref="codeRef"></make-qrcode>
<el-dialog
title="活动二维码"
:visible.sync="codeDialogVisible"
:close-on-click-modal="false"
width="30%">
<div style=" display: flex;justify-content: center;">
<qrcode :options="{ width: 400 }" :value="activityUrl" ></qrcode>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="codeDialogVisible = false" type="primary">关 闭</el-button>
</span>
</el-dialog>
</guava>
</div>
<script>
<!--#include('info.js'){}#-->
<!--#include('basicForm.js'){}#-->
<!--#include('makeQrcode.js'){}#-->
new Vue({
el: "#app",
store,
dicts: ["CAMPUS", "LITERACY_SIGNUP_TYPE"],
mixins: [initTableMixins],
components: {
"info": info,
"basic-form": basicForm,
"make-qrcode": makeQrcode,
},
data() {
return {
pageForm: {
year: new Date().getFullYear() + ''
},
tableColumns: [
{ label: "活动名称", prop: "activityName", width: 600 },
{ label: "活动时间", prop: "activityTime" },
{ label: "是否开启", prop: "isDisabled", width: 100 },
{ label: "创建时间", prop: "createdAt" }
],
codeDialogVisible: false,
activityUrl: '',
}
},
methods: {
back() {
this.$refs.guava.index()
},
openAdd() {
this.$refs.guava.edit(() => {
this.$refs.formRef.initData()
})
},
openEdit(row) {
this.$refs.guava.edit(() => {
this.$refs.formRef.initData(row)
})
},
onView(row) {
this.$refs.guava.view(() => {
this.$refs.infoRef.initData(row.id)
})
},
openActivityCode(id) {
this.activityUrl = location.origin + "/platform/mobile/literacyActivity/activityInfo?activityId="
+ id + '&isMySign=0'
this.codeDialogVisible = true
},
makeCode(row) {
this.$refs.codeRef.initData(row)
},
async activityStatusChange(notice, val, id) {
const resp = await this.$axios.post(loc() + "/activityStatusChange", { notice: notice, isDisabled: val, id })
if (resp.code === 0) {
this.$message.success(resp.msg)
} else {
this.$message.warning(resp.msg)
}
},
async onDelete(row) {
this.$confirm("此操作将永久删除, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(async () => {
const resp = await this.$axios.post(loc() + "/onDelete", { id: row.id })
this.$message.success(resp.msg)
this.doSearch()
}).catch(() => {})
},
},
async created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -1,111 +0,0 @@
const info = {
template: /*language=HTML*/ `
<div>
<el-tabs>
<el-tab-pane label="基础信息">
<el-descriptions :column="2" border class="table_fixed mt20">
<el-descriptions-item :span="2" label="活动名称">{{viewData.activityName}}</el-descriptions-item>
<el-descriptions-item label="年度">{{viewData.year}}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{$moment(viewData.createdAt).format('YYYY-MM-DD HH:mm:ss')}}</el-descriptions-item>
<el-descriptions-item label="活动开始时间">{{viewData.activityStartTime}}</el-descriptions-item>
<el-descriptions-item label="活动结束时间">{{viewData.activityEndTime}}</el-descriptions-item>
<el-descriptions-item label="报名开始时间">{{viewData.activitySignUpStartTime}}</el-descriptions-item>
<el-descriptions-item label="报名结束时间">{{viewData.activitySignUpEndTime}}</el-descriptions-item>
</el-descriptions>
</el-tab-pane>
<el-tab-pane :label="literacyType + '信息'">
<el-table :data="viewData.courseList" class="mt20">
<el-table-column :label="literacyType + '名称'" prop="courseName"></el-table-column>
<el-table-column label="类型" prop="courseTypeName"></el-table-column>
<el-table-column label="人数" prop="coursePeopleNumber"></el-table-column>
<el-table-column label="预留名额" prop="courseReservedNumber"></el-table-column>
<el-table-column label="地点" prop="courseLocation">
<template v-slot="{row}">
<el-button @click="openViewMap(row.courseLocationCoordinates)" type="text">{{row.courseLocation}}</el-button>
</template>
</el-table-column>
<el-table-column label="校区" prop="campus"></el-table-column>
<el-table-column label="负责人" prop="courseInstructor"></el-table-column>
<el-table-column label="上课时间" prop="courseTimeList" width="200px">
<template v-slot="{ row }">
<el-button @click="openViewCourseTime(row.courseTimeList)" type="text">点击查看课程时间</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-dialog :visible.sync="courseTimeListDialog" :title="literacyType + '时间'" width="60%" append-to-body>
<el-table :data="courseTimeList">
<el-table-column label="日期" prop="courseDate">
<template v-slot="{row}">{{$moment(row.courseDate).format('YYYY-MM-DD')}}</template>
</el-table-column>
<el-table-column label="开始时间" prop="courseStartTime"></el-table-column>
<el-table-column label="结束时间" prop="courseEndTime"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="courseTimeListDialog = false" type="primary"> </el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="viewMapDialog" title="地点" width="60%">
<div id="viewMap" style="width: 100%; height: 500px"></div>
</el-dialog>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
literacyType: '',
viewData: {},
courseTimeListDialog: false,
courseTimeList: [],
viewMapDialog: false,
}
},
methods: {
initData(id) {
this.$axios.post(loc() + "/findOne", { id: id })
.then((resp) => {
if (resp.code === 0) {
this.viewData = resp.data
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find((o) => o.code === resp.data.literacyType)
this.literacyType = type?.name || "培训班"
}
})
},
openViewCourseTime(courseTimeList) {
this.courseTimeList = courseTimeList
this.courseTimeListDialog = true
},
openViewMap(point) {
if (!Array.isArray(point)) {
this.$message.warning("没有设置点位,无法通过地图查看")
return
}
this.viewMapDialog = true
this.$nextTick(() => {
viewMap = new AMap.Map("viewMap", {
resizeEnable: true,
center: point,
zoom: 16
})
if (viewMarker) {
viewMap.remove(viewMarker)
}
viewMarker = new AMap.Marker({
position: point,
offset: new AMap.Pixel(-13, -30)
})
viewMap.add(viewMarker)
viewMap.setFitView(null, false, [150, 60, 100, 60])
})
},
},
style: /*language=CSS*/ `
.el-button--text {
padding: 0;
}
`
}
@@ -1,82 +0,0 @@
const makeQrcode = {
template: /*language=HTML*/ `
<div>
<el-dialog :close-on-click-modal="false" :visible.sync="courseDialog"
append-to-body :title="literacyType + '列表'" width="60%">
<el-table :data="courseList">
<el-table-column :label="literacyType + '名称'" prop="courseName"></el-table-column>
<el-table-column label="校区" prop="campus"></el-table-column>
<el-table-column label="是否签到" prop="isMobileSign">
<template v-slot="{row}">
<span v-if="row.isMobileSign === true">签到</span>
<span v-else>不签到</span>
</template>
</el-table-column>
<el-table-column label="签到方式" prop="signType">
<template v-slot="{row}">
<span v-if="row.signType === 1">扫描二维码</span>
<span v-else-if="row.signType === 2">被扫</span>
<span v-else-if="row.signType === 3">GPS定位签到</span>
<span v-else>暂无签到方式</span>
</template>
</el-table-column>
<el-table-column label="是否领取礼品" prop="isReceiveGift">
<template v-slot="{row}">
<span v-if="row.isReceiveGift === true">领取</span>
<span v-else>不领取</span>
</template>
</el-table-column>
<el-table-column label="领取方式" prop="giftType">
<template v-slot="{row}">
<span v-if="row.giftType === 1">扫描二维码</span>
<span v-else-if="row.giftType === 2">面对面确认</span>
<span v-else>暂无领取方式</span>
</template>
</el-table-column>
<el-table-column label="操作" width="260">
<template v-slot="{row}">
<el-button v-if="row.signType === 1"
@click="makeCourseCode(row)"
size="mini" type="primary">
生成二维码
</el-button>
<el-button v-else size="mini" type="text">{{literacyType}}的签到方式不支持生成二维码</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="courseDialog = false" type="primary"> </el-button>
</span>
</el-dialog>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
courseDialog: false,
literacyType: "",
courseList: [],
}
},
methods: {
initData(row) {
this.courseList = row.courseList
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find((o) => o.code === row.literacyType)
this.literacyType = type?.name || "培训班"
this.courseDialog = true
},
makeCourseCode(row) {
const o = {courseId: row.id}
const content = jrQrcode.getQrBase64(JSON.stringify(o))
let image = new Image()
image.src = content
let viewer = new Viewer(image, {
zIndex: 99999999,
})
viewer.show()
},
},
style: /*language=CSS*/ `
`
}
@@ -1,221 +0,0 @@
const unionForm = {
template: /*language=HTML*/ `
<div>
<el-dialog :close-on-click-modal="false" :visible.sync="setUpUnionLimitDialog" title="分工会人数限制" top="50px" append-to-body>
<div class="left-span-label" style="display: flex; justify-content: space-between; align-items: center">
<div>分段设置</div>
<div>
<el-button size="small" type="primary" @click="unionLimitQuickSetting">应用分段设置</el-button>
</div>
</div>
<el-row v-for="(item,index) in unionUserNumCalc" :key="index" :gutter="20" class="mb5">
<el-col :span="7">
<el-input-number
v-model="item.startNum"
:precision="0"
:step="1"
:min="1"
placeholder="请输入最小人数"
style="width: 100%"
></el-input-number>
</el-col>
<el-col :span="7">
<el-input-number
v-model="item.endNum"
:precision="0"
:step="1"
:min="1"
placeholder="请输入最大人数"
style="width: 100%"
></el-input-number>
</el-col>
<el-col :span="6">
<el-input-number
v-model="item.resultNum"
:precision="0"
:step="1"
:min="1"
placeholder="请输入限制人数"
style="width: 100%"
></el-input-number>
</el-col>
<el-col :span="4" class="text-right">
<el-button icon="el-icon-plus" @click="unionUserNumCalc.push({})"></el-button>
<el-button icon="el-icon-minus" @click="unionUserNumCalc.splice(index,1)" :disabled="unionUserNumCalc.length===1"></el-button>
</el-col>
</el-row>
<el-row class="mt10">
<div v-for="(item,index) in unionUserNumCalcTips" class="text-danger">
<span class="mr10">({{index+1}}).</span>
{{item}}
</div>
</el-row>
<div class="left-span-label" style="display: flex; justify-content: space-between; align-items: center">
<div>比例设置</div>
<div>
一键比例
<el-input-number
v-model="unionUserNumOneKeyRatio"
:precision="0"
:step="1"
:min="0"
placeholder="请输入一键比例"
size="small"
:max="100"
></el-input-number>
<el-button size="small" type="primary" @click="applyScaleSettings" class="ml5">应用比例设置</el-button>
</div>
</div>
<el-table :data="formData.courseList[unionLimitIndex].unionLimit" max-height="500px">
<el-table-column prop="name" label="分工会"></el-table-column>
<el-table-column prop="teacherCount" label="人数"></el-table-column>
<el-table-column prop="ratio" label="比例(%)">
<template v-slot="{row}">
<el-input-number v-model="row.ratio" :precision="0" :step="1" :min="0" :max="100"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="limitCount" label="限制人数">
<template v-slot="{row}">
<el-input-number
v-model="row.limitCount"
:precision="0"
:step="1"
:min="0"
:max="row.teacherCount"
@change="calSummaryCount"
></el-input-number>
</template>
</el-table-column>
</el-table>
<el-row class="mt20" justify="end" type="flex">
<div class="text-danger" style="width: 100%; font-size: 18px; display: flex; align-items: center; font-weight: bold">
限制总人数{{summaryCount}}
</div>
<el-button @click="clearUnionLimit" type="danger">清空分工会人数限制</el-button>
<el-button @click="setUpUnionLimitDialog=false">取消</el-button>
<el-button @click="doConfirmSetUpUnionLimit" type="primary">确定</el-button>
</el-row>
</el-dialog>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
formData: {},
unionLimitIndex: 0,
setUpUnionLimitDialog: false,
unionList: [],
unionUserNumCalc: [{}],
unionUserNumOneKeyRatio: null,
summaryCount: 0,
}
},
computed: {
unionUserNumCalcTips() {
return this.unionUserNumCalc.map((v) => {
return (
(v.startNum ? v.startNum : "?") +
"-" +
(v.endNum ? v.endNum : "?") +
"人的分工会,限报" +
(v.resultNum ? v.resultNum : "?") +
"人"
)
})
}
},
methods: {
calSummaryCount() {
const array = this.formData.courseList[this.unionLimitIndex].unionLimit
if (array) {
this.summaryCount = array.reduce((prev, curr) => {
const value = Number(curr.limitCount)
if (!isNaN(value)) {
return prev + curr.limitCount
} else {
return prev
}
}, 0)
}
},
async onOpen(formData, index) {
this.unionList = await this.$businessTool.listUnion()
this.formData = formData
this.unionLimitIndex = index
this.setUpUnionLimitDialog = true
if (
!this.formData.courseList[this.unionLimitIndex].unionLimit ||
this.formData.courseList[this.unionLimitIndex].unionLimit.length === 0
) {
const resp = await this.$axios.get("/platform/literacy/manage/activity/getUnionLimit", {
activityScopeId: this.formData.activityGroupId
})
if (resp.code === 0) {
this.$set(this.formData.courseList[this.unionLimitIndex], "unionLimit", resp.data)
}
}
this.summaryCount = this.formData.courseList[this.unionLimitIndex].unionLimit.reduce((prev, curr) => {
const value = Number(curr.limitCount)
if (!isNaN(value)) {
return prev + curr.limitCount
} else {
return prev
}
}, 0)
},
unionLimitQuickSetting() {
this.unionUserNumCalc.forEach((v, i) => {
const startNum = v.startNum
const endNum = v.endNum
const resultNum = v.resultNum
if (startNum > endNum) {
this.$message.warning("第" + (i + 1) + "行设置错误")
} else {
this.formData.courseList[this.unionLimitIndex].unionLimit.forEach((x) => {
if (x.teacherCount >= startNum && x.teacherCount <= endNum) {
x.limitCount = resultNum
}
})
this.calSummaryCount()
}
})
},
doConfirmSetUpUnionLimit() {
this.setUpUnionLimitDialog = false
},
//应用比例设置
applyScaleSettings() {
this.formData.courseList[this.unionLimitIndex].unionLimit.forEach((v) => {
v.limitCount = parseFloat(((v.teacherCount * this.unionUserNumOneKeyRatio) / 100).toFixed(0))
if (v.ratio) {
v.limitCount = parseFloat(((v.teacherCount * v.ratio) / 100).toFixed(0))
}
})
this.calSummaryCount()
},
async clearUnionLimit() {
const confirm = await this.$confirm("确定要清空分工会人数限制吗, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
if ("confirm" === confirm) {
this.formData.courseList[this.unionLimitIndex].unionLimit = []
this.unionUserNumOneKeyRatio = null
this.unionUserNumCalc = [{}]
this.setUpUnionLimitDialog = false
}
},
},
created() {
if(!this.formData.courseList) {
this.formData = {courseList: [{unionLimit: []}]}
}
},
style: /*language=CSS*/ `
`
}
@@ -1,156 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-icon-arrow-left,
.el-icon-arrow-right {
font-size: 28px;
font-weight: bolder;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
placeholder="请选择年度"
type="year"
style="width: 100%"
@change="yearChange"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</search-item>
<search-item label="活动名称:">
<el-select @change="activityChange" style="width: 100%" v-model="pageForm.activityId">
<el-option :label="item.activityName" :value="item.id" v-for="item in activityList" :key="item.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :label="literacyType">
<el-button type="primary" size="small" @click="exportSignUser" :disabled="!pageForm.activityId">导出报名人员</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="literacyType" prop="courseName" show-overflow-tooltip></el-table-column>
<el-table-column label="类型" prop="courseType" sortable show-overflow-tooltip></el-table-column>
<el-table-column :label="literacyType + '地点'" prop="courseLocation" sortable show-overflow-tooltip></el-table-column>
<el-table-column label="负责人" prop="courseInstructor" sortable show-overflow-tooltip></el-table-column>
<el-table-column label="最多报名人数" prop="coursePeopleNumber" sortable align="center" header-align="center" show-overflow-tooltip>
<template v-slot="{row}">
<span v-if="row.reserveMode === 1">
{{row.coursePeopleNumber}}
</span>
<span v-if="row.reserveMode === 2">
{{(row.coursePeopleNumber + row.waitingNum) + '(候补占' + row.waitingNum + ''}}
</span>
</template>
</el-table-column>
<el-table-column label="预留人数" prop="courseReservedNumber" sortable show-overflow-tooltip></el-table-column>
<el-table-column label="已报名人数" prop="registerNum" sortable show-overflow-tooltip>
<template v-slot="{row}">
<el-link @click="openView(row)" type="primary">
{{row.registerNum}}
</el-link>
</template>
</el-table-column>
<el-table-column label="操作" width="200px">
<template v-slot="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button @click="openSign(row)" size="mini" v-if="row.interTime" :type="row.openOtherUnion === true ? 'danger' : 'primary'">
{{row.openOtherUnion === true ? '关闭报名' : '开放报名'}}
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<info ref="infoRef"></info>
</template>
</guava>
</div>
<script>
<!--#include('info.js'){}#-->
new Vue({
el: "#app",
dicts: ["LITERACY_SIGNUP_TYPE"],
mixins: [initTableMixins],
components: {
"info": info,
},
data() {
return {
activityList: [],
pageForm: {
year: new Date().getFullYear().toString(),
activityId: null
},
tableColumns: [
{ label: "培训班", prop: "courseName" },
{ label: "类型", prop: "courseType", sortable: true },
{ label: "地点", prop: "courseLocation" },
{ label: "教师", prop: "courseInstructor", sortable: true },
{ label: "最多报名人数", prop: "coursePeopleNumber", sortable: true },
{ label: "已报名人数", prop: "registerNum", sortable: true }
],
literacyType: "培训班",
}
},
methods: {
async openSign(row) {
const resp = await this.$axios.post(loc() + "/signChange", { courseId: row.id, openOtherUnion: !row.openOtherUnion })
if (resp.code === 0) {
this.$message.success(resp.msg)
this.doSearch()
} else {
this.$message.warning(resp.msg)
}
},
activityChange(val) {
const activity = this.activityList.find((o) => o.id === val)
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find(o => o.code === activity.literacyType)
this.literacyType = type?.name || "培训班"
},
exportSignUser() {
this.$downLoad(loc() + "/exportSignUser", { activityId: this.pageForm.activityId })
},
async yearChange() {
this.pageForm.activityId = null
await this.getActivityList()
await this.doSearch()
},
async getActivityList() {
const resp = await this.$axios.post(loc() + "/activityList", { year: this.pageForm.year })
this.activityList = resp.data
if (this.activityList && this.activityList.length > 0) {
this.pageForm.activityId = this.activityList[0].id
this.activityChange(this.activityList[0].id)
}
},
async initData() {
await this.getActivityList()
},
async openView(row) {
this.$refs.guava.view(() => {
this.$refs.infoRef.onOpen(row)
})
}
},
async created() {
await this.initData()
await this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -1,98 +0,0 @@
const info = {
template: /*language=HTML*/ `
<div>
<el-tabs>
<el-tab-pane label="报名人员">
<el-table :data="registerUserTableData" class="mt20">
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="(column, index) in registerUserTableColumns"
:key="index"
>
<template v-slot="{row}" v-if="column.prop === 'state'">
<span class="text-success" v-if="row.state === 1">正常报名</span>
<span class="text-warning" v-else-if="row.state === 2">候补报名</span>
<span class="text-success" v-else-if="row.state === 3">正常报名候补</span>
<span class="text-info" v-else-if="row.state === 4">无效报名缺席</span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="签到情况" v-if="clickRow.isMobileSign === true && Object.keys(userSignInfo).length > 0">
<el-tabs style="height: 600px" tab-position="left" class="mt20">
<el-tab-pane v-for="(item, key) in userSignInfo" :key="key">
<span slot="label">
<i class="el-icon-date"></i>
{{key}}
</span>
<el-table :data="item" style="max-height: 600px; overflow-y: auto">
<el-table-column label="姓名" prop="username"></el-table-column>
<el-table-column label="工号" prop="loginname"></el-table-column>
<el-table-column label="是否签到" prop="isAttend">
<template v-slot="{row}">
<template v-if="Date.now() < Date.parse(row.courseStartTime)">
<span class="text-default">未开始</span>
</template>
<template v-else>
<span class="text-success" v-if="row.isAttend">已签到</span>
<span class="text-warning" v-else>未签到</span>
</template>
</template>
</el-table-column>
<el-table-column label="签到时间" prop="attendTime"></el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-tab-pane>
</el-tabs>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
registerUserTableData: [],
registerUserTableColumns: [
{ label: "姓名", prop: "username" },
{ label: "工号", prop: "loginname" },
{ label: "单位", prop: "unitName" },
{ label: "分工会", prop: "unionName" },
{ label: "联系方式", prop: "mobile" },
{ label: "报名时间", prop: "signUpTime" },
{ label: "报名状态", prop: "state" }
],
cloneTableColumns: [
{label: '姓名', prop: 'username'},
{label: '工号', prop: 'loginname'},
{label: '单位', prop: 'unitName'},
{label: '分工会', prop: 'unionName'},
{label: '联系方式', prop: 'mobile'},
{label: '报名时间', prop: 'signUpTime'},
{label: '报名状态', prop: 'state'},
],
userSignInfo: {},
clickRow: {}
}
},
methods: {
async onOpen(row) {
this.clickRow = row
const resp_register = await this.$axios.post(loc() + "/registerUserList", {courseId: row.id})
this.registerUserTableData = resp_register.data
const resp_signInfo = await this.$axios.post(loc() + "/getSignInfo", {courseId: row.id})
this.userSignInfo = resp_signInfo.data
const resp_columnInfo = await $.get(loc() + '/getTaleColumnInfo', {courseId: row.id})
if (resp_columnInfo.data) {
this.registerUserTableColumns = []
this.registerUserTableColumns = this.cloneTableColumns.concat(resp_columnInfo.data)
}
}
},
style: /*language=CSS*/ `
`
}
@@ -1,350 +0,0 @@
const basicForm = {
template: /*language=HTML*/ `
<div>
<el-form label-width="120px" :model="formData" ref="addForm" :rules="rules">
<el-form-item prop="code" label="类型编码">
<el-input v-model="formData.code" placeholder="请输入类型编码"></el-input>
</el-form-item>
<el-form-item prop="typeName" label="类型名称">
<el-input v-model="formData.typeName" placeholder="请输入类型名称"></el-input>
</el-form-item>
<el-form-item prop="isBringFamily" label="是否携带家属">
<el-radio-group v-model="formData.isBringFamily" @input="isBringFamilyInput">
<el-radio :label="true" border>携带</el-radio>
<el-radio :label="false" border>不携带</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formData.isBringFamily === true" prop="isAddFamily" label="家属纳入总人数">
<el-radio-group v-model="formData.isAddFamily">
<el-radio :label="true" border>纳入</el-radio>
<el-radio :label="false" border>不纳入</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="formData.isBringFamily === true" prop="selfAddFamily" label="本人纳入总人数">
<el-radio-group v-model="formData.selfAddFamily">
<el-radio :label="true" border>纳入</el-radio>
<el-radio :label="false" border>不纳入</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div class="left-span-label" style="display: flex; justify-content: space-between; align-items: center">
<div>
报名填写字段
<span style="color: #c64120; margin-left: 10px">
移动端报名时字段的显示顺序会按照下面表格中的序号进行排列字段编码不能重复
</span>
</div>
<div>
<el-button
@click="formData.literacyMobileSignColumnList.push({isRequired: false})"
size="small"
type="primary"
style="margin-left: 10px"
>
<i class="ti-plus"></i>
添加
</el-button>
</div>
</div>
<el-table :data="formData.literacyMobileSignColumnList">
<el-table-column label="序号" prop="columnIndex">
<template v-slot="{row}">
<el-input-number v-model="row.columnIndex" placeholder="请输入序号"></el-input-number>
</template>
</el-table-column>
<el-table-column label="字段名称" prop="columnName">
<template v-slot="{row}">
<el-input v-model="row.columnName" placeholder="请输入字段名称"></el-input>
</template>
</el-table-column>
<el-table-column label="字段编码" prop="columnCode">
<template v-slot="{row}">
<el-input
v-model="row.columnCode"
placeholder="请输入字段编码"
:disabled="formData.isBringFamily === true && row.columnCode === 'xdqsrs'"
></el-input>
</template>
</el-table-column>
<el-table-column label="控件类型" prop="columnFormType">
<template v-slot="{row, $index}">
<el-select
filterable
v-model="row.columnFormType"
@change="(val) => {columnFormTypeChange(val, $index)}"
placeholder="请选择控件类型"
>
<el-option v-for="item in columnFormTypeList" :label="item.description" :value="item.code" :key="item.code"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="字段类型" prop="columnType">
<template v-slot="{row}">
<el-select
filterable
placeholder="请选择字段类型"
v-model="row.columnType"
>
<el-option v-for="item in columnTypeOptions" :label="item" :value="item" :key="item"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="是否必填" prop="isRequired" sortable>
<template v-slot="{row}">
<el-switch
v-model="row.isRequired"
active-color="#13ce66"
inactive-color="#ff4949"
:active-value="true"
:inactive-value="false"
active-text="是"
inactive-text="否"
></el-switch>
</template>
</el-table-column>
<el-table-column label="操作">
<template v-slot="{row, $index}">
<el-button
@click="openDetailedParams(row, $index)"
:disabled="!['SELECT', 'RADIO', 'FILE'].includes(row.columnFormType)"
size="mini"
type="primary"
>
设置详细参数
</el-button>
<el-button
@click="formData.literacyMobileSignColumnList.splice($index, 1)"
:disabled="formData.isBringFamily === true && row.columnCode === 'xdqsrs'"
size="mini"
type="danger"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div style="float: right; margin: 20px 0">
<el-button @click="$emit('refresh')"> </el-button>
<el-button type="primary" @click="doHandle"> </el-button>
</div>
<el-drawer append-to-body :visible.sync="detailedParamsVisible" size="40%">
<template #title>
<div class="left-span-label">设置详细参数</div>
</template>
<el-form class="mt20" ref="paramForm" :rules="paramFormRules" :model="clickRow" label-width="80px">
<template v-if="['SELECT'].includes(clickRow.columnFormType)">
<el-form-item label="选项列表" prop="selectValues">
<el-select
v-model="clickRow.selectValues"
multiple
style="width: 100%"
filterable
allow-create
default-first-option
placeholder="请选择选项列表(如无数据时,需手动输入选项进行添加)"
>
<el-option v-for="item in clickRow.columnOptions" :label="item" :value="item" :key="item"></el-option>
</el-select>
</el-form-item>
</template>
<template v-if="['RADIO'].includes(clickRow.columnFormType)">
<el-form-item label="选项列表" prop="selectValues">
<el-select
v-model="clickRow.selectValues"
multiple
style="width: 100%"
filterable
allow-create
default-first-option
placeholder="请选择选项列表(如无数据时,需手动输入选项进行添加)"
>
<el-option v-for="item in clickRow.columnOptions" :label="item" :value="item" :key="item"></el-option>
</el-select>
</el-form-item>
</template>
<template v-if="['FILE'].includes(clickRow.columnFormType)">
<el-form-item label="文件类型" prop="fileType">
<el-select v-model="clickRow.fileType" multiple style="width: 100%" filterable placeholder="请选择文件类型">
<el-option label="jpg" value="jpg"></el-option>
<el-option label="png" value="png"></el-option>
<el-option label="jpeg" value="jpeg"></el-option>
<el-option label="doc" value="doc"></el-option>
<el-option label="docx" value="docx"></el-option>
<el-option label="xlsx" value="xlsx"></el-option>
<el-option label="pdf" value="pdf"></el-option>
<el-option label="mp3" value="mp3"></el-option>
<el-option label="mp4" value="mp4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="文件个数" prop="fileNumber">
<el-input-number v-model="clickRow.fileNumber" :min="1" :max="10" placeholder="请输入文件个数" style="width: 100%"></el-input-number>
</el-form-item>
</template>
</el-form>
<div style="float: right; margin: 20px 0">
<el-button @click="detailedParamsVisible = false"> </el-button>
<el-button type="primary" @click="doDetailParams"> </el-button>
</div>
</el-drawer>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
formData: {
literacyMobileSignColumnList: [{ isRequired: false }],
isBringFamily: false,
isAddFamily: false,
selfAddFamily: true,
},
rules: {
typeName: [{ required: true, message: "请输入类型名称", trigger: ["change", "blur"] }],
code: [{ required: true, message: "请输入类型编码", trigger: ["change", "blur"] }],
isBringFamily: [{ required: true, message: "请选择是否携带家属", trigger: ["blur", "change"] }],
isAddFamily: [{ required: true, message: "请选择家属是否纳入总人数", trigger: ["blur", "change"] }]
},
columnTypeOptions: [],
columnFormTypeList: [],
clickRow: {},
paramFormRules: {
selectValues: [{ required: true, message: "请选择选项列表", trigger: ["blur"] }],
fileType: [{ required: true, message: "请选择文件类型", trigger: ["blur"] }],
fileNumber: [{ required: true, message: "请输入文件个数", trigger: ["blur", "change"] }]
},
detailedParamsVisible: false,
}
},
methods: {
isBringFamilyInput(o) {
this.$set(this.formData, "isAddFamily", o === true ? false : null)
if (o === true) {
this.formData.literacyMobileSignColumnList.unshift({
columnName: "携带亲属人数",
columnCode: "xdqsrs",
columnFormType: "INPUT",
columnType: "INT",
isRequired: true
})
} else {
this.formData.literacyMobileSignColumnList.forEach((item, index) => {
if (item.columnCode === "xdqsrs" && this.formData.isBringFamily === false) {
this.formData.literacyMobileSignColumnList.splice(index, 1)
}
})
}
},
columnFormTypeChange(val, index) {
if (val === "FILE") {
this.formData.literacyMobileSignColumnList[index].columnType = "JSON"
this.formData.literacyMobileSignColumnList[index].isDisabled = true
} else {
this.formData.literacyMobileSignColumnList[index].columnType = ""
this.formData.literacyMobileSignColumnList[index].isDisabled = false
}
},
doHandle() {
if (this.formData.id) {
this.doEdit()
} else {
this.doAdd()
}
},
async doDetailParams() {
const isValid = await this.$refs["paramForm"].validate()
if (isValid) {
this.detailedParamsVisible = false
}
},
openDetailedParams(row, index) {
this.clickRow = row
this.detailedParamsVisible = true
if (this.$refs["paramForm"]) this.$refs["paramForm"].clearValidate()
},
doAdd() {
this.$refs["addForm"].validate((valid) => {
if (valid) {
const newListLength = new Set(this.formData.literacyMobileSignColumnList.map((item) => item.columnCode)).size
const listLength = this.formData.literacyMobileSignColumnList.length
if (listLength > newListLength) {
this.$message.warning('字段编码不能重复')
return
}
const cloneData = clone(this.formData)
this.$axios.post(loc() + "/doAdd", { data: JSON.stringify(cloneData) }).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.$emit('refresh')
} else {
this.$message.error(res.msg)
}
})
}
})
},
doEdit() {
this.$refs["addForm"].validate((valid) => {
if (valid) {
const newListLength = new Set(this.formData.literacyMobileSignColumnList.map((item) => item.columnCode)).size
const listLength = this.formData.literacyMobileSignColumnList.length
if (listLength > newListLength) {
this.$message.warning('字段编码不能重复')
return
}
const cloneData = clone(this.formData)
cloneData.literacyMobileSignColumnList = JSON.stringify(cloneData.literacyMobileSignColumnList)
this.$axios.post(loc() + "/doEdit", cloneData).then((res) => {
if (res.code === 0) {
this.$message.success(res.msg)
this.$emit('refresh')
} else {
this.$message.error(res.msg)
}
})
}
})
},
async getColTypeOptions() {
const resp = await this.$axios.get(loc() + "/getColumnType")
this.columnTypeOptions = resp.data
},
async getEnumOptions() {
const resp = await this.$axios.post("/open/common/dictEnumOptions", { name: "ColumnFormTypeEnum" })
return resp.data
},
initData(row) {
if(row && row.id) {
this.formData = JSON.parse(JSON.stringify(row))
this.formData.literacyMobileSignColumnList.forEach((item) => {
item.isDisabled = item.columnFormType === "FILE"
})
} else {
this.formData = {
literacyMobileSignColumnList: [{ isRequired: false }],
isBringFamily: false,
isAddFamily: false,
selfAddFamily: true,
}
if (this.$refs["addForm"]) this.$refs["addForm"].resetFields()
}
},
},
async created() {
await this.getColTypeOptions()
this.columnFormTypeList = await this.getEnumOptions()
},
style: /*language=CSS*/ `
`
}
@@ -1,120 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-row--flex.is-justify-space-between {
justify-content: left;
}
.el-drawer__body {
padding: 0 30px 0 10px;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="类型名称:">
<el-input clearable placeholder="请输入类型名称" v-model="pageForm.typeName"></el-input>
</search-item>
</search>
</el-card>
<el-card shadow="never" class="mt20">
<table-tool label="申请列表">
<el-button type="primary" size="small" @click="openAdd">
<i class="ti-plus"></i>
新增类型
</el-button>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" :size="tableSize">
<el-table-column label="序号" width="70" type="index">
<template v-slot="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}}</span>
</template>
</el-table-column>
<el-table-column label="类型编码" prop="code" sortable></el-table-column>
<el-table-column label="类型名称" prop="typeName"></el-table-column>
<el-table-column label="操作" width="300px">
<template v-slot="{ row }">
<el-button v-if="row.xh!==1" size="mini" type="primary" @click="rowChange(row, false)">上移</el-button>
<el-button v-if="row.xh!==pageForm.totalCount" size="mini" type="primary" @click="rowChange(row, true)">下移</el-button>
<el-button type="primary" size="mini" @click="openEdit(row)">编辑</el-button>
<el-button type="danger" size="mini" @click="doDelete(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit>
<basic-form ref="basicFormRef" @refresh="doSearch();$refs.guava.index()"></basic-form>
</template>
</guava>
</div>
<script>
<!--#include('basicForm.js'){}#-->
const vue = new Vue({
el: "#app",
mixins: [initTableMixins],
components: {
"basic-form": basicForm,
},
data() {
return {}
},
methods: {
async rowChange(row, toDown) {
await this.$axios.post(loc() + "/xhChange", { id: row.id, xh: row.xh, toDown }).then((res) => {
if (res.code === 0) {
this.doSearch()
}
})
},
openAdd() {
this.$refs.guava.edit(() => {
this.$refs.basicFormRef.initData()
})
},
pageData() {
this.$axios.post(loc() + "/pageData", this.pageForm).then((res) => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
},
openEdit(obj) {
this.$refs.guava.edit(() => {
this.$refs.basicFormRef.initData(obj)
})
},
doDelete(id) {
this.$confirm("您确定要删除吗, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$axios.post(loc() + "/doDelete", { id: id }).then((res) => {
if (res.code === 0) {
this.doSearch()
this.$message.success(res.msg)
}
})
})
.catch(() => {})
},
},
async created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -1,144 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
placeholder="请选择年度"
type="year"
style="width: 100%"
@change="yearChange"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</search-item>
<search-item label="活动名称:">
<el-select @change="activityChange" style="width: 100%" v-model="pageForm.activityId">
<el-option :label="item.activityName" :value="item.id" v-for="item in activityList" :key="item.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="人员调整"></table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="literacyType" prop="courseName" show-overflow-tooltip></el-table-column>
<el-table-column label="类型" prop="courseType" sortable show-overflow-tooltip></el-table-column>
<el-table-column :label="literacyType + '地点'" prop="courseLocation" sortable show-overflow-tooltip></el-table-column>
<el-table-column
:label="literacyType === '培训班' ? '讲师' : '负责人'"
prop="courseInstructor"
sortable
show-overflow-tooltip
></el-table-column>
<el-table-column label="最多报名人数" prop="coursePeopleNumber" sortable show-overflow-tooltip>
<template v-slot="{row}">
<span v-if="row.reserveMode === 1">
{{row.coursePeopleNumber}}
</span>
<span v-if="row.reserveMode === 2">
{{(row.coursePeopleNumber + row.waitingNum) + '(候补占' + row.waitingNum + ''}}
</span>
</template>
</el-table-column>
<el-table-column label="预留人数" prop="courseReservedNumber" sortable show-overflow-tooltip></el-table-column>
<el-table-column label="已报名人数" prop="registerNum" sortable show-overflow-tooltip>
<template v-slot="{row}">
<el-link @click="openView(row)" type="primary">
{{row.registerNum}}
</el-link>
</template>
</el-table-column>
<el-table-column label="操作" width="150px">
<template v-slot="{row}">
<el-button @click="openView(row)" size="mini" type="primary">调整</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<user-info ref="userInfoRef" @refresh="doSearch"></user-info>
</template>
</guava>
</div>
<script>
<!--#include('userInfo.js'){}#-->
new Vue({
el: "#app",
dicts: ["LITERACY_SIGNUP_TYPE"],
mixins: [initTableMixins],
components: {
"user-info": userInfo,
},
data() {
return {
literacyType: "培训班",
activityList: [],
pageForm: {
year: new Date().getFullYear().toString(),
activityId: null
},
tableColumns: [
{ label: "培训班", prop: "courseName" },
{ label: "类型", prop: "courseType", sortable: true },
{ label: "地点", prop: "courseLocation" },
{ label: "教师", prop: "courseInstructor", sortable: true },
{ label: "最多报名人数", prop: "coursePeopleNumber", sortable: true },
{ label: "已报名人数", prop: "registerNum", sortable: true }
],
}
},
methods: {
activityChange(val) {
const activity = this.activityList.find((o) => o.id === val)
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find(o => o.code === activity.literacyType)
this.literacyType = type?.name || "培训班"
},
async yearChange() {
this.pageForm.activityId = null
await this.getActivityList()
await this.doSearch()
},
async getActivityList() {
const resp = await this.$axios.post(loc() + "/activityList", { year: this.pageForm.year })
this.activityList = resp.data
if (this.activityList && this.activityList.length > 0) {
this.pageForm.activityId = this.activityList[0].id
this.activityChange(this.activityList[0].id)
}
},
async initData() {
await this.getActivityList()
},
async openView(o) {
this.$refs.guava.view(() => {
const activity = this.activityList.find((o) => o.id === this.pageForm.activityId)
this.$refs.userInfoRef.onOpen(o, activity)
})
},
},
async created() {
await this.initData()
await this.pageData()
},
})
</script>
<!--#
}
#-->
@@ -1,224 +0,0 @@
const userInfo = {
template: /*language=HTML*/ `
<div>
<div class="left-span-label">{{ registerCourse.courseName + '报名人员' }}</div>
<div>
<search @search="registerSearch">
<search-item label="姓名/工号:">
<el-input v-model="registerForm.searchKeyword" placeholder="请输入内容"></el-input>
</search-item>
<search-item label="所属工会:">
<el-select v-model="registerForm.unionId" clearable filterable placeholder="请选择院级工会" @change="getUnitList()">
<el-option v-for="item in unionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</search-item>
<search-item label="所属单位:">
<el-select v-model="registerForm.unitId" clearable filterable placeholder="请选择单位">
<el-option v-for="item in unitList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</search-item>
</search>
</div>
<el-table :data="registerUserTableData" class="mt15">
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="(column, index) in registerUserTableColumns"
:key="index"
>
<template v-slot="{row}" v-if="column.prop === 'state'">
<span class="text-success" v-if="row.state === 1">正常报名</span>
<span class="text-warning" v-else-if="row.state === 2">候补报名</span>
<span class="text-success" v-else-if="row.state === 3">正常报名候补</span>
<span class="text-info" v-else-if="row.state === 4">无效报名缺席</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px">
<template v-slot="{row}">
<el-button v-if="row.state === 1 || row.state === 3" @click="adjust(row)" size="mini" type="primary">修改</el-button>
<el-button @click="deleteSignUser(row)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="人员调整" append-to-body class="adjustDialog" :close-on-click-modal="false" :visible.sync="adjustDialogVisible" width="50%">
<span style="color: #c33714">如单选为灰色选择不了则表示对应的{{ literacyType }}人数已满候补报名不做调整</span>
<el-table :data="courseList" class="mt20">
<el-table-column label="单选" width="160">
<template v-slot="{row}">
<el-radio
:label="row.id"
@change.native="getCurrentRow(row)"
:disabled="(row.courseReservedNumber + row.registerNum) >= row.coursePeopleNumber"
v-model="afterAdjustCourse"
></el-radio>
</template>
</el-table-column>
<el-table-column
:label="literacyType + '列表'"
prop="courseName"
align="center"
header-align="center"
show-overflow-tooltip
></el-table-column>
<el-table-column label="最多报名人数" prop="coursePeopleNumber" align="center" header-align="center">
</el-table-column>
<el-table-column label="预留名额" prop="courseReservedNumber" align="center" header-align="center"></el-table-column>
<el-table-column label="已报名人数" prop="registerNum" align="center" header-align="center"></el-table-column>
<el-table-column label="候补人数" prop="hasWaitingNum" align="center" header-align="center"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="adjustDialogVisible = false"> </el-button>
<el-button type="primary" @click="doAdjust"> </el-button>
</span>
</el-dialog>
</div>
`,
dicts: ["LITERACY_SIGNUP_TYPE"],
data() {
return {
afterAdjustCourse: "",
adjustDialogVisible: false,
unionList: [],
unitList: [],
registerForm: {
unionId: "",
unitId: ""
},
registerCourse: {},
courseList: [],
userInfo: {},
chooseRow: {},
registerUserTableData: [],
registerUserTableColumns: [
{ label: "姓名", prop: "username" },
{ label: "工号", prop: "loginname" },
{ label: "单位", prop: "unitName" },
{ label: "分工会", prop: "unionName" },
{ label: "联系方式", prop: "mobile" },
{ label: "报名时间", prop: "signUpTime" },
{ label: "报名状态", prop: "state" }
],
literacyType: '',
activity: {},
}
},
methods: {
async onOpen(row, activity) {
this.registerCourse = row
this.registerForm.courseId = row.id
this.activity = activity
const resp_register = await this.$axios.post(loc() + "/registerUserList", this.registerForm)
this.registerUserTableData = resp_register.data
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find(o => o.code === activity.literacyType)
this.literacyType = type?.name || "培训班"
},
getCurrentRow(row) {
this.chooseRow = row
},
async doAdjust() {
if (!this.afterAdjustCourse) {
this.$message.warning("请选择要调整的" + this.literacyType + "")
return
}
this.$confirm(
"您确定要将" +
"<span style='color: red'>" +
this.userInfo.username +
"</span>" +
"的报名信息调整到" +
"<span style='color: red'>" +
this.chooseRow.courseName +
"</span>" +
"中吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
dangerouslyUseHTMLString: true
}
)
.then(async () => {
const loading = this.$loading({
lock: true,
text: "努力调整中,感谢您的耐心等待。。。",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
})
const resp = await this.$axios.post(loc() + "/adjust", {
activityId: this.activity.id,
oldCourseId: this.registerCourse.id,
newCourseId: this.afterAdjustCourse,
userId: this.userInfo.userId
})
loading.close()
if (resp.code === 0) {
this.$message.success(resp.msg)
this.adjustDialogVisible = false
await this.registerSearch()
this.$emit("refresh", null)
} else {
this.$message.warning(resp.msg)
}
})
.catch(() => {})
},
async adjust(o) {
this.userInfo = o
this.afterAdjustCourse = ""
await this.getCourse(this.activity.id)
this.adjustDialogVisible = true
},
deleteSignUser(o) {
this.$confirm("您确定要删除" + "<span style='color: red'>" + o.username + "</span>" + "的报名信息吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
dangerouslyUseHTMLString: true
})
.then(async () => {
const resp = await this.$axios.post(loc() + "/deleteSignUser", {
activityId: this.activity.id,
courseId: this.registerCourse.id,
userId: o.userId
})
if (resp.code === 0) {
this.$message.success(resp.msg)
await this.registerSearch()
this.$emit("refresh", null)
} else {
this.$message.warning(resp.msg)
}
})
.catch(() => {})
},
async registerSearch() {
this.registerForm.courseId = this.registerCourse.id
const resp_register = await $.get(loc() + "/registerUserList", this.registerForm)
this.registerUserTableData = resp_register.data
},
async getCourse(val) {
const {data} = await this.$axios.post(loc() + "/getCourse", {activityId: val})
this.courseList = data
}
},
async created() {
this.unionList = await this.$businessTool.listUnion()
this.unitList = await this.$businessTool.listUnit(this.registerForm.unionId)
},
style: /*language=CSS*/ `
.adjustDialog .el-radio__label {
display: none;
}
.adjustDialog .el-dialog__body {
max-height: 600px;
overflow-y: auto;
}
`
}
@@ -1,235 +0,0 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度:">
<el-date-picker
placeholder="选择年度"
type="year"
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy"
></el-date-picker>
</search-item>
<search-item label="活动名称:">
<el-select @change="activityChange" style="width: 100%" v-model="pageForm.activityId">
<el-option :label="item.activityName" :value="item.id" v-for="item in activityList" :key="item.id"></el-option>
</el-select>
</search-item>
<search-item :label="literacyType + ''">
<el-select @change="courseChange" :placeholder="'请选择' + literacyType" style="width: 100%" v-model="pageForm.courseId">
<el-option :label="item.courseName" :value="item.id" v-for="item in courseList" :key="item.id"></el-option>
</el-select>
</search-item>
<search-item label="人员信息:">
<el-input clearable placeholder="输入姓名或者工号搜索" v-model="pageForm.userKeyWord"></el-input>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool ref="tool" :label="literacyType + '(温馨提示:如需补充人员,请在上面选择具体的' + literacyType + ''">
<el-button @click="openReserve" type="primary" v-if="reserveMode === 2" size="small">补充人员</el-button>
<el-button @click="exportSignPerson" type="primary" size="small">导出签到名单</el-button>
<el-button @click="exportGiftPerson" type="primary" size="small">导出领取名单</el-button>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" label="序号" type="index" width="80px"></el-table-column>
<el-table-column
:label="column.prop === 'courseNames' ? literacyType : column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-if="(column.prop !== 'state' && column.prop !== 'absentCount') || (reserveMode === 2 && column.prop === 'state' && column.prop !== 'absentCount')
|| (column.prop === 'absentCount' && course.isMobileSign === true)"
v-for="(column,index) in tableColumns"
:key="index"
>
<template v-slot="{row}" v-if="column.prop==='isDisabled'">
<span class="text-danger" v-if="row.isDisabled"></span>
<span class="text-success" v-else></span>
</template>
<template v-slot="{row}" v-else-if="column.prop==='state'">
<span class="text-success" v-if="row.state === 1">正常报名</span>
<span class="text-warning" v-else-if="row.state === 2">候补报名</span>
<span class="text-success" v-else-if="row.state === 3">正常报名(候补)</span>
<span class="text-info" v-else-if="row.state === 4">无效报名(缺席)</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px">
<template v-slot="{row}">
<el-button @click="handleUser(row.userId)" size="mini" type="danger" v-if="!row.isDisabled">拉黑</el-button>
<el-button @click="handleUser(row.userId)" size="mini" type="success" v-if="row.isDisabled">解封</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
<el-dialog title="补充人员" :visible.sync="reserveDialogVisible" width="55%" top="3%">
<vi-title title="以下为候补人员,已为您按照报名时间降序排列"></vi-title>
<el-table :data="reserveTableData" ref="multipleTable" @selection-change="handleSelectionChange">
<el-table-column :selectable="(row, index) => {return row.state === 2}" type="selection" width="55"></el-table-column>
<el-table-column prop="username" label="姓名"></el-table-column>
<el-table-column prop="loginname" label="工号"></el-table-column>
<el-table-column prop="mobile" label="联系方式"></el-table-column>
<el-table-column prop="unitName" label="单位"></el-table-column>
<el-table-column prop="unionName" label="工会"></el-table-column>
<el-table-column prop="signUpTime" label="报名时间"></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="reserveDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="reserveDo">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
new Vue({
el: "#app",
dicts: ["LITERACY_SIGNUP_TYPE"],
mixins: [initTableMixins],
data() {
return {
reserveDialogVisible: false,
reserveTableData: [],
activityList: [],
pageForm: {
year: new Date().getFullYear().toString(),
activityId: null
},
tableColumns: [
{ label: "姓名", prop: "username" },
{ label: "工号", prop: "loginname" },
{ label: "联系方式", prop: "mobile" },
{ label: "单位", prop: "unitName", sortable: true },
{ label: "分工会", prop: "unionName", sortable: true },
{ label: "课程", prop: "courseNames", sortable: true },
{ label: "缺席次数", prop: "absentCount" },
{ label: "是否黑名单", prop: "isDisabled", sortable: true }
],
literacyType: "培训班",
courseList: [],
course: {},
reserveMode: 1,
multipleSelection: [],
}
},
methods: {
handleSelectionChange(val) {
this.multipleSelection = val
},
async openReserve() {
const activity = this.activityList.find((o) => o.id === this.pageForm.activityId)
if (this.$moment().unix() < this.$moment(activity.activityEndTime).unix()) {
this.$alert("此活动还未结束,无法补充", "提示", {
confirmButtonText: "确定"
})
return
}
const resp = await this.$axios.post("/platform/literacy/userManage/getReserveUser", { courseId: this.course.id })
this.reserveTableData = resp.data
this.reserveDialogVisible = true
},
reserveDo() {
if (this.multipleSelection.length === 0) {
this.$message.warning("请先在左侧多选框中选择要补充的人员")
return
}
this.$confirm("您选择了" + this.multipleSelection.length + "位教职工,确定要进行补充操作吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(async () => {
const ids = this.multipleSelection.map((o) => o.userId)
const resp = await this.$axios.post("/platform/literacy/userManage/reserveSingUp", {
ids: JSON.stringify(ids),
courseId: this.course.id
})
if (resp.code === 0) {
this.$message.success(resp.msg)
this.doSearch()
this.multipleSelection = []
this.$refs.multipleTable.clearSelection()
this.reserveDialogVisible = false
}
})
.catch(() => {})
},
courseChange(val) {
const course = this.courseList.find((o) => o.id === val)
this.course = course
this.reserveMode = course.reserveMode
if (this.reserveMode === 2) {
this.tableColumns.push({ label: "报名状态", prop: "state", sortable: true })
} else {
const o = this.tableColumns.find((o) => o.label === "报名状态")
if (o !== null && o !== undefined) {
this.tableColumns.splice(this.tableColumns.length - 1, 1)
}
}
this.$refs.tool.app = this
this.doSearch()
},
exportSignPerson() {
this.exportPro(loc() + "/exportSignPerson", { activityId: this.pageForm.activityId })
},
exportGiftPerson() {
this.exportPro(loc() + "/exportGiftPerson", { activityId: this.pageForm.activityId })
},
exportPro(url, param) {
if (param.activityId === null) {
this.$message.warning("请选择活动")
return
}
this.$downLoad(url, param)
},
async activityChange(val) {
const activity = this.activityList.find((o) => o.id === val)
const type = this.dict.type.LITERACY_SIGNUP_TYPE.find(o => o.code === activity.literacyType)
this.literacyType = type?.name || "培训班"
const resp = await this.$axios.post(loc() + "/getCourseByActivityId", { activityId: val })
this.courseList = resp.data
this.pageForm.courseId = ""
},
async handleUser(userId) {
const resp = await $.post(loc() + "/doHandleUser", { userId })
if (resp.code === 0) {
this.$message.success(resp.msg)
this.doSearch()
}
},
async yearChange() {
this.pageForm.activityId = null
await this.getActivityList()
await this.doSearch()
},
async getActivityList() {
const resp = await this.$axios.post("/platform/literacy/statistics/activity/activityList", { year: this.pageForm.year })
this.activityList = resp.data
if (this.activityList && this.activityList.length > 0) {
this.pageForm.activityId = this.activityList[0].id
await this.activityChange(this.activityList[0].id)
}
},
async initData() {
await this.getActivityList()
},
},
async created() {
await this.initData()
await this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -244,6 +244,7 @@ layout("/layouts/platform.html"){
this.$set(this.formData, "unionName", user.union ? user.union.name : null)
this.$set(this.formData, "sex", user.sex)
this.$set(this.formData, "birthday", user.birthday ? this.$moment(user.birthday).format('YYYY-MM-DD') : '')
this.$set(this.formData, "mobile", user.mobile)
this.$set(this.formData, "nation", user.nation)
this.$set(this.formData, "political", user.political)
this.$set(this.formData, "education", user.education)
@@ -353,8 +353,21 @@ layout("/layouts/platform.html"){
})
})
},
// 提交验证
validateBeforeSubmit() {
return new Promise((resolve) => {
this.$refs.formRef.validate((valid) => {
if (valid) {
resolve(true);
} else {
this.$message.error('请完善必填信息');
resolve(false);
}
});
});
},
// 提交
onSubmit() {
async onSubmit() {
// 余额校验
if (this.formData.money && this.formData.fundBalance) {
const balance = parseFloat(this.formData.fundBalance);
@@ -364,6 +377,10 @@ layout("/layouts/platform.html"){
return;
}
}
// 表单验证
const isValid = await this.validateBeforeSubmit();
if (!isValid) return;
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -380,7 +397,7 @@ layout("/layouts/platform.html"){
})
},
// 再次提交
onFinishTask() {
async onFinishTask() {
// 余额校验
if (this.formData.money && this.formData.fundBalance) {
const balance = parseFloat(this.formData.fundBalance);
@@ -390,6 +407,10 @@ layout("/layouts/platform.html"){
return;
}
}
// 表单验证
const isValid = await this.validateBeforeSubmit();
if (!isValid) return;
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -23,8 +23,8 @@ layout("/layouts/platform.html"){
<table-tool>
<el-button type="primary" size="small" icon="el-icon-refresh" @click="syncSysUnit">同步系统单位</el-button>
</table-tool>
<el-table :data="tableData" border size="small" ref="tableRef" height="calc(100vh - 400px)">
<el-table-column label="序号" type="index" :index="indexMethod"></el-table-column>
<el-table :data="tableData" border ref="tableRef" height="calc(100vh - 400px)">
<el-table-column label="序号" type="index" :index="indexMethod" width="60"></el-table-column>
<el-table-column prop="name" label="单位名称" show-overflow-tooltip></el-table-column>
<el-table-column prop="code" label="单位编码" width="150px"></el-table-column>
<el-table-column prop="branchSchoolLeader" label="分管校领导及联系方式" width="180px"></el-table-column>
@@ -15,7 +15,15 @@ const TREE_COMPONENT = {
default-expand-all
@node-click="treeNodeClick"
:filter-node-method="filterNode"
></el-tree>
>
<template slot-scope="{ node, data }">
<span class="el-tree-node__label">
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
<i class="el-icon-folder" v-else></i>
{{node.label}}
</span>
</template>
</el-tree>
</div>
</el-card>
`,
@@ -16,20 +16,21 @@
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="userId" label="用户">
<el-form-item prop="userId" label="代表">
<user-select v-model="formData.userId"
ref="userSelectRef"
v-if="dialogFormVisible"
api="/platform/teacherCongress/delegate/manage/adjustUserList"
:api_params="{sessionId:formData.sessionId}"
api_input_key_name="keyWord"
placeholder="请选择代表"
:option_label_func="(item)=>{return item.userName + item.loginName + '(' + item.unitName + ')'}"
></user-select>
<el-button icon="el-icon-plus" type="primary" @click="move">添加到待调整列表</el-button>
</el-form-item>
</el-row>
<el-form-item prop="users" label="待调整用户">
<el-form-item prop="users" label="待调整代表">
<el-table :data="formData.users" size="small">
<el-table-column label="工号" prop="loginName"></el-table-column>
<el-table-column label="姓名" prop="userName"></el-table-column>
@@ -16,7 +16,15 @@ const TREE_TEMPLATE = {
default-expand-all
@node-click="treeNodeClick"
:filter-node-method="filterNode"
></el-tree>
>
<template slot-scope="{ node, data }">
<span class="el-tree-node__label">
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
<i class="el-icon-folder" v-else></i>
{{node.label}}
</span>
</template>
</el-tree>
</el-card>
`,
data() {
@@ -10,7 +10,7 @@ const BASIC_TABLE_COMPONENT = {
<el-table key="1" :data="tableData" ref="tableRef">
<el-table-column label="序号" width="100px" type="index" :index="indexMethod"></el-table-column>
<el-table-column prop="name" label="机构名称"></el-table-column>
<el-table-column prop="code" label="机构编码"></el-table-column>
<el-table-column prop="introduce" label="描述"></el-table-column>
<el-table-column label="操作" width="100px">
<template slot-scope="{row}">
<el-link size="mini" type="danger" @click="del(row.id)">删除</el-link>
@@ -32,6 +32,9 @@ const BASIC_TABLE_COMPONENT = {
</el-form-item>
<el-form-item label="机构代码" prop="code">
<el-input placeholder="请输入机构代码" v-model="formData.code" disabled></el-input>
</el-form-item>
<el-form-item label="描述" prop="introduce">
<el-input v-model="formData.introduce" placeholder="请输入描述"></el-input>
</el-form-item>
<el-form-item label="备注" prop="notes">
<el-input v-model="formData.notes" placeholder="请输入备注"></el-input>
@@ -15,7 +15,15 @@ const TREE_COMPONENT = {
default-expand-all
@node-click="treeNodeClick"
:filter-node-method="filterNode"
></el-tree>
>
<template slot-scope="{ node, data }">
<span class="el-tree-node__label">
<i class="el-icon-folder-opened" v-if="node.level===1"></i>
<i class="el-icon-folder" v-else></i>
{{node.label}}
</span>
</template>
</el-tree>
</el-card>
`,
data() {
@@ -3,164 +3,156 @@ layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<snaker-start slot="header" label="申请表单" define_key="DSZNFMTX"></snaker-start>
<el-form :model="formData" ref="formRef" :rules="formRules" label-suffix="" label-width="120px">
<!-- 将表单项按两列重新排列 -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="职工姓名" prop="userName">
<el-input v-model="formData.userName" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-input v-model="formData.sex" readonly></el-input>
</el-form-item>
</el-col>
<snaker-start slot="header" label="申请表单" define_key="DSZNFMTX"></snaker-start>
<el-form :model="formData" ref="formRef" :rules="formRules" label-suffix="" label-width="120px">
<!-- 将表单项按两列重新排列 -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="职工姓名" prop="userName">
<el-input v-model="formData.userName" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-input v-model="formData.sex" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="出生年月" prop="birthday">
<el-input v-model="formData.birthday" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原工作单位" prop="unitName">
<el-input v-model="formData.unitName" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="退休时间" prop="retireTime">
<el-date-picker type="date"
v-model="formData.retireTime"
placeholder="请选择"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="爱人姓名" prop="loverName">
<el-input type="text" v-model="formData.loverName" placeholder="请输入爱人姓名"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="性别" prop="loverSex">
<el-select v-model="formData.loverSex" placeholder="请选择" style="width: 100%">
<el-option label="男性" value="男性"></el-option>
<el-option label="女性" value="女性"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作单位" prop="loverUnitName">
<el-input type="text" v-model="formData.loverUnitName"
placeholder="请输入工作单位"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="结婚日期" prop="marryTime">
<el-date-picker type="date"
v-model="formData.marryTime"
placeholder="请选择"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="子女出生日" prop="childrenBirthday">
<el-date-picker type="date"
v-model="formData.childrenBirthday"
placeholder="请选择子女出生日"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="领独生子女证日" prop="getCertificateTime">
<el-date-picker type="date"
v-model="formData.getCertificateTime"
placeholder="请选择"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="独生子女光荣证号" prop="childrenGraceNumber">
<el-input type="text" v-model="formData.childrenGraceNumber"
placeholder="请输入独生子女光荣证号"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="办证机关" prop="office">
<el-input type="text" v-model="formData.office"
placeholder="请输入办证机关"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 以下项目保持单独一行 -->
<el-form-item prop="honorFiles" label="独生子女父母光荣证">
<file-upload :upload_number="5" :value.sync="formData.honorFiles"
upload_result_type="url"
upload_text="请上传独生子女父母光荣证"
complete_result upload_mode="drag"
upload_result_category="array"></file-upload>
</el-form-item>
<el-form-item prop="retireFiles" label="退休证">
<file-upload :upload_number="5" :value.sync="formData.retireFiles"
upload_result_type="url"
upload_text="请上传退休证"
complete_result upload_mode="drag"
upload_result_category="array"></file-upload>
</el-form-item>
<el-form-item prop="sign" label="签字">
<pc-signature v-model="formData.sign"></pc-signature>
</el-form-item>
<el-form-item prop="declarationAgreed">
<el-checkbox v-model="formData.declarationAgreed">
根据《河北省人口与计划生育条例》第四章第三十四条第四款"独生子女父母是国家工作人员、企事业单位员工的,退休时分别给予不低于三千元一次性奖励"的规定。<br/>
说明:1. 本人应如实填写各项情况。2. 申报时需持《独生子女父母光荣证》、《退休证》原件及其复印件各一份。
</el-checkbox>
</el-form-item>
</el-form>
<el-row type="flex" justify="end" class="mt20">
<el-button type="primary" plain @click="onSave">保存</el-button>
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
<el-button type="primary" @click="onFinishTask" v-else>提交1</el-button>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="出生年月" prop="birthday">
<el-input v-model="formData.birthday" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原工作单位" prop="unitName">
<el-input v-model="formData.unitName" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="退休时间" prop="retireTime">
<el-date-picker type="date"
v-model="formData.retireTime"
placeholder="请选择"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="爱人姓名" prop="loverName">
<el-input type="text" v-model="formData.loverName" placeholder="请输入爱人姓名"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="性别" prop="loverSex">
<el-select v-model="formData.loverSex" placeholder="请选择" style="width: 100%">
<el-option label="男性" value="男性"></el-option>
<el-option label="女性" value="女性"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工作单位" prop="loverUnitName">
<el-input type="text" v-model="formData.loverUnitName"
placeholder="请输入工作单位"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="结婚日期" prop="marryTime">
<el-date-picker type="date"
v-model="formData.marryTime"
placeholder="请选择"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="子女出生日" prop="childrenBirthday">
<el-date-picker type="date"
v-model="formData.childrenBirthday"
placeholder="请选择子女出生日"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="领独生子女证日" prop="getCertificateTime">
<el-date-picker type="date"
v-model="formData.getCertificateTime"
placeholder="请选择"
clearable
style="width: 100%"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="独生子女光荣证号" prop="childrenGraceNumber">
<el-input type="text" v-model="formData.childrenGraceNumber"
placeholder="请输入独生子女光荣证号"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="办证机关" prop="office">
<el-input type="text" v-model="formData.office"
placeholder="请输入办证机关"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="奖励金额" prop="bonus">
<el-input type="text" v-model="formData.bonus"
placeholder="请输入奖励金额"></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 以下项目保持单独一行 -->
<el-form-item prop="honorFiles" label="独生子女父母光荣证">
<file-upload :upload_number="5" :value.sync="formData.honorFiles"
upload_result_type="url"
upload_text="请上传独生子女父母光荣证"
complete_result upload_mode="drag"
upload_result_category="array"></file-upload>
</el-form-item>
<el-form-item prop="retireFiles" label="退休证">
<file-upload :upload_number="5" :value.sync="formData.retireFiles"
upload_result_type="url"
upload_text="请上传退休证"
complete_result upload_mode="drag"
upload_result_category="array"></file-upload>
</el-form-item>
<el-form-item prop="sign" label="签字">
<pc-signature v-model="formData.sign"></pc-signature>
</el-form-item>
<el-form-item prop="declarationAgreed">
<el-checkbox v-model="formData.declarationAgreed">
根据《河北省人口与计划生育条例》第四章第三十四条第四款"独生子女父母是国家工作人员、企事业单位员工的,退休时分别给予不低于三千元一次性奖励"的规定。<br/>
说明:1. 本人应如实填写各项情况。2. 申报时需持《独生子女父母光荣证》、《退休证》原件及其复印件各一份。
</el-checkbox>
</el-form-item>
</el-form>
<el-row type="flex" justify="end" class="mt20">
<el-button type="primary" plain @click="onSave">保存</el-button>
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
<el-button type="primary" @click="onFinishTask" v-else>提交1</el-button>
</el-row>
</el-card>
</div>
@@ -176,9 +168,23 @@ layout("/layouts/platform.html"){
taskId: GetQueryString("taskId"),
formData: {},
formRules: {
declarationAgreed: [
{ required: true, message: '请勾选申报理由', trigger: 'change' }
]
userName: [{ required: true, message: '职工姓名不能为空', trigger: 'blur' }],
sex: [{ required: true, message: '性别不能为空', trigger: 'blur' }],
birthday: [{ required: true, message: '出生年月不能为空', trigger: 'blur' }],
unitName: [{ required: true, message: '原工作单位不能为空', trigger: 'blur' }],
retireTime: [{ required: true, message: '请选择退休时间', trigger: 'change' }],
loverName: [{ required: true, message: '请输入爱人姓名', trigger: 'blur' }],
loverSex: [{ required: true, message: '请选择爱人性别', trigger: 'change' }],
loverUnitName: [{ required: true, message: '请输入爱人工作单位', trigger: 'blur' }],
marryTime: [{ required: true, message: '请选择结婚日期', trigger: 'change' }],
childrenBirthday: [{ required: true, message: '请选择子女出生日', trigger: 'change' }],
getCertificateTime: [{ required: true, message: '请选择领独生子女证日', trigger: 'change' }],
childrenGraceNumber: [{ required: true, message: '请输入独生子女光荣证号', trigger: 'blur' }],
office: [{ required: true, message: '请输入办证机关', trigger: 'blur' }],
honorFiles: [{ required: true, message: '请上传独生子女父母光荣证', trigger: 'change' }],
retireFiles: [{ required: true, message: '请上传退休证', trigger: 'change' }],
sign: [{ required: true, message: '请签字', trigger: 'change' }],
declarationAgreed: [{ required: true, message: '请勾选申报理由', trigger: 'change', type: 'enum', enum: [true] }]
},
}
},
@@ -199,54 +205,101 @@ layout("/layouts/platform.html"){
})
})
},
// 提交
onSubmit() {
this.$refs.formRef.validate((valid) => {
if (valid) {
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post('/platform/dsznfmtx/apply/submit', {
data: JSON.stringify(this.formData)
}).then(res => {
if (res.code === 0) {
this.$message.success("提交成功")
commonUtil.pjaxPush('/platform/dsznfmtx/mine/index')
}
})
})
} else {
this.$message.error('请完善表单信息并勾选申报理由');
return false;
}
// 提交验证
validateBeforeSubmit() {
return new Promise((resolve) => {
this.$refs.formRef.validate((valid) => {
if (valid) {
resolve(true);
} else {
this.$message.error('请完善表单信息并勾选申报理由');
resolve(false);
}
});
});
},
// 再次提交
onFinishTask() {
this.$refs.formRef.validate((valid) => {
if (valid) {
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post('/platform/dsznfmtx/apply/submitAgain', {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
if (res.code === 0) {
this.$message.success("提交成功")
commonUtil.pjaxPush('/platform/dsznfmtx/mine/index')
}
})
})
} else {
this.$message.error('请完善表单信息并勾选申报理由');
return false;
// 添加检查是否为退休人员的方法
async checkRetirementStatus() {
try {
const resp = await this.$axios.post('/platform/dsznfmtx/apply/checkRetirementStatus');
// 如果返回code为0且data为true,表示用户是退休人员
if (resp.code === 0 && resp.data === true) {
return true;
}
});
return false;
} catch (error) {
console.error('检查退休状态失败:', error);
return false;
}
},
// 检查用户是否已申请过
async checkUserApplication() {
try {
const resp = await this.$axios.post('/platform/dsznfmtx/apply/checkUserApplied');
// 如果返回code为0且data为true,表示用户已申请过
if (resp.code === 0 && resp.data === true) {
return true;
}
return false;
} catch (error) {
console.error('检查用户申请状态失败:', error);
return false;
}
},
// 提交
async onSubmit() {
// 检查是否为退休人员
const isRetired = await this.checkRetirementStatus();
if (!isRetired) {
this.$message.warning('您不是退休人员,无法申请此项福利');
return;
}
if (!this.bizId) {
const isApplied = await this.checkUserApplication();
if (isApplied) {
this.$message.warning('您已经提交过申请,不能重复申请');
return;
}
}
const isValid = await this.validateBeforeSubmit();
if (!isValid) return;
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post('/platform/dsznfmtx/apply/submit', {
data: JSON.stringify(this.formData)
}).then(res => {
if (res.code === 0) {
this.$message.success("提交成功")
commonUtil.pjaxPush('/platform/dsznfmtx/mine/index')
}
})
})
},
// 再次提交
async onFinishTask() {
const isValid = await this.validateBeforeSubmit();
if (!isValid) return;
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post('/platform/dsznfmtx/apply/submitAgain', {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
if (res.code === 0) {
this.$message.success("提交成功")
commonUtil.pjaxPush('/platform/dsznfmtx/mine/index')
}
})
})
},
async findOne(id) {
const resp = await $.get('/platform/dsznfmtx/apply/findOne', {id})
@@ -272,9 +325,7 @@ layout("/layouts/platform.html"){
sex: sex,
birthday: birthday,
}
}
}
},
created() {
@@ -284,6 +335,7 @@ layout("/layouts/platform.html"){
</script>
<!--#
}
#-->
@@ -86,7 +86,7 @@ layout("/layouts/platform.html"){
//分页数据
mixins: [initTableMixins],
components: {
"dsznfmtx-info": dsznfmtxInfo
"dsznfmtx-info": DSZNFMTX_INFO
},
data() {
return {
@@ -1,4 +1,4 @@
const dsznfmtxInfo = {
const DSZNFMTX_INFO = {
template: /*language=HTML*/ `
<div>
<div class="process-title">
@@ -17,7 +17,7 @@ const dsznfmtxInfo = {
<el-descriptions-item label="工作单位" :span="2">{{viewData.loverUnitName}}</el-descriptions-item>
<el-descriptions-item label="结婚日期">{{viewData.marryTime}}</el-descriptions-item>
<el-descriptions-item label="子女出生日">{{viewData.childrenBirthday}}</el-descriptions-item>
<el-descriptions-item label="领独生子女证时间">{{viewData.startTime}}</el-descriptions-item>
<el-descriptions-item label="领独生子女证时间">{{viewData.getCertificateTime}}</el-descriptions-item>
<el-descriptions-item label="独生子女光荣证号">{{viewData.childrenGraceNumber}}</el-descriptions-item>
<el-descriptions-item label="办证机关">{{viewData.office}}</el-descriptions-item>
<el-descriptions-item label="奖励金额">{{viewData.bonus}}</el-descriptions-item>
@@ -63,6 +63,12 @@ const dsznfmtxInfo = {
<el-descriptions-item label="办理意见" v-if="!task.ext.isFirstTaskNode">{{
task.taskFormData.opinion }}
</el-descriptions-item>
<el-descriptions-item label="签字" :span="3" v-if="!task.ext.isFirstTaskNode">
<el-image :src="task.ext.tf_userSign"
v-if="task.ext.tf_userSign"
class="signature-image"></el-image>
<span v-else>暂无</span>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
@@ -34,7 +34,7 @@ layout("/layouts/platform.html"){
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)" size="mini" type="primary">编辑</el-button>
<el-button v-if="row.canRevoke" @click="onRevoke(row)" size="mini" type="danger">撤回
</el-button>
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onDelete(row.id)" size="mini" type="danger">删除</el-button>
<el-button @click="onDelete(row.id)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
@@ -57,7 +57,7 @@ layout("/layouts/platform.html"){
//分页数据
mixins: [initTableMixins],
components: {
"dsznfmtx-info": dsznfmtxInfo
"dsznfmtx-info": DSZNFMTX_INFO
},
data() {
return {
@@ -88,6 +88,9 @@ layout("/layouts/platform.html"){
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
</el-form-item>
<el-form-item label="电子签名" prop="tf_userSign" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<pc-signature v-model="formData.tf_userSign"></pc-signature>
</el-form-item>
</el-form>
<el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()" size="small">取消</el-button>
@@ -99,6 +102,19 @@ layout("/layouts/platform.html"){
</dsznfmtx-info>
</template>
</guava>
<el-dialog title="输入奖励金额" :visible.sync="bonusDialogVisible" width="400px">
<el-form label-width="80px">
<el-form-item label="奖励金额">
<el-input v-model="bonusFormData.bonus" placeholder="请输入奖励金额">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelBonusInput">取 消</el-button>
<el-button type="primary" @click="confirmBonusInput">确 定</el-button>
</div>
</el-dialog>
</div>
@@ -111,7 +127,7 @@ layout("/layouts/platform.html"){
//分页数据
mixins: [initTableMixins],
components: {
"dsznfmtx-info": dsznfmtxInfo
"dsznfmtx-info": DSZNFMTX_INFO
},
data() {
return {
@@ -124,6 +140,13 @@ layout("/layouts/platform.html"){
unionOptions: [],
unitOptions: [],
userOptions: [],
// 奖励金额输入对话框相关数据
bonusDialogVisible: false,
bonusFormData: {
bonus: ''
},
currentRow: null,
currentSubmitType: null
}
}
,
@@ -140,6 +163,7 @@ layout("/layouts/platform.html"){
processTaskId: row.taskId,
taskName: row.curTaskName
}
this.currentRow = row;
this.$refs.dsznfmtxInfoRef.onOpen(row)
})
},
@@ -157,7 +181,77 @@ layout("/layouts/platform.html"){
})
})
},
// 显示奖励金额输入对话框
showBonusInputDialog(submitType) {
this.currentSubmitType = submitType;
this.bonusFormData.bonus = '';
this.bonusDialogVisible = true;
},
// 确认奖励金额输入并提交
confirmBonusInput() {
if (!this.bonusFormData.bonus) {
this.$message.warning('请输入奖励金额');
return;
}
// 验证金额格式
const bonusPattern = /^([0-9]*[.]{0,1}[0-9]{0,2})$/;
if (!bonusPattern.test(this.bonusFormData.bonus)) {
this.$message.warning('请输入有效的金额格式');
return;
}
this.bonusDialogVisible = false;
// 调用申请页面的保存方法来更新奖励金额
this.saveBonusAndApprove();
},
// 取消奖励金额输入
cancelBonusInput() {
this.bonusDialogVisible = false;
},
// 保存奖励金额并执行审批
// 保存奖励金额并执行审批
saveBonusAndApprove() {
// 先获取完整的申请数据
this.$axios.post('/platform/dsznfmtx/apply/findOne', {id: this.currentRow.id}).then(res => {
if (res.code === 0) {
// 获取完整的数据后,更新奖励金额
const fullData = res.data;
fullData.bonus = this.bonusFormData.bonus;
// 调用申请页面的保存方法,传递完整数据
this.$axios.post('/platform/dsznfmtx/apply/save', {data: JSON.stringify(fullData)}).then(saveRes => {
if (saveRes.code === 0) {
// 保存成功后执行审批操作
this.executeTaskAction(this.currentSubmitType);
} else {
this.$message.error(saveRes.msg || '保存奖励金额失败');
}
}).catch(error => {
this.$message.error('保存奖励金额失败');
console.error('保存奖励金额失败:', error);
});
} else {
this.$message.error(res.msg || '获取申请数据失败');
}
}).catch(error => {
this.$message.error('获取申请数据失败');
console.error('获取申请数据失败:', error);
});
},
handleTaskAction(val) {
// 如果是同意申请操作(val=1),需要先输入奖励金额
if (val === 1) {
this.showBonusInputDialog(val);
return;
}
// 其他操作直接执行
this.executeTaskAction(val);
},
// 执行任务操作
executeTaskAction(val) {
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -170,9 +264,9 @@ layout("/layouts/platform.html"){
})
}).then((res) => {
if (res.code === 0) {
this.$refs.guava.index()
this.$message.success(res.msg)
this.doSearch()
this.$refs.guava.index();
this.$message.success(res.msg);
this.doSearch();
}
})
})
@@ -86,6 +86,9 @@ layout("/layouts/platform.html"){
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
</el-form-item>
<el-form-item label="电子签名" prop="tf_userSign" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<pc-signature v-model="formData.tf_userSign"></pc-signature>
</el-form-item>
</el-form>
<el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()" size="small">取消</el-button>
@@ -109,7 +112,7 @@ layout("/layouts/platform.html"){
//分页数据
mixins: [initTableMixins],
components: {
"dsznfmtx-info": dsznfmtxInfo
"dsznfmtx-info": DSZNFMTX_INFO
},
data() {
return {
@@ -111,12 +111,8 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="合计天数" span="2">{{formData.leaveDays}}
</el-descriptions-item>
</el-descriptions>
<table-tool label="休假时间"></table-tool>
<el-descriptions :column="2" border>
<el-descriptions-item label="休假时间起">
<el-form-item label="休假时间起" prop="startTime">
<el-date-picker type="date"
@@ -172,7 +168,16 @@ layout("/layouts/platform.html"){
bizId: GetQueryString("bizId"),
taskId: GetQueryString("taskId"),
formData: {},
formRules: {},
formRules: {
loverName: [{ required: true, message: '请输入爱人姓名', trigger: 'blur' }],
loverSex: [{ required: true, message: '请选择爱人性别', trigger: 'change' }],
loverNation: [{ required: true, message: '请选择爱人民族', trigger: 'change' }],
loverBirthday: [{ required: true, message: '请选择爱人出生年月', trigger: 'change' }],
loverUnitName: [{ required: true, message: '请输入爱人工作单位', trigger: 'blur' }],
startTime: [{ required: true, message: '请选择休假开始时间', trigger: 'change' }],
endTime: [{ required: true, message: '请选择休假结束时间', trigger: 'change' }],
childrenBirthday: [{ required: true, message: '请选择子女出生日期', trigger: 'change' }]
},
}
},
computed: {
@@ -216,8 +221,24 @@ layout("/layouts/platform.html"){
})
})
},
// 提交验证
validateBeforeSubmit() {
return new Promise((resolve) => {
this.$refs.formRef.validate((valid) => {
if (valid) {
resolve(true);
} else {
this.$message.error('请完善必填信息');
resolve(false);
}
});
});
},
// 提交
onSubmit() {
async onSubmit() {
const isValid = await this.validateBeforeSubmit();
if (!isValid) return;
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -234,7 +255,10 @@ layout("/layouts/platform.html"){
})
},
// 再次提交
onFinishTask() {
async onFinishTask() {
const isValid = await this.validateBeforeSubmit();
if (!isValid) return;
this.$confirm("您确定要提交吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
@@ -289,6 +313,7 @@ layout("/layouts/platform.html"){
</script>
<!--#
}
#-->
@@ -42,11 +42,8 @@ const maternityLeaveInfo = {
</el-descriptions-item>
<el-descriptions-item label="寒假">{{viewData.winterLeave}}</el-descriptions-item>
<el-descriptions-item label="暑假">{{viewData.summerLeave}}</el-descriptions-item>
<el-descriptions-item label="合计">{{viewData.leaveDays}}</el-descriptions-item>
</el-descriptions>
<el-descriptions-item label="合计" :span="2">{{viewData.leaveDays}}</el-descriptions-item>
<table-tool label="休假时间"></table-tool>
<el-descriptions :column="2" border class="flow-task-form">
<el-descriptions-item label="休假时间起">{{viewData.startTime}}</el-descriptions-item>
<el-descriptions-item label="休假时间止">{{viewData.endTime}}</el-descriptions-item>
<el-descriptions-item label="子女出生日">{{viewData.childrenBirthday}}</el-descriptions-item>
@@ -76,9 +73,15 @@ const maternityLeaveInfo = {
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</el-descriptions-item>
<el-descriptions-item label="办理意见" v-if="!task.ext.isFirstTaskNode">{{
<el-descriptions-item label="办理意见" :span="3" v-if="!task.ext.isFirstTaskNode">{{
task.taskFormData.opinion }}
</el-descriptions-item>
<el-descriptions-item label="签字" :span="3" v-if="!task.ext.isFirstTaskNode">
<el-image :src="task.ext.tf_userSign"
v-if="task.ext.tf_userSign"
class="signature-image"></el-image>
<span v-else>暂无</span>
</el-descriptions-item>
</el-descriptions>
</div>
</template>
@@ -87,6 +87,9 @@ layout("/layouts/platform.html"){
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
</el-form-item>
<el-form-item label="电子签名" prop="tf_userSign" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<pc-signature v-model="formData.tf_userSign"></pc-signature>
</el-form-item>
</el-form>
<el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()" size="small">取消</el-button>
@@ -86,6 +86,9 @@ layout("/layouts/platform.html"){
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<user-opinion-textarea v-model="formData.tf_opinion"></user-opinion-textarea>
</el-form-item>
<el-form-item label="电子签名" prop="tf_userSign" :rules="[{required:true,message:'必填',trigger:['change','blur']}]">
<pc-signature v-model="formData.tf_userSign"></pc-signature>
</el-form-item>
</el-form>
<el-row type="flex" justify="end">
<el-button @click="$refs.guava.index()" size="small">取消</el-button>
@@ -128,6 +131,7 @@ layout("/layouts/platform.html"){
methods: {
onView(row) {
this.$refs.guava.view(()=>{
this.showApprovalForm = false;
this.$refs.maternityLeaveInfoRef.onOpen(row)
})
},
@@ -180,7 +180,7 @@ layout("/layouts/platform.html"){
if (!changeTypesList || changeTypesList.length === 0 || !this.changeTypeData || this.changeTypeData.length === 0) return null
return changeTypesList
.map((v) => {
return this.changeTypeData.find((item) => item.name === v).changeTypeName
return this.changeTypeData.find((item) => item.code === v).changeTypeName
})
.join(",")
}
@@ -270,7 +270,7 @@ layout("/layouts/platform.html"){
if (!changeTypesList || changeTypesList.length === 0 || !this.changeTypeData || this.changeTypeData.length === 0) return null
return changeTypesList
.map((v) => {
return this.changeTypeData.find((item) => item.name === v).changeTypeName
return this.changeTypeData.find((item) => item.code === v).changeTypeName
})
.join(",")
}
@@ -134,7 +134,7 @@ layout("/layouts/platform.html"){
if (!changeTypesList || changeTypesList.length === 0 || !this.changeTypeData || this.changeTypeData.length === 0) return null
return changeTypesList
.map((v) => {
return this.changeTypeData.find((item) => item.name === v).changeTypeName
return this.changeTypeData.find((item) => item.code === v).changeTypeName
})
.join(",")
}
@@ -156,7 +156,7 @@ layout("/layouts/platform.html"){
if (!changeTypesList || changeTypesList.length === 0 || !this.changeTypeData || this.changeTypeData.length === 0) return null
return changeTypesList
.map((v) => {
return this.changeTypeData.find((item) => item.name === v).changeTypeName
return this.changeTypeData.find((item) => item.code === v).changeTypeName
})
.join(",")
}
@@ -182,7 +182,7 @@ layout("/layouts/platform.html"){
if (!changeTypesList || changeTypesList.length === 0 || !this.changeTypeData || this.changeTypeData.length === 0) return null
return changeTypesList
.map((v) => {
return this.changeTypeData.find((item) => item.name === v).changeTypeName
return this.changeTypeData.find((item) => item.code === v).changeTypeName
})
.join(",")
}
@@ -217,7 +217,7 @@ layout("/layouts/platform.html"){
if (!changeTypesList || changeTypesList.length === 0 || !this.changeTypeData || this.changeTypeData.length === 0) return null
return changeTypesList
.map((v) => {
return this.changeTypeData.find((item) => item.name === v).changeTypeName
return this.changeTypeData.find((item) => item.code === v).changeTypeName
})
.join(",")
}
@@ -24,6 +24,11 @@ layout("/layouts/platform_h5.html"){
.van-count-down {
color: #fff;
}
.item-header .van-tag {
font-size: 12px;
padding: 3px 6px;
border-radius: 6px;
}
</style>
<div id="app">
@@ -40,10 +45,25 @@ layout("/layouts/platform_h5.html"){
<table-list api="/platform/family/apply/activityPageData"
:page_form.sync="pageForm"
ref="tableListRef"
title="activityName"
img="cover"
@ready="onReady"
>
<template #header="{index,row}">
<div class="item-header">
<div class="item-title">{{ row.activityName }}</div>
<div>
<van-tag type="primary" v-if="$moment().isBefore($moment(row.activitySignUpStartTime))">
即将开始
</van-tag>
<van-tag type="success" v-if="$moment().isAfter($moment(row.activitySignUpStartTime)) && $moment().isBefore($moment(row.activitySignUpEndTime))">
进行中
</van-tag>
<van-tag class="grey" v-if="$moment().isAfter($moment(row.activitySignUpEndTime))">
已结束
</van-tag>
</div>
</div>
</template>
<template v-slot="{index,row}">
<table-column label="面向对象">{{row.activityGroupName}}</table-column>
<table-column label="报名时间">
@@ -54,14 +74,16 @@ layout("/layouts/platform_h5.html"){
</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看介绍</span>
</div>
<div class="action-btn" @click="onApply(row)">
<i class="fa fa-edit"></i>
<span>去报名</span>
</div>
<template v-if="$moment().isBefore($moment(row.activitySignUpEndTime))">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看介绍</span>
</div>
<div class="action-btn" @click="onApply(row)">
<i class="fa fa-edit"></i>
<span>去报名</span>
</div>
</template>
</template>
</table-list>
@@ -105,12 +127,11 @@ layout("/layouts/platform_h5.html"){
totalCount: 0,
searchKeyword: '',
year: new Date().getFullYear(),
activityType: 4,
activityType: 2,
},
typeOptions: [
{text: '全部', value: 1},
{text: '即将开始', value: 4},
{text: '报名中', value: 2},
{text: '即将开始 & 报名中', value: 2},
{text: '已结束', value: 3},
],
infoVisible: false,
@@ -271,6 +271,7 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, "sex", user.sex)
this.$set(this.formData, "birthday", user.birthday ? this.$moment(user.birthday).format('YYYY-MM-DD') : '')
this.$set(this.formData, "nation", user.nation)
this.$set(this.formData, "mobile", user.mobile)
this.$set(this.formData, "political", user.political)
this.$set(this.formData, "education", user.education)
this.$set(this.formData, "technicalTitle", user.technicalTitle)
@@ -180,6 +180,8 @@ const apply = {
this.$set(this.formData, "sex", this.$store.state.user.sex)
this.$set(this.formData, "siteId", this.row.id)
this.$set(this.formData, "applyTime", this.selected.startTime + '-' + this.selected.endTime)
this.$set(this.formData, "startTime", this.selected.startTime)
this.$set(this.formData, "endTime", this.selected.endTime)
if (this.row.reserveTarget === 1 || this.row.reserveTarget === 3) {
this.$set(this.formData, "joinCount", this.row.maxNum)
} else {
@@ -5,6 +5,9 @@ layout("/layouts/platform_h5.html"){
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="报销统计" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
<van-search
:reverse-color="false"
:show-action="false"
@@ -13,9 +16,6 @@ layout("/layouts/platform_h5.html"){
placeholder="请输入经办人搜索"
v-model="pageForm.userName"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
@@ -0,0 +1,378 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style>
.signature-image {
max-width: 200px;
max-height: 100px;
}
</style>
<div id="app" v-cloak>
<van-nav-bar title="独生子女父母退休申请" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed z-index="999"
class="custom-nav"></van-nav-bar>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="人员信息" class="form-section">
<van-field label="职工姓名" v-model="formData.userName" placeholder="从信息中心获取"
readonly></van-field>
<van-field label="性别" v-model="formData.sex" placeholder="从信息中心获取" readonly></van-field>
<van-field label="出生年月" v-model="formData.birthday" placeholder="从信息中心获取"
readonly></van-field>
<van-field label="原工作单位" v-model="formData.unitName" placeholder="从信息中心获取"
readonly></van-field>
<van-field label="退休时间"
v-model="formData.retireTime"
placeholder="请选择退休时间"
readonly
@click="showDatePicker('retireTime')"
clickable
required
></van-field>
<van-field label="爱人姓名" v-model="formData.loverName" placeholder="请输入爱人姓名" required></van-field>
<van-field
v-model="formData.loverSex"
name="loverSex"
label="性别"
readonly
placeholder="请选择性别"
@click="showLoverSexPicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showLoverSexPicker">
<van-picker :columns="loverSexColumns" @cancel="showLoverSexPicker = false"
@confirm="onLoverSexConfirm" show-toolbar ></van-picker>
</van-popup>
<van-field label="工作单位" v-model="formData.loverUnitName" placeholder="请输入工作单位" required></van-field>
<van-field label="结婚日期"
v-model="formData.marryTime"
placeholder="请选择结婚日期"
readonly
@click="showDatePicker('marryTime')"
clickable
required
></van-field>
<van-field label="子女出生日"
v-model="formData.childrenBirthday"
placeholder="请选择子女出生日"
readonly
@click="showDatePicker('childrenBirthday')"
clickable
required
></van-field>
<van-field label="领独生子女证日"
v-model="formData.getCertificateTime"
placeholder="请选择日期"
readonly
@click="showDatePicker('getCertificateTime')"
clickable
required
></van-field>
<van-field label="独生子女光荣证号" v-model="formData.childrenGraceNumber" placeholder="请输入独生子女光荣证号" required></van-field>
<van-field label="办证机关" v-model="formData.office" placeholder="请输入办证机关" required></van-field>
<van-field class="more-text" name="honorFiles"
label="独生子女父母光荣证" required>
<template #input>
<h5-file-upload
slot="input"
:value.sync="formData.honorFiles"
:upload_number="10"
upload_mode="file"
upload_result_category="array"
upload_result_type="url"
complete_result
></h5-file-upload>
</template>
</van-field>
<van-field class="more-text" name="retireFiles"
label="退休证" required>
<template #input>
<h5-file-upload
slot="input"
:value.sync="formData.retireFiles"
:upload_number="10"
upload_mode="file"
upload_result_category="array"
upload_result_type="url"
complete_result
></h5-file-upload>
</template>
</van-field>
<van-field class="more-text" name="sign" label="">
<template #input>
<h5-signature v-model="formData.sign" slot="input"></h5-signature>
</template>
</van-field>
</van-cell-group>
<van-field name="declarationAgreed" class="declaration-checkbox">
<template #input>
<van-checkbox v-model="formData.declarationAgreed" checked-color="#ee0a24">
我已阅读并同意以下声明
</van-checkbox>
</template>
</van-field>
<van-cell class="declaration-text">
根据《河北省人口与计划生育条例》第四章第三十四条第四款"独生子女父母是国家工作人员、企事业单位员工的,退休时分别给予不低于三千元一次性奖励"的规定。<br/>
说明:1. 本人应如实填写各项情况。2. 申报时需持《独生子女父母光荣证》、《退休证》原件及其复印件各一份。
</van-cell>
</van-cell-group>
<!-- 日期选择器弹窗 -->
<van-popup position="bottom" round v-model:show="showDatePopup">
<van-datetime-picker
type="date"
:min-date="minDate"
:max-date="maxDate"
@confirm="onDateConfirm"
@cancel="showDatePopup = false"
show-toolbar
/>
</van-popup>
<!-- 提交按钮 -->
<div class="form-actions">
<van-button plain @click="onSave" type="info">保存</van-button>
<van-button @click="onSubmit" type="primary" v-if="!taskId">提交</van-button>
<van-button @click="onSubmitAgain" type="primary" v-else>提交1</van-button>
</div>
</van-form>
</div>
</div>
<script>
new Vue({
store,
el: '#app',
dicts: ["USER_NATION"],
data() {
return {
bizId: GetQueryString("bizId"),
taskId: GetQueryString("taskId"),
formData: {},
// 性别选择器
showLoverSexPicker: false,
loverSexColumns: [
{ value: '男性', text: '男性' },
{ value: '女性', text: '女性' }
],
// 日期选择器
showDatePopup: false,
currentDatePickerField: '', // 当前正在选择日期的字段名
minDate: new Date(1950, 0, 1),
maxDate: new Date(2040, 11, 31)
}
},
methods: {
// 显示日期选择器
showDatePicker(fieldName) {
this.currentDatePickerField = fieldName;
this.showDatePopup = true;
},
// 日期确认事件
onDateConfirm(value) {
const formattedDate = this.$moment(value).format("YYYY-MM-DD");
this.$set(this.formData, this.currentDatePickerField, formattedDate);
this.showDatePopup = false;
},
async onSave() {
// 保存时不需要验证,直接提交数据
this.$axios.post("/platform/dsznfmtx/apply/save", {data: JSON.stringify(this.formData)})
.then((res) => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success(res.msg);
pjaxReplace('/platform/dsznfmtx/mine/h5')
} else {
this.$toast.fail(res.msg || '保存失败');
}
})
.catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
},
// 提交前进行表单验证
async validateForm() {
const errors = [];
// 必填字段验证
if (!this.formData.retireTime) {
errors.push('请选择退休时间');
}
if (!this.formData.loverName) {
errors.push('请输入爱人姓名');
}
if (!this.formData.loverSex) {
errors.push('请选择爱人性别');
}
if (!this.formData.loverUnitName) {
errors.push('请输入爱人工作单位');
}
if (!this.formData.marryTime) {
errors.push('请选择结婚日期');
}
if (!this.formData.childrenBirthday) {
errors.push('请选择子女出生日');
}
if (!this.formData.getCertificateTime) {
errors.push('请选择领独生子女证日');
}
if (!this.formData.childrenGraceNumber) {
errors.push('请输入独生子女光荣证号');
}
if (!this.formData.office) {
errors.push('请输入办证机关');
}
if (!this.formData.honorFiles || this.formData.honorFiles.length === 0) {
errors.push('请上传独生子女父母光荣证');
}
if (!this.formData.retireFiles || this.formData.retireFiles.length === 0) {
errors.push('请上传退休证');
}
if (!this.formData.sign) {
errors.push('请签字');
}
if (!this.formData.declarationAgreed) {
errors.push('请阅读并同意声明');
}
return errors;
},
// 添加检查是否为退休人员的方法
async checkRetirementStatus() {
try {
const resp = await this.$axios.post('/platform/dsznfmtx/apply/checkRetirementStatus');
// 如果返回code为0且data为true,表示用户是退休人员
if (resp.code === 0 && resp.data === true) {
return true;
}
return false;
} catch (error) {
console.error('检查退休状态失败:', error);
return false;
}
},
// 检查用户是否已申请过
async checkUserApplication() {
try {
const resp = await this.$axios.post('/platform/dsznfmtx/apply/checkUserApplied');
// 如果返回code为0且data为true,表示用户已申请过
if (resp.code === 0 && resp.data === true) {
return true;
}
return false;
} catch (error) {
console.error('检查用户申请状态失败:', error);
return false;
}
},
// 提交
async onSubmit() {
// 检查是否为退休人员
const isRetired = await this.checkRetirementStatus();
if (!isRetired) {
this.$message.warning('您不是退休人员,无法申请此项福利');
return;
}
if (!this.bizId) {
const isApplied = await this.checkUserApplication();
if (isApplied) {
this.$message.warning('您已经提交过申请,不能重复申请');
return;
}
}
// 提交时进行表单验证
const errors = await this.validateForm();
if (errors.length > 0) {
this.$toast.fail(errors[0]); // 显示第一条错误信息
return;
}
this.$axios.post('/platform/dsznfmtx/apply/submit', {data: JSON.stringify(this.formData)})
.then(res => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success("提交成功");
pjaxReplace('/platform/dsznfmtx/mine/h5')
} else {
this.$toast.fail(res.msg || '提交失败');
}
})
.catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
},
// 再次提交
async onSubmitAgain() {
// 提交时进行表单验证
const errors = await this.validateForm();
if (errors.length > 0) {
this.$toast.fail(errors[0]); // 显示第一条错误信息
return;
}
this.$axios.post('/platform/dsznfmtx/apply/submitAgain', {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success("提交成功");
setTimeout(() => {
pjaxReplace('/platform/dsznfmtx/mine/h5')
}, 1500);
} else {
this.$toast.fail(res.msg || '提交失败');
}
}).catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
},
// 添加性别确认方法
onLoverSexConfirm(o) {
this.$set(this.formData, "loverSex", o.text);
this.showLoverSexPicker = false;
},
init() {
this.bizId = GetQueryString("bizId")
if (this.bizId) {
this.$axios.post("/platform/dsznfmtx/apply/findOne", {id: this.bizId}).then((res) => {
if (res.code === 0) {
this.formData = res.data;
}
})
} else {
const user = this.$store.state.user
this.$set(this.formData, "userId", user.id)
this.$set(this.formData, "userName", user.username)
this.$set(this.formData, "loginName", user.loginname)
this.$set(this.formData, "unitId", user.unitId)
this.$set(this.formData, "unitName", user.unit.name)
this.$set(this.formData, "unionId", user.union.id)
this.$set(this.formData, "unionName", user.union.name)
this.$set(this.formData, "sex", user.sex)
this.$set(this.formData, "birthday", user.birthday)
}
}
},
async created() {
await this.init();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,127 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="查询统计" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入职工姓名搜索"
v-model="pageForm.userName"
></van-search>
</van-sticky>
<table-list api="/platform/dsznfmtx/collect/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="退休时间">{{row.retireTime}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.taskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn delete" @click="onDelete(row)" v-if="$auth.hasRole('SYSADMIN')">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<dsznfmtx-info ref="dsznfmtxInfoRef"></dsznfmtx-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"dsznfmtx-info":DSZNFMTX_INFO
},
data() {
return {
viewShow: false,
yearList: [],
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
year: "",
},
infoShow: false
}
},
methods: {
onView(row) {
this.showApprovalForm = false
this.$refs.dsznfmtxInfoRef.onOpen(row)
},
onRevoke(row){
this.$dialog
.confirm({
title: "提示",
message: "您确定要撤销申请吗?"
})
.then(() => {
this.$axios.post("/flow/common/revokeTask", {taskId: row.startTaskId}).then((resp) => {
this.$toast.success(resp.msg)
this.doSearch()
})
})
},
onDelete(row) {
this.$dialog
.confirm({
title: "提示",
message: "您确定要删除吗?"
})
.then(() => {
this.$axios.post("/platform/dsznfmtx/mine/delete", {id: row.id}).then((resp) => {
if (resp.code === 0) {
this.$toast.success(resp.msg)
this.doSearch()
}
})
})
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
initData() {
for (let i = new Date().getFullYear() - 10; i <= new Date().getFullYear(); i++) {
this.yearList.unshift({value: i, text: i + "年"})
}
this.$set(this.pageForm, "year", this.yearList[0].value)
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,123 @@
const DSZNFMTX_INFO = {
template:
/*language=HTML*/`
<van-action-sheet v-model="visible" title="查看详情">
<div class="detail-container">
<van-cell-group title="基本信息">
<van-cell title="职工姓名">{{ viewData.userName }}</van-cell>
<van-cell title="性别">{{ viewData.sex }}</van-cell>
<van-cell title="出生年月">{{ viewData.birthday }}</van-cell>
<van-cell title="原工作单位">{{ viewData.unitName }}</van-cell>
<van-cell title="退休时间">{{ viewData.retireTime }}</van-cell>
<van-cell title="爱人姓名">{{ viewData.loverName }}</van-cell>
<van-cell title="性别">{{ viewData.loverSex }}</van-cell>
<van-cell title="工作单位">{{ viewData.loverUnitName }}</van-cell>
<van-cell title="结婚日期">{{ viewData.loverBirthday }}</van-cell>
<van-cell title="子女出生日">{{ viewData.loverBirthday }}</van-cell>
<van-cell title="领独生子女光时间">{{ viewData.getCertificateTime }}</van-cell>
<van-cell title="独生子女光荣证号">{{ viewData.childrenGraceNumber }}</van-cell>
<van-cell title="办证机关">{{ viewData.office }}</van-cell>
<van-cell title="奖励金额">{{ viewData.bonus }}</van-cell>
<van-cell title="独生子女父母光荣证">
<file-preview :files="viewData.honorFiles" complete_result></file-preview>
</van-cell>
<van-cell title="退休证">
<file-preview :files="viewData.retireFiles" complete_result></file-preview>
</van-cell>
<van-cell title="签字" >
<van-image :src="viewData.sign"
v-if="viewData.sign"
class="signature-image"></van-image>
</van-cell>
</van-cell-group>
<template v-for="(task,index) in doneTasks">
<div class="process-title">
{{ task.displayName }}
</div>
<van-cell-group v-if="task.ext.isFirstTaskNode">
<van-cell title="申请用户">
{{ task.ext.initiatorName}}({{task.ext.initiatorAccount}})
</van-cell>
<van-cell title="申请时间">
{{ task.finishTime}}
</van-cell>
<van-cell title="办理结果">
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</van-cell>
</van-cell-group>
<van-cell-group v-else>
<van-cell title="办理用户">
{{ task.taskFormData.userName}}({{task.taskFormData.loginName}})
</van-cell>
<van-cell title="办理时间">
{{ task.finishTime}}
</van-cell>
<van-cell title="办理结果">
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</van-cell>
<van-cell title="办理意见" v-if="!task.ext.isFirstTaskNode">
<template #label>
{{
task.taskFormData.opinion
}}
</template>
</van-cell>
<van-cell title="签字" v-if="!task.ext.isFirstTaskNode">
<van-image :src="task.ext.tf_userSign"
v-if="task.ext.tf_userSign"
class="signature-image"></van-image>
</van-cell>
</van-cell-group>
</template>
</div>
<slot></slot>
</van-action-sheet>
`,
dicts: ["PROCESS_TASK_SUBMIT_TYPE"],
data() {
return {
visible:false,
viewData: {},
doneTasks: [],
row: null,
}
},
methods: {
onOpen(row) {
this.row = row
this.visible = true
this.getInfo()
this.getDoneTasks()
},
// 关闭
onClose(){
this.visible = false
},
// 获取申请信息
getInfo() {
this.$axios.post("/platform/dsznfmtx/apply/findOne", {id: this.row.id}).then((res) => {
if (res.code === 0) {
this.viewData = res.data
}
})
},
// 查看
openView(id) {
this.$nextTick(() => {
this.$refs.infoDialogRef.onOpen(id)
})
},
// 获取已办任务审批记录
getDoneTasks() {
this.$axios.post("/flow/common/doneTasks", {bizId: this.row.id}).then((res) => {
if (res.code === 0) {
this.doneTasks = res.data
}
})
},
},
}
@@ -0,0 +1,134 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="我的申请" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/dsznfmtx/mine/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="退休时间">{{row.retireTime}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.taskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)" v-if="row.taskKey === 'startTask' || !row.instanceId">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" v-if="row.canRevoke" @click="onRevoke(row)">
<i class="fa fa-undo"></i>
<span>撤回</span>
</div>
<div class="action-btn delete" @click="onDelete(row)" v-if="row.taskKey === 'startTask' || !row.instanceId">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<dsznfmtx-info ref="dsznfmtxInfoRef"></dsznfmtx-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"dsznfmtx-info":DSZNFMTX_INFO
},
data() {
return {
viewShow: false,
yearList: [],
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
year: "",
},
infoShow: false
}
},
methods: {
onView(row) {
this.showApprovalForm = false
this.$refs.dsznfmtxInfoRef.onOpen(row)
},
onEdit(row) {
this.$pjaxReplace('/platform/dsznfmtx/apply/h5?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id)
},
onRevoke(row){
this.$dialog
.confirm({
title: "提示",
message: "您确定要撤销申请吗?"
})
.then(() => {
this.$axios.post("/flow/common/revokeTask", {taskId: row.startTaskId}).then((resp) => {
this.$toast.success(resp.msg)
this.doSearch()
})
})
},
onDelete(row) {
this.$dialog
.confirm({
title: "提示",
message: "您确定要删除吗?"
})
.then(() => {
this.$axios.post("/platform/dsznfmtx/mine/delete", {id: row.id}).then((resp) => {
if (resp.code === 0) {
this.$toast.success(resp.msg)
this.doSearch()
}
})
})
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
initData() {
for (let i = new Date().getFullYear() - 10; i <= new Date().getFullYear(); i++) {
this.yearList.unshift({value: i, text: i + "年"})
}
this.$set(this.pageForm, "year", this.yearList[0].value)
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,257 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="校工会审核" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入职工姓名搜索"
v-model="pageForm.userName"
></van-search>
<van-tabs v-model="pageForm.approvalText"
@change="(val)=>{this.pageForm.approval = val==='1';this.doSearch();}">
<van-tab title="已审核" name="1"></van-tab>
<van-tab title="未审核" name="0"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/dsznfmtx/schoolAudit/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="奖励金额">{{row.bonus}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.curTaskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" v-if="row.taskState === 10" @click="onAudit(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
</div>
</template>
</table-list>
<dsznfmtx-info ref="dsznfmtxInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">
校工会审核
</div>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="审批意见">
<van-field label=""
:rules="[{ required: true,message:'请填审批意见' }]"
v-model="formData.tf_opinion"
required
type="textarea"
name="tf_opinion"
rows="4"
autosize
class="more-text"
placeholder="请填审批意见"></van-field>
</van-cell-group>
<van-cell-group title="电子签名" class="form-section">
<van-field class="more-text" name="tf_userSign" label="">
<template #input>
<h5-signature v-model="formData.tf_userSign" slot="input"></h5-signature>
</template>
</van-field>
</van-cell-group>
<!-- 按钮区域 -->
<div class="form-actions">
<van-button type="danger" @click="handleTaskAction(6)">退回到发起人</van-button>
<van-button type="danger" @click="handleTaskAction(2)">拒绝申请</van-button>
<van-button type="primary" @click="handleTaskAction(1)">同意申请</van-button>
</div>
</van-form>
</div>
</div>
</dsznfmtx-info>
<!-- 奖励金额输入弹窗 -->
<van-dialog v-model="bonusDialogVisible" title="输入奖励金额" show-cancel-button
@confirm="confirmBonusInput" @cancel="cancelBonusInput">
<van-field v-model="bonusFormData.bonus" placeholder="请输入奖励金额" type="number">
<template #right-icon>
<span></span>
</template>
</van-field>
</van-dialog>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"dsznfmtx-info":DSZNFMTX_INFO
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
approvalText: "0",
approval: false,
year: new Date().getFullYear(),
},
formData: {},
showApprovalForm: false,
infoShow: false,
// 奖励金额输入弹窗相关数据
bonusDialogVisible: false,
bonusFormData: {
bonus: ''
},
currentRow: null,
currentSubmitType: null
}
},
methods: {
// 显示奖励金额输入弹窗
showBonusInputDialog(submitType) {
this.currentSubmitType = submitType;
this.bonusFormData.bonus = '';
this.bonusDialogVisible = true;
},
// 确认奖励金额输入
confirmBonusInput() {
if (!this.bonusFormData.bonus) {
this.$toast.fail('请输入奖励金额');
return false; // 阻止弹窗关闭
}
// 验证金额格式
const bonusPattern = /^([0-9]*[.]{0,1}[0-9]{0,2})$/;
if (!bonusPattern.test(this.bonusFormData.bonus)) {
this.$toast.fail('请输入有效的金额格式');
return false; // 阻止弹窗关闭
}
this.bonusDialogVisible = false;
// 保存奖励金额并执行审批操作
this.saveBonusAndApprove();
return true; // 允许弹窗关闭
},
// 取消奖励金额输入
cancelBonusInput() {
this.bonusDialogVisible = false;
},
// 保存奖励金额并执行审批
saveBonusAndApprove() {
// 先获取完整的申请数据
this.$axios.post('/platform/dsznfmtx/apply/findOne', {id: this.currentRow.id}).then(res => {
if (res.code === 0) {
// 获取完整的数据后,更新奖励金额
const fullData = res.data;
fullData.bonus = this.bonusFormData.bonus;
// 调用申请页面的保存方法,传递完整数据
this.$axios.post('/platform/dsznfmtx/apply/save', {data: JSON.stringify(fullData)}).then(saveRes => {
if (saveRes.code === 0) {
// 保存成功后执行审批操作
this.executeTaskAction(this.currentSubmitType);
} else {
this.$toast.fail(saveRes.msg || '保存奖励金额失败');
}
}).catch(error => {
this.$toast.fail('保存奖励金额失败');
console.error('保存奖励金额失败:', error);
});
} else {
this.$toast.fail(res.msg || '获取申请数据失败');
}
}).catch(error => {
this.$toast.fail('获取申请数据失败');
console.error('获取申请数据失败:', error);
});
},
// 执行任务操作
executeTaskAction(val) {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要提交吗?',
}).then(() => {
this.$axios.post('/flow/common/executeTask', {
data: JSON.stringify({
...this.formData,
submitType: val
})
}).then(res => {
if (res.code === 0) {
this.$toast.success("提交成功")
this.doSearch()
this.$refs.dsznfmtxInfoRef.onClose()
}
})
}).catch(() => {
// on cancel
});
}).catch();
},
handleTaskAction(val) {
// 如果是同意申请操作(val=1),需要先输入奖励金额
if (val === 1) {
this.showBonusInputDialog(val);
return;
}
// 其他操作直接执行
this.executeTaskAction(val);
},
onView(row) {
this.showApprovalForm = false
this.$refs.dsznfmtxInfoRef.onOpen(row)
},
onAudit(row) {
this.showApprovalForm = true
this.currentRow = row;
this.formData = {
tf_opinion: null,
tf_userSign: null,
processTaskId: row.taskId,
taskName: row.curTaskName
}
this.$refs.dsznfmtxInfoRef.onOpen(row)
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
},
created() {
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,167 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="分工会审核" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入职工姓名搜索"
v-model="pageForm.userName"
></van-search>
<van-tabs v-model="pageForm.approvalText"
@change="(val)=>{this.pageForm.approval = val==='1';this.doSearch();}">
<van-tab title="已审核" name="1"></van-tab>
<van-tab title="未审核" name="0"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/dsznfmtx/unionAudit/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="退休时间">{{row.retireTime}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.curTaskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" v-if="row.taskState === 10" @click="onAudit(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
</div>
</template>
</table-list>
<dsznfmtx-info ref="dsznfmtxInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">
分工会审核
</div>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="审批意见">
<van-field label=""
:rules="[{ required: true,message:'请填审批意见' }]"
v-model="formData.tf_opinion"
required
type="textarea"
name="tf_opinion"
rows="4"
autosize
class="more-text"
placeholder="请填审批意见"></van-field>
</van-cell-group>
<van-cell-group title="电子签名" class="form-section">
<van-field class="more-text" name="tf_userSign" label="">
<template #input>
<h5-signature v-model="formData.tf_userSign" slot="input"></h5-signature>
</template>
</van-field>
</van-cell-group>
<!-- 按钮区域 -->
<div class="form-actions">
<van-button type="danger" @click="handleTaskAction(6)">退回到发起人</van-button>
<van-button type="danger" @click="handleTaskAction(2)">拒绝申请</van-button>
<van-button type="primary" @click="handleTaskAction(1)">同意申请</van-button>
</div>
</van-form>
</div>
</div>
</dsznfmtx-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"dsznfmtx-info":DSZNFMTX_INFO
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
approvalText: "0",
approval: false,
year: new Date().getFullYear(),
},
formData: {},
showApprovalForm: false,
infoShow: false
}
},
methods: {
handleTaskAction(val) {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要提交吗?',
}).then(() => {
this.$axios.post('/flow/common/executeTask', {
data: JSON.stringify({
...this.formData,
submitType: val
})
}).then(res => {
if (res.code === 0) {
this.$toast.success("提交成功")
this.doSearch()
this.$refs.dsznfmtxInfoRef.onClose()
}
})
}).catch(() => {
// on cancel
});
}).catch();
},
onView(row) {
this.showApprovalForm = false
this.$refs.dsznfmtxInfoRef.onOpen(row)
},
onAudit(row) {
this.showApprovalForm = true
this.formData = {
tf_opinion: null,
tf_userSign: null,
processTaskId: row.taskId,
taskName: row.curTaskName
}
this.$refs.dsznfmtxInfoRef.onOpen(row)
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
},
created() {
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,465 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<van-nav-bar title="生育休假申请" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed z-index="999"
class="custom-nav"></van-nav-bar>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="人员信息" class="form-section">
<van-field label="职工姓名" v-model="formData.userName" placeholder="从信息中心获取"
readonly></van-field>
<van-field label="性别" v-model="formData.sex" placeholder="从信息中心获取" readonly></van-field>
<van-field label="民族" v-model="formData.nation" placeholder="从信息中心获取" readonly></van-field>
<van-field label="出生年月" v-model="formData.birthday" placeholder="从信息中心获取"
readonly></van-field>
<van-field label="工作单位" v-model="formData.unitName" placeholder="从信息中心获取"
readonly></van-field>
<van-field label="电话" v-model="formData.mobile" placeholder="从信息中心获取" readonly></van-field>
<van-field label="爱人姓名" v-model="formData.loverName" placeholder="请输入爱人姓名" required></van-field>
<van-field
v-model="formData.loverSex"
name="loverSex"
label="性别"
readonly
placeholder="请选择性别"
@click="showLoverSexPicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showLoverSexPicker">
<van-picker :columns="loverSexColumns" @cancel="showLoverSexPicker = false"
@confirm="onLoverSexConfirm" show-toolbar></van-picker>
</van-popup>
<van-field
v-model="formData.loverNationName"
name="loverNationName"
label="民族"
readonly
placeholder="请选择民族"
@click="showLoverNationPicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showLoverNationPicker">
<van-picker :columns="loverNationColumns" @cancel="showLoverNationPicker = false"
@confirm="onLoverNationConfirm" show-toolbar></van-picker>
</van-popup>
<van-field label="出生年月"
v-model="formData.loverBirthday"
placeholder="请选择出生年月"
readonly
@click="showLoverBirthdayPicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showLoverBirthdayPicker">
<van-datetime-picker
type="date"
:min-date="minDate"
:max-date="maxDate"
@confirm="onLoverBirthdayConfirm"
@cancel="showLoverBirthdayPicker = false"
show-toolbar
/>
</van-popup>
<van-field label="工作单位" v-model="formData.loverUnitName" placeholder="请输入工作单位" required></van-field>
</van-cell-group>
<van-cell-group title="假期类型" class="form-section">
<van-field label="陪产假" v-model="formData.withLeave" placeholder="请输入天数" type="number"
v-if="formData.sex === '男性' || formData.sex === '男'" required></van-field>
<van-field label="育儿假" v-model="formData.parentalLeave" placeholder="请输入天数" type="number"
v-if="formData.sex === '男性' || formData.sex === '男'" required></van-field>
<van-field label="产假" v-model="formData.maternityLeave" placeholder="请输入天数" type="number"
v-if="formData.sex === '女性' || formData.sex === '女'" required></van-field>
<van-field label="延长假" v-model="formData.extendLeave" placeholder="请输入天数" type="number"
v-if="formData.sex === '女性' || formData.sex === '女'" required></van-field>
<van-field label="多胞胎" v-model="formData.birthsLeave" placeholder="请输入天数" type="number"
v-if="formData.sex === '女性' || formData.sex === '女'" required></van-field>
<van-field label="难产假" v-model="formData.difficultLeave" placeholder="请输入天数" type="number"
v-if="formData.sex === '女性' || formData.sex === '女'" required></van-field>
<van-field label="寒假" v-model="formData.winterLeave" placeholder="请输入天数"
type="number" required></van-field>
<van-field label="暑假" v-model="formData.summerLeave" placeholder="请输入天数"
type="number" required></van-field>
<van-field label="合计天数" :value="totalLeaveDays" readonly></van-field>
<van-field label="休假时间起"
v-model="formData.startTime"
placeholder="请选择休假开始时间"
readonly
@click="showStartTimePicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showStartTimePicker">
<van-datetime-picker
type="date"
:min-date="minDate"
:max-date="maxDate"
@confirm="onStartTimeConfirm"
@cancel="showStartTimePicker = false"
show-toolbar
/>
</van-popup>
<van-field label="休假时间止"
v-model="formData.endTime"
placeholder="请选择休假结束时间"
readonly
@click="showEndTimePicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showEndTimePicker">
<van-datetime-picker
type="date"
:min-date="minDate"
:max-date="maxDate"
@confirm="onEndTimeConfirm"
@cancel="showEndTimePicker = false"
show-toolbar
/>
</van-popup>
<van-field label="子女出生日"
v-model="formData.childrenBirthday"
placeholder="请选择子女出生日期"
readonly
@click="showChildrenBirthdayPicker = true"
clickable
required
></van-field>
<van-popup position="bottom" round v-model:show="showChildrenBirthdayPicker">
<van-datetime-picker
type="date"
:min-date="minDate"
:max-date="maxDate"
@confirm="onChildrenBirthdayConfirm"
@cancel="showChildrenBirthdayPicker = false"
show-toolbar
/>
</van-popup>
</van-cell-group>
<!-- 提交按钮 -->
<div class="form-actions">
<van-button plain @click="onSave" type="info">保存</van-button>
<van-button @click="onSubmit" type="primary" v-if="!taskId">提交</van-button>
<van-button @click="onSubmitAgain" type="primary" v-else>提交1</van-button>
</div>
</van-form>
</div>
</div>
<script>
new Vue({
store,
el: '#app',
dicts: ["USER_NATION"],
data() {
return {
bizId: GetQueryString("bizId"),
taskId: GetQueryString("taskId"),
formData: {},
// 民族
showLoverNationPicker: false,
loverNationColumns: [],
// 性别
showLoverSexPicker: false,
loverSexColumns: [
{ value: '男性', text: '男性' },
{ value: '女性', text: '女性' }
],
showLoverBirthdayPicker: false,
showStartTimePicker: false,
showEndTimePicker: false,
showChildrenBirthdayPicker: false,
minDate: new Date(1950, 0, 1), // 设置最小日期为2000年1月1日
maxDate: new Date(2040, 12, 31), // 设置最大日期为2030年12月31日
// 表单验证规则
formRules: {
loverName: [{ required: true, message: '请输入爱人姓名' }],
loverSex: [{ required: true, message: '请选择爱人性别' }],
loverNationName: [{ required: true, message: '请选择爱人民族' }],
loverBirthday: [{ required: true, message: '请选择爱人出生年月' }],
loverUnitName: [{ required: true, message: '请输入爱人工作单位' }],
withLeave: [{ required: true, message: '请输入陪产假天数' }],
parentalLeave: [{ required: true, message: '请输入育儿假天数' }],
maternityLeave: [{ required: true, message: '请输入产假天数' }],
extendLeave: [{ required: true, message: '请输入延长假天数' }],
birthsLeave: [{ required: true, message: '请输入多胞胎天数' }],
difficultLeave: [{ required: true, message: '请输入难产假天数' }],
winterLeave: [{ required: true, message: '请输入寒假天数' }],
summerLeave: [{ required: true, message: '请输入暑假天数' }],
startTime: [{ required: true, message: '请选择休假开始时间' }],
endTime: [{ required: true, message: '请选择休假结束时间' }],
childrenBirthday: [{ required: true, message: '请选择子女出生日期' }]
}
}
},
computed: {
totalLeaveDays() {
const fields = [
'withLeave', // 陪产假
'parentalLeave', // 育儿假
'maternityLeave', // 产假
'extendLeave', // 延长假
'birthsLeave', // 多胞胎
'difficultLeave', // 难产假
'winterLeave', // 寒假
'summerLeave' // 暑假
];
let total = 0;
fields.forEach(field => {
const value = parseFloat(this.formData[field]) || 0;
total += value;
});
// 同时更新 formData.leaveDays,以便保存到后端
this.$set(this.formData, 'leaveDays', total);
return total;
}
},
methods: {
async onSave() {
// 保存时不需要验证,直接提交数据
this.$axios.post("/platform/maternityLeave/apply/save", {data: JSON.stringify(this.formData)})
.then((res) => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success(res.msg);
pjaxReplace('/platform/maternityLeave/mine/h5')
} else {
this.$toast.fail(res.msg || '保存失败');
}
})
.catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
},
// 提交前进行表单验证
async validateForm() {
const errors = [];
// 根据性别确定需要验证的字段
const isMale = this.formData.sex === '男性' || this.formData.sex === '男';
const isFemale = this.formData.sex === '女性' || this.formData.sex === '女';
// 必填字段验证
if (!this.formData.loverName) {
errors.push('请输入爱人姓名');
}
if (!this.formData.loverSex) {
errors.push('请选择爱人性别');
}
if (!this.formData.loverNationName) {
errors.push('请选择爱人民族');
}
if (!this.formData.loverBirthday) {
errors.push('请选择爱人出生年月');
}
if (!this.formData.loverUnitName) {
errors.push('请输入爱人工作单位');
}
// 根据性别验证假期字段
if (isMale) {
if (!this.formData.withLeave && this.formData.withLeave !== 0) {
errors.push('请输入陪产假天数');
}
if (!this.formData.parentalLeave && this.formData.parentalLeave !== 0) {
errors.push('请输入育儿假天数');
}
}
if (isFemale) {
if (!this.formData.maternityLeave && this.formData.maternityLeave !== 0) {
errors.push('请输入产假天数');
}
if (!this.formData.extendLeave && this.formData.extendLeave !== 0) {
errors.push('请输入延长假天数');
}
if (!this.formData.birthsLeave && this.formData.birthsLeave !== 0) {
errors.push('请输入多胞胎天数');
}
if (!this.formData.difficultLeave && this.formData.difficultLeave !== 0) {
errors.push('请输入难产假天数');
}
}
// 所人性别都需要填写的字段
if (!this.formData.winterLeave && this.formData.winterLeave !== 0) {
errors.push('请输入寒假天数');
}
if (!this.formData.summerLeave && this.formData.summerLeave !== 0) {
errors.push('请输入暑假天数');
}
if (!this.formData.startTime) {
errors.push('请选择休假开始时间');
}
if (!this.formData.endTime) {
errors.push('请选择休假结束时间');
}
if (!this.formData.childrenBirthday) {
errors.push('请选择子女出生日期');
}
return errors;
},
// 提交
async onSubmit() {
// 提交时进行表单验证
const errors = await this.validateForm();
if (errors.length > 0) {
this.$toast.fail(errors[0]); // 显示第一条错误信息
return;
}
this.$axios.post('/platform/maternityLeave/apply/submit', {data: JSON.stringify(this.formData)})
.then(res => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success("提交成功");
pjaxReplace('/platform/maternityLeave/mine/h5')
} else {
this.$toast.fail(res.msg || '提交失败');
}
})
.catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
},
// 再次提交
async onSubmitAgain() {
// 提交时进行表单验证
const errors = await this.validateForm();
if (errors.length > 0) {
this.$toast.fail(errors[0]); // 显示第一条错误信息
return;
}
this.$axios.post('/platform/maternityLeave/apply/submitAgain', {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
this.$toast.clear();
if (res.code === 0) {
this.$toast.success("提交成功");
setTimeout(() => {
pjaxReplace('/platform/maternityLeave/mine/h5')
}, 1500);
} else {
this.$toast.fail(res.msg || '提交失败');
}
}).catch(err => {
this.$toast.clear();
this.$toast.fail('网络错误,请稍后重试');
});
},
// 出生日期确认事件
onLoverBirthdayConfirm(value) {
this.$set(this.formData, "loverBirthday", this.$moment(value).format("YYYY-MM-DD"));
this.showLoverBirthdayPicker = false;
},
// 休假开始时间确认事件
onStartTimeConfirm(value) {
this.$set(this.formData, "startTime", this.$moment(value).format("YYYY-MM-DD"));
this.showStartTimePicker = false;
},
// 休假结束时间确认事件
onEndTimeConfirm(value) {
this.$set(this.formData, "endTime", this.$moment(value).format("YYYY-MM-DD"));
this.showEndTimePicker = false;
},
// 子女出生日期确认事件
onChildrenBirthdayConfirm(value) {
this.$set(this.formData, "childrenBirthday", this.$moment(value).format("YYYY-MM-DD"));
this.showChildrenBirthdayPicker = false;
},
onLoverNationConfirm(o) {
this.$set(this.formData, "loverNationName", o.text); // 显示名称
this.$set(this.formData, "loverNation", o.value); // 字典值
this.showLoverNationPicker = false;
},
// 添加性别确认方法
onLoverSexConfirm(o) {
this.$set(this.formData, "loverSex", o.text);
this.showLoverSexPicker = false;
},
async initDictOptions() {
// 民族
const loverNationData = await this.$businessTool.getDictOptions('USER_NATION')
this.loverNationColumns = loverNationData.map(item => {
return {value: item.code, text: item.name}
})
},
init() {
this.bizId = GetQueryString("bizId")
if (this.bizId) {
this.$axios.post("/platform/maternityLeave/apply/findOne", {id: this.bizId}).then((res) => {
if (res.code === 0) {
// 先保存原始数据
const originalData = {...res.data};
this.formData = res.data;
// 处理支付方式显示
if (this.loverNationColumns.length > 0) {
const matched = this.loverNationColumns.find(item =>
item.value === originalData.loverNation
)
if (matched) {
this.$set(this.formData, "loverNationName", matched.text)
this.$set(this.formData, "loverNation", matched.value)
}
}
}
})
} else {
const user = this.$store.state.user
this.$set(this.formData, "userId", user.id)
this.$set(this.formData, "userName", user.username)
this.$set(this.formData, "loginName", user.loginname)
this.$set(this.formData, "unitId", user.unitId)
this.$set(this.formData, "unitName", user.unit.name)
this.$set(this.formData, "unionId", user.union.id)
this.$set(this.formData, "unionName", user.union.name)
this.$set(this.formData, "sex", user.sex)
this.$set(this.formData, "nation", user.nation)
this.$set(this.formData, "birthday", user.birthday)
this.$set(this.formData, "mobile", user.mobile)
}
}
},
async created() {
await this.initDictOptions();
await this.init();
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,127 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="查询统计" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入职工姓名搜索"
v-model="pageForm.userName"
></van-search>
</van-sticky>
<table-list api="/platform/maternityLeave/collect/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="休假天数">{{row.leaveDays}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.taskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn delete" @click="onDelete(row)" v-if="$auth.hasRole('SYSADMIN')">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<maternity-leave-info ref="maternityLeaveInfoRef"></maternity-leave-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"maternity-leave-info":MATERNITY_LEAVE_INFO
},
data() {
return {
viewShow: false,
yearList: [],
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
year: "",
},
infoShow: false
}
},
methods: {
onView(row) {
this.showApprovalForm = false
this.$refs.maternityLeaveInfoRef.onOpen(row)
},
onRevoke(row){
this.$dialog
.confirm({
title: "提示",
message: "您确定要撤销申请吗?"
})
.then(() => {
this.$axios.post("/flow/common/revokeTask", {taskId: row.startTaskId}).then((resp) => {
this.$toast.success(resp.msg)
this.doSearch()
})
})
},
onDelete(row) {
this.$dialog
.confirm({
title: "提示",
message: "您确定要删除吗?"
})
.then(() => {
this.$axios.post("/platform/maternityLeave/mine/delete", {id: row.id}).then((resp) => {
if (resp.code === 0) {
this.$toast.success(resp.msg)
this.doSearch()
}
})
})
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
initData() {
for (let i = new Date().getFullYear() - 10; i <= new Date().getFullYear(); i++) {
this.yearList.unshift({value: i, text: i + "年"})
}
this.$set(this.pageForm, "year", this.yearList[0].value)
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,125 @@
const MATERNITY_LEAVE_INFO = {
template:
/*language=HTML*/`
<van-action-sheet v-model="visible" title="查看详情">
<div class="detail-container">
<van-cell-group title="人员信息">
<van-cell title="职工姓名">{{ viewData.userName }}</van-cell>
<van-cell title="性别">{{ viewData.sex }}</van-cell>
<van-cell title="民族">{{ viewData.nation }}</van-cell>
<van-cell title="出生年月">{{ viewData.birthday }}</van-cell>
<van-cell title="单位">{{ viewData.unitName }}</van-cell>
<van-cell title="电话">{{ viewData.mobile }}</van-cell>
<van-cell title="爱人姓名">{{ viewData.loverName }}</van-cell>
<van-cell title="性别">{{ viewData.loverSex }}</van-cell>
<van-cell title="民族">{{ viewData.loverNation }}</van-cell>
<van-cell title="出生年月">{{ viewData.loverBirthday }}</van-cell>
<van-cell title="单位">{{ viewData.loverUnitName }}</van-cell>
</van-cell-group>
<van-cell-group title="假期类型">
<van-cell title="陪产假" v-if="viewData.sex === '男性' || viewData.sex === '男'">{{ viewData.withLeave }}</van-cell>
<van-cell title="育儿假" v-if="viewData.sex === '男性' || viewData.sex === '男'">{{ viewData.parentalLeave }}</van-cell>
<van-cell title="产假" v-if="viewData.sex === '女性' || viewData.sex === '女'">{{ viewData.maternityLeave }}</van-cell>
<van-cell title="延长假" v-if="viewData.sex === '女性' || viewData.sex === '女'">{{ viewData.extendLeave }}</van-cell>
<van-cell title="多胞胎" v-if="viewData.sex === '女性' || viewData.sex === '女'">{{ viewData.birthsLeave }}</van-cell>
<van-cell title="难产假" v-if="viewData.sex === '女性' || viewData.sex === '女'">{{ viewData.difficultLeave }}</van-cell>
<van-cell title="寒假">{{ viewData.winterLeave }}</van-cell>
<van-cell title="暑假">{{ viewData.summerLeave }}</van-cell>
<van-cell title="合计">{{ viewData.leaveDays }}</van-cell>
<van-cell title="休假时间起">{{ viewData.startTime }}</van-cell>
<van-cell title="休假时间止">{{ viewData.endTime }}</van-cell>
<van-cell title="子女出生日">{{ viewData.childrenBirthday }}</van-cell>
</van-cell-group>
<template v-for="(task,index) in doneTasks">
<div class="process-title">
{{ task.displayName }}
</div>
<van-cell-group v-if="task.ext.isFirstTaskNode">
<van-cell title="申请用户">
{{ task.ext.initiatorName}}({{task.ext.initiatorAccount}})
</van-cell>
<van-cell title="申请时间">
{{ task.finishTime}}
</van-cell>
<van-cell title="办理结果">
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</van-cell>
</van-cell-group>
<van-cell-group v-else>
<van-cell title="办理用户">
{{ task.taskFormData.userName}}({{task.taskFormData.loginName}})
</van-cell>
<van-cell title="办理时间">
{{ task.finishTime}}
</van-cell>
<van-cell title="办理结果">
<dict-tag :options="dict.type.PROCESS_TASK_SUBMIT_TYPE"
:value="task.ext.submitType"></dict-tag>
</van-cell>
<van-cell title="办理意见" v-if="!task.ext.isFirstTaskNode">
<template #label>
{{
task.taskFormData.opinion
}}
</template>
</van-cell>
<van-cell title="签字" v-if="!task.ext.isFirstTaskNode">
<van-image :src="task.ext.tf_userSign"
v-if="task.ext.tf_userSign"
class="signature-image"></van-image>
</van-cell>
</van-cell-group>
</template>
</div>
<slot></slot>
</van-action-sheet>
`,
dicts: ["PROCESS_TASK_SUBMIT_TYPE"],
data() {
return {
visible:false,
viewData: {},
doneTasks: [],
row: null,
}
},
methods: {
onOpen(row) {
this.row = row
this.visible = true
this.getInfo()
this.getDoneTasks()
},
// 关闭
onClose(){
this.visible = false
},
// 获取申请信息
getInfo() {
this.$axios.post("/platform/maternityLeave/apply/findOne", {id: this.row.id}).then((res) => {
if (res.code === 0) {
this.viewData = res.data
}
})
},
// 查看
openView(id) {
this.$nextTick(() => {
this.$refs.infoDialogRef.onOpen(id)
})
},
// 获取已办任务审批记录
getDoneTasks() {
this.$axios.post("/flow/common/doneTasks", {bizId: this.row.id}).then((res) => {
if (res.code === 0) {
this.doneTasks = res.data
}
})
},
},
}
@@ -0,0 +1,133 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="我的申请" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/maternityLeave/mine/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="休假天数">{{row.leaveDays}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.taskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)" v-if="row.taskKey === 'startTask' || !row.instanceId">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" v-if="row.canRevoke" @click="onRevoke(row)">
<i class="fa fa-undo"></i>
<span>撤回</span>
</div>
<div class="action-btn delete" @click="onDelete(row)" v-if="row.taskKey === 'startTask' || !row.instanceId">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<maternity-leave-info ref="maternityLeaveInfoRef"></maternity-leave-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"maternity-leave-info":MATERNITY_LEAVE_INFO
},
data() {
return {
viewShow: false,
yearList: [],
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
year: "",
},
infoShow: false
}
},
methods: {
onView(row) {
this.showApprovalForm = false
this.$refs.maternityLeaveInfoRef.onOpen(row)
},
onEdit(row) {
this.$pjaxReplace('/platform/maternityLeave/apply/h5?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id)
},
onRevoke(row){
this.$dialog
.confirm({
title: "提示",
message: "您确定要撤销申请吗?"
})
.then(() => {
this.$axios.post("/flow/common/revokeTask", {taskId: row.startTaskId}).then((resp) => {
this.$toast.success(resp.msg)
this.doSearch()
})
})
},
onDelete(row) {
this.$dialog
.confirm({
title: "提示",
message: "您确定要删除吗?"
})
.then(() => {
this.$axios.post("/platform/maternityLeave/mine/delete", {id: row.id}).then((resp) => {
if (resp.code === 0) {
this.$toast.success(resp.msg)
this.doSearch()
}
})
})
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
initData() {
for (let i = new Date().getFullYear() - 10; i <= new Date().getFullYear(); i++) {
this.yearList.unshift({value: i, text: i + "年"})
}
this.$set(this.pageForm, "year", this.yearList[0].value)
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,167 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="校工会审核" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入职工姓名搜索"
v-model="pageForm.userName"
></van-search>
<van-tabs v-model="pageForm.approvalText"
@change="(val)=>{this.pageForm.approval = val==='1';this.doSearch();}">
<van-tab title="已审核" name="1"></van-tab>
<van-tab title="未审核" name="0"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/maternityLeave/schoolAudit/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="休假天数">{{row.leaveDays}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.curTaskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" v-if="row.taskState === 10" @click="onAudit(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
</div>
</template>
</table-list>
<maternity-leave-info ref="maternityLeaveInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">
校工会审核
</div>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="审批意见">
<van-field label=""
:rules="[{ required: true,message:'请填审批意见' }]"
v-model="formData.tf_opinion"
required
type="textarea"
name="tf_opinion"
rows="4"
autosize
class="more-text"
placeholder="请填审批意见"></van-field>
</van-cell-group>
<van-cell-group title="电子签名" class="form-section">
<van-field class="more-text" name="tf_userSign" label="">
<template #input>
<h5-signature v-model="formData.tf_userSign" slot="input"></h5-signature>
</template>
</van-field>
</van-cell-group>
<!-- 按钮区域 -->
<div class="form-actions">
<van-button type="danger" @click="handleTaskAction(6)">退回到发起人</van-button>
<van-button type="danger" @click="handleTaskAction(2)">拒绝申请</van-button>
<van-button type="primary" @click="handleTaskAction(1)">同意申请</van-button>
</div>
</van-form>
</div>
</div>
</maternity-leave-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"maternity-leave-info":MATERNITY_LEAVE_INFO
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
approvalText: "0",
approval: false,
year: new Date().getFullYear(),
},
formData: {},
showApprovalForm: false,
infoShow: false
}
},
methods: {
handleTaskAction(val) {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要提交吗?',
}).then(() => {
this.$axios.post('/flow/common/executeTask', {
data: JSON.stringify({
...this.formData,
submitType: val
})
}).then(res => {
if (res.code === 0) {
this.$toast.success("提交成功")
this.doSearch()
this.$refs.maternityLeaveInfoRef.onClose()
}
})
}).catch(() => {
// on cancel
});
}).catch();
},
onView(row) {
this.showApprovalForm = false
this.$refs.maternityLeaveInfoRef.onOpen(row)
},
onAudit(row) {
this.showApprovalForm = true
this.formData = {
tf_opinion: null,
tf_userSign: null,
processTaskId: row.taskId,
taskName: row.curTaskName
}
this.$refs.maternityLeaveInfoRef.onOpen(row)
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
},
created() {
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,167 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="分工会审核" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入职工姓名搜索"
v-model="pageForm.userName"
></van-search>
<van-tabs v-model="pageForm.approvalText"
@change="(val)=>{this.pageForm.approval = val==='1';this.doSearch();}">
<van-tab title="已审核" name="1"></van-tab>
<van-tab title="未审核" name="0"></van-tab>
</van-tabs>
</van-sticky>
<table-list api="/platform/maternityLeave/unionAudit/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" >
<template v-slot="{index,row}">
<table-column label="职工姓名">{{row.userName}}</table-column>
<table-column label="性别">{{row.sex}}</table-column>
<table-column label="工会">{{row.unionName}}</table-column>
<table-column label="所属单位">{{row.unitName}}</table-column>
<table-column label="休假天数">{{row.leaveDays}}</table-column>
<table-column label="申请时间">{{row.applyTime}}</table-column>
<table-column label="当前节点">{{row.curTaskName}}</table-column>
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" v-if="row.taskState === 10" @click="onAudit(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
</div>
</template>
</table-list>
<maternity-leave-info ref="maternityLeaveInfoRef">
<div v-if="showApprovalForm">
<div class="process-title">
分工会审核
</div>
<div class="form-container">
<van-form ref="formRef">
<van-cell-group title="审批意见">
<van-field label=""
:rules="[{ required: true,message:'请填审批意见' }]"
v-model="formData.tf_opinion"
required
type="textarea"
name="tf_opinion"
rows="4"
autosize
class="more-text"
placeholder="请填审批意见"></van-field>
</van-cell-group>
<van-cell-group title="电子签名" class="form-section">
<van-field class="more-text" name="tf_userSign" label="">
<template #input>
<h5-signature v-model="formData.tf_userSign" slot="input"></h5-signature>
</template>
</van-field>
</van-cell-group>
<!-- 按钮区域 -->
<div class="form-actions">
<van-button type="danger" @click="handleTaskAction(6)">退回到发起人</van-button>
<van-button type="danger" @click="handleTaskAction(2)">拒绝申请</van-button>
<van-button type="primary" @click="handleTaskAction(1)">同意申请</van-button>
</div>
</van-form>
</div>
</div>
</maternity-leave-info>
</div>
<script>
<!--#include('../common/info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: [],
components: {
"maternity-leave-info":MATERNITY_LEAVE_INFO
},
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
searchKeyword: "",
approvalText: "0",
approval: false,
year: new Date().getFullYear(),
},
formData: {},
showApprovalForm: false,
infoShow: false
}
},
methods: {
handleTaskAction(val) {
this.$refs.formRef.validate().then(() => {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要提交吗?',
}).then(() => {
this.$axios.post('/flow/common/executeTask', {
data: JSON.stringify({
...this.formData,
submitType: val
})
}).then(res => {
if (res.code === 0) {
this.$toast.success("提交成功")
this.doSearch()
this.$refs.maternityLeaveInfoRef.onClose()
}
})
}).catch(() => {
// on cancel
});
}).catch();
},
onView(row) {
this.showApprovalForm = false
this.$refs.maternityLeaveInfoRef.onOpen(row)
},
onAudit(row) {
this.showApprovalForm = true
this.formData = {
tf_opinion: null,
tf_userSign: null,
processTaskId: row.taskId,
taskName: row.curTaskName
}
this.$refs.maternityLeaveInfoRef.onOpen(row)
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
},
created() {
}
})
</script>
<!--#
}
#-->
@@ -67,8 +67,8 @@ const home = {
}
},
methods: {
listQuickEntry() {
this.$axios.post("/platform/home/listQuickEntry", { platform: "H5" }).then((res) => {
listRecommendApp() {
this.$axios.post("/platform/home/listRecommendApp", { platform: "H5" }).then((res) => {
if (res.code === 0) {
this.quickEntries = res.data
}
@@ -91,7 +91,7 @@ const home = {
}
},
created() {
this.listQuickEntry()
this.listRecommendApp()
this.listActivity()
},
style: /*language=CSS*/ `