<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.releaseNo" />
|
<button v-if="!isUpdate && current==0" type="default" style="background-color: #04d007; color: white;" @click="toSysSubmitFrom(formData.releaseNo)">
|
实验室送检
|
</button>
|
</view>
|
<view class="form-group">
|
<label class="form-label">到货单号:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.lotNo" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">创建人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.createBy" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">负责人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.userName" />
|
<button v-if="!isUpdate&& current==0 &&this.IQCJL" type="default" style="background-color: #04d007; color: white;" @click="toUpdateCheckBy(formData.releaseNo,formData.userName)">
|
变更负责人
|
</button>
|
</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.itemNo" />
|
<button type="primary" @click="toFileUrlByU9List(1,formData.itemNo)">
|
图纸规格书
|
</button>
|
<button type="primary" @click="toFileUrlByU9List(2,formData.itemNo)">
|
进料检验文件
|
</button>
|
</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.fcovertQty" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">不良描述:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.fngDesc" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">上次不良:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.newFngDesc" />
|
</view>
|
<view class="form-group">
|
<label class="form-label">项目:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.projectCodes" />
|
</view>
|
</form>
|
</view>
|
|
<view class="list-container">
|
|
<uni-table ref="table" border emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" class="th" width="100" style="color: #FFFFFF;">检验项目</uni-th>
|
<uni-th align="center" class="th" style="color: #FFFFFF;">检验描述</uni-th>
|
<uni-th align="center" class="th" width="100" style="color: #FFFFFF">是否合格</uni-th>
|
<uni-th align="center" class="th" width="50" style="color: #FFFFFF">记录(点击)</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in tableData" :key="index">
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.fcheckItem" />
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.fcheckItemDesc" />
|
</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">
|
<button v-if="item.fenterQty >=item.checkQyt" type="default" @click="toDetail(item)">
|
{{ item.checkQyt + '/' + item.fenterQty }}
|
</button>
|
<button v-else type="warn" @click="toDetail(item)">
|
{{ item.checkQyt + '/' + item.fenterQty }}
|
</button>
|
</view>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
|
<!-- <view class="dif">
|
<view class="plus-button">
|
<button type="warn" v-if="!isUpdate && !isShowTable" @click="submit">检验提交</button>
|
</view>
|
<view class="plus-button">
|
<button type="warn" v-if="isUpdate && !isShowTable" @click="getItem">创建检验单并生成部分默认值</button>
|
</view>
|
<view class="plus-button">
|
<button type="warn" v-if="!isUpdate && !isShowTable" @click="toImage">上传/查看图片</button>
|
</view>
|
<!-- 移动端先注销,有需求再放出来 -->
|
<!-- <view class="plus-button">
|
<button type="warn" v-if="!isUpdate && !formData.fcheckResu && !isShowTable" @click="removeXJ">删除单据</button>
|
</view> -->
|
<!-- <view class="plus-button">
|
<button type="warn" v-if="!isUpdate && !isShowTable" @click="saveRemarks">添加不良描述</button>
|
</view>
|
<view class="plus-button">
|
<button type="warn" v-if="isShowTable" @click="getTable">获取检验项目</button>
|
</view>
|
<view class="plus-button">
|
<button type="warn" v-if="isShowTable && isUpdate" @click="saveTable">生成检验项目</button>
|
</view>
|
</view> -->
|
|
<view class="fixed-buttons">
|
<button type="warn" v-if="!isUpdate && !isShowTable && current==0" @click="submit">检验提交</button>
|
<button type="warn" v-if="isUpdate && !isShowTable" @click="getItem">创建检验单并生成部分默认值</button>
|
<button type="warn" v-if="!isUpdate && !isShowTable" @click="toImage">上传/查看图片</button>
|
<button type="warn" v-if="!isUpdate && !isShowTable" @click="saveRemarks">添加不良描述</button>
|
<button type="warn" v-if="!isUpdate && !isShowTable && current==0" @click="getTable">获取检验项目</button>
|
<button type="warn" v-if="isShowTable && isUpdate" @click="saveTable">生成检验项目</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>
|
</template>
|
|
<script>
|
import { compile } from "vue";
|
import {
|
msgRead
|
} from "../../../utils/message";
|
|
export default {
|
data() {
|
return {
|
formData: {
|
id: "",
|
releaseNo: "",
|
createBy: "",
|
createDate: "",
|
lotNo: "",
|
itemNo: "",
|
billNo: "",
|
fcovertQty: "",
|
detailMem: "",
|
taskNo: "",
|
fcheckResu: "",
|
boardModel: "",
|
planQty: "",
|
mocode: "",
|
boardStyle: ""
|
},
|
|
DAA020List: [],
|
DAA020Index: -1,
|
DAA001List: [],
|
DAA001Index: -1,
|
schemeResult: [],
|
isShowTable: false,
|
ItemList: [],
|
ItemIndex: -1,
|
boardItems: [],
|
lineList: [],
|
lineNo: "",
|
tableData: [],
|
isSubmit: true,
|
isUpdate: true,
|
remarks: "",
|
remarksPopup: false,
|
|
msgId: 0
|
};
|
},
|
onLoad(options) {
|
//options中包含了url附带的参数
|
|
let params = options;
|
|
if (params["id"]) {
|
this.isUpdate = false;
|
this.formData.id = params["id"];
|
this.formData.releaseNo = params["releaseNo"];
|
this.formData.lotNo = params["lotNo"];
|
this.msgId = params["msgId"];
|
this.current=params["current"];
|
if(this.$loginInfo.roleid.indexOf("87638") != -1 || this.$loginInfo.account=="PL017")
|
{
|
this.IQCJL=true;
|
}else
|
{
|
this.IQCJL=false;
|
}
|
|
|
//getQaItemXj02
|
//this.init();
|
|
if (this.msgId > 0) {
|
this.msgRead();
|
}
|
|
} else {
|
//初始化检验单号
|
this.$post({
|
url: "/LLJ/getMaxReleaseNo"
|
}).then(res => {
|
this.formData.releaseNo = res.data.tbBillList;
|
this.formData.createBy = this.$loginInfo.account;
|
this.formData.createDate = this.$getDate("yyyy-mm-dd");
|
});
|
|
}
|
},
|
methods: {
|
removeXJ() {
|
if (this.formData.id) {
|
this.$post({
|
url: "/LLJ/removeXJ",
|
data: {
|
releaseNo: this.formData.releaseNo
|
}
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.$showMessage("删除成功");
|
//关闭当前页面,返回上一页面或多级页面
|
uni.navigateBack();
|
} else {
|
this.$showMessage("删除失败");
|
}
|
});
|
} else {
|
this.$showMessage("请先选择检验单号");
|
}
|
},
|
getItem() {
|
|
if (this.isSubmit) {
|
this.$showMessage("此物料无启用的检验项目,请维护!");
|
return;
|
}
|
|
if (!this.formData.billNo) {
|
this.$showMessage("请选择计划编号");
|
return;
|
}
|
|
this.$post({
|
url: "/XJ/save",
|
data: {
|
from: this.formData,
|
userNo: this.$loginInfo.account,
|
items: this.tableData
|
}
|
}).then(res => {
|
this.formData.id = res.data.tbBillList;
|
this.$showMessage("生成检验项目成功");
|
this.init();
|
this.isUpdate = false;
|
});
|
},
|
submit() {
|
this.$post({
|
url: "/LLJ/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.showToast({
|
title: res.message.toString(),
|
icon: 'error',
|
duration: 2000
|
})
|
|
}
|
|
})
|
},
|
msgRead() {
|
msgRead(this.msgId, this.$loginInfo.account);
|
},
|
init() {
|
let userName = this.$loginInfo.account;
|
|
this.$post({
|
url: "/LLJ/getPage",
|
data: {
|
id: this.formData.id,
|
createUser: userName,
|
pageIndex: 1,
|
limit: 1,
|
}
|
}).then(res => {
|
let data = res.data.tbBillList[0];
|
if (data) {
|
this.formData = data;
|
|
this.$post({
|
url: "/LLJ/getJYItem",
|
data: {
|
id: this.formData.id,
|
releaseNo: this.formData.releaseNo
|
}
|
}).then(res1 => {
|
let tableData = res1.data.tbBillList
|
//当已检验个数都不为空时按照检测结构排序
|
tableData.sort((a, b) => {
|
if (a.result === '未完成' && b.result === '合格') {
|
return -1;
|
} else if (a.result === '合格' && b.result === '未完成') {
|
return 1;
|
} else {
|
return 0;
|
}
|
});
|
this.tableData = tableData;
|
if (this.tableData.length === 0) {
|
this.isShowTable = true;
|
}
|
|
|
})
|
}
|
});
|
},
|
toDetail(item) {
|
if (this.isUpdate) {
|
uni.showToast({
|
icon: "none",
|
title: "请先生成检验项目",
|
duration: 2000,
|
});
|
} else {
|
uni.navigateTo({
|
url: 'detail?mainId=' + item.id
|
});
|
}
|
},
|
saveRemarks() {
|
this.remarksPopup = !this.remarksPopup;
|
this.remarks = this.formData.remarks;
|
},
|
editRemarks() {
|
if (this.remarks) {
|
//saveRemarksGid
|
this.$post({
|
url: "/LLJ/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 = !this.remarksPopup;
|
this.$showMessage("保存成功");
|
}
|
})
|
}
|
},
|
toImage() {
|
uni.navigateTo({
|
url: 'ImageItem?id=' + this.formData.id
|
});
|
},
|
getTable() {
|
this.$post({
|
url: "/LLJ/setJYItem",
|
data: {
|
itemNo: this.formData.itemNo,
|
quantity: this.formData.fcovertQty,
|
releaseNo: this.formData.releaseNo
|
}
|
}).then(res => {
|
if (res.status==0) {
|
uni.showToast({
|
title: res.message.toString(),
|
//将值设置为 success 或者直接不用写icon这个参数
|
icon: 'success',
|
//显示持续时间为 2秒
|
duration: 2000
|
})
|
// 如果有页面跳转,需要用定时器延迟
|
setTimeout(() => {
|
this.init();
|
}, 2000); // 保持与 duration 相同的时长
|
|
} else {
|
// this.$showMessage("此物料没有启用的检验项目,请维护!");
|
// this.isShowTable = true;
|
// this.isUpdate = false;
|
// this.tableData = [];
|
uni.showToast({
|
title: res.message.toString(),
|
//将值设置为 success 或者直接不用写icon这个参数
|
icon: 'error',
|
//显示持续时间为 2秒
|
duration: 2000
|
})
|
|
}
|
|
});
|
|
},
|
saveTable() {
|
if (this.tableData.length === 0) {
|
return;
|
}
|
this.$post({
|
url: "/LLJ/saveItem",
|
data: {
|
releaseNo: this.formData.releaseNo,
|
items: this.tableData,
|
userNo: this.$loginInfo.account,
|
gid: this.formData.id
|
}
|
}).then(res => {
|
this.formData.id = res.data.tbBillList;
|
this.isShowTable = false;
|
this.isUpdate = false;
|
this.init();
|
|
})
|
},
|
//去文件列表页面(文件类型,物料编号)
|
toFileUrlByU9List(type,u9No){
|
if(type===1){
|
uni.navigateTo({
|
url: 'FileUrlByU9List?type=' + type+'&itemID='+u9No
|
});
|
}else{
|
uni.navigateTo({
|
url: 'FileUrlByU9List2?type=' + type+'&itemID='+u9No
|
});
|
}
|
|
},
|
toSysSubmitFrom(releaseNo){
|
uni.navigateTo({
|
url: 'SysSubmitFrom?releaseNo=' + releaseNo+'&userID='+this.$loginInfo.account
|
});
|
},
|
toUpdateCheckBy(releaseNo,userName){
|
|
//console.log(this.$loginInfo)
|
uni.navigateTo({
|
url: 'UpdateCheckBy?releaseNo=' + releaseNo+'&userID='+this.$loginInfo.account+'&staffName='+userName
|
});
|
}
|
},
|
onShow() {
|
//每次进入页面都会执行的方法
|
if (this.formData.id) {
|
this.init();
|
}
|
}
|
};
|
</script>
|
<style>
|
.form-group {
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.form-label {
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.form-input {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
}
|
|
.picker {
|
flex: 1;
|
margin-bottom: 0;
|
padding: 5px;
|
font-size: 12px;
|
}
|
|
.uni-form-item {
|
display: flex;
|
border-bottom: 1px solid #c9c9c9;
|
}
|
|
.edit {
|
background-color: white;
|
}
|
|
/* 默认样式 */
|
/* .list-container {
|
height: 60vh;
|
/* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */
|
/* overflow-y: auto; */
|
/* 允许列表容器垂直滚动 */
|
/* padding: 10px; */
|
/* 可选:添加一些内边距,使列表内容更美观 */
|
/* } */
|
|
.fixed-buttons {
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
right: 0;
|
display: flex;
|
flex-wrap: wrap;
|
padding: 10px;
|
background-color: #ffffff;
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
z-index: 1000;
|
max-height: 30vh; /* 限制按钮容器最大高度 */
|
overflow-y: auto; /* 按钮过多时自身可滚动 */
|
}
|
|
.fixed-buttons button {
|
margin: 5px;
|
flex: 1 1 calc(50% - 20px); /* 两列布局 */
|
}
|
|
/* 为内容区域添加底部 padding 防止被固定按钮遮挡 */
|
.list-container {
|
height: calc(100vh - 400px); /* 动态高度计算 */
|
overflow-y: auto;
|
padding: 10px;
|
padding-bottom: 300px; /* 根据按钮高度调整 */
|
}
|
|
@media (max-width: 768px) {
|
.list-container {
|
height: calc(100vh - 376px);
|
padding-bottom: 300px;
|
}
|
|
.fixed-buttons {
|
flex-direction: column;
|
padding: 10px;
|
}
|
|
.fixed-buttons button {
|
flex: none;
|
width: 100%;
|
margin: 5px 0;
|
}
|
}
|
|
.form-container {
|
padding: 10px;
|
/* 可选:添加一些内边距,使表单内容更美观 */
|
}
|
|
.th {
|
background-color: lightskyblue;
|
color: #FFFFFF;
|
}
|
|
.plus-button {
|
line-height: 59px;
|
font-size: 24px;
|
cursor: pointer;
|
z-index: 1000;
|
margin-bottom: 10px;
|
}
|
|
|
|
.plus-button button {
|
margin: 5px 0;
|
/* 按钮之间的垂直间距 */
|
}
|
|
.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% */
|
}
|
</style>
|