let action = null, app = null; layui.config({ base: "/js/", version: 2 }).use(['system'], function () { var form = layui.form, $ = layui.jquery, table = layui.table, layer = layui.layer, system = layui.system, u = new system.u(), sendData = { queryConfig: null }, urlBase = $('#ReUrl').val(), areaName = 'warehous', tableName = 'Inventory'; action = { exportOptions: function () { var options = { fromId: "listForm", url: urlBase + "api/WMS/GetInventoriesWithPage", isDefault: false, ajaxOpt: { contentType: "application/json", jsonStr: true }, sendDataWhere: (function () { app.methods.queryParameter(); sendData.pageNumber = 1; sendData.perPageCount = 100000000 return sendData; })(), excelCols: { head: app.data.cols } } return options; }, btnExportBefore: function (sysU, parm, formData, tableObj, fnCallBack) { fetch(parm.url, { method: 'POST', headers: { 'content-type': 'application/json', }, body: JSON.stringify(formData) }).then(r => r.json()).then(result => { if (sysU.successBefore(result)) return false; var excelParm = typeof parm.isDefault == "undefined" ? tableObj : parm; sysU.ExcelExportData(excelParm, { Result: result.Result.Data }); }) }, queryOptions: function () { var options = { resetFrom: "form[lay-filter=listForm]", fromId: "listForm", urlExport: urlBase +"api/WMS/GetInventoriesWithPage", urlQuery: urlBase + "api/WMS/GetInventoriesWithPage", ajaxOpt: { contentType: "application/json", }, sendDataWhere: (function () { app.methods.queryParameter(); return sendData; })(), mainTable: app.data.tableIns } return options; }, queryBefore: (sysU, toolbarId, fromValueObj, callBack) => { if (callBack != null) callBack(); }, //所有动作成功之后 actionSuccess: (flag) => { u.refreshTable(app, u, null, flag); } } app = { data: { cols: [[ { checkbox: true, fixed: true }, { field: "Id", width: 150, sort: true, fixed: false, title: "id", hide: true }, { field: "BillNo", width: 150, fixed: false, title: "billNo", hide: true }, { field: "WarehouseCode", width: 150, sort: false, fixed: false, title: "仓库编码" }, { field: "LocationCode", width: 150, sort: false, fixed: false, title: "库位编码" }, { field: "ContainerCode", width: 150, sort: false, fixed: false, title: "容器号" }, { field: "MaterialCode", width: 150, sort: true, fixed: false, title: "物料编码" }, { field: "MaterialName", width: 150, sort: false, fixed: false, title: "物料名称" }, { field: "MaterialSpec", width: 150, sort: false, fixed: false, title: "物料规格" }, { field: "Batch", width: 150, sort: false, fixed: false, title: "批次" }, { field: "MaterialPipeSize", width: 150, sort: false, fixed: false, title: "管径" }, { field: "MaterialWallthickness", width: 150, sort: false, fixed: false, title: "壁厚" }, { field: "MaterialTextures", width: 150, sort: false, fixed: false, title: "材质" }, { field: "MaterialUnit", width: 150, sort: false, fixed: false, title: "物料单位" }, { field: "Qty", width: 150, sort: true, fixed: false, title: "数量" }, { field: "TrackingCode", width: 150, sort: false, fixed: false, title: "跟踪码" }, { field: "Len", width: 150, sort: true, fixed: false, title: "长度" }, { field: "InTime", width: 150, sort: true, fixed: false, title: "入库时间" }, { field: "Status", width: 150, sort: true, fixed: false, title: "状态", hide: true }, ]], tableIns: null, tableElem: "mainList", //下拉框配置 selectOption: { //返回的数据 用于后续操作 selectData: { } } }, methods: { initTable: function (opts) { var config = {}; if (opts != undefined) $.extend(config, opts); let options = { elem: "#" + app.data.tableElem, contentType: "application/json", url: urlBase + "api/WMS/GetInventoriesWithPage", cols: u.columnRecord(app.data.tableElem, app.data.cols), toolbar: '#toolbarTable', where: config, request: { pageName: "pageNumber", limitName: "perPageCount", },//用于对分页请求的参数:page、limit重新设定名称 parseDataExtend: function (res) { if (res.Code == 200 || res.code == 200) { return { Code: res.Code, Message: res.Message, Count: res.Result.TotalCount, Result: res.Result.Data } } return { Code: -1, Message: res.msg, Count: 0, Result: [] } }, doneExtend: function () { } } if ("".GetUrlParam("menuFlag") === -2) options["height"] = 'full-55'; app.data.tableIns = u.initTable(options); }, queryParameter() { sendData.queryConfig= form.val("listForm"); }, initFrom() { } }, registerEvent: function () { }, init: function () { app.methods.queryParameter(); app.methods.initFrom(); app.methods.initTable(sendData); app.registerEvent(); } }; app.init(); });