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.
 
 
 

159 lines
3.2 KiB

<template>
<view class="main">
<view class="searchBox">
<searchRow placeholder="请输入名称/标识/主机/描述" @searchFn="searchFn"/>
</view>
<view class="tabs">
<myTab :tabList="tabList" @tabClick="tabClick" :current="current"></myTab>
</view>
<view class="ul">
<view class="total"><text v-if="total">共{{ total }}条</text> </view>
<view class="card" v-for="(item,index) in list" :key="index">
<view class="row">
<view class="lab">名称</view>
<view class="val">{{item.name}}</view>
</view>
<view class="row">
<view class="lab">标识</view>
<view class="val">{{item.tag}}</view>
</view>
<view class="row">
<view class="lab">机器主机</view>
<view class="val blue">{{item.host}}</view>
</view>
<view class="row">
<view class="lab">描述</view>
<view class="val">{{item.description}}</view>
</view>
<view class="row">
<view class="lab">状态</view>
<view class="flex" v-if="item.status==1">
<view class="icon">
<image src="../../../static/images/icon (11).png" mode=""></image>
</view>
<view class="val blue">启用</view>
</view>
<view class="flex" v-else>
<view class="icon">
<image src="../../../static/images/icon (12).png" mode=""></image>
</view>
<view class="val hui">停用</view>
</view>
</view>
</view>
</view>
<nodata v-if="!list.length&&status=='nomore'"></nodata>
</view>
</template>
<script>
import { machineList } from '@/config/api.js'
export default {
data() {
return {
tabList: [{
name: '全部',
id: 0
}, {
name: '启用',
id: 1
}, {
name: '停用',
id: 2
}, ],
current: 0,
total: 1,
list: [],
name: '',
status: ''
}
},
onLoad() {
this.machineListFn()
},
onPullDownRefresh() {
this.machineListFn()
},
methods: {
async machineListFn() {
let status = this.current?this.current:''
const {data: res} = await machineList({status, name: this.name})
this.list = res.rows
this.total = res.total
if(!res.total) {
this.status = 'nomore'
}else {
this.status = ''
}
uni.stopPullDownRefresh()
},
tabClick(item) {
this.current = item.index
this.machineListFn()
},
searchFn(val) {
this.name = val
this.machineListFn()
}
}
}
</script>
<style lang="scss" scoped>
.searchBox {
padding: 16rpx 30rpx;
background-color: #fff;
}
.tabs {
background-color: #fff;
margin-top: 8rpx;
padding: 16rpx 0;
}
.ul {
width: 100%;
padding: 0 30rpx 40rpx 30rpx;
.total {
height: 66rpx;
line-height: 66rpx;
font-size: 24rpx;
color: #999;
text-align: right;
}
.card {
padding: 10rpx 28rpx;
margin-bottom: 24rpx;
.row {
align-items: center;
display: flex;
justify-content: space-between;
padding: 16rpx 0;
font-size: 26rpx;
color: #333;
.lab {
}
.val {
&.blue {
color: $themC;
}
&.hui {
color: #999;
}
}
.flex {
display: flex;
justify-content: flex-end;
.icon {
width: 28rpx;
height: 30rpx;
margin-right: 20rpx;
}
}
}
}
}
</style>