acceptance.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import http from '@/request/index.js';
  2. export const state = {
  3. acceptData: [], //验收数据
  4. acceptDetaData: [], // 验收详情头部数据
  5. acceptDetail: [], //验收详情列表数据
  6. refusaData: { // 耗材清单详情数据
  7. index: 0,
  8. data: {}
  9. },
  10. udiData: [] // udi数据
  11. };
  12. export const mutations = {
  13. setAcceptData(state, data) {
  14. state.acceptData = data
  15. },
  16. setAcceptDetaData(state, data) {
  17. state.acceptDetaData = data
  18. },
  19. setAcceptDetail(state, data) {
  20. state.acceptDetail = data
  21. },
  22. setRefusaData(state, data) {
  23. state.refusaData = data
  24. },
  25. setUdiData(state, data) {
  26. state.udiData = data
  27. }
  28. }
  29. export const actions = {
  30. //获取待验收数据
  31. getAceptData({
  32. commit,
  33. rootState
  34. }, data) {
  35. return new Promise((resolve, reject) => {
  36. http('acceptance.getAwaitListData',
  37. data.pam, '加载中').then(res => {
  38. if (res.success == true && res.data) {
  39. data.that.$refs.paging.complete(res.data.records);
  40. }
  41. }).catch(e => {
  42. reject(e)
  43. })
  44. })
  45. },
  46. //获取待验收详情数据
  47. getAwaitDetail({
  48. commit,
  49. rootState
  50. }, data) {
  51. return new Promise((resolve, reject) => {
  52. http('acceptance.getAwaitDetailListData',
  53. data, '加载中').then(res => {
  54. if (res.success == true && res.data) {
  55. res.data.records.length && res.data.records.forEach((item) => {
  56. if (item.shppCnt == null) {
  57. return item.shppCnt = item.stooutCnt;
  58. }
  59. })
  60. commit('setAcceptDetail', res.data.records)
  61. }
  62. }).catch(e => {
  63. commit('setAcceptDetail', [])
  64. reject(e)
  65. })
  66. })
  67. },
  68. //获取已验收数据
  69. getAreadyData({
  70. commit,
  71. rootState
  72. }, data) {
  73. return new Promise((resolve, reject) => {
  74. http('acceptance.getAlreadyData',
  75. data.pam, '加载中').then(res => {
  76. if (res.success == true && res.data) {
  77. data.that.$refs.paging.complete(res.data.records);
  78. }
  79. }).catch(e => {
  80. reject(e)
  81. })
  82. })
  83. },
  84. //获取已验收详情数据
  85. getAreadyDetail({
  86. commit,
  87. rootState
  88. }, data) {
  89. return new Promise((resolve, reject) => {
  90. http('acceptance.getAreadyDetailListData',
  91. data, '加载中').then(res => {
  92. if (res.success == true && res.data) {
  93. res.data.records.length && res.data.records.forEach((item) => {
  94. if (item.shppCnt == null) {
  95. item.shppCnt = item.stooutCnt;
  96. }
  97. })
  98. commit('setAcceptDetail', res.data.records)
  99. }
  100. }).catch(e => {
  101. commit('setAcceptDetail', [])
  102. reject(e)
  103. })
  104. })
  105. },
  106. // 验收提交数据
  107. submitAceptData({
  108. commit,
  109. rootState
  110. }, data) {
  111. return new Promise((resolve, reject) => {
  112. http('acceptance.subMitAceptData',
  113. data, '加载中').then(res => {
  114. if (res.success == true) {
  115. resolve()
  116. }
  117. }).catch(e => {
  118. reject(e)
  119. })
  120. })
  121. },
  122. //获取UDI码数据
  123. getUDIData({
  124. commit,
  125. rootState
  126. }, data) {
  127. return new Promise((resolve, reject) => {
  128. http('acceptance.queryUdiData',
  129. data, '加载中').then(res => {
  130. if (res.success == true) {
  131. commit('setUdiData', res.data.records)
  132. }
  133. }).catch(e => {
  134. reject(e)
  135. })
  136. })
  137. },
  138. }