zentaobiz.ui.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. $(document).off('click', '.batch-btn').on('click', '.batch-btn', function()
  2. {
  3. const dtable = zui.DTable.query($(this).target);
  4. const checkedList = dtable.$.getChecks();
  5. if(!checkedList.length) return;
  6. const formData = dtable.$.getFormData();
  7. const url = $(this).data('url');
  8. const form = new FormData();
  9. checkedList.forEach((id) =>
  10. {
  11. let key = 'relation[' + id + ']';
  12. form.append(key, formData[key]);
  13. });
  14. if($(this).hasClass('ajax-btn'))
  15. {
  16. $.ajaxSubmit({url, data: form});
  17. }
  18. else
  19. {
  20. postAndLoadPage(url, form);
  21. }
  22. });
  23. window.renderCell = function(result, info)
  24. {
  25. const relatedObjectType = $('[name^=relatedObjectType]').val();
  26. if(relatedObjectType == 'doc' && info.col.name == 'title' && info.row.data.vision != vision)
  27. {
  28. result[0].props.href = '###';
  29. result[0].props.disabled = true;
  30. result[0].props['data-toggle'] = '';
  31. result[0].props['data-size'] = '';
  32. }
  33. if(info.col.name == 'relation')
  34. {
  35. let relationItems = [];
  36. $.each(relationPairs, function(key, value){relationItems.push({'value': key, 'text': value});});
  37. result[0].children.props.required = true;
  38. result[0].children.props.items = relationItems;
  39. }
  40. return result;
  41. }
  42. window.switchObject = function(value)
  43. {
  44. const url = $.createLink('custom', 'relateObject', 'objectID=' + objectID + '&objectType=' + objectType + '&relatedObjectType=' + value);
  45. loadModal(url);
  46. }