<template>
|
<view>
|
<view class="form-container">
|
<form :modelValue="formData">
|
<view class="form-group">
|
<label class="form-label">项目名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.projName"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">质量要求:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemMod"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">检验方法:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.inspectionMethod"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">使用仪表:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.usingInstruments"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">检验数:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.levelNum"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">下限:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.minValue"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">标准值:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.standardValue"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">上限:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.maxValue"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">更新人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.updater"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">更新时间:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.updateTime"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">预览结果:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.result"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">不合格描述:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.remarks"/>
|
</view>
|
<view class="form-group edit">
|
<input class="form-input" style="color: red" disabled="true" type="text"
|
value="没有最大值和最小值时填写0(未通过检验)或1(通过检验)"/>
|
</view>
|
<view class="form-group edit">
|
<label class="form-label">检测结果:</label>
|
<input class="form-input" type="number" v-model="formData.fcheckResu"/>
|
</view>
|
<button type="primary" v-if="tableData.length < formData.levelNum" @click="submit">保存</button>
|
</form>
|
</view>
|
<view>
|
<img v-if="isShowImg" :src="base64Image" style="width:100%" @click="previewImage"/>
|
</view>
|
<view class="list-container">
|
<uni-table ref="table" border emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">编号</uni-th>
|
<uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">判定标识</uni-th>
|
<uni-th align="center" style="color: #FFFFFF;background-color: lightskyblue;">检验结果</uni-th>
|
<uni-th width="150" align="center" style="color: #FFFFFF;background-color: lightskyblue;">修改</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
<uni-td align="center">
|
{{ index + 1 }}
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.fstand"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.fcheckResu"/>
|
</uni-td>
|
<uni-td>
|
<view class="uni-group edit">
|
<button type="warn" v-if="isNumber" @click="toDetail(item)">修改</button>
|
<button type="warn" v-if="!isNumber" @click="numberEdit(item)">{{ editResult(item.fcheckResu) }}</button>
|
</view>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" @click="saveRemarks">添加不合格描述</button>
|
</view>
|
|
<view v-if="remarksPopup" class="overlay">
|
<view class="popup">
|
<h3>修改不合格描述</h3>
|
<form>
|
<view class="form-group">
|
<label class="form-label">不合格描述:</label>
|
<input class="form-input" type="text" v-model="remarks"/>
|
</view>
|
<button type="warn" @click="editRemarks">修改</button>
|
<button @click="remarksPopup = !remarksPopup">取消</button>
|
</form>
|
</view>
|
</view>
|
|
<view v-if="showPopup" class="overlay">
|
<view class="popup">
|
<h3>修改检验结果</h3>
|
<form :modelValue="editData">
|
<view class="form-group">
|
<label class="form-label">检验结果:</label>
|
<input class="form-input" type="text" v-model="editData.fcheckResu"/>
|
</view>
|
<button type="warn" @click="eidt">修改</button>
|
<button @click="showPopup = !showPopup">取消</button>
|
</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) {
|
//saveRemarksGid
|
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) {
|
//options中包含了url附带的参数
|
let params = options;
|
|
this.id = params["id"];
|
this.billNo = params["billNo"];
|
this.gid = params["gid"];
|
|
this.refreshResult();
|
}
|
}
|
</script>
|
|
<style>
|
|
.form-group {
|
display: flex;
|
align-items: center;
|
border: 1px solid #c9c9c9;
|
background-color: #d4d4d4;
|
}
|
|
.form-label {
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
/* 默认样式 */
|
.list-container {
|
height: calc(100vh - 750px);
|
/* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */
|
overflow-y: auto;
|
/* 允许列表容器垂直滚动 */
|
padding: 10px;
|
/* 可选:添加一些内边距,使列表内容更美观 */
|
}
|
|
/* 在小屏幕设备上,重置高度为适应屏幕 */
|
@media (max-width: 768px) {
|
.list-container {
|
height: calc(100vh - 485px);
|
/* 适当调整高度 */
|
}
|
}
|
|
.form-container {
|
/* 设置表单容器的高度,使其可以滚动 */
|
overflow-y: auto;
|
/* 允许表单容器垂直滚动 */
|
padding: 10px;
|
/* 可选:添加一些内边距,使表单内容更美观 */
|
}
|
|
.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;
|
}
|
|
.popup {
|
background-color: #fff;
|
padding: 20px;
|
border: 1px solid #ccc;
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
width: 68vw; /* 设置宽度为视口宽度的80% */
|
height: 25vh; /* 设置高度为视口高度的80% */
|
}
|
|
.edit {
|
background-color: white;
|
}
|
</style>
|