<template>
|
<view class="container">
|
<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="index">
|
<block slot="backText">返回</block>
|
<block slot="content">安灯处置</block>
|
</cu-custom>
|
|
<uni-search-bar placeholder="单号查询" @confirm="search" :focus="false" v-model="searchValue" @blur="blur"
|
@focus="focus" @input="input" @cancel="cancel" @clear="clear">
|
</uni-search-bar>
|
|
<view class="content">
|
<ren-dropdown-filter :filterData='filterData' :defaultIndex='defaultIndex' @onSelected='ed'
|
@dateChange='dateChange'>
|
</ren-dropdown-filter>
|
</view>
|
|
|
<view class="container">
|
|
<mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="top" @down="downCallback" @up="upCallback">
|
<view class="production-container">
|
<view class="bill-table" v-for="(item, index) in mockBillList" :key="index">
|
<!-- 表头(共用样式) -->
|
<view class="table-content">
|
<!-- 单据号行 -->
|
<view class="table-row">
|
<text class="table-header">单据号:</text>
|
<text class="table-value">{{item.billNo || item.num}}</text>
|
</view>
|
<!-- 安灯等级行 -->
|
<view class="table-row">
|
<text class="table-header">安灯等级:</text>
|
<text class="table-value">{{item.materialCode}}</text>
|
</view>
|
<!-- 产线行 -->
|
<view class="table-row">
|
<text class="table-header">产线:</text>
|
<text class="table-value">{{item.materialDesc}}</text>
|
</view>
|
<!--工位行 -->
|
<view class="table-row">
|
<text class="table-header">工位:</text>
|
<text class="table-value">{{item.productionLine}}</text>
|
</view>
|
<!-- 问题类型行 -->
|
<view class="table-row">
|
<text class="table-header">问题类型:</text>
|
<text class="table-value">{{item.team}}</text>
|
</view>
|
<!-- 问题发起人行 -->
|
<view class="table-row">
|
<text class="table-header">问题发起人:</text>
|
<text class="table-value">{{item.team}}</text>
|
</view>
|
<!-- 发起时间行 -->
|
<view class="table-row">
|
<text class="table-header">发起时间:</text>
|
<text class="table-value">{{item.team}}</text>
|
</view>
|
<view class="table-row">
|
<text class="table-header">单据状态:</text>
|
<view class="table-value">
|
<text class="status-tag"
|
:class="[{ passed: item.inspectResult === '未响应' },{ failed: item.inspectResult === '已完成' },{ called: item.inspectResult === '已响应' }]">
|
{{item.inspectResult}}
|
</text>
|
</view>
|
</view>
|
<!-- 操作行 -->
|
<view class="table-row operation-row">
|
<text class="table-header">操作:</text>
|
<view class="table-value">
|
<view class="button-group">
|
<button class="action-btn" v-for="btn in getActionButtons(item.inspectResult)"
|
:key="btn.type" @click="handleButtonClick(item, btn)" :class="btn.type">
|
{{btn.text}}
|
</button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</mescroll-uni>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
export default {
|
mixins: [MescrollMixin], // 使用mixin
|
data() {
|
return {
|
mockBillList: [{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '未响应'
|
},
|
{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '已响应'
|
},
|
{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '已完成'
|
},
|
{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '已完成'
|
},
|
{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '未响应'
|
},
|
{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '未响应'
|
},
|
{
|
billNo: 'ADD2025052010110201', // 单据号
|
materialCode: '一级', // 物料编码
|
materialDesc: '热处理线', // 物料描述
|
spec: '1号工位', // 规格型号
|
productionLine: '热处理组', // 产线
|
team: '设备异常', // 班组
|
produceDate: 'admin', // 生产日期
|
planQty: '2025-05-11 10:20:15',
|
inspectResult: '未响应'
|
}
|
],
|
searchValue: '',
|
filterData: [
|
[{
|
text: '产线',
|
value: ''
|
}, {
|
text: '产线1',
|
value: 1
|
}, {
|
text: '产线2',
|
value: 2
|
}, {
|
text: '产线3',
|
value: 3
|
}],
|
[{
|
text: '班组',
|
value: ''
|
}, {
|
text: '班组1',
|
value: 1
|
}, {
|
text: '班组2',
|
value: 2
|
}, {
|
text: '班组3',
|
value: 3
|
}]
|
],
|
defaultIndex: [0, 0],
|
scrollLeft: 0,
|
NavBarColor: this.NavBarColor,
|
upOption: {
|
page: {
|
num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
|
size: 10, // 每页数据的数量
|
|
},
|
noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
|
empty: {
|
tip: '~ 暂无数据 ~', // 提示
|
|
},
|
loading: '',
|
text: '全部',
|
isShowNoMore: false,
|
textNoMore: '我是有底线的 >_<'
|
},
|
styles: {
|
color: '#2979FF',
|
borderColor: '#2979FF'
|
},
|
actionConfig: {
|
// 未响应状态下的操作按钮
|
'unexecuted': [{
|
text: '响应',
|
type: 'check',
|
path: '/pages/eam/production/check/check'
|
},
|
// {
|
// text: '填报',
|
// type: 'process',
|
// path: '/pages/eam/production/process/process'
|
// },
|
{
|
text: '详情',
|
type: 'device',
|
path: '/pages/eam/andon/andonDetail/andonDetail'
|
}
|
],
|
'executing': [{
|
text: '填报',
|
type: 'process',
|
path: '/pages/eam/andon/andonAction/andonAction'
|
},
|
{
|
text: '详情',
|
type: 'device',
|
path: '/pages/eam/andon/andonDetail/andonDetail'
|
}
|
],
|
|
'completed': [
|
{
|
text: '详情',
|
type: 'device',
|
path: '/pages/eam/andon/andonDetail/andonDetail'
|
}
|
]
|
|
},
|
url: {
|
delete: "/pm/arrivalAdvice/delete",
|
sub: "/pm/arrivalAdvice/issue",
|
list: "/pm/arrivalAdvice/list",
|
|
},
|
placeholderStyle: "color:#2979FF;font-size:14px",
|
msdDelList: [],
|
msgList: [], //列表数据
|
announcementList: [],
|
}
|
},
|
|
computed: {
|
top() {
|
return this.CustomBar * 3 + 200
|
},
|
style() {
|
var StatusBar = this.StatusBar;
|
var CustomBar = this.CustomBar;
|
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
|
return style
|
},
|
},
|
|
|
methods: {
|
// 根据状态获取对应的操作按钮
|
getActionButtons(status) {
|
switch (status) {
|
case '未响应':
|
case 0:
|
return this.actionConfig.unexecuted;
|
case '已响应':
|
case 1:
|
return this.actionConfig.executing;
|
case '已完成':
|
case 2:
|
return this.actionConfig.completed;
|
default:
|
return this.actionConfig.unexecuted;
|
}
|
},
|
|
search(res) {
|
uni.showToast({
|
title: '搜索:' + res.value,
|
icon: 'none'
|
})
|
},
|
input(res) {
|
console.log('----input:', res)
|
},
|
clear(res) {
|
console.log('clear事件,清除值为:' + res.value)
|
},
|
/**
|
* @param {Object} res
|
* 当输入框失去焦点时触发
|
*/
|
blur(res) {
|
console.log('blur事件,输入值为:' + res.value)
|
|
},
|
/**
|
* @param {Object} e
|
* 当输入框获得焦点时触发
|
*/
|
focus(e) {
|
console.log('blur事件,输入值为:' + e.value)
|
|
},
|
cancel(res) {
|
console.log('blur事件,输入值为:' + res.value)
|
},
|
ed(res) {
|
console.log(res)
|
},
|
dateChange(d) {
|
uni.showToast({
|
icon: 'none',
|
title: d
|
})
|
},
|
|
searBut() {
|
this.msgList = [];
|
this.$http.get(this.url.list, {
|
params: {
|
pageNo: 1,
|
pageSize: this.upOption.page.size,
|
num: this.formData.num,
|
createUserName: this.formData.createUserName,
|
endCreateTime: this.formData.endCreateTime,
|
startCreateTime: this.formData.startCreateTime,
|
column: "createTime",
|
order: "desc",
|
type: 2,
|
status: 0
|
}
|
}).then(res => {
|
//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
this.announcement1 = res.data.result.records
|
this.mescroll.endSuccess(this.announcement1.length);
|
console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data)
|
this.msg1Count = res.data.result.total
|
this.msg1Title = "通知(" + res.data.result.total + ")";
|
for (let annItem of this.announcement1) {
|
this.msgList.push(annItem)
|
}
|
}
|
if (page.num == 1) {
|
this.msgList = []; //如果是第一页需手动制空列表
|
this.msgList = this.msgList.concat(this.announcement1); //追加新数据
|
}
|
|
}).catch(() => {
|
//联网失败, 结束加载
|
this.mescroll.endErr();
|
uni.showToast({
|
title: '网络异常,请稍后再试',
|
icon: 'none'
|
});
|
})
|
|
|
},
|
mescrollInit(mescroll) {
|
console.log('mescrollInit')
|
this.mescroll = mescroll;
|
},
|
|
// 按钮点击处理
|
handleButtonClick(item, button) {
|
console.log('点击按钮:', button.text, '工单:', item.billNo);
|
|
switch (button.type) {
|
case 'check':
|
// 齐套检查
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'process':
|
// 工艺点检
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'device':
|
// 设备点检
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'sample':
|
// 样件校验
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'feed':
|
// 上料
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'record':
|
// 操作记录
|
uni.navigateTo({
|
url: button.path + '?billNo=' + item.billNo
|
});
|
break;
|
case 'report':
|
// 报工
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'inspection':
|
// 生产检验
|
uni.navigateTo({
|
url: button.path
|
});
|
break;
|
case 'detail':
|
// 详情
|
uni.navigateTo({
|
url: button.path + '?billNo=' + item.billNo
|
});
|
break;
|
default:
|
uni.showToast({
|
title: '功能开发中',
|
icon: 'none'
|
});
|
}
|
},
|
|
upCallback(page) {
|
//联网加载数据
|
this.$http.get(this.url.list, {
|
params: {
|
pageNo: page.num,
|
pageSize: page.size,
|
order: "desc",
|
column: "createTime",
|
type: 2,
|
status: 0
|
|
}
|
}).then(res => {
|
//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
this.announcement1 = res.data.result.records
|
this.mescroll.endSuccess(this.announcement1.length);
|
//console.log("url", res)
|
//设置列表数据
|
if (res.data.success) {
|
console.log("res", res.data)
|
this.msg1Count = res.data.result.total
|
this.msg1Title = "通知(" + res.data.result.total + ")";
|
for (let annItem of this.announcement1) {
|
this.msgList.push(annItem)
|
}
|
}
|
if (page.num == 1) {
|
this.msgList = []; //如果是第一页需手动制空列表
|
this.msgList = this.msgList.concat(this.announcement1); //追加新数据
|
}
|
|
}).catch(() => {
|
//联网失败, 结束加载
|
this.mescroll.endErr();
|
uni.showToast({
|
title: '网络异常,请稍后再试',
|
icon: 'none'
|
});
|
})
|
|
},
|
|
}
|
}
|
</script>
|
|
<style>
|
<style scoped>.container {
|
background-color: #f5f5f5;
|
min-height: 100vh;
|
}
|
|
.tab-container {
|
background-color: #ffffff;
|
}
|
|
.production-container {
|
padding: 20rpx;
|
}
|
|
.bill-table {
|
background-color: #ffffff;
|
border-radius: 16rpx;
|
margin-bottom: 20rpx;
|
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
|
overflow: hidden;
|
}
|
|
.table-content {
|
padding: 20rpx;
|
}
|
|
.table-row {
|
display: flex;
|
margin-bottom: 15rpx;
|
}
|
|
.table-row:last-child {
|
margin-bottom: 0;
|
}
|
|
.table-header {
|
flex: 0 0 180rpx;
|
font-size: 28rpx;
|
color: #666;
|
}
|
|
.table-value {
|
flex: 1;
|
font-size: 28rpx;
|
color: #333;
|
display: flex;
|
align-items: center;
|
}
|
|
.right-content {
|
margin-left: auto;
|
color: #999;
|
font-size: 26rpx;
|
}
|
|
.status-tag {
|
padding: 6rpx 12rpx;
|
border-radius: 8rpx;
|
font-size: 24rpx;
|
background-color: #ff6347;
|
color: #ffffff;
|
}
|
|
.status-tag.passed {
|
background-color: #39b54a;
|
}
|
|
.status-tag.called {
|
background-color: #ffaa00;
|
}
|
|
.button-group {
|
display: flex;
|
flex-wrap: wrap;
|
gap: 15rpx;
|
}
|
|
.action-btn {
|
padding: 12rpx 20rpx;
|
font-size: 24rpx;
|
border-radius: 8rpx;
|
border: none;
|
background-color: #007AFF;
|
color: #ffffff;
|
min-width: 120rpx;
|
text-align: center;
|
}
|
|
/* 不同操作按钮的颜色 */
|
.action-btn.check {
|
background-color: #007AFF;
|
}
|
|
.action-btn.process {
|
background-color: #39b54a;
|
}
|
|
.action-btn.device {
|
background-color: #9932cc;
|
}
|
|
.action-btn.sample {
|
background-color: #ff6347;
|
}
|
|
.action-btn.feed {
|
background-color: #ffa500;
|
}
|
|
.action-btn.report {
|
background-color: #1e90ff;
|
}
|
|
.action-btn.inspection {
|
background-color: #228b22;
|
}
|
|
.action-btn.detail {
|
background-color: #6a5acd;
|
}
|
|
.action-btn.record {
|
background-color: #808080;
|
}
|
|
.operation-row {
|
margin-top: 10rpx;
|
padding-top: 15rpx;
|
border-top: 1rpx solid #eee;
|
}
|
|
.empty-tip {
|
text-align: center;
|
padding: 100rpx 0;
|
color: #999;
|
font-size: 28rpx;
|
}
|
|
/* 标签页样式 */
|
.nav {
|
white-space: nowrap;
|
width: 100%;
|
}
|
|
.cu-item {
|
display: inline-block;
|
min-width: 150rpx;
|
padding: 0 30rpx;
|
height: 80rpx;
|
line-height: 80rpx;
|
text-align: center;
|
}
|
|
.cu-item.cur {
|
border-bottom: 4rpx solid #0081ff;
|
}
|
</style>
|