更新初始化文件

pull/1/head
759675757@qq.com 2019-12-25 17:21:19 +08:00
parent 4847caec39
commit 42c682ebad
26 changed files with 252 additions and 158 deletions

View File

@ -33,37 +33,37 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Slf4j
public class SysUserController extends BaseController {
@Autowired
private ISysUserService sysUserService;
@Autowired
private ISysUserService sysUserService;
@GetMapping("/list-ui")
public String listUI(Model model) {
return "system/user/list";
}
@GetMapping("/list-ui")
public String listUI(Model model) {
return "system/user/list";
}
@PostMapping("/page")
@ResponseBody
public Result page(Page page, SysUserPageReq req) {
Object principal = SecurityUtils.getSubject().getPrincipal();
QueryWrapper qw = new QueryWrapper();
qw.orderByDesc(req.getOrderBy());
IPage result = sysUserService.page(page, qw);
return Result.success(result);
}
@PostMapping("/page")
@ResponseBody
public Result page(Page page, SysUserPageReq req) {
Object principal = SecurityUtils.getSubject().getPrincipal();
QueryWrapper qw = new QueryWrapper();
qw.orderByDesc(req.getOrderBy());
IPage result = sysUserService.page(page, qw);
return Result.success(result);
}
@GetMapping("/add-or-upd-ui")
public String addOrUpdUI(Model model, SysUser record) {
if (StringUtils.isNotEmpty(record.getId())) {
SysUser result = sysUserService.getById(record.getId());
model.addAttribute("result", result);
}
return "system/user/addOrUpd";
}
@GetMapping("/add-or-upd-ui")
public String addOrUpdUI(SysUser record, Model model) {
if (StringUtils.isNotEmpty(record.getId())) {
SysUser result = sysUserService.getById(record.getId());
model.addAttribute("result", result);
}
return "system/user/addOrUpd";
}
@PostMapping("/add-or-upd")
@ResponseBody
public Result addOrUpd(SysUser record) {
sysUserService.saveOrUpdate(record);
return Result.success(record.getId());
}
@PostMapping("/add-or-upd")
@ResponseBody
public Result addOrUpd(SysUser record) {
sysUserService.saveOrUpdate(record);
return Result.success(record.getId());
}
}

View File

@ -1,37 +1,42 @@
body {
margin: 0 0 0 0;
background: #f2f2f2;
margin: 0 0 0 0;
background: #f2f2f2;
}
.layuimini-container {
border: 1px solid #f2f2f2;
border-radius: 5px;
background-color: #ffffff;
border: 1px solid #f2f2f2;
border-radius: 5px;
background-color: #ffffff;
}
.layuimini-main {
margin: 10px 10px 10px 10px;
margin: 10px 10px 10px 10px;
}
/**必填红点 */
.layuimini-form > .layui-form-item > .required:after {
content: "*";
color: red;
position: absolute;
margin-left: 4px;
font-weight: bold;
line-height: 1.8em;
top: 6px;
right: 5px;
.layuimini-form .layui-form-item > .sp-required:after {
content: "*";
color: red;
position: absolute;
margin-left: 4px;
font-weight: bold;
line-height: 1.8em;
top: 6px;
right: 5px;
}
.layuimini-form > .layui-form-item > .layui-form-label {
width: 120px !important;
.layuimini-form .layui-form-item > .layui-form-label {
width: 120px !important;
}
.layuimini-form > .layui-form-item > .layui-input-block {
margin-left: 150px !important;
margin-left: 150px !important;
}
.layuimini-form > .layui-form-item > .layui-input-block > tip {
display: inline-block;
margin-top: 10px;
line-height: 10px;
font-size: 10px;
color: #a29c9c;
.layuimini-form .layui-form-item > .layui-input-block > tip {
display: inline-block;
margin-top: 10px;
line-height: 10px;
font-size: 10px;
color: #a29c9c;
}

View File

@ -29,5 +29,5 @@ layui.config({
// wangEditor富文本扩展
wangEditor: 'wangEditor/wangEditor',
// 自定义layer扩展组件
spLayer: 'spLayer/spLayer'
splayer: 'splayer/splayer'
});

View File

@ -7,17 +7,17 @@ layui.define(['layer'], function (exports) {
var $ = layui.jquery;
var layer = layui.layer;
var spLayer = {
var splayer = {
// 渲染弹出框
open: function (param) {
console.log(param);
var config = {};
$.extend(config, param, {
// 这里写默认配置,会覆盖自定义配置 param
content: param.content + '?' + spUtil.parseParam(param.spWhere)
});
layer.open(config);
}
};
exports('spLayer', spLayer);
exports('splayer', splayer);
});

View File

@ -1,6 +1,103 @@
// 工具类
var spUtil = {};
spUtil.open = function () {
/**
* 将对象转为url路径字符串参数编码之后的字符串
* @param param
* @param key
* @returns {string}
*/
spUtil.parseParam = function (a) {
var s = [],
rbracket = /\[\]$/,
isArray = function (obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
},
add = function (k, v) {
v = typeof v === 'function' ? v() : v === null ? '' : v === undefined ? '' : v;
s[s.length] = encodeURIComponent(k) + '=' + encodeURIComponent(v);
},
buildParams = function (prefix, obj) {
var i, len, key;
if (prefix) {
if (isArray(obj)) {
for (i = 0, len = obj.length; i < len; i++) {
if (rbracket.test(prefix)) {
add(prefix, obj[i]);
} else {
buildParams(prefix + '[' + (typeof obj[i] === 'object' ? i : '') + ']', obj[i]);
}
}
} else if (obj && String(obj) === '[object Object]') {
for (key in obj) {
buildParams(prefix + '[' + key + ']', obj[key]);
}
} else {
add(prefix, obj);
}
} else if (isArray(obj)) {
for (i = 0, len = obj.length; i < len; i++) {
add(obj[i].name, obj[i].value);
}
} else {
for (key in obj) {
buildParams(key, obj[key]);
}
}
return s;
};
return buildParams('', a).join('&').replace(/%20/g, '+');
};
/**
* 解析url路径参数为对象
* @param url
*/
spUtil.parseQueryString = function (url) {
var obj = {};
var keyvalue = [];
var key = "",
value = "";
var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
for (var i in paraString) {
keyvalue = paraString[i].split("=");
key = keyvalue[0];
value = decodeURIComponent(keyvalue[1]);
obj[key] = value;
}
return obj;
};
/**
* 去除字符串内所有的空格
* @param str
*/
spUtil.trimAll = function (str) {
return str ? str.replace(/\s*/g, "") : str;
};
/**
* 去除字符串内两头的空格
* @param str
*/
spUtil.trimBothEnds = function (str) {
return str ? str.replace(/^\s*|\s*$/g, "") : str;
};
/**
* 去除字符串内左侧的空格
* @param str
*/
spUtil.trimLeft = function (str) {
return str ? str.replace(/^\s*/, "") : str;
};
/**
* 去除字符串内右侧的空格
* @param str
*/
spUtil.trimRight = function (str) {
return str ? str.replace(/(\s*$)/g, "") : str;
};

View File

@ -9,4 +9,5 @@
<![endif]-->
<script src="${request.contextPath}/lib/jquery/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="${request.contextPath}/lib/layui/layui.js?v=v2.5.5" charset="utf-8"></script>
<script src="${request.contextPath}/js/layui-module/layui-config.js?v=1.0.0" charset="utf-8"></script>
<script src="${request.contextPath}/js/spUtil.js?v=1.0.0" charset="utf-8"></script>
<script src="${request.contextPath}/js/layuimodule/config.js?v=1.0.0" charset="utf-8"></script>

View File

@ -18,8 +18,7 @@
<div class="weadmin-body">
<form class="layui-form">
<div class="layui-form-item">
<label for="js-name" class="layui-form-label">
<span class="we-red">*</span>标签名
<label for="js-name" class="layui-form-label sp-required">标签名
</label>
<div class="layui-input-inline">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${dict.name}">
@ -27,8 +26,7 @@
</div>
<div class="layui-form-item">
<label for="js-value" class="layui-form-label">
<span class="we-red">*</span>标签值
<label for="js-value" class="layui-form-label sp-required">标签值
</label>
<div class="layui-input-inline">
<input type="text" id="js-value" name="value" lay-verify="required" autocomplete="off" class="layui-input" value="${dict.value}">
@ -36,17 +34,14 @@
</div>
<div class="layui-form-item">
<label for="js-type" class="layui-form-label">
<span class="we-red">*</span>类别
</label>
<label for="js-type" class="layui-form-label sp-required">类别</label>
<div class="layui-input-inline">
<input type="text" id="js-type" name="type" lay-verify="required" autocomplete="off" class="layui-input" value="${dict.type}">
</div>
</div>
<div class="layui-form-item">
<label for="js-descr" class="layui-form-label">
<span class="we-red">*</span>描述
<label for="js-descr" class="layui-form-label sp-required">描述
</label>
<div class="layui-input-inline">
<input type="text" id="js-descr" name="descr" lay-verify="required" autocomplete="off" class="layui-input" value="${dict.descr}">
@ -54,8 +49,7 @@
</div>
<div class="layui-form-item">
<label for="js-sort-num" class="layui-form-label">
<span class="we-red">*</span>排序
<label for="js-sort-num" class="layui-form-label sp-required">排序
</label>
<div class="layui-input-inline">
<input type="text" id="js-sort-num" name="sortNum" lay-verify="required|number" autocomplete="off" class="layui-input" value="${dict.sortNum}">
@ -63,7 +57,7 @@
</div>
<div class="layui-form-item">
<label for="js-status" class="layui-form-label"><span class="we-red">*</span>状态</label>
<label for="js-status" class="layui-form-label sp-required"><span class="sp-red">*</span>状态</label>
<div class="layui-input-block" id="js-status">
<input type="radio" name="status" value="0" title="正常" checked>
<input type="radio" name="status" value="1" title="已删除">
@ -72,7 +66,7 @@
<div class="layui-form-item">
<input type="hidden" name="id" id="js-id" value="" />
<label for="js-add-btn" class="layui-form-label"></label>
<label for="js-add-btn" class="layui-form-label sp-required"></label>
<button id="js-add-btn" class="layui-btn" lay-filter="add" lay-submit="">确定</button>
</div>
</form>

View File

@ -18,8 +18,7 @@
<div class="weadmin-body">
<form class="layui-form">
<div class="layui-form-item">
<label for="js-name" class="layui-form-label">
<span class="we-red">*</span>菜单名称
<label for="js-name" class="layui-form-label sp-required">菜单名称
</label>
<div class="layui-input-inline">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${result.name}">
@ -27,8 +26,7 @@
</div>
<div class="layui-form-item">
<label for="js-url" class="layui-form-label">
<span class="we-red">*</span>菜单URL
<label for="js-url" class="layui-form-label sp-required">菜单URL
</label>
<div class="layui-input-inline">
<input type="text" id="js-url" name="url" lay-verify="required" autocomplete="off" class="layui-input" value="${result.url}">
@ -36,7 +34,7 @@
</div>
<div class="layui-form-item">
<label for="js-parent-id" class="layui-form-label">
<label for="js-parent-id" class="layui-form-label sp-required">
父菜单ID
</label>
<div class="layui-input-inline">
@ -45,7 +43,7 @@
</div>
<div class="layui-form-item">
<label for="js-grade" class="layui-form-label">
<label for="js-grade" class="layui-form-label sp-required">
层级
</label>
<div class="layui-input-inline">
@ -54,7 +52,7 @@
</div>
<div class="layui-form-item">
<label for="js-sort-num" class="layui-form-label">
<label for="js-sort-num" class="layui-form-label sp-required">
排序
</label>
<div class="layui-input-inline">
@ -63,7 +61,7 @@
</div>
<div class="layui-form-item">
<label for="js-type" class="layui-form-label">
<label for="js-type" class="layui-form-label sp-required">
类型
</label>
<div class="layui-input-inline">
@ -72,7 +70,7 @@
</div>
<div class="layui-form-item">
<label for="js-permission" class="layui-form-label">
<label for="js-permission" class="layui-form-label sp-required">
授权
</label>
<div class="layui-input-inline">
@ -81,7 +79,7 @@
</div>
<div class="layui-form-item">
<label for="js-icon" class="layui-form-label">
<label for="js-icon" class="layui-form-label sp-required">
菜单图标
</label>
<div class="layui-input-inline">
@ -90,7 +88,7 @@
</div>
<div class="layui-form-item">
<label for="js-descr" class="layui-form-label">
<label for="js-descr" class="layui-form-label sp-required">
描述
</label>
<div class="layui-input-inline">
@ -100,7 +98,7 @@
<div class="layui-form-item">
<input type="hidden" name="id" id="js-id" value="" />
<label for="js-add-btn" class="layui-form-label"></label>
<label for="js-add-btn" class="layui-form-label sp-required"></label>
<button id="js-add-btn" class="layui-btn" lay-filter="add" lay-submit="">确定</button>
</div>
</form>

View File

@ -18,8 +18,7 @@
<div class="weadmin-body">
<form class="layui-form">
<div class="layui-form-item">
<label for="js-name" class="layui-form-label">
<span class="we-red">*</span>角色名称
<label for="js-name" class="layui-form-label sp-required">角色名称
</label>
<div class="layui-input-inline">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${result.name}">
@ -27,8 +26,7 @@
</div>
<div class="layui-form-item">
<label for="js-code" class="layui-form-label">
<span class="we-red">*</span>角色编码
<label for="js-code" class="layui-form-label sp-required">角色编码
</label>
<div class="layui-input-inline">
<input type="text" id="js-code" name="code" lay-verify="required" autocomplete="off" class="layui-input" value="${result.code}">
@ -36,7 +34,7 @@
</div>
<div class="layui-form-item">
<label for="js-descr" class="layui-form-label">
<label for="js-descr" class="layui-form-label sp-required">
描述
</label>
<div class="layui-input-inline">
@ -45,7 +43,7 @@
</div>
<div class="layui-form-item">
<label for="js-status" class="layui-form-label"><span class="we-red">*</span>状态</label>
<label for="js-status" class="layui-form-label sp-required">状态</label>
<div class="layui-input-block" id="js-status">
<input type="radio" name="status" value="0" title="正常" <#if result.status == "0" || !(result??)>checked</#if>>
<input type="radio" name="status" value="1" title="已删除" <#if result.status == "1">checked</#if>>
@ -54,7 +52,7 @@
<div class="layui-form-item">
<input type="hidden" name="id" id="js-id" value="" />
<label for="js-add-btn" class="layui-form-label"></label>
<label for="js-add-btn" class="layui-form-label sp-required"></label>
<button id="js-add-btn" class="layui-btn" lay-filter="add" lay-submit="">确定</button>
</div>
</form>

View File

@ -11,13 +11,12 @@
<body>
<div class="weadmin-body">
<form class="layui-form">
<form class="layui-form layuimini-form">
<div class="layui-container">
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<div class="layui-form-item">
<label for="js-name" class="layui-form-label">
<span class="we-red">*</span>姓名
<label for="js-name" class="layui-form-label sp-required">姓名
</label>
<div class="layui-input-inline">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${result.name}">
@ -25,8 +24,7 @@
</div>
<div class="layui-form-item">
<label for="js-username" class="layui-form-label">
<span class="we-red">*</span>用户名
<label for="js-username" class="layui-form-label sp-required">用户名
</label>
<div class="layui-input-inline">
<input type="text" id="js-username" name="username" lay-verify="required" autocomplete="off" class="layui-input" value="${result.username}">
@ -34,8 +32,7 @@
</div>
<div class="layui-form-item">
<label for="js-password" class="layui-form-label">
<span class="we-red">*</span>密码
<label for="js-password" class="layui-form-label sp-required">密码
</label>
<div class="layui-input-inline">
<input type="password" id="js-password" name="password" lay-verify="required" autocomplete="off" class="layui-input" value="${result.password}">
@ -43,8 +40,7 @@
</div>
<div class="layui-form-item">
<label for="js-repassword" class="layui-form-label">
<span class="we-red">*</span>确认密码
<label for="js-repassword" class="layui-form-label sp-required">确认密码
</label>
<div class="layui-input-inline">
<input type="password" id="js-repassword" name="repassword" lay-verify="required" autocomplete="off" class="layui-input" value="${result.password}">
@ -52,7 +48,7 @@
</div>
<div class="layui-form-item">
<label for="js-dept-id" class="layui-form-label">
<label for="js-dept-id" class="layui-form-label sp-required">
部门id
</label>
<div class="layui-input-inline">
@ -61,7 +57,7 @@
</div>
<div class="layui-form-item">
<label for="js-email" class="layui-form-label">
<label for="js-email" class="layui-form-label sp-required">
邮箱
</label>
<!--校验规则动态添加,根据鼠标焦点进行-->
@ -71,8 +67,7 @@
</div>
<div class="layui-form-item">
<label for="js-mobile" class="layui-form-label">
<span class="we-red">*</span>手机号
<label for="js-mobile" class="layui-form-label sp-required">手机号
</label>
<div class="layui-input-inline">
<input type="text" id="js-mobile" name="mobile" lay-verify="required|number" autocomplete="off" class="layui-input" value="${result.mobile}">
@ -80,7 +75,7 @@
</div>
<div class="layui-form-item">
<label for="js-tel" class="layui-form-label">
<label for="js-tel" class="layui-form-label sp-required">
固定电话
</label>
<div class="layui-input-inline">
@ -89,7 +84,7 @@
</div>
<div class="layui-form-item">
<label for="js-sex" class="layui-form-label"><span class="we-red">*</span>性别</label>
<label for="js-sex" class="layui-form-label sp-required">性别</label>
<div class="layui-input-block" id="js-sex">
<input type="radio" name="sex" value="0" title="女" <#if result.sex == "0" || !(result??)>checked</#if>>
<input type="radio" name="sex" value="1" title="男" <#if result.sex == "1">checked</#if>>
@ -98,7 +93,7 @@
</div>
<div class="layui-form-item">
<label for="js-birthday" class="layui-form-label">
<label for="js-birthday" class="layui-form-label sp-required">
出生年月日
</label>
<div class="layui-input-inline">
@ -108,7 +103,7 @@
</div>
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<div class="layui-form-item">
<label for="js-pic-id" class="layui-form-label">
<label for="js-pic-id" class="layui-form-label sp-required">
图片id
</label>
<div class="layui-input-inline">
@ -117,7 +112,7 @@
</div>
<div class="layui-form-item">
<label for="js-id-card" class="layui-form-label">
<label for="js-id-card" class="layui-form-label sp-required">
身份证
</label>
<div class="layui-input-inline">
@ -126,7 +121,7 @@
</div>
<div class="layui-form-item">
<label for="js-hobby" class="layui-form-label">
<label for="js-hobby" class="layui-form-label sp-required">
爱好
</label>
<div class="layui-input-inline">
@ -135,7 +130,7 @@
</div>
<div class="layui-form-item">
<label for="js-province" class="layui-form-label">
<label for="js-province" class="layui-form-label sp-required">
省份
</label>
<div class="layui-input-inline">
@ -144,64 +139,55 @@
</div>
<div class="layui-form-item">
<label for="js-city" class="layui-form-label">
城市
</label>
<label for="js-city" class="layui-form-label sp-required">城市</label>
<div class="layui-input-inline">
<input type="text" id="js-city" name="city" lay-verify="" autocomplete="off" class="layui-input" value="${result.city}">
</div>
</div>
<div class="layui-form-item">
<label for="js-district" class="layui-form-label">
区县
</label>
<label for="js-district" class="layui-form-label sp-required">区县</label>
<div class="layui-input-inline">
<input type="text" id="js-district" name="district" lay-verify="" autocomplete="off" class="layui-input" value="${result.district}">
</div>
</div>
<div class="layui-form-item">
<label for="js-street" class="layui-form-label">
街道
</label>
<label for="js-street" class="layui-form-label sp-required">街道</label>
<div class="layui-input-inline">
<input type="text" id="js-street" name="street" lay-verify="" autocomplete="off" class="layui-input" value="${result.street}">
</div>
</div>
<div class="layui-form-item">
<label for="js-street-number" class="layui-form-label">
门牌号
</label>
<label for="js-street-number" class="layui-form-label sp-required">门牌号</label>
<div class="layui-input-inline">
<input type="text" id="js-street-number" name="streetNumber" lay-verify="" autocomplete="off" class="layui-input" value="${result.streetNumber}">
</div>
</div>
<div class="layui-form-item">
<label for="js-descr" class="layui-form-label">
描述
</label>
<label for="js-descr" class="layui-form-label sp-required">描述</label>
<div class="layui-input-inline">
<input type="text" id="js-descr" name="descr" lay-verify="" autocomplete="off" class="layui-input" value="${result.descr}">
</div>
</div>
<div class="layui-form-item">
<label for="js-status" class="layui-form-label"><span class="we-red">*</span>状态</label>
<label for="js-status" class="layui-form-label sp-required">状态</label>
<div class="layui-input-block" id="js-status">
<input type="radio" name="status" value="0" title="正常" <#if result.status == "0" || !(result??)>checked</#if>>
<input type="radio" name="status" value="1" title="已删除" <#if result.status == "1">checked</#if>>
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<input type="hidden" name="id" id="js-id" value=""/>
<label for="js-add-btn" class="layui-form-label"></label>
<button id="js-add-btn" class="layui-btn" lay-filter="add" lay-submit="">确定</button>
<div class="layui-form-item">
<div class="layui-input-block">
<input id="js-id" name="id" value="${result.id}"/>
<button id="js-submit" class="layui-btn layui-hide" lay-filter="js-submit-filter" lay-submit>确定</button>
</div>
</div>
</div>
</div>
</form>
</div>
@ -224,13 +210,13 @@
});
//监听提交
form.on('submit(add)', function (data) {
form.on('submit(js-submit-filter)', function (data) {
console.log(data);
return false;
$.ajax({
type: "POST",
//请求的媒体类型
//contentType: "application/json;charset=UTF-8",
async: true,
url: "${request.contextPath}/admin/sys/user/add-or-upd",
//data: JSON.stringify(data),
data: data.field,
success: function (result) {
if (result.code === 0) {

View File

@ -11,7 +11,8 @@
<body>
<div class="layuimini-container">
<div class="layuimini-main">
<form class="layui-form layui-form-pane" action="">
<!--查询参数-->
<form id="js-q-form" class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">用户姓名</label>
@ -45,6 +46,7 @@
<table class="layui-hide" id="record-table" lay-filter="table-filter"></table>
</div>
</div>
<script type="text/html" id="toolbar-top">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="getCheckData"><i class="layui-icon">&#xe640;</i>批量删除</button>
@ -56,28 +58,21 @@
</div>
</script>
<script type="text/html" id="operateTpl">
<a title="编辑" href="javascript:;" lay-event="edit">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="查看" onclick="WeAdminShow('查看用户','./show.html',600,400)" href="javascript:;">
<i class="layui-icon">&#xe63c;</i>
</a>
<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
<script type="text/html" id="toolbar-right">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
layui.use(['form', 'table', 'spLayer'], function () {
layui.use(['form', 'table', 'splayer'], function () {
var $ = layui.$,
form = layui.form,
table = layui.table,
spLayer = layui.spLayer;
splayer = layui.splayer;
var tableIns = table.render({
elem: '#record-table',
cellMinWidth: 80,
height: 'full-80',
height: 'full-' + ($('#js-q-form').height() + 40),
toolbar: '#toolbar-top',
method: 'POST',
limits: [10, 20, 50, 100],
@ -138,7 +133,7 @@
}, {
field: 'status', title: '状态', width: 90
}, {
fixed: 'right', field: 'operate', title: '操作', toolbar: '#operateTpl', unresize: true, width: 90
fixed: 'right', field: 'operate', title: '操作', toolbar: '#toolbar-right', unresize: true, width: 120
}]
],
done: function (res, curr, count) {
@ -212,20 +207,40 @@
//监听行工具事件
table.on('tool(table-filter)', function (obj) {
var data = obj.data;
console.log(obj);
if (obj.event === 'del') {
layer.confirm('真的删除行么', function (index) {
obj.del();
layer.close(index);
});
} else if (obj.event === 'edit') {
console.log('edit...');
spLayer.open({
splayer.open({
title: '编辑',
type: 2,
area: ['800px', '500px'],
area: ['100%', '100%'],
fixed: false,
maxmin: true,
content: '${request.contextPath}/admin/sys/user/add-or-upd-ui'
// 请求url参数
spWhere: {id: data.id},
content: '${request.contextPath}/admin/sys/user/add-or-upd-ui',
btn: ['确定', '取消'],
yes: function(index, layero){
console.log(layero);
//do something
console.log($($(layero).find('#js-submit').get(0)));
$($(layero).find('#js-submit').get(0)).trigger("click");
layer.close(index); //如果设定了yes回调需进行手工关闭
},
btn2: function(index, layero){
//按钮【按钮二】的回调
//return false 开启该代码可禁止点击该按钮关闭
},
cancel: function(index, layero){
//右上角关闭回调
//return false 开启该代码可禁止点击该按钮关闭
}
});
}
});