index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="fault-page">
  3. <navigation title="故障处理"></navigation>
  4. <view class="list-box" v-if="dataList.length>0">
  5. <view class="datetime-picker-box">
  6. <uni-datetime-picker v-model="single" type="date" @change="confirm" :border="false" />
  7. </view>
  8. <view class="list-item" v-for="(item, index) in dataList" :key="index">
  9. <view class="item-text">设备名称:{{ item.equipmentName || '-' }}</view>
  10. <view class="item-text">故障发生时间:{{ item.createTime || '-' }}</view>
  11. <view class="item-text">重新运行时间:{{ item.relieveTime || '-' }}</view>
  12. <view class="item-text">故障时长:{{ dayjs(item.relieveTime).diff(dayjs(item.createTime), 'minute') }}</view>
  13. </view>
  14. </view>
  15. <empty v-else text="暂无数据"></empty>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. dataList: [],
  23. single: '',
  24. }
  25. },
  26. onShow() {
  27. this.single = this.dayjs().format('YYYY-MM-DD')
  28. this.getList()
  29. },
  30. methods: {
  31. confirm(e) {
  32. this.single = e
  33. this.getList()
  34. },
  35. getList() {
  36. uni.showLoading({
  37. title: '正在加载...'
  38. })
  39. let params = {
  40. createTime: this.single
  41. }
  42. this.$api.iofaultList(params).then(res => {
  43. this.dataList = res.rows
  44. uni.hideLoading()
  45. }).catch(err => {})
  46. },
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .fault-page {
  52. .list-box {
  53. padding: 0 20rpx;
  54. color: $uni-text-color-list;
  55. .datetime-picker-box {
  56. background-color: $uni-bg-color;
  57. width: 100%;
  58. margin-top: 20rpx;
  59. }
  60. .list-item {
  61. background-color: $uni-bg-color;
  62. padding: 20rpx;
  63. border-radius: 20rpx;
  64. margin-top: 28rpx;
  65. .item-text {
  66. margin-top: 10rpx;
  67. }
  68. }
  69. .btn-box {
  70. display: flex;
  71. justify-content: flex-end;
  72. margin-top: 10rpx;
  73. .btn-item {
  74. width: 175rpx;
  75. height: 50rpx;
  76. line-height: 50rpx;
  77. text-align: center;
  78. border-radius: 24rpx;
  79. margin-left: 20rpx;
  80. border: 1px solid #43adfd;
  81. color: #43adfd;
  82. }
  83. }
  84. }
  85. }
  86. </style>