index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="repair-page">
  3. <navigation title="设备报修"></navigation>
  4. <view class="list-box" v-if="dataList.length>0">
  5. <view class="add" @click="addInfo">
  6. <image class="icon" src="@/static/add.jpg"></image>
  7. <view class="text">新增</view>
  8. </view>
  9. <view class="list-item" v-for="(item, index) in dataList" :key="index">
  10. <view class="item-text">工单编号:{{ item.num || '-' }}</view>
  11. <view class="item-text">设备名称:{{ item.equipmentName || '-' }}</view>
  12. <view class="item-text">工单描述:{{ item.orderMsg || '-' }}</view>
  13. <view class="item-text">提交人:{{ item.createUserName || '-' }}</view>
  14. <view class="item-text">发生时间:{{ item.happenTime || '-' }}</view>
  15. <view class="btn-box">
  16. <view class="btn-item" @click="toDetail(item.id)">
  17. <view>详情</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <empty v-else text="暂无报修数据" :showBtn="true" @onAdd="addInfo"></empty>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. dataList: [],
  30. userId: uni.getStorageSync('userInfo').id
  31. }
  32. },
  33. onShow() {
  34. this.getList()
  35. },
  36. methods: {
  37. getList() {
  38. uni.showLoading({
  39. title: '正在加载...'
  40. })
  41. this.$api.workOrderList({
  42. createUserId: this.userId
  43. }).then(res => {
  44. this.dataList = res.rows
  45. uni.hideLoading()
  46. }).catch(err => {})
  47. },
  48. addInfo() {
  49. uni.navigateTo({
  50. url: '/subPackages/repair/add'
  51. });
  52. },
  53. toDetail(id) {
  54. uni.navigateTo({
  55. url: '/subPackages/repair/detail?id=' + id
  56. });
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .repair-page {
  63. .add {
  64. display: flex;
  65. justify-content: center;
  66. align-items: center;
  67. background-color: #fff;
  68. padding: 20rpx;
  69. border-radius: 16rpx;
  70. .icon {
  71. width: 50rpx;
  72. height: 50rpx;
  73. margin-right: 16rpx;
  74. }
  75. }
  76. .list-box {
  77. padding: 0 20rpx;
  78. color: $uni-text-color-list;
  79. .list-item {
  80. background-color: $uni-bg-color;
  81. padding: 20rpx;
  82. border-radius: 20rpx;
  83. margin-top: 28rpx;
  84. .item-text {
  85. margin-top: 10rpx;
  86. }
  87. }
  88. .btn-box {
  89. display: flex;
  90. justify-content: flex-end;
  91. margin-top: 10rpx;
  92. .btn-item {
  93. width: 175rpx;
  94. height: 50rpx;
  95. line-height: 50rpx;
  96. text-align: center;
  97. border-radius: 24rpx;
  98. margin-left: 20rpx;
  99. border: 1px solid #43adfd;
  100. color: #43adfd;
  101. }
  102. }
  103. }
  104. }
  105. </style>