commit
This commit is contained in:
@@ -52,6 +52,24 @@ public class SysHomeActivityController {
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.homeActivity")
|
||||
public Object doHandle(Sys_home_activity activity) {
|
||||
try {
|
||||
sysHomeActivityService.saveHomeActivity(activity);
|
||||
return Result.success();
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.homeActivity")
|
||||
public Object doDelete(@Valid String id) {
|
||||
sysHomeActivityService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@RequiresPermissions("sys.homeActivity")
|
||||
public Object enable(@Valid String id) {
|
||||
|
||||
@@ -5,4 +5,12 @@ import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
|
||||
public interface SysHomeActivityService extends BaseService<Sys_home_activity> {
|
||||
|
||||
/**
|
||||
* 保存首页活动配置,新增时补齐主键和默认状态,避免 controller 直接处理公共保存规则。
|
||||
*
|
||||
* @param activity 首页活动配置
|
||||
* @return 保存后的首页活动
|
||||
*/
|
||||
Sys_home_activity saveHomeActivity(Sys_home_activity activity);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package io.v.nutz.sys.services.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.sys.models.Sys_home_activity;
|
||||
import io.v.nutz.sys.services.SysHomeActivityService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SysHomeActivityServiceImpl extends BaseServiceImpl<Sys_home_activity> implements SysHomeActivityService {
|
||||
@@ -12,4 +14,31 @@ public class SysHomeActivityServiceImpl extends BaseServiceImpl<Sys_home_activit
|
||||
public SysHomeActivityServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sys_home_activity saveHomeActivity(Sys_home_activity activity) {
|
||||
if (StrUtil.isBlank(activity.getName())) {
|
||||
throw new IllegalArgumentException("活动名称不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(activity.getH5Url())) {
|
||||
throw new IllegalArgumentException("H5端链接不能为空");
|
||||
}
|
||||
if (activity.getStartDate() == null || activity.getEndDate() == null) {
|
||||
throw new IllegalArgumentException("活动开始时间和结束时间不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(activity.getId())) {
|
||||
activity.setId(R.UU32());
|
||||
}
|
||||
// 手工维护的首页活动没有业务模块同步默认值,这里统一兜底,保证新增后能被首页列表正常读取。
|
||||
if (activity.getEnable() == null) {
|
||||
activity.setEnable(false);
|
||||
}
|
||||
if (activity.getTop() == null) {
|
||||
activity.setTop(false);
|
||||
}
|
||||
if (activity.getSortNo() == null) {
|
||||
activity.setSortNo(0);
|
||||
}
|
||||
return insertOrUpdate(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import io.v.nutz.base.model.Review;
|
||||
import io.v.nutz.base.utils.ViTool;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.sys.models.Sys_signature;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package io.v.nutz.zhgh.zgfw.controller.condolence;
|
||||
import cn.wizzer.framework.base.Result;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
|
||||
@@ -10,7 +10,7 @@ import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.services.SysMsgService;
|
||||
import io.v.nutz.sys.services.SysMsgUserService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.zhgh.zgfw.handler.condolence.CondolenceToDoHandler;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.Condolence;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.base.service.ViService;
|
||||
import io.v.nutz.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.zhgh.zgfw.model.condolence.CondolenceType;
|
||||
import io.v.nutz.zhgh.zgfw.service.CondolenceService;
|
||||
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.v.nutz.zgfw.model.condolence;
|
||||
package io.v.nutz.zhgh.zgfw.model.condolence;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.DB;
|
||||
|
||||
@@ -11,16 +11,24 @@ layout("/layouts/platform.html"){
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<div style="margin-bottom: 10px">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="openAdd">新增</el-button>
|
||||
</div>
|
||||
<el-table :data="tableData" header-align="center" border style="width: 100%">
|
||||
<el-table-column label="序号" type="index" width="50px" :method="indexMethod"></el-table-column>
|
||||
<el-table-column label="名称" prop="name"></el-table-column>
|
||||
<el-table-column label="pc端链接" prop="url"></el-table-column>
|
||||
<el-table-column label="h5端链接" prop="h5Url"></el-table-column>
|
||||
<el-table-column label="封面" prop="cover" width="80px">
|
||||
<el-table-column label="名称" prop="name" min-width="140" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="pc端链接" prop="url" min-width="180" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="h5端链接" prop="h5Url" min-width="220" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="封面" prop="cover" width="90px">
|
||||
<template slot-scope="scope">
|
||||
<el-image :src="scope.row.cover" v-if="scope.row.icon" style="width: 30px; height: 30px"></el-image>
|
||||
<el-image :src="CREATE_PREVIEW_URL(scope.row.cover)"
|
||||
fit="cover"
|
||||
style="width: 48px; height: 48px"
|
||||
v-if="scope.row.cover"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" prop="startDate" width="160"></el-table-column>
|
||||
<el-table-column label="结束时间" prop="endDate" width="160"></el-table-column>
|
||||
<el-table-column label="状态" prop="enable" width="80px">
|
||||
<template slot-scope="scope">
|
||||
<i v-if="!scope.row.enable" class="fa fa-circle text-danger ml5"></i>
|
||||
@@ -33,18 +41,114 @@ layout("/layouts/platform.html"){
|
||||
<el-tag size="mini" v-else type="info">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="关联类路径" prop="classPath" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="操作" width="150px">
|
||||
<el-table-column label="排序号" prop="sortNo" width="90px"></el-table-column>
|
||||
<el-table-column label="关联类路径" prop="classPath" min-width="180" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="操作" width="250px" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="danger" size="mini" @click="disable(scope.row.id)" v-if="scope.row.enable">关闭</el-link>
|
||||
<el-link type="primary" size="mini" @click="enable(scope.row.id)" v-if="!scope.row.enable">开启</el-link>
|
||||
<el-link type="primary" size="mini" @click="topUp(scope.row.id)" v-if="!scope.row.top">置顶</el-link>
|
||||
<el-link type="danger" size="mini" @click="cancelTopUp(scope.row.id)" v-if="scope.row.top">取消置顶</el-link>
|
||||
<el-link type="primary" size="mini" @click="openEdit(scope.row)">编辑</el-link>
|
||||
<el-link type="danger" size="mini" @click="doDelete(scope.row)">删除</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
<el-dialog :title="formDialogTitle"
|
||||
:visible.sync="formDialogVisible"
|
||||
width="720px"
|
||||
append-to-body
|
||||
@close="resetForm">
|
||||
<el-form :model="formData" :rules="formRules" ref="form" label-width="130px">
|
||||
<el-form-item label="活动名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入活动名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="PC端链接" prop="url">
|
||||
<el-input v-model="formData.url" placeholder="请输入PC端链接"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="H5端链接" prop="h5Url">
|
||||
<el-input v-model="formData.h5Url" placeholder="请输入H5端链接"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="封面" prop="cover">
|
||||
<image-Upload :height="120"
|
||||
:width="180"
|
||||
:limit="1"
|
||||
:file-type="['png', 'jpg', 'jpeg']"
|
||||
:file-size="5"
|
||||
v-model="formData.cover"></image-Upload>
|
||||
</el-form-item>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startDate">
|
||||
<el-date-picker v-model="formData.startDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择开始时间"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="结束时间" prop="endDate">
|
||||
<el-date-picker v-model="formData.endDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择结束时间"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="人员分组ID" prop="allowUserGroupId">
|
||||
<el-input-number v-model="formData.allowUserGroupId"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
placeholder="不限制可留空"
|
||||
style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序号" prop="sortNo">
|
||||
<el-input-number v-model="formData.sortNo"
|
||||
controls-position="right"
|
||||
style="width: 100%"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="允许查看SQL" prop="allowUserSql">
|
||||
<el-input v-model="formData.allowUserSql"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="不限制可留空,SQL需要返回userId字段"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="类路径" prop="classPath">
|
||||
<el-input v-model="formData.classPath" placeholder="手工新增可留空"></el-input>
|
||||
</el-form-item>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用" prop="enable">
|
||||
<el-switch v-model="formData.enable"
|
||||
active-text="启用"
|
||||
inactive-text="关闭"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否置顶" prop="top">
|
||||
<el-switch v-model="formData.top"
|
||||
active-text="置顶"
|
||||
inactive-text="普通"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeFormDialog">取 消</el-button>
|
||||
<el-button type="primary" @click="doHandle">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -52,16 +156,98 @@ layout("/layouts/platform.html"){
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
formDialogVisible: false,
|
||||
formDialogTitle: "新增首页活动",
|
||||
formData: {},
|
||||
formRules: {
|
||||
name: [{required: true, message: "必填", trigger: "blur"}],
|
||||
h5Url: [{required: true, message: "必填", trigger: "blur"}],
|
||||
cover: [{required: true, message: "必填", trigger: "change"}],
|
||||
startDate: [{required: true, message: "必填", trigger: "change"}],
|
||||
endDate: [{required: true, message: "必填", trigger: "change"}],
|
||||
enable: [{required: true, message: "必填", trigger: "change"}],
|
||||
top: [{required: true, message: "必填", trigger: "change"}],
|
||||
sortNo: [{required: true, message: "必填", trigger: "blur"}]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setFormDefaults() {
|
||||
this.$set(this.formData, "id", null)
|
||||
this.$set(this.formData, "name", null)
|
||||
this.$set(this.formData, "cover", null)
|
||||
this.$set(this.formData, "url", null)
|
||||
this.$set(this.formData, "h5Url", null)
|
||||
this.$set(this.formData, "allowUserGroupId", undefined)
|
||||
this.$set(this.formData, "allowUserSql", null)
|
||||
this.$set(this.formData, "enable", true)
|
||||
this.$set(this.formData, "classPath", null)
|
||||
this.$set(this.formData, "top", false)
|
||||
this.$set(this.formData, "sortNo", 0)
|
||||
this.$set(this.formData, "startDate", null)
|
||||
this.$set(this.formData, "endDate", null)
|
||||
},
|
||||
openAdd() {
|
||||
this.setFormDefaults()
|
||||
this.$set(this, "formDialogTitle", "新增首页活动")
|
||||
this.$set(this, "formDialogVisible", true)
|
||||
},
|
||||
openEdit(row) {
|
||||
this.setFormDefaults()
|
||||
Object.keys(row).forEach(key => {
|
||||
this.$set(this.formData, key, row[key])
|
||||
})
|
||||
this.$set(this, "formDialogTitle", "编辑首页活动")
|
||||
this.$set(this, "formDialogVisible", true)
|
||||
},
|
||||
closeFormDialog() {
|
||||
this.$set(this, "formDialogVisible", false)
|
||||
},
|
||||
resetForm() {
|
||||
if (this.$refs.form) {
|
||||
this.$refs.form.clearValidate()
|
||||
}
|
||||
},
|
||||
doHandle() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
$.post(loc() + "/doHandle", this.formData).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.closeFormDialog()
|
||||
this.pageData()
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
doDelete(row) {
|
||||
this.$confirm("您确定要删除吗?", "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
$.post(loc() + "/doDelete", {id: row.id}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.pageData()
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
disable(id) {
|
||||
this.$confirm("您确定要关闭吗?", "提示", {
|
||||
type: "warning",
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
$.post(loc() + "/disable", { id }).then((resp) => {
|
||||
$.post(loc() + "/disable", {id: id}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.pageData()
|
||||
@@ -75,7 +261,7 @@ layout("/layouts/platform.html"){
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
$.post(loc() + "/enable", { id }).then((resp) => {
|
||||
$.post(loc() + "/enable", {id: id}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.pageData()
|
||||
@@ -89,7 +275,7 @@ layout("/layouts/platform.html"){
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
$.post(loc() + "/topUp", { id }).then((resp) => {
|
||||
$.post(loc() + "/topUp", {id: id}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.pageData()
|
||||
@@ -103,7 +289,7 @@ layout("/layouts/platform.html"){
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(() => {
|
||||
$.post(loc() + "/cancelTopUp", { id }).then((resp) => {
|
||||
$.post(loc() + "/cancelTopUp", {id: id}).then((resp) => {
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.pageData()
|
||||
@@ -113,6 +299,7 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.setFormDefaults()
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user