|
|
@@ -34,9 +34,11 @@
|
|
|
<div id="toolbar" class="pb-4">
|
|
|
<form id="formSearch" class="form-inline">
|
|
|
<div class="form-group pr-2">
|
|
|
- <div>状态:</div>
|
|
|
- <select id="状态" name="状态" class="custom-select" style="width:120px;">
|
|
|
+ <div>线号:</div>
|
|
|
+ <select id="线号" name="线号" class="custom-select" style="width:120px;">
|
|
|
<option value="">请选择...</option>
|
|
|
+ <option value="1">1</option>
|
|
|
+ <option value="2">2</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
|
|
|
@@ -48,15 +50,16 @@
|
|
|
</form>
|
|
|
</div>
|
|
|
<!--报表数据-->
|
|
|
- <table id="table" class="table table-bordered table-hover" data-toolbar="#toolbar" style="font-size:14px;">
|
|
|
+ <table id="table" class="table table-bordered table-hover" data-toolbar="#toolbar" style="font-size: 14px;">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
<th scope="col" data-field="线号" data-sortable="true">线号</th>
|
|
|
- <th scope="col" data-field="产品型号" data-sortable="true">产品型号</th>
|
|
|
<th scope="col" data-field="出水距" data-sortable="true">水距</th>
|
|
|
+ <th scope="col" data-field="产品型号" data-sortable="true">产品型号</th>
|
|
|
<th scope="col" data-field="商标" data-sortable="true">商标</th>
|
|
|
+ <th scope="col" data-field="商标物料描述" data-sortable="true">物料描述</th>
|
|
|
<th scope="col" data-field="商标变更" data-sortable="true">商标变更</th>
|
|
|
- <th scope="col" data-field="物料编码" data-sortable="true">物料编码</th>
|
|
|
+ <th scope="col" data-field="商标变更物料描述" data-sortable="true">物料描述</th>
|
|
|
<th scope="col" data-field="出库数量" data-sortable="true">数量</th>
|
|
|
<th scope="col" data-field="已出数量" data-sortable="true">已出</th>
|
|
|
<th scope="col" data-field="状态" data-sortable="true">状态</th>
|
|
|
@@ -81,18 +84,89 @@
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
loadData();
|
|
|
+ setInterval(function () { loadData(); }, 30000);
|
|
|
});
|
|
|
|
|
|
- function loadData() {
|
|
|
- xuwell.loadTable({
|
|
|
- id: '#table',
|
|
|
- url: 'index.ashx?r=' + Math.random()
|
|
|
- });
|
|
|
- }
|
|
|
+ function loadData() {
|
|
|
+ const select = document.getElementById('线号');
|
|
|
+ //await xuwell.loadTable({
|
|
|
+ // id: '#table',
|
|
|
+ // url: 'index.ashx?linenumber=' + select.value + '&r=' + Math.random()
|
|
|
+ //});
|
|
|
+ //将原有方法提取出来 新加uptable方法
|
|
|
+ var $table = $('#table');
|
|
|
+ $table.bootstrapTable('destroy').bootstrapTable({
|
|
|
+ toggle: "table",
|
|
|
+ boolbar: '#toolbar',
|
|
|
+ url: 'index.ashx?linenumber=' + select.value + '&r=' + Math.random(),
|
|
|
+ locale: "zh-CN",
|
|
|
+ sortable: false,
|
|
|
+ sortOrder: "asc",
|
|
|
+ pagination: true,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageList: "[10, 100, 500, 1000, 2000, 5000, ALL]",
|
|
|
+ striped: true,
|
|
|
+ sidePagination: 'server',
|
|
|
+ responseHandler: function (res) {
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ onLoadSuccess: function (data) {
|
|
|
+ if (data['success'] == false) {
|
|
|
+ swal({
|
|
|
+ title: '登录异常!',
|
|
|
+ text: '请您先登录系统!',
|
|
|
+ icon: 'error',
|
|
|
+ button: '确定'
|
|
|
+ }).then(function () {
|
|
|
+ window.location = '../common/login.html';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ uptable(data.rows);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
function resetForm() {
|
|
|
$('#formSearch')[0].reset();
|
|
|
+ };
|
|
|
+ /**合并单元格*/
|
|
|
+ const uptable = (data) => {
|
|
|
+ /**出水距*/
|
|
|
+ let dataValue = null;
|
|
|
+ /**起始单元格 */
|
|
|
+ let startIndex = 0;
|
|
|
+ /**合并行数 */
|
|
|
+ let rowspan = 1;
|
|
|
+ data.forEach((value, index) => {
|
|
|
+ // 初始化
|
|
|
+ if (dataValue === null) {
|
|
|
+ dataValue = value.出水距;
|
|
|
+ startIndex = index;
|
|
|
+ }
|
|
|
+ //检测到变化点
|
|
|
+ else if (value.出水距 !== dataValue) {
|
|
|
+ //合并前一个组并且只合并数量大于1的组
|
|
|
+ if (rowspan > 1) {
|
|
|
+ $('#table').bootstrapTable('mergeCells', { index: startIndex, field: '出水距', rowspan: rowspan })
|
|
|
+ }
|
|
|
+ // 更新状态
|
|
|
+ dataValue = value.出水距;
|
|
|
+ startIndex = index;
|
|
|
+ rowspan = 1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 同一组,增加计数
|
|
|
+ rowspan++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 处理最后一个组(如果数组以同一组结束且数量大于1)
|
|
|
+ if (dataValue !== null && rowspan > 1) {
|
|
|
+ $('#table').bootstrapTable('mergeCells', { index: startIndex, field: '出水距', rowspan: rowspan })
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
</body>
|