job.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. <inspectionBom v-if='objData && Object.prototype.hasOwnProperty.call(objData, "semiProductList") && objData.semiProductList.length' :semiProductList='objData.semiProductList'></inspectionBom>
  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 diagramLast from '../components/diagramLast.vue'
  37. import deviceBom from '../../feeding/components/deviceBom.vue'
  38. import inspectionBom from "../components/inspectionBom.vue";
  39. export default {
  40. components: {
  41. workOrderBom,
  42. diagramLast,
  43. deviceBom,
  44. inspectionBom
  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. let _num = 0
  84. res.semiProductList.forEach(f => {
  85. if( (f.extInfo.isQualified == 2 && Object.prototype.hasOwnProperty.call(f.extInfo, "notType") && f.extInfo.notType != 5) ) {
  86. _num = _num + 1
  87. }
  88. })
  89. this.formedNumLast = this.formedNumLast - Number(_num)
  90. this.formedNum = this.formedNumLast
  91. this.lastObj = {
  92. formedNum: res.formedNumLast,
  93. taskNameLast: res.taskNameLast,
  94. unit: res.unit
  95. }
  96. this.objData = res
  97. })
  98. },
  99. scrolltolower() {},
  100. save() {
  101. this.objData.workReportInfo.formedNum = this.formedNum
  102. console.log(this.objData.workReportInfo)
  103. if (Number(this.objData.workReportInfo.formedNum) < 0 || this.objData.workReportInfo.formedNum == null) {
  104. uni.showToast({
  105. icon: 'none',
  106. title: '合格数量不能小于0'
  107. })
  108. return false
  109. }
  110. jobSave(this.objData).then(res => {
  111. uni.navigateBack()
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .content-box {
  119. height: 100vh;
  120. overflow: hidden;
  121. display: flex;
  122. flex-direction: column;
  123. }
  124. .list_box {
  125. flex: 1;
  126. overflow: hidden;
  127. padding: 4rpx 0;
  128. .u-list {
  129. height: 100% !important;
  130. }
  131. .card_box {
  132. padding: 16rpx;
  133. }
  134. }
  135. .bottom-wrapper {
  136. .btn_box {
  137. width: 750rpx;
  138. height: 88rpx;
  139. line-height: 88rpx;
  140. background: $theme-color;
  141. text-align: center;
  142. font-size: 36rpx;
  143. font-style: normal;
  144. font-weight: 400;
  145. color: #fff;
  146. }
  147. }
  148. .operate_box {
  149. padding: 10rpx 160rpx;
  150. /deep/ .u-button {
  151. width: 160rpx;
  152. }
  153. }
  154. /deep/ .uni-input-input {
  155. border: 2rpx solid #F0F8F2;
  156. background: #F0F8F2;
  157. color: $theme-color;
  158. }
  159. </style>