index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#F7F9FA"
  4. color="#000" @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode"></uni-nav-bar>
  5. <view class="list_box">
  6. <u-list @scrolltolower="scrolltolower">
  7. <view v-for="(item,index) in List" :key="index" class="card_box">
  8. <workOrderBom :item='item' @handleScan='handleWordScan'></workOrderBom>
  9. <turnoverBom v-if='item.turnover.length != 0' :list='item.turnover' :wordItem='item'
  10. :newTurnover='item.newTurnover' @handleScan='handleScan' @refreshList='getList'></turnoverBom>
  11. </view>
  12. </u-list>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  18. import turnoverBom from '../components/turnoverBom.vue'
  19. import {
  20. getVehicle,
  21. scanLedger
  22. } from '@/api/pda/workOrder.js'
  23. export default {
  24. components: {
  25. workOrderBom,
  26. turnoverBom
  27. },
  28. data() {
  29. return {
  30. title: '',
  31. workOrderId: null,
  32. List: [],
  33. taskId: null,
  34. }
  35. },
  36. onLoad(options) {
  37. this.title = options.taskName ? options.taskName + '-更换周转车' : '更换周转车'
  38. this.workOrderId = options.workOrderId;
  39. this.taskId = options.taskId
  40. this.taskName = options.taskName
  41. this.getList()
  42. },
  43. methods: {
  44. scrolltolower() {},
  45. getList() {
  46. getVehicle({
  47. workOrderId: this.workOrderId,
  48. taskId: this.taskId
  49. }).then(res => {
  50. this.List = []
  51. if (res.turnover && res.turnover.length) {
  52. res.newTurnover = []
  53. res.turnover.forEach(e => {
  54. e.extInfo.positionList.length && e.extInfo.positionList.forEach(o => {
  55. o['check'] = false
  56. o['isend'] = false
  57. o['newQuantity'] = o.quantity
  58. })
  59. })
  60. }
  61. this.List.push(res)
  62. })
  63. },
  64. handleWordScan(id, type) {
  65. uni.showToast({
  66. icon: 'none',
  67. title: '不支持更换工单'
  68. })
  69. },
  70. handleScan(id, type) {
  71. uni.scanCode({
  72. success: (res) => {
  73. this.scanData(res.result, type, id)
  74. }
  75. })
  76. },
  77. // 相机扫码
  78. HandlScanCode() {
  79. uni.scanCode({
  80. success: (res) => {
  81. this.scanItAllData(res.result)
  82. }
  83. })
  84. },
  85. scanItAllData(result) {
  86. scanLedger(result).then(res => {
  87. if (res[0].rootCategoryLevelId == 7) { // 周转车
  88. // let isFals = this.List[0].turnover.some(m => m.code == result)
  89. // if (isFals) {
  90. // uni.showToast({
  91. // title: '周转车已存在',
  92. // icon: 'none'
  93. // })
  94. // return false
  95. // }
  96. this.List[0].turnover = []
  97. let _List = JSON.parse(JSON.stringify(this.List))
  98. _List[0]['newTurnover'] = []
  99. res[0].isOld = 1
  100. res[0].extInfo.positionList.length && res[0].extInfo.positionList.forEach(o => {
  101. o['check'] = false
  102. o['isend'] = false
  103. o['newQuantity'] = o.quantity
  104. })
  105. _List[0].turnover = res
  106. this.List = _List
  107. console.log(this.List)
  108. this.$forceUpdate()
  109. }
  110. })
  111. },
  112. },
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .content-box {
  117. height: 100vh;
  118. overflow: hidden;
  119. display: flex;
  120. flex-direction: column;
  121. }
  122. .list_box {
  123. flex: 1;
  124. overflow: hidden;
  125. padding: 4rpx 0;
  126. .u-list {
  127. height: 100% !important;
  128. }
  129. .card_box {
  130. padding: 16rpx;
  131. }
  132. }
  133. .operate_box {
  134. padding: 10rpx 160rpx;
  135. /deep/ .u-button {
  136. width: 160rpx;
  137. }
  138. }
  139. </style>