<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"/>
|
</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.createDate"/>
|
</view>
|
<view class="uni-form-item uni-column form-item edit">
|
<text class="form-label">生产线别:</text>
|
<superwei-combox v-if="isUpdate" :candidates="DAA020List" placeholder="请选择或输入"
|
v-model="formData.lineName"
|
@select="onDaa020Change"
|
class="picker form-input"
|
style="border: none;"></superwei-combox>
|
<input v-else class="form-input" disabled="true" type="text" v-model="formData.daa015"/>
|
</view>
|
|
<view class="uni-form-item uni-column form-item edit">
|
<text class="form-label">送检批次号:</text>
|
<superwei-combox v-if="isUpdate" :candidates="DAA001List" placeholder="请选择或输入"
|
v-model="formData.billNo"
|
@select="onDaa001Change"
|
class="picker form-input"
|
style="border: none;"></superwei-combox>
|
<input v-else class="form-input" disabled="true" type="text" v-model="formData.billNo"/>
|
</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="uni-title-sub uni-ellipsis-2">
|
<view class="form-group">
|
<label class="form-label">产品名称:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.itemName"/>
|
</view>
|
</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.quantity"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">报工人:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.bgr"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">检验结果:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.fcheckResu"/>
|
</view>
|
<view class="form-group">
|
<label class="form-label">不合格描述:</label>
|
<input class="form-input" disabled="true" type="text" v-model="formData.remarks"/>
|
</view>
|
</form>
|
</view>
|
|
<view class="list-container">
|
<uni-table ref="table" border emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" class="th" style="color: #FFFFFF;">检验项目</uni-th>
|
<uni-th align="center" class="th" style="color: #FFFFFF">是否合格</uni-th>
|
<uni-th align="center" class="th" 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.projName"/>
|
</uni-td>
|
<uni-td align="center">
|
<input class="form-input" disabled="true" type="text" v-model="item.result"/>
|
</uni-td>
|
<uni-td>
|
<view class="uni-group">
|
<button v-if="item.isCheck >=item.levelNum" type="default" @click="toDetail(item)">
|
{{ item.levelNum + '/' + item.isCheck }}
|
</button>
|
<button v-else type="warn" @click="toDetail(item)">
|
{{ item.levelNum + '/' + item.isCheck }}
|
</button>
|
</view>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</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 && !isShowTable" @click="saveRemarks">添加不合格描述</button>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" v-if="!isUpdate && !isShowTable && this.formData.fsubmit != 1" @click="cleanResult">清除检验结果</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="isShowTable" @click="getTable">获取检验项目</button>
|
</view>
|
|
<view class="plus-button">
|
<button type="warn" v-if="isShowTable && isUpdate" @click="saveTable">生成检验项目</button>
|
</view>
|
|
|
<view v-if="showPopup" 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="edit">修改</button>
|
<button @click="showPopup = !showPopup">取消</button>
|
</form>
|
</view>
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
formData: {
|
id: "",
|
releaseNo: "",
|
createBy: "",
|
createDate: "",
|
daa020: "",
|
itemNo: "",
|
billNo: "",
|
catQty: "",
|
detailMem: "",
|
taskNo: "",
|
fcheckResu: "",
|
remarks: ""
|
},
|
|
DAA020List: [],
|
|
DAA001List: [],
|
|
BillNoList: [],
|
|
lineList: [],
|
|
lineNo: "",
|
|
tableData: [],
|
|
isSubmit: true,
|
|
isUpdate: true,
|
|
isShowTable: false,
|
|
remarks: "",
|
|
showPopup: false,
|
};
|
},
|
onLoad(options) {
|
//options中包含了url附带的参数
|
|
let params = options;
|
|
if (params["id"]) {
|
this.isUpdate = false;
|
this.formData.id = params["id"];
|
this.formData.releaseNo = params["releaseNo"];
|
//getQaItemXj02
|
this.init();
|
} else {
|
//初始化检验单号
|
this.$post({
|
url: "/RKJ/getMaxReleaseNo"
|
}).then(res => {
|
this.formData.releaseNo = res.data.tbBillList;
|
this.formData.createBy = this.$loginInfo.account;
|
this.formData.createDate = this.$getDate("yyyy-mm-dd");
|
});
|
|
//车间下拉框的初始化
|
this.$post({
|
url: "/XJ/getLineAll"
|
}).then(res => {
|
this.lineList = res.data.tbBillList;
|
this.DAA020List = res.data.tbBillList.map(item => item.lineName);
|
})
|
}
|
},
|
methods: {
|
removeXJ() {
|
if (this.formData.id) {
|
this.$post({
|
url: "/RKJ/removeXJ",
|
data: {
|
id: this.formData.id
|
}
|
}).then(res => {
|
if (res.data.tbBillList > 0) {
|
this.$showMessage("删除成功");
|
//关闭当前页面,返回上一页面或多级页面
|
uni.navigateBack();
|
} else {
|
this.$showMessage("删除失败");
|
}
|
});
|
} else {
|
this.$showMessage("请先选择检验单号");
|
}
|
},
|
getItem() {
|
|
if (!this.formData.billNo) {
|
this.$showMessage("请选择送检批次号");
|
return;
|
}
|
|
if (this.isSubmit) {
|
this.$showMessage("此物料无启用的检验项目,请维护!");
|
return;
|
}
|
|
this.$post({
|
url: "/RKJ/save",
|
data: {
|
from: this.formData,
|
userNo: this.$loginInfo.account,
|
//moidNum: this.formData.moidNum
|
items: this.tableData
|
}
|
}).then(res => {
|
this.formData.id = res.data.tbBillList;
|
this.$showMessage("生成检验项目成功");
|
this.init();
|
this.isUpdate = false;
|
});
|
},
|
//生产线别选择并初始话工单号
|
onDaa020Change(event) {
|
//获取生产线别的下标地址
|
this.formData.lineName = event;
|
|
this.lineNo = this.lineList[this.DAA020List.indexOf(event)].lineNo;
|
|
this.formData.line = this.lineNo;
|
|
this.$post({
|
url: "/RKJ/getDaa001",
|
data: {
|
lineNo: this.formData.lineName
|
}
|
}).then(res => {
|
this.BillNoList = res.data.tbBillList;
|
this.DAA001List = res.data.tbBillList.map(s => s.billNo);
|
|
this.formData.billNo = "";
|
this.formData.mocode = "";
|
this.formData.boardModel = "";
|
this.formData.taskNo = "";
|
this.formData.itemNo = "";
|
this.formData.boardName = "";
|
this.formData.quantity = "";
|
this.tableData = [];
|
})
|
},
|
//选取工单填充物料号和其他信息
|
onDaa001Change(e) {
|
|
this.formData.billNo = e;
|
|
let data = this.BillNoList[this.DAA001List.indexOf(e)];
|
|
//当返回的结果集为空时置空原有的值
|
if (!data) {
|
this.formData.billNo = "";
|
this.formData.mocode = "";
|
this.formData.boardModel = "";
|
this.formData.taskNo = "";
|
this.formData.itemNo = "";
|
this.formData.boardName = "";
|
this.formData.quantity = "";
|
this.tableData = [];
|
return;
|
}
|
//不为空时赋值
|
this.formData.billNo = data.billNo;
|
this.formData.mocode = data.mocode;
|
this.formData.boardModel = data.boardModel;
|
this.formData.taskNo = data.taskNo;
|
this.formData.itemNo = data.itemNo;
|
this.formData.boardName = data.boardName;
|
this.formData.quantity = data.quantity;
|
|
|
this.$post({
|
url: "/RKJ/setJYItem",
|
data: {
|
itemNo: this.formData.itemNo,
|
quantity:this.formData.quantity
|
}
|
}).then(res => {
|
this.tableData = res.data.tbBillList;
|
if (this.tableData.length === 0) {
|
this.$showMessage("该物料条码没有检验项目");
|
this.isSubmit = true;
|
this.tableData = [];
|
} else {
|
this.isSubmit = false;
|
}
|
});
|
},
|
init() {
|
this.$post({
|
url: "/RKJ/getPage",
|
data: {
|
id: this.formData.id,
|
createUser: this.$loginInfo.account,
|
pageIndex: 1,
|
limit: 1,
|
}
|
}).then(res => {
|
let data = res.data.tbBillList[0];
|
if (data) {
|
this.formData = data;
|
|
this.$post({
|
url: "/RKJ/getItems",
|
data: {
|
pid: this.formData.id
|
}
|
}).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?id=' + item.id + '&billNo=' + this.formData.billNo + '&gid=' + this.formData
|
.id + '&itemInId=' + this.formData.itemInId
|
});
|
}
|
},
|
toImage() {
|
uni.navigateTo({
|
url: 'ImageItem?id=' + this.formData.id
|
});
|
},
|
saveRemarks() {
|
this.showPopup = !this.showPopup;
|
this.remarks = this.formData.remarks;
|
},
|
edit() {
|
if (this.remarks) {
|
//saveRemarksGid
|
this.$post({
|
url: "/RKJ/saveRemarksGid",
|
data: {
|
gid: this.formData.id,
|
remarks: this.remarks
|
}
|
}).then(res => {
|
if(res.data.tbBillList > 0){
|
this.formData.remarks = this.remarks;
|
this.showPopup = !this.showPopup;
|
this.$showMessage("保存成功");
|
}
|
})
|
}
|
},getTable() {
|
this.$post({
|
url: "/RKJ/setJYItem",
|
data: {
|
itemNo: this.formData.itemNo,
|
quantity:this.formData.quantity
|
}
|
}).then(res => {
|
|
this.tableData = res.data.tbBillList;
|
if (this.tableData.length === 0) {
|
this.$showMessage("该物料条码没有检验项目");
|
this.isSubmit = true;
|
this.tableData = [];
|
this.isShowTable = true;
|
this.isUpdate = false;
|
} else {
|
this.isSubmit = false;
|
this.isShowTable = true;
|
this.isUpdate = true;
|
}
|
});
|
},
|
saveTable() {
|
if (this.tableData.length === 0) {
|
return;
|
}
|
|
this.$post({
|
url: "/RKJ/saveItem",
|
data: {
|
gid: this.formData.id,
|
items: this.tableData,
|
userNo: this.$loginInfo.account
|
}
|
}).then(res => {
|
this.formData.id = res.data.tbBillList;
|
this.isShowTable = false;
|
this.isUpdate = false;
|
this.init();
|
})
|
},
|
cleanResult(){
|
this.$post({
|
url: "/RKJ/cleanReqResult",
|
data: {
|
gid: this.formData.id,
|
userNo: this.$loginInfo.account
|
}
|
}).then(res => {
|
console.log(res);
|
if(res.status == 0){
|
this.init();
|
}else{
|
this.$showMessage(res.message);
|
}
|
|
})
|
}
|
},
|
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;
|
/* 可选:添加一些内边距,使列表内容更美观 */
|
}
|
|
/* 在小屏幕设备上,重置高度为适应屏幕 */
|
@media (max-width: 768px) {
|
.list-container {
|
height: calc(100vh - 500px);
|
/* 适当调整高度 */
|
}
|
}
|
|
|
.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;
|
}
|
|
.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>
|