TeacherRetailEdit.js 2.9 KB

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