活动导出
This commit is contained in:
+125
-62
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.deepoove.poi.XWPFTemplate;
|
import com.deepoove.poi.XWPFTemplate;
|
||||||
import com.deepoove.poi.config.Configure;
|
import com.deepoove.poi.config.Configure;
|
||||||
@@ -13,12 +14,12 @@ import io.v.nutz.base.annontation.ViReturn;
|
|||||||
import io.v.nutz.base.service.ViService;
|
import io.v.nutz.base.service.ViService;
|
||||||
import io.v.nutz.base.utils.DateUtil;
|
import io.v.nutz.base.utils.DateUtil;
|
||||||
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
import io.v.nutz.base.utils.OfficeTemplateUtil;
|
||||||
|
import io.v.nutz.base.utils.Roles;
|
||||||
import io.v.nutz.base.utils.ViTool;
|
import io.v.nutz.base.utils.ViTool;
|
||||||
import io.v.nutz.sys.models.Sys_union;
|
import io.v.nutz.sys.models.Sys_union;
|
||||||
import io.v.nutz.sys.models.Sys_unit;
|
import io.v.nutz.sys.models.Sys_unit;
|
||||||
import io.v.nutz.sys.models.Sys_user;
|
import io.v.nutz.sys.models.Sys_user;
|
||||||
import io.v.nutz.sys.services.SysUnionService;
|
import io.v.nutz.sys.services.SysUnionService;
|
||||||
import io.v.nutz.web.commons.base.Globals;
|
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.activity.models.*;
|
import io.v.nutz.zhgh.activity.models.*;
|
||||||
import io.v.nutz.zhgh.activity.services.ActivityPlanService;
|
import io.v.nutz.zhgh.activity.services.ActivityPlanService;
|
||||||
@@ -28,8 +29,8 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.entity.Record;
|
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.dao.util.cri.Static;
|
import org.nutz.dao.util.cri.Static;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
@@ -46,6 +47,7 @@ import javax.servlet.ServletOutputStream;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -69,28 +71,22 @@ public class ActivityCommonController {
|
|||||||
/*@Inject
|
/*@Inject
|
||||||
private HdTypeService hdTypeService;*/
|
private HdTypeService hdTypeService;*/
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
@Inject
|
@Inject
|
||||||
private SysUnionService sysUnionService;
|
private SysUnionService sysUnionService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ActivitySchoolService activitySchoolService;
|
private ActivitySchoolService activitySchoolService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ActivityPlanService activityPlanService;
|
private ActivityPlanService activityPlanService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||||
|
|
||||||
@Inject("ActivityEvent")
|
@Inject("ActivityEvent")
|
||||||
private ViService<ActivityEvent> activityEventService;
|
private ViService<ActivityEvent> activityEventService;
|
||||||
|
|
||||||
@Inject("ActivitySchoolTeam")
|
@Inject("ActivitySchoolTeam")
|
||||||
private ViService<ActivitySchoolTeam> activitySchoolTeamViService;
|
private ViService<ActivitySchoolTeam> activitySchoolTeamViService;
|
||||||
|
|
||||||
@Inject("ActivitySchoolEvent")
|
@Inject("ActivitySchoolEvent")
|
||||||
private ViService<ActivitySchoolEvent> activitySchoolEventService;
|
private ViService<ActivitySchoolEvent> activitySchoolEventService;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OfficeTemplateUtil officeTemplateUtil;
|
private OfficeTemplateUtil officeTemplateUtil;
|
||||||
|
|
||||||
@@ -281,7 +277,7 @@ public class ActivityCommonController {
|
|||||||
|
|
||||||
|
|
||||||
@At
|
@At
|
||||||
public void exportXlsx(String id, String unionId, HttpServletResponse response) throws IOException {
|
public void exportXlsx(String id, String unionId,Boolean isUnion, HttpServletResponse response) throws IOException {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
app.username,
|
app.username,
|
||||||
@@ -305,13 +301,13 @@ public class ActivityCommonController {
|
|||||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||||
LEFT JOIN activity_school sc ON sc.id=app.activityId
|
LEFT JOIN activity_school sc ON sc.id=app.activityId
|
||||||
WHERE
|
WHERE
|
||||||
activityId = @id
|
activityId = @id
|
||||||
and app.status=2
|
and app.status=2
|
||||||
$cnd
|
$cnd
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
u.unioncode ASC,
|
||||||
app.applyUser DESC,
|
app.applyUser DESC,
|
||||||
ev.allName DESC,
|
ev.allName DESC,
|
||||||
u.unionname DESC,
|
|
||||||
app.`team` asc
|
app.`team` asc
|
||||||
""").setParam("id", id);
|
""").setParam("id", id);
|
||||||
|
|
||||||
@@ -343,19 +339,26 @@ public class ActivityCommonController {
|
|||||||
// exportEntities.add(new ExcelExportEntity("身份", "sf", 20));
|
// exportEntities.add(new ExcelExportEntity("身份", "sf", 20));
|
||||||
exportEntities.add(new ExcelExportEntity("报名人", "applyUserName", 20));
|
exportEntities.add(new ExcelExportEntity("报名人", "applyUserName", 20));
|
||||||
|
|
||||||
Map<String, List<NutMap>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getString("unionname")));
|
|
||||||
Workbook workbook = new XSSFWorkbook();
|
Workbook workbook = new XSSFWorkbook();
|
||||||
listMap.forEach((k, v) -> {
|
|
||||||
ExcelExportService service = new ExcelExportService();
|
if (isUnion != null && isUnion) {
|
||||||
ExportParams exportParams = new ExportParams();
|
Map<String, List<NutMap>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getString("unionname")));
|
||||||
exportParams.setTitle(k);
|
ViTool.excelResponse(response, activityName + "报名表.xlsx");
|
||||||
exportParams.setSheetName(k);
|
Workbook finalWorkbook = workbook;
|
||||||
exportParams.setType(ExcelType.XSSF);
|
listMap.forEach((k, v) -> {
|
||||||
service.createSheetForMap(workbook, exportParams, exportEntities, v);
|
ExcelExportService service = new ExcelExportService();
|
||||||
});
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setTitle(k);
|
||||||
|
exportParams.setSheetName(k);
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
service.createSheetForMap(finalWorkbook, exportParams, exportEntities, v);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ViTool.excelResponse(response, activityName + "报名表(总表).xlsx");
|
||||||
|
workbook = ExcelExportUtil.exportExcel(new ExportParams(), exportEntities, list);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ViTool.excelResponse(response, activityName + "报名表.xlsx");
|
|
||||||
ServletOutputStream outputStream = response.getOutputStream();
|
ServletOutputStream outputStream = response.getOutputStream();
|
||||||
workbook.write(outputStream);
|
workbook.write(outputStream);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
@@ -403,55 +406,115 @@ public class ActivityCommonController {
|
|||||||
public void export(String id, String unionId, HttpServletResponse response) {
|
public void export(String id, String unionId, HttpServletResponse response) {
|
||||||
try {
|
try {
|
||||||
ActivitySchool activity = activitySchoolService.fetch(id);
|
ActivitySchool activity = activitySchoolService.fetch(id);
|
||||||
String fileName = Globals.MyConfig.getString("GxName") + activity.getName() + "报名表";
|
String fileName = activity.getName() + "报名表";
|
||||||
response.addHeader("Content-Type", "application/octet-stream");
|
response.addHeader("Content-Type", "application/octet-stream");
|
||||||
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".zip");
|
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\".zip");
|
||||||
|
|
||||||
|
Sql queryAllSql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
act.*,
|
||||||
|
ae.allName
|
||||||
|
FROM
|
||||||
|
activity_school_apply act
|
||||||
|
LEFT JOIN activity_event ae ON act.eventId = ae.id
|
||||||
|
WHERE
|
||||||
|
act.activityId = @actId
|
||||||
|
ORDER BY act.eventId ASC
|
||||||
|
""").setParam("actId", id);
|
||||||
|
List<NutMap> resultList = activitySchoolApplyService.listMap(queryAllSql);
|
||||||
|
|
||||||
|
List<ActivitySchoolApply> schoolApplies = BeanUtil.copyToList(resultList, ActivitySchoolApply.class);
|
||||||
|
|
||||||
|
|
||||||
List<ActivityBasicUnion> basicUnions = activitySchoolService.dao().query(ActivityBasicUnion.class, Cnd.NEW().asc("unioncode"));
|
List<ActivityBasicUnion> basicUnions = activitySchoolService.dao().query(ActivityBasicUnion.class, Cnd.NEW().asc("unioncode"));
|
||||||
|
|
||||||
|
if (Lang.isEmpty(schoolApplies)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||||
for (ActivityBasicUnion union : basicUnions) {
|
for (ActivityBasicUnion union : basicUnions) {
|
||||||
NutMap map = new NutMap();
|
if (!"6132df49148c43b1a8829c108ad0fcbf".equals(id)) {
|
||||||
map.setv("unionName", union.getUnionname());
|
NutMap map = new NutMap();
|
||||||
|
map.setv("unionName", union.getUnionname());
|
||||||
|
List<ActivitySchoolApply> ydhUserList = schoolApplies.stream().filter(v -> v.getIdentity().contains("1")).collect(Collectors.toList());
|
||||||
|
ActivitySchoolApply jlUser = schoolApplies.stream().filter(v -> v.getIdentity().contains("2")).findFirst().orElse(null);
|
||||||
|
ActivitySchoolApply ldUser = schoolApplies.stream().filter(v -> v.getIdentity().contains("3")).findFirst().orElse(null);
|
||||||
|
ydhUserList.forEach(y -> y.setSf("队员"));
|
||||||
|
for (int i = 0; i < ydhUserList.size(); i++) {
|
||||||
|
ydhUserList.get(i).setSf("队员");
|
||||||
|
ydhUserList.get(i).setIndex(i + 1);
|
||||||
|
}
|
||||||
|
map.setv("headName", fileName);
|
||||||
|
if (Lang.isNotEmpty(ldUser)) {
|
||||||
|
map.setv("ldUserName", ldUser.getUsername());
|
||||||
|
map.setv("ldMobile", ldUser.getMobile());
|
||||||
|
}
|
||||||
|
if (Lang.isNotEmpty(jlUser)) {
|
||||||
|
map.setv("jlUserName", jlUser.getUsername());
|
||||||
|
}
|
||||||
|
|
||||||
List<ActivitySchoolApply> schoolApplies = activitySchoolApplyService.query(Cnd.where("activityId", "=", id));
|
map.setv("ydhUser", ydhUserList);
|
||||||
|
|
||||||
List<ActivitySchoolApply> ydhUserList = schoolApplies.stream().filter(v -> v.getIdentity().contains("1")).collect(Collectors.toList());
|
map.setv("applyDate", DateUtil.getDate());
|
||||||
ActivitySchoolApply jlUser = schoolApplies.stream().filter(v -> v.getIdentity().contains("2")).findFirst().orElse(null);
|
|
||||||
ActivitySchoolApply ldUser = schoolApplies.stream().filter(v -> v.getIdentity().contains("3")).findFirst().orElse(null);
|
String twoFileName = union.getUnionname() + "比赛报名表.docx";
|
||||||
ydhUserList.stream().forEach(y -> y.setSf("队员"));
|
zipOutputStream.putNextEntry(new ZipEntry(twoFileName));
|
||||||
for (int i = 0; i < ydhUserList.size(); i++) {
|
|
||||||
ydhUserList.get(i).setSf("队员");
|
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||||
ydhUserList.get(i).setIndex(i + 1);
|
Configure config = Configure.newBuilder().bind("ydhUser", policy).build();
|
||||||
|
/* if (activity.getApplyType() == 1) {
|
||||||
|
templateUrl = officeTemplateUtil.getPath("activity_list1");
|
||||||
|
} else if (activity.getApplyType() == 2) {
|
||||||
|
templateUrl = officeTemplateUtil.getPath("activity_list");
|
||||||
|
}officeTemplateUtil.getPath("activity_user");
|
||||||
|
*/
|
||||||
|
String officeTemplateUtilPath = officeTemplateUtil.getPath("activity_user");
|
||||||
|
XWPFTemplate.compile(officeTemplateUtilPath, config).render(map).write(zipOutputStream);
|
||||||
|
zipOutputStream.closeEntry();
|
||||||
|
} else {
|
||||||
|
List<ActivitySchoolApply> unionApply = schoolApplies.stream().filter(v -> v.getUnionId().equals(union.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (Lang.isEmpty(unionApply)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
NutMap result = NutMap.NEW();
|
||||||
|
// 获取主席
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
u.username,
|
||||||
|
u.mobile
|
||||||
|
FROM
|
||||||
|
sys_user_role sur
|
||||||
|
LEFT JOIN sys_user u ON sur.userId = u.id
|
||||||
|
WHERE
|
||||||
|
sur.roleId = @roleId AND sur.unionId = @unionId
|
||||||
|
""").setParam("roleId", Roles.GH01).setParam("unionId", union.getId());
|
||||||
|
sql.setCallback(Sqls.callback.map());
|
||||||
|
dao.execute(sql);
|
||||||
|
NutMap userMap = (NutMap) sql.getResult();
|
||||||
|
|
||||||
|
// 设置序号
|
||||||
|
for (int i = 0; i < unionApply.size(); i++) {
|
||||||
|
unionApply.get(i).setIndex(i + 1);
|
||||||
|
unionApply.get(i).setSf(unionApply.get(i).getAllName().substring(0, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
result.put("activityName", cn.hutool.core.date.DateUtil.year(cn.hutool.core.date.DateUtil.parseDate(activity.getApplyStartTime())) + "年" + activity.getName());
|
||||||
|
result.put("unionName", union.getUnionname());
|
||||||
|
result.put("fzr", userMap.getString("username"));
|
||||||
|
result.put("mobile", userMap.getString("mobile"));
|
||||||
|
result.put("list", unionApply);
|
||||||
|
|
||||||
|
zipOutputStream.putNextEntry(new ZipEntry(union.getUnionname() + "报名表.docx"));
|
||||||
|
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/activity/activity_jsz.docx");
|
||||||
|
|
||||||
|
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
||||||
|
Configure config = Configure.newBuilder().bind("list", policy).build();
|
||||||
|
XWPFTemplate.compile(inputStream, config).render(result, zipOutputStream);
|
||||||
|
zipOutputStream.closeEntry();
|
||||||
}
|
}
|
||||||
map.setv("headName", fileName);
|
|
||||||
if (Lang.isNotEmpty(ldUser)) {
|
|
||||||
map.setv("ldUserName", ldUser.getUsername());
|
|
||||||
map.setv("ldMobile", ldUser.getMobile());
|
|
||||||
}
|
|
||||||
if (Lang.isNotEmpty(jlUser)) {
|
|
||||||
map.setv("jlUserName", jlUser.getUsername());
|
|
||||||
}
|
|
||||||
|
|
||||||
map.setv("ydhUser", ydhUserList);
|
|
||||||
|
|
||||||
map.setv("applyDate", DateUtil.getDate());
|
|
||||||
|
|
||||||
String twoFileName = union.getUnionname() + "比赛报名表.docx";
|
|
||||||
zipOutputStream.putNextEntry(new ZipEntry(twoFileName));
|
|
||||||
|
|
||||||
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
|
|
||||||
Configure config = Configure.newBuilder().bind("ydhUser", policy).build();
|
|
||||||
/* if (activity.getApplyType() == 1) {
|
|
||||||
templateUrl = officeTemplateUtil.getPath("activity_list1");
|
|
||||||
} else if (activity.getApplyType() == 2) {
|
|
||||||
templateUrl = officeTemplateUtil.getPath("activity_list");
|
|
||||||
}officeTemplateUtil.getPath("activity_user");
|
|
||||||
*/
|
|
||||||
String officeTemplateUtilPath = officeTemplateUtil.getPath("activity_user");
|
|
||||||
assert officeTemplateUtilPath != null;
|
|
||||||
XWPFTemplate.compile(officeTemplateUtilPath, config).render(map).write(zipOutputStream);
|
|
||||||
zipOutputStream.closeEntry();
|
|
||||||
}
|
}
|
||||||
zipOutputStream.flush();
|
zipOutputStream.flush();
|
||||||
zipOutputStream.close();
|
zipOutputStream.close();
|
||||||
|
|||||||
Binary file not shown.
@@ -1,25 +1,23 @@
|
|||||||
<!--#
|
<!--#
|
||||||
layout("/layouts/platform.html"){
|
layout("/layouts/platform.html"){
|
||||||
#-->
|
#-->
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="platform" id="app" v-cloak>
|
<div class="platform" id="app" v-cloak>
|
||||||
<guava ref="guava">
|
<guava ref="guava">
|
||||||
<template>
|
<template>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
|
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">年  度</div>
|
<div class="search-item-label">年  度</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
type="year" v-model="pageForm.year"
|
type="year"
|
||||||
value-format="yyyy">
|
v-model="pageForm.year"
|
||||||
</el-date-picker>
|
value-format="yyyy"
|
||||||
|
></el-date-picker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -27,15 +25,8 @@ layout("/layouts/platform.html"){
|
|||||||
<div class="search-item-label">活动名称</div>
|
<div class="search-item-label">活动名称</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<!--<el-input v-model="pageForm.name" placeholder="请输入活动名称" clearable></el-input>-->
|
<!--<el-input v-model="pageForm.name" placeholder="请输入活动名称" clearable></el-input>-->
|
||||||
<el-select clearable filterable
|
<el-select clearable filterable placeholder="请选择活动名称" style="width: 100%" v-model="pageForm.activityId">
|
||||||
placeholder="请选择活动名称" style="width: 100%"
|
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in activities"></el-option>
|
||||||
v-model="pageForm.activityId">
|
|
||||||
<el-option
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id"
|
|
||||||
v-for="item in activities">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -52,32 +43,21 @@ layout("/layouts/platform.html"){
|
|||||||
:value="v">
|
:value="v">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>-->
|
</el-select>-->
|
||||||
<el-select clearable placeholder="请选择活动级别"
|
<el-select clearable placeholder="请选择活动级别" style="width: 100%" v-model="pageForm.activityLevel">
|
||||||
style="width: 100%"
|
<el-option :key="item.code" :label="item.name" :value="item.code" v-for="item in activityTypeList"></el-option>
|
||||||
v-model="pageForm.activityLevel">
|
|
||||||
<el-option
|
|
||||||
:key="item.code"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.code"
|
|
||||||
v-for="item in activityTypeList">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search-query">
|
<div class="search-query">
|
||||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
|
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search-item" style="width: 80vw">
|
<div class="search-item" style="width: 80vw">
|
||||||
<div class="search-item-label">一键查询</div>
|
<div class="search-item-label">一键查询</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-radio-group @change="doSearch" v-model="pageForm.query">
|
<el-radio-group @change="doSearch" v-model="pageForm.query">
|
||||||
<el-radio-button :key="it.key" :label="it.key"
|
<el-radio-button :key="it.key" :label="it.key" v-for="it in queryOptions">{{it.value}}</el-radio-button>
|
||||||
v-for="it in queryOptions">
|
|
||||||
{{it.value}}
|
|
||||||
</el-radio-button>
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -87,30 +67,37 @@ layout("/layouts/platform.html"){
|
|||||||
<el-card class="mt10" shadow="never">
|
<el-card class="mt10" shadow="never">
|
||||||
<table-tool :app="this" label="活动列表">
|
<table-tool :app="this" label="活动列表">
|
||||||
<template #func>
|
<template #func>
|
||||||
<el-button @click="openAdd" icon="el-icon-edit-outline" size="small"
|
<el-button @click="openAdd" icon="el-icon-edit-outline" size="small" type="primary">创建活动</el-button>
|
||||||
type="primary">
|
|
||||||
创建活动
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</table-tool>
|
</table-tool>
|
||||||
|
|
||||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
|
<el-table
|
||||||
class="vi-table" row-key="id" style="width: 100%;margin-bottom: 20px"
|
:data="tableData"
|
||||||
v-loading="tableLoading">
|
:size="tableSize"
|
||||||
|
@sort-change="pageOrder"
|
||||||
<el-table-column :index="indexMethod" align="center" header-align="center"
|
class="vi-table"
|
||||||
label="序号" type="index"
|
row-key="id"
|
||||||
width="80px"></el-table-column>
|
style="width: 100%; margin-bottom: 20px"
|
||||||
|
v-loading="tableLoading"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
:index="indexMethod"
|
||||||
|
align="center"
|
||||||
|
header-align="center"
|
||||||
|
label="序号"
|
||||||
|
type="index"
|
||||||
|
width="80px"
|
||||||
|
></el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="column.label"
|
:label="column.label"
|
||||||
:prop="column.prop"
|
:prop="column.prop"
|
||||||
:sortable="column.sortable"
|
:sortable="column.sortable"
|
||||||
align="center"
|
align="center"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
v-for="column in tableColumns">
|
v-for="column in tableColumns"
|
||||||
|
>
|
||||||
<template scope="{row}" v-if="column.prop=='events'">
|
<template scope="{row}" v-if="column.prop=='events'">
|
||||||
<span>{{row.allName}}</span>
|
<span>{{row.allName}}</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -127,31 +114,25 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<template scope="{row}" v-else-if="column.prop=='startTime'">
|
<template scope="{row}" v-else-if="column.prop=='startTime'">
|
||||||
<span v-if="row.startTime">
|
<span v-if="row.startTime">
|
||||||
{{moment(row.startTime).format('YYYY-MM-DD')}} -
|
{{moment(row.startTime).format('YYYY-MM-DD')}} - {{moment(row.endTime).format('YYYY-MM-DD')}}
|
||||||
{{moment(row.endTime).format('YYYY-MM-DD')}}
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template scope="{row}" v-else-if="column.prop=='isDisabled'">
|
<template scope="{row}" v-else-if="column.prop=='isDisabled'">
|
||||||
<el-switch
|
<el-switch
|
||||||
@change="(val)=>{activityStatusChange(row,val)}"
|
@change="(val)=>{activityStatusChange(row,val)}"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#ff4949"
|
inactive-color="#ff4949"
|
||||||
v-model="row.isDisabled">
|
v-model="row.isDisabled"
|
||||||
</el-switch>
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template
|
<template scope="{row:{close,applyStartTime,applyEndTime,startTime,endTime,isSave}}" v-else-if="column.prop=='state'">
|
||||||
scope="{row:{close,applyStartTime,applyEndTime,startTime,endTime,isSave}}"
|
|
||||||
v-else-if="column.prop=='state'">
|
|
||||||
<div v-html="getStatus(close,applyStartTime,applyEndTime,startTime,endTime,isSave)"></div>
|
<div v-html="getStatus(close,applyStartTime,applyEndTime,startTime,endTime,isSave)"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="center" header-align="center" label="操作"
|
<el-table-column align="center" header-align="center" label="操作" prop="userOnline" width="150px">
|
||||||
prop="userOnline" width="150px">
|
|
||||||
<template scope="{row}">
|
<template scope="{row}">
|
||||||
<el-dropdown @command="dropdownCommand">
|
<el-dropdown @command="dropdownCommand">
|
||||||
<el-button :loading="row.loading" size="mini">
|
<el-button :loading="row.loading" size="mini">
|
||||||
@@ -159,27 +140,14 @@ layout("/layouts/platform.html"){
|
|||||||
<span class="ti-angle-down"></span>
|
<span class="ti-angle-down"></span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item :command="{type:'sendMsg',row}">
|
<el-dropdown-item :command="{type:'sendMsg',row}">通知</el-dropdown-item>
|
||||||
通知
|
<el-dropdown-item :command="{type:'openCode',row}">二维码</el-dropdown-item>
|
||||||
</el-dropdown-item>
|
<el-dropdown-item :command="{type:'view',row}">查看</el-dropdown-item>
|
||||||
<el-dropdown-item :command="{type:'openCode',row}">
|
<el-dropdown-item :command="{type:'export',row}">导出名单docx</el-dropdown-item>
|
||||||
二维码
|
<el-dropdown-item :command="{type:'exportXlsx', row}">按工会导出名单excel</el-dropdown-item>
|
||||||
</el-dropdown-item>
|
<el-dropdown-item :command="{type:'exportXlsxAll', row}">导出名单(总表)excel</el-dropdown-item>
|
||||||
<el-dropdown-item :command="{type:'view',row}">
|
<el-dropdown-item :command="{type:'edit',row}">编辑</el-dropdown-item>
|
||||||
查看
|
<el-dropdown-item :command="{type:'delete',row}">删除</el-dropdown-item>
|
||||||
</el-dropdown-item>
|
|
||||||
<!--<el-dropdown-item :command="{type:'export',row}" v-if="row.applyType===1">
|
|
||||||
导出名单docx
|
|
||||||
</el-dropdown-item>-->
|
|
||||||
<el-dropdown-item :command="{type:'exportXlsx',row}">
|
|
||||||
导出名单
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item :command="{type:'edit',row}">
|
|
||||||
编辑
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item :command="{type:'delete',row}">
|
|
||||||
删除
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
@@ -196,13 +164,18 @@ layout("/layouts/platform.html"){
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #edit>
|
<template #edit>
|
||||||
<add-activity :form="formData" :is_a06="is_A06" :is_club="is_club" :is_h10="is_h10"
|
<add-activity
|
||||||
:is_sysadmin="is_sysadmin"
|
:form="formData"
|
||||||
:is_union="is_union"
|
:is_a06="is_A06"
|
||||||
:unionid="'${@shiro.getPrincipalProperty('unit').getUnionid()}'"
|
:is_club="is_club"
|
||||||
@flip="flip"
|
:is_h10="is_h10"
|
||||||
@flush="flush"
|
:is_sysadmin="is_sysadmin"
|
||||||
ref="activity"></add-activity>
|
:is_union="is_union"
|
||||||
|
:unionid="'${@shiro.getPrincipalProperty('unit').getUnionid()}'"
|
||||||
|
@flip="flip"
|
||||||
|
@flush="flush"
|
||||||
|
ref="activity"
|
||||||
|
></add-activity>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #view>
|
<template #view>
|
||||||
@@ -213,7 +186,6 @@ layout("/layouts/platform.html"){
|
|||||||
|
|
||||||
<open-qr-code :url="url" ref="openQRCode"></open-qr-code>
|
<open-qr-code :url="url" ref="openQRCode"></open-qr-code>
|
||||||
</guava>
|
</guava>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script src="/assets/platform/module/activity/activity.js?v=1.0.0"></script>
|
<script src="/assets/platform/module/activity/activity.js?v=1.0.0"></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -221,7 +193,7 @@ layout("/layouts/platform.html"){
|
|||||||
const editors = {}
|
const editors = {}
|
||||||
|
|
||||||
const vue = new Vue({
|
const vue = new Vue({
|
||||||
el: '#app',
|
el: "#app",
|
||||||
mixins: [initTableMixins],
|
mixins: [initTableMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -248,36 +220,36 @@ layout("/layouts/platform.html"){
|
|||||||
combinationMethod: []
|
combinationMethod: []
|
||||||
},
|
},
|
||||||
tableColumns: [
|
tableColumns: [
|
||||||
{prop: 'name', label: '活动名称'},
|
{ prop: "name", label: "活动名称" },
|
||||||
{prop: 'activityCode', label: '活动编号', sortable: true},
|
{ prop: "activityCode", label: "活动编号", sortable: true },
|
||||||
{prop: 'address', label: '活动地点'},
|
{ prop: "address", label: "活动地点" },
|
||||||
{prop: 'foundUnit', label: '创建单位', sortable: true},
|
{ prop: "foundUnit", label: "创建单位", sortable: true },
|
||||||
{prop: 'activityLevelName', label: '活动级别', sortable: true},
|
{ prop: "activityLevelName", label: "活动级别", sortable: true },
|
||||||
{prop: 'startTime', label: '活动日期', sortable: true},
|
{ prop: "startTime", label: "活动日期", sortable: true },
|
||||||
{prop: 'state', label: '活动状态', sortable: true},
|
{ prop: "state", label: "活动状态", sortable: true },
|
||||||
{prop: 'applyNum', label: '已报名人数', sortable: true},
|
{ prop: "applyNum", label: "已报名人数", sortable: true },
|
||||||
{prop: 'isDisabled', label: '是否开启', sortable: true},
|
{ prop: "isDisabled", label: "是否开启", sortable: true },
|
||||||
{prop: 'foundDate', label: '创建时间', sortable: true},
|
{ prop: "foundDate", label: "创建时间", sortable: true }
|
||||||
],
|
],
|
||||||
pageForm: {
|
pageForm: {
|
||||||
query: 'zero'
|
query: "zero"
|
||||||
},
|
},
|
||||||
queryOptions: [
|
queryOptions: [
|
||||||
{key: 'zero', value: '全部'},
|
{ key: "zero", value: "全部" },
|
||||||
{key: 'one', value: '正在报名'},
|
{ key: "one", value: "正在报名" },
|
||||||
{key: 'two', value: '报名结束'},
|
{ key: "two", value: "报名结束" },
|
||||||
{key: 'three', value: '活动进行中'},
|
{ key: "three", value: "活动进行中" },
|
||||||
{key: 'four', value: '活动已结束'},
|
{ key: "four", value: "活动已结束" }
|
||||||
],
|
],
|
||||||
url: '',
|
url: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
guava: httpVueLoader("/components/plugins/Guava.vue"),
|
||||||
'info': httpVueLoader('/components/activity/school/Info.vue?v=' + new Date().getTime()),
|
info: httpVueLoader("/components/activity/school/Info.vue?v=" + new Date().getTime()),
|
||||||
'add-activity': httpVueLoader('/components/activity/school/AddActivity.vue?v=' + new Date().getTime()),
|
"add-activity": httpVueLoader("/components/activity/school/AddActivity.vue?v=" + new Date().getTime()),
|
||||||
'send-msg': httpVueLoader('/components/plugins/SendMsgByGroupId.vue'),
|
"send-msg": httpVueLoader("/components/plugins/SendMsgByGroupId.vue"),
|
||||||
'open-qr-code': httpVueLoader('/components/plugins/OpenQRCode.vue'),
|
"open-qr-code": httpVueLoader("/components/plugins/OpenQRCode.vue")
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getStatus(close, applyStartTime, applyEndTime, startTime, endTime) {
|
getStatus(close, applyStartTime, applyEndTime, startTime, endTime) {
|
||||||
@@ -285,7 +257,7 @@ layout("/layouts/platform.html"){
|
|||||||
return `<span class="text-danger">活动已关闭</span>`
|
return `<span class="text-danger">活动已关闭</span>`
|
||||||
}
|
}
|
||||||
const now = moment().valueOf()
|
const now = moment().valueOf()
|
||||||
const dateNow = moment(moment(moment().format('YYYY-MM-DD')).valueOf()).valueOf()
|
const dateNow = moment(moment(moment().format("YYYY-MM-DD")).valueOf()).valueOf()
|
||||||
|
|
||||||
if (now < moment(applyStartTime).valueOf()) {
|
if (now < moment(applyStartTime).valueOf()) {
|
||||||
return `<span class="text-info">未开始报名</span>`
|
return `<span class="text-info">未开始报名</span>`
|
||||||
@@ -300,12 +272,12 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async activityStatusChange(row, val) {
|
async activityStatusChange(row, val) {
|
||||||
const resp = await $.get('/platform/activity/school/info/mange/activityStatusChange', {
|
const resp = await $.get("/platform/activity/school/info/mange/activityStatusChange", {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
isDisabled: val
|
isDisabled: val
|
||||||
})
|
})
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.pageData();
|
this.pageData()
|
||||||
this.notifySuccess(resp.msg)
|
this.notifySuccess(resp.msg)
|
||||||
} else {
|
} else {
|
||||||
this.notifyError(resp.msg)
|
this.notifyError(resp.msg)
|
||||||
@@ -319,20 +291,22 @@ layout("/layouts/platform.html"){
|
|||||||
this.pageData()
|
this.pageData()
|
||||||
},
|
},
|
||||||
dropdownCommand(command) {
|
dropdownCommand(command) {
|
||||||
const {type, row} = command
|
const { type, row } = command
|
||||||
if (type === 'view') {
|
if (type === "view") {
|
||||||
this.openView(row)
|
this.openView(row)
|
||||||
} else if (type === 'edit') {
|
} else if (type === "edit") {
|
||||||
this.openEdit(row)
|
this.openEdit(row)
|
||||||
} else if (type === 'delete') {
|
} else if (type === "delete") {
|
||||||
this.doDelete(row)
|
this.doDelete(row)
|
||||||
} else if (type === 'export') {
|
} else if (type === "export") {
|
||||||
window.open("/platform/activity/common/export?id=" + row.id)
|
window.open("/platform/activity/common/export?id=" + row.id)
|
||||||
} else if (type === 'exportXlsx') {
|
} else if (type === "exportXlsx") {
|
||||||
window.open("/platform/activity/common/exportXlsx?id=" + row.id)
|
window.open("/platform/activity/common/exportXlsx?id=" + row.id + "&isUnion=true")
|
||||||
}else if (type == 'sendMsg') {
|
} else if (type === "exportXlsxAll") {
|
||||||
|
window.open("/platform/activity/common/exportXlsx?id=" + row.id + "&isUnion=false")
|
||||||
|
} else if (type === "sendMsg") {
|
||||||
this.sendMsg(row)
|
this.sendMsg(row)
|
||||||
} else if (type === 'openCode') {
|
} else if (type === "openCode") {
|
||||||
this.openCode(row)
|
this.openCode(row)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -344,12 +318,11 @@ layout("/layouts/platform.html"){
|
|||||||
this.$refs.sendMsg.openDialog(row.activityGroupId)
|
this.$refs.sendMsg.openDialog(row.activityGroupId)
|
||||||
},
|
},
|
||||||
openView(row) {
|
openView(row) {
|
||||||
const {id} = row
|
const { id } = row
|
||||||
this.$refs.guava.view()
|
this.$refs.guava.view()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.info.getInfo(id)
|
this.$refs.info.getInfo(id)
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
},
|
},
|
||||||
async openAdd() {
|
async openAdd() {
|
||||||
this.$refs.guava.edit()
|
this.$refs.guava.edit()
|
||||||
@@ -358,7 +331,7 @@ layout("/layouts/platform.html"){
|
|||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
async openEdit(row) {
|
async openEdit(row) {
|
||||||
const {id, applyStartTime, isSave} = row
|
const { id, applyStartTime, isSave } = row
|
||||||
this.formData.id = id
|
this.formData.id = id
|
||||||
const now = moment().valueOf()
|
const now = moment().valueOf()
|
||||||
this.$refs.guava.edit()
|
this.$refs.guava.edit()
|
||||||
@@ -367,26 +340,25 @@ layout("/layouts/platform.html"){
|
|||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
doDelete(row) {
|
doDelete(row) {
|
||||||
const {id} = row
|
const { id } = row
|
||||||
this.$confirm('确定要删除该活动吗?', '提示', {type: 'warning'}).then(async () => {
|
this.$confirm("确定要删除该活动吗?", "提示", { type: "warning" }).then(async () => {
|
||||||
this.$set(row, "loading", true)
|
this.$set(row, "loading", true)
|
||||||
const resp = await $.post(loc() + "/doDelete", {id});
|
const resp = await $.post(loc() + "/doDelete", { id })
|
||||||
this.$set(row, "loading", false)
|
this.$set(row, "loading", false)
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.pageData()
|
this.pageData()
|
||||||
} else {
|
} else {
|
||||||
this.notifyWarning(resp.msg)
|
this.notifyWarning(resp.msg)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
})
|
||||||
},
|
},
|
||||||
async getActivitys() {
|
async getActivitys() {
|
||||||
const {data} = await $.get("/platform/activity/remind/getActivitys")
|
const { data } = await $.get("/platform/activity/remind/getActivitys")
|
||||||
return data;
|
return data
|
||||||
},
|
},
|
||||||
async getActivityTypeList(code) {
|
async getActivityTypeList(code) {
|
||||||
const {data} = await $.get("/platform/activity/basic/basic/settings/getActivityTwoLevelType", {code: code})
|
const { data } = await $.get("/platform/activity/basic/basic/settings/getActivityTwoLevelType", { code: code })
|
||||||
return data;
|
return data
|
||||||
},
|
},
|
||||||
async doOperate() {
|
async doOperate() {
|
||||||
await this.$refs.activity.operate()
|
await this.$refs.activity.operate()
|
||||||
@@ -394,21 +366,27 @@ layout("/layouts/platform.html"){
|
|||||||
async doSave() {
|
async doSave() {
|
||||||
this.$refs.activity.doSave()
|
this.$refs.activity.doSave()
|
||||||
},
|
},
|
||||||
pageData() {//加载分页数据
|
pageData() {
|
||||||
sublime.showLoadingbar();//显示loading
|
//加载分页数据
|
||||||
$.post(loc() + "/pageData", this.pageForm, (data) => {
|
sublime.showLoadingbar() //显示loading
|
||||||
sublime.closeLoadingbar();//关闭loading
|
$.post(
|
||||||
if (data.code == 0) {
|
loc() + "/pageData",
|
||||||
this.tableData = data.data.list;
|
this.pageForm,
|
||||||
this.pageForm.totalCount = data.data.totalCount;
|
(data) => {
|
||||||
} else {
|
sublime.closeLoadingbar() //关闭loading
|
||||||
this.$message({
|
if (data.code == 0) {
|
||||||
message: data.msg,
|
this.tableData = data.data.list
|
||||||
type: 'error'
|
this.pageForm.totalCount = data.data.totalCount
|
||||||
});
|
} else {
|
||||||
}
|
this.$message({
|
||||||
}, "json");
|
message: data.msg,
|
||||||
},
|
type: "error"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
if ("${@shiro.hasRole('club01')}" === "true") {
|
if ("${@shiro.hasRole('club01')}" === "true") {
|
||||||
|
|||||||
Reference in New Issue
Block a user