mirror of https://gitee.com/stylefeng/guns
parent
5c5901eb1b
commit
5622fe502e
@ -0,0 +1,52 @@
|
||||
package cn.stylefeng.guns.modular.app;
|
||||
|
||||
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
|
||||
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* 应用管理界面
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/6 13:32
|
||||
*/
|
||||
@Controller
|
||||
@Slf4j
|
||||
@ApiResource(name = "应用管理界面")
|
||||
public class AppViewController {
|
||||
|
||||
/**
|
||||
* 应用管理首页
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/6 13:32
|
||||
*/
|
||||
@GetResource(name = "应用管理首页", path = "/view/app")
|
||||
public String appIndex() {
|
||||
return "/modular/auth/app/app.html";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色界面
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/6 13:37
|
||||
*/
|
||||
@GetResource(name = "新增角色界面", path = "/view/app/add")
|
||||
public String appAdd() {
|
||||
return "/modular/auth/app/app_add.html";
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑角色界面
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/6 13:37
|
||||
*/
|
||||
@GetResource(name = "编辑角色界面", path = "/view/app/edit")
|
||||
public String appEdit() {
|
||||
return "/modular/auth/app/app_edit.html";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
layui.use(['table', 'HttpRequest', 'func', 'form'], function () {
|
||||
var $ = layui.$;
|
||||
var table = layui.table;
|
||||
var HttpRequest = layui.HttpRequest;
|
||||
var func = layui.func;
|
||||
var form = layui.form;
|
||||
|
||||
/**
|
||||
* 初始化参数
|
||||
*/
|
||||
var App = {
|
||||
tableId: "appTable"
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化表格的列
|
||||
*/
|
||||
App.initColumn = function () {
|
||||
return [[
|
||||
{type: 'radio'},
|
||||
{field: 'appId', hide: true, title: '主键'},
|
||||
{field: 'appName', sort: true, align: "center", title: '应用名称'},
|
||||
{field: 'appCode', sort: true, align: "center", title: '应用编码'},
|
||||
{field: 'activeFlag', sort: true, align: "center", title: '是否激活', templet: '#activeTpl'},
|
||||
{field: 'statusFlag', sort: true, align: "center", title: '是否启用', templet: '#statusTpl'},
|
||||
{field: 'createTime', sort: true, align: "center", title: '创建时间'},
|
||||
{field: 'updateTime', sort: true, align: "center", title: '更新时间'},
|
||||
{align: 'center', toolbar: '#tableBar', title: '操作'}
|
||||
]];
|
||||
};
|
||||
|
||||
/**
|
||||
* 点击查询按钮
|
||||
*/
|
||||
App.search = function () {
|
||||
var queryData = {};
|
||||
queryData['appName'] = $("#appName").val();
|
||||
queryData['appCode'] = $("#appCode").val();
|
||||
table.reload(App.tableId, {
|
||||
where: queryData, page: {curr: 1}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 添加应用对话框
|
||||
*/
|
||||
App.openAddDlg = function () {
|
||||
func.open({
|
||||
height: 500,
|
||||
title: '添加应用',
|
||||
content: Feng.ctxPath + '/view/app/add',
|
||||
tableId: App.tableId
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 编辑应用对话框
|
||||
*
|
||||
* @param data 点击按钮时候的行数据
|
||||
*/
|
||||
App.openEditDlg = function (data) {
|
||||
func.open({
|
||||
height: 500,
|
||||
title: '修改应用',
|
||||
content: Feng.ctxPath + '/view/app/edit?appId=' + data.appId,
|
||||
tableId: App.tableId
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新应用为激活状态
|
||||
*/
|
||||
App.updateActiveFlag = function (appId) {
|
||||
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysApp/updateActiveFlag", 'post', function (data) {
|
||||
Feng.success("激活成功!");
|
||||
table.reload(App.tableId);
|
||||
}, function (data) {
|
||||
Feng.error("激活失败!" + data.message);
|
||||
table.reload(App.tableId);
|
||||
});
|
||||
httpRequest.set("appId", appId);
|
||||
httpRequest.start(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新应用状态
|
||||
*/
|
||||
App.updateStatus = function (appId, statusFlag) {
|
||||
var httpRequest = new HttpRequest(Feng.ctxPath + "/sysApp/updateStatus", 'post', function (data) {
|
||||
Feng.success("修改成功!");
|
||||
}, function (data) {
|
||||
Feng.error("修改失败!" + data.message);
|
||||
table.reload(App.tableId);
|
||||
});
|
||||
httpRequest.set("appId", appId);
|
||||
httpRequest.set("statusFlag", statusFlag);
|
||||
httpRequest.start(true);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 点击删除
|
||||
*
|
||||
* @param data 点击按钮时候的行数据
|
||||
*/
|
||||
App.onDeleteItem = function (data) {
|
||||
var operation = function () {
|
||||
var request = new HttpRequest(Feng.ctxPath + "/sysApp/delete", 'post', function (data) {
|
||||
Feng.success("删除成功!");
|
||||
table.reload(App.tableId);
|
||||
}, function (data) {
|
||||
Feng.error("删除失败!" + data.message + "!");
|
||||
});
|
||||
request.set("appId", data.appId);
|
||||
request.start(true);
|
||||
};
|
||||
Feng.confirm("是否删除?", operation);
|
||||
};
|
||||
|
||||
// 渲染表格
|
||||
var tableResult = table.render({
|
||||
elem: '#' + App.tableId,
|
||||
url: Feng.ctxPath + '/sysApp/page',
|
||||
page: true,
|
||||
height: "full-158",
|
||||
cellMinWidth: 100,
|
||||
cols: App.initColumn(),
|
||||
request: {pageName: 'pageNo', limitName: 'pageSize'},
|
||||
parseData: Feng.parseData
|
||||
});
|
||||
|
||||
// 搜索按钮点击事件
|
||||
$('#btnSearch').click(function () {
|
||||
App.search();
|
||||
});
|
||||
|
||||
// 添加按钮点击事件
|
||||
$('#btnAdd').click(function () {
|
||||
App.openAddDlg();
|
||||
});
|
||||
|
||||
// 工具条点击事件
|
||||
table.on('tool(' + App.tableId + ')', function (obj) {
|
||||
var data = obj.data;
|
||||
var layEvent = obj.event;
|
||||
|
||||
if (layEvent === 'edit') {
|
||||
App.openEditDlg(data);
|
||||
} else if (layEvent === 'delete') {
|
||||
App.onDeleteItem(data);
|
||||
}
|
||||
});
|
||||
|
||||
// 修改激活标识
|
||||
form.on('switch(activeFilter)', function (obj) {
|
||||
var appId = obj.elem.value;
|
||||
App.updateActiveFlag(appId);
|
||||
});
|
||||
|
||||
// 修改状态
|
||||
form.on('switch(statusFilter)', function (obj) {
|
||||
var appId = obj.elem.value;
|
||||
var checked = obj.elem.checked ? 1 : 2;
|
||||
App.updateStatus(appId, checked);
|
||||
});
|
||||
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 添加应用
|
||||
*/
|
||||
layui.use(['form', 'admin', 'HttpRequest'], function () {
|
||||
var form = layui.form;
|
||||
var admin = layui.admin;
|
||||
var HttpRequest = layui.HttpRequest;
|
||||
|
||||
//表单提交事件
|
||||
form.on('submit(btnSubmit)', function (data) {
|
||||
var request = new HttpRequest(Feng.ctxPath + "/sysApp/add", 'post', function (data) {
|
||||
admin.closeThisDialog();
|
||||
Feng.success("添加成功!");
|
||||
admin.putTempData('formOk', true);
|
||||
}, function (data) {
|
||||
admin.closeThisDialog();
|
||||
Feng.error("添加失败!" + data.message);
|
||||
});
|
||||
request.set(data.field);
|
||||
request.start(true);
|
||||
});
|
||||
|
||||
});
|
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 编辑应用
|
||||
*/
|
||||
layui.use(['form', 'admin', 'HttpRequest'], function () {
|
||||
var form = layui.form;
|
||||
var admin = layui.admin;
|
||||
var HttpRequest = layui.HttpRequest;
|
||||
|
||||
// 获取应用详情
|
||||
var request = new HttpRequest(Feng.ctxPath + "/sysApp/detail?appId=" + Feng.getUrlParam("appId"), 'get');
|
||||
var result = request.start();
|
||||
|
||||
form.val('appForm', result.data);
|
||||
|
||||
// 表单提交事件
|
||||
form.on('submit(btnSubmit)', function (data) {
|
||||
var request = new HttpRequest(Feng.ctxPath + "/sysApp/edit", 'post', function (data) {
|
||||
Feng.success("修改成功!");
|
||||
admin.putTempData('formOk', true);
|
||||
admin.closeThisDialog();
|
||||
}, function (data) {
|
||||
Feng.error("修改失败!" + data.message);
|
||||
admin.closeThisDialog();
|
||||
});
|
||||
request.set(data.field);
|
||||
request.start(true);
|
||||
});
|
||||
|
||||
});
|
@ -0,0 +1,44 @@
|
||||
@layout("/layout/_container.html", {js:["/assets/modular/auth/app/app.js"]}){
|
||||
|
||||
<div class="layui-body-header">
|
||||
<span class="layui-body-header-title">应用管理</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-fluid">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form toolbar">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<input id="appName" class="layui-input" type="text" placeholder="应用名称"/>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input id="appCode" class="layui-input" type="text" placeholder="应用编码"/>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon"></i>搜索</button>
|
||||
<button id="btnAdd" class="layui-btn icon-btn"><i class="layui-icon"></i>添加</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-table" id="appTable" lay-filter="appTable"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="tableBar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="activeTpl">
|
||||
<input type="checkbox" lay-filter="activeFilter" value="{{d.appId}}" lay-skin="switch" lay-text="已激活|未激活" {{d.activeFlag=='Y'?'checked':''}}/>
|
||||
</script>
|
||||
<script type="text/html" id="statusTpl">
|
||||
<input type="checkbox" lay-filter="statusFilter" value="{{d.appId}}" lay-skin="switch" lay-text="启用|禁用" {{d.statusFlag=='1'?'checked':''}}/>
|
||||
</script>
|
||||
@}
|
@ -0,0 +1,31 @@
|
||||
@layout("/layout/_form.html",{js:["/assets/modular/auth/app/app_add.js"]}){
|
||||
|
||||
<form class="layui-form" id="appForm" lay-filter="appForm">
|
||||
<div class="layui-fluid" style="padding-bottom: 75px;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item layui-row">
|
||||
<input name="deptId" type="hidden"/>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">应用名称<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input name="appName" placeholder="请输入应用名称" type="text" class="layui-input" lay-verify="required" required autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">应用编码<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input name="appCode" placeholder="请输入应用编码" type="text" class="layui-input" lay-verify="required" required autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-center">
|
||||
<button class="layui-btn" lay-filter="btnSubmit" lay-submit> 提交 </button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary" ew-event="closeDialog"> 取消 </button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@}
|
@ -0,0 +1,31 @@
|
||||
@layout("/layout/_form.html",{js:["/assets/modular/auth/app/app_edit.js"]}){
|
||||
|
||||
<form class="layui-form" id="appForm" lay-filter="appForm">
|
||||
<div class="layui-fluid" style="padding-bottom: 75px;">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-form-item layui-row">
|
||||
<input name="appId" type="hidden"/>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">应用名称<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input name="appName" placeholder="请输入应用名称" type="text" class="layui-input" lay-verify="required" required autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">应用编码<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input name="appCode" placeholder="请输入应用编码" type="text" class="layui-input layui-disabled" lay-verify="required" disabled required autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-center">
|
||||
<button class="layui-btn" lay-filter="btnSubmit" lay-submit> 提交 </button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary" ew-event="closeDialog"> 取消 </button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@}
|
Loading…
Reference in new issue