| New file |
| | |
| | | var pageCurr; |
| | | |
| | | function getCol() { |
| | | var cols = []; |
| | | cols.push( |
| | | {field: 'orderNo', align: 'center', title: '订单编号'} |
| | | , {field: 'col1', align: 'center', title: '订单名称'} |
| | | , {field: 'col2', align: 'center', title: '订单详情'} |
| | | , {field: 'col3', align: 'center', title: '订单客户'} |
| | | , {field: 'col4', align: 'center', title: '订单状态'} |
| | | , {fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 80} |
| | | ); |
| | | return cols; |
| | | } |
| | | |
| | | layui.use(['table', 'laydate', 'form', 'upload'], function () { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | var upload = layui.upload; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#salesOrder', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | // url: baseUrl+'/matCode/list/auth', |
| | | data: [ |
| | | { |
| | | "orderNo": 20210315000001, |
| | | "col1": "西班牙xx 210315号", |
| | | "col2": "兰博基尼童车 5000台", |
| | | "col3": "西班牙xx儿童玩具公司", |
| | | "col4": "生产中", |
| | | } |
| | | ], |
| | | page: true, |
| | | limit: 16, |
| | | limits: [16, 50, 100, 200, 500], |
| | | even: true, |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | cols: [getCol()], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | } |
| | | }); |
| | | |
| | | // 搜索栏重置事件 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 搜索栏搜索事件 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | |
| | | |
| | | // 时间选择器 |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | , type: 'datetime' |
| | | , range: true |
| | | }); |
| | | }); |
| | | |
| | | /* 表格数据重载 */ |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function () { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | |
| | | console.log('搜索内容', searchData); |
| | | |
| | | // (child ? parent.tableIns : tableIns).reload({ |
| | | // where: searchData, |
| | | // page: { |
| | | // curr: pageCurr |
| | | // }, |
| | | // done: function (res, curr, count) { |
| | | // if (res.code === 403) { |
| | | // top.location.href = baseUrl + "/"; |
| | | // } |
| | | // pageCurr = curr; |
| | | // if (res.data.length === 0 && count !== 0) { |
| | | // tableIns.reload({ |
| | | // where: searchData, |
| | | // page: { |
| | | // curr: pageCurr - 1 |
| | | // } |
| | | // }); |
| | | // pageCurr -= 1; |
| | | // } |
| | | // limit(child); |
| | | // // 当前分页数据存储 |
| | | // locNormalList = res.data; |
| | | // } |
| | | // }); |
| | | } |
| | | |
| | | /* 监听回车事件 */ |
| | | $('body').keydown(function () { |
| | | if (event.keyCode === 13) { |
| | | $("#search").click(); |
| | | } |
| | | }); |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/print.css" media="all"> |
| | | </head> |
| | | <style> |
| | | #search-box { |
| | | padding: 30px 30px 10px 30px; |
| | | } |
| | | |
| | | #search-box .layui-inline { |
| | | margin-right: 5px; |
| | | } |
| | | |
| | | #data-search-btn { |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | #data-search-btn.layui-btn-container .layui-btn { |
| | | margin-right: 20px; |
| | | } |
| | | |
| | | .contain td { |
| | | border: 1px solid #000; |
| | | /*line-height: 46px;*/ |
| | | } |
| | | |
| | | </style> |
| | | <body> |
| | | |
| | | <div> |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="orderNo" placeholder="订单号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 日期范围 --> |
| | | <div class="layui-inline" style="width: 300px"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input layui-laydate-range" name="orderTime" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-inline" style="width: 150px"> |
| | | <select id="orderState" name="orderState"> |
| | | <option value="">订单状态</option> |
| | | <option value="1">初始</option> |
| | | <option value="2">执行中</option> |
| | | <option value="3">结束</option> |
| | | </select> |
| | | </div> |
| | | |
| | | |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索 |
| | | </button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="salesOrder" lay-filter="salesOrder"></table> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="btnPrint">质检</button> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/salesOrder/salsesOrder.js"></script> |
| | | |
| | | </body> |
| | | </html> |
| | | |