<template>
|
<view class="page-container">
|
<!-- 表单容器 -->
|
<view class="form-card">
|
<form :modelValue="formData">
|
<view class="form-group">
|
<label class="form-label">检验单号:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.releaseNo" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料编码:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemNo" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemName" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">物料规格:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemModel" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">订单编号:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.saleOrderNo" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">送检数量:</label>
|
<input class="form-input" disabled="true" type="number" v-model="formData.planQty" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建时间:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.createDate" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.createUser" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">不良描述:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.remeke" />
|
</view>
|
</form>
|
</view>
|
|
<!-- 检验项目卡片 -->
|
<view class="inspection-card">
|
<view class="card-header">
|
<view class="header-icon">🔍</view>
|
<text class="header-title">检验项目</text>
|
<view class="header-badge">{{ tableData.length }}</view>
|
</view>
|
|
<view class="inspection-list" v-if="tableData.length > 0">
|
<view v-for="(item, index) in tableData" :key="index" class="inspection-item"
|
:class="{ 'item-completed': item.fcheckResu === '合格', 'item-failed': item.fcheckResu === '不合格' }">
|
|
<!-- 左侧状态指示器 -->
|
<view class="status-indicator"
|
:class="{ 'status-pass': item.fcheckResu === '合格', 'status-fail': item.fcheckResu === '不合格', 'status-pending': item.fcheckResu === '未检验' }">
|
</view>
|
|
<!-- 主要内容区域 -->
|
<view class="item-content">
|
<view class="item-header">
|
<view class="item-title">{{ item.fcheckItem }}</view>
|
<view class="status-badge"
|
:class="{ 'badge-pass': item.fcheckResu === '合格', 'badge-fail': item.fcheckResu === '不合格', 'badge-pending': item.fcheckResu === '未检验' }">
|
<text class="status-icon">{{ item.fcheckResu === '合格' ? '✓' : item.fcheckResu === '不合格' ? '✗' : '○' }}</text>
|
<text class="status-text">{{ item.fcheckResu }}</text>
|
</view>
|
</view>
|
|
<view class="item-description" v-if="item.fcheckItemDesc">
|
<text class="description-text">{{ item.fcheckItemDesc }}</text>
|
</view>
|
|
<view class="item-footer">
|
<view class="progress-info">
|
<text class="progress-label">检验进度:</text>
|
<view class="progress-bar">
|
<view class="progress-fill"
|
:style="{ width: (item.fenterQty / item.checkQyt * 100) + '%' }"
|
:class="{ 'progress-complete': item.fenterQty >= item.checkQyt, 'progress-incomplete': item.fenterQty < item.checkQyt }">
|
</view>
|
</view>
|
<text class="progress-text">{{ item.fenterQty }}/{{ item.checkQyt }}</text>
|
</view>
|
|
<view class="action-button" @click="toDetail(item)"
|
:class="{ 'btn-complete': item.fenterQty >= item.checkQyt, 'btn-incomplete': item.fenterQty < item.checkQyt }">
|
<text class="btn-text">{{ item.fenterQty >= item.checkQyt ? '查看详情' : '开始检验' }}</text>
|
<text class="btn-icon">→</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 空状态 -->
|
<view v-else class="empty-state">
|
<view class="empty-icon">📋</view>
|
<text class="empty-text">暂无检验项目</text>
|
<text class="empty-desc">请先生成检验项目</text>
|
</view>
|
</view>
|
|
<!-- 操作按钮区域 -->
|
<view class="action-buttons">
|
<button class="btn btn-primary" @click="submitInspection">提交</button>
|
<button class="secondary-btn" @click="uploadImages">上传/查看图片</button>
|
<button class="btn btn-secondary" @click="addDefectDescription">添加不合格描述</button>
|
</view>
|
|
|
<!-- 不合格描述弹出层 -->
|
<view v-if="remarksPopup" class="overlay active">
|
<view class="popup" :class="{ 'popup-scale': isPopupAnimated }" @animationend="isPopupAnimated = false">
|
<view class="popup-header">
|
<h3 class="popup-title">修改不合格描述</h3>
|
<view class="close-btn" @click="remarksPopup = !remarksPopup">×</view>
|
</view>
|
<form>
|
<view class="form-group">
|
<label class="form-label">不合格描述:</label>
|
<input class="form-input" type="text" v-model="remarks" />
|
</view>
|
<view class="button-group popup-buttons">
|
<button :class="['action-btn', 'btn-danger']" @click="editRemarks">
|
修改
|
</button>
|
<button :class="['action-btn', 'btn-light']" @click="remarksPopup = !remarksPopup">
|
取消
|
</button>
|
</view>
|
</form>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
formData: {},
|
tableData: [],
|
remarks: "",
|
remarksPopup: false,
|
isPopupAnimated: false,
|
}
|
},
|
onLoad(options) {
|
//options中包含了url附带的参数
|
let params = options;
|
|
if (params["id"]) {
|
this.formData.id = params["id"];
|
this.init();
|
}
|
},
|
methods: {
|
init() {
|
let userName = this.$loginInfo.account;
|
this.$post({
|
url: "/MesOqcItemsDetect02/getPage",
|
data: {
|
id: this.formData.id,
|
createUser: userName,
|
pageIndex: 1,
|
limit: 1,
|
}
|
}).then(res => {
|
let data = res.data[0];
|
if (data) {
|
this.formData = data;
|
this.getDetail5();
|
}
|
});
|
},
|
|
getDetail5() {
|
let userName = this.$loginInfo.account;
|
this.$post({
|
url: "/MesOqcItemsDetect02/GetDetail5",
|
data: {
|
id: this.formData.id,
|
createUser: userName,
|
releaseNo: this.formData.releaseNo,
|
}
|
}).then(res => {
|
let data = res.data;
|
this.tableData = data;
|
});
|
},
|
uploadImages() {
|
// 上传/查看图片的逻辑
|
uni.navigateTo({
|
url: 'ImageItem?id=' + this.formData.releaseNo
|
});
|
},
|
addDefectDescription() {
|
// 确保表单数据存在
|
if (!this.formData) return;
|
|
this.remarksPopup = !this.remarksPopup;
|
this.remarks = this.formData.remeke || '';
|
this.isPopupAnimated = true;
|
},
|
toDetail(item) {
|
|
uni.navigateTo({
|
url: 'detail?mainId=' + item.id + '&releaseNo=' + this.formData
|
.releaseNo
|
});
|
|
},
|
submitInspection() {
|
// 检验提交的逻辑
|
this.$post({
|
url: "/MesOqcItemsDetect02/IqcQaSubmit",
|
data: {
|
userNo: this.$loginInfo.account,
|
releaseNo: this.formData.releaseNo
|
}
|
}).then(res => {
|
if (res.status == 0) {
|
|
uni.showToast({
|
title: res.message.toString(),
|
icon: 'success',
|
duration: 2000
|
})
|
// 如果有页面跳转,需要用定时器延迟
|
setTimeout(() => {
|
uni.navigateTo({
|
url: 'List'
|
});
|
}, 2000); // 保持与 duration 相同的时长
|
|
} else {
|
uni.showModal({
|
title: "提示",
|
content: res.message.toString(),
|
confirmText: "确定",
|
showCancel: false,
|
success: (res) => {
|
|
}
|
})
|
}
|
})
|
},
|
editRemarks() {
|
if (this.remarks && this.formData.id) {
|
this.$post({
|
url: "/MesOqcItemsDetect02/saveRemarksGid",
|
data: {
|
gid: this.formData.id,
|
remarks: this.remarks,
|
releaseNo: this.formData.releaseNo,
|
}
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.formData.remarks = this.remarks;
|
this.remarksPopup = false;
|
this.$showMessage("保存成功");
|
this.init();
|
} else {
|
this.$showMessage("保存失败");
|
}
|
}).catch(() => {
|
this.$showMessage("保存失败,请重试");
|
});
|
} else if (!this.formData.id) {
|
this.$showMessage("请先生成检验单");
|
} else {
|
this.$showMessage("请输入不合格描述");
|
}
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
.page-container {
|
padding: 20px;
|
background-color: #f5f5f5;
|
min-height: 100vh;
|
}
|
|
/* 表单卡片 */
|
.form-card {
|
background-color: #fff;
|
border-radius: 12px;
|
padding: 20px;
|
margin-bottom: 20px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
}
|
|
/* 表单组 */
|
.form-group {
|
display: flex;
|
align-items: center;
|
margin-bottom: 15px;
|
}
|
|
.form-group:last-child {
|
margin-bottom: 0;
|
}
|
|
/* 标签样式 */
|
.form-label {
|
width: 120px;
|
color: #333;
|
font-size: 14px;
|
font-weight: 500;
|
flex-shrink: 0;
|
}
|
|
/* 输入框样式 */
|
.form-input {
|
flex: 1;
|
height: 40px;
|
padding: 0 10px;
|
border: 1px solid #e0e0e0;
|
border-radius: 8px;
|
background-color: #f8f8f8;
|
color: #666;
|
font-size: 14px;
|
transition: all 0.3s ease;
|
}
|
|
.form-input:disabled {
|
background-color: #e9e9e9;
|
}
|
|
.form-input:focus {
|
border-color: #007AFF;
|
outline: none;
|
}
|
|
/* 操作按钮区域 */
|
.action-buttons {
|
display: flex;
|
justify-content: space-between;
|
gap: 15px;
|
padding: 15px 0;
|
}
|
|
.btn {
|
flex: 1;
|
height: 45px;
|
border-radius: 8px;
|
border: none;
|
color: #fff;
|
font-size: 14px;
|
font-weight: 500;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
cursor: pointer;
|
transition: background-color 0.3s ease;
|
}
|
|
.btn-primary {
|
background-color: #007AFF;
|
}
|
|
.btn-primary:hover {
|
background-color: #0056CC;
|
}
|
|
.secondary-btn {
|
background-color: #8E8E93;
|
}
|
|
.secondary-btn:hover {
|
background-color: #6D6D70;
|
}
|
|
.btn-secondary {
|
background-color: #8E8E93;
|
}
|
|
.btn-secondary:hover {
|
background-color: #6D6D70;
|
}
|
|
/* 检验项目卡片 */
|
.inspection-card {
|
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
|
border-radius: 16px;
|
padding: 0;
|
margin-bottom: 24px;
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
|
border: 1px solid #e2e8f0;
|
overflow: hidden;
|
}
|
|
/* 卡片头部 */
|
.card-header {
|
background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
|
padding: 20px 24px;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
position: relative;
|
}
|
|
.card-header::before {
|
content: '';
|
position: absolute;
|
top: 0;
|
left: 0;
|
right: 0;
|
bottom: 0;
|
background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
|
pointer-events: none;
|
}
|
|
.header-icon {
|
font-size: 24px;
|
margin-right: 12px;
|
}
|
|
.header-title {
|
color: white;
|
font-size: 18px;
|
font-weight: 600;
|
flex: 1;
|
}
|
|
.header-badge {
|
background: rgba(255, 255, 255, 0.2);
|
color: white;
|
padding: 6px 12px;
|
border-radius: 20px;
|
font-size: 14px;
|
font-weight: 500;
|
backdrop-filter: blur(10px);
|
}
|
|
/* 检验列表 */
|
.inspection-list {
|
padding: 24px;
|
}
|
|
.inspection-item {
|
background: white;
|
border-radius: 12px;
|
margin-bottom: 16px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
border: 1px solid #e2e8f0;
|
overflow: hidden;
|
transition: all 0.3s ease;
|
position: relative;
|
}
|
|
.inspection-item:hover {
|
transform: translateY(-2px);
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
}
|
|
.inspection-item:last-child {
|
margin-bottom: 0;
|
}
|
|
.inspection-item.item-completed {
|
border-left: 4px solid #10b981;
|
background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
|
}
|
|
.inspection-item.item-failed {
|
border-left: 4px solid #ef4444;
|
background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
|
}
|
|
/* 状态指示器 */
|
.status-indicator {
|
position: absolute;
|
left: 0;
|
top: 0;
|
bottom: 0;
|
width: 4px;
|
background: #e2e8f0;
|
}
|
|
.status-indicator.status-pass {
|
background: linear-gradient(180deg, #10b981 0%, #059669 100%);
|
}
|
|
.status-indicator.status-fail {
|
background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
|
}
|
|
.status-indicator.status-pending {
|
background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
|
}
|
|
/* 项目内容 */
|
.item-content {
|
padding: 20px 24px;
|
margin-left: 4px;
|
}
|
|
.item-header {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 12px;
|
}
|
|
.item-title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #1e293b;
|
flex: 1;
|
}
|
|
.status-badge {
|
display: flex;
|
align-items: center;
|
padding: 6px 12px;
|
border-radius: 20px;
|
font-size: 12px;
|
font-weight: 500;
|
}
|
|
.status-badge.badge-pass {
|
background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
|
color: #166534;
|
border: 1px solid #86efac;
|
}
|
|
.status-badge.badge-fail {
|
background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
|
color: #991b1b;
|
border: 1px solid #fca5a5;
|
}
|
|
.status-badge.badge-pending {
|
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
|
color: #92400e;
|
border: 1px solid #fcd34d;
|
}
|
|
.status-icon {
|
margin-right: 6px;
|
font-weight: bold;
|
}
|
|
/* 项目描述 */
|
.item-description {
|
margin-bottom: 16px;
|
}
|
|
.description-text {
|
color: #64748b;
|
font-size: 14px;
|
line-height: 1.5;
|
background: #f8fafc;
|
padding: 12px 16px;
|
border-radius: 8px;
|
border-left: 3px solid #e2e8f0;
|
}
|
|
/* 项目底部 */
|
.item-footer {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
gap: 16px;
|
}
|
|
.progress-info {
|
display: flex;
|
align-items: center;
|
gap: 12px;
|
flex: 1;
|
}
|
|
.progress-label {
|
font-size: 14px;
|
color: #64748b;
|
font-weight: 500;
|
white-space: nowrap;
|
}
|
|
.progress-bar {
|
flex: 1;
|
height: 8px;
|
background: #e2e8f0;
|
border-radius: 4px;
|
overflow: hidden;
|
position: relative;
|
}
|
|
.progress-fill {
|
height: 100%;
|
border-radius: 4px;
|
transition: all 0.3s ease;
|
position: relative;
|
}
|
|
.progress-fill.progress-complete {
|
background: linear-gradient(90deg, #10b981 0%, #059669 100%);
|
}
|
|
.progress-fill.progress-incomplete {
|
background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
|
}
|
|
.progress-text {
|
font-size: 14px;
|
color: #374151;
|
font-weight: 600;
|
white-space: nowrap;
|
}
|
|
/* 操作按钮 */
|
.action-button {
|
display: flex;
|
align-items: center;
|
gap: 8px;
|
padding: 10px 16px;
|
border-radius: 8px;
|
cursor: pointer;
|
transition: all 0.3s ease;
|
font-size: 14px;
|
font-weight: 500;
|
white-space: nowrap;
|
}
|
|
.action-button.btn-complete {
|
background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
|
color: #1e40af;
|
border: 1px solid #93c5fd;
|
}
|
|
.action-button.btn-complete:hover {
|
background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
|
transform: translateX(4px);
|
}
|
|
.action-button.btn-incomplete {
|
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
|
color: #92400e;
|
border: 1px solid #fcd34d;
|
}
|
|
.action-button.btn-incomplete:hover {
|
background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
|
transform: translateX(4px);
|
}
|
|
.btn-text {
|
font-size: 14px;
|
}
|
|
.btn-icon {
|
font-size: 16px;
|
transition: transform 0.3s ease;
|
}
|
|
.action-button:hover .btn-icon {
|
transform: translateX(4px);
|
}
|
|
/* 空状态 */
|
.empty-state {
|
padding: 60px 24px;
|
text-align: center;
|
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
}
|
|
.empty-icon {
|
font-size: 48px;
|
margin-bottom: 16px;
|
opacity: 0.6;
|
}
|
|
.empty-text {
|
font-size: 18px;
|
color: #64748b;
|
font-weight: 500;
|
margin-bottom: 8px;
|
display: block;
|
}
|
|
.empty-desc {
|
font-size: 14px;
|
color: #94a3b8;
|
display: block;
|
}
|
|
/* 响应式设计 */
|
@media (max-width: 768px) {
|
.inspection-card {
|
margin: 0 -8px 24px -8px;
|
border-radius: 12px;
|
}
|
|
.card-header {
|
padding: 16px 20px;
|
}
|
|
.header-title {
|
font-size: 16px;
|
}
|
|
.inspection-list {
|
padding: 16px 20px;
|
}
|
|
.item-content {
|
padding: 16px 20px;
|
}
|
|
.item-header {
|
flex-direction: column;
|
align-items: flex-start;
|
gap: 8px;
|
}
|
|
.item-footer {
|
flex-direction: column;
|
align-items: stretch;
|
gap: 12px;
|
}
|
|
.progress-info {
|
flex-direction: column;
|
align-items: stretch;
|
gap: 8px;
|
}
|
|
.action-button {
|
justify-content: center;
|
}
|
}
|
|
/* 输入框中显示的工具提示 */
|
.value-with-tooltip {
|
position: relative;
|
}
|
|
.value-with-tooltip .tooltip {
|
position: absolute;
|
top: -30px;
|
left: 0;
|
background-color: rgba(0, 0, 0, 0.6);
|
color: #fff;
|
font-size: 12px;
|
padding: 5px;
|
border-radius: 4px;
|
}
|
|
/* 弹出层样式 */
|
.overlay {
|
position: fixed;
|
top: 0;
|
left: 0;
|
width: 100%;
|
height: 100%;
|
background-color: rgba(0, 0, 0, 0.5);
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
z-index: 1000;
|
opacity: 0;
|
transition: opacity 0.3s ease;
|
}
|
|
.overlay.active {
|
opacity: 1;
|
}
|
|
.popup {
|
background-color: #fff;
|
border-radius: 12px;
|
width: 90%;
|
max-width: 500px;
|
padding: 20px;
|
transform: scale(0.8);
|
transition: transform 0.3s ease;
|
}
|
|
.popup-scale {
|
transform: scale(1);
|
}
|
|
.popup-header {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
.popup-title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #333;
|
}
|
|
.close-btn {
|
font-size: 20px;
|
color: #333;
|
cursor: pointer;
|
}
|
|
.button-group {
|
display: flex;
|
justify-content: space-between;
|
margin-top: 20px;
|
}
|
|
.action-btn {
|
width: 48%;
|
padding: 10px;
|
border-radius: 8px;
|
border: none;
|
font-size: 14px;
|
font-weight: 500;
|
}
|
|
.btn-danger {
|
background-color: #dc3545;
|
color: #fff;
|
}
|
|
.btn-light {
|
background-color: #f8f8f8;
|
color: #333;
|
}
|
|
.btn-danger:hover {
|
background-color: #c82333;
|
}
|
|
.btn-light:hover {
|
background-color: #e9e9e9;
|
}
|
|
</style>
|