job.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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="180" labelAlign="left" style="margin-top: 40rpx;">
  14. <u-form-item label="合格数量:" class="required-form" borderBottom prop="formingNum">
  15. <input class="uni-input" v-model="formingNum" 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. formingNum: 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. formingNum: null,
  72. taskId: this.taskId,
  73. reportType: 3
  74. }
  75. this.formedNumLast = res.formedNumLast
  76. this.formingNum = 0
  77. res.normalQuality.forEach(f => {
  78. this.formingNum = this.formedNumLast - Number(f.quantity)
  79. })
  80. this.lastObj = {
  81. formedNum: res.formedNumLast,
  82. diagramLast: {
  83. taskTypeName: res.taskNameLast
  84. }
  85. }
  86. this.objData = res
  87. })
  88. },
  89. save() {
  90. this.objData.workReportInfo.formingNum = this.formingNum
  91. console.log(this.objData.workReportInfo)
  92. if (Number(this.objData.workReportInfo.formingNum) < 0 || this.objData.workReportInfo.formingNum == null) {
  93. uni.showToast({
  94. icon: 'none',
  95. title: '合格数量不能小于0'
  96. })
  97. return false
  98. }
  99. jobSave(this.objData).then(res => {
  100. if (res) {
  101. uni.navigateBack()
  102. }
  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. /deep/ .uni-input-input {
  146. border: 2rpx solid #F0F8F2;
  147. background: #F0F8F2;
  148. color: $theme-color;
  149. }
  150. </style>