【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.7 KiB

  1. import request from '@/utils/request'
  2. export function getSupplier() {
  3. return request({
  4. url: 'api/supplier/dropdown-list',
  5. method: 'get'
  6. })
  7. }
  8. export function add(data) {
  9. const url = getUrl(data, 'add')
  10. return request({
  11. url: url,
  12. method: 'post',
  13. data
  14. })
  15. }
  16. export function del(ids) {
  17. const data = {
  18. id: ids[0]
  19. }
  20. return request({
  21. url: 'api/desecabinet/delete',
  22. method: 'post',
  23. data
  24. })
  25. }
  26. export function edit(data) {
  27. const url = getUrl(data, 'edit')
  28. return request({
  29. url: url,
  30. method: 'put',
  31. data
  32. })
  33. }
  34. export function getDeviceType() {
  35. return request({
  36. url: 'api/device/type',
  37. method: 'get'
  38. })
  39. }
  40. function getUrl(data, optTYpe) {
  41. let url = 'api/desecabinet/'
  42. if (data.deviceTypeId.name === '密集架') {
  43. url = 'api/desecabinet/'
  44. } else if (data.deviceTypeId.name === '回转柜') {
  45. url = 'api/rotarycabinet/'
  46. } else if (data.deviceTypeId.name === '摄像头') {
  47. url = 'api/camera/'
  48. } else if (data.deviceTypeId.name === '空调' || data.deviceTypeId.name === '桌面式RFID读写器' || data.deviceTypeId.name === '盘点机' || data.deviceTypeId.name === '恒湿机' || data.deviceTypeId.name === '漏水传感器' || data.deviceTypeId.name === '温湿度感应器' || data.deviceTypeId.name === '空气质量检测设备' || data.deviceTypeId.name === '漏水传感器') {
  49. url = 'api/insidedevices/'
  50. } else if (data.deviceTypeId.name === '通道门' || data.deviceTypeId.name === '手持式RFID读写器') {
  51. url = 'api/outsidedevices/'
  52. }
  53. if (optTYpe === 'add') {
  54. url += 'create'
  55. } else if (optTYpe === 'edit') {
  56. url += 'update'
  57. }
  58. return url
  59. }
  60. export default { add, edit, del, getSupplier, getDeviceType }