malfunction.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="故障记录"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <uni-section title="故障记录" type="line">
  12. <uni-collapse>
  13. <uni-collapse-item
  14. :open="index === 0"
  15. :typeOpen="1"
  16. :show-animation="true"
  17. v-for="(item, index) in tableData"
  18. :key="item.id"
  19. >
  20. <template v-slot:title>
  21. <view class="modle-info">
  22. <view class="modle-line">
  23. <view>
  24. {{ item.repairsPerson }}
  25. </view>
  26. <view>{{ item.repairsCode }}</view>
  27. </view>
  28. <view class="modle-line">
  29. <view>{{ item.createTime }}</view>
  30. </view>
  31. </view>
  32. </template>
  33. <CellInfo label="来源类型" :value="item.source.desc"></CellInfo>
  34. <CellInfo label="来源单号" :value="item.sourceCode"></CellInfo>
  35. <CellInfo
  36. :label="index === 0 ? '维修工单编号' : ''"
  37. :value="item"
  38. v-for="(item, index) in item.workOrderCodeList"
  39. ></CellInfo>
  40. <CellInfo label="验收人" :value="item.repairsPerson"></CellInfo>
  41. <CellInfo label="验收时间" :value="item.finishTime"></CellInfo>
  42. </uni-collapse-item>
  43. </uni-collapse>
  44. </uni-section>
  45. </view>
  46. </template>
  47. <script>
  48. import CellInfo from '@/components/CellInfo.vue'
  49. import { postJ } from '@/utils/api.js'
  50. let [page, size, isEnd] = [1, 20, true]
  51. export default {
  52. components: {
  53. CellInfo
  54. },
  55. data () {
  56. return {
  57. info: {},
  58. tableData: []
  59. }
  60. },
  61. onLoad (option) {
  62. this.info = JSON.parse(decodeURIComponent(option.info))
  63. },
  64. onShow () {
  65. page = 1
  66. this.getData()
  67. },
  68. onReachBottom () {
  69. if (isEnd) {
  70. return
  71. }
  72. page++
  73. this.getData()
  74. },
  75. methods: {
  76. getData () {
  77. postJ(this.apiUrl + `/repair/info/getPage?page=${page}&size=${size}`, {
  78. equiCode: this.info.assetCode
  79. }).then(res => {
  80. if (res.success) {
  81. if (page === 1) {
  82. this.tableData = res.data.records
  83. } else {
  84. this.tableData.push(...res.data.records)
  85. }
  86. isEnd = this.tableData.length >= res.data.total
  87. }
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style scoped lang="scss">
  94. .mainBox {
  95. /deep/.uni-collapse-item__title {
  96. background-color: rgba(215, 215, 215, 1);
  97. }
  98. /deep/.uni-collapse-item__wrap {
  99. background-color: rgba(244, 244, 244, 1);
  100. }
  101. .modle-info {
  102. .modle-line {
  103. width: 94%;
  104. margin: 0 auto;
  105. display: flex;
  106. align-items: center;
  107. justify-content: space-between;
  108. padding: 20rpx 0;
  109. font-size: 28rpx;
  110. .line-status {
  111. display: inline-block;
  112. background: #47975a;
  113. padding: 6rpx 12rpx;
  114. border-radius: 10rpx;
  115. margin-left: 20rpx;
  116. color: #fff;
  117. font-size: 20rpx;
  118. }
  119. }
  120. .modle-line:last-child {
  121. color: #999;
  122. padding: 0rpx 0 20rpx;
  123. }
  124. }
  125. }
  126. </style>