project.ui.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. window.renderCell = function(result, {col, row})
  2. {
  3. if(col.name === 'name')
  4. {
  5. if(typeof result[0].props == 'object') result[0].props.className = 'clip w-max';
  6. if(row.data.postponed) result[result.length] = {html:'<span class="label size-sm circle danger-pale w-max">' + row.data.delayInfo + '</span>'};
  7. return result;
  8. }
  9. return result;
  10. }
  11. $(document).on('click', '#involved', function()
  12. {
  13. var involved = $(this).prop('checked') ? 1 : 0;
  14. $.cookie.set('involved', involved, {expires:config.cookieLife, path:config.webRoot});
  15. loadCurrentPage();
  16. });
  17. window.confirmDelete = function(projectID, projectName)
  18. {
  19. zui.Modal.confirm({message: confirmDeleteTip.replace('%s', projectName), icon:'icon-exclamation-sign', iconClass: 'warning-pale rounded-full icon-2x'}).then((res) =>
  20. {
  21. if(res) $.ajaxSubmit({url: $.createLink('project', 'delete', 'projectID=' + projectID)});
  22. });
  23. }
  24. $(document).on('click', '.batch-btn', function()
  25. {
  26. const dtable = zui.DTable.query($(this).target);
  27. const checkedList = dtable.$.getChecks();
  28. if(!checkedList.length) return;
  29. const form = new FormData();
  30. const url = $(this).data('url');
  31. checkedList.forEach((id) => form.append('projectIdList[]', id));
  32. postAndLoadPage(url, form);
  33. });
  34. window.footerSummary = function(checkedIdList, pageSummary)
  35. {
  36. return {html: pageSummary};
  37. }