browse.ui.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. window.renderActivityCell = function(result, info)
  2. {
  3. const {col, row} = info;
  4. if(col.name == 'order')
  5. {
  6. const canSort = this.options.orderBy.order == 'asc';
  7. result[0] = {html: "<i class='icon-move' title='" + (!canSort ? sortHint : '') + "'></i>", className: 'text-gray cursor-move move-process ' + (!canSort ? 'disabled' : '')};
  8. }
  9. if(col.name == 'actions')
  10. {
  11. if(!row.data?.hasDeliverable) return result;
  12. const actionItem = result[0]?.props?.items?.[1];
  13. if(actionItem && 'data-confirm' in actionItem) delete actionItem['data-confirm'];
  14. }
  15. return result;
  16. };
  17. window.onSortEnd = function(from, to, type)
  18. {
  19. if(!from || !to) return false;
  20. const url = $.createLink('activity', 'ajaxUpdateOrder');
  21. const form = new FormData();
  22. form.append('orders', JSON.stringify(this.state.rowOrders));
  23. form.append('orderBy', orderBy);
  24. $.ajaxSubmit({url, data:form});
  25. $.apps.updateAppUrl($.createLink('activity', 'browse', `groupID=${groupID}&browseType=${browseType}&param=${param}&orderBy=order_asc`));
  26. return true;
  27. }
  28. $(document).off('click', '[data-formaction]').on('click', '[data-formaction]', function () {
  29. const $this = $(this);
  30. if ($this.attr('class').indexOf('disabled') !== -1) return;
  31. const dtable = zui.DTable.query($('#activities'));
  32. const checkedList = dtable.$.getChecks();
  33. if (!checkedList.length) return;
  34. const postData = new FormData();
  35. checkedList.forEach((id) => postData.append('activityIdList[]', id));
  36. if ($this.data('page') == 'batch') {
  37. postAndLoadPage($this.data('formaction'), postData);
  38. }
  39. else {
  40. $.ajaxSubmit({ "url": $this.data('formaction'), "data": postData });
  41. }
  42. });