index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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">
  5. </uni-nav-bar>
  6. <view class="list_box">
  7. <u-list @scrolltolower="scrolltolower">
  8. <view class="card_box" v-for="(item,index) in List" :key="index">
  9. <workOrderBom :item='item' v-if='item' @handleScan='handleWordScan'></workOrderBom>
  10. <sampleBom :item='item.quality' v-if='item.quality' :isDetails='false'></sampleBom>
  11. </view>
  12. </u-list>
  13. </view>
  14. <view class="bottom-wrapper">
  15. <view class="btn_box" @click="save">一键报工</view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. workorderList,
  23. } from '@/api/pda/workOrder.js'
  24. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  25. import sampleBom from '../components/sampleBom.vue'
  26. import {
  27. batchSave
  28. } from '@/api/pda/feeding.js'
  29. export default {
  30. components: {
  31. workOrderBom,
  32. sampleBom
  33. },
  34. data() {
  35. return {
  36. title: null,
  37. id: null,
  38. taskId: null,
  39. List: [],
  40. count: 0,
  41. isLastJob: true
  42. }
  43. },
  44. onLoad(options) {
  45. this.title = options.taskName ? options.taskName : '质检'
  46. this.id = options.workOrderId
  47. this.taskId = options.taskId
  48. this.getList()
  49. },
  50. methods: {
  51. getList() {
  52. workorderList({
  53. ids: [this.id],
  54. taskId: this.taskId
  55. }).then(res => {
  56. console.log(11)
  57. console.log(res)
  58. this.List = res.map(m => {
  59. m.workOrderId = m.id
  60. if (m.quality) {
  61. m.quality['sampleList'] = []
  62. } else {
  63. this.isLastJob = false
  64. }
  65. m.feedType = 2
  66. delete m.id
  67. return {
  68. ...m
  69. }
  70. })
  71. })
  72. },
  73. scrolltolower() {},
  74. handleWordScan() {
  75. uni.showToast({
  76. icon: 'none',
  77. title: '不支持换工单'
  78. })
  79. },
  80. save() {
  81. if (!this.isLastJob) {
  82. uni.showToast({
  83. icon: 'none',
  84. title: '上道工序暂未报工'
  85. })
  86. return false
  87. }
  88. this.count = 0;
  89. this.List[0].quality.sampleList.forEach(e => {
  90. if (Number(e.num) > 0 && Number(e.num) != NaN) {
  91. this.count += Number(e.num);
  92. }
  93. })
  94. if (this.List[0].quality.sampleNum != this.count) {
  95. uni.showToast({
  96. icon: 'none',
  97. title: '处置数量和取样数量对应不上'
  98. })
  99. return false
  100. }
  101. batchSave(this.List).then(res => {
  102. uni.navigateBack()
  103. })
  104. },
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .content-box {
  110. height: 100vh;
  111. overflow: hidden;
  112. display: flex;
  113. flex-direction: column;
  114. }
  115. .list_box {
  116. flex: 1;
  117. overflow: hidden;
  118. padding: 4rpx 0;
  119. .u-list {
  120. height: 100% !important;
  121. }
  122. .card_box {
  123. padding: 16rpx 24rpx;
  124. }
  125. }
  126. .bottom-wrapper {
  127. .btn_box {
  128. width: 750rpx;
  129. height: 88rpx;
  130. line-height: 88rpx;
  131. background: $theme-color;
  132. text-align: center;
  133. font-size: 36rpx;
  134. font-style: normal;
  135. font-weight: 400;
  136. color: #fff;
  137. }
  138. }
  139. .operate_box {
  140. padding: 10rpx 160rpx;
  141. /deep/ .u-button {
  142. width: 160rpx;
  143. }
  144. }
  145. </style>