【前端】印包客app
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.

298 lines
7.7 KiB

<template>
<view class="content">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="生产设备详情"></uni-nav-bar>
<view class="flex-col items-center group_1" v-if="info.videoUrl">
<image src="/static/imgs/digital-workshops/camera-tip-bg.png" class="image_2" @click="go2('video-play', { url: info.videoUrl })" />
</view>
<view class="flex-col group_6">
<view class="flex-col">
<text class="text_5">{{ info.name }}</text>
<view class="flex-row group_8">
<text>{{ translate(info.latestWorkTime) }}</text>
<text class="text_7">{{ info.belongWorkshop }}</text>
</view>
</view>
<view class="flex-col group_9">
<text>品牌{{ info.brand }}</text>
<text class="text_9">供应商{{ info.supplier }}</text>
<text class="text_10">出厂年月{{ info.outFactoryDate | formatDate }}</text>
<text class="text_11">平均产能{{ info.avgCapacity }}/小时</text>
<text class="text_12">电压/功率{{ info.voltage }}V/10KW</text>
</view>
</view>
<view class="flex-col line-tabs">
<view class="flex-col section_3">
<view class="flex-row group_2">
<view
class="text-wrapper"
:class="{ 'text-wrapper_selected': curTab === item.key }"
v-for="item in tabList"
:key="item.key"
@click="selectTab(item.key)"
>
<text>{{ item.name }}</text>
<view v-show="curTab === item.key" class="divider"></view>
</view>
</view>
</view>
<view class="flex-row section_4" v-show="curTab == 1">
<view class="flex-col group_11">
<view class="flex-row group_12">
<image src="/static/imgs/factory/electric-box-icon.png" class="image_6" />
<text class="text_16">当月产能(件)</text>
</view>
<text class="text_17">{{ info.monthCapacity }}</text>
<text class="text_18">今日:{{ info.todayCapacity }}</text>
<text class="text_18">昨日:{{ info.yesterdayCapacity }}</text>
<text class="text_18">累计:{{ info.totalCapacity }}</text>
</view>
<view class="flex-col group_11">
<view class="flex-row group_12">
<image src="/static/imgs/factory/clock-icon.png" class="image_6" />
<text class="text_16">当月工作</text>
</view>
<text class="text_17">{{ info.monthWorkHour }} h</text>
<text class="text_18">今日:{{ info.todayWorkHour }}</text>
<text class="text_18">昨日:{{ info.yesterdayWorkHour }}</text>
<text class="text_18">累计:{{ info.totalWorkHour }}</text>
</view>
<view class="flex-col group_11">
<view class="flex-row group_12">
<image src="/static/imgs/factory/calc-icon.png" class="image_6" />
<text class="text_16">开机率</text>
</view>
<text class="text_17">{{ info.startupRate }}%</text>
</view>
</view>
<view class="flex-col items-center empty-info" v-show="curTab == 2">
<text>暂无维修信息</text>
</view>
<view class="flex-col items-center empty-info" v-show="curTab == 3">
<text>暂无购置信息</text>
</view>
</view>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import { getEquipmentInfo } from '@/apis/deviceApi'
const tabList = [
{ name: '生产情况', key: 1 },
{ name: '维修保养', key: 2 },
{ name: '购置信息', key: 3 }
]
export default {
data() {
return {
id: null,
info: {},
tabList: Object.freeze(tabList),
curTab: 1
}
},
onLoad(options) {
if (options.id) {
this.id = options.id
}
},
watch: {
id(val) {
this.getInfo()
}
},
methods: {
go2,
back,
getInfo() {
if (this.id) {
getEquipmentInfo({ id: this.id }).then((res) => {
if (res) {
this.info = res
}
})
}
},
translate(time) {
if (!time) {
return ''
}
time = time.replace(/-/g, '/')
let date = new Date(time)
let month = date.getMonth() + 1
let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
if (minute < 10) {
minute = '0' + minute
}
return `最近开机 ${month}${day}${hour}:${minute}`
},
selectTab(key) {
this.curTab = key
}
},
filters: {
formatDate(time) {
if (!time) {
return ''
}
time = time.replace(/-/g, '/')
let date = new Date(time)
let year = date.getFullYear()
let month = date.getMonth() + 1
return `${year}${month}`
}
}
}
</script>
<style lang="scss" scoped>
.content {
width: 750rpx;
.group_1 {
color: rgb(255, 255, 255);
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
white-space: nowrap;
position: relative;
.image_2 {
width: 91.5vw;
height: 51.5vw;
}
.text_18 {
position: absolute;
left: 24rpx;
top: 16rpx;
}
}
}
.group_6 {
padding: 24rpx 32rpx 32rpx;
.group_9 {
margin-top: 24rpx;
color: rgb(51, 51, 51);
font-size: 28rpx;
line-height: 40rpx;
white-space: nowrap;
.text_9 {
margin-top: 10rpx;
}
.text_10 {
margin-top: 10rpx;
}
.text_11 {
margin-top: 10rpx;
}
.text_12 {
margin-top: 10rpx;
}
}
.text_5 {
color: rgb(0, 0, 0);
font-size: 34rpx;
font-weight: 500;
line-height: 48rpx;
white-space: nowrap;
}
.group_8 {
margin-top: 8rpx;
color: rgb(136, 136, 136);
font-size: 20rpx;
line-height: 28rpx;
white-space: nowrap;
.text_7 {
margin-left: 11rpx;
}
}
}
.line-tabs {
margin-top: 20rpx;
.section_3 {
padding-bottom: 3rpx;
background-color: rgb(255, 255, 255);
.group_2 {
padding: 0 40rpx;
border-bottom: solid 2rpx rgb(221, 221, 221);
.text-wrapper {
color: rgb(136, 136, 136);
font-size: 28rpx;
height: 86rpx;
line-height: 86rpx;
white-space: nowrap;
position: relative;
text-align: center;
margin-right: 40rpx;
min-width: 80rpx;
}
.text-wrapper_selected {
color: rgb(51, 51, 51);
font-weight: 500;
}
.divider {
background-color: rgb(0, 122, 255);
border-radius: 3rpx;
width: 80rpx;
height: 6rpx;
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
}
}
.section_4 {
padding: 0 32rpx 25rpx;
background-color: rgb(255, 255, 255);
.group_11 {
margin-top: 30rpx;
flex: 1 1 auto;
width: 30%;
text-align: center;
.group_12 {
padding-left: 8rpx;
color: rgb(136, 136, 136);
font-size: 24rpx;
line-height: 33rpx;
white-space: nowrap;
justify-content: center;
.text_16 {
margin-left: 9rpx;
}
}
.text_17 {
margin-top: 12rpx;
align-self: center;
color: rgb(51, 51, 51);
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
white-space: nowrap;
}
.text_18 {
margin-top: 6rpx;
color: rgb(136, 136, 136);
font-size: 24rpx;
line-height: 33rpx;
white-space: nowrap;
}
}
.image_6 {
width: 28rpx;
height: 28rpx;
}
}
}
.empty-info {
padding: 50rpx 0 58rpx;
color: rgb(0, 0, 0);
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
white-space: nowrap;
background-color: rgb(255, 255, 255);
overflow: hidden;
height: 148rpx;
}
</style>