job.vue 3.9 KB

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