|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index.cshtml"; } <script> $(function () { gridList(); }) function gridList() { var $gridList = $("#gridList"); $gridList.dataGrid({ url: "/ProductManage/OrderManage/GetGridJson", height: $(window).height() - 96, colModel: [
{ label: "主键", name: "F_Id", hidden: true, key: true }, { label: "CustomerId", name: "CustomerId", hidden: true }, { label: 'Order No', name: 'PreSellNo', width: 120, align: 'left' }, { label: 'Customer Name', name: 'CustomerName', width: 100, align: 'left' //formatter: function (cellvalue, options, rowObject) { // return top.clients.user[cellvalue] == null ? "" : top.clients.user[cellvalue].realname; //} }, { label: "Confirmation State", name: "IsConfirm", width: 110, align: "left", formatter: function (cellvalue) { return cellvalue == 1 ? "Confirmed" : "Unconfirmed"; } }, { label: 'Creator User', name: 'F_CreatorUserId', width: 100, align: 'left', formatter: function (cellvalue, options, rowObject) { return top.clients.user[cellvalue] == null ? "" : top.clients.user[cellvalue].realname; } }, { label: 'Creator Time', name: 'F_CreatorTime', width: 100, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i', newformat: 'Y-m-d H:i' } }, { label: 'Modify User', name: 'F_LastModifyUserId', width: 100, align: 'left', formatter: function (cellvalue, options, rowObject) { return top.clients.user[cellvalue] == null ? "" : top.clients.user[cellvalue].realname; } }, { label: 'Modify Time', name: 'F_LastModifyTime', width: 100, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i', newformat: 'Y-m-d H:i' } }, { label: 'SalesMan', name: 'F_CreatorUserId', width: 100, align: 'left', formatter: function (cellvalue, options, rowObject) { return top.clients.user[cellvalue] == null ? "" : top.clients.user[cellvalue].realname; } } ], pager: "#gridPager", sortname: 'F_CreatorTime desc,PreSellNo asc', multiselect: true, viewrecords: true }); $("#btn_search").click(function () { $gridList.jqGrid('setGridParam', { postData: { keyword: $("#txt_keyword").val(), keyword2: $("#txt_keyword2").val() }, }).trigger('reloadGrid'); }); }
function btn_edit() { var keyValue = $("#gridList").jqGridRowValue().F_Id; var ids = $('#gridList').jqGrid('getGridParam', 'selarrrow'); var keyValues = ""; for (var i = 0; i < ids.length; i++) { if (i == 0) keyValues += ids[i]; else keyValues += "," + ids[i]; } $.modalConfirm("Note: are you sure you want to confirm the order?", function (r) { if (r) { $.submitForm({ url: "/ProductManage/OrderManage/ConfirmOrders", param: { keyValue: keyValues }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }); }
function btn_cancel() { var keyValue = $("#gridList").jqGridRowValue().F_Id; var ids = $('#gridList').jqGrid('getGridParam', 'selarrrow'); var keyValues = ""; for (var i = 0; i < ids.length; i++) { if (i == 0) keyValues += ids[i]; else keyValues += "," + ids[i]; } $.modalConfirm("Note: are you sure you want to cancel confirm the order?", function (r) { if (r) { $.submitForm({ url: "/ProductManage/OrderManage/CancelConfirmOrders", param: { keyValue: keyValues }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) } }); }
function btn_details() { var keyValue = $("#gridList").jqGrid('getGridParam', 'selrow'); $.modalOpen({ id: "Details", title: "Look", url: "/ProductManage/OrderManage/Details?keyValue=" + keyValue, width: "880px", height: "450px", btn: null, }); }
function download(options) { var defaults = { method: "GET", url: "", param: [] }; var options = $.extend(defaults, options); if (options.url && options.param) { var $form = $('<form action="' + options.url + '" method="' + (options.method || 'post') + '"></form>'); for (var key in options.param) { var $input = $('<input type="hidden" data-back="backdw" />').attr('name', key).val(options.param[key]); $form.append($input); } $form.appendTo('body').submit().remove(); }; }
function download(options) { var defaults = { method: "GET", url: "", param: [] }; var options = $.extend(defaults, options); if (options.url && options.param) { var $form = $('<form action="' + options.url + '" method="' + (options.method || 'post') + '"></form>'); for (var key in options.param) { var $input = $('<input type="hidden" data-back="backdw" />').attr('name', key).val(options.param[key]); $form.append($input); } $form.appendTo('body').submit().remove(); }; }
function btn_export() { var keyValue = $("#gridList").jqGrid('getGridParam', 'selrow'); if (keyValue == null || keyValue == "") { alert("没有可导出的数据."); return false; } download({ method: "POST", url: '/ProductManage/OrderManage/Export', param: { keyValue: keyValue } }); } </script>
<div class="topPanel"> <div class="toolbar"> <div class="btn-group"> <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a> <a id="NF-Export" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_export()"><i class="fa fa-search-plus"></i>Export</a> <a id="NF-Details" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_details()"><i class="fa fa-search-plus"></i>Look Details</a> <a id="NF-edit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>Order Confirmation</a> <a id="NF-cancel" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_cancel()"><i class="fa fa-pencil-square-o"></i>Cancel Confirmation</a> </div> @*<div class="btn-group"> <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建产品</a> </div>*@ @*<div class="operate"> <ul class="nav nav-pills"> <li class="first">Already Selected<span>1</span>Item</li> <li><a id="NF-Details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>Look Details</a></li> <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>Order Confirmation</a></li> </ul> <a href="javascript:;" class="close"></a> </div>*@ <script>$('.toolbar').authorizeButton()</script> </div> <div class="search"> <table> <tr> <td> <div class="input-group"> <input id="txt_keyword" type="text" class="form-control" placeholder="Order No" style="width: 100px;"> <input id="txt_keyword2" type="text" class="form-control" placeholder="Customer Name" style="width: 100px;margin-left:10px;"> @*<input id="txt_TO" type="text" class="form-control txttotxt" value="TO" style="width:20px;border:0;color:white;background-color:#1ABC9C;padding:1px 3px;font-size:14px;" /> <input id="txt_keyword2" type="text" class="form-control" placeholder="ProductSN" style="width: 100px;">*@ <span class="input-group-btn"> <button id="btn_search" type="button" style="margin-left:10px;" class="btn btn-primary"><i class="fa fa-search"></i></button> </span>
</div> </td> </tr> </table> </div> </div> <div class="gridPanel"> <table id="gridList"></table> <div id="gridPager"></div> </div>
|