index.vue 2.7 KB

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