gantt.ui.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. window.clickSubmit = function(e)
  2. {
  3. let hasData = false;
  4. $('[name^=name]').each(function()
  5. {
  6. if($(this).val())
  7. {
  8. hasData = true;
  9. return false;
  10. }
  11. })
  12. if(splitTaskRelation && Object.keys(splitTaskRelation).length > 0 && hasData)
  13. {
  14. zui.Modal.confirm({message: unlinkRelationTip, actions: [{key: 'confirm', text: unlinkLang, btnType: 'primary', class: 'btn-wide'}, {key: 'cancel'}]}).then((res) =>
  15. {
  16. if(res)
  17. {
  18. const link = $('#taskBatchCreateForm > .panel-body form').attr('action');
  19. let formData = $('#taskBatchCreateForm > .panel-body form').serialize();
  20. let postData = {};
  21. let params = new URLSearchParams(formData);
  22. for(const[key, value] of params.entries())
  23. {
  24. const decodedKey = decodeURIComponent(key);
  25. const decodedValue = decodeURIComponent(value);
  26. if(!(decodedKey in postData)) postData[decodedKey] = [];
  27. postData[decodedKey].push(decodedValue);
  28. }
  29. $.ajaxSubmit({url: link, data: postData});
  30. }
  31. else
  32. {
  33. return false;
  34. }
  35. })
  36. return false;
  37. }
  38. }