<template>
|
<view class="container">
|
<!-- 头部 -->
|
<view class="header">
|
<view class="title">入库检验项目明细</view>
|
<view class="order-number">检验单号: {{formData.id}}</view>
|
</view>
|
|
<!-- 基本信息 -->
|
<view class="section">
|
<view class="section-header">基本信息</view>
|
<view class="section-body">
|
<view class="info-grid">
|
<view class="info-item">
|
<view class="info-label">项目名称</view>
|
<view class="info-value">{{ formData.projName }}</view>
|
</view>
|
<view class="info-item" v-if="formData.itemMod">
|
<view class="info-label">质量要求</view>
|
<view class="info-value">{{ formData.itemMod }}</view>
|
</view>
|
<view class="info-item" v-if="formData.inspectionMethod">
|
<view class="info-label">检验方法</view>
|
<view class="info-value">{{ formData.inspectionMethod }}</view>
|
</view>
|
<view class="info-item" v-if="formData.usingInstruments">
|
<view class="info-label">使用仪表</view>
|
<view class="info-value">{{ formData.usingInstruments }}</view>
|
</view>
|
<view class="info-item">
|
<view class="info-label">检验数</view>
|
<view class="info-value">{{ formData.levelNum }}</view>
|
</view>
|
<view class="info-item" v-if="formData.qsCode">
|
<view class="info-label">检验标准编码</view>
|
<view class="info-value">{{ formData.qsCode }}</view>
|
</view>
|
<view class="info-item" v-if="formData.qsName">
|
<view class="info-label">检验标准名称</view>
|
<view class="info-value">{{ formData.qsName }}</view>
|
</view>
|
<view class="info-item" v-if="formData.fcheckLevel">
|
<view class="info-label">检验水平</view>
|
<view class="info-value">{{ formData.fcheckLevel }}</view>
|
</view>
|
<view class="info-item" v-if="formData.facLevel">
|
<view class="info-label">接收水平</view>
|
<view class="info-value">{{ formData.facLevel }}</view>
|
</view>
|
<view class="info-item" v-if="formData.minValue">
|
<view class="info-label">下限</view>
|
<view class="info-value">{{ formData.minValue }}</view>
|
</view>
|
<view class="info-item" v-if="formData.standardValue">
|
<view class="info-label">标准值</view>
|
<view class="info-value">{{ formData.standardValue }}</view>
|
</view>
|
<view class="info-item" v-if="formData.maxValue">
|
<view class="info-label">上限</view>
|
<view class="info-value">{{ formData.maxValue }}</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 检验结果 -->
|
<view class="section">
|
<view class="section-header">检验结果</view>
|
<view class="section-body">
|
<view class="info-grid">
|
<view class="info-item">
|
<view class="info-label">AC数</view>
|
<view class="info-value">{{formData.freQty ? formData.freQty - 1 : 0}}</view>
|
</view>
|
<view class="info-item">
|
<view class="info-label">RE数</view>
|
<view class="info-value">{{formData.freQty || 0}}</view>
|
</view>
|
<view class="info-item">
|
<view class="info-label">不合格数</view>
|
<view class="info-value">{{formData.unqualified || 0}}</view>
|
</view>
|
</view>
|
|
<view v-if="formData.result != null" class="result-preview">
|
<view class="info-label">预览结果</view>
|
<view class="info-value">{{formData.result}}</view>
|
</view>
|
|
<view v-if="formData.remarks != null" class="result-ng">
|
<view class="info-label">不合格描述</view>
|
<view class="info-value danger">{{formData.remarks}}</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 结果录入 -->
|
<view class="section">
|
<view class="section-header">检验结果录入</view>
|
<view class="section-body">
|
<view class="inspection-hint">
|
<view class="hint-text">没有最大值和最小值时填写0(未通过检验)或1(通过检验)</view>
|
</view>
|
<view class="input-group">
|
<view class="input-wrapper">
|
<input v-if="tableData.length < formData.levelNum"
|
v-model="formData.fcheckResu"
|
type="number"
|
class="result-input"
|
placeholder="请输入检验结果"
|
placeholder-class="placeholder" />
|
<button v-if="(tableData.length < formData.levelNum)"
|
class="btn primary-btn"
|
@click="submit">保存结果</button>
|
</view>
|
</view>
|
</view>
|
</view>
|
<!-- 图片预览 -->
|
<view v-if="isShowImg" class="section">
|
<view class="section-header">相关图片</view>
|
<view class="section-body">
|
<view class="image-preview" @click="previewImage">
|
<image :src="base64Image" mode="aspectFit" class="preview-image"/>
|
</view>
|
</view>
|
</view>
|
|
<!-- 结果表格 -->
|
<view v-if="tableData.length > 0" class="section">
|
<view class="section-header">检验记录</view>
|
<view class="section-body">
|
<view class="table-container">
|
<view class="table-header">
|
<view class="th">编号</view>
|
<view class="th">判定标识</view>
|
<view class="th">检验结果</view>
|
<view class="th">操作</view>
|
</view>
|
|
<view v-for="(item, index) in tableData" :key="index" class="table-row">
|
<view class="td">{{ index + 1 }}</view>
|
<view class="td">
|
<view class="result-badge" :class="item.fstand === '√' ? 'OK' : 'NG'">
|
{{ item.fstand }}
|
</view>
|
</view>
|
<view class="td">
|
<view class="result-badge" :class="item.fcheckResu === '1' ? 'OK' : 'NG'">
|
{{ item.fcheckResu }}
|
</view>
|
</view>
|
<view class="td">
|
<button v-if="isNumber" class="btn danger-btn" @click="toDetail(item)">修改</button>
|
<button v-if="!isNumber" class="btn danger-btn" @click="numberEdit(item)">{{ editResult(item.fcheckResu) }}</button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<!-- 操作按钮 -->
|
<view class="action-buttons">
|
<button class="action-btn warning" @click="saveRemarks">添加不合格描述</button>
|
</view>
|
|
<!-- 修改检验结果弹出框 -->
|
<view v-if="showPopup" class="overlay">
|
<view class="popup">
|
<view class="popup-header">
|
<h3>修改检验结果</h3>
|
</view>
|
<view class="popup-content">
|
<view class="input-group">
|
<view class="input-label">检验结果:</view>
|
<input class="input-field" type="text" v-model="editData.fcheckResu" placeholder="请输入检验结果"/>
|
</view>
|
</view>
|
<view class="popup-actions">
|
<button class="action-btn primary" @click="eidt">修改</button>
|
<button class="action-btn secondary" @click="showPopup = !showPopup">取消</button>
|
</view>
|
</view>
|
</view>
|
|
<!-- 修改不合格描述弹出框 -->
|
<view v-if="remarksPopup" class="overlay">
|
<view class="popup">
|
<view class="popup-header">
|
<h3>修改不合格描述</h3>
|
</view>
|
<view class="popup-content">
|
<view class="input-group">
|
<view class="input-label">不合格描述:</view>
|
<input class="input-field" type="text" v-model="remarks" placeholder="请输入不合格描述"/>
|
</view>
|
</view>
|
<view class="popup-actions">
|
<button class="action-btn primary" @click="editRemarks">修改</button>
|
<button class="action-btn secondary" @click="remarksPopup = !remarksPopup">取消</button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
|
export default {
|
data() {
|
return {
|
formData: {},
|
isNumber: false,
|
checkItem: "",
|
id: 0,
|
gid: 0,
|
itemInId: 0,
|
billNo: "",
|
showPopup: false,
|
editData: {},
|
tableData: [],
|
isShowImg: false,
|
base64Image: "",
|
remarks: "",
|
remarksPopup: false,
|
fcheckResu: null
|
}
|
},
|
methods: {
|
|
previewImage() {
|
uni.previewImage({
|
urls: [this.base64Image],
|
});
|
},
|
|
editResult(fcheckResu) {
|
if (fcheckResu == '1') {
|
return "改为不合格";
|
} else {
|
return "改为合格";
|
}
|
},
|
submit() {
|
|
let count = this.formData.levelNum;
|
let fstand = "√";
|
|
//有最大值和最小值就根据是否符合标准值更新判定结果,没有最大值和最小值就根据是否通过检验判定结果
|
if (this.formData.maxValue && this.formData.minValue) {
|
|
if (!this.formData.fcheckResu) {
|
this.$showMessage("请输入检验值");
|
return;
|
}
|
|
if (this.formData.fcheckResu >= this.formData.minValue && this.formData.fcheckResu <= this.formData
|
.maxValue) {
|
fstand = "√"
|
} else {
|
fstand = "×";
|
}
|
count = 1;
|
} else {
|
|
if (!this.formData.fcheckResu) {
|
this.formData.fcheckResu = 1
|
}
|
|
if (this.formData.fcheckResu == 0 || this.formData.fcheckResu == 1) {
|
this.formData.isPass = this.formData.fcheckResu
|
} else {
|
this.$showMessage("无标准值时,检验结果只能为0或1!");
|
return;
|
}
|
count = count - this.tableData.length;
|
}
|
|
this.formData.updater = this.$loginInfo.account;
|
|
this.$post({
|
url: "/RKJ/SetQSItemDetail",
|
data: {
|
pid: this.id,
|
gid: this.gid,
|
fstand: fstand,
|
fcheckResu: this.formData.fcheckResu,
|
updateBy: this.formData.updater,
|
count: count
|
}
|
}).then(res => {
|
this.formData.fcheckResu = null;
|
this.$showMessage("保存成功");
|
this.refreshResult();
|
})
|
|
},
|
refreshResult() {
|
this.$post({
|
url: "/RKJ/getXjDetail02ById",
|
data: {
|
id: this.id
|
}
|
}).then(res => {
|
this.formData = res.data.tbBillList.itemXj01;
|
|
this.tableData = res.data.tbBillList.itemXj02s;
|
|
if (this.formData.imageData) {
|
this.isShowImg = true;
|
this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
|
}
|
|
//maxValue minValue standardValue
|
if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
|
this.isNumber = true;
|
}
|
|
})
|
},
|
toDetail(item) {
|
this.showPopup = !this.showPopup;
|
this.editData = item;
|
this.fcheckResu = this.editData.fcheckResu;
|
},
|
eidt() {
|
|
if (!this.editData.fcheckResu) {
|
this.$showMessage("请输入检验结果");
|
}
|
|
if (this.formData.fcheckResu == this.editData.fcheckResu) {
|
this.$showMessage("修改成功");
|
return;
|
}
|
|
let fstand = "√";
|
|
if (this.formData.maxValue && this.formData.minValue) {
|
|
if (!this.editData.fcheckResu) {
|
this.$showMessage("请输入检验值");
|
return;
|
}
|
|
if (this.editData.fcheckResu >= this.formData.minValue && this.editData.fcheckResu <= this.formData
|
.maxValue) {
|
this.editData.isPass = 1
|
} else {
|
this.editData.isPass = 0
|
fstand = "×";
|
}
|
} else {
|
|
if (!this.editData.fcheckResu) {
|
this.editData.fcheckResu = 1
|
}
|
|
if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
|
if (this.editData.fcheckResu == 0) {
|
fstand = "×";
|
}
|
} else {
|
this.$showMessage("无标准值时,检验结果只能为0或1!");
|
return;
|
}
|
}
|
|
this.editData.updater = this.$loginInfo.account;
|
|
this.$post({
|
url: "/RKJ/UpdateQSItemDetail",
|
data: {
|
id: this.editData.id,
|
pid: this.id,
|
gid: this.gid,
|
itemInId: this.itemInId,
|
fstand: fstand,
|
fcheckResu: this.editData.fcheckResu,
|
updateBy: this.editData.updater,
|
}
|
}).then(res => {
|
this.showPopup = !this.showPopup;
|
if(res.status == 0){
|
this.$showMessage("修改成功");
|
this.refreshResult(); //刷新页面
|
}else{
|
this.$showMessage(res.message);
|
this.editData.fcheckResu = this.fcheckResu;
|
}
|
})
|
},
|
|
numberEdit(item) {
|
|
let fstand = "√";
|
let fcheckResu = 1;
|
|
if (item.fcheckResu == '1') {
|
fstand = "×";
|
fcheckResu = 0;
|
}
|
|
this.$post({
|
url: "/RKJ/UpdateQSItemDetail",
|
data: {
|
id: item.id,
|
pid: item.pid,
|
gid: item.gid,
|
itemInId: this.itemInId,
|
fstand: fstand,
|
fcheckResu: fcheckResu,
|
updateBy: this.$loginInfo.account,
|
}
|
}).then(res => {
|
if(res.status == 0){
|
this.$showMessage("修改成功");
|
this.refreshResult(); //刷新页面
|
}else{
|
this.$showMessage(res.message);
|
}
|
})
|
},
|
saveRemarks() {
|
this.remarksPopup = !this.remarksPopup;
|
this.remarks = this.formData.remarks;
|
},
|
editRemarks() {
|
if (this.remarks) {
|
//saveRemarksGid
|
this.$post({
|
url: "/RKJ/saveRemarksPid",
|
data: {
|
pid: this.formData.id,
|
remarks: this.remarks
|
}
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.formData.remarks = this.remarks;
|
this.remarksPopup = !this.remarksPopup;
|
this.$showMessage("保存成功");
|
}
|
})
|
}
|
}
|
},
|
onLoad(options) {
|
//options中包含了url附带的参数
|
let params = options;
|
|
this.id = params["id"];
|
this.billNo = params["billNo"];
|
this.gid = params["gid"];
|
this.itemInId = params["itemInId"];
|
|
this.refreshResult();
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
$primary-color: #409EFF;
|
$success-color: #67C23A;
|
$danger-color: #F56C6C;
|
$warning-color: #E6A23C;
|
$border-color: #DCDFE6;
|
$bg-color: #f5f7fa;
|
|
.container {
|
padding: 20px;
|
background-color: #fff;
|
}
|
|
.header {
|
padding: 20px;
|
border-bottom: 1px solid $border-color;
|
background: linear-gradient(90deg, #f0f7ff, #e1f0ff);
|
|
.title {
|
font-size: 24px;
|
color: #333;
|
margin-bottom: 10px;
|
}
|
|
.order-number {
|
color: #666;
|
font-size: 14px;
|
}
|
}
|
|
.section {
|
margin: 20px 0;
|
border: 1px solid $border-color;
|
border-radius: 4px;
|
|
&-header {
|
padding: 12px 16px;
|
background-color: $bg-color;
|
border-bottom: 1px solid $border-color;
|
font-weight: bold;
|
}
|
|
&-body {
|
padding: 16px;
|
}
|
}
|
|
.info-grid {
|
display: grid;
|
grid-template-columns: repeat(3, 1fr);
|
gap: 16px;
|
|
.info-item {
|
margin-bottom: 12px;
|
|
.info-label {
|
color: #909399;
|
font-size: 14px;
|
margin-bottom: 4px;
|
}
|
|
.info-value {
|
color: #333;
|
font-weight: 500;
|
}
|
}
|
}
|
|
.inspection-hint {
|
background-color: #fff3cd;
|
padding: 10px;
|
border-radius: 4px;
|
margin-bottom: 15px;
|
}
|
|
.hint-text {
|
font-size: 12px;
|
color: #856404;
|
}
|
|
.input-group {
|
margin: 16px 0;
|
|
.input-wrapper {
|
display: flex;
|
gap: 12px;
|
|
.result-input {
|
flex: 1;
|
height: 45px;
|
padding: 0 12px;
|
border: 1px solid $border-color;
|
border-radius: 4px;
|
font-size: 14px;
|
}
|
}
|
}
|
|
.btn {
|
padding: 8px 16px;
|
border: none;
|
border-radius: 4px;
|
font-size: 14px;
|
cursor: pointer;
|
transition: all 0.2s;
|
|
&.primary-btn {
|
background-color: $primary-color;
|
color: white;
|
}
|
|
&.danger-btn {
|
background-color: $danger-color;
|
color: white;
|
}
|
}
|
|
.table-container {
|
border: 1px solid $border-color;
|
border-radius: 4px;
|
overflow: hidden;
|
width: 100%;
|
|
.table-header {
|
display: flex;
|
background-color: $bg-color;
|
border-bottom: 1px solid $border-color;
|
|
.th {
|
flex: 1;
|
padding: 12px;
|
font-weight: bold;
|
text-align: center;
|
border-right: 1px solid $border-color;
|
|
&:last-child {
|
border-right: none;
|
}
|
}
|
}
|
|
.table-row {
|
display: flex;
|
border-bottom: 1px solid $border-color;
|
align-items: center;
|
min-height: 50px;
|
|
&:last-child {
|
border-bottom: none;
|
}
|
|
.td {
|
flex: 1;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding: 8px;
|
border-right: 1px solid $border-color;
|
|
&:last-child {
|
border-right: none;
|
}
|
}
|
}
|
}
|
|
.result-badge {
|
display: inline-block;
|
padding: 4px 8px;
|
border-radius: 4px;
|
font-size: 12px;
|
font-weight: bold;
|
|
&.OK {
|
background-color: rgba($success-color, 0.1);
|
color: $success-color;
|
}
|
|
&.NG {
|
background-color: rgba($danger-color, 0.1);
|
color: $danger-color;
|
}
|
}
|
|
.result-preview {
|
margin: 16px 0;
|
padding: 12px;
|
background-color: #f8f9fa;
|
border-radius: 4px;
|
display: flex;
|
align-items: center;
|
gap: 12px;
|
|
.info-label {
|
color: #909399;
|
font-size: 14px;
|
min-width: 80px;
|
}
|
|
.info-value {
|
color: #333;
|
font-weight: 500;
|
}
|
}
|
|
.result-ng {
|
margin: 16px 0;
|
padding: 12px;
|
background-color: rgba($danger-color, 0.1);
|
border-radius: 4px;
|
display: flex;
|
align-items: center;
|
gap: 12px;
|
|
.info-label {
|
color: $danger-color;
|
font-size: 14px;
|
min-width: 80px;
|
}
|
|
.info-value {
|
color: $danger-color;
|
font-weight: 500;
|
}
|
}
|
|
.image-preview {
|
text-align: center;
|
cursor: pointer;
|
}
|
|
.preview-image {
|
max-width: 100%;
|
max-height: 300px;
|
border-radius: 4px;
|
border: 1px solid #ddd;
|
}
|
|
.action-buttons {
|
display: flex;
|
flex-direction: column;
|
gap: 10px;
|
margin-bottom: 20px;
|
}
|
|
.action-btn {
|
padding: 12px 20px;
|
border: none;
|
border-radius: 6px;
|
font-size: 14px;
|
font-weight: 500;
|
cursor: pointer;
|
transition: all 0.2s;
|
|
&.primary {
|
background-color: $primary-color;
|
color: white;
|
}
|
|
&.secondary {
|
background-color: #95a5a6;
|
color: white;
|
}
|
|
&.warning {
|
background-color: $warning-color;
|
color: white;
|
}
|
}
|
|
.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;
|
}
|
|
.popup {
|
background-color: white;
|
border-radius: 8px;
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
width: 90%;
|
max-width: 400px;
|
max-height: 80vh;
|
overflow-y: auto;
|
}
|
|
.popup-header {
|
padding: 20px;
|
border-bottom: 1px solid #eee;
|
|
h3 {
|
font-size: 18px;
|
font-weight: 600;
|
color: #2c3e50;
|
margin: 0;
|
}
|
}
|
|
.popup-content {
|
padding: 20px;
|
}
|
|
.input-group {
|
display: flex;
|
flex-direction: column;
|
gap: 8px;
|
}
|
|
.input-label {
|
font-size: 14px;
|
color: #7f8c8d;
|
font-weight: 500;
|
}
|
|
.input-field {
|
padding: 8px 12px;
|
border: 1px solid #ddd;
|
border-radius: 4px;
|
font-size: 14px;
|
background-color: white;
|
}
|
|
.popup-actions {
|
padding: 20px;
|
border-top: 1px solid #eee;
|
display: flex;
|
gap: 10px;
|
justify-content: flex-end;
|
}
|
|
.danger {
|
color: $danger-color;
|
}
|
|
/* 响应式设计 */
|
@media (max-width: 768px) {
|
.info-grid {
|
grid-template-columns: 1fr;
|
}
|
|
.input-wrapper {
|
flex-direction: column;
|
}
|
|
.table-container {
|
.table-header .th {
|
font-size: 12px;
|
padding: 8px 4px;
|
}
|
|
.table-row .td {
|
font-size: 12px;
|
padding: 8px 4px;
|
}
|
}
|
}
|
</style>
|