index.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import {
  2. postJ,
  3. post,
  4. get
  5. } from "@/utils/request";
  6. import Vue from "vue";
  7. /**
  8. * 查询文件夹分类数据
  9. * @data data
  10. */
  11. export async function getDocTreeListAPI(data) {
  12. const res = await postJ(Vue.prototype.apiUrl+'/fm/directory/selectTreeList', data);
  13. if (res.code == 0) {
  14. return res.data;
  15. }
  16. return Promise.reject(new Error(res.message));
  17. }
  18. /**
  19. * 查询文件数据
  20. * @data data
  21. */
  22. export async function filePageAPI(data) {
  23. const res = await postJ(Vue.prototype.apiUrl+'/fm/file/pageBusiness', data);
  24. if (res.code == 0) {
  25. return res.data;
  26. }
  27. return Promise.reject(new Error(res.message));
  28. }
  29. /**
  30. * 保存
  31. * @data data
  32. */
  33. export async function fileSaveAPI(data) {
  34. const res = await postJ(Vue.prototype.apiUrl+'/fm/file/save', data);
  35. if (res.code == 0) {
  36. return res.data;
  37. }
  38. return Promise.reject(new Error(res.message));
  39. }
  40. /**
  41. * 详情
  42. * @id id
  43. */
  44. export async function fileGetByIdAPI(id) {
  45. const res = await request.get(`/fm/file/getById/${id}`);
  46. if (res.data.code == 0) {
  47. return res.data.data;
  48. }
  49. return Promise.reject(new Error(res.data.message));
  50. }
  51. /**
  52. * ids查询文件列表
  53. * @data data
  54. */
  55. export async function queryIds(data) {
  56. const res = await postJ(Vue.prototype.apiUrl+'/fm/file/queryIds', data);
  57. if (res.code == 0) {
  58. return res.data;
  59. }
  60. return Promise.reject(new Error(res.message));
  61. }
  62. // 获取编码树
  63. export async function selectTreeList(data) {
  64. const res = await postJ(Vue.prototype.apiUrl+`/main/business_code_category/selectTreeList`, data);
  65. if (res.code == 0) {
  66. return res.data;
  67. }
  68. return Promise.reject(new Error(res.message));
  69. }
  70. // 获取右侧列表
  71. export async function listParentId(data) {
  72. const res = await postJ(Vue.prototype.apiUrl+`/main/business_code_category/listPageParentId`, data);
  73. if (res.code == 0) {
  74. return res.data;
  75. }
  76. return Promise.reject(new Error(res.message));
  77. }
  78. /**
  79. * 上传文件
  80. * @param file 文件
  81. */
  82. export async function uploadFileNew (data) {
  83. const formData = new FormData();
  84. formData.append('multiPartFile', data.multiPartFile);
  85. formData.append('module', data.module);
  86. const res = await post(Vue.prototype.apiUrl+'/main/file/uploadFile', formData);
  87. if (res.code === '0') {
  88. return res.data;
  89. }
  90. return Promise.reject(new Error(res.message));
  91. }
  92. // 编码方案
  93. export async function listCode() {
  94. const res = await get(Vue.prototype.apiUrl+`/main/business_code_category/listCode/WD0001`);
  95. if (res.code == 0) {
  96. return res.data;
  97. }
  98. return Promise.reject(new Error(res.message));
  99. }