adhoc_task.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict'
  2. /**
  3. * Created by Tony on 2021/11/3.
  4. */
  5. let adHocTaskObj = {
  6. currentRationRepId: '',
  7. currentRationLibId: '',
  8. iniPage: function() {
  9. this._getCompilationList();
  10. },
  11. _getCompilationList: function(){
  12. let me = adHocTaskObj, params = {};
  13. CommonAjax.postEx("report_tpl_api/getCompilationList", params, 20000, true, function(result){
  14. for (let item of result) {
  15. $("#compilations").append("<option value='" + item._id + "'>" + item.name + "</option>");
  16. }
  17. me.changeCompilation($("#compilations").get(0));
  18. me.currentRationRepId = $("#compilations").get(0).value;
  19. }, null, null
  20. );
  21. },
  22. changeCompilation: function(dom) {
  23. $("#rations").empty();
  24. ///rationRepository/api
  25. let compilationId = dom.value;
  26. CommonAjax.post('/rationRepository/api/getRationLibsByCompilation', {compilationId: compilationId}, function (rstData) {
  27. $('#rations').empty();
  28. for(let rationLib of rstData){
  29. let opt = `<option value="${rationLib.ID}">${rationLib.dispName}</option>`;
  30. $('#rations').append(opt);
  31. }
  32. adHocTaskObj.currentRationLibId = $("#rations").get(0).value;
  33. });
  34. },
  35. changeRationRepository: function(dom) {
  36. adHocTaskObj.currentRationLibId = dom.value;
  37. },
  38. createDesktopMdb: function() {
  39. let params = {};
  40. params.compilationId = adHocTaskObj.currentRationRepId;
  41. params.rationLibId = adHocTaskObj.currentRationLibId;
  42. params.hasRationTree = $("#eleRationTree").get(0).checked;
  43. params.hasRation = $("#eleRationItems").get(0).checked;
  44. params.hasAssistRation = $("#eleAssistRationItems").get(0).checked;
  45. params.hasGLJ = $("#eleAllGLJ").get(0).checked;
  46. params.hasCOE = $("#eleCOE").get(0).checked;
  47. CommonAjax.postEx('/adHoc_report_api/createDesktopMdb', params, 10000, false, function (result) {
  48. console.log(`result: `);
  49. console.log(result);
  50. });
  51. }
  52. };