<template>
|
<view class="content">
|
|
<view class="tabs">
|
<view :class="tabs == 0 ? 'on':''" @tap="changeTab(0)">全部</view>
|
<view :class="tabs == 1 ? 'on':''" @tap="changeTab(1)">运行</view>
|
<view :class="tabs == 2 ? 'on':''" @tap="changeTab(2)">待机</view>
|
<view :class="tabs == 3 ? 'on':''" @tap="changeTab(3)">停机</view>
|
</view>
|
|
<view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
|
|
<!-- 只在全部页签显示添加生产资源卡片 -->
|
<view class="list" v-if="tabs == 0">
|
<uni-card style="margin: 10px;" @tap="addResource">
|
<view class="card-main add-resource">
|
<view class="add-icon">+</view>
|
<view class="add-text">添加生产资源</view>
|
</view>
|
</uni-card>
|
</view>
|
|
<view class="list" v-for="(item,index) in showList" :key="index">
|
<uni-card style="margin: 10px;" @tap="toList(item)">
|
<view class="card-main">
|
<image src="../../static/sb.png" mode=""></image>
|
<view class="right">
|
<view class="detail" v-if="item.HSourceName">
|
<text>设备编号:</text>{{item.HSourceName}}
|
</view>
|
<view class="detail" v-if="item.HSourceNumber">
|
<text>设备代码:</text>{{item.HSourceNumber}}
|
</view>
|
<view class="detail" v-if="item.HUserName">
|
<text>操作员:</text>{{item.HUserName}}
|
</view>
|
<view class="detail" v-if="item.GroupName">
|
<text>生产班组:</text>{{item.GroupName}}
|
</view>
|
<view class="detail" v-if="item.HEmpName">
|
<text>负责人:</text>{{item.HEmpName}}
|
</view>
|
</view>
|
<view class="op">
|
<view class="op5" v-if="item.HStatus == '空闲'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
<view class="op3" v-if="item.HStatus == '开机'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
<view class="op4" v-if="item.HStatus == '停机'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
<view class="op1" v-if="item.HStatus == '生产'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
<view class="op2" v-if="item.HStatus == '维修进行中'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
<view class="op2" v-if="item.HStatus == '维修结束'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
<view class="op2" v-if="item.HStatus == '维修终止'">
|
<uni-icons type="smallcircle-filled" size="14"
|
color=""></uni-icons><text>{{item.HStatus}}</text>
|
</view>
|
</view>
|
<!-- 删除按钮 -->
|
<view class="delete-btn" @tap.stop="deleteResource(item.HSourceID, index)" v-if="item.HSourceID">
|
<uni-icons type="closeempty" size="20" color="#da0000"></uni-icons>
|
</view>
|
</view>
|
</uni-card>
|
</view>
|
|
<view class="over" v-if="listData.length == 0">暂无数据</view>
|
<view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
|
<view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
getUserInfo
|
} from "@/utils/auth.js";
|
export default {
|
data() {
|
return {
|
userInfo: getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
tabs: 0,
|
status: '全部',
|
|
sWhere: '',
|
listData: [],
|
showList: [],
|
showDetail: -1,
|
operations: -1,
|
|
page: 1,
|
}
|
},
|
onLoad() {
|
// 监听刷新事件
|
uni.$on('refreshDeviceList', () => {
|
this.getList();
|
});
|
this.getList();
|
},
|
onUnload() {
|
// 移除事件监听
|
uni.$off('refreshDeviceList');
|
},
|
onReachBottom: function() {
|
this.page++
|
setTimeout(() => {
|
this.showList = this.showList.concat(this.getPage(this.page, this.listData))
|
}, 100)
|
},
|
onPullDownRefresh: function() {
|
this.clear()
|
setTimeout(() => {
|
uni.stopPullDownRefresh();
|
}, 1000);
|
},
|
methods: {
|
getPage(page, list) {
|
let sindex = (parseInt(page) - 1) * 20
|
let eindex = parseInt(page) * 20
|
let newList = list.slice(sindex, eindex)
|
return newList
|
},
|
changeTab(e) {
|
this.tabs = e
|
this.page = 1
|
this.showList = []
|
if (this.tabs == 0) {
|
this.status = '全部'
|
this.getList()
|
}
|
if (this.tabs == 1) {
|
this.status = '运行'
|
this.getList()
|
}
|
if (this.tabs == 2) {
|
this.status = '待机'
|
this.getList()
|
}
|
if (this.tabs == 3) {
|
this.status = '停机'
|
this.getList()
|
}
|
},
|
getList() {
|
uni.request({
|
url: this.serverUrl + '/ReportPlatForm/SearchGetLineBindBillListStatus',
|
data: {
|
HStatus: this.status,
|
HUserName: uni.getStorageSync('HUserName')
|
},
|
success: (res) => {
|
console.log(1, res.data);
|
if (res.data.count == 1) {
|
this.listData = res.data.data.h_p_JIT_GetSourceInfoByUser
|
console.log(this.listData.length)
|
this.showList = this.getPage(this.page, this.listData)
|
setTimeout(() => {
|
uni.hideLoading()
|
}, 1000)
|
} else {
|
this.listData = []
|
uni.hideLoading()
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
},
|
});
|
},
|
//工单列表
|
toList(item) {
|
uni.navigateTo({
|
url: './DayPlanBillList?HSourceID=' + item.HSourceID + '&HSourceName=' + item.HSourceName,
|
success: () => {
|
// 设置页面返回时需要刷新的标志
|
this.needRefresh = true;
|
}
|
})
|
},
|
// 添加生产资源
|
addResource() {
|
uni.navigateTo({
|
url: './AddLineBind', // 你需要创建这个页面
|
success: () => {
|
// 设置页面返回时需要刷新的标志
|
this.needRefresh = true;
|
}
|
})
|
},
|
// 删除生产资源
|
deleteResource(HSourceID, index) {
|
uni.showModal({
|
title: '删除确认',
|
content: '确认要删除吗,删除后不能恢复',
|
success: (res) => {
|
if (res.confirm) {
|
uni.showLoading({
|
title: '删除中...'
|
})
|
uni.request({
|
url: this.serverUrl + '/ReportPlatForm/DeleteGetLineBindBillList',
|
method: 'GET',
|
data: {
|
HSourceID: HSourceID,
|
user: uni.getStorageSync('HUserName')
|
},
|
success: (res) => {
|
uni.hideLoading()
|
if (res.data.count > 0) {
|
// 重置分页参数
|
this.page = 1
|
this.listData = []
|
this.showList = []
|
// 重新获取数据
|
this.getList()
|
} else {
|
uni.showToast({
|
title: res.data.Message || '删除失败',
|
icon: 'none'
|
})
|
}
|
},
|
fail: () => {
|
uni.hideLoading()
|
uni.showToast({
|
title: '删除失败',
|
icon: 'none'
|
})
|
}
|
})
|
}
|
}
|
})
|
},
|
}
|
}
|
</script>
|
|
|
<style lang="scss" scoped>
|
.form {
|
width: 640rpx;
|
margin: 20rpx auto;
|
}
|
|
.tabs {
|
width: 100%;
|
display: flex;
|
|
view {
|
width: 25%;
|
font-size: 30rpx;
|
color: #555;
|
text-align: center;
|
padding: 16rpx 0;
|
}
|
|
.on {
|
color: #3a78ff;
|
font-weight: bold;
|
border-bottom: 3px solid #3a78ff;
|
}
|
}
|
|
.form-item {
|
display: flex;
|
align-items: center;
|
font-size: 28rpx;
|
padding: 6rpx 0;
|
|
.title {
|
width: 180rpx;
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
}
|
|
.right {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
|
.righton {
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
input {
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
}
|
|
.buttons {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
margin-top: 20rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
|
.btn-a {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
}
|
|
.list {
|
width: 100%;
|
|
.card-main {
|
display: flex;
|
|
image {
|
width: 160rpx;
|
height: 160rpx;
|
margin-right: 30rpx;
|
}
|
|
.right {
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
|
text {
|
color: #999;
|
}
|
}
|
}
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
line-height: 120%;
|
|
.detail {
|
// width: 50%;
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
|
text {
|
color: #999;
|
font-size: 26rpx;
|
}
|
}
|
}
|
|
.more {
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
|
.part {
|
width: 50%;
|
text-align: center;
|
}
|
}
|
|
.op {
|
display: flex;
|
// justify-content: space-around;
|
// margin-top: 20rpx;
|
align-items: center;
|
justify-content: center;
|
margin-top: 4rpx;
|
font-size: 26rpx;
|
font-weight: bold;
|
position: absolute;
|
right: 30rpx;
|
bottom: 30rpx;
|
|
text {
|
margin-right: 10rpx;
|
font-weight: bold;
|
font-size: 28rpx;
|
}
|
|
button {
|
padding: 0;
|
width: 150rpx;
|
font-size: 25rpx;
|
}
|
|
.op1 {
|
// border: 1px solid #41a863;
|
color: #41a863;
|
background-color: rgba(#41a863, .15);
|
padding: 2rpx 10rpx;
|
border-radius: 4rpx;
|
box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
|
}
|
|
.op2 {
|
// border: 1px solid #d98d00;
|
color: #d98d00;
|
background-color: rgba(#d98d00, .15);
|
padding: 2rpx 10rpx;
|
border-radius: 4rpx;
|
box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
|
}
|
|
.op3 {
|
// border: 1px solid #3a78ff;
|
color: #3a78ff;
|
background-color: rgba(#3a78ff, .15);
|
padding: 2rpx 10rpx;
|
border-radius: 4rpx;
|
box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
|
}
|
|
.op4 {
|
// border: 1px solid #da0000;
|
color: #da0000;
|
background-color: rgba(#da0000, .15);
|
padding: 2rpx 10rpx;
|
border-radius: 4rpx;
|
box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
|
}
|
|
.op5 {
|
// border: 1px solid #888;
|
color: #888;
|
background-color: rgba(#888, .15);
|
padding: 2rpx 10rpx;
|
border-radius: 4rpx;
|
box-shadow: 2rpx 2rpx 6rpx 0 #acacac;
|
}
|
}
|
|
// 删除按钮样式
|
.delete-btn {
|
position: absolute;
|
top: 10rpx;
|
right: 10rpx;
|
width: 50rpx;
|
height: 50rpx;
|
background-color: rgba(255, 255, 255, 0.9);
|
border-radius: 50%;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
|
z-index: 10;
|
}
|
|
// 添加资源卡片样式 - 大小缩小一半
|
.add-resource {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
height: 120rpx;
|
/* 从300rpx缩小到150rpx */
|
border: 2rpx dashed #3a78ff;
|
border-radius: 16rpx;
|
background-color: #f8fafc;
|
|
.add-icon {
|
font-size: 50rpx;
|
/* 从100rpx缩小到50rpx */
|
color: #3a78ff;
|
line-height: 1;
|
margin-bottom: 10rpx;
|
/* 从20rpx缩小到10rpx */
|
}
|
|
.add-text {
|
font-size: 24rpx;
|
/* 从32rpx缩小到24rpx */
|
color: #3a78ff;
|
text-align: center;
|
}
|
}
|
}
|
</style>
|