<template>
|
<view class="page-container">
|
<view class="form-card">
|
<form :modelValue="formData">
|
<view class="form-grid">
|
<view class="form-item">
|
<label class="form-label">项目名称:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.projName"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">质量要求:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.itemMod"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">检验方法:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.inspectionMethod"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">使用仪表:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.usingInstruments"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">检验数:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.levelNum"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">下限:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.minValue"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">标准值:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.standardValue"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">上限:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.maxValue"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">更新人:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.updater"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">更新时间:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.updateTime"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">预览结果:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.result"/>
|
</view>
|
<view class="form-item">
|
<label class="form-label">不合格描述:</label>
|
<input class="form-input readonly" disabled="true" type="text" v-model="formData.remarks"/>
|
</view>
|
<view class="form-item edit-item">
|
<input class="form-input info-text" style="color: #e64340" disabled="true" type="text"
|
value="没有最大值和最小值时填写0(未通过检验)或1(通过检验)"/>
|
</view>
|
<view class="form-item edit-item">
|
<label class="form-label">检测结果:</label>
|
<input class="form-input editable" type="number" v-model="formData.fcheckResu"/>
|
</view>
|
</view>
|
<view class="form-actions">
|
<button type="primary" v-if="tableData.length < formData.levelNum" @click="submit" class="btn-primary">保存</button>
|
</view>
|
</form>
|
</view>
|
|
<view v-if="isShowImg" class="image-preview">
|
<img :src="base64Image" style="width:100%" @click="previewImage" class="preview-image"/>
|
</view>
|
|
<view class="table-container">
|
<uni-table ref="table" border emptyText="暂无更多数据" class="data-table">
|
<uni-tr class="table-header">
|
<uni-th align="center">编号</uni-th>
|
<uni-th align="center">判定标识</uni-th>
|
<uni-th align="center">检验结果</uni-th>
|
<uni-th width="150" align="center">修改</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index" class="table-row" :class="index % 2 === 0 ? 'table-row-even' : 'table-row-odd'">
|
<uni-td align="center" class="table-cell">
|
{{ index + 1 }}
|
</uni-td>
|
<uni-td align="center" class="table-cell">
|
<input class="form-input readonly" disabled="true" type="text" v-model="item.fstand"/>
|
</uni-td>
|
<uni-td align="center" class="table-cell">
|
<input class="form-input readonly" disabled="true" type="text" v-model="item.fcheckResu"/>
|
</uni-td>
|
<uni-td class="table-cell">
|
<view class="action-group">
|
<button type="warn" v-if="isNumber" @click="toDetail(item)" class="btn-warning">修改</button>
|
<button type="warn" v-if="!isNumber" @click="numberEdit(item)" class="btn-warning">{{ editResult(item.fcheckResu) }}</button>
|
</view>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="saveRemarks" class="btn-float">
|
<text class="btn-icon">+</text>
|
<text class="btn-text">添加不合格描述</text>
|
</button>
|
</view>
|
|
<view v-if="remarksPopup" class="modal-overlay" :class="{ 'show-modal': remarksPopup }">
|
<view class="modal" :class="{ 'show-modal-content': remarksPopup }">
|
<div class="modal-header">
|
<h3>修改不合格描述</h3>
|
<span @click="remarksPopup = !remarksPopup" class="close-modal">×</span>
|
</div>
|
<form class="modal-form">
|
<view class="form-group">
|
<label class="form-label">不合格描述:</label>
|
<input class="form-input" type="text" v-model="remarks"/>
|
</view>
|
<view class="modal-actions">
|
<button type="warn" @click="editRemarks" class="btn-warning">修改</button>
|
<button @click="remarksPopup = !remarksPopup" class="btn-secondary">取消</button>
|
</view>
|
</form>
|
</view>
|
</view>
|
|
<view v-if="showPopup" class="modal-overlay" :class="{ 'show-modal': showPopup }">
|
<view class="modal" :class="{ 'show-modal-content': showPopup }">
|
<div class="modal-header">
|
<h3>修改检验结果</h3>
|
<span @click="showPopup = !showPopup" class="close-modal">×</span>
|
</div>
|
<form :modelValue="editData" class="modal-form">
|
<view class="form-group">
|
<label class="form-label">检验结果:</label>
|
<input class="form-input" type="text" v-model="editData.fcheckResu"/>
|
</view>
|
<view class="modal-actions">
|
<button type="warn" @click="eidt" class="btn-warning">修改</button>
|
<button @click="showPopup = !showPopup" class="btn-secondary">取消</button>
|
</view>
|
</form>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
formData: {},
|
isNumber: false,
|
checkItem: "",
|
id: 0,
|
gid: 0,
|
billNo: "",
|
showPopup: false,
|
editData: {},
|
tableData: [],
|
base64Image: "",
|
isShowImg: false,
|
remarks: "",
|
remarksPopup: false,
|
}
|
},
|
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: "/SJ/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: "/SJ/getQSItems",
|
data: {
|
id: this.id
|
}
|
}).then(res => {
|
this.formData = res.data.tbBillList[0];
|
this.formData.billNo = this.billNo;
|
if (this.formData.imageData) {
|
this.isShowImg = true;
|
this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
|
}
|
if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
|
this.isNumber = true;
|
}
|
})
|
|
this.$post({
|
url: "/SJ/getQSItemDetail",
|
data: {
|
pid: this.id,
|
gid: this.gid
|
}
|
}).then(res => {
|
this.tableData = res.data.tbBillList;
|
})
|
},
|
toDetail(item) {
|
this.showPopup = !this.showPopup;
|
this.editData = item;
|
},
|
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: "/SJ/UpdateQSItemDetail",
|
data: {
|
id: this.editData.id,
|
pid: this.id,
|
gid: this.gid,
|
fstand: fstand,
|
fcheckResu: this.editData.fcheckResu,
|
updateBy: this.editData.updater,
|
}
|
}).then(res => {
|
this.showPopup = !this.showPopup;
|
this.$showMessage("修改成功");
|
this.refreshResult();
|
})
|
},
|
numberEdit(item) {
|
let fstand = "√";
|
let fcheckResu = 1;
|
|
if (item.fcheckResu == '1') {
|
fstand = "×";
|
fcheckResu = 0;
|
}
|
|
this.$post({
|
url: "/SJ/UpdateQSItemDetail",
|
data: {
|
id: item.id,
|
pid: item.pid,
|
gid: item.gid,
|
fstand: fstand,
|
fcheckResu: fcheckResu,
|
updateBy: this.$loginInfo.account,
|
}
|
}).then(res => {
|
this.$showMessage("修改成功");
|
this.refreshResult();
|
})
|
},
|
saveRemarks() {
|
this.remarksPopup = !this.remarksPopup;
|
this.remarks = this.formData.remarks;
|
},
|
editRemarks() {
|
if (this.remarks) {
|
this.$post({
|
url: "/SJ/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) {
|
let params = options;
|
this.id = params["id"];
|
this.billNo = params["billNo"];
|
this.gid = params["gid"];
|
this.refreshResult();
|
}
|
}
|
</script>
|
|
<style>
|
/* 基础配色方案 */
|
:root {
|
--primary-color: #165DFF; /* 主色调 - 蓝色 */
|
--primary-light: #E8F3FF; /* 主色浅色 */
|
--success-color: #00B42A; /* 成功色 - 绿色 */
|
--warning-color: #FF7D00; /* 警告色 - 橙色 */
|
--danger-color: #F53F3F; /* 危险色 - 红色 */
|
--text-color: #1D2129; /* 主文本色 */
|
--text-secondary: #4E5969; /* 次要文本色 */
|
--bg-color: #F2F3F5; /* 背景色 */
|
--card-bg: #FFFFFF; /* 卡片背景色 */
|
--border-color: #E5E6EB; /* 边框色 */
|
}
|
|
/* 页面整体样式 */
|
.page-container {
|
padding: 16px;
|
background-color: var(--bg-color);
|
min-height: 100vh;
|
}
|
|
/* 表单卡片样式 */
|
.form-card {
|
background-color: var(--card-bg);
|
border-radius: 12px;
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
padding: 24px;
|
margin-bottom: 20px;
|
}
|
|
/* 表单网格布局 */
|
.form-grid {
|
display: grid;
|
grid-template-columns: repeat(2, 1fr);
|
gap: 16px;
|
}
|
|
/* 表单项目样式 */
|
.form-item {
|
display: flex;
|
flex-direction: column;
|
}
|
|
.form-label {
|
font-size: 14px;
|
color: var(--text-color);
|
margin-bottom: 8px;
|
font-weight: 500;
|
}
|
|
.form-input {
|
padding: 12px 16px;
|
border: 1px solid var(--border-color);
|
border-radius: 8px;
|
font-size: 14px;
|
color: var(--text-color);
|
background-color: var(--card-bg);
|
transition: border-color 0.3s, box-shadow 0.3s;
|
}
|
|
.form-input:focus {
|
border-color: var(--primary-color);
|
outline: none;
|
box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.2);
|
}
|
|
/* 只读输入框样式 */
|
.form-input.readonly {
|
background-color: #F7F8FA;
|
color: var(--text-secondary);
|
cursor: not-allowed;
|
border-color: #E5E6EB;
|
}
|
|
/* 编辑项样式 */
|
.edit-item {
|
grid-column: span 2;
|
}
|
|
.info-text {
|
background-color: #FFF3F3;
|
color: var(--danger-color);
|
border-color: #FFE0E0;
|
}
|
|
/* 表单操作按钮 */
|
.form-actions {
|
margin-top: 24px;
|
display: flex;
|
justify-content: flex-end;
|
}
|
|
.btn-primary {
|
background-color: var(--primary-color);
|
border-color: var(--primary-color);
|
color: white;
|
padding: 10px 24px;
|
border-radius: 8px;
|
font-size: 14px;
|
font-weight: 500;
|
transition: background-color 0.3s;
|
display: flex;
|
align-items: center;
|
}
|
|
.btn-primary:hover {
|
background-color: #0D47A1;
|
}
|
|
.btn-primary:active {
|
transform: translateY(1px);
|
}
|
|
/* 表格容器样式 */
|
.table-container {
|
background-color: var(--card-bg);
|
border-radius: 12px;
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
padding: 16px;
|
margin-bottom: 20px;
|
}
|
|
.data-table {
|
width: 100%;
|
}
|
|
.table-header {
|
background-color: var(--primary-color);
|
color: white;
|
}
|
|
.table-row {
|
transition: background-color 0.2s;
|
}
|
|
.table-row:hover {
|
background-color: #F7F8FA;
|
}
|
|
.table-row-even {
|
background-color: #F9FAFC;
|
}
|
|
.table-row-odd {
|
background-color: #F2F3F5;
|
}
|
|
.table-cell {
|
padding: 14px 16px;
|
border-color: var(--border-color);
|
font-size: 14px;
|
color: var(--text-color);
|
}
|
|
/* 操作按钮组 */
|
.action-group {
|
display: flex;
|
gap: 8px;
|
justify-content: center;
|
}
|
|
.btn-warning {
|
background-color: var(--warning-color);
|
border-color: var(--warning-color);
|
color: white;
|
padding: 8px 16px;
|
border-radius: 8px;
|
font-size: 12px;
|
transition: background-color 0.3s;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.btn-warning:hover {
|
background-color: #D66600;
|
}
|
|
.btn-secondary {
|
background-color: #FFFFFF;
|
border: 1px solid var(--border-color);
|
color: var(--text-color);
|
padding: 8px 16px;
|
border-radius: 8px;
|
font-size: 12px;
|
transition: background-color 0.3s, border-color 0.3s;
|
}
|
|
.btn-secondary:hover {
|
background-color: #F7F8FA;
|
border-color: #C9CDD4;
|
}
|
|
/* 图片预览样式 */
|
.image-preview {
|
background-color: var(--card-bg);
|
border-radius: 12px;
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
padding: 16px;
|
margin-bottom: 20px;
|
text-align: center;
|
}
|
|
.preview-image {
|
border-radius: 8px;
|
transition: transform 0.3s;
|
}
|
|
.preview-image:hover {
|
transform: scale(1.02);
|
}
|
|
/* 悬浮按钮样式 */
|
.plus-button {
|
margin: 20px 0;
|
text-align: center;
|
}
|
|
.btn-float {
|
background-color: var(--warning-color);
|
border-color: var(--warning-color);
|
color: white;
|
padding: 12px 24px;
|
border-radius: 32px;
|
font-size: 14px;
|
font-weight: 500;
|
box-shadow: 0 4px 12px rgba(255, 125, 0, 0.2);
|
transition: all 0.3s;
|
display: inline-flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.btn-float:hover {
|
background-color: #D66600;
|
transform: translateY(-2px);
|
box-shadow: 0 6px 16px rgba(255, 125, 0, 0.3);
|
}
|
|
.btn-float:active {
|
transform: translateY(1px);
|
}
|
|
.btn-icon {
|
margin-right: 8px;
|
font-size: 18px;
|
}
|
|
/* 模态框样式 */
|
.modal-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;
|
visibility: hidden;
|
transition: opacity 0.3s, visibility 0.3s;
|
}
|
|
.show-modal {
|
opacity: 1;
|
visibility: visible;
|
}
|
|
.modal {
|
background-color: var(--card-bg);
|
border-radius: 12px;
|
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
width: 90%;
|
max-width: 500px;
|
max-height: 80vh;
|
overflow-y: auto;
|
transform: translateY(20px);
|
transition: transform 0.3s;
|
opacity: 0;
|
}
|
|
.show-modal-content {
|
transform: translateY(0);
|
opacity: 1;
|
}
|
|
.modal-header {
|
padding: 16px 24px;
|
border-bottom: 1px solid var(--border-color);
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
.modal-header h3 {
|
font-size: 18px;
|
color: var(--text-color);
|
margin: 0;
|
font-weight: 600;
|
}
|
|
.close-modal {
|
font-size: 24px;
|
color: var(--text-secondary);
|
cursor: pointer;
|
transition: color 0.3s;
|
}
|
|
.close-modal:hover {
|
color: var(--text-color);
|
}
|
|
.modal-form {
|
padding: 24px;
|
}
|
|
.modal-actions {
|
display: flex;
|
justify-content: flex-end;
|
gap: 12px;
|
margin-top: 24px;
|
}
|
|
/* 响应式设计 */
|
@media (max-width: 768px) {
|
.form-grid {
|
grid-template-columns: 1fr;
|
}
|
|
.edit-item {
|
grid-column: span 1;
|
}
|
|
.table-container {
|
overflow-x: auto;
|
}
|
|
.btn-float {
|
padding: 10px 20px;
|
font-size: 12px;
|
}
|
}
|
</style>
|