index.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import { request, upload } from "@/utils/request.js";
  2. import { getDeptId } from "@/utils/auth";
  3. export const getAllDataDictList = () =>
  4. request({
  5. url: "/system/dict-data/simple-list",
  6. method: "GET",
  7. });
  8. export const getAllDeptList = (name) =>
  9. request({
  10. url: "/system/dept/simple-list",
  11. method: "GET",
  12. params: {
  13. name,
  14. },
  15. });
  16. export const getAllDeviceList = (deptId) =>
  17. request({
  18. url: "/rq/iot-device/simple-list",
  19. method: "GET",
  20. params: {
  21. deptId,
  22. },
  23. });
  24. /**
  25. * 获取工厂、成本中心、库存地点列表
  26. * @param type 1-工厂 2-成本中心 3-库存地点
  27. */
  28. export const getAllCostCenterOrFactoryOrStorageLocationList = (type) =>
  29. request({
  30. url: "/system/sap-org/simple-list",
  31. method: "GET",
  32. params: {
  33. type,
  34. },
  35. });
  36. /**
  37. * 获取工厂、成本中心列表 - 新
  38. * @param type 1-工厂 2-成本中心
  39. */
  40. export const filteredSimpleSapOrgList = (type) =>
  41. request({
  42. url: "/system/sap-org/filteredSimpleSapOrgList",
  43. method: "GET",
  44. params: {
  45. type,
  46. deptId: getDeptId(), // 获取当前部门ID
  47. },
  48. });
  49. /**
  50. * 供应商分页数据
  51. * @param params 筛选参数
  52. */
  53. export const getSupplierList = (params) =>
  54. request({
  55. url: "/supplier/base/page",
  56. method: "GET",
  57. params,
  58. });
  59. /**
  60. * 获取字典分页数据
  61. * @param params
  62. */
  63. export const getDataDictList = (params) =>
  64. request({
  65. url: "/system/dict-data/page",
  66. method: "GET",
  67. params,
  68. });
  69. /**
  70. * 上传文件
  71. * @param filePath
  72. */
  73. export const uploadFile = (filePath) =>
  74. upload("/infra/file/upload/path", {
  75. // #ifdef MP-ALIPAY
  76. fileType: "image/video/audio", // 仅支付宝小程序,且必填。
  77. // #endif
  78. filePath: filePath, // 要上传文件资源的路径。
  79. name: "file", // 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
  80. });
  81. /**
  82. * 获取用户列表
  83. * @param userId
  84. */
  85. export const getUserList = (userId) =>
  86. request({
  87. url: "/system/user/dept/users",
  88. method: "GET",
  89. params: {
  90. userId,
  91. },
  92. });
  93. // 获取用户信息
  94. export const getUserInfo = (params) =>
  95. request({
  96. url: "/system/user/get",
  97. method: "GET",
  98. params,
  99. });
  100. // 获取用户部门信息
  101. export const getUserDeptInfo = (params) =>
  102. request({
  103. url: "/system/dept/get",
  104. method: "GET",
  105. params,
  106. });
  107. /**
  108. * 获取部门下用户列表
  109. * @param deptId
  110. */
  111. export const getUserListByDeptId = (deptId) =>
  112. request({
  113. url: '/system/user/simpleUserList',
  114. method: 'GET',
  115. params: { deptId },
  116. })