You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.2 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="main">
  3. <view class="searchBox">
  4. <searchRow placeholder="请输入名称/标识/主机/描述" @searchFn="searchFn"/>
  5. </view>
  6. <view class="tabs">
  7. <myTab :tabList="tabList" @tabClick="tabClick" :current="current"></myTab>
  8. </view>
  9. <view class="ul">
  10. <view class="total"><text v-if="total">{{ total }}</text> </view>
  11. <view class="card" v-for="(item,index) in list" :key="index">
  12. <view class="row">
  13. <view class="lab">名称</view>
  14. <view class="val">{{item.name}}</view>
  15. </view>
  16. <view class="row">
  17. <view class="lab">标识</view>
  18. <view class="val">{{item.tag}}</view>
  19. </view>
  20. <view class="row">
  21. <view class="lab">机器主机</view>
  22. <view class="val blue">{{item.host}}</view>
  23. </view>
  24. <view class="row">
  25. <view class="lab">描述</view>
  26. <view class="val">{{item.description}}</view>
  27. </view>
  28. <view class="row">
  29. <view class="lab">状态</view>
  30. <view class="flex" v-if="item.status==1">
  31. <view class="icon">
  32. <image src="../../../static/images/icon (11).png" mode=""></image>
  33. </view>
  34. <view class="val blue">启用</view>
  35. </view>
  36. <view class="flex" v-else>
  37. <view class="icon">
  38. <image src="../../../static/images/icon (12).png" mode=""></image>
  39. </view>
  40. <view class="val hui">停用</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  46. </view>
  47. </template>
  48. <script>
  49. import { machineList } from '@/config/api.js'
  50. export default {
  51. data() {
  52. return {
  53. tabList: [{
  54. name: '全部',
  55. id: 0
  56. }, {
  57. name: '启用',
  58. id: 1
  59. }, {
  60. name: '停用',
  61. id: 2
  62. }, ],
  63. current: 0,
  64. total: 1,
  65. list: [],
  66. name: '',
  67. status: ''
  68. }
  69. },
  70. onLoad() {
  71. this.machineListFn()
  72. },
  73. onPullDownRefresh() {
  74. this.machineListFn()
  75. },
  76. methods: {
  77. async machineListFn() {
  78. let status = this.current?this.current:''
  79. const {data: res} = await machineList({status, name: this.name})
  80. this.list = res.rows
  81. this.total = res.total
  82. if(!res.total) {
  83. this.status = 'nomore'
  84. }else {
  85. this.status = ''
  86. }
  87. uni.stopPullDownRefresh()
  88. },
  89. tabClick(item) {
  90. this.current = item.index
  91. this.machineListFn()
  92. },
  93. searchFn(val) {
  94. this.name = val
  95. this.machineListFn()
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .searchBox {
  102. padding: 16rpx 30rpx;
  103. background-color: #fff;
  104. }
  105. .tabs {
  106. background-color: #fff;
  107. margin-top: 8rpx;
  108. padding: 16rpx 0;
  109. }
  110. .ul {
  111. width: 100%;
  112. padding: 0 30rpx 40rpx 30rpx;
  113. .total {
  114. height: 66rpx;
  115. line-height: 66rpx;
  116. font-size: 24rpx;
  117. color: #999;
  118. text-align: right;
  119. }
  120. .card {
  121. padding: 10rpx 28rpx;
  122. margin-bottom: 24rpx;
  123. .row {
  124. align-items: center;
  125. display: flex;
  126. justify-content: space-between;
  127. padding: 16rpx 0;
  128. font-size: 26rpx;
  129. color: #333;
  130. .lab {
  131. }
  132. .val {
  133. &.blue {
  134. color: $themC;
  135. }
  136. &.hui {
  137. color: #999;
  138. }
  139. }
  140. .flex {
  141. display: flex;
  142. justify-content: flex-end;
  143. .icon {
  144. width: 28rpx;
  145. height: 30rpx;
  146. margin-right: 20rpx;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. </style>