/* * 描 述:库区管理 */ var selectedRow; var refreshGirdData; var typnum = 1; var bootstrap = function ($, learun) { "use strict"; var warehouseId = ''; var page = { init: function () { page.inittree(); page.initGird(); page.bind(); }, bind: function () { // 查询 $('#btn_Search').on('click', function () { var keyword = $('#txt_Keyword').val(); page.search({ keyword: keyword }); }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); // 新增 $('#lr_add').on('click', function () { selectedRow = null; learun.layerForm({ id: 'form', title: '新增', url: top.$.rootUrl + '/BaseManager/BaseWarea/Form?warehouseId=' + warehouseId, width: 700, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NO'); selectedRow = $('#gridtable').jfGridGet('rowdata'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '编辑', url: top.$.rootUrl + '/BaseManager/BaseWarea/Form?keyValue=' + keyValue, width: 700, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NO'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseWarea/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); $('#lr_import').on('click', function () { learun.layerForm({ id: 'ImportForm', title: '导入Excel数据', url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + typnum, width: 600, height: 400, maxmin: true, btn: null }); }); $('#lr_exportnow').on('click', function () { learun.layerForm({ id: "ExcelExportForm", title: '导出Excel数据', url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + $('#gridtable').attr('id') + '&filename=' + encodeURI(encodeURI("区域列表")), width: 500, height: 380, callBack: function (id) { return top[id].acceptClick(); }, btn: ['导出Excel', '关闭'] }); }); }, inittree: function () { $('#warehouseTree').lrtree({ url: top.$.rootUrl + '/BaseManager/BaseWarea/GetTree', param: { parentId: '0' }, nodeClick: page.treeNodeClick }); $('#warehouseTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681'); }, treeNodeClick: function (item) { if (item.parentId == 0) { warehouseId = ""; } else { warehouseId = item.id; } $('#titleinfo').text(item.text); //$('#department_select').lrselectRefresh({ // // 访问数据接口地址 // url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', // // 访问数据接口参数 // param: { companyId: companyId, parentId: '0' }, //}); page.search(); }, initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/BaseManager/BaseWarea/GetPageList', headData: [ learun.jfFormatter.col_F_NO("区域编号"), learun.jfFormatter.col_F_NAME("区域名称"), { label: '区域类型', name: 'F_FTYPE', width: 100, align: "left" , formatterAsync: function (callback, value, row) { learun.clientdata.getAsync('dataItem', { Rowkey: value, GrpCode: 'EWAreaType', getType: 'Num', callback: function (item) { callback(item.F_NAME); } }); } }, { label: '所属仓库', name: 'F_WAREHOUSENO', width: 150, align: "left" , formatterAsync: function (callback, value, row) { learun.clientdata.getAsync('warehouse', { key: value, callback: function (item) { callback(item.F_NAME); } }); } }, learun.jfFormatter.col_F_ISSTOP(), learun.jfFormatter.col_F_ADDUSERNO(), learun.jfFormatter.col_F_ADDTIME(), learun.jfFormatter.col_F_EDITUSERNO(), learun.jfFormatter.col_F_EDITTIME(), learun.jfFormatter.col_F_MEMO() ], mainId: 'F_NO', sidx: 'F_NO', reloadSelected: true, isPage: true }); page.search(); }, search: function (param) { param = param || {}; param.warehouseId = warehouseId; $('#gridtable').jfGridSet('reload', param); } }; refreshGirdData = function () { page.search(); }; page.init(); }