var isDetailSelectMax = false; $(function () { isDetailSelectMax = $.SystemGeneral.getUrlParam("isDetailSelectMax") == 1; }) function validChoose() { var d = []; $.each($("#dgStockInTMSelectList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //删除 function StockOut_Edit_Delete() { var d = validChoose(); var da = validChoose().join(','); if (da == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } var roleViewList = $("#dgStockInTMSelectList").cmsXDataTable("getRows"); var i, j; var len = roleViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (roleViewList[i].TeachingMaterialPoolID == d[j].TeachingMaterialPoolID) { roleViewList.splice(i, 1); break; } } } $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length }); var sum = 0; for (var i = 0; i < roleViewList.length; i++) { sum += parseInt(roleViewList[i].OrderQty) } $("#OutNumber").val(sum); } //添加教材 function StockOut_Edit_Add() { var popupUrl = CMS_SystemConfig.VirtualDirectoryPath + '/StockOut/TeachingMaterial'; if (isDetailSelectMax) { popupUrl += "?IsSelectMax=1"; } $.popupTopWindow('添加教材', popupUrl, 720, 480, StockIn_Add_Confirm); } //roleList 选中的对象 function StockIn_Add_Confirm(roleList) { if (roleList == undefined) return; var dataList = [{ "Text": "请选择", "Value": -1 }]; var roleViewList = $("#dgStockInTMSelectList").cmsXDataTable("getRows"); $.each(roleList, function (index, value) { if ($.grep(roleViewList, function (row, index) { return value.TeachingMaterialPoolID == roleViewList[index].TeachingMaterialPoolID; }).length == 0) { roleViewList.push({ TeachingMaterialPoolID: value.TeachingMaterialPoolID, OrderQty: value.OrderQty, PresentInventory: value.PresentInventory, TeachingMaterialCode: value.TeachingMaterialCode, CoursematerialName: value.CoursematerialName, TeachingMaterialName: value.TeachingMaterialName, ISBN: value.ISBN, PublishTime: value.PublishTime, Discount: value.Discount, DiscountPrice: value.DiscountPrice, PublishName: value.PublishName, Author: value.Author, Price: value.Price, IsLateName: value.IsLateName, }); } }); $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length }); var sum = 0; for (var i = 0; i < roleViewList.length; i++) { sum += parseInt(roleViewList[i].OrderQty) } $("#OutNumber").val(sum); } function reload() { $("#dgStockInTMSelectList").cmsXDataTable("load", $.getDataGridParams("dgStockInTMSelectList")); } function QueryPublishDropdownList() { reload(); }