mes_mobile/pages/deviceStatus/deviceStatus.vue

231 lines
6.1 KiB
Vue
Raw Permalink Normal View History

2024-02-19 16:53:38 +08:00
<template>
2024-04-11 18:54:43 +08:00
<view class="page_padding">
2024-04-30 16:08:07 +08:00
<view class="padd_bot12 font14 flex_layout">
<text>硬件设备状态</text>
<view class="status font12"><text class="drop"></text>在线</view>
2024-03-13 16:07:11 +08:00
</view>
<view class="body-view contentboxsty">
<view class="content-top">
2024-04-30 16:08:07 +08:00
<view class="content-left" @click="prveClick">
2024-03-13 16:07:11 +08:00
<text class="iconfont icon-gengduo more_icon"></text>
</view>
<view class="content-scroll">
<view class="center-cut-menu">
2024-04-30 16:08:07 +08:00
<scroll-view scroll-x="true" show-scrollbar="false" scroll-with-animation="true" :scroll-left="scrollLeft" class="scroll-view horizontalScrollView" >
<view class="scroll-item" :style="'width:'+itemWidth+'px'" v-for="(item, index) in list" :key="index" @click="changeMenu(index)">
2024-03-13 16:07:11 +08:00
<text class="item-text" :class="curIndex == index? 'active' : ''">{{item.name}}</text>
</view>
</scroll-view>
</view>
</view>
2024-04-30 16:08:07 +08:00
<view class="content-right" @click="nextClick">
2024-03-13 16:07:11 +08:00
<text class="iconfont icon-gengduo"></text>
</view>
</view>
2024-04-30 16:08:07 +08:00
<swiper class="swiper-box-list" circular="true" easing-function="linear" :current="curIndex" @change="swiperChange">
2024-03-13 16:07:11 +08:00
<swiper-item class="swiper-topic-list" v-for="item in swiperDateList" :key="item.id">
2024-04-30 16:08:07 +08:00
<view class="swiper-item">
<view class="img">
<image style="width: 100%;height: 100%;" :src="item.img"></image>
2024-03-13 16:07:11 +08:00
</view>
<view class="font14">
2024-04-30 16:08:07 +08:00
<view class="device_row">
2024-03-13 16:07:11 +08:00
<text class="name font_bold">设备名称</text>
2024-04-30 16:08:07 +08:00
<text class="text">双头立锯</text>
<view @click="toCamera()" class="videoIcon text" style="position: absolute;right: 0;">
<text class="iconfont icon-a-shexiangtou_shiti1"></text>
2024-04-11 18:54:43 +08:00
</view>
2024-03-13 16:07:11 +08:00
</view>
<view class="device_row">
<text class="name font_bold">开机时间</text>
2024-04-30 16:08:07 +08:00
<text class="text">2024-02-11 08:00:45</text>
2024-03-13 16:07:11 +08:00
</view>
<view class="device_row">
<text class="name font_bold">保养到期日</text>
2024-04-30 16:08:07 +08:00
<text class="text">2024-02-11 08:00:45</text>
2024-03-13 16:07:11 +08:00
</view>
<view class="device_row">
<text class="name font_bold">今日停机</text>
2024-04-30 16:08:07 +08:00
<text class="text">5</text>
2024-03-13 16:07:11 +08:00
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
2024-02-19 16:53:38 +08:00
</view>
</template>
<script>
2024-03-13 16:07:11 +08:00
export default {
data() {
return {
list: [{
id: 1,
2024-04-30 16:08:07 +08:00
name: '多片锯',
2024-03-13 16:07:11 +08:00
},
{
id: 2,
2024-04-30 16:08:07 +08:00
name: '双头带锯',
2024-03-13 16:07:11 +08:00
},
{
id: 3,
2024-04-30 16:08:07 +08:00
name: '视觉分析',
2024-03-13 16:07:11 +08:00
},
{
id: 4,
2024-04-30 16:08:07 +08:00
name: '卧锯带锯',
2024-03-13 16:07:11 +08:00
},
{
id: 5,
2024-04-30 16:08:07 +08:00
name: '上料机架',
2024-03-13 16:07:11 +08:00
},
],
// Tab切换内容
swiperDateList: [
{
id: 1,
2024-04-30 16:08:07 +08:00
content: '1',
img:'http://dm-auto.oss-cn-shanghai.aliyuncs.com/mes_wechat/duopian.png'
2024-03-13 16:07:11 +08:00
},
{
id: 2,
2024-04-30 16:08:07 +08:00
content: '2',
img:'http://dm-auto.oss-cn-shanghai.aliyuncs.com/mes_wechat/liju.png'
2024-03-13 16:07:11 +08:00
},
{
id: 3,
2024-04-30 16:08:07 +08:00
content: '3',
img:'http://dm-auto.oss-cn-shanghai.aliyuncs.com/mes_wechat/shijue.png'
2024-03-13 16:07:11 +08:00
},
{
id: 4,
2024-04-30 16:08:07 +08:00
content: '4',
img:'http://dm-auto.oss-cn-shanghai.aliyuncs.com/mes_wechat/woshi.png'
2024-03-13 16:07:11 +08:00
},
{
id: 5,
2024-04-30 16:08:07 +08:00
content: '5',
img:'http://dm-auto.oss-cn-shanghai.aliyuncs.com/mes_wechat/shang.png'
2024-03-13 16:07:11 +08:00
},
],
2024-04-30 16:08:07 +08:00
itemWidth: 90,
curIndex: 0,
scrollLeft: 0,
2024-03-13 16:07:11 +08:00
}
},
mounted() {
2024-04-30 16:08:07 +08:00
2024-03-13 16:07:11 +08:00
},
2024-04-30 16:08:07 +08:00
onReady() {
this.getScrollW();
},
2024-04-11 18:54:43 +08:00
methods: {
toCamera(){
uni.navigateTo({
url:'/pages/deviceStatus/deviceCamera'
})
},
2024-04-30 16:08:07 +08:00
// 区域宽度,子元素的宽度以及距离左边栏的距离
getScrollW() {
let itemWidth = 0;
let query = uni.createSelectorQuery().in(this);
query.select('.scroll-view').boundingClientRect(data => {
this.itemWidth = (data.width/3).toFixed(0);
itemWidth = (data.width/3).toFixed(0);
this.getItemWidth(itemWidth);
}).exec();
},
getItemWidth(num){
let query = uni.createSelectorQuery().in(this);
query.selectAll('.scroll-item').boundingClientRect(data => {
let dataLen = data.length;
for (let i = 0; i < dataLen; i++) {
this.list[i].width = Number(num);
this.list[i].left = Number(num) + Number(data[i].left);
}
}).exec()
},
// 选择标题
changeMenu(index) {
this.curIndex = index;
this.scrollLeft = 0;
for (let i = 0; i < index - 1; i++) {
this.scrollLeft += this.list[i].width;
};
},
swiperChange(e) {
let index = e.detail.current;
this.changeMenu(index);
},
prveClick(){
this.curIndex = this.curIndex==0? 0 : this.curIndex-1;
},
nextClick(){
this.curIndex = this.curIndex < this.list.length-1? this.curIndex+1 : this.curIndex;
}
2024-03-13 16:07:11 +08:00
}
}
</script>
2024-04-30 16:08:07 +08:00
<style scoped lang="scss">
2024-03-13 16:07:11 +08:00
.body-view{
height: 450px;
.content-top{
display: flex;
align-items: center;
.content-left{flex-basis: 30px;text-align: center;
.more_icon{display: inline-block;transform: scaleX(-1);}
}
2024-04-30 16:08:07 +08:00
.content-scroll{flex: 1;overflow: hidden;}
.center-cut-menu {width: 100%;height: 100rpx;
2024-03-13 16:07:11 +08:00
.scroll-view {height: 100rpx;white-space: nowrap;
2024-04-30 16:08:07 +08:00
.scroll-item {height: 100rpx;padding: 0 20rpx;display: inline-block;text-align: center;box-sizing: border-box;
2024-03-13 16:07:11 +08:00
.item-text {font-size: 14px;line-height: 100rpx;
&.active {
2024-04-30 16:08:07 +08:00
font-size: 17px;
2024-03-13 16:07:11 +08:00
}
}
}
}
}
.content-right{flex-basis: 30px;text-align: center;}
}
2024-04-30 16:08:07 +08:00
.swiper-box-list{height: 400px;padding:0 12px;
.device_row:first-child{margin-top: 6px;}
2024-03-13 16:07:11 +08:00
.device_row{padding: 6px 0;display: flex;
2024-04-30 16:08:07 +08:00
.name{flex-basis: 82px;}
2024-03-13 16:07:11 +08:00
}
}
}
2024-04-30 16:08:07 +08:00
.flex_layout{
align-items: center;
}
.swiper-item{
.img{
width: 100%;
height: 250px;
}
.videoIcon{
color: $uni-color-primary;
}
}
.status{
background: $uni-bg-color-success;
margin-left: 8px;
border-radius: 20px;
padding: 3px 10px;
display: flex;
align-items: center;
.drop{
width: 4px;
height: 4px;
border-radius: 50%;
background: $uni-bg-color-whith;
display: inline-block;
margin-right: 6px;
}
}
2024-02-19 16:53:38 +08:00
</style>