quality.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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"></uni-nav-bar>
  5. <view class="list_box">
  6. <u-list @scrolltolower="scrolltolower">
  7. <view class="card_box">
  8. <workOrderBom :item='objData' @handleScan='handleWordScan'></workOrderBom>
  9. <qualityTurnoverBom v-if='objData.turnover && objData.turnover.length != 0' :list='objData.turnover'
  10. :wordItem='objData' :newTurnover='objData.newTurnover' @refreshList='getList'>
  11. </qualityTurnoverBom>
  12. <view class="operate_box rx-sc">
  13. <u-button size="small" class="u-reset-button" type="success"
  14. @click="handAdd(objData.id)">手动添加</u-button>
  15. <u-button size="small" class="u-reset-button" type="success"
  16. @click="scanIt(objData.id)">扫一扫</u-button>
  17. </view>
  18. </view>
  19. </u-list>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  25. import qualityTurnoverBom from '../components/qualityTurnoverBom.vue'
  26. import {
  27. getVehicle,
  28. scanLedger
  29. } from '@/api/pda/workOrder.js'
  30. export default {
  31. components: {
  32. workOrderBom,
  33. qualityTurnoverBom
  34. },
  35. data() {
  36. return {
  37. title: '',
  38. workOrderId: null,
  39. objData: {},
  40. taskId: null
  41. }
  42. },
  43. onShow() {
  44. uni.$off("setSelectList");
  45. uni.$on("setSelectList", (selectList, id) => {
  46. let turnover = []
  47. selectList.forEach(f => {
  48. if (f.rootCategoryLevelId == 7) { // 周转车
  49. f.extInfo.positionList.length && f.extInfo.positionList.forEach(o => {
  50. o['check'] = false
  51. o['isend'] = false
  52. })
  53. turnover = turnover.concat(f)
  54. }
  55. })
  56. this.$set(this.objData, 'turnover', turnover)
  57. this.$forceUpdate()
  58. });
  59. },
  60. onLoad(options) {
  61. this.title = options.taskName ? options.taskName + '-更换周转车' : '更换周转车'
  62. this.workOrderId = options.workOrderId;
  63. this.taskId = options.taskId
  64. this.taskName = options.taskName
  65. this.getList()
  66. },
  67. methods: {
  68. scrolltolower() {},
  69. getList() {
  70. getVehicle({
  71. workOrderId: this.workOrderId,
  72. taskId: this.taskId
  73. }).then(res => {
  74. if (!res.hasOwnProperty('turnover')) {
  75. res['turnover'] = []
  76. }
  77. this.objData = res
  78. })
  79. },
  80. handleWordScan(id, type) {
  81. uni.showToast({
  82. icon: 'none',
  83. title: '不支持更换工单'
  84. })
  85. },
  86. scanIt(id) {
  87. // this.scanItData('w0300000002579001', id)
  88. // return false
  89. uni.scanCode({
  90. success: (res) => {
  91. this.scanItData(res.result, id)
  92. }
  93. })
  94. },
  95. scanItData(result, id) {
  96. scanLedger(result).then(res => {
  97. let _arr = []
  98. if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 设备
  99. this.objData.turnover = res
  100. this.$forceUpdate()
  101. }
  102. })
  103. },
  104. handAdd(id) {
  105. const storageKey = Date.now() + "";
  106. uni.setStorageSync(storageKey, this.objData);
  107. uni.navigateTo({
  108. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  109. })
  110. },
  111. },
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .content-box {
  116. height: 100vh;
  117. overflow: hidden;
  118. display: flex;
  119. flex-direction: column;
  120. }
  121. .list_box {
  122. flex: 1;
  123. overflow: hidden;
  124. padding: 4rpx 0;
  125. .u-list {
  126. height: 100% !important;
  127. }
  128. .card_box {
  129. padding: 16rpx;
  130. }
  131. }
  132. .operate_box {
  133. padding: 10rpx 160rpx;
  134. /deep/ .u-button {
  135. width: 160rpx;
  136. }
  137. }
  138. </style>