v2版本正式上线测试版
This commit is contained in:
@@ -1,67 +1,62 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">
|
||||
<div style="margin: 10px 0px">
|
||||
<blockquote class="layui-elem-quote">
|
||||
说明:新建任务分组
|
||||
</blockquote>
|
||||
</div>
|
||||
<form class="layui-form" action="" method="post" >
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分组名称</label>
|
||||
<div class="layui-input-inline" style="min-width: 200px;">
|
||||
<input type="text" name="group_name" id="group_name" lay-verify="required" autocomplete="off" placeholder="任务分组" class="layui-input" value="">
|
||||
</div>
|
||||
|
||||
<div class="layui-form-mid layui-word-aux">*</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分组说明</label>
|
||||
<div class="layui-input-inline" style="min-width: 400px;">
|
||||
<textarea name="description" id="description" placeholder="请输入内容" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "GroupController.Add"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="group_name">分类名称</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="group_name" value="" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="description">分类说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="description" class="form-control" id="description" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="hidden" id="id" value="0">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
// $(".alert").hide();
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "GroupController.Add"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "GroupController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
var $;
|
||||
layui.use(['form','element','layer','jquery'],function(){
|
||||
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
|
||||
var $ = layui.jquery;
|
||||
var error_info = "{{.flash.error}}";
|
||||
if(error_info){
|
||||
layer.msg(error_info,{icon: 2,shade:0.3},function () {
|
||||
window.history.go(-1)
|
||||
})
|
||||
return;
|
||||
}
|
||||
form.on('submit(sub)', function(data){
|
||||
var form_data = $("form").serialize();
|
||||
$.post('{{urlfor "GroupController.AjaxSave"}}', form_data, function (out) {
|
||||
if (out.status == 0) {
|
||||
layer.msg("操作成功",{icon: 1},function () {
|
||||
window.history.go(-1)
|
||||
})
|
||||
} else {
|
||||
layer.msg(out.message)
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
|
||||
//但是,如果你的HTML是动态生成的,自动渲染就会失效
|
||||
//因此你需要在相应的地方,执行下述方法来手动渲染,跟这类似的还有 element.init();
|
||||
form.render();
|
||||
});
|
||||
</script>
|
||||
@@ -1,67 +1,62 @@
|
||||
<!-- 新增任务 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">
|
||||
<div style="margin: 10px 0px">
|
||||
<blockquote class="layui-elem-quote">
|
||||
说明:编辑任务分组
|
||||
</blockquote>
|
||||
</div>
|
||||
<form class="layui-form" action="" method="post" >
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分组名称</label>
|
||||
<div class="layui-input-inline" style="min-width: 200px;">
|
||||
<input type="text" value="{{.group.group_name}}" name="group_name" id="group_name" lay-verify="required" autocomplete="off" placeholder="任务分组" class="layui-input" >
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">*</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">分组说明</label>
|
||||
<div class="layui-input-inline" style="min-width: 400px;">
|
||||
<textarea name="description" id="description" placeholder="请输入内容" class="layui-textarea">{{.group.description}}</textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<input type="hidden" id="id" name="id" value="{{.group.id}}">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<form action="{{urlfor "GroupController.Edit"}}" method="post" class="form-horizontal">
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="group_name">分类名称</label>
|
||||
<div class="col-sm-3" >
|
||||
<input type="text" class="form-control input-sm" placeholder="" name="group_name" value="{{.group.GroupName}}" required />
|
||||
</div>
|
||||
<div class="col-sm-6" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-top: 15px">
|
||||
<label class="col-sm-3 control-label" for="description">分类说明</label>
|
||||
<div class="col-sm-5" >
|
||||
<textarea name="description" class="form-control" id="description" rows="3">{{.group.Description}}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4" style="padding-top:5px;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<input type="hidden" name="id" value="{{.group.Id}}" />
|
||||
<div class="modal-footer" style="text-align:center">
|
||||
<button type="submit" class="btn btn-primary submit_attr_button">保存</button>
|
||||
<button type="button" class="btn btn-default reback">返回</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("form").submit(function () {
|
||||
$("button[type='submit']").attr('disabled', true);
|
||||
$.post('{{urlfor "GroupController.Edit"}}', $(this).serialize(), function (out) {
|
||||
if (out.status == 0) {
|
||||
window.location.href = '{{urlfor "GroupController.List"}}';
|
||||
} else {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
$("button[type='submit']").attr('disabled', false);
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
var $;
|
||||
layui.use(['form','element','layer','jquery'],function(){
|
||||
var form = layui.form; //只有执行了这一步,部分表单元素才会自动修饰成功
|
||||
var $ = layui.jquery;
|
||||
var error_info = "{{.flash.error}}";
|
||||
if(error_info){
|
||||
layer.msg(error_info,{icon: 2,shade:0.3},function () {
|
||||
window.history.go(-1)
|
||||
})
|
||||
return;
|
||||
}
|
||||
form.on('submit(sub)', function(data){
|
||||
var form_data = $("form").serialize();
|
||||
$.post('{{urlfor "GroupController.AjaxSave"}}', form_data, function (out) {
|
||||
if (out.status == 0) {
|
||||
layer.msg("操作成功",{icon: 1},function () {
|
||||
window.history.go(-1)
|
||||
})
|
||||
} else {
|
||||
layer.msg(out.message)
|
||||
}
|
||||
}, "json");
|
||||
return false;
|
||||
});
|
||||
|
||||
//但是,如果你的HTML是动态生成的,自动渲染就会失效
|
||||
//因此你需要在相应的地方,执行下述方法来手动渲染,跟这类似的还有 element.init();
|
||||
form.render();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1,113 +1,105 @@
|
||||
<!-- 分组列表 -->
|
||||
<div class="container-fluid">
|
||||
<div class="info-center">
|
||||
<!--title-->
|
||||
<div class="info-center">
|
||||
<div class="page-header">
|
||||
<div class="pull-left">
|
||||
<h4>{{.pageTitle}}</h4>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<!-- <button type="button" class="btn btn-mystyle btn-sm refresh">刷新</button>
|
||||
<button type="button" class="btn btn-mystyle btn-sm reback">返回</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
|
||||
<div class="layui-row" style="margin-top: 20px;">
|
||||
<div class="layui-col-xs6">
|
||||
<a class="layui-btn" data-type="tabAdd" href="/group/add">新增</a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<!--content-list-->
|
||||
<div class="content-list">
|
||||
<div class="search-box row">
|
||||
<div class="col-md-4">
|
||||
<div class="btn-group pull-left" role="group" aria-label="...">
|
||||
<a href='{{urlfor "GroupController.Add"}}' class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span> 新增分类</a>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="glyphicon glyphicon-edit"></span> 批量操作
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" onclick="javascript:batch('delete');"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> 删除</a></li>
|
||||
</ul>
|
||||
<div class="layui-col-xs6 search_text">
|
||||
<form class="layui-form" action="" onsubmit="javascript:return false;">
|
||||
<div class="demoTable">
|
||||
<div class="layui-inline" style="width: 40%">
|
||||
<input class="layui-input" name="groupName" id="groupName" autocomplete="off" placeholder="分组名称" >
|
||||
</div>
|
||||
<button class="layui-btn" data-type="reload">查询</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class=" btn-large pull-right" >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<div class="table-margin">
|
||||
<form id="form-list" method="post" action="">
|
||||
<table class="table table-bordered table-header">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="all_check" /></td>
|
||||
<td>ID</td>
|
||||
<td width="20%">分类名称</td>
|
||||
<td>描述</td>
|
||||
<td width="25%">操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range $k,$v := .list}}
|
||||
<tr>
|
||||
<td class="chk"><input type="checkbox" name="ids" value="{{$v.Id}}" /></td>
|
||||
<td class="center">{{$v.Id}}</td>
|
||||
<td>{{$v.GroupName}}</td>
|
||||
<td>{{$v.Description}}</td>
|
||||
|
||||
<td>
|
||||
|
||||
<a class="btn btn-info btn-xs" href="{{urlfor "GroupController.Edit"}}?id={{$v.Id}}">
|
||||
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> 编辑
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<div class="pull-right">
|
||||
{{str2html .pageBar}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="layui-hide" id="table_list" lay-filter="table_filter">
|
||||
</table>
|
||||
|
||||
<script type="text/html" id="bar">
|
||||
<!-- <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a> -->
|
||||
<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>
|
||||
</div>
|
||||
<script>
|
||||
function batch(action) {
|
||||
if ($("input[name='ids']:checked").size() < 1) {
|
||||
alert_message("请选择要操作的任务","alert-danger","alert-success");
|
||||
} else {
|
||||
if(action=='delete'){
|
||||
if(!confirm("确定要删除所选吗?")) return;
|
||||
}
|
||||
var url = "{{urlfor "GroupController.Batch"}}";
|
||||
$.post(url + "?action=" + action, $("#form-list").serialize(), function(out) {
|
||||
if (out.status != 0) {
|
||||
alert_message(out.msg,"alert-danger","alert-success");
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//点击行换色
|
||||
$('tbody tr').click(function(){
|
||||
$(this).addClass("warning").siblings().removeClass("warning");
|
||||
});
|
||||
layui.use(['table','form','element'], function(){
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var element = layui.element;
|
||||
var error_info = "{{.flash.error}}";
|
||||
if(error_info){
|
||||
layer.msg(error_info,{icon: 2,shade:0.3},function () {
|
||||
window.history.go(-1)
|
||||
})
|
||||
return;
|
||||
}
|
||||
//方法级渲染
|
||||
table.render({
|
||||
elem: '#table_list'
|
||||
,url: '/group/table'
|
||||
,cols: [[
|
||||
// {checkbox: true, fixed: true},
|
||||
{field:'id', title: 'ID', align:'center',sort: true, width:150}
|
||||
,{field:'group_name',title: '分组名称'}
|
||||
,{field:'description', title: '分组说明'}
|
||||
,{field:'create_time', title: '创建时间'}
|
||||
,{field:'update_time', title: '更新时间'}
|
||||
,{fixed: 'right', width:160, align:'center', toolbar: '#bar'}
|
||||
]]
|
||||
,id: 'listReload'
|
||||
,page: true
|
||||
,height: "full-130"
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
reload: function(){
|
||||
table.reload('listReload', {
|
||||
where: {
|
||||
groupName: $('#groupName').val(),
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//监听工具条
|
||||
table.on('tool(table_filter)', function(obj){
|
||||
var data = obj.data;
|
||||
if(obj.event === 'edit'){
|
||||
window.location.href="/group/edit?id="+data.id
|
||||
} else if(obj.event === 'del'){
|
||||
|
||||
layer.confirm('真的删除【'+data.group_name+'】分组么', function(index){
|
||||
var jsData = {'id':data.id}
|
||||
$.post('{{urlfor "GroupController.AjaxDel"}}', jsData, function (out) {
|
||||
if (out.status == 0) {
|
||||
layer.alert('删除成功了', {icon: 1},function(index){
|
||||
layer.close(index);
|
||||
window.location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(out.message)
|
||||
return
|
||||
}
|
||||
}, "json");
|
||||
// obj.del();
|
||||
layer.close(index);
|
||||
})
|
||||
|
||||
}else{
|
||||
layer.msg('操作不存在');
|
||||
}
|
||||
});
|
||||
|
||||
$('.demoTable .layui-btn').on('click', function(){
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user