【前端】智能库房综合管理系统前端项目
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.

111 lines
2.6 KiB

3 years ago
3 years ago
3 years ago
  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(data) {
  17. return request({
  18. url: '/api/device/delete',
  19. method: 'delete',
  20. data
  21. })
  22. }
  23. export function edit(data) {
  24. const url = getUrl(data, 'edit')
  25. return request({
  26. url: url,
  27. method: 'put',
  28. data
  29. })
  30. }
  31. export function getDeviceType() {
  32. return request({
  33. url: 'api/device/type',
  34. method: 'get'
  35. })
  36. }
  37. export function getDeviceById(params) {
  38. return request({
  39. url: 'api/device/state',
  40. method: 'get',
  41. params
  42. })
  43. }
  44. export function getDesecabinetById(params) {
  45. return request({
  46. url: 'api/desecabinet/query',
  47. method: 'get',
  48. params
  49. })
  50. }
  51. export function getRotarycabinetById(params) {
  52. return request({
  53. url: 'api/rotarycabinet/query',
  54. method: 'get',
  55. params
  56. })
  57. }
  58. function getUrl(data, optTYpe) {
  59. let url = 'api/desecabinet/'
  60. if (data.deviceTypeId.name === '密集架') {
  61. url = 'api/desecabinet/'
  62. } else if (data.deviceTypeId.name === '回转柜') {
  63. url = 'api/rotarycabinet/'
  64. } else if (data.deviceTypeId.name === '摄像头') {
  65. url = 'api/camera/'
  66. } 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 === '漏水传感器') {
  67. url = 'api/insidedevices/'
  68. } else if (data.deviceTypeId.name === '通道门' || data.deviceTypeId.name === '手持式RFID读写器') {
  69. url = 'api/outsidedevices/'
  70. }
  71. if (optTYpe === 'add') {
  72. url += 'create'
  73. } else if (optTYpe === 'edit') {
  74. url += 'update'
  75. }
  76. return url
  77. }
  78. export function getDeviceList(params) {
  79. return request({
  80. url: 'api/device/list',
  81. method: 'get',
  82. params
  83. })
  84. }
  85. // 根据区列获取在库已借数
  86. export function FetchInBorrowByQuCol(params) {
  87. return request({
  88. url: 'api/tag/getInBorrowByQuCol',
  89. method: 'get',
  90. params
  91. })
  92. }
  93. export function unbind(data) {
  94. return request({
  95. url: 'api/displayconfig/unbind',
  96. method: 'post',
  97. data
  98. })
  99. }
  100. export default { add, edit, del, getSupplier, getDeviceType, getDeviceById, getDesecabinetById, getRotarycabinetById, getDeviceList, FetchInBorrowByQuCol, unbind }