index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <z-paging class="page" ref="paging" v-model="dataList" @query="queryList">
  3. <!-- z-paging默认铺满全屏,此时页面所有view都应放在z-paging标签内,否则会被盖住 -->
  4. <!-- 需要固定在页面顶部的view请通过slot="top"插入,包括自定义的导航栏 -->
  5. <view>
  6. <view class="item" v-for="(item, index) in dataList" :key="index">
  7. <uni-row class="flex-wrap" style="padding: 10px">
  8. <uni-col :span="8">{{ $t('statusChange.deviceName') + ': ' }}</uni-col>
  9. <uni-col :span="16">{{ item.deviceName }}</uni-col>
  10. <uni-col :span="8" style="margin-top: 8px">{{ $t('statusChange.deviceCode') + ': ' }}</uni-col>
  11. <uni-col :span="16" style="margin-top: 8px">{{ item.deviceCode }}</uni-col>
  12. <uni-col :span="8" style="margin-top: 8px">{{ $t('statusChange.beforeLeader') + ': ' }}</uni-col>
  13. <uni-col :span="16" style="margin-top: 8px">{{ item.oldPersonNames }}</uni-col>
  14. <uni-col :span="8" style="margin-top: 8px">{{ $t('statusChange.afterLeader') + ': ' }}</uni-col>
  15. <uni-col :span="16" style="margin-top: 8px">{{ item.newPersonNames }}</uni-col>
  16. <uni-col :span="8" style="margin-top: 8px">{{ $t('statusChange.reason') + ': ' }}</uni-col>
  17. <uni-col :span="16" style="margin-top: 8px">{{ item.reason }}</uni-col>
  18. <uni-col :span="8" style="margin-top: 8px">{{ $t('statusChange.createUser') + ': ' }}</uni-col>
  19. <uni-col :span="16" style="margin-top: 8px">{{ item.creatorName }}</uni-col>
  20. </uni-row>
  21. </view>
  22. </view>
  23. </z-paging>
  24. </template>
  25. <script setup>
  26. import { ref } from 'vue'
  27. import { onLoad } from "@dcloudio/uni-app"
  28. import { getDeviceUserHistoryList } from "@/api/deviceUser";
  29. const paging = ref(null)
  30. // v-model绑定的这个变量不要在分页请求结束中自己赋值,直接使用即可
  31. const dataList = ref([])
  32. const deviceId = ref('')
  33. onLoad((params) => {
  34. deviceId.value = params.id
  35. })
  36. // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用paging.value.reload()即可
  37. const queryList = (pageNo, pageSize) => {
  38. // 此处请求仅为演示,请替换为自己项目中的请求
  39. getDeviceUserHistoryList({
  40. pageNo,
  41. pageSize,
  42. deviceId: deviceId.value,
  43. }).then(res => {
  44. // console.log('res', res)
  45. // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
  46. paging.value.complete(res.data.list);
  47. }).catch(() => {
  48. // 如果请求失败写paging.value.complete(false);
  49. // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
  50. // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
  51. paging.value.complete(false);
  52. })
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .page {
  57. box-sizing: border-box;
  58. padding: 10px !important;
  59. }
  60. .search-row {
  61. height: 35px;
  62. position: fixed;
  63. left: 15px;
  64. width: calc(100% - 30px) !important;
  65. background: #F3F5F9;
  66. z-index: 10;
  67. .mini-btn {
  68. height: 35px;
  69. line-height: 35px;
  70. width: calc(100% - 10px);
  71. margin-left: 10px;
  72. }
  73. }
  74. .item {
  75. width: 100%;
  76. background: #FFFFFF;
  77. border-radius: 6px;
  78. margin-top: 10px;
  79. font-size: 14px;
  80. }
  81. .item-module {
  82. width: 100%;
  83. height: 42px;
  84. box-sizing: border-box;
  85. padding: 10px 15px 10px 10px;
  86. border-radius: 6px 6px 0 0;
  87. background: linear-gradient(270deg, #FFFFFF 0%, #8EBEFF 100%);
  88. &.tobeFilled {
  89. background: linear-gradient(270deg, #FFFFFF 0%, #FFF0F0 100%);
  90. }
  91. .module-status {
  92. // min-width: 60px;
  93. height: 23px;
  94. padding: 0 6px;
  95. background: #FFEBEB;
  96. border-radius: 3px;
  97. border: 1px solid #FFFFFF;
  98. text-align: center;
  99. font-weight: 500;
  100. font-size: 16px;
  101. line-height: 23px;
  102. color: #E7000D;
  103. }
  104. }
  105. .item-title-width {
  106. min-width: 70px;
  107. }
  108. .item-title-bg {
  109. background: linear-gradient( 270deg, #FFFFFF 0%, #8EBEFF 100%);
  110. border-radius: 6px 6px 0 0;
  111. padding: 10px;
  112. display: flex;
  113. justify-content: space-between;
  114. }
  115. .item-title {
  116. font-size: 16px;
  117. color: #333333;
  118. flex: 1;
  119. }
  120. .item-status {
  121. padding: 4px 14px;
  122. background: #EBF5FF;
  123. border-radius: 3px;
  124. border: 1px solid #FFFFFF;
  125. color: #004098;
  126. font-size: 14px;
  127. }
  128. .item-button {
  129. background: #FFFFFF;
  130. border-radius: 3px;
  131. border: 1px solid #004098;
  132. color: #004098;
  133. margin-right: 0;
  134. }
  135. </style>