quality.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. console.log(id)
  88. let _this = this
  89. // _this.scanItData('w0300000002579001', id)
  90. // return false
  91. uni.scanCode({
  92. success: function(res) {
  93. _this.scanItData(res.result, id)
  94. }
  95. })
  96. },
  97. scanItData(result, id) {
  98. scanLedger(result).then(res => {
  99. let _arr = []
  100. if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 设备
  101. this.objData.turnover = res
  102. this.$forceUpdate()
  103. }
  104. })
  105. },
  106. handAdd(id) {
  107. const storageKey = Date.now() + "";
  108. uni.setStorageSync(storageKey, this.objData);
  109. uni.navigateTo({
  110. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  111. })
  112. },
  113. },
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .content-box {
  118. height: 100vh;
  119. overflow: hidden;
  120. display: flex;
  121. flex-direction: column;
  122. }
  123. .list_box {
  124. flex: 1;
  125. overflow: hidden;
  126. padding: 4rpx 0;
  127. .u-list {
  128. height: 100% !important;
  129. }
  130. .card_box {
  131. padding: 16rpx;
  132. }
  133. }
  134. .operate_box {
  135. padding: 10rpx 160rpx;
  136. /deep/ .u-button {
  137. width: 160rpx;
  138. }
  139. }
  140. </style>