..
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"printWidth": 150,
|
||||
"printWidth": 250,
|
||||
"singleQuote": false,
|
||||
"tabWidth": 4,
|
||||
"semi": false,
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package com.budwk.app.zhgh.dayofficework.birthdayWishes.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_task;
|
||||
import com.budwk.app.sys.services.SysTaskService;
|
||||
import com.budwk.app.task.services.TaskPlatformService;
|
||||
import com.budwk.app.zhgh.dayofficework.birthdayWishes.models.BirthdayWishesPlan;
|
||||
import com.budwk.app.zhgh.dayofficework.birthdayWishes.service.BirthdayWishesService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/birthdayWishes/plan")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "生日祝福")
|
||||
public class BirthdayWishesPlanController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BirthdayWishesService birthdayWishesService;
|
||||
@Inject
|
||||
private SysTaskService sysTaskService;
|
||||
@Inject
|
||||
private TaskPlatformService taskPlatformService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/birthdayWishes/plan/index.html")
|
||||
@SaCheckPermission("birthdayWishes")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("birthdayWishes")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Pagination pagination = birthdayWishesService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("添加计划")
|
||||
@SaCheckPermission("birthdayWishes")
|
||||
public Result insert(BirthdayWishesPlan wishesPlan) {
|
||||
dao.insert(wishesPlan);
|
||||
|
||||
// 插入定时任务
|
||||
Sys_task sysTask = new Sys_task();
|
||||
sysTask.setId(wishesPlan.getId());
|
||||
sysTask.setName(wishesPlan.getName());
|
||||
sysTask.setJobClass("com.budwk.app.zhgh.dayofficework.birthdayWishes.task.BirthdayWishesTask");
|
||||
sysTask.setCron(wishesPlan.getCron());
|
||||
sysTask.setData(Json.toJson(wishesPlan));
|
||||
sysTask.setDisabled(!wishesPlan.getEnabled());
|
||||
// sysTaskService.fastInsert(sysTask);
|
||||
sysTaskService.insert("sys_task", Chain.from(sysTask));
|
||||
|
||||
// 添加定时任务
|
||||
if (wishesPlan.getEnabled()) {
|
||||
if (!taskPlatformService.isExist(sysTask.getId(), sysTask.getId())) {
|
||||
taskPlatformService.add(sysTask.getId(), sysTask.getId(), sysTask.getJobClass(), sysTask.getCron(), sysTask.getNote(), sysTask.getData());
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("更新计划")
|
||||
@SaCheckPermission("birthdayWishes")
|
||||
public Result update(BirthdayWishesPlan wishesPlan) {
|
||||
dao.update(wishesPlan);
|
||||
|
||||
Sys_task sysTask = sysTaskService.fetch(wishesPlan.getId());
|
||||
sysTask.setName(wishesPlan.getName());
|
||||
sysTask.setCron(wishesPlan.getCron());
|
||||
sysTask.setData(Json.toJson(wishesPlan));
|
||||
sysTask.setDisabled(!wishesPlan.getEnabled());
|
||||
sysTaskService.update(sysTask);
|
||||
|
||||
if (wishesPlan.getEnabled()) {
|
||||
if (taskPlatformService.isExist(sysTask.getId(), sysTask.getId())) {
|
||||
taskPlatformService.delete(sysTask.getId(), sysTask.getId());
|
||||
}
|
||||
taskPlatformService.add(sysTask.getId(), sysTask.getId(), sysTask.getJobClass(), sysTask.getCron(), sysTask.getNote(), sysTask.getData());
|
||||
} else {
|
||||
if (taskPlatformService.isExist(sysTask.getId(), sysTask.getId())) {
|
||||
taskPlatformService.delete(sysTask.getId(), sysTask.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("删除计划")
|
||||
@SaCheckPermission("birthdayWishes")
|
||||
public Result delete(@Param("id") String id) {
|
||||
dao.delete(BirthdayWishesPlan.class, id);
|
||||
dao.clear(Sys_task.class, Cnd.where(Sys_task::getId, "=", id));
|
||||
if (taskPlatformService.isExist(id, id)) {
|
||||
taskPlatformService.delete(id, id);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.budwk.app.zhgh.dayofficework.birthdayWishes.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("birthday_wishes_plan")
|
||||
@Comment("生日祝福计划")
|
||||
public class BirthdayWishesPlan extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Comment("计划名称")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Comment("定时任务")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String cron;
|
||||
|
||||
@Comment("模板")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String template;
|
||||
|
||||
@Comment("是否启用")
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.zhgh.dayofficework.birthdayWishes.service;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.dayofficework.birthdayWishes.models.BirthdayWishesPlan;
|
||||
|
||||
public interface BirthdayWishesService extends BaseService<BirthdayWishesPlan> {
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.budwk.app.zhgh.dayofficework.birthdayWishes.service.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.zhgh.dayofficework.birthdayWishes.models.BirthdayWishesPlan;
|
||||
import com.budwk.app.zhgh.dayofficework.birthdayWishes.service.BirthdayWishesService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class BirthdayWishesServiceImpl extends BaseServiceImpl<BirthdayWishesPlan> implements BirthdayWishesService {
|
||||
public BirthdayWishesServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.budwk.app.zhgh.dayofficework.birthdayWishes.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.budwk.app.sys.models.Sys_msg;
|
||||
import com.budwk.app.sys.services.SysMsgService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Slf4j
|
||||
public class BirthdayWishesTask implements Job {
|
||||
|
||||
@Inject
|
||||
protected SysMsgService sysMsgService;
|
||||
@Inject
|
||||
protected Dao dao;
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
log.info("=================================执行计划任务:{}", context.getJobDetail().getKey().getName());
|
||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||
log.info("=================================参数:{}", Json.toJson(dataMap));
|
||||
|
||||
String planName = dataMap.getString("name");
|
||||
|
||||
String today = DateUtil.today();
|
||||
|
||||
Sys_msg msg = new Sys_msg();
|
||||
msg.setTitle(planName + today);
|
||||
msg.setType("user");
|
||||
msg.setSendType("show");
|
||||
msg.setSendAt(DateUtil.current());
|
||||
msg.setNote(dataMap.getString("template"));
|
||||
|
||||
// 查询今天生日的会员用户
|
||||
Sql sql = Sqls.create("SELECT loginname FROM sys_user WHERE member = 1 AND MONTH(birthday) = MONTH(CURRENT_DATE) AND DAY(birthday) = DAY(CURRENT_DATE)");
|
||||
sql.setCallback(Sqls.callback.strList());
|
||||
dao.execute(sql);
|
||||
List<String> users = sql.getList(String.class);
|
||||
// 转为数组
|
||||
String[] userArray = users.toArray(String[]::new);
|
||||
log.info("=================================查询今天生日会员用户:{}", users);
|
||||
|
||||
if(userArray.length > 0){
|
||||
log.info("=================================发送消息:{}", msg);
|
||||
sysMsgService.saveMsg(msg, userArray, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-5
@@ -1,6 +1,8 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.huimin.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
@@ -27,21 +29,24 @@ public class HuiminManageController {
|
||||
private HuiminService huiminService;
|
||||
|
||||
@At("")
|
||||
@SaCheckLogin
|
||||
@Ok("beetl:/platform/zhgh/dayofficework/huimin/manage/index.html")
|
||||
@SaCheckPermission("huimin.manage")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/huimin/manage/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("huimin.manage")
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(StrUtil.isNotBlank(pageForm.getSearchKeyword())){
|
||||
cnd.where().andLike(Huimin::getTitle, pageForm.getSearchKeyword());
|
||||
}
|
||||
Pagination pagination = huiminService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("huimin.manage")
|
||||
@ApiOperation("新增惠民服务")
|
||||
public Result insert(@Param("data") Huimin huimin) {
|
||||
huiminService.insert(huimin);
|
||||
@@ -57,7 +62,7 @@ public class HuiminManageController {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("huimin.manage")
|
||||
@ApiOperation("删除惠民服务")
|
||||
public Result delete(String id) {
|
||||
huiminService.delete(id);
|
||||
|
||||
+12
-6
@@ -1,9 +1,12 @@
|
||||
package com.budwk.app.zhgh.staffbenefit.huimin.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.zhgh.staffbenefit.huimin.models.Huimin;
|
||||
import com.budwk.app.zhgh.staffbenefit.huimin.service.HuiminService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -24,22 +27,25 @@ public class HuiminMineController {
|
||||
private HuiminService huiminService;
|
||||
|
||||
@At("")
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("huimin.mine")
|
||||
@Ok("beetl:/platform/zhgh/staffbenefit/huimin/mine/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At("/h5")
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("h5.huimin.mine")
|
||||
@Ok("beetl:/platform/zhghh5/staffbenefit/huimin/mine/index.html")
|
||||
public void h5Index(){
|
||||
public void h5Index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
public Result pageData(PageForm pageForm){
|
||||
@SaCheckPermission(value = {"huimin.mine", "h5.huimin.mine"}, mode = SaMode.OR)
|
||||
public Result pageData(PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(Huimin::getTitle, pageForm.getSearchKeyword());
|
||||
}
|
||||
Pagination pagination = huiminService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@@ -39,4 +39,14 @@ public class Huimin extends BaseModel {
|
||||
@Default("1")
|
||||
private Boolean enable;
|
||||
|
||||
@Comment("外部链接")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Column
|
||||
private String link;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("分组id")
|
||||
private Integer groupId;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<van-list v-if="tableData && tableData.length>0"
|
||||
v-model="tableLoading"
|
||||
:finished="tableFinished"
|
||||
finished-text=""
|
||||
finished-text="没有更多了"
|
||||
@load="onLoad">
|
||||
<div class="table-list-container">
|
||||
<div v-for="(row, index) in tableData" :key="index" class="table-list-item">
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<script>
|
||||
module.exports = {
|
||||
name: "index",
|
||||
components: {
|
||||
"drawer-user-scope": httpVueLoader("/components/module/activity/DrawerUserScope.vue")
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupOptions: [],
|
||||
internalGroupId: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
internalGroupId(newValue) {
|
||||
this.$emit('update:value', newValue);
|
||||
},
|
||||
value:{
|
||||
handler:function (val){
|
||||
this.internalGroupId = val
|
||||
},
|
||||
immediate:true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async listGroups() {
|
||||
const {data} = await $.get("/platform/activity/basic/scope/getActivityUserScopeGroup")
|
||||
this.groupOptions = data
|
||||
},
|
||||
onGroupChange(id) {
|
||||
this.listGroups()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.listGroups()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div style="display: flex;">
|
||||
<el-select placeholder="参加人员范围"
|
||||
v-model="internalGroupId"
|
||||
clearable
|
||||
filterable>
|
||||
<el-option v-for="item in groupOptions"
|
||||
:label="item.groupName"
|
||||
:value="item.groupId"
|
||||
:key="item.groupId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-button @click="$refs.drawerUserScope.userScopeDialog = true" type="primary" icon="el-icon-setting">设置
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<drawer-user-scope
|
||||
@group_change="onGroupChange"
|
||||
ref="drawerUserScope"
|
||||
:group_id.sync="internalGroupId"
|
||||
></drawer-user-scope>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -354,6 +354,7 @@
|
||||
)
|
||||
Vue.component("snaker-chart", httpVueLoader("/components/plugins/snaker/snakerChart.vue?v=" + new Date().getTime()))
|
||||
Vue.component("snaker-start", httpVueLoader("/components/plugins/snaker/snakerStart.vue?v=" + new Date().getTime()))
|
||||
Vue.component("permission-group", httpVueLoader("/components/plugins/permissionGroup/index.vue?v=" + new Date().getTime()))
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,135 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="名称">
|
||||
<el-input placeholder="名称" clearable v-model="pageForm.searchKeyword"></el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool label="数据列表">
|
||||
<el-button type="primary" size="small" icon="el-icon-plus" @click="onOpen">新增</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%">
|
||||
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index" width="80px"></el-table-column>
|
||||
<el-table-column label="名称" prop="name" sortable></el-table-column>
|
||||
<el-table-column label="模板内容" prop="template" width="400px"></el-table-column>
|
||||
<el-table-column label="定时任务" prop="cron" width="150px"></el-table-column>
|
||||
<el-table-column label="是否启用" prop="enabled" sortable width="150px">
|
||||
<template scope="{row}">
|
||||
<el-tag :type="row.enabled ? 'success' : 'danger'" size="mini">{{row.enabled ? '是' : '否'}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="200px">
|
||||
<template scope="{row}">
|
||||
<el-button size="mini" type="primary" @click="onEdit(row)">修改</el-button>
|
||||
<el-button size="mini" type="danger" @click="onDelete(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
|
||||
<el-dialog :title="formData.id ? '编辑' : '新增'" :visible.sync="dialogVisible" :close-on-click-modal="false" width="60%">
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板内容" prop="template">
|
||||
<el-input v-model="formData.template" placeholder="模板内容" type="textarea" rows="5"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="定时任务" prop="cron">
|
||||
{{formData.cron}}
|
||||
<el-select v-model="formData.cron" placeholder="请选择定时任务或者输入cron表达式" allow-create filterable>
|
||||
<el-option label="早上8点" value="0 0 8 * * ?"></el-option>
|
||||
<el-option label="早上9点" value="0 0 9 * * ?"></el-option>
|
||||
<el-option label="早上10点" value="0 0 10 * * ?"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enabled">
|
||||
<el-switch v-model="formData.enabled"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formRules: {
|
||||
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
template: [{ required: true, message: "请输入模板内容", trigger: "blur" }],
|
||||
cron: [{ required: true, message: "请选择定时任务或者输入cron表达式", trigger: "blur" }],
|
||||
enabled: [{ required: true, message: "请选择是否启用", trigger: "blur" }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen() {
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.formData = {}
|
||||
this.$refs.formRef.resetFields()
|
||||
})
|
||||
},
|
||||
onEdit(row) {
|
||||
this.dialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.formData = { ...row }
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
this.$refs.formRef.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$axios.post("/platform/birthdayWishes/plan/" + (this.formData.id ? "update" : "insert"), this.formData).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.dialogVisible = false
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onDelete(id) {
|
||||
this.$confirm("确定删除吗?", "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/birthdayWishes/plan/delete", { id }).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -7,7 +7,7 @@ layout("/layouts/platform.html"){
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="名称">
|
||||
<el-input v-model="pageForm.displayName" placeholder="名称" clearable></el-input>
|
||||
<el-input v-model="pageForm.searchKeyword" placeholder="名称" clearable></el-input>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
@@ -41,18 +41,26 @@ layout("/layouts/platform.html"){
|
||||
<el-form-item label="标题" prop="title" :rules="{ required: true, message: '请输入标题', trigger: 'blur' }">
|
||||
<el-input v-model="formData.title" placeholder="请输入标题"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面图" prop="cover" :rules="{ required: true, message: '请上传封面图', trigger: 'blur' }">
|
||||
<el-form-item label="封面图" prop="cover"
|
||||
:rules="{ required: true, message: '请上传封面图', trigger: 'blur' }">
|
||||
<file-upload
|
||||
:value.sync="formData.cover"
|
||||
:upload_number="1"
|
||||
upload_mode="image"
|
||||
upload_result_category="interval"
|
||||
upload_result_type="url"
|
||||
:value.sync="formData.cover"
|
||||
:upload_number="1"
|
||||
upload_mode="image"
|
||||
upload_result_category="interval"
|
||||
upload_result_type="url"
|
||||
></file-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="content" :rules="{ required: true, message: '请输入内容', trigger: 'blur' }">
|
||||
<el-form-item label="内容" prop="content"
|
||||
:rules="{ required: true, message: '请输入内容', trigger: 'blur' }">
|
||||
<text-editor v-model="formData.content"></text-editor>
|
||||
</el-form-item>
|
||||
<el-form-item label="可见人员" prop="groupId">
|
||||
<permission-group :value.sync="formData.groupId"></permission-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="外部链接" prop="link">
|
||||
<el-input v-model="formData.link" placeholder="请输入外部链接" maxlength="255"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="enable">
|
||||
<el-switch v-model="formData.enable"></el-switch>
|
||||
</el-form-item>
|
||||
@@ -82,10 +90,24 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
onEdit(row) {
|
||||
this.dialogVisible = true
|
||||
this.formData = { ...row }
|
||||
this.formData = {...row}
|
||||
},
|
||||
onDelete(row) {
|
||||
this.$confirm("您确定删除吗?", "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
this.$axios.post("/platform/huimin/manage/delete", {id: row.id}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
$.post("/platform/huimin/manage/" + (this.formData.id ? "update" : "insert"), { data: JSON.stringify(this.formData) }).then((res) => {
|
||||
this.$axios.post("/platform/huimin/manage/" + (this.formData.id ? "update" : "insert"), {data: JSON.stringify(this.formData)}).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(res.msg)
|
||||
this.pageData()
|
||||
|
||||
@@ -2,6 +2,61 @@
|
||||
layout("/layouts/platform_h5.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.detail-content {
|
||||
padding: 16px;
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.detail-cover {
|
||||
margin-bottom: 16px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-text {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.content-label {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #323233;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.content-html {
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
color: #646566;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.content-html p {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.detail-link {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.detail-info {
|
||||
border-top: 1px solid #ebedf0;
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
font-size: 12px;
|
||||
color: #969799;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-nav-bar title="惠民服务" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed></van-nav-bar>
|
||||
<van-sticky offset-top="46px">
|
||||
@@ -10,19 +65,57 @@ layout("/layouts/platform_h5.html"){
|
||||
:show-action="false"
|
||||
:reverse-color="false"
|
||||
input-align="left"
|
||||
placeholder="请输入姓名/工号搜索"
|
||||
placeholder="请输入关键字搜索"
|
||||
@search="doSearch"
|
||||
></van-search>
|
||||
</van-sticky>
|
||||
|
||||
<table-list api="/platform/huimin/mine/pageData"
|
||||
:page_form.sync="pageForm"
|
||||
json
|
||||
@ready="onReady"
|
||||
img=""
|
||||
img="cover"
|
||||
ref="tableListRef">
|
||||
<template v-slot="{index,row}">
|
||||
<table-column label="标题">{{row.title}}</table-column>
|
||||
</template>
|
||||
<template #actions="{index,row}">
|
||||
<div class="action-btn" @click="onView(row)">
|
||||
<i class="fa fa-eye"></i>
|
||||
<span>查看</span>
|
||||
</div>
|
||||
</template>
|
||||
</table-list>
|
||||
|
||||
<!-- 详情弹出层 -->
|
||||
<van-action-sheet v-model="showDetail" :title="currentItem.title">
|
||||
<div class="detail-content">
|
||||
<!-- 封面图片 -->
|
||||
<div class="detail-cover" v-if="currentItem.cover">
|
||||
<van-image :src="currentItem.cover" fit="cover" width="100%" height="200px"></van-image>
|
||||
</div>
|
||||
|
||||
<!-- 内容 -->
|
||||
<div class="detail-text" v-if="currentItem.content">
|
||||
<div class="content-label">详细内容:</div>
|
||||
<div class="content-html" v-html="currentItem.content"></div>
|
||||
</div>
|
||||
|
||||
<!-- 外部链接 -->
|
||||
<div class="detail-link" v-if="currentItem.link">
|
||||
<van-button type="primary" block @click="openLink(currentItem.link)">
|
||||
<van-icon name="link"></van-icon>
|
||||
访问链接
|
||||
</van-button>
|
||||
</div>
|
||||
|
||||
<!-- 创建时间 -->
|
||||
<div class="detail-info">
|
||||
<div class="info-item">创建时间:{{ formatTime(currentItem.createdAt) }}</div>
|
||||
<div class="info-item" v-if="currentItem.updatedAt !== currentItem.createdAt">更新时间:{{ formatTime(currentItem.updatedAt) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</van-action-sheet>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -39,12 +132,14 @@ layout("/layouts/platform_h5.html"){
|
||||
delegationId: null,
|
||||
roleId: null
|
||||
},
|
||||
showDetail: false,
|
||||
currentItem: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
historyBack,
|
||||
onReady(){
|
||||
|
||||
this.doSearch()
|
||||
},
|
||||
doSearch() {
|
||||
this.$nextTick(() => {
|
||||
@@ -52,6 +147,26 @@ layout("/layouts/platform_h5.html"){
|
||||
this.pageForm.totalCount = 0
|
||||
this.$refs.tableListRef.doSearch()
|
||||
})
|
||||
},
|
||||
onView(row){
|
||||
this.currentItem = row
|
||||
this.showDetail = true
|
||||
},
|
||||
openLink(url) {
|
||||
if (url) {
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
},
|
||||
formatTime(timestamp) {
|
||||
if (!timestamp) return ''
|
||||
const date = new Date(timestamp)
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user