main.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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. storageUtil.setSessionCache("RationGrp","repositoryID_" + rstData[i].ID, rstData[i].dispName);
  10. if(rstData[i].gljLib){
  11. storageUtil.setSessionCache("gljLib","repositoryID_" + rstData[i].ID, rstData[i].gljLib);
  12. }
  13. let id = rstData[i].ID;
  14. let libName = rstData[i].dispName;
  15. $("#comple_ration_table").append(
  16. "<tr id='tempId'>" +
  17. "<td><a href='/stdGljRepository/glj'>"+libName+"</a></td></tr>"
  18. );
  19. var newHref = "/complementaryRation/ration?repository="+id;
  20. $("#tempId td:first a").attr("href", newHref);
  21. $("#tempId").attr("id", id);
  22. }
  23. };
  24. CommonAjax.post('/complementaryRation/api/getRationLibs', {user_id: userID}, scFunc);
  25. }
  26. };
  27. $(document).ready(function () {
  28. $('#comple-ration').on('shown.bs.modal', function () {
  29. compleRationMain.getRationLibs();
  30. });
  31. });