<template>
|
<view>
|
<!-- 刷新页面后的顶部提示框 -->
|
<view class="tips" :class="{ 'tips-ani': tipShow }">
|
<view class="tips-icon">✓</view>
|
<view class="tips-text">刷新成功</view>
|
</view>
|
|
<view class="newsTab">
|
<uni-segmented-control
|
:current="current"
|
:values="items"
|
@clickItem="onClickItem"
|
style-type="button"
|
active-color="#409EFF"
|
class="segmented-control fixed-tabs"
|
></uni-segmented-control>
|
|
<view class="content">
|
<view v-show="current===0">
|
<!-- 基于 uni-list 的页面布局 -->
|
<view v-if="data.length === 0" class="empty-state">
|
<view class="empty-icon">📝</view>
|
<view class="empty-text">暂无未提交的检验单</view>
|
</view>
|
|
<uni-list v-else>
|
<!-- 优化后的列表项 -->
|
<uni-list-item
|
style="margin-top: 15px;"
|
class="list-item enhanced-list"
|
direction="column"
|
v-for="item in data"
|
:key="item.id"
|
:to="'Add?id='+item.id+'&releaseNo='+item.releaseNo"
|
>
|
<!-- 通过header插槽定义列表的标题 -->
|
<template v-slot:header>
|
<view class="card-header pending-header">
|
<view class="form-group">
|
<label class="form-label">检验单号:</label>
|
<input class="form-input order-no" disabled="true" type="text" v-model="item.releaseNo"/>
|
</view>
|
</view>
|
</template>
|
|
<!-- 通过body插槽定义列表内容显示 -->
|
<template v-slot:body>
|
<view class="card-body pending-body">
|
<view class="row">
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">创建时间:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.createDate"/>
|
</view>
|
</view>
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">创建人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.createBy"/>
|
</view>
|
</view>
|
</view>
|
|
<view class="row">
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">产线:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.daa020"/>
|
</view>
|
</view>
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">物料编码:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.itemNo"/>
|
</view>
|
</view>
|
</view>
|
|
<!-- 产品名称单独一行 -->
|
<view class="form-group">
|
<label class="form-label">产品名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.itemName"/>
|
</view>
|
|
<!-- 产品规格单独一行 -->
|
<view class="form-group">
|
<label class="form-label">产品规格:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.itemModel"/>
|
</view>
|
|
<view class="row status-row">
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label">工单数量:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.planQty"/>
|
</view>
|
</view>
|
<view class="col-50">
|
<view class="form-group status-group">
|
<label class="form-label lab">检测结果:</label>
|
<span class="status-tag pending-tag" :class="item.fcheckResu === '合格' ? 'success' : 'danger'">
|
{{ item.fcheckResu }}
|
</span>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
|
<view v-show="current===1">
|
<view v-if="data.length === 0" class="empty-state">
|
<view class="empty-icon">📁</view>
|
<view class="empty-text">暂无已提交的检验单</view>
|
</view>
|
|
<uni-list v-else>
|
<!-- 已提交列表项样式 -->
|
<uni-list-item
|
style="margin-top: 15px;"
|
class="list-item enhanced-list"
|
direction="column"
|
v-for="item in data"
|
:key="item.id"
|
:to="'Add?id='+item.id+'&releaseNo='+item.releaseNo"
|
>
|
<!-- 通过header插槽定义列表的标题 -->
|
<template v-slot:header>
|
<view class="card-header submitted-header">
|
<view class="form-group">
|
<label class="form-label">检验单号:</label>
|
<input class="form-input order-no" disabled="true" type="text" v-model="item.releaseNo"/>
|
</view>
|
</view>
|
</template>
|
|
<!-- 通过body插槽定义列表内容显示 -->
|
<template v-slot:body>
|
<view class="card-body submitted-body">
|
<view class="row">
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">创建时间:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.createDate"/>
|
</view>
|
</view>
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">创建人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.createBy"/>
|
</view>
|
</view>
|
</view>
|
|
<view class="row">
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">产线:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.daa020"/>
|
</view>
|
</view>
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label lab">物料编码:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.itemNo"/>
|
</view>
|
</view>
|
</view>
|
|
<!-- 产品名称单独一行 -->
|
<view class="form-group">
|
<label class="form-label">产品名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.itemName"/>
|
</view>
|
|
<!-- 产品规格单独一行 -->
|
<view class="form-group">
|
<label class="form-label">产品规格:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.itemModel"/>
|
</view>
|
|
<view class="row status-row">
|
<view class="col-50">
|
<view class="form-group">
|
<label class="form-label">工单数量:</label>
|
<input class="form-input" disabled="true" type="text" v-model="item.planQty"/>
|
</view>
|
</view>
|
<view class="col-50">
|
<view class="form-group status-group">
|
<label class="form-label lab">检测结果:</label>
|
<span class="status-tag submitted-tag" :class="item.fcheckResu === '合格' ? 'success' : 'danger'">
|
{{ item.fcheckResu }}
|
</span>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
</view>
|
</view>
|
|
<!-- 加载更多组件 -->
|
<view v-if="loading || noData" class="load-more-container">
|
<uni-load-more :status="options.status" />
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
components: {},
|
data() {
|
return {
|
items: ['未提交', '已提交'],
|
current: 0,
|
data: [],
|
tipShow: false, // 是否显示顶部提示框
|
|
// 多页数据所需参数
|
pageIndex: 1,
|
limit: 20,
|
totalPage: 0,
|
totalCount: 0,
|
noData: false, // 没有更多数据了
|
isLoading: false, // 是否正在加载
|
|
// 加载更多组件状态
|
options: {
|
status: 'more'
|
}
|
};
|
},
|
onLoad() {
|
// 页面加载时调用的事件
|
this.init();
|
},
|
methods: {
|
init() {
|
let result = "未完成";
|
if (this.current === 1) {
|
result = "已完成";
|
}
|
|
// 获取当前登录的用户
|
let userName = this.$loginInfo.account;
|
|
// 页面加载时调用的事件
|
this.$post({
|
url: "/XJ/getPage",
|
data: {
|
pageIndex: this.pageIndex,
|
limit: this.limit,
|
createUser: userName,
|
result: result
|
}
|
}).then(res => {
|
if (this.pageIndex === 1) {
|
// 如果是第一页,直接覆盖原数据
|
this.data = res.data.tbBillList;
|
} else {
|
if (res.data.tbBillList.length > 0) {
|
// 如果是下一页,追加新数据
|
this.data = [...this.data, ...res.data.tbBillList];
|
}
|
}
|
|
this.totalCount = res.data.totalCount;
|
this.totalPage = Math.ceil(this.totalCount / this.limit);
|
|
this.noData = this.pageIndex >= this.totalPage;
|
this.isLoading = false; // 结束加载
|
|
// 更新加载更多状态
|
this.options.status = this.noData ? 'noMore' : 'more';
|
}).catch(() => {
|
this.isLoading = false; // 出现错误时结束加载
|
this.options.status = 'fail';
|
});
|
},
|
handleFabClick() {
|
uni.navigateTo({
|
url: 'Add?id'
|
});
|
},
|
onClickItem(index) {
|
if (this.current !== index.currentIndex) {
|
this.current = index.currentIndex;
|
this.data = [];
|
this.pageIndex = 1;
|
this.init();
|
}
|
},
|
},
|
/**
|
* 下拉刷新回调函数
|
*/
|
onPullDownRefresh() {
|
// 重新执行一遍查询
|
this.init();
|
this.tipShow = true;
|
|
// 关闭动画
|
uni.stopPullDownRefresh();
|
|
// 正确写法(使用箭头函数保持this指向)
|
setTimeout(() => {
|
this.tipShow = false;
|
}, 1000);
|
},
|
/**
|
* 上拉加载回调函数
|
*/
|
onReachBottom() {
|
if (this.noData || this.isLoading) return;
|
|
this.isLoading = true;
|
this.pageIndex++;
|
this.init(); // 加载更多数据
|
},
|
onShow() {
|
// 每次进入页面都会执行的方法
|
// this.init();
|
}
|
};
|
</script>
|
|
<style lang="scss">
|
@import '@/common/uni-ui.scss';
|
|
/* 全局样式 */
|
page {
|
display: flex;
|
flex-direction: column;
|
box-sizing: border-box;
|
background-color: #f8f9fa;
|
min-height: 100%;
|
height: auto;
|
padding-bottom: 80px; /* 为浮动按钮留出空间 */
|
}
|
|
/* 顶部提示框 */
|
.tips {
|
position: fixed;
|
top: 0;
|
left: 0;
|
right: 0;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
color: #3a86ff;
|
font-size: 14px;
|
line-height: 40px;
|
background-color: #e6f7ff;
|
height: 0;
|
opacity: 0;
|
transform: translateY(-100%);
|
transition: all 0.3s ease;
|
z-index: 1000;
|
box-shadow: 0 2px 10px rgba(64, 158, 255, 0.2);
|
}
|
|
.tips-ani {
|
transform: translateY(0);
|
height: 40px;
|
opacity: 1;
|
}
|
|
.tips-icon {
|
margin-right: 8px;
|
font-size: 18px;
|
font-weight: bold;
|
}
|
|
/* 固定标签页样式 */
|
.fixed-tabs {
|
background-color: #fff;
|
border-bottom: 2px solid #409EFF;
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
position: sticky;
|
top: 0;
|
z-index: 999;
|
}
|
|
/* 分段控件按钮样式增强 */
|
.uni-segmented-control__button {
|
font-weight: 500;
|
font-size: 16px;
|
color: #606266;
|
transition: all 0.2s;
|
}
|
|
.uni-segmented-control__button--active {
|
color: #409EFF;
|
border-bottom: 2px solid #409EFF;
|
background-color: transparent;
|
font-weight: 600;
|
}
|
|
/* 内容区域 */
|
.content {
|
width: 100%;
|
padding: 15px;
|
box-sizing: border-box;
|
margin-top: 10px;
|
}
|
|
/* 卡片样式 - 增强视觉层次 */
|
.card-header, .card-body {
|
border-radius: 12px;
|
padding: 18px;
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
|
transition: all 0.3s ease;
|
}
|
|
.card-header {
|
margin-bottom: 10px;
|
display: flex;
|
align-items: center;
|
}
|
|
.card-body {
|
margin-bottom: 15px;
|
}
|
|
/* 未提交状态卡片样式 */
|
.pending-header {
|
background: linear-gradient(145deg, #f0f9ff, #e0f2fe);
|
border-left: 4px solid #409EFF;
|
}
|
|
.pending-body {
|
background-color: #f0f9ff;
|
}
|
|
/* 已提交状态卡片样式 */
|
.submitted-header {
|
background: linear-gradient(145deg, #f6f6f6, #e9e9e9);
|
border-left: 4px solid #909399;
|
}
|
|
.submitted-body {
|
background-color: #f6f6f6;
|
}
|
|
/* 表单样式增强 */
|
.form-group {
|
display: flex;
|
align-items: flex-start;
|
margin-bottom: 18px; /* 增加间距 */
|
}
|
|
.form-label {
|
margin-bottom: 0;
|
padding: 6px 10px;
|
font-size: 14px;
|
width: 100px; /* 增加标签宽度 */
|
color: #606266;
|
flex-shrink: 0;
|
font-weight: 500;
|
}
|
|
.form-label.lab {
|
color: #303133;
|
font-weight: 600;
|
}
|
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 10px 14px; /* 增加内边距 */
|
font-size: 14px; /* 增大字体 */
|
background-color: rgba(255, 255, 255, 0.7);
|
border: 1px solid #dcdfe6;
|
border-radius: 8px; /* 增大圆角 */
|
color: #303133;
|
transition: all 0.2s;
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
}
|
|
.form-input:active {
|
transform: scale(0.99);
|
}
|
|
/* 检验单号底色 */
|
.order-no {
|
background-color: #e6f7ff; /* 浅蓝色底色 */
|
border-color: #bfdbfe;
|
font-weight: 500;
|
}
|
|
/* 行和列布局 */
|
.row {
|
display: flex;
|
margin-bottom: 18px; /* 增加间距 */
|
}
|
|
.status-row {
|
border-top: 1px dashed #dcdfe6;
|
padding-top: 12px;
|
margin-top: 12px;
|
}
|
|
.col-50 {
|
flex: 1;
|
margin-right: 18px; /* 增加间距 */
|
}
|
|
.col-50:last-child {
|
margin-right: 0;
|
}
|
|
/* 状态标签增强 */
|
.status-group {
|
align-items: center;
|
}
|
|
.status-tag {
|
display: inline-block;
|
padding: 6px 12px; /* 增加内边距 */
|
font-size: 14px; /* 增大字体 */
|
border-radius: 20px; /* 圆形标签 */
|
margin-left: 12px; /* 增加间距 */
|
font-weight: 500;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
}
|
|
.pending-tag {
|
background-color: rgba(64, 158, 255, 0.1);
|
color: #409EFF;
|
}
|
|
.submitted-tag {
|
background-color: rgba(144, 147, 153, 0.1);
|
color: #909399;
|
}
|
|
.success {
|
background-color: #e6f7ed;
|
color: #36b37e;
|
border: 1px solid #d1fae5;
|
}
|
|
.danger {
|
background-color: #ffefef;
|
color: #ff4d4f;
|
border: 1px solid #fee2e2;
|
}
|
|
/* 浮动按钮 */
|
.plus-button {
|
position: fixed;
|
bottom: 20px;
|
right: 20px;
|
width: 72px;
|
height: 72px;
|
border-radius: 50%;
|
background: linear-gradient(135deg, #409EFF, #66B1FF);
|
color: #ffffff;
|
text-align: center;
|
line-height: 72px;
|
font-size: 32px;
|
cursor: pointer;
|
z-index: 1000;
|
box-shadow: 0 6px 20px rgba(64, 158, 255, 0.4); /* 增强按钮阴影 */
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
transition: all 0.3s ease;
|
}
|
|
.plus-button:active {
|
transform: scale(0.95);
|
box-shadow: 0 4px 15px rgba(64, 158, 255, 0.3);
|
}
|
|
.plus-button:hover {
|
transform: scale(1.03);
|
}
|
|
/* 空状态 */
|
.empty-state {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
padding: 60px 0;
|
color: #909399;
|
}
|
|
.empty-icon {
|
font-size: 64px;
|
margin-bottom: 24px;
|
color: #c0c4cc;
|
}
|
|
.empty-text {
|
font-size: 16px;
|
font-weight: 500;
|
}
|
|
/* 加载更多容器 */
|
.load-more-container {
|
padding: 30px 0;
|
text-align: center;
|
}
|
|
/* 增强列表项动画 */
|
.enhanced-list {
|
transition: all 0.3s ease;
|
border-radius: 12px;
|
overflow: hidden;
|
}
|
|
.enhanced-list:active {
|
transform: translateY(2px);
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
|
}
|
|
.enhanced-list:hover {
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
|
transform: translateY(-2px);
|
}
|
</style>
|