|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_LayoutIndex.cshtml"; } <script> $(function () { $('#layout').layout(); treeView(); gridList(); }); function treeView() { $("#itemTree").treeview({ url: "/ProductManage/PreSaleOrder/GetTreeJson", onnodeclick: function (item) { $("#txt_keyword").val(''); $('#btn_search').trigger("click"); } }); } function gridList() { var $gridList = $("#gridList"); $gridList.dataGrid({ height: $(window).height() - 96, colModel: [ //{ label: "主键", name: "F_Id", hidden: true, key: true }, //{ label: '产品ID', name: 'Product_Id', hidden: true }, //{ label: 'Product SN', name: 'Product_SN', width: 150, align: 'left' }, //{ // label: 'Schedule Time', name: 'PreSellTime', width: 80, align: 'left', // formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' } //} { label: "主键", name: "F_Id", hidden: true, key: true }, { label: '产品ID', name: 'Product_Id', hidden: true }, { label: 'Product No', name: 'ProductSN', width: 80, align: 'left' }, { label: 'Measurement', name: 'Measurement', width: 90, align: 'left' },//尺寸 { label: 'Schedule Time', name: 'PreSellTime', width: 100, align: 'left', formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' } }, { label: 'Sort', name: 'Other', width: 60, align: 'left' }, //{ label: 'Weight', name: 'Weight', width: 60, align: 'left' },//重量 { label: 'FinishedWeight', name: 'Weight', width: 100, align: 'left', formatter: "number", formatoptions: { thousandsSeparator: ',', defaulValue: '', decimalPlaces: 3 } }, { label: 'RoughWeight', name: 'GrossWeight', width: 90, align: 'left', formatter: "number", formatoptions: { thousandsSeparator: ',', defaulValue: '', decimalPlaces: 3 } }, { label: 'Shape', name: 'Shape', width: 60, align: 'left' },//形状 { label: 'Certificate No', name: 'CertificateNo', width: 100, align: 'left' },//证书号码 { label: 'Price', name: 'Price', width: 60, align: 'left' },//价格 { label: 'Location', name: 'Location', width: 120, align: 'left' } ], multiselect: true, editurl: "JqGridHandler.ashx?sign=singleEdit" }); $("#btn_search").click(function () { $gridList.jqGrid('setGridParam', { url: "/ProductManage/PreSaleOrder/GetGridJson", postData: { itemId: $("#itemTree").getCurrentNode().id, keyword: $("#txt_keyword").val() }, }).trigger('reloadGrid'); }); }
function btn_deleteOrder() { var records = $('#gridList').jqGrid('getGridParam', 'records'); if (records > 0) { alert("Not empty orders, not deleted."); } else { var id = $("#itemTree").getCurrentNode().id; $.deleteForm({ url: "/ProductManage/PreSaleOrder/DeleteFormOrder", param: { keyValue: id }, success: function () { treeView(); $("#gridList").resetSelection(); $("#gridList").trigger("reloadGrid"); } }) } }
function btn_delete() { 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]; } $.deleteForm({ url: "/ProductManage/PreSaleOrder/DeleteForm", param: { keyValue: keyValues }, success: function () { treeView(); $("#gridList").resetSelection(); $("#gridList").trigger("reloadGrid"); } }) } </script> <div class="ui-layout" id="layout" style="height: 100%; width: 100%;"> <div class="ui-layout-west"> <div id="itemTree"></div> </div> <div class="ui-layout-center"> <div class="topPanel"> <div class="toolbar"> <div class="btn-group"> <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a> </div> <div class="btn-group"> @*<a id="NF-Details" authorize="yes" class="btn btn-primary" onclick="btn_details()"><i class="fa fa-search-plus"></i>Look Product</a>*@ <a id="NF-delete" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_delete()"><i class="fa fa-trash-o"></i>Cancel Schedule</a> </div> <script>$('.toolbar').authorizeButton()</script> </div> <div class="search"> <table> <tr> <td> <div class="toolbar" style="line-height:30px;"> <div class="btn-group"> <a id="NF-deleteOrder" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_deleteOrder()"><i class="fa fa-trash-o"></i>Delete Order</a> </div> </div> <div class="input-group"> <input id="txt_keyword" type="text" class="form-control" placeholder="Product SN" style="width: 200px;"> <span class="input-group-btn"> <button id="btn_search" type="button" 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> </div> </div>
|