index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. console.log(33,res)
  51. this.List = []
  52. if (res.turnover && res.turnover.length) {
  53. res.newTurnover = []
  54. res.turnover.forEach(e => {
  55. e.extInfo.positionList.length && e.extInfo.positionList.forEach(o => {
  56. o['check'] = false
  57. o['isend'] = false
  58. o['newQuantity'] = o.quantity
  59. })
  60. })
  61. }
  62. this.List.push(res)
  63. })
  64. },
  65. handleWordScan(id, type) {
  66. uni.showToast({
  67. icon: 'none',
  68. title: '不支持更换工单'
  69. })
  70. },
  71. handleScan(id, type) {
  72. uni.scanCode({
  73. success: (res) => {
  74. this.scanData(res.result, type, id)
  75. }
  76. })
  77. },
  78. // 相机扫码
  79. HandlScanCode() {
  80. uni.scanCode({
  81. success: (res) => {
  82. this.scanItAllData(res.result)
  83. }
  84. })
  85. },
  86. scanItAllData(result) {
  87. scanLedger(result).then(res => {
  88. if (res[0].rootCategoryLevelId == 7) { // 周转车
  89. let isFals = this.List[0].turnover.some(m => m.code == result)
  90. if (isFals) {
  91. uni.showToast({
  92. title: '周转车已存在',
  93. icon: 'none'
  94. })
  95. return false
  96. }
  97. this.List[0].turnover.push(res[0])
  98. this.$forceUpdate()
  99. }
  100. })
  101. },
  102. },
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .content-box {
  107. height: 100vh;
  108. overflow: hidden;
  109. display: flex;
  110. flex-direction: column;
  111. }
  112. .list_box {
  113. flex: 1;
  114. overflow: hidden;
  115. padding: 4rpx 0;
  116. .u-list {
  117. height: 100% !important;
  118. }
  119. .card_box {
  120. padding: 16rpx;
  121. }
  122. }
  123. .operate_box {
  124. padding: 10rpx 160rpx;
  125. /deep/ .u-button {
  126. width: 160rpx;
  127. }
  128. }
  129. </style>