|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml"; } <script> debugger; //var Type = $.request("Type"); var ColModelMain = []; var ColModelSub = []; $(function () { gridList(); })
function gridList() { var $gridList = $("#gridList"); var queryJson = { MTDOCCode: $("#txt_MTDOCCode").val(), } $gridList.dataGrid({ url: "/WMS/ICSMTDOC/GetGridJson" + "?" + Math.random(), postData: { queryJson: JSON.stringify(queryJson) }, height: $(window).height() - 200, width: $(window).width() - 300, colModel: [ { label: "主键", name: "ID", hidden: true, key: true }, { label: '形态转换单号', name: 'MTDOCCode', width: 120, align: 'left' }, //{ label: '部门代码', name: 'DepCode', width: 150, align: 'left' }, { label: "状态", name: "Status", width: 60, align: "left", formatter: function (cellvalue) { if (cellvalue == "1") { return "开立"; } else if (cellvalue == "2") { return "审核"; } else if (cellvalue == "3") { return "关闭"; } else { return ""; } } }, { label: '创建人', name: 'CreatePerson', width: 150, align: 'left' }, { label: '创建时间', name: 'CreateDateTime', width: 100, align: 'left' }, { label: '操作人', name: 'MUSER', width: 100, align: 'left' }, { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' }, { label: '操作时间', name: 'MTIME', width: 100, align: 'left' }, ], //colModel: ColModelMan, width: "100%", autowidth: true, //shrinkToFit: true, gridComplete: function () { }, pager: "#gridPager", sortname: 'MTDOCCode', sortorder: "desc", viewrecords: true, multiselect: true, beforeSelectRow: function (rowid, e) { $("#gridList").jqGrid('resetSelection'); return (true); }, subGrid: true, // (1)开启子表格支持 subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数 $("#gridList").jqGrid("setSelection", rowid, false); bindSubGrid(subgrid_id, rowid) } });
$("#warehouse a.btn-default").click(function () { $("#warehouse a.btn-default").removeClass("active"); $(this).addClass("active"); $('#btn_search').trigger("click"); }); $("#btn_search").click(function () { var warehouse = $("#warehouse a.active").attr('data-value'); var queryJson = { MTDOCCode: $("#txt_MTDOCCode").val(), } $gridList.jqGrid('setGridParam', { postData: { queryJson: JSON.stringify(queryJson) }, }).trigger('reloadGrid'); });
}
function bindSubGrid(subgrid_id, rowid) { debugger; $("#gridList").jqGrid("setSelection", rowid, false); var subgrid_table_id; subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
var subgrid_pager_id; subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
// (5)动态添加子报表的table和pager $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>"); var MTDOCCode = $("#gridList").jqGrid('getRowData', rowid).MTDOCCode; //var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence; // (6)创建jqGrid对象 $("#" + subgrid_table_id).dataGrid({ cellEdit: true, url: "/WMS/ICSMTDOC/GetSubGridJson?MTDOCCode=" + MTDOCCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数 colModel: [ { label: "主键", name: "ID", hidden: true, key: true }, { label: "行号", name: "Sequence", width: 50, align: 'left' }, { label: '部门代码', name: 'DepCode', width: 100, align: 'left' }, { label: '部门名称', name: 'DepName', width: 100, align: 'left' }, { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' }, { label: '仓库名称', name: 'WarehouseName', width: 100, align: 'left' }, { label: '条码', name: 'LotNo', width: 100, align: 'left' }, { label: '料品编码', name: 'InvCode', width: 100, align: 'left' }, { label: '料品名称', name: 'InvName', width: 100, align: 'left' }, { label: '数量', name: 'Quantity', width: 100, align: 'left' }, { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' }, { label: '已转换数量', name: 'MTDOCQuantity', width: 100, align: 'left' }, { label: '转换类型', name: 'MTDOCQuantity', width: 100, align: 'left' }, ], //colModel: ColModelSub, shrinkToFit: true,//宽度自适应 multiselect: true, prmNames: { search: "search" }, viewrecords: true, height: "100%", rowNum: 20, pager: subgrid_pager_id,
}); }
function btnCreate() { debugger; $.modalOpen({ id: "ICSMTDOCAdd", title: "形态转换", url: "/WMS/ICSMTDOC/ICSMTDOCAdd", width: "1200px", height: "1150px", callBack: function (iframeId) { top.frames[iframeId].submitForm(); } }); }
//审核 function btnAudit() { debugger; var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据 if (ids.length == 0) { $.modalAlertNew("WMS00004"); return; } for (var i = 0; i < ids.length; i++) { var rowData = $("#gridList").jqGrid('getRowData', ids[i]); var MTDOCCode = rowData.MTDOCCode; } $.modalConfirm("确定审核吗?", function (r) { if (r) { $.submitForm({ url: "/WMS/ICSMTDOC/ICSMTDOCAudit?MTDOCCode=" + MTDOCCode + "&" + Math.random(), //param: { keyValue: IDlist }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }); }
function btnToLead() { $.modalOpen({ id: "ToLead", title: "形态转换", url: "/WMS/ICSMTDOC/MetamorphosisToLead?" + Math.random(), width: "400px", height: "225px", btn: null, });
}
</script>
<div class="topPanel" style="height:60px;"> <div class="toolbar"> <div class="btn-group"> <a id="NF-Create" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>形态转换</a> <a id="NF-Audit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnAudit()"><i class="fa fa-pencil-square-o"></i>审核</a> <a id="NF-ToLead" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnToLead()"><i class="fa fa-pencil-square-o"></i>导入</a> <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
</div>
<script>$('.toolbar').authorizeButton()</script> </div> <div class="search"> <table> <tr> <td style="text-align:right;"><label class="lglabel" for="txt_MTDOCCode">单据号</label>:</td> <td> <div class="input-group"> <input id="txt_MTDOCCode" type="text" class="form-control" style="width: 100px;"> </div> </td> <td> <span class="input-group-btn"> <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button> </span> </td> </tr>
</table> </div> </div> <div class="gridPanel"> <table id="gridList"></table> <div id="gridPager"></div> </div>
|