活动导出
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.params.ExcelExportEntity;
|
||||
import cn.afterturn.easypoi.excel.export.ExcelExportService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
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.utils.DateUtil;
|
||||
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.sys.models.Sys_union;
|
||||
import io.v.nutz.sys.models.Sys_unit;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
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.zhgh.activity.models.*;
|
||||
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.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
@@ -46,6 +47,7 @@ import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -69,28 +71,22 @@ public class ActivityCommonController {
|
||||
/*@Inject
|
||||
private HdTypeService hdTypeService;*/
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolService activitySchoolService;
|
||||
|
||||
@Inject
|
||||
private ActivityPlanService activityPlanService;
|
||||
|
||||
@Inject
|
||||
private ActivitySchoolApplyService activitySchoolApplyService;
|
||||
|
||||
@Inject("ActivityEvent")
|
||||
private ViService<ActivityEvent> activityEventService;
|
||||
|
||||
@Inject("ActivitySchoolTeam")
|
||||
private ViService<ActivitySchoolTeam> activitySchoolTeamViService;
|
||||
|
||||
@Inject("ActivitySchoolEvent")
|
||||
private ViService<ActivitySchoolEvent> activitySchoolEventService;
|
||||
|
||||
|
||||
@Inject
|
||||
private OfficeTemplateUtil officeTemplateUtil;
|
||||
|
||||
@@ -281,7 +277,7 @@ public class ActivityCommonController {
|
||||
|
||||
|
||||
@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("""
|
||||
SELECT
|
||||
app.username,
|
||||
@@ -305,13 +301,13 @@ public class ActivityCommonController {
|
||||
LEFT JOIN activity_event ev ON ev.id = app.eventId
|
||||
LEFT JOIN activity_school sc ON sc.id=app.activityId
|
||||
WHERE
|
||||
activityId = @id
|
||||
activityId = @id
|
||||
and app.status=2
|
||||
$cnd
|
||||
ORDER BY
|
||||
u.unioncode ASC,
|
||||
app.applyUser DESC,
|
||||
ev.allName DESC,
|
||||
u.unionname DESC,
|
||||
app.`team` asc
|
||||
""").setParam("id", id);
|
||||
|
||||
@@ -343,19 +339,26 @@ public class ActivityCommonController {
|
||||
// exportEntities.add(new ExcelExportEntity("身份", "sf", 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();
|
||||
listMap.forEach((k, v) -> {
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setTitle(k);
|
||||
exportParams.setSheetName(k);
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
service.createSheetForMap(workbook, exportParams, exportEntities, v);
|
||||
});
|
||||
|
||||
if (isUnion != null && isUnion) {
|
||||
Map<String, List<NutMap>> listMap = list.stream().collect(Collectors.groupingBy(v -> v.getString("unionname")));
|
||||
ViTool.excelResponse(response, activityName + "报名表.xlsx");
|
||||
Workbook finalWorkbook = workbook;
|
||||
listMap.forEach((k, 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 {
|
||||
ViTool.excelResponse(response, activityName + "报名表.xlsx");
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
@@ -403,55 +406,115 @@ public class ActivityCommonController {
|
||||
public void export(String id, String unionId, HttpServletResponse response) {
|
||||
try {
|
||||
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-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"));
|
||||
|
||||
if (Lang.isEmpty(schoolApplies)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
|
||||
for (ActivityBasicUnion union : basicUnions) {
|
||||
NutMap map = new NutMap();
|
||||
map.setv("unionName", union.getUnionname());
|
||||
if (!"6132df49148c43b1a8829c108ad0fcbf".equals(id)) {
|
||||
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());
|
||||
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.stream().forEach(y -> y.setSf("队员"));
|
||||
for (int i = 0; i < ydhUserList.size(); i++) {
|
||||
ydhUserList.get(i).setSf("队员");
|
||||
ydhUserList.get(i).setIndex(i + 1);
|
||||
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");
|
||||
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.close();
|
||||
|
||||
Binary file not shown.
@@ -1,25 +1,23 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
|
||||
<div class="platform" id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年  度</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
type="year" v-model="pageForm.year"
|
||||
value-format="yyyy">
|
||||
</el-date-picker>
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,15 +25,8 @@ layout("/layouts/platform.html"){
|
||||
<div class="search-item-label">活动名称</div>
|
||||
<div class="search-item-option">
|
||||
<!--<el-input v-model="pageForm.name" placeholder="请输入活动名称" clearable></el-input>-->
|
||||
<el-select clearable filterable
|
||||
placeholder="请选择活动名称" style="width: 100%"
|
||||
v-model="pageForm.activityId">
|
||||
<el-option
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
v-for="item in activities">
|
||||
</el-option>
|
||||
<el-select clearable filterable placeholder="请选择活动名称" style="width: 100%" v-model="pageForm.activityId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in activities"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -52,32 +43,21 @@ layout("/layouts/platform.html"){
|
||||
:value="v">
|
||||
</el-option>
|
||||
</el-select>-->
|
||||
<el-select clearable placeholder="请选择活动级别"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.activityLevel">
|
||||
<el-option
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
v-for="item in activityTypeList">
|
||||
</el-option>
|
||||
<el-select clearable placeholder="请选择活动级别" style="width: 100%" v-model="pageForm.activityLevel">
|
||||
<el-option :key="item.code" :label="item.name" :value="item.code" v-for="item in activityTypeList"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
|
||||
</el-button>
|
||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||
</div>
|
||||
|
||||
<div class="search-item" style="width: 80vw">
|
||||
<div class="search-item-label">一键查询</div>
|
||||
<div class="search-item-option">
|
||||
<el-radio-group @change="doSearch" v-model="pageForm.query">
|
||||
<el-radio-button :key="it.key" :label="it.key"
|
||||
v-for="it in queryOptions">
|
||||
{{it.value}}
|
||||
</el-radio-button>
|
||||
<el-radio-button :key="it.key" :label="it.key" v-for="it in queryOptions">{{it.value}}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,30 +67,37 @@ layout("/layouts/platform.html"){
|
||||
<el-card class="mt10" shadow="never">
|
||||
<table-tool :app="this" label="活动列表">
|
||||
<template #func>
|
||||
<el-button @click="openAdd" icon="el-icon-edit-outline" size="small"
|
||||
type="primary">
|
||||
创建活动
|
||||
</el-button>
|
||||
<el-button @click="openAdd" icon="el-icon-edit-outline" size="small" type="primary">创建活动</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
|
||||
class="vi-table" row-key="id" 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
|
||||
:data="tableData"
|
||||
:size="tableSize"
|
||||
@sort-change="pageOrder"
|
||||
class="vi-table"
|
||||
row-key="id"
|
||||
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
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns">
|
||||
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template scope="{row}" v-if="column.prop=='events'">
|
||||
<span>{{row.allName}}</span>
|
||||
</template>
|
||||
@@ -127,31 +114,25 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='startTime'">
|
||||
<span v-if="row.startTime">
|
||||
{{moment(row.startTime).format('YYYY-MM-DD')}} -
|
||||
{{moment(row.endTime).format('YYYY-MM-DD')}}
|
||||
{{moment(row.startTime).format('YYYY-MM-DD')}} - {{moment(row.endTime).format('YYYY-MM-DD')}}
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
<template scope="{row}" v-else-if="column.prop=='isDisabled'">
|
||||
<el-switch
|
||||
@change="(val)=>{activityStatusChange(row,val)}"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
v-model="row.isDisabled">
|
||||
</el-switch>
|
||||
@change="(val)=>{activityStatusChange(row,val)}"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
v-model="row.isDisabled"
|
||||
></el-switch>
|
||||
</template>
|
||||
|
||||
<template
|
||||
scope="{row:{close,applyStartTime,applyEndTime,startTime,endTime,isSave}}"
|
||||
v-else-if="column.prop=='state'">
|
||||
<template 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>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" header-align="center" label="操作"
|
||||
prop="userOnline" width="150px">
|
||||
<el-table-column align="center" header-align="center" label="操作" prop="userOnline" width="150px">
|
||||
<template scope="{row}">
|
||||
<el-dropdown @command="dropdownCommand">
|
||||
<el-button :loading="row.loading" size="mini">
|
||||
@@ -159,27 +140,14 @@ layout("/layouts/platform.html"){
|
||||
<span class="ti-angle-down"></span>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{type:'sendMsg',row}">
|
||||
通知
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'openCode',row}">
|
||||
二维码
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'view',row}">
|
||||
查看
|
||||
</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-item :command="{type:'sendMsg',row}">通知</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'openCode',row}">二维码</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'view',row}">查看</el-dropdown-item>
|
||||
<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 :command="{type:'exportXlsxAll', row}">导出名单(总表)excel</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>
|
||||
</template>
|
||||
@@ -196,13 +164,18 @@ layout("/layouts/platform.html"){
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<add-activity :form="formData" :is_a06="is_A06" :is_club="is_club" :is_h10="is_h10"
|
||||
:is_sysadmin="is_sysadmin"
|
||||
:is_union="is_union"
|
||||
:unionid="'${@shiro.getPrincipalProperty('unit').getUnionid()}'"
|
||||
@flip="flip"
|
||||
@flush="flush"
|
||||
ref="activity"></add-activity>
|
||||
<add-activity
|
||||
:form="formData"
|
||||
:is_a06="is_A06"
|
||||
:is_club="is_club"
|
||||
:is_h10="is_h10"
|
||||
:is_sysadmin="is_sysadmin"
|
||||
:is_union="is_union"
|
||||
:unionid="'${@shiro.getPrincipalProperty('unit').getUnionid()}'"
|
||||
@flip="flip"
|
||||
@flush="flush"
|
||||
ref="activity"
|
||||
></add-activity>
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
@@ -213,7 +186,6 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<open-qr-code :url="url" ref="openQRCode"></open-qr-code>
|
||||
</guava>
|
||||
|
||||
</div>
|
||||
<script src="/assets/platform/module/activity/activity.js?v=1.0.0"></script>
|
||||
<script>
|
||||
@@ -221,7 +193,7 @@ layout("/layouts/platform.html"){
|
||||
const editors = {}
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
@@ -248,36 +220,36 @@ layout("/layouts/platform.html"){
|
||||
combinationMethod: []
|
||||
},
|
||||
tableColumns: [
|
||||
{prop: 'name', label: '活动名称'},
|
||||
{prop: 'activityCode', label: '活动编号', sortable: true},
|
||||
{prop: 'address', label: '活动地点'},
|
||||
{prop: 'foundUnit', label: '创建单位', sortable: true},
|
||||
{prop: 'activityLevelName', label: '活动级别', sortable: true},
|
||||
{prop: 'startTime', label: '活动日期', sortable: true},
|
||||
{prop: 'state', label: '活动状态', sortable: true},
|
||||
{prop: 'applyNum', label: '已报名人数', sortable: true},
|
||||
{prop: 'isDisabled', label: '是否开启', sortable: true},
|
||||
{prop: 'foundDate', label: '创建时间', sortable: true},
|
||||
{ prop: "name", label: "活动名称" },
|
||||
{ prop: "activityCode", label: "活动编号", sortable: true },
|
||||
{ prop: "address", label: "活动地点" },
|
||||
{ prop: "foundUnit", label: "创建单位", sortable: true },
|
||||
{ prop: "activityLevelName", label: "活动级别", sortable: true },
|
||||
{ prop: "startTime", label: "活动日期", sortable: true },
|
||||
{ prop: "state", label: "活动状态", sortable: true },
|
||||
{ prop: "applyNum", label: "已报名人数", sortable: true },
|
||||
{ prop: "isDisabled", label: "是否开启", sortable: true },
|
||||
{ prop: "foundDate", label: "创建时间", sortable: true }
|
||||
],
|
||||
pageForm: {
|
||||
query: 'zero'
|
||||
query: "zero"
|
||||
},
|
||||
queryOptions: [
|
||||
{key: 'zero', value: '全部'},
|
||||
{key: 'one', value: '正在报名'},
|
||||
{key: 'two', value: '报名结束'},
|
||||
{key: 'three', value: '活动进行中'},
|
||||
{key: 'four', value: '活动已结束'},
|
||||
{ key: "zero", value: "全部" },
|
||||
{ key: "one", value: "正在报名" },
|
||||
{ key: "two", value: "报名结束" },
|
||||
{ key: "three", value: "活动进行中" },
|
||||
{ key: "four", value: "活动已结束" }
|
||||
],
|
||||
url: '',
|
||||
url: ""
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
||||
'info': httpVueLoader('/components/activity/school/Info.vue?v=' + new Date().getTime()),
|
||||
'add-activity': httpVueLoader('/components/activity/school/AddActivity.vue?v=' + new Date().getTime()),
|
||||
'send-msg': httpVueLoader('/components/plugins/SendMsgByGroupId.vue'),
|
||||
'open-qr-code': httpVueLoader('/components/plugins/OpenQRCode.vue'),
|
||||
guava: httpVueLoader("/components/plugins/Guava.vue"),
|
||||
info: httpVueLoader("/components/activity/school/Info.vue?v=" + new Date().getTime()),
|
||||
"add-activity": httpVueLoader("/components/activity/school/AddActivity.vue?v=" + new Date().getTime()),
|
||||
"send-msg": httpVueLoader("/components/plugins/SendMsgByGroupId.vue"),
|
||||
"open-qr-code": httpVueLoader("/components/plugins/OpenQRCode.vue")
|
||||
},
|
||||
methods: {
|
||||
getStatus(close, applyStartTime, applyEndTime, startTime, endTime) {
|
||||
@@ -285,7 +257,7 @@ layout("/layouts/platform.html"){
|
||||
return `<span class="text-danger">活动已关闭</span>`
|
||||
}
|
||||
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()) {
|
||||
return `<span class="text-info">未开始报名</span>`
|
||||
@@ -300,12 +272,12 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
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,
|
||||
isDisabled: val
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.pageData();
|
||||
this.pageData()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
@@ -319,20 +291,22 @@ layout("/layouts/platform.html"){
|
||||
this.pageData()
|
||||
},
|
||||
dropdownCommand(command) {
|
||||
const {type, row} = command
|
||||
if (type === 'view') {
|
||||
const { type, row } = command
|
||||
if (type === "view") {
|
||||
this.openView(row)
|
||||
} else if (type === 'edit') {
|
||||
} else if (type === "edit") {
|
||||
this.openEdit(row)
|
||||
} else if (type === 'delete') {
|
||||
} else if (type === "delete") {
|
||||
this.doDelete(row)
|
||||
} else if (type === 'export') {
|
||||
} else if (type === "export") {
|
||||
window.open("/platform/activity/common/export?id=" + row.id)
|
||||
} else if (type === 'exportXlsx') {
|
||||
window.open("/platform/activity/common/exportXlsx?id=" + row.id)
|
||||
}else if (type == 'sendMsg') {
|
||||
} else if (type === "exportXlsx") {
|
||||
window.open("/platform/activity/common/exportXlsx?id=" + row.id + "&isUnion=true")
|
||||
} else if (type === "exportXlsxAll") {
|
||||
window.open("/platform/activity/common/exportXlsx?id=" + row.id + "&isUnion=false")
|
||||
} else if (type === "sendMsg") {
|
||||
this.sendMsg(row)
|
||||
} else if (type === 'openCode') {
|
||||
} else if (type === "openCode") {
|
||||
this.openCode(row)
|
||||
}
|
||||
},
|
||||
@@ -344,12 +318,11 @@ layout("/layouts/platform.html"){
|
||||
this.$refs.sendMsg.openDialog(row.activityGroupId)
|
||||
},
|
||||
openView(row) {
|
||||
const {id} = row
|
||||
const { id } = row
|
||||
this.$refs.guava.view()
|
||||
setTimeout(() => {
|
||||
this.$refs.info.getInfo(id)
|
||||
}, 500)
|
||||
|
||||
},
|
||||
async openAdd() {
|
||||
this.$refs.guava.edit()
|
||||
@@ -358,7 +331,7 @@ layout("/layouts/platform.html"){
|
||||
}, 500)
|
||||
},
|
||||
async openEdit(row) {
|
||||
const {id, applyStartTime, isSave} = row
|
||||
const { id, applyStartTime, isSave } = row
|
||||
this.formData.id = id
|
||||
const now = moment().valueOf()
|
||||
this.$refs.guava.edit()
|
||||
@@ -367,26 +340,25 @@ layout("/layouts/platform.html"){
|
||||
}, 500)
|
||||
},
|
||||
doDelete(row) {
|
||||
const {id} = row
|
||||
this.$confirm('确定要删除该活动吗?', '提示', {type: 'warning'}).then(async () => {
|
||||
this.$set(row, "loading", true)
|
||||
const resp = await $.post(loc() + "/doDelete", {id});
|
||||
this.$set(row, "loading", false)
|
||||
if (resp.code === 0) {
|
||||
this.pageData()
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
const { id } = row
|
||||
this.$confirm("确定要删除该活动吗?", "提示", { type: "warning" }).then(async () => {
|
||||
this.$set(row, "loading", true)
|
||||
const resp = await $.post(loc() + "/doDelete", { id })
|
||||
this.$set(row, "loading", false)
|
||||
if (resp.code === 0) {
|
||||
this.pageData()
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
);
|
||||
})
|
||||
},
|
||||
async getActivitys() {
|
||||
const {data} = await $.get("/platform/activity/remind/getActivitys")
|
||||
return data;
|
||||
const { data } = await $.get("/platform/activity/remind/getActivitys")
|
||||
return data
|
||||
},
|
||||
async getActivityTypeList(code) {
|
||||
const {data} = await $.get("/platform/activity/basic/basic/settings/getActivityTwoLevelType", {code: code})
|
||||
return data;
|
||||
const { data } = await $.get("/platform/activity/basic/basic/settings/getActivityTwoLevelType", { code: code })
|
||||
return data
|
||||
},
|
||||
async doOperate() {
|
||||
await this.$refs.activity.operate()
|
||||
@@ -394,21 +366,27 @@ layout("/layouts/platform.html"){
|
||||
async doSave() {
|
||||
this.$refs.activity.doSave()
|
||||
},
|
||||
pageData() {//加载分页数据
|
||||
sublime.showLoadingbar();//显示loading
|
||||
$.post(loc() + "/pageData", this.pageForm, (data) => {
|
||||
sublime.closeLoadingbar();//关闭loading
|
||||
if (data.code == 0) {
|
||||
this.tableData = data.data.list;
|
||||
this.pageForm.totalCount = data.data.totalCount;
|
||||
} else {
|
||||
this.$message({
|
||||
message: data.msg,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}, "json");
|
||||
},
|
||||
pageData() {
|
||||
//加载分页数据
|
||||
sublime.showLoadingbar() //显示loading
|
||||
$.post(
|
||||
loc() + "/pageData",
|
||||
this.pageForm,
|
||||
(data) => {
|
||||
sublime.closeLoadingbar() //关闭loading
|
||||
if (data.code == 0) {
|
||||
this.tableData = data.data.list
|
||||
this.pageForm.totalCount = data.data.totalCount
|
||||
} else {
|
||||
this.$message({
|
||||
message: data.msg,
|
||||
type: "error"
|
||||
})
|
||||
}
|
||||
},
|
||||
"json"
|
||||
)
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
if ("${@shiro.hasRole('club01')}" === "true") {
|
||||
|
||||
Reference in New Issue
Block a user