AttachmentService.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var AttachmentService = {};
  2. /**
  3. * 获取文件属性
  4. */
  5. AttachmentService.getFileProperties = function (data) {
  6. return new Promise(function(resolve, reject) {
  7. $.ajax({
  8. url: Common.getApi(
  9. "/api/attachmentPanelResource/getFileProperties"
  10. ),
  11. type: "get",
  12. dataType: "json",
  13. data: data,
  14. beforeSend: function (request) {
  15. addTokenToRequest(request);
  16. },
  17. success: function (data) {
  18. resolve(data);
  19. }
  20. });
  21. });
  22. },
  23. /**
  24. * 下载附件
  25. */
  26. AttachmentService.downloadAttachment = function (data) {
  27. return new Promise(function(resolve, reject) {
  28. $.ajax({
  29. url: Common.getApi("/api/file/attachmentDownloadPath"),
  30. type: "get",
  31. data: data,
  32. beforeSend: function (request) {
  33. addTokenToRequest(request);
  34. },
  35. success: function (data) {
  36. resolve(data);
  37. }
  38. });
  39. });
  40. },
  41. /**
  42. * 删除附件
  43. */
  44. AttachmentService.deleteAttachment = function (data) {
  45. return new Promise(function(resolve, reject) {
  46. $.ajax({
  47. url: Common.getApi(
  48. "/api/attachmentPanelResource/deleteAttachment"
  49. ),
  50. type: "get",
  51. data: data,
  52. beforeSend: function (request) {
  53. addTokenToRequest(request);
  54. },
  55. success: function (data) {
  56. resolve(data);
  57. }
  58. });
  59. });
  60. }