Commit 766e4ae5 by fsn

初始化通知模块

parent d73989f0
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.stylefeng.guns.modular.system.controller;
import com.stylefeng.guns.common.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
/**
* 通知控制器
*
* @author fengshuonan
* @Date 2017-05-09 22:44:57
*/
@Controller
@RequestMapping("/notice")
public class NoticeController extends BaseController {
private String PREFIX = "/system/notice/";
/**
* 跳转到通知首页
*/
@RequestMapping("")
public String index() {
return PREFIX + "notice.html";
}
/**
* 跳转到添加通知
*/
@RequestMapping("/notice_add")
public String noticeAdd() {
return PREFIX + "notice_add.html";
}
/**
* 跳转到修改通知
*/
@RequestMapping("/notice_update/{noticeId}")
public String noticeUpdate(@PathVariable Integer noticeId, Model model) {
return PREFIX + "notice_edit.html";
}
/**
* 新增通知
*/
@RequestMapping(value = "/add")
@ResponseBody
public Object add() {
return super.SUCCESS_TIP;
}
/**
* 删除通知
*/
@RequestMapping(value = "/delete")
@ResponseBody
public Object delete() {
return SUCCESS_TIP;
}
/**
* 修改通知
*/
@RequestMapping(value = "/update")
@ResponseBody
public Object update() {
return super.SUCCESS_TIP;
}
/**
* 通知详情
*/
@RequestMapping(value = "/detail")
@ResponseBody
public Object detail() {
return null;
}
}
@layout("/common/_container.html"){
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>通知管理</h5>
</div>
<div class="ibox-content">
<div class="row row-lg">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<#NameCon id="condition" name="名称" />
</div>
<div class="col-sm-3">
<#button name="搜索" icon="fa-search" clickFun="Notice.search()"/>
</div>
</div>
<div class="hidden-xs" id="NoticeTableToolbar" role="group">
@if(shiro.hasPermission("/notice/add")){
<#button name="添加" icon="fa-plus" clickFun="Notice.openAddNotice()"/>
@}
@if(shiro.hasPermission("/notice/update")){
<#button name="修改" icon="fa-plus" clickFun="Notice.openNoticeDetail()" space="true"/>
@}
@if(shiro.hasPermission("/notice/delete")){
<#button name="删除" icon="fa-plus" clickFun="Notice.delete()" space="true"/>
@}
</div>
<#table id="NoticeTable"/>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="${ctxPath}/static/modular/system/notice/notice.js"></script>
@}
@layout("/common/_container.html"){
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="form-horizontal">
<input type="hidden" id="id" value="">
<div class="row">
<div class="col-sm-6 b-r">
</div>
<div class="col-sm-6">
</div>
</div>
<div class="row btn-group-m-t">
<div class="col-sm-10">
<#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="NoticeInfoDlg.addSubmit()"/>
<#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="NoticeInfoDlg.close()"/>
</div>
</div>
</div>
</div>
</div>
<script src="${ctxPath}/static/modular/system/notice/notice_info.js"></script>
@}
@layout("/common/_container.html"){
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="form-horizontal">
<input type="hidden" id="id" value="${notice.id}">
<div class="row">
<div class="col-sm-6 b-r">
</div>
<div class="col-sm-6">
</div>
</div>
<div class="row btn-group-m-t">
<div class="col-sm-10">
<#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="NoticeInfoDlg.editSubmit()"/>
<#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="NoticeInfoDlg.close()"/>
</div>
</div>
</div>
</div>
</div>
<script src="${ctxPath}/static/modular/system/notice/notice_info.js"></script>
@}
/**
* 通知管理初始化
*/
var Notice = {
id: "NoticeTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Notice.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '标题', field: 'title', align: 'center', valign: 'middle'},
{title: '内容', field: 'content', align: 'center', valign: 'middle'},
{title: '发布者', field: 'creater', align: 'center', valign: 'middle'},
{title: '创建时间', field: 'createtime', align: 'center', valign: 'middle'}
];
};
/**
* 检查是否选中
*/
Notice.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Notice.seItem = selected[0];
return true;
}
};
/**
* 点击添加通知
*/
Notice.openAddNotice = function () {
var index = layer.open({
type: 2,
title: '添加通知',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/notice/notice_add'
});
this.layerIndex = index;
};
/**
* 打开查看通知详情
*/
Notice.openNoticeDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '通知详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/notice/notice_update/' + Notice.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除通知
*/
Notice.delete = function () {
if (this.check()) {
var ajax = new $ax(Feng.ctxPath + "/notice/delete", function (data) {
Feng.success("删除成功!");
Notice.table.refresh();
}, function (data) {
Feng.error("删除失败!");
});
ajax.set("noticeId", this.seItem.id);
ajax.start();
}
};
/**
* 查询通知列表
*/
Notice.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Notice.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Notice.initColumn();
var table = new BSTable(Notice.id, "/notice/list", defaultColunms);
table.setPaginationType("client");
Notice.table = table.init();
});
/**
* 初始化通知详情对话框
*/
var NoticeInfoDlg = {
noticeInfoData : {}
};
/**
* 清除数据
*/
NoticeInfoDlg.clearData = function() {
this.noticeInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
NoticeInfoDlg.set = function(key, val) {
this.noticeInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
NoticeInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
NoticeInfoDlg.close = function() {
parent.layer.close(window.parent.Notice.layerIndex);
}
/**
* 收集数据
*/
NoticeInfoDlg.collectData = function() {
this.set('id');
}
/**
* 提交添加
*/
NoticeInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/notice/add", function(data){
Feng.success("添加成功!");
window.parent.Notice.table.refresh();
NoticeInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.noticeInfoData);
ajax.start();
}
/**
* 提交修改
*/
NoticeInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/notice/update", function(data){
Feng.success("修改成功!");
window.parent.Notice.table.refresh();
NoticeInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.noticeInfoData);
ajax.start();
}
$(function() {
});
...@@ -16,8 +16,8 @@ public class TemplateGenerator { ...@@ -16,8 +16,8 @@ public class TemplateGenerator {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
ContextConfig contextConfig = new ContextConfig(); ContextConfig contextConfig = new ContextConfig();
contextConfig.setBizChName("测试"); contextConfig.setBizChName("通知");
contextConfig.setBizEnName("test"); contextConfig.setBizEnName("notice");
GunsTemplateEngine gunsTemplateEngine = new SimpleTemplateEngine(); GunsTemplateEngine gunsTemplateEngine = new SimpleTemplateEngine();
gunsTemplateEngine.setContextConfig(contextConfig); gunsTemplateEngine.setContextConfig(contextConfig);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment