<template>
|
<!-- 新建表单 - 优化后的UI样式 -->
|
<view v-if="isUpdate" class="create-form">
|
<view class="form-header">
|
<h2>新建入库检验单</h2>
|
<p class="form-subtitle">请按顺序填写以下信息</p>
|
</view>
|
|
<view class="form-content">
|
<!-- 检验单号 -->
|
<view class="form-section">
|
<view class="section-title">基本信息</view>
|
<view class="form-row">
|
<label class="form-label">检验单号:</label>
|
<span class="form-value">{{formData.releaseNo}}</span>
|
</view>
|
</view>
|
|
<!-- 选择区域 -->
|
<view class="form-section">
|
<view class="section-title">选择信息</view>
|
<view class="form-row">
|
<label class="form-label required">工作车间:</label>
|
<superwei-combox :candidates="departmentList" placeholder="请选择车间"
|
v-model="formData.workShop"
|
@select="onDepartmentChange"
|
class="form-select"></superwei-combox>
|
</view>
|
|
<view class="form-row">
|
<label class="form-label required">生产线别:</label>
|
<superwei-combox v-if="formData.workShop" :candidates="DAA020List" placeholder="请选择线体"
|
v-model="formData.lineName"
|
@select="onDaa020Change"
|
class="form-select"></superwei-combox>
|
<span v-else class="form-hint">请先选择工作车间</span>
|
</view>
|
|
<view class="form-row">
|
<label class="form-label required">生产工单:</label>
|
<superwei-combox v-if="formData.lineName" :candidates="DAA001List" placeholder="请选择工单"
|
v-model="formData.rBillNo"
|
@select="onDaa001Change"
|
class="form-select"></superwei-combox>
|
<span v-else class="form-hint">请先选择生产线别</span>
|
</view>
|
|
<view class="form-row">
|
<label class="form-label required">送检数量:</label>
|
<input type="number"
|
v-model="formData.quantity"
|
placeholder="请输入送检数量"
|
class="form-input"
|
@input="onQuantityChange"/>
|
</view>
|
</view>
|
|
<!-- 产品信息 -->
|
<view class="form-section" v-if="formData.itemName || formData.itemNo || formData.itemModel || formData.planQty">
|
<view class="section-title">产品信息</view>
|
<view class="form-row" v-if="formData.itemName">
|
<label class="form-label">产品名称:</label>
|
<span class="form-value">{{formData.itemName}}</span>
|
</view>
|
|
<view class="form-row" v-if="formData.itemNo">
|
<label class="form-label">物料编码:</label>
|
<span class="form-value">{{formData.itemNo}}</span>
|
</view>
|
|
<view class="form-row" v-if="formData.itemModel">
|
<label class="form-label">规格型号:</label>
|
<span class="form-value">{{formData.itemModel}}</span>
|
</view>
|
|
<view class="form-row" v-if="formData.planQty">
|
<label class="form-label">工单数量:</label>
|
<span class="form-value">{{formData.planQty}}</span>
|
</view>
|
</view>
|
</view>
|
|
<view class="form-actions">
|
<button class="btn-primary"
|
v-if="!isShowTable && formData.workShop && formData.lineName && formData.rBillNo && formData.quantity"
|
@click="getItem">
|
<text class="btn-icon">✓</text>
|
生成检验单
|
</button>
|
<button class="btn-primary"
|
v-if="isShowTable && isUpdate"
|
@click="saveTable">
|
<text class="btn-icon">✓</text>
|
生成检验项目
|
</button>
|
</view>
|
</view>
|
|
<!-- 查看/编辑表单 - 使用LLJ类似的样式 -->
|
<view v-else class="inspection-sheet">
|
<!-- 头部信息 -->
|
<view class="sheet-header">
|
<h1>入库检验单</h1>
|
<view class="inspection-number">检验单号:{{formData.releaseNo}}</view>
|
</view>
|
|
<!-- 基本信息区 -->
|
<view class="basic-info">
|
<view class="info-row">
|
<span class="info-label">工单号:</span>
|
<span class="info-value">{{formData.billNo || formData.rBillNo}}</span>
|
<span class="info-label">创建人:</span>
|
<span class="info-value">{{formData.createBy}}</span>
|
</view>
|
<view class="info-row">
|
<span class="info-label">创建时间:</span>
|
<span class="info-value">{{formData.createDate}}</span>
|
<span class="info-label"> 提交状态:</span>
|
<span class="info-value">{{formData.fsubmit == 1 ? '已提交' : '未提交'}}</span>
|
</view>
|
</view>
|
|
<!-- 物料信息区 -->
|
<view class="material-info">
|
<view class="info-block">
|
<view class="info-label">物料编码:</view>
|
<view class="info-value">{{formData.itemNo}}</view>
|
</view>
|
<view class="info-block">
|
<view class="info-label">产品名称:</view>
|
<view class="info-value">{{formData.itemName}}</view>
|
</view>
|
<view class="info-block">
|
<view class="info-label">规格型号:</view>
|
<view class="info-value">{{formData.itemModel}}</view>
|
</view>
|
<view class="info-block">
|
<view class="info-label">送检数量:</view>
|
<view class="info-value highlight">{{formData.quantity}}</view>
|
</view>
|
<view class="info-block" v-if="formData.remarks">
|
<view class="info-label">不合格描述:</view>
|
<view class="info-value">{{formData.remarks}}</view>
|
</view>
|
</view>
|
|
<!-- 下拉选择区域 -->
|
<view class="dropdown-row">
|
<view class="info-label">工作车间:</view>
|
<view class="info-value">{{formData.workShop}}</view>
|
</view>
|
<view class="dropdown-row">
|
<view class="info-label">生产线别:</view>
|
<view class="info-value">{{formData.lineName || formData.daa015}}</view>
|
</view>
|
<view class="dropdown-row">
|
<view class="info-label">生产工单:</view>
|
<view class="info-value">{{formData.billNo || formData.rBillNo}}</view>
|
</view>
|
|
<!-- 表单上方操作按钮区 -->
|
<view class="top-action-buttons">
|
<button class="action-btn" v-if="tableData.length === 0 && formData.fsubmit != 1" @click="getInspectionItems">获取检验项目</button>
|
</view>
|
|
<!-- 检验项目表格 -->
|
<view class="inspection-table" v-if="formData.id">
|
<table>
|
<thead>
|
<tr>
|
<th width="20%" style="text-align: center;">检验项目</th>
|
<th width="50%" style="text-align: center;">检验描述</th>
|
<th width="15%" style="text-align: center;">记录(点击)</th>
|
</tr>
|
</thead>
|
<tbody>
|
<tr v-for="(item, index) in tableData" :key="index">
|
<td>{{ item.projName }}</td>
|
<td>
|
<view v-if="item.result=='合格'" class="watermark approved">
|
{{ getStatusText(item.result) }}
|
</view>
|
<view v-if="item.result=='不合格'" class="watermark rejected">
|
{{ getStatusText(item.result) }}
|
</view>
|
<view v-if="item.result==null || item.result=='未完成'" class="watermark pending">
|
{{ getStatusText(item.result) }}
|
</view>
|
<view class="description-text">{{ item.projName }}</view>
|
</td>
|
<td>
|
<button v-if="item.isCheck >= item.levelNum || formData.fsubmit == 1" class="record-btn" @click="toDetail(item)">查看</button>
|
<button v-else class="record-btn" @click="toDetail(item)">填写</button>
|
</td>
|
</tr>
|
</tbody>
|
</table>
|
<view v-if="tableData.length === 0" class="no-data-tip">
|
<text style="color: #999; font-size: 16px;">该检验单暂无检验项目,请点击"获取检验项目"按钮添加检验项目</text>
|
</view>
|
</view>
|
|
<!-- 表单下方操作按钮区 -->
|
<view class="bottom-action-buttons">
|
<button class="action-btn small" @click="toImage">上传/查看图片</button>
|
<button class="action-btn small" @click="saveRemarks" v-if="formData.fsubmit != 1">添加不合格描述</button>
|
<button class="action-btn small" @click="cleanResult" v-if="formData.fsubmit != 1">清除检验结果</button>
|
<button class="action-btn small primary" @click="submitInspection" v-if="formData.fsubmit != 1 && tableData.length > 0">提交检验</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" placeholder="请输入不合格描述"/>
|
</view>
|
</form>
|
<button class="updateBut" @click="edit">修改</button>
|
<button @click="showPopup = !showPopup">取消</button>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
formData: {
|
id: "",
|
releaseNo: "",
|
createBy: "",
|
createDate: "",
|
daa020: "",
|
itemNo: "",
|
itemId: "", // 物料ID
|
billNo: "",
|
lineNo: "", // 生产线编号
|
catQty: "",
|
detailMem: "",
|
taskNo: "",
|
fcheckResu: "",
|
fsubmit: "", // 提交状态
|
remarks: "",
|
rbillNo: "",
|
workShop: "", // 工作车间
|
lineName: "", // 线体名称
|
quantity: "", // 送检数量
|
planQty: "" // 工单计划数量
|
},
|
|
DAA020List: [],
|
|
DAA001List: [],
|
|
BillNoList: [],
|
|
lineList: [],
|
|
lineNo: "",
|
|
tableData: [],
|
|
isSubmit: true,
|
|
isUpdate: true,
|
|
isShowTable: false,
|
|
remarks: "",
|
|
showPopup: false,
|
departmentList: [], // 车间列表
|
selectedDepartmentId: "", // 选中的车间ID
|
};
|
},
|
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: "/RKJ/GetDepartmentsWithLines"
|
}).then(res => {
|
this.departmentList = res.data.tbBillList.map(item => item.departmentname);
|
})
|
}
|
},
|
methods: {
|
getStatusClass(result) {
|
if (result === '合格') return 'status-pass';
|
if (result === '不合格') return 'status-fail';
|
return 'status-pending';
|
},
|
|
getStatusText(status) {
|
const statusMap = {
|
approved: '合格',
|
rejected: '不合格',
|
pending: '待确认'
|
}
|
if (status == null || status == '未完成') {
|
return statusMap['pending'] || '待确认';
|
} else if (status == '合格') {
|
return statusMap['approved'] || '合格';
|
} else {
|
return statusMap['rejected'] || '不合格';
|
}
|
},
|
|
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.workShop) {
|
this.$showMessage("请选择工作车间");
|
return;
|
}
|
|
if (!this.formData.lineName) {
|
this.$showMessage("请选择生产线体");
|
return;
|
}
|
|
if (!this.formData.rBillNo) {
|
this.$showMessage("请选择生产工单");
|
return;
|
}
|
|
if (!this.formData.quantity || parseFloat(this.formData.quantity) <= 0) {
|
this.$showMessage("请输入有效的送检数量");
|
return;
|
}
|
|
const quantity = parseFloat(this.formData.quantity);
|
const planQty = parseFloat(this.formData.planQty);
|
|
if (quantity > planQty) {
|
this.$showMessage("送检数量不能大于工单数量");
|
return;
|
}
|
|
// 确保必要字段被正确设置
|
if (!this.formData.itemId) {
|
this.$showMessage("物料ID获取失败,请重新选择工单");
|
return;
|
}
|
|
if (!this.formData.billNo) {
|
this.$showMessage("工单号获取失败,请重新选择工单");
|
return;
|
}
|
|
// 设置Daa015字段(生产线别)
|
this.formData.daa015 = this.formData.lineNo;
|
|
// 设置默认提交状态为未提交(0)
|
this.formData.fsubmit = 0;
|
|
this.$post({
|
url: "/RKJ/save",
|
data: {
|
from: this.formData,
|
userNo: this.$loginInfo.account,
|
quantity: this.formData.quantity,
|
//moidNum: this.formData.moidNum
|
items: this.tableData
|
}
|
}).then(res => {
|
this.formData.id = res.data.tbBillList;
|
|
// 保存车间选择信息
|
if (this.formData.workShop && this.selectedDepartmentId) {
|
this.$post({
|
url: "/RKJ/SaveDepartmentSelection",
|
data: {
|
id: this.formData.id,
|
departmentId: this.selectedDepartmentId,
|
departmentName: this.formData.workShop
|
}
|
});
|
}
|
|
this.$showMessage("检验单创建成功!该检验单未维护检验项目,请先维护检验项目!");
|
// 不调用init方法,避免检验单号发生变化
|
this.isUpdate = false;
|
});
|
},
|
//生产线别选择并初始话工单号
|
onDaa020Change(event) {
|
//获取生产线别的下标地址
|
this.formData.lineName = event;
|
|
const selectedLine = this.lineList[this.DAA020List.indexOf(event)];
|
this.lineNo = selectedLine.lineno;
|
|
// 设置生产线编号到formData
|
this.formData.lineNo = this.lineNo;
|
|
this.$post({
|
url: "/RKJ/getDaa001",
|
data: {
|
lineNo: this.lineNo
|
}
|
}).then(res => {
|
this.BillNoList = res.data.tbBillList;
|
// 工单号去重,只显示唯一
|
this.DAA001List = Array.from(new Set(res.data.tbBillList.map(s => s.daa001)));
|
this.formData.rBillNo = "";
|
// 不清空送检数量,保持用户已输入的值
|
this.formData.itemName = "";
|
this.formData.itemNo = "";
|
this.formData.itemId = ""; // 清空物料ID
|
this.formData.itemModel = "";
|
this.formData.planQty = "";
|
this.tableData = [];
|
})
|
},
|
// 车间选择事件
|
onDepartmentChange(event) {
|
this.formData.workShop = event;
|
|
// 根据车间名称获取车间ID
|
this.$post({
|
url: "/RKJ/GetDepartmentsWithLines"
|
}).then(res => {
|
const department = res.data.tbBillList.find(item => item.departmentname === event);
|
if (department) {
|
this.selectedDepartmentId = department.departmentid;
|
|
// 根据车间ID获取线体列表
|
this.$post({
|
url: "/RKJ/GetLinesByDepartment",
|
data: {
|
departmentId: this.selectedDepartmentId
|
}
|
}).then(lineRes => {
|
console.log("线体数据:", lineRes.data.tbBillList); // 添加调试日志
|
this.lineList = lineRes.data.tbBillList;
|
this.DAA020List = lineRes.data.tbBillList.map(item => item.linename);
|
|
// 清空相关数据
|
this.formData.lineName = "";
|
this.formData.lineNo = ""; // 清空生产线编号
|
this.formData.rBillNo = "";
|
this.formData.billNo = ""; // 清空工单号
|
// 不清空送检数量,保持用户已输入的值
|
this.formData.itemName = "";
|
this.formData.itemNo = "";
|
this.formData.itemId = ""; // 清空物料ID
|
this.formData.itemModel = "";
|
this.formData.planQty = "";
|
this.tableData = [];
|
});
|
}
|
});
|
},
|
//选取工单填充物料号和其他信息
|
onDaa001Change(e) {
|
this.formData.rBillNo = e;
|
|
// 找到当前工单号的完整数据
|
let data = this.BillNoList.find(item => item.daa001 === e);
|
if (!data) {
|
this.formData.itemName = "";
|
this.formData.itemNo = "";
|
this.formData.itemId = "";
|
this.formData.billNo = "";
|
this.formData.quantity = "";
|
this.formData.itemModel = "";
|
this.tableData = [];
|
return;
|
}
|
|
// 自动填充物料信息
|
this.formData.itemName = data.daa003; // 产品名称
|
this.formData.itemNo = data.daa002; // 产品编码
|
this.formData.itemId = data.itemId || ""; // 物料ID
|
this.formData.billNo = data.daa001; // 工单号作为billNo
|
this.formData.itemModel = data.daa004 || ""; // 产品规格
|
this.formData.planQty = data.daa008 || ""; // 工单数量
|
// 不清空送检数量,保持用户已输入的值
|
this.tableData = [];
|
},
|
// 送检数量变化事件
|
onQuantityChange(event) {
|
// 如果输入为空,不进行验证
|
if (!this.formData.quantity || this.formData.quantity === "") {
|
return;
|
}
|
|
const quantity = parseFloat(this.formData.quantity);
|
|
// 检查是否为有效数字
|
if (isNaN(quantity)) {
|
this.$showMessage("请输入有效的数字");
|
this.formData.quantity = "";
|
return;
|
}
|
|
// 只有在输入完成且数量大于0时才进行验证
|
if (quantity <= 0) {
|
this.$showMessage("送检数量必须大于0");
|
this.formData.quantity = "";
|
return;
|
}
|
|
// 只有在已选择工单且有工单数量时才进行数量比较
|
if (this.formData.planQty) {
|
const planQty = parseFloat(this.formData.planQty);
|
if (!isNaN(planQty) && quantity > planQty) {
|
this.$showMessage("送检数量不能大于工单数量");
|
this.formData.quantity = "";
|
return;
|
}
|
}
|
},
|
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) {
|
// 保存原有的检验单号
|
const originalReleaseNo = this.formData.releaseNo;
|
|
// 映射数据库字段到前端字段
|
this.formData.id = data.id;
|
this.formData.releaseNo = data.releaseNo || originalReleaseNo;
|
this.formData.createBy = data.createBy;
|
this.formData.createDate = data.createDate;
|
this.formData.billNo = data.billNo;
|
this.formData.rbillNo = data.rbillNo;
|
this.formData.itemNo = data.itemNo;
|
this.formData.itemId = data.itemId;
|
this.formData.lineNo = data.lineNo;
|
this.formData.quantity = data.quantity;
|
this.formData.fcheckResu = data.fcheckResu;
|
this.formData.fcheckBy = data.fcheckBy;
|
this.formData.fcheckDate = data.fcheckDate;
|
this.formData.fsubmit = data.fsubmit; // 提交状态
|
this.formData.remarks = data.remarks;
|
this.formData.workShop = data.workShop;
|
this.formData.departmentId = data.departmentId;
|
|
// 从关联表获取的字段
|
this.formData.itemName = data.itemName;
|
this.formData.itemModel = data.itemModel;
|
this.formData.daa015 = data.daa015;
|
|
// 设置生产线名称(如果有lineNo)
|
if (this.formData.lineNo && this.formData.workShop) {
|
this.formData.lineName = this.formData.lineNo;
|
}
|
|
// 加载车间列表和相关信息
|
this.loadDepartmentAndLineInfo();
|
|
// 加载检验项目
|
this.loadInspectionItems();
|
}
|
});
|
},
|
|
// 加载车间和线体信息
|
loadDepartmentAndLineInfo() {
|
this.$post({
|
url: "/RKJ/GetDepartmentsWithLines"
|
}).then(deptRes => {
|
this.departmentList = deptRes.data.tbBillList.map(item => item.departmentname);
|
|
if (this.formData.workShop) {
|
const department = deptRes.data.tbBillList.find(item => item.departmentname === this.formData.workShop);
|
if (department) {
|
this.selectedDepartmentId = department.departmentid;
|
this.loadLineInfo();
|
}
|
}
|
});
|
},
|
|
// 加载线体信息
|
loadLineInfo() {
|
if (this.selectedDepartmentId) {
|
this.$post({
|
url: "/RKJ/GetLinesByDepartment",
|
data: {
|
departmentId: this.selectedDepartmentId
|
}
|
}).then(lineRes => {
|
this.lineList = lineRes.data.tbBillList;
|
this.DAA020List = lineRes.data.tbBillList.map(item => item.linename);
|
|
if (this.formData.lineNo) {
|
const selectedLine = this.lineList.find(line => line.lineNo === this.formData.lineNo);
|
if (selectedLine) {
|
this.formData.lineName = selectedLine.lineName;
|
}
|
this.loadWorkOrderInfo();
|
}
|
});
|
}
|
},
|
|
// 加载工单信息
|
loadWorkOrderInfo() {
|
if (this.formData.lineNo) {
|
this.$post({
|
url: "/RKJ/getDaa001",
|
data: {
|
lineNo: this.formData.lineNo
|
}
|
}).then(workOrderRes => {
|
this.BillNoList = workOrderRes.data.tbBillList;
|
this.DAA001List = Array.from(new Set(workOrderRes.data.tbBillList.map(s => s.daa001)));
|
});
|
}
|
},
|
|
// 加载检验项目
|
loadInspectionItems() {
|
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) {
|
console.log("没有找到检验项目");
|
}
|
}).catch(error => {
|
console.error("加载检验项目失败:", error);
|
this.tableData = [];
|
});
|
},
|
toDetail(item) {
|
|
if (this.isUpdate) {
|
uni.showToast({
|
icon: "none",
|
title: "请先生成检验项目",
|
duration: 2000,
|
});
|
} else if (this.formData.fsubmit == 1) {
|
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() {
|
if (this.formData.fsubmit == 1) {
|
this.$showMessage("该检验单已提交,不能修改不合格描述");
|
return;
|
}
|
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("保存成功");
|
}
|
})
|
}
|
},getInspectionItems() {
|
// 获取检验项目的逻辑 - 调用存储过程
|
this.$post({
|
url: "/RKJ/genUpdate",
|
data: {
|
id: this.formData.id,
|
no: this.formData.releaseNo,
|
user: this.$loginInfo.account
|
}
|
}).then(res => {
|
if (res.status == 0) {
|
uni.showToast({
|
title: res.data.message || "检验项目生成成功",
|
icon: 'success',
|
duration: 2000
|
});
|
// 延迟重新加载数据
|
setTimeout(() => {
|
this.init();
|
}, 2000);
|
} else {
|
uni.showToast({
|
title: res.data.message || "检验项目生成失败",
|
icon: 'error',
|
duration: 2000
|
});
|
}
|
}).catch(error => {
|
console.error("获取检验项目失败:", error);
|
this.$showMessage("获取检验项目失败,请重试");
|
});
|
},
|
getTable() {
|
// 确保quantity有值
|
if (!this.formData.quantity || parseFloat(this.formData.quantity) <= 0) {
|
this.$showMessage("请先输入有效的送检数量");
|
return;
|
}
|
|
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 = true;
|
} 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(){
|
if (this.formData.fsubmit == 1) {
|
this.$showMessage("该检验单已提交,不能清除检验结果");
|
return;
|
}
|
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);
|
}
|
|
})
|
},
|
|
// 提交检验方法
|
submitInspection() {
|
// 检查是否已提交
|
if (this.formData.fsubmit == 1) {
|
this.$showMessage("该检验单已提交,不能重复提交");
|
return;
|
}
|
|
// 检查是否有检验项目
|
if (this.tableData.length === 0) {
|
this.$showMessage("请先获取检验项目");
|
return;
|
}
|
|
// 检查是否所有检验项目都已完成
|
const unfinishedItems = this.tableData.filter(item =>
|
item.result === null || item.result === '未完成'
|
);
|
|
if (unfinishedItems.length > 0) {
|
this.$showMessage("还有检验项目未完成,请先完成所有检验项目");
|
return;
|
}
|
|
// 确认提交
|
uni.showModal({
|
title: '确认提交',
|
content: '确定要提交此检验单吗?提交后将无法修改。',
|
success: (res) => {
|
if (res.confirm) {
|
this.$post({
|
url: "/RKJ/submitInspection",
|
data: {
|
id: this.formData.id,
|
userNo: this.$loginInfo.account
|
}
|
}).then(res => {
|
if (res.status == 0) {
|
this.$showMessage("检验单提交成功!");
|
// 更新本地状态
|
this.formData.fsubmit = 1;
|
// 刷新数据
|
this.init();
|
} else {
|
this.$showMessage(res.message || "提交失败");
|
}
|
}).catch(error => {
|
console.error("提交失败:", error);
|
this.$showMessage("提交失败,请重试");
|
});
|
}
|
}
|
});
|
}
|
},
|
onShow() {
|
//每次进入页面都会执行的方法
|
if (this.formData.id) {
|
this.init();
|
}
|
},
|
};
|
</script>
|
|
<style>
|
/* 新建表单 - 优化后的UI样式 */
|
.create-form {
|
padding: 20px;
|
background-color: #f5f5f5;
|
min-height: 100vh;
|
font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
|
}
|
|
.form-header {
|
text-align: center;
|
margin-bottom: 30px;
|
padding: 20px;
|
background-color: #fff;
|
border-radius: 8px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
}
|
|
.form-header h2 {
|
color: #2c3e50;
|
font-size: 24px;
|
margin: 0 0 8px 0;
|
font-weight: 600;
|
}
|
|
.form-subtitle {
|
color: #7f8c8d;
|
font-size: 14px;
|
margin: 0;
|
}
|
|
.form-content {
|
background-color: #fff;
|
border-radius: 8px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
margin-bottom: 20px;
|
overflow: hidden;
|
}
|
|
.form-section {
|
padding: 20px;
|
border-bottom: 1px solid #ecf0f1;
|
}
|
|
.form-section:last-child {
|
border-bottom: none;
|
}
|
|
.section-title {
|
font-size: 16px;
|
font-weight: 600;
|
color: #2c3e50;
|
margin-bottom: 15px;
|
padding-bottom: 8px;
|
border-bottom: 2px solid #3498db;
|
display: flex;
|
align-items: center;
|
}
|
|
.section-title::before {
|
content: "●";
|
color: #3498db;
|
margin-right: 8px;
|
font-size: 12px;
|
}
|
|
.form-row {
|
display: flex;
|
align-items: center;
|
margin-bottom: 15px;
|
padding: 12px 0;
|
transition: all 0.3s ease;
|
}
|
|
.form-row:hover {
|
background-color: #f8f9fa;
|
border-radius: 8px;
|
padding-left: 8px;
|
padding-right: 8px;
|
}
|
|
.form-row:last-child {
|
margin-bottom: 0;
|
}
|
|
.form-label {
|
width: 120px;
|
font-weight: 500;
|
color: #34495e;
|
flex-shrink: 0;
|
font-size: 14px;
|
display: flex;
|
align-items: center;
|
}
|
|
.form-label.required::after {
|
content: " *";
|
color: #e74c3c;
|
font-weight: bold;
|
}
|
|
.form-value {
|
color: #2c3e50;
|
flex: 1;
|
font-weight: 500;
|
padding: 8px 12px;
|
background-color: #f8f9fa;
|
border-radius: 6px;
|
border: 1px solid #e9ecef;
|
}
|
|
.form-select {
|
flex: 1;
|
padding: 10px 12px;
|
border: 2px solid #e9ecef;
|
border-radius: 8px;
|
background-color: white;
|
color: #2c3e50;
|
font-size: 14px;
|
transition: all 0.3s ease;
|
}
|
|
.form-select:focus {
|
border-color: #3498db;
|
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
|
outline: none;
|
}
|
|
.form-input {
|
flex: 1;
|
padding: 15px 12px;
|
border: 2px solid #e9ecef;
|
border-radius: 8px;
|
font-size: 14px;
|
background-color: white;
|
color: #2c3e50;
|
transition: all 0.3s ease;
|
min-width: 200px;
|
width: 100%;
|
min-height: 50px;
|
}
|
|
.form-input:focus {
|
border-color: #3498db;
|
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
|
outline: none;
|
}
|
|
.form-hint {
|
flex: 1;
|
color: #95a5a6;
|
font-size: 14px;
|
font-style: italic;
|
padding: 10px 12px;
|
background-color: #f8f9fa;
|
border-radius: 8px;
|
border: 1px dashed #bdc3c7;
|
}
|
|
.form-actions {
|
text-align: center;
|
padding: 20px;
|
background-color: #fff;
|
border-radius: 8px;
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
}
|
|
.btn-primary {
|
background-color: #3498db;
|
color: white;
|
padding: 14px 32px;
|
border: none;
|
border-radius: 8px;
|
font-size: 16px;
|
font-weight: 500;
|
cursor: pointer;
|
transition: all 0.3s ease;
|
display: inline-flex;
|
align-items: center;
|
justify-content: center;
|
gap: 8px;
|
box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
|
}
|
|
.btn-primary:hover {
|
transform: translateY(-2px);
|
box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
|
}
|
|
.btn-primary:active {
|
transform: translateY(0);
|
}
|
|
.btn-primary:disabled {
|
background: #bdc3c7;
|
cursor: not-allowed;
|
transform: none;
|
box-shadow: none;
|
}
|
|
.btn-icon {
|
font-size: 16px;
|
font-weight: bold;
|
}
|
|
/* 查看/编辑表单 - LLJ类似的样式 */
|
.inspection-sheet {
|
font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
|
max-width: 1000px;
|
margin: 0 auto;
|
padding: 20px 20px 100px 20px; /* 底部增加内边距为固定按钮留空间 */
|
background-color: #fff;
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
min-height: 100vh;
|
position: relative;
|
}
|
|
/* 头部样式 */
|
.sheet-header {
|
text-align: center;
|
margin-bottom: 20px;
|
padding-bottom: 15px;
|
border-bottom: 2px solid #e0e0e0;
|
}
|
|
.sheet-header h1 {
|
color: #2c3e50;
|
font-size: 24px;
|
margin-bottom: 5px;
|
}
|
|
.inspection-number {
|
font-size: 16px;
|
font-weight: bold;
|
color: #3498db;
|
}
|
|
/* 基本信息区样式 */
|
.basic-info,
|
.material-info {
|
margin-bottom: 20px;
|
}
|
|
.info-row {
|
display: flex;
|
margin-bottom: 10px;
|
flex-wrap: wrap;
|
}
|
|
.info-label {
|
font-weight: bold;
|
color: #34495e;
|
min-width: 80px;
|
margin-right: 5px;
|
}
|
|
.info-value {
|
color: #2c3e50;
|
margin-right: 20px;
|
}
|
|
.picker-text {
|
padding: 6px 10px;
|
border: 1px solid #ddd;
|
border-radius: 4px;
|
background-color: white;
|
color: #999;
|
font-size: 14px;
|
min-height: 32px;
|
display: flex;
|
align-items: center;
|
max-width: 150px;
|
}
|
|
.picker-text.selected {
|
color: #e74c3c;
|
font-weight: 500;
|
}
|
|
.highlight {
|
font-weight: bold;
|
color: #e74c3c;
|
}
|
|
/* 物料信息区样式 */
|
.material-info {
|
border: 1px solid #eee;
|
padding: 15px;
|
border-radius: 5px;
|
}
|
|
.info-block {
|
display: flex;
|
align-items: center;
|
margin-bottom: 10px;
|
flex-wrap: wrap;
|
}
|
|
.dropdown-row {
|
display: flex;
|
align-items: center;
|
margin-bottom: 10px;
|
}
|
|
/* 表格样式 */
|
.inspection-table {
|
margin: 25px 0;
|
}
|
|
.inspection-table table {
|
width: 100%;
|
border-collapse: collapse;
|
}
|
|
.inspection-table th,
|
.inspection-table td {
|
padding: 12px 15px;
|
border: 1px solid #ddd;
|
text-align: left;
|
}
|
|
.inspection-table th {
|
background-color: #f8f9fa;
|
font-weight: bold;
|
color: #34495e;
|
}
|
|
.inspection-table tr:nth-child(even) {
|
background-color: #f9f9f9;
|
}
|
|
.inspection-table tr:hover {
|
background-color: #f1f5f9;
|
}
|
|
/* 水印样式 */
|
.watermark {
|
position: absolute;
|
font-size: 40px;
|
font-weight: bold;
|
opacity: 1;
|
z-index: 1;
|
pointer-events: none;
|
transform: rotate(-15deg);
|
width: 100%;
|
text-align: center;
|
top: 50%;
|
left: 50%;
|
transform: translate(-50%, -50%) rotate(-15deg);
|
}
|
|
.watermark.approved {
|
color: #2ecc71;
|
}
|
|
.watermark.rejected {
|
color: #e74c3c;
|
}
|
|
.watermark.pending {
|
color: #f39c12;
|
}
|
|
/* 描述文本容器 */
|
.description-text {
|
position: relative;
|
z-index: 2;
|
padding: 25px;
|
background-color: rgba(255, 255, 255, 0.7);
|
}
|
|
/* 调整表格单元格 */
|
.inspection-table td:nth-child(2) {
|
position: relative;
|
overflow: hidden;
|
padding: 0;
|
}
|
|
/* 表单上方操作按钮区样式 */
|
.top-action-buttons {
|
display: flex;
|
justify-content: flex-end;
|
gap: 10px;
|
margin: 20px 0;
|
padding: 15px;
|
background-color: #f8f9fa;
|
border-radius: 8px;
|
border: 1px solid #e9ecef;
|
}
|
|
/* 表单下方操作按钮区样式 */
|
.bottom-action-buttons {
|
display: flex;
|
justify-content: center;
|
gap: 8px;
|
padding: 12px;
|
flex-wrap: wrap;
|
align-items: center;
|
position: fixed; /* 固定在屏幕底部 */
|
bottom: 0; /* 距离底部0px */
|
left: 0; /* 距离左边0px */
|
right: 0; /* 距离右边0px */
|
background-color: #fff; /* 背景色 */
|
border-top: 1px solid #e9ecef; /* 顶部边框 */
|
z-index: 1000; /* 确保在最上层 */
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); /* 顶部阴影 */
|
}
|
|
.action-btn {
|
background-color: #ecf0f1;
|
color: #34495e;
|
padding: 12px 15px;
|
border: none;
|
border-radius: 6px;
|
cursor: pointer;
|
font-size: 14px;
|
font-weight: 500;
|
transition: all 0.3s ease;
|
text-align: center;
|
min-height: 44px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.action-btn:hover {
|
background-color: #d5dbdb;
|
transform: translateY(-1px);
|
}
|
|
.action-btn.primary {
|
background-color: #3498db;
|
color: #fff;
|
}
|
|
.action-btn.primary:hover {
|
background-color: #2980b9;
|
}
|
|
/* 小尺寸按钮样式 */
|
.action-btn.small {
|
padding: 10px 12px;
|
font-size: 14px;
|
min-height: 44px;
|
white-space: nowrap;
|
flex-shrink: 0;
|
min-width: 80px;
|
max-width: 120px;
|
flex: 1;
|
}
|
|
.record-btn {
|
padding: 6px 12px;
|
background-color: #f8f9fa;
|
border: 1px solid #ddd;
|
border-radius: 3px;
|
cursor: pointer;
|
transition: all 0.2s;
|
font-size: 14px;
|
color: #333;
|
}
|
|
.record-btn:hover {
|
background-color: #e9ecef;
|
}
|
|
/* 弹出框样式 */
|
.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;
|
padding: 20px;
|
}
|
|
.popup h3 {
|
font-size: 18px;
|
font-weight: 600;
|
color: #2c3e50;
|
margin: 0 0 20px 0;
|
}
|
|
.form-group {
|
margin-bottom: 15px;
|
}
|
|
.form-label {
|
display: block;
|
font-size: 14px;
|
color: #7f8c8d;
|
font-weight: 500;
|
margin-bottom: 5px;
|
}
|
|
.form-input {
|
width: 100%;
|
padding: 8px 12px;
|
border: 1px solid #ddd;
|
border-radius: 4px;
|
font-size: 14px;
|
background-color: white;
|
box-sizing: border-box;
|
}
|
|
.updateBut {
|
background-color: #3498db;
|
color: white;
|
padding: 10px 20px;
|
border: none;
|
border-radius: 4px;
|
cursor: pointer;
|
font-size: 14px;
|
margin-right: 10px;
|
}
|
|
.updateBut:hover {
|
background-color: #2980b9;
|
}
|
|
/* 无数据提示样式 */
|
.no-data-tip {
|
text-align: center;
|
padding: 40px 20px;
|
background-color: #f8f9fa;
|
border: 1px dashed #ddd;
|
border-radius: 8px;
|
margin: 20px 0;
|
}
|
|
/* 响应式设计 */
|
@media (max-width: 768px) {
|
.info-row {
|
flex-direction: column;
|
}
|
|
.info-block {
|
flex-direction: column;
|
align-items: flex-start;
|
}
|
|
.dropdown-row {
|
flex-direction: column;
|
align-items: flex-start;
|
}
|
|
.bottom-action-buttons {
|
flex-direction: column;
|
gap: 5px;
|
}
|
|
.action-btn.small {
|
min-width: 100%;
|
max-width: none;
|
}
|
}
|
</style>
|