var refreshGirdData;
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 },];
var page = {
init: function () {
page.bind();
page.initGird();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
// 调用后台查询
// queryJson 查询条件
console.log(queryJson);
queryJson["Code"] = $("#Code").val();
queryJson["Name"] = $("#Name").val();
queryJson["ShortCode"] = $("#ShortCode").val();
queryJson["ProMaterCode"] = $("#ProMaterCode").val();
queryJson["BomCode"] = $("#BomCode").val();
if ($("#IsStop").is(":checked")) {
queryJson["IsStop"] = '1';
} else {
queryJson["IsStop"] = '';
}
queryJson["StampType"] = stampType;
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(), StampType: stampType }) });
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 新增
$('#lr_add').on('click', function () {
learun.layerForm({
id: 'form',
title: '新增' + urls[parseInt(stampType) - 1].name,
url: top.$.rootUrl + urls[parseInt(stampType) - 1].url,
width: urls[parseInt(stampType) - 1].width,
height: urls[parseInt(stampType) - 1].height,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').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,
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 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;
}
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();
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/FJManager/BillBomSet/GetPaiKuList',
headData: [
{ label: '垛型编码', name: 'BomsetgrpId', width: 160, align: 'left' },
{ label: '垛型名称', name: 'BomsetgrpName', width: 160, align: 'left' },
{ label: '所属仓库id', name: 'WarehousId', width: 160, align: 'left' },
{ label: '所属仓库编码', name: 'WarehouseCode', width: 50, align: 'left' },
{ label: '垛型对应仓库占比', name: 'Percent', width: 100, align: 'left' },
//{ label: '投料物料编码', name: 'ProCode', width: 180, align: 'left' },
//{ label: '实际物料编码', name: 'BomCode', width: 180, align: 'left' },
//{
// label: '投料物料名称', name: 'BomCode', width: 180, align: 'left', formatterAsync: function (callback, value, row) {
// learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomInfo/GetList', { queryJson: JSON.stringify({ Code: value }) }, function (res) {
// if (res.code > 0 && res.data.length > 0) {
// callback(res.data[0].Name);
// }
// });
// },
//},
learun.jfFormatter.col_AddWho(),
learun.jfFormatter.col_AddTime(),
learun.jfFormatter.col_EditWho(),
learun.jfFormatter.col_EditTime(),
learun.jfFormatter.col_MEMO()
],
mainId: 'Code',
isPage: true,
isMultiselect: true,
reloadSelected: true,
sidx: 'Code',
isSubGrid: true, // 是否有子表
//subGridExpanded: function (subid, rowdata) {
// psuid = subid;
// $('#' + subid).jfGrid({
// url: top.$.rootUrl + '/FJManager/BillBomSet/GetPaiKuList',
// headData: [
// { label: '编号', name: 'XYNo', width: 40, align: 'left' },
// { label: '行', name: 'Row', width: 40, align: 'left' },
// { label: '物料编码', name: 'MatCode', width: 200, align: 'left' },
// { label: '物料Id', name: 'MatId', width: 150, align: 'left' },
// {
// label: '有/无', name: 'IsEmpty', width: 60, align: 'left', formatter: function (cellvalue) {
// if (cellvalue == '0') {
// return '有';
// } else if (cellvalue == '1') {
// return '无';
// } else {
// return '未知';
// }
// }
// },
// {
// label: '正/反面', name: 'SideNum', width: 70, align: 'left', formatter: function (cellvalue) {
// if (cellvalue == '1') {
// return '正面朝上';
// } else if (cellvalue == '2') {
// return '反面朝上';
// } else {
// return '未知';
// }
// }
// },
// { label: '工字轮型号', name: 'SpoolType', width: 80, align: 'left' },
// {
// label: '单/双丝', name: 'SilkType', width: 80, align: 'left', formatter: function (cellvalue) {
// if (cellvalue == '1') {
// return '单丝';
// } else if (cellvalue == '2') {
// return '双丝';
// } else if (cellvalue == '3') {
// return '三丝';
// }
// else {
// return '未知';
// }
// }
// },
// { label: '钢丝直径上限', name: 'SilkDiam', width: 100, align: 'left' },
// /* { label: '钢丝直径上限', name: 'SilkDiamMaxCount', width: 100, align: 'left' },*/
// { label: '数量上限', name: 'QtyMaxCount', width: 100, align: 'left' },
// {
// label: '是否芯股', name: 'IsCore', width: 100, align: 'left', formatter: function (cellvalue) {
// if (cellvalue == '1') {
// return '是';
// } else if (cellvalue == '2') {
// return '否';
// }
// else {
// return '未知';
// }
// }
// },
// {
// label: '是混合行', name: 'IsMixRow', width: 100, align: 'left', formatter: function (cellvalue) {
// if (cellvalue == '1') {
// return '是';
// } else if (cellvalue == '0') {
// return '否';
// }
// else {
// return '未知';
// }
// }
// },
// { label: '混合料行编码', name: 'MixRowCode', width: 100, align: 'left' },
// learun.jfFormatter.col_ISSTOP(),
// ]
// });
// $('#' + subid).jfGridSet('reloadSon', { bomSetHdrId: rowdata.Id });
//},
});
page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), StampType: stampType }) });
},
search: function (param) {
$('#gridtable').jfGridSet('reload', param);
}
};
refreshGirdData = function () {
$('#gridtable').jfGridSet('reload');
};
page.init();
}