linkcommit.ui.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. function loadCommit()
  2. {
  3. let begin = $('.select-date-box input[name=begin]').val();
  4. let end = $('.select-date-box input[name=end]').val();
  5. let repoID = $('.select-repo-box input[name=repo]').val();
  6. if(begin.indexOf('-') != -1)
  7. {
  8. let beginarray = begin.split("-");
  9. begin = '';
  10. for(i = 0; i < beginarray.length; i++) begin = begin + beginarray[i];
  11. }
  12. if(end.indexOf('-') != -1)
  13. {
  14. let endarray = end.split("-");
  15. end = '';
  16. for(i = 0 ; i < endarray.length ; i++) end = end + endarray[i];
  17. }
  18. if(begin > end)
  19. {
  20. zui.Modal.alert(errorDate);
  21. loadPage($.createLink('design', 'linkCommit', "designID=" + designID + '&repoID=' + repoID));
  22. return false;
  23. }
  24. var modalTarget = $('#viewCommitModal').length > 0 ? 'viewCommitModal' : 'linkCommitModal';
  25. loadModal($.createLink('design', 'linkCommit', "designID=" + designID + '&repoID=' + repoID + '&begin=' + begin + '&end=' + end), modalTarget);
  26. }
  27. $(document).off('click','.batch-btn').on('click', '.batch-btn', function()
  28. {
  29. const dtable = zui.DTable.query($(this));
  30. const checkedList = dtable.$.getChecks();
  31. if(!checkedList.length) return;
  32. const url = $(this).data('url');
  33. const form = new FormData();
  34. checkedList.forEach((id) => form.append('revision[]', id));
  35. $.ajaxSubmit({url, data: form});
  36. });
  37. window.calcHeight = function()
  38. {
  39. if(isTutorial) return 200;
  40. return $('#viewCommitModal').height() - $('#viewCommitModal .modal-header').height() - $('#viewCommitModal .modal-body > .flex').height() - 200;
  41. }