edit.ui.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. $(function()
  2. {
  3. setWhite();
  4. });
  5. /* 切换项目管理模型的逻辑. */
  6. $(document).on('click', '.model-drop', function()
  7. {
  8. const currentModel = $(this).find('.listitem').attr('data-key');
  9. const url = $.createLink('project', 'edit', "projectID=" + currentProject + "&from=" + from + "&programID=" + programID + "&extra=workflowGroup=,model=" + currentModel);
  10. loadPage(url);
  11. })
  12. window.toggleStoryType = function(e)
  13. {
  14. if(!e.target.checked)
  15. {
  16. const link = $.createLink('project', 'ajaxGetStoryByType', 'projectID=' + currentProject + '&storyType=' + e.target.value)
  17. $.get(link, function(data)
  18. {
  19. if(data)
  20. {
  21. zui.Modal.confirm(confirmDisableStoryType).then((res) => {
  22. if(!res)
  23. {
  24. if(storyType.includes('epic')) $('input[value=epic]').prop('checked', true);
  25. if(storyType.includes('requirement')) $('input[value=requirement]').prop('checked', true);
  26. return false;
  27. }
  28. })
  29. }
  30. });
  31. if(e.target.value == 'requirement')
  32. {
  33. $('input[value=epic]').prop('checked', false);
  34. }
  35. }
  36. if(e.target.value == 'epic' && e.target.checked)
  37. {
  38. $('input[value=requirement]').prop('checked', true);
  39. }
  40. }
  41. window.changeAcl = function(e)
  42. {
  43. const parentID = e.target.value;
  44. const defaultVal = $('.aclBox .check-list [name=acl]:checked').val();
  45. const useList = parentID > 0 ? subAclList : aclList;
  46. const hasDefault = typeof(useList[defaultVal]) != 'undefined';
  47. let aclHtml = '';
  48. let checkedID = hasDefault ? defaultVal : 'open';
  49. for(key in useList)
  50. {
  51. let checked = key == checkedID;
  52. aclHtml += '<div class="radio-primary"><input type="radio" id="acl' + key + '" name="acl"' + (checked ? ' checked' : '') + ' value="' + key +'"><label for="acl' + key + '">' + useList[key] + '</label></div>';
  53. }
  54. $('.aclBox .check-list').html(aclHtml);
  55. setWhite();
  56. }