123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- var refreshGirdData;
- var selectedRow;
- var bootstrap = function ($, learun) {
- "use strict";
- var selectRowsData;
- var psuid = "";
- var urls = [{ "url": "/FJManager/BillBomSet/DFM1509", "name": "DFM1509", "width": 744, "height": 690 },
- { "url": "/FJManager/BillBomSet/DOF2", "name": "DOF2", "width": 920, "height": 676 },
- { "url": "/FJManager/BillBomSet/DOF4", "name": "DOF4", "width": 920, "height": 676 },
- { "url": "/FJManager/BillBomSet/DFM6", "name": "DFM6", "width": 920, "height": 676 },
- { "url": "/FJManager/BillBomSet/DFM09", "name": "DFM9", "width": 940, "height": 676 },
- { "url": "/FJManager/BillBomSet/Exception", "name": "Exception", "width": 920, "height": 676 },
- { "url": "/FJManager/BillBomSet/DFMAll", "name": "DFMAll", "width": 920, "height": 676 },
- { "url": "/FJManager/BillBomSet/Form", "name": "PaiKu", "width": 920, "height": 676 }];
- var page = {
- init: function () {
- page.bind();
- page.initGird();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- // 调用后台查询
- // queryJson 查询条件
- console.log(queryJson);
- queryJson["Percent"] = $("#Percent").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 () {
- learun.layerForm({
- id: 'form',
- title: '新增' + urls[7].name,
- url: top.$.rootUrl + urls[7].url,
- width: urls[7].width,
- height: urls[7].height,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- selectedRow = $('#gridtable').jfGridGet("rowdata");
- if (selectedRow.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (selectedRow.length > 1) {
- learun.alert.error('选择了多行!');
- return false;
- }
- var keyValue = selectedRow[0].Id;
- selectedRow = selectedRow[0];
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑' + urls[7].name,
- url: top.$.rootUrl + urls[7].url + '?keyValue=' + keyValue,
- width: urls[7].width,
- height: urls[7].height,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- $("#lr_search").on('click', function () {
- let editSelRows = $('#gridtable').jfGridGet("rowdata");
- if (editSelRows.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (editSelRows.length > 1) {
- learun.alert.error('选择了多行!');
- return false;
- }
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '查看' + urls[parseInt(stampType) - 1].name,
- btn: ['关闭'],
- url: top.$.rootUrl + urls[parseInt(stampType) - 1].url + '?keyValue=' + keyValue,
- width: urls[parseInt(stampType) - 1].width,
- height: urls[parseInt(stampType) - 1].height,
- callBack: function (id) {
- return true;
- //return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- selectRowsData = $('#gridtable').jfGridGet("rowdata");
- if (selectRowsData.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (selectRowsData.length > 1) {
- learun.alert.error('只能选择一行!');
- return false;
- }
- var keyValue = selectRowsData.map((item) => item.Id);
- //var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/FJManager/BillBomSet/DeletePK', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- // 启用
- $('#lr_enable').on('click', function () {
- var postData = $('#gridtable').jfGridGet("rowdata");
- if (postData.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (postData.length > 1) {
- learun.alert.error('启用只能选择一条数据!');
- return false;
- }
- learun.layerConfirm('是否确认启用该跺型!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Enables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
- refreshGirdData();
- });
- }
- });
- });
- // 禁用
- $('#lr_disable').on('click', function () {
- var postData = $('#gridtable').jfGridGet("rowdata");
- if (postData.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- learun.layerConfirm('是否确认禁用该跺型!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Disables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
- refreshGirdData();
- });
- }
- });
- });
- // 打印
- $('#lr_print').on('click', function () {
- $('#gridtable').jqprintTable();
- });
- $('#WarehouseId').lrselect({
- url: top.$.rootUrl + "/FJManager/BaseWarehouse/PaiKuGetSelectWarehouseCodeNameList",
- allowSearch: true,
- width: 180,
- });
- $('#BomsetgrpId').lrselect({
- url: top.$.rootUrl + "/FJManager/BillBomSet/PaiKuGetList",
- allowSearch: true,
- width: 180,
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/FJManager/BillBomSet/GetPaiKuList',
- headData: [
- { label: 'ID', name: 'Id', width: 160, align: 'left' },
- { label: '垛型名称', name: 'BomsetgrpName', width: 160, align: 'left' },
- { label: '仓库编码', name: 'WarehouseCode', width: 160, align: 'left' },
- { label: '排库占比', name: 'Percent', width: 100, align: 'left' },
- { label: '垛型编码', name: 'BomsetgrpId', width: 160, align: 'left' },
- { label: '仓库ID', name: 'WarehousId', width: 160, align: 'left' },
- learun.jfFormatter.col_AddWho(),
- learun.jfFormatter.col_AddTime(),
- learun.jfFormatter.col_EditWho(),
- learun.jfFormatter.col_EditTime(),
- learun.jfFormatter.col_MEMO()
- ],
- mainId: 'Id',
- isPage: true,
- isMultiselect: true,
- reloadSelected: true,
- sidx: 'BomsetgrpName',
- isSubGrid: false, // 是否有子表
- });
- page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
- },
- search: function (param) {
- $('#gridtable').jfGridSet('reload', param);
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|