|
@@ -0,0 +1,182 @@
|
|
|
+{{template "inc"}}
|
|
|
+<!-- Main Header -->
|
|
|
+{{template "header"}}
|
|
|
+<!-- Left side column. 权限菜单 -->
|
|
|
+{{template "memu"}}
|
|
|
+
|
|
|
+<!-- Content Wrapper. Contains page content -->
|
|
|
+<div class="content-wrapper">
|
|
|
+ <section class="content-header">
|
|
|
+ <h1>
|
|
|
+ <small><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-info">新增逻辑</button></small>
|
|
|
+ </h1>
|
|
|
+ <ol class="breadcrumb">
|
|
|
+ <li><a href="/admin/version"><i class="fa fa-dashboard"></i> 版本控制</a></li>
|
|
|
+ <li><a href="/admin/version">版本管理</a></li>
|
|
|
+ <li class="active"><a href="#">前置逻辑</a></li>
|
|
|
+ </ol>
|
|
|
+ </section>
|
|
|
+ <!-- Main content -->
|
|
|
+ <section class="content">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-xs-12">
|
|
|
+ <div class="box">
|
|
|
+ <div class="box-body">
|
|
|
+ <table id="dataTable" class="table table-bordered table-hover">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>名称</th>
|
|
|
+ <th>创建人</th>
|
|
|
+ <th>描述</th>
|
|
|
+ <th>状态</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <!-- /.box-body -->
|
|
|
+ </div>
|
|
|
+ <!-- /.box -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+</div>
|
|
|
+
|
|
|
+<div class="modal fade" id="modal-info">
|
|
|
+ <div class="modal-dialog">
|
|
|
+ <form id="dataform" class="form-horizontal" role="form">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span aria-hidden="true">×</span></button>
|
|
|
+ <h4 class="modal-title">规则信息</h4>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="code" class="col-sm-2 control-label">名称:</label>
|
|
|
+ <div class="col-sm-10">
|
|
|
+ <input id="name" type="text" class="form-control" placeholder="请输名称">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="code" class="col-sm-2 control-label">版本:</label>
|
|
|
+ <div class="col-sm-10">
|
|
|
+ <input id="version" type="text" value="{{.version}}" class="form-control" disabled>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="code" class="col-sm-2 control-label">描述:</label>
|
|
|
+ <div class="col-sm-10">
|
|
|
+ <input id="descript" type="text" class="form-control" placeholder="描述">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reset()">取消</button>
|
|
|
+ <button type="button" class="btn btn-primary" onclick="save()">保存</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- /.modal-content -->
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <!-- /.modal-dialog -->
|
|
|
+</div>
|
|
|
+<!-- /.modal -->
|
|
|
+
|
|
|
+<!-- footer -->
|
|
|
+{{template "footer"}}
|
|
|
+
|
|
|
+<script>
|
|
|
+menuActive("version")
|
|
|
+$(function () {
|
|
|
+ ttable=$('#dataTable').DataTable({
|
|
|
+ "paging" : false,
|
|
|
+ "lengthChange": false,
|
|
|
+ "searching" : true,
|
|
|
+ "ordering" : false,
|
|
|
+ "info" : true,
|
|
|
+ "autoWidth" : false,
|
|
|
+ "ajax": {
|
|
|
+ "url": "/admin/rulepre/data",
|
|
|
+ "type": "post",
|
|
|
+ "data":{"version":{{ .version}} }
|
|
|
+ },
|
|
|
+ "language": {
|
|
|
+ "url": "../res/dist/js/dataTables.chinese.lang"
|
|
|
+ },
|
|
|
+ "columns": [
|
|
|
+ { "data": "name"},
|
|
|
+ { "data": "username"},
|
|
|
+ { "data": "descript"},
|
|
|
+ { "data": "state",render:function(val,a,row){
|
|
|
+ tmp=""
|
|
|
+ if(val=="0"){
|
|
|
+ tmp="待完成"
|
|
|
+ }else if (val=="1"){
|
|
|
+ tmp="待审核"
|
|
|
+ }else{
|
|
|
+ tmp="已审核"
|
|
|
+ }
|
|
|
+ return tmp
|
|
|
+ }},
|
|
|
+ { "data": "_id",render:function(val,a,row){
|
|
|
+ return "<a href='#' onclick='edit(\""+val+"\")'><i class='fa fa-fw fa-edit text-yellow'></i></a> "+
|
|
|
+ "<a href='#' onclick='del(\""+val+"\")'><i class='fa fa-fw fa-trash text-red'></i></a>"
|
|
|
+ }}
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ //ttable.on('init.dt', function () {});
|
|
|
+})
|
|
|
+function save(){
|
|
|
+ name=$("#name").val()
|
|
|
+ version=$("#version").val()
|
|
|
+ descript=$("#descript").val()
|
|
|
+ if(name==""||descript==""){
|
|
|
+ alert("表单填写不完整!")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/rulepre/save",
|
|
|
+ type:"post",
|
|
|
+ data:{"name":name,"version":version,
|
|
|
+ "descript":descript,"username":{{index (session "user") "name" }}},
|
|
|
+ success:function(r){
|
|
|
+ if(r.rep){
|
|
|
+ $("#dataform")[0].reset();
|
|
|
+ $("#modal-info").modal("hide");
|
|
|
+ ttable.ajax.reload();
|
|
|
+ }else{
|
|
|
+ alert("保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+function edit(_id){
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/rulepre/save",
|
|
|
+ type:"post",
|
|
|
+ data:{"_id":_id},
|
|
|
+ success:function(r){
|
|
|
+ if(r.rep){
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+function del(_id){
|
|
|
+ showConfirm("确定删除?", function() {
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/rulepre/del",
|
|
|
+ type:"post",
|
|
|
+ data:{"_id":_id},
|
|
|
+ success:function(r){
|
|
|
+ if(r.rep){
|
|
|
+ ttable.ajax.reload();
|
|
|
+ }else{
|
|
|
+ showTip("删除失败", 1000, function() {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|