| | |
| | | padding: 6px 10px; |
| | | } |
| | | #code { |
| | | width: 70%; |
| | | width: 75%; |
| | | height: 30px; |
| | | margin-right: 0; |
| | | } |
| | | header button { |
| | | height: 20px; |
| | |
| | | } |
| | | |
| | | /* 主体 */ |
| | | main { |
| | | height: 170px; |
| | | overflow: auto; |
| | | } |
| | | .layui-table, .layui-table-view { |
| | | margin: 0; |
| | | } |
| | |
| | | padding: 0; |
| | | } |
| | | .layui-table-cell { |
| | | height: 22px; |
| | | line-height: 22px; |
| | | padding: 0; |
| | | } |
| | | |
| | | .layui-table-grid-down { |
| | | display: none; |
| | | } |
| | | /* 尾部 */ |
| | | footer { |
| | | position: absolute; |
| | |
| | | <!-- 尾部 --> |
| | | <footer> |
| | | <div class="layui-btn-container"> |
| | | <button type="button" class="layui-btn layui-btn-xs">重置</button> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn-xs">组托</button> |
| | | <button type="button" class="layui-btn layui-btn-xs" onclick="reset()">重置</button> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn-xs" onclick="comb">组托</button> |
| | | </div> |
| | | </footer> |
| | | </body> |
| | | <script> |
| | | var tableIns; |
| | | layui.use(['table','laydate', 'form'], function() { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var layDate = layui.laydate; |
| | | var form = layui.form; |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#chooseData', |
| | | data: [], |
| | | even: true, |
| | | limit: 500, |
| | | cellMinWidth: 50, |
| | | cols: [[ |
| | | {fixed: 'left', field: 'count', title: '数量', align: 'center', edit:'text', style:'color: blue;font-weight: bold', width:50}, |
| | | {fixed: 'left', align: 'center', field: 'count', title: '量', style:'color: blue', width:20}, |
| | | {field: 'matNo', align: 'center', title: '物料编码'}, |
| | | {field: 'matName', align: 'center', title: '物料名称'} |
| | | ]], |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 添加表格数据 |
| | | var matData = []; |
| | | function addTableData(data) { |
| | | let toPush = true; |
| | | for (var j=0;j<matData.length;j++){ |
| | | if (data.matNo === matData[j].matNo) { |
| | | matData[j].count = Number(matData[j].count) + Number(data.count); |
| | | toPush = false; |
| | | } |
| | | } |
| | | if (toPush) { |
| | | matData.push(data); |
| | | } |
| | | tableIns.reload({data: matData}); |
| | | } |
| | | |
| | | // 重置 |
| | | function reset() { |
| | | $('#code').val(""); |
| | | matData = []; |
| | | tableIns.reload({data: matData}); |
| | | } |
| | | |
| | | // 组托 |
| | | function comb() { |
| | | |
| | | } |
| | | </script> |
| | | </html> |