listPage.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="equipmentInformationListPage">
  3. <view class="top-bix-box">
  4. <view class="top-box">
  5. <view class="left-time-box">
  6. <uni-datetime-picker v-model="range" type="daterange" :clearIcon="false"/>
  7. </view>
  8. <view class="right-button-box" @click="queryButton()">查询</view>
  9. </view>
  10. <view class="top-box" style="margin-top:10rpx;">
  11. <view class="left-time-box">
  12. <input class="input-text" type="text" v-model="text" placeholder="设备名称">
  13. </view>
  14. <view class="right-button-box-2" @click="resetButton()">重置</view>
  15. </view>
  16. </view>
  17. <scroll-view scroll-y @scrolltolower="scrollGet" class="list-max-big-box">
  18. <img class="null-img" v-if="!dataList[0]" :src="imagesUrl('commonality/null-data-1.png')">
  19. <view class="list-for-max-big-box" v-for="(item,index) in dataList" :key="index">
  20. <view class="top-title-box">
  21. <view>{{item.deviceName}}</view>
  22. <view>{{item.usageTypeName}}</view>
  23. </view>
  24. <view class="text-p">{{item.location}}</view>
  25. <view class="text-p">使用时间:{{item.startTime}} 至 {{item.actualEndTime?item.actualEndTime:'未结束'}}</view>
  26. <view class="bottom-title-box">
  27. <view>设备编号:{{item.deviceCode}}</view>
  28. <view>使用人:{{item.userName}}</view>
  29. </view>
  30. </view>
  31. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  32. </scroll-view>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. mpDeviceUsageList,
  38. } from '@/pages_equipmentUtilization/api/index.js'
  39. export default {
  40. data() {
  41. return {
  42. getDataType:false,
  43. range:[],
  44. text:'',
  45. // 查询参数
  46. queryParams: {
  47. page: 1,
  48. pageSize: 10,
  49. },
  50. dataList:[],
  51. total:0,
  52. }
  53. },
  54. onLoad(option) {
  55. },
  56. onShow() {
  57. },
  58. mounted() {
  59. this.getList()
  60. },
  61. methods: {
  62. queryButton(){
  63. this.getList()
  64. },
  65. resetButton(){
  66. this.$set(this,'range',[]);
  67. this.$set(this,'text','');
  68. this.$set(this,'queryParams',{
  69. page: 1,
  70. pageSize: 10,
  71. });
  72. this.$set(this,'dataList',[]);
  73. this.$set(this,'total',0);
  74. this.getList()
  75. },
  76. //滚动加载事件
  77. scrollGet() {
  78. let self = this;
  79. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  80. this.$set(this, 'getDataType', true);
  81. } else {
  82. this.queryParams.page += 1;
  83. this.$nextTick(() => {
  84. this.getList();
  85. })
  86. }
  87. },
  88. //获取数据列表
  89. async getList() {
  90. let self = this;
  91. let obj = JSON.parse(JSON.stringify(this.queryParams));
  92. obj.startTime = this.range[0] ? this.range[0] +'T00:00:00' : '';
  93. obj.endTime = this.range[0] ? this.range[1] +'T23:59:59' : '';
  94. obj.deviceName = this.text ? this.text : '';
  95. const {
  96. data
  97. } = await mpDeviceUsageList(obj);
  98. if (data.code == 200) {
  99. if(self.queryParams.page == 1){
  100. this.dataList = data.data.records;
  101. this.total = data.data.total;
  102. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  103. this.$set(this, 'getDataType', true);
  104. }
  105. }else{
  106. this.dataList = [...this.dataList, ...data.data.records]
  107. this.total = data.data.total;
  108. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  109. this.$set(this, 'getDataType', true);
  110. }
  111. }
  112. }
  113. },
  114. },
  115. }
  116. </script>
  117. <style lang="stylus" scoped>
  118. .equipmentInformationListPage {
  119. height: 100%;
  120. flex:1;
  121. display:flex;
  122. flex-direction:column;
  123. .top-bix-box{
  124. height:160rpx;
  125. padding:20rpx 20rpx;
  126. background-color: #fff;
  127. .top-box{
  128. display: flex;
  129. .left-time-box{
  130. width:600rpx;
  131. .input-text{
  132. padding-left:30rpx;
  133. height:70rpx;
  134. line-height:70rpx;
  135. border-radius:6rpx;
  136. color:#333;
  137. border:1px solid #e5e5e5;
  138. }
  139. }
  140. .right-button-box{
  141. margin-left:20rpx;
  142. width:140rpx;
  143. height:70rpx;
  144. line-height:70rpx;
  145. text-align: center;
  146. border-radius:6rpx;
  147. color:#fff;
  148. background-color: #0183FA;
  149. border:1px solid #0183FA;
  150. }
  151. .right-button-box-2{
  152. margin-left:20rpx;
  153. width:140rpx;
  154. height:70rpx;
  155. line-height:70rpx;
  156. text-align: center;
  157. border-radius:6rpx;
  158. color:#999;
  159. border:1px solid #e5e5e5;
  160. }
  161. }
  162. }
  163. .list-max-big-box{
  164. flex:1;
  165. display:flex;
  166. flex-direction:column;
  167. overflow: scroll;
  168. padding-bottom:80rpx;
  169. .null-img {
  170. display block;
  171. width: 276rpx;
  172. height: 321rpx;
  173. position absolute;
  174. top: 200rpx;
  175. left: 274rpx;
  176. }
  177. .get-data-null-p {
  178. margin-top:20rpx;
  179. text-align: center;
  180. line-height: 40rpx;
  181. padding-bottom: 40px;
  182. color: #999;
  183. }
  184. .list-for-max-big-box{
  185. margin:20rpx 0 0;
  186. padding:20rpx;
  187. background-color: #fff;
  188. .top-title-box{
  189. display:flex;
  190. line-height:60rpx;
  191. view{
  192. flex:1;
  193. }
  194. view:nth-child(1){
  195. color:#333;
  196. }
  197. view:nth-child(2){
  198. text-align: right;
  199. color:#888;
  200. }
  201. }
  202. .text-p{
  203. color:#888;
  204. line-height:60rpx;
  205. }
  206. .bottom-title-box{
  207. display:flex;
  208. line-height:60rpx;
  209. view{
  210. flex:1;
  211. }
  212. view:nth-child(1){
  213. color:#888;
  214. }
  215. view:nth-child(2){
  216. text-align: right;
  217. color:#888;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. </style>