index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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.push(res[0])
  97. this.$forceUpdate()
  98. }
  99. })
  100. },
  101. },
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .content-box {
  106. height: 100vh;
  107. overflow: hidden;
  108. display: flex;
  109. flex-direction: column;
  110. }
  111. .list_box {
  112. flex: 1;
  113. overflow: hidden;
  114. padding: 4rpx 0;
  115. .u-list {
  116. height: 100% !important;
  117. }
  118. .card_box {
  119. padding: 16rpx;
  120. }
  121. }
  122. .operate_box {
  123. padding: 10rpx 160rpx;
  124. /deep/ .u-button {
  125. width: 160rpx;
  126. }
  127. }
  128. </style>