commit
This commit is contained in:
+165
@@ -0,0 +1,165 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.blessing.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.DateUtil;
|
||||
import com.budwk.app.sys.models.Sys_task;
|
||||
import com.budwk.app.sys.services.SysTaskService;
|
||||
import com.budwk.app.task.services.TaskPlatformService;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.models.Blessing;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.models.BlessingUser;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.service.BlessingService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.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 org.nutz.trans.Trans;
|
||||
import org.quartz.CronExpression;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@ApiOperation("职工祝福")
|
||||
@At("/platform/blessing/applyList")
|
||||
public class BlessingController {
|
||||
|
||||
@Inject
|
||||
private BlessingService blessingService;
|
||||
|
||||
@Inject
|
||||
private TaskPlatformService taskPlatformService;
|
||||
|
||||
@Inject
|
||||
private SysTaskService sysTaskService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/blessing/applyList.html")
|
||||
@SaCheckPermission("blessing.applyList")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("blessing.applyList")
|
||||
public Result pageData(PageForm pageForm, String blessingName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
bl.*,
|
||||
aus.groupName
|
||||
FROM
|
||||
`blessing` bl
|
||||
LEFT JOIN activity_user_scope aus ON aus.groupId = bl.activityGroupId
|
||||
$condition
|
||||
""");
|
||||
if (Strings.isNotBlank(blessingName)) {
|
||||
cnd.where().andLike("bl.blessingName", blessingName);
|
||||
}
|
||||
cnd.groupBy("aus.groupId");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(blessingService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("blessing.applyList")
|
||||
public Result doAdd(@Param("Blessing") Blessing blessing) {
|
||||
blessing.setApplyDate(DateUtil.getDate());
|
||||
blessingService.insert(blessing);
|
||||
if (blessing.getIsSend().equals("1")) {
|
||||
blessingService.addTask(blessing);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("blessing.applyList")
|
||||
public Result doEdit(@Param("Blessing") Blessing blessing) {
|
||||
if (Strings.isNotBlank(blessing.getBlessingCron()) && !blessing.getBlessingCron().equals("* * * * * ? *")) {
|
||||
blessing.setApplyDate(DateUtil.getDate());
|
||||
blessingService.updateIgnoreNull(blessing);
|
||||
if (blessing.getIsSend().equals("1")) {
|
||||
blessingService.editTask(blessing);
|
||||
}
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("blessing.applyList")
|
||||
public Result doDelete(String id) {
|
||||
blessingService.delete(id);
|
||||
Sys_task sysTask = sysTaskService.fetch(Cnd.where("name", "=", id));
|
||||
blessingService.dao().clear(BlessingUser.class, Cnd.where("blessingId", "=", id));
|
||||
if (sysTask != null) {
|
||||
taskPlatformService.delete(sysTask.getId(), sysTask.getId());
|
||||
sysTaskService.delete(sysTask.getId());
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@SaCheckPermission("blessing.applyList")
|
||||
public Result findOne(String id) {
|
||||
try {
|
||||
Blessing blessing = blessingService.fetch(id);
|
||||
NutMap nutMap = NutMap.WRAP(JSON.parseObject(JSON.toJSONString(blessing)));
|
||||
List<String> result = new ArrayList<>();
|
||||
try {
|
||||
CronExpression cronExpression = new CronExpression(nutMap.getString("blessingCron"));
|
||||
Date lastTime = new Date();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
lastTime = cronExpression.getNextValidTimeAfter(lastTime);
|
||||
if (lastTime != null) {
|
||||
result.add(DateUtil.formatDateTime(lastTime));
|
||||
} else {
|
||||
String[] newStr = nutMap.getString("blessingCron").split(" ");
|
||||
String second = (newStr[0].equals("?") || newStr[0].equals("*")) ? "00" : newStr[0];
|
||||
String minute = (newStr[1].equals("?") || newStr[1].equals("*")) ? "00" : newStr[1];
|
||||
String hour = (newStr[2].equals("?") || newStr[2].equals("*")) ? "00" : newStr[2];
|
||||
String day = (newStr[3].equals("?") || newStr[3].equals("*")) ? "00" : newStr[3];
|
||||
String month = (newStr[4].equals("?") || newStr[4].equals("*")) ? "00" : newStr[4];
|
||||
String s6 = (newStr[5].equals("?") || newStr[5].equals("*")) ? "00" : newStr[5];
|
||||
String year = (newStr[6].equals("?") || newStr[6].equals("*")) ? "00" : newStr[6];
|
||||
String Time = year + "/" + month + "/" + day + " " + hour + ":" + minute + ":" + second;
|
||||
result.add(Time);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
nutMap.setv("blessingDate", result);
|
||||
return Result.success(nutMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.blessing.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.service.BlessingService;
|
||||
import org.nutz.dao.Cnd;
|
||||
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.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@Ok("json:full")
|
||||
@At("/platform/blessing/userList")
|
||||
public class BlessingUserController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/blessing/blessingUser.html")
|
||||
@SaCheckPermission("blessing.user")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@Inject
|
||||
private BlessingService blessingService;
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("blessing.user")
|
||||
public Result pageData(PageForm pageForm, String data, String unionId, String unitId, String personType, String userState, String sex, String blessingName) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unionname,
|
||||
u.unitname,
|
||||
u.birthday,
|
||||
blu.*,
|
||||
bl.blessingName
|
||||
FROM
|
||||
blessing_user blu
|
||||
LEFT JOIN blessing bl ON bl.id = blu.blessingId
|
||||
LEFT JOIN `user` u ON u.id = blu.userId
|
||||
$condition
|
||||
""");
|
||||
if (Strings.isNotBlank(pageForm.getSearchKeyword()) && Strings.isNotBlank(pageForm.getSearchName())) {
|
||||
cnd.where().andLike(pageForm.getSearchName(), pageForm.getSearchKeyword());
|
||||
}
|
||||
if (Strings.isNotBlank(blessingName)) {
|
||||
cnd.where().andLike("bl.blessingName", blessingName);
|
||||
}
|
||||
cnd.andEX("u.unionid", "=", unionId);
|
||||
cnd.andEX("u.unitid", "=", unitId);
|
||||
cnd.andEX("u.personType", "=", personType);
|
||||
cnd.andEX("u.userState", "=", userState);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
cnd.andEX("blu.applyDate", "=", data);
|
||||
cnd.desc("blu.blessingId");
|
||||
cnd.desc("blu.applyDate");
|
||||
cnd.desc("u.unitid");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(blessingService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.blessing.models;
|
||||
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class Blessing extends BaseModel {
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("祝福名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String blessingName;
|
||||
|
||||
@Column
|
||||
@Comment("发送范围")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String activityGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("祝福模式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String blessingMode;
|
||||
|
||||
@Column
|
||||
@Comment("是否发送,0未开启,1 进行中,2,已完成")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 2)
|
||||
private String isSend;
|
||||
|
||||
@Column
|
||||
@Comment("发送方式")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> sendTypes;
|
||||
|
||||
@Column
|
||||
@Comment("祝福内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String blessingContent;
|
||||
|
||||
@Column
|
||||
@Comment("cron表达式")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String blessingCron;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String applyDate;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.blessing.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
@Data
|
||||
@Table
|
||||
public class BlessingUser extends BaseModel {
|
||||
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("接收人ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
|
||||
@Column
|
||||
@Comment("祝福ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String blessingId;
|
||||
|
||||
@Column
|
||||
@Comment("发送时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String applyDate;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.blessing.service;
|
||||
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.models.Blessing;
|
||||
|
||||
public interface BlessingService extends BaseService<Blessing> {
|
||||
|
||||
|
||||
/**
|
||||
* 添加任务
|
||||
*
|
||||
* @param blessing
|
||||
*/
|
||||
void addTask(Blessing blessing);
|
||||
|
||||
/**
|
||||
* 修改任务
|
||||
*
|
||||
* @param blessing
|
||||
*/
|
||||
void editTask(Blessing blessing);
|
||||
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.blessing.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_task;
|
||||
import com.budwk.app.sys.services.SysTaskService;
|
||||
import com.budwk.app.task.services.TaskPlatformService;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.models.Blessing;
|
||||
import com.budwk.app.zhgh.staffbenefit.blessing.service.BlessingService;
|
||||
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.json.Json;
|
||||
import org.nutz.trans.Trans;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class BlessingServiceImpl extends BaseServiceImpl<Blessing> implements BlessingService {
|
||||
public BlessingServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
private final String JOB_CLASS = "io.v.nutz.task.job.BlessingJob"; //调用类
|
||||
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@Inject
|
||||
private TaskPlatformService taskPlatformService;
|
||||
|
||||
@Inject
|
||||
private SysTaskService sysTaskService;
|
||||
|
||||
@Override
|
||||
public void addTask(Blessing blessing) {
|
||||
Trans.exec(() -> {
|
||||
Sys_task sys_task = new Sys_task();
|
||||
sys_task.setName(blessing.getId());
|
||||
|
||||
sys_task.setNote(blessing.getBlessingName());
|
||||
sys_task.setJobClass(JOB_CLASS);
|
||||
sys_task.setCron(blessing.getBlessingCron());
|
||||
sys_task.setData(Json.toJson(new HashMap<String, Object>() {{
|
||||
put("blessingId", blessing.getId());
|
||||
}}));
|
||||
sys_task.setDisabled(false);
|
||||
sys_task = sysTaskService.insert(sys_task);
|
||||
taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editTask(Blessing blessing) {
|
||||
Sys_task sys_task = sysTaskService.fetch(Cnd.where("name", "=", blessing.getId()));
|
||||
sys_task.setCron(blessing.getBlessingCron());
|
||||
sysTaskService.updateIgnoreNull(sys_task);
|
||||
|
||||
taskPlatformService.delete(sys_task.getId(), sys_task.getId());
|
||||
taskPlatformService.add(sys_task.getId(), sys_task.getId(), sys_task.getJobClass(), sys_task.getCron(), sys_task.getNote(), sys_task.getData());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.pop_btn[data-v-4da915b3]{text-align:center;margin-top:20px}.popup-main[data-v-4da915b3]{position:relative;margin:10px auto;background:#fff;border-radius:5px;font-size:12px;overflow:hidden}.popup-title[data-v-4da915b3]{overflow:hidden;line-height:34px;padding-top:6px;background:#f2f2f2}.popup-result[data-v-4da915b3]{-webkit-box-sizing:border-box;box-sizing:border-box;line-height:24px;margin:25px auto;padding:15px 10px 10px;border:1px solid #ccc;position:relative}.popup-result .title[data-v-4da915b3]{position:absolute;top:-28px;left:50%;width:140px;font-size:14px;margin-left:-70px;text-align:center;line-height:30px;background:#fff}.popup-result table[data-v-4da915b3]{text-align:center;width:100%;margin:0 auto}.popup-result table span[data-v-4da915b3]{display:block;width:100%;font-family:arial;line-height:30px;height:30px;white-space:nowrap;overflow:hidden;border:1px solid #e8e8e8}.popup-result-scroll[data-v-4da915b3]{font-size:12px;line-height:24px;height:10em;overflow-y:auto}
|
||||
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,398 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
|
||||
<style>
|
||||
.box {
|
||||
width: 500px;
|
||||
height: 100px;
|
||||
margin: 150px auto 0;
|
||||
}
|
||||
|
||||
.inp {
|
||||
width: 300px !important;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
|
||||
|
||||
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
|
||||
<div 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-input placeholder="请输入祝福名称" v-model="pageForm.blessingName" clearable>
|
||||
<template slot="prepend">祝福名称</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="祝福列表">
|
||||
<el-button icon="el-icon-s-promotion" type="primary" size="small"
|
||||
@click="openAdd">新建祝福
|
||||
</el-button>
|
||||
</table-tool>
|
||||
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
ref="table"
|
||||
:size="tableSize" class="vi-table">
|
||||
|
||||
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
|
||||
width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
>
|
||||
<template v-if="column.prop==='blessingMode'" scope="{row:{blessingMode}}">
|
||||
{{blessingMode=='birthday'?'生日祝福':'其它祝福'}}
|
||||
</template>
|
||||
<template v-else-if="column.prop==='isSend'" scope="{row:{isSend}}">
|
||||
{{isSend=='2'?'任务已完成':isSend=='1'?'进行中':'未开启'}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="300px">
|
||||
<template scope="{row}">
|
||||
|
||||
<el-button type="primary" @click="openView(row)" size="mini">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button type="primary" @click="openEdit(row)" size="mini" :disabled="row.isSend!=0">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="danger" @click="doDelete(row)" size="mini">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<el-form :model="formData" ref="addForm" :rules="formRules" label-width="120px"
|
||||
style="width: 50%;margin: auto">
|
||||
|
||||
<el-row gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="blessingName" label="祝福名称">
|
||||
<el-input v-model="formData.blessingName" style="width: 100%"
|
||||
type="text"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="activityGroupId" label="发送范围">
|
||||
<el-select v-model="formData.activityGroupId" placeholder="请选择发送范围" filterable
|
||||
clearable
|
||||
style="width: 100%">
|
||||
<el-option v-for="item in activityGroupList"
|
||||
:value="item.groupId"
|
||||
:key="item.groupId"
|
||||
:label="item.groupName"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="blessingMode" label="祝福模式">
|
||||
<el-select v-model="formData.blessingMode" placeholder="请选择祝福模式" filterable clearable
|
||||
style="width: 100%">
|
||||
<el-option label="生日祝福" value="birthday"></el-option>
|
||||
<el-option label="其它祝福" value="other"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="isSend" label="是否发送">
|
||||
<el-switch
|
||||
v-model="formData.isSend"
|
||||
active-color="#13ce66"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
inactive-color="#ff4949">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="发送方式" prop="sendTypes">
|
||||
<el-checkbox-group v-model="formData.sendTypes" size="medium">
|
||||
<el-checkbox border label="msg">短信发送</el-checkbox>
|
||||
<el-checkbox border label="WeChat">微信发送</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="日期和时间" prop="blessingCron">
|
||||
<el-input v-for="a in cronExecuteDate" :value="a" readonly></el-input>
|
||||
<!-- <el-input v-model="formData.blessingCron" placeholder class="inp" readonly></el-input>-->
|
||||
<el-button type="primary" @click="showDialog">设置日期和时间</el-button>
|
||||
<sapn style="color: red" v-if="cronExecuteDate.length>2">只展示最近五次执行时间</sapn>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item prop="blessingContent" label="祝福内容">
|
||||
<el-input v-model="formData.blessingContent" style="width: 100%"
|
||||
type="textarea" rows="4"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-row style="float: right">
|
||||
<el-button type="primary" @click="formData.id?doEdit():doAdd()">创建</el-button>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
|
||||
<el-form label-suffix=":" label-width="140px" label-position="left" style="width: 50%;margin: auto">
|
||||
|
||||
<el-row gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="祝福名称">
|
||||
<el-input readonly :value="viewData.blessingName"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="发送范围">
|
||||
<el-input readonly :value="viewData.groupName"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="祝福模式">
|
||||
<el-input readonly
|
||||
:value="viewData.blessingMode==='other'?'其它祝福':'生日祝福'"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否发送">
|
||||
<el-input readonly
|
||||
:value="viewData.isSend==='0'?'未开启':viewData.isSend==='1'?'进行中':'任务已完成'"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="最近五次执行时间">
|
||||
<el-input readonly v-for="a in viewData.blessingDate" :value="a"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="祝福内容">
|
||||
<el-input style="width: 100%" readonly :value="viewData.blessingContent" rows="4"
|
||||
type="textarea"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-dialog title="生成 cron" :visible.sync="showCron">
|
||||
<vcron :expression="formData.blessingCron"
|
||||
@hide="showCron=false"
|
||||
@fill="crontabFill"
|
||||
ref="cron"></vcron>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"vcron": vcrontab.default
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cronExecuteDate: [],
|
||||
viewData: {},
|
||||
formData: {
|
||||
sendTypes: [],
|
||||
blessingCron: ''
|
||||
},
|
||||
pageForm: {
|
||||
blessingName: ''
|
||||
},
|
||||
activityGroupList: [],
|
||||
dialogVisible: false,
|
||||
tableColumns: [
|
||||
{prop: 'blessingName', label: '祝福名称'},
|
||||
{prop: 'groupName', label: '发送范围'},
|
||||
{prop: 'blessingMode', label: '祝福模式'},
|
||||
{prop: 'sendTypesName', label: '发送方式',},
|
||||
{prop: 'isSend', label: '是否发送',},
|
||||
],
|
||||
formRules: {
|
||||
blessingName: [{required: true, message: '请填写祝福名称', trigger: ['blur', 'change']}],
|
||||
activityGroupId: [{required: true, message: '请选择发送范围', trigger: ['blur', 'change']}],
|
||||
blessingMode: [{required: true, message: '请选择祝福模式', trigger: ['blur', 'change']}],
|
||||
sendTypes: [{required: true, message: '请选择发送方式', trigger: ['blur', 'change']}],
|
||||
blessingContent: [{required: true, message: '请填写祝福内容', trigger: ['blur', 'change']}],
|
||||
},
|
||||
showCron: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async openView(row) {
|
||||
const {data} = await $.post(loc() + '/findOne', {id: row.id})
|
||||
this.viewData = row
|
||||
this.viewData.blessingDate = data.blessingDate
|
||||
this.$refs.guava.view()
|
||||
|
||||
},
|
||||
async openEdit(row) {
|
||||
|
||||
const {data} = await $.post(loc() + '/findOne', {id: row.id})
|
||||
this.$set(this, "formData", data)
|
||||
this.$refs.guava.edit()
|
||||
if (this.$refs['addForm']) {
|
||||
this.$refs['addForm'].resetFields()
|
||||
}
|
||||
|
||||
},
|
||||
async doDelete(row) {
|
||||
const confirm = await this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const data = await $.post('/platform/blessing/applyList/doDelete', {id: row.id})
|
||||
if (data.code == 0) {
|
||||
this.$message.success(data.msg);
|
||||
this.$refs.guava.index()
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
async doEdit() {
|
||||
this.$refs["addForm"].validate(async valid => {
|
||||
if (valid) {
|
||||
const confirm = await this.$confirm('确定要修改吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const data = await $.post(loc() + '/doEdit', {Blessing: JSON.stringify(this.formData)})
|
||||
if (data.code == 0) {
|
||||
this.$message.success(data.msg);
|
||||
this.$refs.guava.index()
|
||||
if (this.$refs['addForm']) {
|
||||
this.$refs['addForm'].resetFields()
|
||||
}
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
doAdd() {
|
||||
this.$refs["addForm"].validate(async valid => {
|
||||
if (valid) {
|
||||
const confirm = await this.$confirm('确定要创建吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === "confirm") {
|
||||
const data = await $.post(loc() + '/doAdd', {Blessing: JSON.stringify(this.formData)})
|
||||
if (data.code == 0) {
|
||||
this.$message.success(data.msg);
|
||||
window.location.reload();
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async getActivityGroup() {
|
||||
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
|
||||
this.activityGroupList = data
|
||||
},
|
||||
openAdd() {
|
||||
this.$refs.guava.edit()
|
||||
this.formData = {
|
||||
sendTypes: [],
|
||||
blessingCron: ''
|
||||
}
|
||||
},
|
||||
crontabFill(value) {
|
||||
this.$set(this.formData, 'blessingCron', value)
|
||||
this.cronExecuteDate = this.$refs.cron.cronExecuteDate
|
||||
},
|
||||
showDialog() {
|
||||
this.expression = this.input
|
||||
this.showCron = true
|
||||
},
|
||||
pageData() {
|
||||
this.tableLoading = true
|
||||
$.post(loc() + "/pageData", this.pageForm, (data) => {
|
||||
this.tableLoading = false
|
||||
if (data.code == 0) {
|
||||
data.data.list.forEach(v => {
|
||||
if (v.sendTypes) {
|
||||
const a = JSON.parse(v.sendTypes).map(z => {
|
||||
if (z == "msg") {
|
||||
return "短信"
|
||||
} else {
|
||||
return "微信"
|
||||
}
|
||||
|
||||
})
|
||||
v.sendTypesName = a.toString()
|
||||
}
|
||||
|
||||
})
|
||||
this.tableData = data.data.list;
|
||||
this.pageForm.totalCount = data.data.totalCount;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.getActivityGroup()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.box {
|
||||
width: 500px;
|
||||
height: 100px;
|
||||
margin: 150px auto 0;
|
||||
}
|
||||
|
||||
.inp {
|
||||
width: 300px !important;
|
||||
margin-right: 20px;
|
||||
}
|
||||
</style>
|
||||
<link href="${base!}/assets/platform/plugins/vue-cron/vcrontab.css" rel="stylesheet"/>
|
||||
|
||||
<script src="${base!}/assets/platform/plugins/vue-cron/vcrontab.umd.min.js"></script>
|
||||
<div id="app" class="platform" 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-input placeholder="请输入祝福名称" v-model="pageForm.blessingName" clearable>
|
||||
<template slot="prepend">祝福名称</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">职工信息:</div>
|
||||
<div class="search-item-option">
|
||||
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
|
||||
style="width: 100%"
|
||||
@keyup.enter.native="doSearch">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
|
||||
style="width: 80px;">
|
||||
<el-option label="姓名" value="username"></el-option>
|
||||
<el-option label="工号" value="loginname"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item"
|
||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}">
|
||||
<div class="search-item-label">所属工会:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
|
||||
clearable="true"
|
||||
@change="flushUnits" @clear="flushUnits"
|
||||
filterable="true">
|
||||
<el-option v-for="item in unions" :label="item.unionname" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属单位:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
|
||||
clearable="true"
|
||||
filterable="true">
|
||||
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">祝福时间:</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
v-model="pageForm.data"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="searchMore">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">人员类型:</div>
|
||||
<div class="search-item-option">
|
||||
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
|
||||
placeholder="人员类型"
|
||||
code="UserType"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">在职状态:</div>
|
||||
<div class="search-item-option">
|
||||
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
|
||||
placeholder="在职状态"
|
||||
code="UserState"></dict-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">性  别:</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.sex" style="width: 100%" clearable
|
||||
placeholder="请选择">
|
||||
<el-option v-for="sex in sexOptions" :label="sex" :value="sex"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
|
||||
<more v-model="searchMore"></more>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt20">
|
||||
|
||||
|
||||
<table-tool label="用户列表" :app="this">
|
||||
<template #func>
|
||||
|
||||
</template>
|
||||
</table-tool>
|
||||
|
||||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||||
ref="table"
|
||||
:size="tableSize" class="vi-table">
|
||||
|
||||
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
|
||||
width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
align="center"
|
||||
header-align="center"
|
||||
v-for="column in tableColumns"
|
||||
show-overflow-tooltip
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
</guava>
|
||||
|
||||
|
||||
</div>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"vcron": vcrontab.default,
|
||||
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
data: moment().format('YYYY-MM-DD'),
|
||||
searchName: "username",
|
||||
blessingName: ''
|
||||
},
|
||||
sexOptions: ['男', '女'],
|
||||
unions: [],
|
||||
units: [],
|
||||
activityGroupList: [],
|
||||
dialogVisible: false,
|
||||
tableColumns: [
|
||||
{prop: 'blessingName', label: '祝福名称'},
|
||||
{prop: 'loginname', label: '工号'},
|
||||
{prop: 'username', label: '姓名'},
|
||||
{prop: 'sex', label: '性别'},
|
||||
{prop: 'personType', label: '人员类型', sortable: true},
|
||||
{prop: 'userState', label: '在职状态', sortable: true},
|
||||
{prop: 'unionname', label: '所属工会', sortable: true},
|
||||
{prop: 'unitname', label: '所属单位', sortable: true},
|
||||
{prop: 'birthday', label: '出生日期', sortable: true},
|
||||
{prop: 'applyDate', label: '发送时间', sortable: true},
|
||||
],
|
||||
formRules: {},
|
||||
showCron: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
async getActivityGroup() {
|
||||
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
|
||||
this.activityGroupList = data
|
||||
},
|
||||
async flushUnits() {
|
||||
this.$set(this.pageForm, "unitId", "")
|
||||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
|
||||
this.units = await getUnits(this.pageForm.unionId)
|
||||
} else {
|
||||
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
async created() {
|
||||
await this.getActivityGroup()
|
||||
this.pageData()
|
||||
this.unions = await getUnions()
|
||||
this.flushUnits()
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
|
||||
Reference in New Issue
Block a user