index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. </view>
  15. </u-list>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. getByIdReport,
  22. getByCodeReport
  23. } from '@/api/pda/jobBooking.js'
  24. import workOrderBom from '../../feeding/components/workOrderBom.vue'
  25. import deviceBom from '../../feeding/components/deviceBom.vue'
  26. import modelBom from '../../feeding/components/modelBom.vue'
  27. import jobBom from '../components/jobBom.vue'
  28. export default {
  29. components: {
  30. workOrderBom,
  31. deviceBom,
  32. modelBom,
  33. jobBom
  34. },
  35. data() {
  36. return {
  37. title: '',
  38. objData: {
  39. equipmentList: [],
  40. modelList: []
  41. },
  42. id: null,
  43. taskId: null,
  44. }
  45. },
  46. onLoad(options) {
  47. this.title = options.taskName ? options.taskName + '-报工' : '报工'
  48. this.id = options.id
  49. this.taskId = options.taskId
  50. this.getList()
  51. },
  52. methods: {
  53. // 相机扫码
  54. HandlScanCode() {
  55. let _this = this
  56. uni.scanCode({
  57. success: function(res) {
  58. console.log(res)
  59. }
  60. })
  61. },
  62. handleScan(id, type) {
  63. let _this = this
  64. uni.scanCode({
  65. success: function(res) {
  66. _this.scanData(res.result, type, id)
  67. }
  68. })
  69. },
  70. scanData(result, type, id) {
  71. if (type == 'wordOrder') {
  72. getByCodeReport(result, this.taskId).then(res => {
  73. this.objData = res
  74. })
  75. }
  76. },
  77. getList() {
  78. getByIdReport(this.id, this.taskId).then(res => {
  79. this.objData = res
  80. })
  81. },
  82. scrolltolower() {}
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .content-box {
  88. height: 100vh;
  89. overflow: hidden;
  90. display: flex;
  91. flex-direction: column;
  92. }
  93. .list_box {
  94. flex: 1;
  95. overflow: hidden;
  96. padding: 4rpx 0;
  97. .u-list {
  98. height: 100% !important;
  99. }
  100. .card_box {
  101. padding: 16rpx 24rpx;
  102. }
  103. }
  104. </style>