browse.ui.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. window.operateDept = function(event, item, index)
  2. {
  3. var $target = $(event.target);
  4. var $button = $target.hasClass('icon') ? $target.closest('button') : $target;
  5. var editLink = editLinkTemp;
  6. var deleteLink = deleteLinkTemp;
  7. var deptID = $target.closest('.tree-item').attr('z-key');
  8. if($target.hasClass('icon-edit') || $target.children('.icon-edit').length > 0)
  9. {
  10. $button.attr('data-toggle', 'modal');
  11. $button.attr('data-size', 'sm');
  12. $button.attr('data-url', editLink.replace('{id}', deptID));
  13. }
  14. else if($target.hasClass('icon-trash') || $target.children('.icon-trash').length > 0)
  15. {
  16. $button.attr('data-confirm', deleteTip);
  17. $button.attr('data-url', deleteLink.replace('{id}', deptID));
  18. $button.addClass('ajax-submit');
  19. }
  20. }
  21. window.onSort = function(event, orders, parentKey)
  22. {
  23. const url = $.createLink('dept', 'updateOrder');
  24. const form = new FormData();
  25. form.append('orders', orders);
  26. $.ajaxSubmit({url, data:form});
  27. }