main.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * Created by Zhong on 2017/12/22.
  3. */
  4. let compleRationMain = {
  5. getRationLibs: function () {
  6. let scFunc = function (rstData) {
  7. $("#comple_ration_table").empty();
  8. for(let i = 0; i < rstData.length; i++){
  9. if(rstData[i].gljLib !== undefined && rstData[i].gljLib && rstData[i].gljLib != -1){
  10. let id = rstData[i].ID;
  11. let libName = rstData[i].dispName;
  12. $("#comple_ration_table").append(
  13. "<tr id='tempId'>" +
  14. "<td><a href='javascript:void(0);'>"+libName+"</a></td></tr>"
  15. );
  16. var newHref = "/complementaryRation/ration?repository="+id;
  17. $("#tempId td:first a").click(function () {
  18. let newHref = "/complementaryRation/ration?repository="+id;
  19. let newTab = window.open('about:blank');
  20. CommonAjax.get(newHref, [], function () {
  21. newTab.location.href = newHref;
  22. });
  23. });
  24. $("#tempId").attr("id", id);
  25. }
  26. }
  27. };
  28. let ration_lib = projectInfoObj.projectInfo.engineeringInfo.ration_lib;
  29. let ids = [];
  30. for(lib of ration_lib){
  31. ids.push(parseInt(lib.id));
  32. }
  33. CommonAjax.post('/complementaryRation/api/getRationLibs', {user_id: userID, ids: ids}, scFunc);
  34. }
  35. };
  36. $(document).ready(function () {
  37. $('#comple-ration').on('shown.bs.modal', function () {
  38. compleRationMain.getRationLibs();
  39. });
  40. });