diff --git a/erp/src/main/resources/template/js/erpstatistics/incomingstatistics.js b/erp/src/main/resources/template/js/erpstatistics/incomingstatistics.js index 55bb0b66a1a3cf1cea856969af48634dee85d0e4..1b7ece35ea265f93bd3259e0044af745e23b8ec9 100644 --- a/erp/src/main/resources/template/js/erpstatistics/incomingstatistics.js +++ b/erp/src/main/resources/template/js/erpstatistics/incomingstatistics.js @@ -1,25 +1,16 @@ -var rowId = ""; - -//单据的时间 -var operTime = ""; - layui.config({ base: basePath, version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'table', 'jquery', 'winui', 'form', 'laydate'], function (exports) { +}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) { winui.renderColor(); var $ = layui.$, form = layui.form, - laydate = layui.laydate, table = layui.table; - //初始化统计时间 - operTime = getOneYMFormatDate(); - - //获取本月日期 + // 获取本月日期 function getOneYMFormatDate(){ var date = new Date; var year = date.getFullYear(); @@ -28,71 +19,47 @@ layui.config({ return year.toString() + "-" + month.toString(); } - laydate.render({elem: '#operTime', type: 'month', value: operTime}); - - initTable(); - function initTable(){ - table.render({ - id: 'messageTable', - elem: '#messageTable', - method: 'post', - url: flowableBasePath + 'statistics003', - where: {materialName: $("#materialName").val(), operTime: operTime}, - even: true, - page: true, - limits: [8, 16, 24, 32, 40, 48, 56], - limit: 8, - cols: [[ - { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, - { field: 'materialName', title: '产品名称', align: 'left', width: 250}, - { field: 'materialModel', title: '型号', align: 'left', width: 100}, - { field: 'unitName', title: '单位', align: 'left', width: 80}, - { field: 'currentTock', title: '进货数量', align: 'left', width: 100}, - { field: 'currentTockMoney', title: '进货金额', align: 'left', width: 120}, - { field: 'returnCurrentTock', title: '退货数量', align: 'left', width: 100}, - { field: 'returnCurrentTockMoney', title: '退货金额', align: 'left', width: 120 } - ]], - done: function(json) { - matchingLanguage(); - } - }); - form.render(); - } - - form.on('submit(formSearch)', function (data) { - if (winui.verifyForm(data.elem)) { - loadTable(); - } - return false; - }); + table.render({ + id: 'messageTable', + elem: '#messageTable', + method: 'post', + url: flowableBasePath + 'statistics003', + where: getTableParams(), + even: true, + page: true, + limits: getLimits(), + limit: getLimit(), + cols: [[ + { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' }, + { field: 'materialName', title: '产品名称', align: 'left', width: 250}, + { field: 'materialModel', title: '型号', align: 'left', width: 150}, + { field: 'unitName', title: '单位', align: 'left', width: 80}, + { field: 'currentTock', title: '进货数量', align: 'left', width: 100}, + { field: 'currentTockMoney', title: '进货金额', align: 'left', width: 120}, + { field: 'returnCurrentTock', title: '退货数量', align: 'left', width: 100}, + { field: 'returnCurrentTockMoney', title: '退货金额', align: 'left', width: 120 } + ]], + done: function(json) { + matchingLanguage(); + initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请选择日期", function () { + table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()}); + }); + } + }); + form.render(); $("body").on("click", "#reloadTable", function() { loadTable(); }); - $("body").on("click", "#formSearch", function () { - refreshTable(); - }) - - //刷新 + // 刷新 function loadTable() { - if(isNull($("#operTime").val())) {//一定要记得,当createTime为空时 - winui.window.msg("请选择日期.", {icon: 2, time: 2000}); - }else { - operTime = $("#operTime").val(); - table.reloadData("messageTable", {where:{materialName: $("#materialName").val(), operTime: operTime}}); - } + table.reloadData("messageTable", {where: getTableParams()}); } - //搜索 - function refreshTable(){ - if(isNull($("#operTime").val())) {//一定要记得,当createTime为空时 - winui.window.msg("请选择日期.", {icon: 2, time: 2000}); - }else { - operTime = $("#operTime").val(); - table.reloadData("messageTable", {page: {curr: 1}, where:{materialName: $("#materialName").val(), operTime: operTime}}) - } - } + function getTableParams() { + return $.extend(true, {}, initTableSearchUtil.getSearchValue("messageTable")); + } exports('incomingstatistics', {}); }); diff --git a/erp/src/main/resources/template/tpl/erpstatistics/incomingstatistics.html b/erp/src/main/resources/template/tpl/erpstatistics/incomingstatistics.html index 220d0d55148a51ba29fd90489e35cf1600806833..a073311fabb9b25ce763c6a167234bb71db725be 100644 --- a/erp/src/main/resources/template/tpl/erpstatistics/incomingstatistics.html +++ b/erp/src/main/resources/template/tpl/erpstatistics/incomingstatistics.html @@ -7,30 +7,10 @@
-