完善消息配置模板
This commit is contained in:
parent
3d502e4159
commit
0a035fe03d
|
@ -1,6 +1,9 @@
|
|||
package com.snow.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.snow.framework.util.ShiroUtils;
|
||||
import com.snow.system.domain.SysUser;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
@ -32,6 +35,8 @@ public class SysNewsNodeController extends BaseController
|
|||
{
|
||||
private String prefix = "system/node";
|
||||
|
||||
private String trggers_prefix = "system/triggers";
|
||||
|
||||
@Autowired
|
||||
private ISysNewsNodeService sysNewsNodeService;
|
||||
|
||||
|
@ -71,7 +76,7 @@ public class SysNewsNodeController extends BaseController
|
|||
/**
|
||||
* 新增消息配置节点
|
||||
*/
|
||||
@GetMapping("/add/{id}")
|
||||
@GetMapping(value = {"/add/{id}","/add/"})
|
||||
public String add(@PathVariable(value = "id", required = false) Long id, ModelMap mmap)
|
||||
{
|
||||
if (StringUtils.isNotNull(id))
|
||||
|
@ -90,6 +95,12 @@ public class SysNewsNodeController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult addSave(SysNewsNode sysNewsNode)
|
||||
{
|
||||
SysNewsNode sysNewsNodeKey = sysNewsNodeService.selectSysNewsNodeByKey(sysNewsNode.getNewsNodeKey());
|
||||
if (sysNewsNodeKey!=null) {
|
||||
return AjaxResult.error("该配置节点key已存在");
|
||||
}
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
sysNewsNode.setCreateBy(String.valueOf(sysUser.getUserId()));
|
||||
return toAjax(sysNewsNodeService.insertSysNewsNode(sysNewsNode));
|
||||
}
|
||||
|
||||
|
@ -113,6 +124,13 @@ public class SysNewsNodeController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(SysNewsNode sysNewsNode)
|
||||
{
|
||||
String newsNodeKey = sysNewsNode.getNewsNodeKey();
|
||||
SysNewsNode sysNewsNodeKey = sysNewsNodeService.selectSysNewsNodeByKey(newsNodeKey);
|
||||
if (sysNewsNodeKey!=null&&!sysNewsNodeKey.getNewsNodeKey().equals(newsNodeKey)) {
|
||||
return AjaxResult.error("该配置节点key已存在");
|
||||
}
|
||||
SysUser sysUser = ShiroUtils.getSysUser();
|
||||
sysNewsNode.setUpdateBy(String.valueOf(sysUser.getUserId()));
|
||||
return toAjax(sysNewsNodeService.updateSysNewsNode(sysNewsNode));
|
||||
}
|
||||
|
||||
|
@ -151,4 +169,18 @@ public class SysNewsNodeController extends BaseController
|
|||
List<Ztree> ztrees = sysNewsNodeService.selectSysNewsNodeTree();
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选择消息触发节点树
|
||||
*/
|
||||
@GetMapping(value = { "/selectTriggerTree/{id}", "/selectTriggerTree/" })
|
||||
public String selectTriggerTree(@PathVariable(value = "id", required = false) Long id, ModelMap mmap)
|
||||
{
|
||||
if (StringUtils.isNotNull(id))
|
||||
{
|
||||
mmap.put("sysNewsNode", sysNewsNodeService.selectSysNewsNodeById(id.intValue()));
|
||||
}
|
||||
return trggers_prefix + "/tree";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,10 +51,11 @@
|
|||
|
||||
/*消息配置节点-新增-选择父部门树*/
|
||||
function selectNodeTree() {
|
||||
var treeId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
|
||||
var options = {
|
||||
title: '消息配置节点选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectNodeTree/" + $("#treeId").val(),
|
||||
url: prefix + "/selectNodeTree/" + treeId,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
|
|
@ -76,11 +76,6 @@
|
|||
title: '节点key',
|
||||
align: 'left'
|
||||
},
|
||||
/* {
|
||||
field: 'parentId',
|
||||
title: '父部门id',
|
||||
align: 'left'
|
||||
},*/
|
||||
/* {
|
||||
field: 'ancestors',
|
||||
title: '祖级列表',
|
||||
|
@ -91,11 +86,6 @@
|
|||
title: '显示顺序',
|
||||
align: 'left'
|
||||
},
|
||||
/* {
|
||||
field: 'isDelete',
|
||||
title: '是否删除',
|
||||
align: 'left'
|
||||
},*/
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<body class="hold-transition box box-main">
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${sysNewsNode?.id}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${sysNewsNode?.newsNodeName}"/>
|
||||
<input id="isParent" name="isParent" type="hidden" />
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||
|
|
|
@ -25,17 +25,18 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-3 control-label">消息开关:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="newsOnOff" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: ztree-js" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "system/triggers"
|
||||
var prefix = ctx + "system/triggers";
|
||||
$("#form-triggers-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
@ -54,7 +55,7 @@
|
|||
var options = {
|
||||
title: '消息配置节点选择',
|
||||
width: "380",
|
||||
url:ctx + "system/node/selectNodeTree/" + deptId,
|
||||
url:ctx + "system/node/selectTriggerTree/" + deptId,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
@ -63,6 +64,11 @@
|
|||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
var treeName= body.find('#treeName').val();
|
||||
if($.common.isEmpty(treeName)){
|
||||
$.modal.msgError("请选择子节点后再提交");
|
||||
return false;
|
||||
}
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#newsNodeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
|
|
|
@ -62,12 +62,6 @@
|
|||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:triggers:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:triggers:import">
|
||||
<i class="fa fa-upload"></i> 导入
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:triggers:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
|
@ -81,7 +75,7 @@
|
|||
<th:block th:include="include :: layout-latest-js" />
|
||||
<th:block th:include="include :: ztree-js" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:triggers:edit')}]];
|
||||
var editFlag = [[${@permission.hasPermi('system:triggers:changeStatus')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:triggers:remove')}]];
|
||||
var sysNewsType = [[${@dict.getType('sys_news_type')}]];
|
||||
var prefix = ctx + "system/triggers";
|
||||
|
@ -102,7 +96,6 @@
|
|||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "消息通知配置",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
|
@ -163,6 +156,7 @@
|
|||
$.tree.init(options);
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
console.log(JSON.stringify(treeNode))
|
||||
//$.tree.notAllowParents();
|
||||
$("#newsNodeId").val(treeNode.id);
|
||||
$("#parentId").val(treeNode.pId);
|
||||
|
@ -195,9 +189,9 @@
|
|||
}
|
||||
|
||||
|
||||
/* 用户状态显示 */
|
||||
/* 开关状态显示 0--关 */
|
||||
function statusTools(row) {
|
||||
if (row.newsOnOff == 1) {
|
||||
if (row.newsOnOff == 0) {
|
||||
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.id + '\')"></i> ';
|
||||
} else {
|
||||
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.id + '\')"></i> ';
|
||||
|
@ -207,14 +201,14 @@
|
|||
/* 用户管理-停用 */
|
||||
function disable(userId) {
|
||||
$.modal.confirm("确认要关闭消息通知吗?", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "id": userId, "newsOnOff": 1 });
|
||||
$.operate.post(prefix + "/changeStatus", { "id": userId, "newsOnOff": 0 });
|
||||
})
|
||||
}
|
||||
|
||||
/* 用户管理启用 */
|
||||
function enable(userId) {
|
||||
$.modal.confirm("确认要启用消息通知吗?", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "id": userId, "newsOnOff": 0 });
|
||||
$.operate.post(prefix + "/changeStatus", { "id": userId, "newsOnOff": 1 });
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -41,7 +41,7 @@ public class NewsTriggerService {
|
|||
|
||||
|
||||
/**
|
||||
* 获取钉钉开关
|
||||
* 获取钉钉开关(0--关,1--开)
|
||||
* @param nodeKey
|
||||
* @return
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue