browseflow.ui.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. $(document).off('click', '.switchButton').on('click', '.switchButton', function()
  2. {
  3. const viewType = $(this).attr('data-type');
  4. $.cookie.set('flowViewType', viewType, {expires:config.cookieLife, path:config.webRoot});
  5. loadCurrentPage();
  6. });
  7. onRenderCell = function(result, {row, col})
  8. {
  9. if(result)
  10. {
  11. if(col.name == 'buildin') return [{html: row.data.buildin == 1 ? '<i class=\"icon icon-check text-success\"></i>' : '<i class=\"icon icon-close text-danger\"></i>'}];
  12. if(col.name == 'actions')
  13. {
  14. for(i in result[0].props.items)
  15. {
  16. let item = result[0].props.items[i];
  17. if(item.disabled) continue;
  18. if(row.data.belong == '' && item.icon == 'off') delete item['data-confirm'];
  19. if(row.data.belong == '' && item.icon == 'play') item['url'] = $.createLink('workflow', 'activate', `id=${row.data.id}&type=all`);
  20. }
  21. }
  22. }
  23. return result;
  24. }
  25. window.activate = function(id)
  26. {
  27. zui.Modal.confirm(
  28. {
  29. 'message' : activateTips,
  30. 'actions': [
  31. {text: activateList['all'], key: 'confirm', class: 'primary'},
  32. {text: activateList['single'], key: 'cancel'},
  33. ],
  34. onResult: function(result)
  35. {
  36. result = result ? 'all' : 'single';
  37. const link = $.createLink('workflow', 'activate', `id=${id}&type=${result}`);
  38. $.ajaxSubmit({url: link});
  39. }
  40. }
  41. );
  42. }