index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. <deviceBom v-if='objData.equipmentList.length != 0' :list='objData.equipmentList'></deviceBom>
  11. <modelBom v-if='objData.modelList.length != 0' :list='objData.modelList'>
  12. </modelBom>
  13. <jobBom :item='objData'></jobBom>
  14. <byProductBom v-if='objData.productRecycleList != 0 ' :list='objData.productRecycleList'></byProductBom>
  15. </view>
  16. </u-list>
  17. </view>
  18. <view class="bottom-wrapper">
  19. <view class="btn_box" @click="save">一键报工</view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. getByIdReport,
  26. getByCodeReport
  27. } from '@/api/pda/jobBooking.js'
  28. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  29. import deviceBom from '../../feeding/components/deviceBom.vue'
  30. import modelBom from '../../feeding/components/modelBom.vue'
  31. import jobBom from '../components/jobBom.vue'
  32. import byProductBom from '../components/byProductBom'
  33. export default {
  34. components: {
  35. workOrderBom,
  36. deviceBom,
  37. modelBom,
  38. jobBom,
  39. byProductBom
  40. },
  41. data() {
  42. return {
  43. title: '',
  44. objData: {
  45. equipmentList: [],
  46. modelList: []
  47. },
  48. id: null,
  49. taskId: null,
  50. }
  51. },
  52. onLoad(options) {
  53. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  54. this.id = options.id
  55. this.taskId = options.taskId
  56. this.getList()
  57. },
  58. methods: {
  59. // 相机扫码
  60. HandlScanCode() {
  61. let _this = this
  62. uni.scanCode({
  63. success: function(res) {
  64. console.log(res)
  65. }
  66. })
  67. },
  68. handleScan(id, type) {
  69. let _this = this
  70. uni.scanCode({
  71. success: function(res) {
  72. _this.scanData(res.result, type, id)
  73. }
  74. })
  75. },
  76. scanData(result, type, id) {
  77. if (type == 'wordOrder') {
  78. getByCodeReport(result, this.taskId).then(res => {
  79. this.objData = res
  80. })
  81. }
  82. },
  83. getList() {
  84. getByIdReport(this.id, this.taskId).then(res => {
  85. this.objData = res
  86. })
  87. },
  88. scrolltolower() {},
  89. save() {}
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .content-box {
  95. height: 100vh;
  96. overflow: hidden;
  97. display: flex;
  98. flex-direction: column;
  99. }
  100. .list_box {
  101. flex: 1;
  102. overflow: hidden;
  103. padding: 4rpx 0;
  104. .u-list {
  105. height: 100% !important;
  106. }
  107. .card_box {
  108. padding: 16rpx 24rpx;
  109. }
  110. }
  111. .bottom-wrapper {
  112. .btn_box {
  113. width: 750rpx;
  114. height: 88rpx;
  115. line-height: 88rpx;
  116. background: $theme-color;
  117. text-align: center;
  118. font-size: 36rpx;
  119. font-style: normal;
  120. font-weight: 400;
  121. color: #fff;
  122. }
  123. }
  124. </style>