var refreshGirdData; var OneInTimebegin = ''; var OneInTimeend = ''; var ProductTimebegin = ''; var ProductTimeend = ''; var logbegin = ''; var logend = ''; var selectedRow; var refreshGirdData; // 更新数据 var bootstrap = function ($, learun) { "use strict"; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { // 调用后台查询 // queryJson 查询条件 var oneintime = $('#lr_search_date_OneInTime').html(); if (oneintime == '') { OneInTimebegin = ''; OneInTimeend = ''; } var producttime = $('#lr_search_date_ProductTime').html(); if (producttime == '') { ProductTimebegin = ''; ProductTimeend = ''; } console.log(queryJson); queryJson["Code"] = $("#Code").val(); queryJson["Name"] = $("#Name").val(); page.search({ queryJson: JSON.stringify(queryJson) }); }, 250); // 查询 $('#btn_Search').on('click', function () { var keyword = $('#txt_Keyword').val(); page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) }); }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { var keyValue = {}; selectedRow = {}; learun.layerForm({ id: 'form', title: '添加库区', url: top.$.rootUrl + '/FJManager/BaseWareArea/Form', height: 400, width: 800, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Code'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '编辑库区信息', url: top.$.rootUrl + '/FJManager/BaseWareArea/Form?keyValue=' + keyValue, height: 400, width: 800, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Code'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/FJManager/BaseWareArea/Delete', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/FJManager/BaseWareArea/GetPageList', headData: [ { label: "库区编码", name: "Code", width: 110, align: "left" }, { label: "库区名称", name: "Name", width: 80, align: "left" }, { label: "仓库", name: "WarehouseName", width: 120, align: "left" }, { label: "仓库ID", name: "WarehouseId", width: 80, align: "left" }, { label: "库区状态", name: "IsStop", width: 80, align: "left", formatter: function (cellvalue) { if (cellvalue == 0) { return '正常'; } else { return '停用'; } } }, { label: "创建用户", name: "AddWho", width: 80, align: "left" }, { label: "修改用户", name: "EditWho", width: 80, align: "left" }, { label: "创建时间", name: "AddTime", width: 130, align: "left" }, { label: "修改时间", name: "EditTime", width: 130, align: "left" }, ], mainId: 'Id', isPage: true, reloadSelected: true, autowWidth: true, sidx: 'AddTime', sord: 'DESC', }); page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) }); }, search: function (param) { $('#gridtable').jfGridSet('reload', param); } }; refreshGirdData = function () { $('#gridtable').jfGridSet('reload'); }; page.init(); }