job.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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">
  9. <workOrderBom :item='objData' v-if='objData' @handleScan='handleWordScan'></workOrderBom>
  10. <diagramLast v-if='lastObj' :item='lastObj'>
  11. </diagramLast>
  12. <qualityStat :normalQuality='objData.normalQuality' v-if='objData'></qualityStat>
  13. <u-form labelPosition="left" labelWidth="160" labelAlign="center" style="margin-top: 40rpx;">
  14. <u-form-item label="合格数量" class="required-form" borderBottom prop="formedNum">
  15. <input class="uni-input" v-model="formedNum" type='digit'></input>
  16. </u-form-item>
  17. </u-form>
  18. </view>
  19. </u-list>
  20. </view>
  21. <view class="bottom-wrapper">
  22. <view class="btn_box" @click="save">一键报工</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. getByIdReport,
  29. jobSave
  30. } from '@/api/pda/jobBooking.js'
  31. import {
  32. junkCount
  33. } from '@/api/pda/workOrder.js'
  34. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  35. import qualityStat from '../components/qualityStat.vue'
  36. import diagramLast from '../components/diagramLast.vue'
  37. export default {
  38. components: {
  39. workOrderBom,
  40. qualityStat,
  41. diagramLast
  42. },
  43. data() {
  44. return {
  45. title: null,
  46. objData: null,
  47. lastObj: null,
  48. feedCount: null,
  49. formedNum: 0,
  50. formedNumLast: 0
  51. }
  52. },
  53. onLoad(options) {
  54. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  55. this.id = options.workOrderId
  56. this.taskId = options.taskId
  57. this.getList()
  58. },
  59. created() {
  60. },
  61. methods: {
  62. handleWordScan() {
  63. uni.showToast({
  64. icon: 'none',
  65. title: '不支持换工单'
  66. })
  67. },
  68. getList() {
  69. getByIdReport(this.id, this.taskId).then(res => {
  70. res.workReportInfo = {
  71. formedNum: null,
  72. taskId: this.taskId,
  73. reportType: 3,
  74. formingNum: res.formingNum,
  75. formingWeight: res.formingWeight,
  76. formedWeight: res.formedWeight,
  77. }
  78. this.formedNumLast = res.formedNumLast
  79. this.formedNum = 0
  80. res.normalQuality.forEach(f => {
  81. this.formedNumLast = this.formedNumLast - Number(f.quantity)
  82. this.formedNum = this.formedNumLast
  83. })
  84. this.lastObj = {
  85. formedNum: res.formedNumLast,
  86. taskNameLast: res.taskNameLast,
  87. unit: res.unit
  88. }
  89. this.objData = res
  90. })
  91. },
  92. scrolltolower() {},
  93. save() {
  94. this.objData.workReportInfo.formedNum = this.formedNum
  95. console.log(this.objData.workReportInfo)
  96. if (Number(this.objData.workReportInfo.formedNum) < 0 || this.objData.workReportInfo.formedNum == null) {
  97. uni.showToast({
  98. icon: 'none',
  99. title: '合格数量不能小于0'
  100. })
  101. return false
  102. }
  103. jobSave(this.objData).then(res => {
  104. uni.navigateBack()
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .content-box {
  112. height: 100vh;
  113. overflow: hidden;
  114. display: flex;
  115. flex-direction: column;
  116. }
  117. .list_box {
  118. flex: 1;
  119. overflow: hidden;
  120. padding: 4rpx 0;
  121. .u-list {
  122. height: 100% !important;
  123. }
  124. .card_box {
  125. padding: 16rpx 24rpx;
  126. }
  127. }
  128. .bottom-wrapper {
  129. .btn_box {
  130. width: 750rpx;
  131. height: 88rpx;
  132. line-height: 88rpx;
  133. background: $theme-color;
  134. text-align: center;
  135. font-size: 36rpx;
  136. font-style: normal;
  137. font-weight: 400;
  138. color: #fff;
  139. }
  140. }
  141. .operate_box {
  142. padding: 10rpx 160rpx;
  143. /deep/ .u-button {
  144. width: 160rpx;
  145. }
  146. }
  147. /deep/ .uni-input-input {
  148. border: 2rpx solid #F0F8F2;
  149. background: #F0F8F2;
  150. color: $theme-color;
  151. }
  152. </style>