jobBooking.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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" right-icon="scan" @clickRight="HandlScanCode">
  5. </uni-nav-bar>
  6. <view class="list_box">
  7. <u-list @scrolltolower="scrolltolower">
  8. <view class="card_box">
  9. <workOrderBom :item='objData' v-if='objData' @handleScan='handleScan'></workOrderBom>
  10. <sampleBom :item='objData.quality' v-if='objData.quality' :workReportInfo='objData.workReportInfo'
  11. :isDetails='true'></sampleBom>
  12. </view>
  13. </u-list>
  14. </view>
  15. <view class="bottom-wrapper">
  16. <view class="btn_box" @click="save">一键报工</view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. getByIdReport,
  23. jobSave
  24. } from '@/api/pda/jobBooking.js'
  25. import sampleBom from '../components/sampleBom.vue'
  26. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  27. export default {
  28. components: {
  29. workOrderBom,
  30. sampleBom
  31. },
  32. data() {
  33. return {
  34. title: '',
  35. objData: {},
  36. id: null,
  37. taskId: null,
  38. }
  39. },
  40. onLoad(options) {
  41. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  42. this.id = options.workOrderId
  43. this.taskId = options.taskId
  44. this.getList()
  45. },
  46. onShow() {
  47. },
  48. methods: {
  49. getList() {
  50. getByIdReport(this.id, this.taskId).then(res => {
  51. res.workReportInfo = {
  52. formedNum: null,
  53. taskId: this.taskId,
  54. reportType: 2,
  55. formingNum: res.formingNum,
  56. formingWeight: res.formingWeight,
  57. formedWeight: res.formedWeight,
  58. }
  59. this.objData = res
  60. if (this.objData.quality && this.objData.quality.sampleList.length > 0) {
  61. let _count = 0
  62. this.objData.quality.sampleList.forEach(e => {
  63. _count = _count + Number(e.num)
  64. })
  65. this.objData.workReportInfo.formedNum = res.formedNumLast - _count
  66. }
  67. })
  68. },
  69. scrolltolower() {},
  70. save() {
  71. if (Number(this.objData.workReportInfo.formedNum) <= 0 || this.objData.workReportInfo.formedNum == null) {
  72. uni.showToast({
  73. icon: 'none',
  74. title: '请输入合格数量'
  75. })
  76. return false
  77. }
  78. jobSave(this.objData).then(res => {
  79. uni.navigateBack()
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .content-box {
  87. height: 100vh;
  88. overflow: hidden;
  89. display: flex;
  90. flex-direction: column;
  91. }
  92. .list_box {
  93. flex: 1;
  94. overflow: hidden;
  95. padding: 4rpx 0;
  96. .u-list {
  97. height: 100% !important;
  98. }
  99. .card_box {
  100. padding: 16rpx 24rpx;
  101. }
  102. }
  103. .bottom-wrapper {
  104. .btn_box {
  105. width: 750rpx;
  106. height: 88rpx;
  107. line-height: 88rpx;
  108. background: $theme-color;
  109. text-align: center;
  110. font-size: 36rpx;
  111. font-style: normal;
  112. font-weight: 400;
  113. color: #fff;
  114. }
  115. }
  116. .search_list {
  117. min-height: 500rpx;
  118. padding: 0 32rpx;
  119. }
  120. </style>