StockOutEdit.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. var isDetailSelectMax = false;
  2. $(function () {
  3. isDetailSelectMax = $.SystemGeneral.getUrlParam("isDetailSelectMax") == 1;
  4. })
  5. function validChoose() {
  6. var d = [];
  7. $.each($("#dgStockInTMSelectList").cmsXDataTable("getSelections"), function (index) {
  8. d.push(this);
  9. });
  10. return d;
  11. }
  12. //删除
  13. function StockOut_Edit_Delete() {
  14. var d = validChoose();
  15. var da = validChoose().join(',');
  16. if (da == "") {
  17. $.messager.alert("系统提示", "请选择您要删除的信息。");
  18. return;
  19. }
  20. var roleViewList = $("#dgStockInTMSelectList").cmsXDataTable("getRows");
  21. var i, j;
  22. var len = roleViewList.length;
  23. for (i = len - 1; i >= 0; i--) {
  24. for (j = 0; j < d.length; j++) {
  25. if (roleViewList[i].TeachingMaterialPoolID == d[j].TeachingMaterialPoolID) {
  26. roleViewList.splice(i, 1);
  27. break;
  28. }
  29. }
  30. }
  31. $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
  32. var sum = 0;
  33. for (var i = 0; i < roleViewList.length; i++) {
  34. sum += parseInt(roleViewList[i].OrderQty)
  35. }
  36. $("#OutNumber").val(sum);
  37. }
  38. //添加教材
  39. function StockOut_Edit_Add() {
  40. var popupUrl = CMS_SystemConfig.VirtualDirectoryPath + '/StockOut/TeachingMaterial';
  41. if (isDetailSelectMax) {
  42. popupUrl += "?IsSelectMax=1";
  43. }
  44. $.popupTopWindow('添加教材', popupUrl, 720, 480, StockIn_Add_Confirm);
  45. }
  46. //roleList 选中的对象
  47. function StockIn_Add_Confirm(roleList) {
  48. if (roleList == undefined)
  49. return;
  50. var dataList = [{ "Text": "请选择", "Value": -1 }];
  51. var roleViewList = $("#dgStockInTMSelectList").cmsXDataTable("getRows");
  52. $.each(roleList, function (index, value) {
  53. if ($.grep(roleViewList, function (row, index) { return value.TeachingMaterialPoolID == roleViewList[index].TeachingMaterialPoolID; }).length == 0) {
  54. roleViewList.push({
  55. TeachingMaterialPoolID: value.TeachingMaterialPoolID,
  56. OrderQty: value.OrderQty,
  57. PresentInventory: value.PresentInventory,
  58. TeachingMaterialCode: value.TeachingMaterialCode,
  59. CoursematerialName: value.CoursematerialName,
  60. TeachingMaterialName: value.TeachingMaterialName,
  61. ISBN: value.ISBN,
  62. PublishTime: value.PublishTime,
  63. Discount: value.Discount,
  64. DiscountPrice: value.DiscountPrice,
  65. PublishName: value.PublishName,
  66. Author: value.Author,
  67. Price: value.Price,
  68. IsLateName: value.IsLateName,
  69. });
  70. }
  71. });
  72. $("#dgStockInTMSelectList").cmsXDataTable("loadData", { rows: roleViewList, total: roleViewList.length });
  73. var sum = 0;
  74. for (var i = 0; i < roleViewList.length; i++) {
  75. sum += parseInt(roleViewList[i].OrderQty)
  76. }
  77. $("#OutNumber").val(sum);
  78. }
  79. function reload() {
  80. $("#dgStockInTMSelectList").cmsXDataTable("load", $.getDataGridParams("dgStockInTMSelectList"));
  81. }
  82. function QueryPublishDropdownList() {
  83. reload();
  84. }