quality.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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' :wordItem='objData'
  10. :newTurnover='objData.newTurnover' @handleScan='handleScan' @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.workOrderId)">手动添加</u-button>
  15. <u-button size="small" class="u-reset-button" type="success"
  16. @click="scanIt(objData.workOrderId)">扫一扫</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. } from '@/api/pda/workOrder.js'
  29. export default {
  30. components: {
  31. workOrderBom,
  32. qualityTurnoverBom
  33. },
  34. data() {
  35. return {
  36. title: '',
  37. workOrderId: null,
  38. objData: {},
  39. taskId: null
  40. }
  41. },
  42. onShow() {
  43. uni.$off("setSelectList");
  44. uni.$on("setSelectList", (selectList, id) => {
  45. let turnover = []
  46. selectList.forEach(f => {
  47. if (f.rootCategoryLevelId == 7) { // 周转车
  48. f.extInfo.positionList.length && f.extInfo.positionList.forEach(o => {
  49. o['check'] = false
  50. o['isend'] = false
  51. })
  52. turnover = turnover.concat(f)
  53. }
  54. })
  55. this.$set(this.objData, 'turnover', turnover)
  56. this.$forceUpdate()
  57. });
  58. },
  59. onLoad(options) {
  60. this.title = options.taskName ? options.taskName + '-更换周转车' : '更换周转车'
  61. this.workOrderId = options.workOrderId;
  62. this.taskId = options.taskId
  63. this.taskName = options.taskName
  64. this.getList()
  65. },
  66. methods: {
  67. scrolltolower() {},
  68. getList() {
  69. getVehicle({
  70. workOrderId: this.workOrderId,
  71. taskId: this.taskId
  72. }).then(res => {
  73. if (!res.hasOwnProperty('turnover')) {
  74. res['turnover'] = []
  75. }
  76. this.objData = res
  77. console.log(this.objData)
  78. })
  79. },
  80. handleWordScan(id, type) {
  81. uni.showToast({
  82. icon: 'none',
  83. title: '不支持更换工单'
  84. })
  85. },
  86. handleScan(id, type) {
  87. let _this = this
  88. uni.scanCode({
  89. success: function(res) {
  90. _this.scanData(res.result, type, id)
  91. }
  92. })
  93. },
  94. handAdd(id) {
  95. const storageKey = Date.now() + "";
  96. uni.setStorageSync(storageKey, this.objData);
  97. uni.navigateTo({
  98. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
  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>