index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. }
  42. },
  43. onLoad(options) {
  44. this.title = options.taskName ? options.taskName : '质检'
  45. this.id = options.workOrderId
  46. this.taskId = options.taskId
  47. this.getList()
  48. },
  49. methods: {
  50. getList() {
  51. workorderList({
  52. ids: [this.id],
  53. taskId: this.taskId
  54. }).then(res => {
  55. this.List = res.map(m => {
  56. m.workOrderId = m.id
  57. m.quality['sampleList'] = []
  58. m.feedType = 2
  59. delete m.id
  60. return {
  61. ...m
  62. }
  63. })
  64. })
  65. },
  66. scrolltolower() {},
  67. handleWordScan() {
  68. uni.showToast({
  69. icon: 'none',
  70. title: '不支持换工单'
  71. })
  72. },
  73. save() {
  74. console.log(this.List)
  75. this.count = 0;
  76. this.List[0].quality.sampleList.forEach(e => {
  77. if (Number(e.num) > 0 && Number(e.num) != NaN) {
  78. this.count += Number(e.num);
  79. }
  80. })
  81. if (this.List[0].quality.sampleNum != this.count) {
  82. uni.showToast({
  83. icon: 'none',
  84. title: '处置数量和取样数量对应不上'
  85. })
  86. return false
  87. }
  88. batchSave(this.List).then(res => {
  89. uni.navigateBack()
  90. })
  91. },
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .content-box {
  97. height: 100vh;
  98. overflow: hidden;
  99. display: flex;
  100. flex-direction: column;
  101. }
  102. .list_box {
  103. flex: 1;
  104. overflow: hidden;
  105. padding: 4rpx 0;
  106. .u-list {
  107. height: 100% !important;
  108. }
  109. .card_box {
  110. padding: 16rpx 24rpx;
  111. }
  112. }
  113. .bottom-wrapper {
  114. .btn_box {
  115. width: 750rpx;
  116. height: 88rpx;
  117. line-height: 88rpx;
  118. background: $theme-color;
  119. text-align: center;
  120. font-size: 36rpx;
  121. font-style: normal;
  122. font-weight: 400;
  123. color: #fff;
  124. }
  125. }
  126. .operate_box {
  127. padding: 10rpx 160rpx;
  128. /deep/ .u-button {
  129. width: 160rpx;
  130. }
  131. }
  132. </style>