init: MES_Manage_View_V20 v1.1.0 项目初始化

- Vue 2.7 + Element UI + Webpack 5 前端
- SQL Server 数据库脚本 (script.sql)
- 4份技术文档 (技术分析/功能映射/使用说明书/用户操作手册)
- 存储过程修复 (fix_生产管理_外协报表_查询.sql)
This commit is contained in:
MESWORK
2026-05-21 09:31:44 +08:00
commit 885e70b9fc
648 changed files with 108327 additions and 0 deletions

View File

@@ -0,0 +1,752 @@
<template>
<div>
<el-card>
<div>
<el-menu mode="horizontal" :default-active="activeIndex" router>
<!-- <el-menu-item index="/QualityManagement/CheckTask/firstSpecial"
>首检专检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processSpecial"
>序检专检</el-menu-item
> -->
<el-menu-item index="/QualityManagement/CheckTask/final"
>终检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/purchaseIncoming"
>采购入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/salesReturn"
>销售退货检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/materialReturn"
>原材料退库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/OtherInbound"
>其他入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processReceive"
>序检收检</el-menu-item
>
</el-menu>
</div>
</el-card>
<el-card>
<div class="search-container">
<span class="show-text">生产订单:</span>
<el-input
v-model="orderNo"
placeholder="请输入生产订单"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">物料名称:</span>
<el-input
v-model="partName"
placeholder="请输入物料名称"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">物料编码:</span>
<el-input
v-model="partNo"
placeholder="请输入物料编号"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">检测日期:</span>
<el-date-picker
v-model="inspectionDate"
:clearable="false"
end-placeholder="结束时间"
format="yyyy-MM-dd"
range-separator="-"
start-placeholder="开始时间"
style="width: 280px; vertical-align: top"
type="datetimerange"
value-format="yyyy-MM-dd"
/>
<!-- <span class="show-text">计划完工日期:</span>
<el-date-picker
v-model="completionTime"
:clearable="false"
end-placeholder="结束时间"
format="yyyy-MM-dd"
range-separator="-"
start-placeholder="开始时间"
style="width: 280px; vertical-align: top"
type="datetimerange"
value-format="yyyy-MM-dd"
/> -->
<br />
<br />
<span class="show-text">检测结果</span>
<el-select
v-model="inspectionResult"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option label="合格" value="1" />
<el-option label="不合格" value="0" />
</el-select>
<span class="show-text">检测人:</span>
<el-select
v-model="checker"
placeholder="请选择检测人"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in checkerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <span class="show-text">检测类别:</span>
<el-select
v-model="type"
placeholder="请选择检测类别"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
<el-button
:disabled="loading"
icon="el-icon-search"
plain
type="primary"
@click="searchTable()"
>查询
</el-button>
<!-- <el-button
type="success"
icon="el-icon-download"
plain
:disabled="tableData.length === 0"
@click="exportToExcel"
>导出</el-button
> -->
</div>
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%; margin-top: 20px"
tooltip-effect="dark"
>
<el-table-column
align="center"
label="序号"
type="index"
width="50"
fixed
/>
<el-table-column
align="center"
label="生产订单"
width="80"
prop="订单编号"
/>
<el-table-column
align="center"
label="物料名称"
width="150"
prop="物料名称"
/>
<el-table-column
align="center"
label="物料编码"
width="150"
prop="物料编码"
/>
<!-- <el-table-column
align="center"
label="采购数"
width="80"
prop="计划生产数"
/> -->
<el-table-column
align="center"
label="检验数量"
width="80"
prop="入库数量"
/>
<el-table-column
align="center"
label="合格数"
width="80"
prop="合格数"
/>
<el-table-column
align="center"
label="不合格数"
width="80"
prop="不合格数"
/>
<el-table-column
align="center"
label="检验人"
width="100"
prop="检测人"
/>
<el-table-column
align="center"
label="检验时间"
width="150"
prop="检验时间"
/>
<el-table-column
align="center"
label="备注"
width="150"
prop="备注"
/>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button
class="operation-btn"
type="primary"
size="mini"
@click="receiveCheck(scope.row)"
>入库检</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 收检对话框 -->
<el-dialog
title="入库检"
:visible.sync="receiveCheckVisible"
width="60%"
style="text-align: center"
>
<el-form
ref="receiveCheckForm"
:model="receiveCheckData"
label-position="right"
label-width="140px"
size="mini"
>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label">物料名称</span>
<span class="info-value">{{ receiveCheckData.零件名称 }}</span>
</div>
<div class="info-item">
<span class="info-label">物料编码</span>
<span class="info-value">{{ receiveCheckData.零件编码 }}</span>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label">生产订单</span>
<span class="info-value">{{ receiveCheckData.计划号 }}</span>
</div>
<div class="info-item">
<span class="info-label">采购数</span>
<span class="info-value">{{ receiveCheckData.计划生产数 }}</span>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 送检数量</span>
<span class="info-value">{{ receiveCheckData.检测数量 }}</span>
</div>
<div class="info-item">
<span class="info-label"> 合格数</span>
<span class="info-value">{{receiveCheckData.检测数量 - receiveCheckData.不合格数 }}</span>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 不合格数</span>
<el-input-number
v-model="receiveCheckData.不合格数"
size="mini"
:min="0"
:max="receiveCheckData.检测数量"
style="width: 200px"
@change="handleQualifiedChange"
/>
</div>
<div class="info-item">
<span class="info-label"> 检验人</span>
<el-select
v-model="receiveCheckData.检测人"
placeholder="请选择检验人"
clearable
style="width: 200px"
filterable
>
<el-option
v-for="item in checkerList"
:key="item.value"
:label="item.label"
:value="item.label"
/>
</el-select>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 检验时间</span>
<el-date-picker
v-model="receiveCheckData.检测时间"
type="datetime"
placeholder="选择检验时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 120px"
class="info-value"
/>
</div>
<div class="info-item">
<span class="info-label"> 放行数量</span>
<el-input
v-model="receiveCheckData.放行数量"
type="number"
style="width: 120px"
class="info-value"
/>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 检测说明</span>
<el-input
v-model="receiveCheckData.检测说明"
type="textarea"
:rows="2"
placeholder="请输入检测说明"
style="width: 120px"
class="info-value"
/>
</div>
</div>
</div>
</el-form>
<div slot="footer">
<el-button type="primary" @click="confirmReceiveCheck"> </el-button>
<el-button @click="receiveCheckVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// 引入xlsx库
import * as XLSX from "xlsx";
export default {
data() {
return {
contractNo: "",
orderNo: "",
partNo: "",
partName: "",
completionTime: "",
inspectionDate: "",
type: "",
typeList: [],
checker: "",
checkerLabel: "",
checkerList: [],
inspectionResult: "",
tableData: [],
loading: false,
selectedRow: null,
receiveCheckVisible: false,
receiveCheckData: {
// 基本信息(从行数据获取)
零件名称: "",
内部合同号: "",
零件编码: "",
计划号: "",
工序名称: "",
计划完成时间: "",
计划生产数: 0,
TaskAID: "",
// 收检数据(用户输入)
检测数量: 0,
合格数: 0,
不合格数: 0,
检测人: "",
检测时间: "",
检测说明: "",
},
};
},
created() {
this.getTypeList();
this.getCheckerList();
this.searchTable();
},
computed: {
activeIndex() {
return this.$route.path;
},
},
methods: {
getTypeList() {
this.typeList = [];
var Data = this.CreateData("11", "查询字典");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].数据类别 === "检测类型") {
this.typeList.push({
label: response.data[i].词条名称,
value: response.data[i].词条编号,
});
}
}
});
},
getCheckerList() {
this.checkerList = [];
var Data = this.CreateData("11", "人员管理_人员信息查询_质检部门_查询");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.checkerList.push({
label: response.data[i].Personnel_Name,
value: response.data[i].Personnel_Number,
});
}
});
},
searchTable() {
// 开始加载状态,清空表格数据和选中行
this.loading = true;
this.tableData = [];
// 构建基础查询参数
var param = [];
param.push(["订单号", this.orderNo]);
param.push(["零件编号", this.partNo]);
param.push(["零件名称", this.partName]);
// 添加检测日期范围参数
param.push([
"检测日期_Start",
this.inspectionDate ? this.inspectionDate[0] : "",
]);
param.push([
"检测日期_End",
this.inspectionDate ? this.inspectionDate[1] : "",
]);
param.push(["检测结果", this.inspectionResult]);
const selectedChecker = this.checkerList.find(
(item) => item.value === this.checker
);
param.push(["检测人", selectedChecker ? selectedChecker.label : ""]);
// 调用封装方法生成请求数据 - 使用新的存储过程名称
var Data = this.CreateData(
"11",
"质量管理_其他入库_查询",
param
);
// 执行数据库请求
this.ExecDatabase(Data)
.then((response) => {
this.loading = false;
console.log(response.data);
if (response.data && response.data.length !== 0) {
this.tableData = response.data;
} else {
this.tableData = [];
this.$message.info("未查询到相关数据");
}
})
.catch((error) => {
this.loading = false;
console.error("查询失败:", error);
this.$message.error("查询失败");
});
},
receiveCheck(row) {
// 打开收检对话框并填充数据
this.receiveCheckVisible = true;
console.log(row)
// 从行数据填充基本信息
this.receiveCheckData = {
// 基本信息(从行数据获取)
零件名称: row.物料名称 || "",
零件编码: row.物料编码 || "",
计划号: row.订单编号 || "",
行号: row.行号 || 0,
订单类型: row.订单类型 || "",
// 收检数据(用户输入)
检测数量: row.入库数量 || 0,
合格数: row.入库数量 || 0,
不合格数: row.不合格数 || 0,
检测人: row.检测人 || "",
检测时间: this.formatDateTime(new Date()),
检测说明: "",
};
console.log(this.receiveCheckData);
},
handleQualifiedChange(value) {
// 自动计算不合格数
this.receiveCheckData.合格数 = this.receiveCheckData.检测数量 - value;
},
confirmReceiveCheck() {
// 验证表单
if (
!this.receiveCheckData.检测数量 ||
this.receiveCheckData.检测数量 <= 0
) {
this.$message.warning("请输入有效的检测数量");
return;
}
if (!this.receiveCheckData.检测人) {
this.$message.warning("请选择检验人");
return;
}
if (!this.receiveCheckData.检测时间) {
this.$message.warning("请选择检验时间");
return;
}
console.log(this.receiveCheckData.合格数,this.receiveCheckData.不合格数)
if (!this.receiveCheckData.检测数量 == this.receiveCheckData.合格数 + this.receiveCheckData.不合格数) {
this.$message.warning("合格数加不合格数必须等于检测数量");
return;
}
// 调用存储过程保存数据
this.saveReceiveCheck();
},
saveReceiveCheck() {
var param = [];
param.push(["检测类型编号", 5]);
param.push(["质检类型", "来料检验"]);
param.push(["零件名称", this.receiveCheckData.零件名称]);
param.push(["零件编码", this.receiveCheckData.零件编码]);
param.push(["计划号", this.receiveCheckData.计划号]);
param.push(["检测数量", this.receiveCheckData.检测数量]);
param.push(["合格数", this.receiveCheckData.合格数]);
param.push(["不合格数", this.receiveCheckData.不合格数]);
param.push(["检测人", this.receiveCheckData.检测人]);
param.push(["检测时间", this.receiveCheckData.检测时间]);
param.push(["检测说明", this.receiveCheckData.检测说明]);
param.push(["行号", this.receiveCheckData.行号]);
param.push(["订单类型", this.receiveCheckData.订单类型]);
param.push(["放行数量", this.receiveCheckData.放行数量]);
console.log(param);
var Data = this.CreateData("12", "质量管理_其他入库检验_更新", param);
this.ExecDatabase(Data)
.then((response) => {
if (
response.data &&
response.data[0] &&
response.data[0].result === "1"
) {
this.$message.success("来料检验操作成功");
this.receiveCheckVisible = false;
// 刷新表格数据
this.searchTable();
} else {
this.$message.error("来料检验操作失败");
}
})
.catch((error) => {
console.error("来料检验操作失败:", error);
this.$message.error("来料检验操作失败");
});
},
formatDateTime(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
// 导出Excel功能
exportToExcel() {
if (this.tableData.length === 0) {
this.$message.warning("没有数据可导出");
return;
}
try {
// 准备导出数据
const exportData = this.tableData.map((item, index) => {
return {
序号: index + 1,
合同号: item.内部合同号 || "",
订单编号: item.计划号 || "",
零件名称: item.零件名称 || "",
零件编码: item.零件编码 || "",
工序名称: item.工序名称 || "",
计划生产数: item.计划生产数 || 0,
检验数量: item.检验数量 || 0,
检验合格数量: item.合格数 || 0,
检验不合格数量: item.不合格数 || 0,
检验操作人: item.检测人 || "",
检验时间: item.检测时间 || "",
};
});
// 创建工作簿
const wb = XLSX.utils.book_new();
// 创建工作表
const ws = XLSX.utils.json_to_sheet(exportData);
// 设置列宽
const colWidth = [
{ wch: 8 }, // 序号
{ wch: 15 }, // 合同号
{ wch: 15 }, // 订单编号
{ wch: 20 }, // 零件名称
{ wch: 15 }, // 零件编码
{ wch: 12 }, // 工序名称
{ wch: 12 }, // 计划生产数
{ wch: 10 }, // 检验数量
{ wch: 15 }, // 检验合格数量
{ wch: 15 }, // 检验不合格数量
{ wch: 12 }, // 检验操作人
{ wch: 20 }, // 检验时间
];
ws["!cols"] = colWidth;
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(wb, ws, "序检收检记录");
// 生成文件名(包含当前时间)
const fileName = `序检收检记录_${this.formatDateForFileName(
new Date()
)}.xlsx`;
// 导出文件
XLSX.writeFile(wb, fileName);
this.$message.success("导出成功");
} catch (error) {
console.error("导出失败:", error);
this.$message.error("导出失败");
}
},
// 格式化日期用于文件名
formatDateForFileName(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
},
},
};
</script>
<style>
.search-container {
margin-bottom: 20px;
}
.show-text {
margin-right: 5px;
line-height: 32px;
}
.operation-cell {
display: flex;
justify-content: space-between;
width: 100%;
}
.operation-btn {
flex: 1;
margin: 0 5px;
padding: 0;
min-width: 0;
}
.active {
color: skyblue;
margin-left: 5px;
}
.info-container {
border: 1px solid #ccc;
display: flex;
}
.info-item {
display: flex;
flex: 1;
border-right: 1px solid #ccc;
}
.info-item:last-child {
border-right: none;
}
.info-label {
width: 30%;
padding: 8px;
background-color: #f5f7fa;
border-right: 1px solid #ccc;
}
.info-value {
flex: 1;
padding: 5px;
}
.info-label,
.info-value {
display: flex;
align-items: center;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,301 @@
<template>
<div>
<el-card>
<div>
<el-menu mode="horizontal" :default-active="activeIndex" router>
<el-menu-item index="/QualityManagement/CheckTask/firstSpecial"
>首检专检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processSpecial"
>序检专检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/final"
>终检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/purchaseIncoming"
>采购入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/salesReturn"
>销售退货检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/materialReturn"
>原材料退库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/OtherInbound"
>其他入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processReceive"
>序检收检</el-menu-item
>
</el-menu>
</div>
</el-card>
<el-card>
<div class="search-container">
<span class="show-text">工序:</span>
<el-select
v-model="process"
placeholder="请选择工序"
clearable
style="width: 150px; margin-right: 10px"
>
<el-option
v-for="item in processList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">工位:</span>
<el-select
v-model="station"
clearable
placeholder="请选择工位"
style="width: 150px; margin-right: 10px"
>
<el-option
v-for="item in StationList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">生产订单:</span>
<el-input
v-model="orderNo"
placeholder="请输入生产订单"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">零件编号:</span>
<el-input
v-model="partNo"
placeholder="请输入零件编号"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">操作时间:</span>
<el-date-picker
v-model="operationTime"
:clearable="false"
end-placeholder="结束时间"
format="yyyy-MM-dd"
popper-class="virtual-cell-time-picker"
range-separator="-"
start-placeholder="开始时间"
style="width: 280px; vertical-align: top"
type="datetimerange"
value-format="yyyy-MM-dd"
/>
<el-button
:disabled="loading"
icon="el-icon-search"
plain
type="primary"
@click="searchTable()"
>查询</el-button
>
</div>
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%; margin-top: 20px"
tooltip-effect="dark"
>
<el-table-column
align="center"
label="序号"
type="index"
width="50"
fixed
/>
<el-table-column align="center" label="工位编号" width="100">
<template slot-scope="scope">
{{ scope.row.工位编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="工序名称" width="100">
<template slot-scope="scope">
{{ scope.row.工序名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作类别" width="100">
<template slot-scope="scope">
{{ scope.row.操作类别 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作人" width="80">
<template slot-scope="scope">
{{ scope.row.操作人 }}
</template>
</el-table-column>
<el-table-column align="center" label="销售订单" width="80">
<template slot-scope="scope">
{{ scope.row.合同号 }}
</template>
</el-table-column>
<el-table-column align="center" label="生产订单" width="80">
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料编号" width="200">
<template slot-scope="scope">
{{ scope.row.物料编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料名称" width="200">
<template slot-scope="scope">
{{ scope.row.物料描述 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作数值" width="100">
<template slot-scope="scope">
{{ scope.row.操作数值 }}
</template>
</el-table-column>
<el-table-column align="center" label="开始时间" width="180">
<template slot-scope="scope">
{{ scope.row.开始时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="结束时间" width="180">
<template slot-scope="scope">
{{ scope.row.结束时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="工时(分)" width="80">
<template slot-scope="scope">
{{ scope.row.工时 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
activeTab: "form",
orderNo: "",
partNo: "",
productCode: "",
productName: "",
processName: "",
process: "",
processList: [],
station: "",
StationList: [],
operationTime: [],
loading: false,
tableData: [],
};
},
created() {
var now = new Date();
var start = new Date(
Date.UTC(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)
)
.toISOString()
.replace("T", " ")
.replace(".000Z", "");
var end = new Date(
Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59)
)
.toISOString()
.replace("T", " ")
.replace(".000Z", "");
this.operationTime = [start, end];
this.getProcessList();
this.getStationList();
this.searchTable();
},
computed: {
activeIndex() {
return this.$route.path;
},
},
methods: {
// 初始化获取工序信息
getProcessList() {
this.processList = [];
var Data = this.CreateData("11", "Prog_MES_LoadProcess");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.processList.push({
label: response.data[i].工序名称,
value: response.data[i].工艺编号,
});
}
});
},
// 初始化获取工位信息
getStationList() {
this.StationList = [];
var Data = this.CreateData("11", "Prog_MES_LoadStations");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.StationList.push({
label: response.data[i].OPName,
value: response.data[i].VisCode,
});
}
});
},
searchTable() {
this.loading = true;
this.tableData = [];
var param = [];
param.push(["ProcessID", this.process]);
param.push(["OPCode", this.station]);
param.push(["OrderNo", this.orderNo]);
param.push(["PartCode", this.partNo]);
param.push([
"PlanStart",
this.operationTime ? this.operationTime[0] : "",
]);
param.push(["PlanEnd", this.operationTime ? this.operationTime[1] : ""]);
param.push(["不装配", 1]);
var Data = this.CreateData(
"11",
"MES_QulityInspection_FirstCheckRecords",
param
);
this.ExecDatabase(Data)
.then((response) => {
this.loading = false;
console.log("查询结果:", response.data);
if (response.data && response.data.length !== 0) {
this.tableData = response.data;
} else {
console.log("查询结果为空");
}
})
.catch((error) => {
this.loading = false;
console.error("查询出错:", error);
});
},
},
};
</script>
<style scoped lang="scss">
.search-container {
margin-bottom: 20px;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
<template>
<div>
<el-card>
<div>
<el-menu mode="horizontal" :default-active="activeIndex" router>
<el-menu-item index="/QualityManagement/CheckTask/firstSpecial"
>首检专检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processSpecial"
>序检专检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/final"
>终检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/purchaseIncoming"
>采购入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/salesReturn"
>销售退货检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/materialReturn"
>原材料退库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/OtherInbound"
>其他入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processReceive"
>序检收检</el-menu-item
>
</el-menu>
</div>
</el-card>
</div>
</template>
<script>
export default {};
</script>
<style>
.search-container {
margin-bottom: 20px;
}
.show-text {
margin-right: 5px;
line-height: 32px;
}
.operation-cell {
display: flex;
justify-content: space-between;
width: 100%;
}
.operation-btn {
flex: 1;
margin: 0 5px;
padding: 0;
min-width: 0;
}
.active {
color: skyblue;
margin-left: 5px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,830 @@
<template>
<div>
<el-card>
<div>
<el-menu mode="horizontal" :default-active="activeIndex" router>
<!-- <el-menu-item index="/QualityManagement/CheckTask/firstSpecial"
>首检专检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processSpecial"
>序检专检</el-menu-item
> -->
<el-menu-item index="/QualityManagement/CheckTask/final"
>终检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/purchaseIncoming"
>采购入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/salesReturn"
>销售退货检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/materialReturn"
>原材料退库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/OtherInbound"
>其他入库检</el-menu-item
>
<el-menu-item index="/QualityManagement/CheckTask/processReceive"
>序检收检</el-menu-item
>
</el-menu>
</div>
</el-card>
<el-card>
<div class="search-container">
<span class="show-text">生产订单:</span>
<el-input
v-model="orderNo"
placeholder="请输入生产订单"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">物料名称:</span>
<el-input
v-model="partName"
placeholder="请输入物料名称"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">物料编码:</span>
<el-input
v-model="partNo"
placeholder="请输入物料编号"
clearable
style="width: 150px; margin-right: 10px"
/>
<span class="show-text">检测日期:</span>
<el-date-picker
v-model="inspectionDate"
:clearable="false"
end-placeholder="结束时间"
format="yyyy-MM-dd"
range-separator="-"
start-placeholder="开始时间"
style="width: 280px; vertical-align: top"
type="datetimerange"
value-format="yyyy-MM-dd"
/>
<!-- <span class="show-text">计划完工日期:</span>
<el-date-picker
v-model="completionTime"
:clearable="false"
end-placeholder="结束时间"
format="yyyy-MM-dd"
range-separator="-"
start-placeholder="开始时间"
style="width: 280px; vertical-align: top"
type="datetimerange"
value-format="yyyy-MM-dd"
/> -->
<br />
<br />
<span class="show-text">检测结果</span>
<el-select
v-model="inspectionResult"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option label="合格" value="1" />
<el-option label="不合格" value="0" />
</el-select>
<span class="show-text">检测人:</span>
<el-select
v-model="checker"
placeholder="请选择检测人"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in checkerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <span class="show-text">检测类别:</span>
<el-select
v-model="type"
placeholder="请选择检测类别"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select> -->
<el-button
:disabled="loading"
icon="el-icon-search"
plain
type="primary"
@click="searchTable()"
>查询
</el-button>
<!-- <el-button
type="success"
icon="el-icon-download"
plain
:disabled="tableData.length === 0"
@click="exportToExcel"
>导出</el-button
> -->
</div>
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%; margin-top: 20px"
tooltip-effect="dark"
>
<el-table-column
align="center"
label="序号"
type="index"
width="50"
fixed
/>
<el-table-column
align="center"
label="生产订单"
width="80"
prop="订单编号"
/>
<el-table-column
align="center"
label="物料名称"
width="150"
prop="物料名称"
/>
<el-table-column
align="center"
label="物料编码"
width="150"
prop="物料编码"
/>
<!-- <el-table-column
align="center"
label="采购数"
width="80"
prop="计划生产数"
/> -->
<el-table-column
align="center"
label="检验数量"
width="80"
prop="入库数量"
/>
<el-table-column
align="center"
label="合格数"
width="80"
prop="合格数"
/>
<el-table-column
align="center"
label="不合格数"
width="80"
prop="不合格数"
/>
<el-table-column
align="center"
label="检验人"
width="100"
prop="检测人"
/>
<el-table-column
align="center"
label="检验时间"
width="150"
prop="检验时间"
/>
<el-table-column
align="center"
label="备注"
width="150"
prop="备注"
/>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button
class="operation-btn"
type="primary"
size="mini"
@click="receiveCheck(scope.row)"
>退货检</el-button
>
</template>
</el-table-column>
</el-table>
</el-card>
<!-- 收检对话框 -->
<el-dialog
title="退货检"
:visible.sync="receiveCheckVisible"
width="60%"
style="text-align: center"
>
<el-form
ref="receiveCheckForm"
:model="receiveCheckData"
label-position="right"
label-width="140px"
size="mini"
>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label">物料名称</span>
<span class="info-value">{{ receiveCheckData.零件名称 }}</span>
</div>
<div class="info-item">
<span class="info-label">物料编码</span>
<span class="info-value">{{ receiveCheckData.零件编码 }}</span>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label">生产订单</span>
<span class="info-value">{{ receiveCheckData.计划号 }}</span>
</div>
<div class="info-item">
<span class="info-label">采购数</span>
<span class="info-value">{{ receiveCheckData.计划生产数 }}</span>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 送检数量</span>
<span class="info-value">{{ receiveCheckData.检测数量 }}</span>
</div>
<div class="info-item">
<span class="info-label"> 合格数</span>
<span class="info-value">{{receiveCheckData.检测数量 - receiveCheckData.不合格数 }}</span>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 不合格数</span>
<el-input-number
v-model="receiveCheckData.不合格数"
size="mini"
:min="0"
:max="receiveCheckData.检测数量"
style="width: 200px"
@change="handleQualifiedChange"
/>
</div>
<div class="info-item">
<span class="info-label"> 检验人</span>
<el-select
v-model="receiveCheckData.检测人"
placeholder="请选择检验人"
clearable
style="width: 200px"
filterable
>
<el-option
v-for="item in checkerList"
:key="item.value"
:label="item.label"
:value="item.label"
/>
</el-select>
</div>
</div>
</div>
<div>
<div class="info-container">
<div class="info-item">
<span class="info-label"> 检验时间</span>
<el-date-picker
v-model="receiveCheckData.检测时间"
type="datetime"
placeholder="选择检验时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 120px"
class="info-value"
/>
</div>
<div class="info-item">
<span class="info-label"> 检测说明</span>
<el-input
v-model="receiveCheckData.检测说明"
type="textarea"
:rows="2"
placeholder="请输入检测说明"
style="width: 120px"
class="info-value"
/>
</div>
</div>
</div>
</el-form>
<div slot="footer">
<el-button type="primary" @click="confirmReceiveCheck"> </el-button>
<el-button @click="receiveCheckVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// 引入xlsx库
import * as XLSX from "xlsx";
export default {
data() {
return {
contractNo: "",
orderNo: "",
partNo: "",
partName: "",
completionTime: "",
inspectionDate: "",
type: "",
typeList: [],
checker: "",
checkerLabel: "",
checkerList: [],
inspectionResult: "",
tableData: [],
loading: false,
selectedRow: null,
receiveCheckVisible: false,
receiveCheckData: {
// 基本信息(从行数据获取)
零件名称: "",
内部合同号: "",
零件编码: "",
计划号: "",
工序名称: "",
计划完成时间: "",
计划生产数: 0,
TaskAID: "",
// 收检数据(用户输入)
检测数量: 0,
合格数: 0,
不合格数: 0,
检测人: "",
检测时间: "",
检测说明: "",
},
};
},
created() {
this.getTypeList();
this.getCheckerList();
this.searchTable();
this.getCurrentTime();
setInterval(this.getCurrentTime, 1000);
},
computed: {
activeIndex() {
return this.$route.path;
},
},
methods: {
getTypeList() {
this.typeList = [];
var Data = this.CreateData("11", "查询字典");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].数据类别 === "检测类型") {
this.typeList.push({
label: response.data[i].词条名称,
value: response.data[i].词条编号,
});
}
}
});
},
getCheckerList() {
this.checkerList = [];
var Data = this.CreateData("11", "人员管理_人员信息查询_质检部门_查询");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.checkerList.push({
label: response.data[i].Personnel_Name,
value: response.data[i].Personnel_Number,
});
}
});
},
searchTable() {
// 开始加载状态,清空表格数据和选中行
this.loading = true;
this.tableData = [];
// 构建基础查询参数
var param = [];
param.push(["订单号", this.orderNo]);
param.push(["零件编号", this.partNo]);
param.push(["零件名称", this.partName]);
// 添加检测日期范围参数
param.push([
"检测日期_Start",
this.inspectionDate ? this.inspectionDate[0] : "",
]);
param.push([
"检测日期_End",
this.inspectionDate ? this.inspectionDate[1] : "",
]);
param.push(["检测结果", this.inspectionResult]);
const selectedChecker = this.checkerList.find(
(item) => item.value === this.checker
);
param.push(["检测人", selectedChecker ? selectedChecker.label : ""]);
// 调用封装方法生成请求数据 - 使用新的存储过程名称
var Data = this.CreateData(
"11",
"质量管理_质量检验_退货质检任务_查询",
param
);
// 执行数据库请求
this.ExecDatabase(Data)
.then((response) => {
this.loading = false;
console.log(response.data);
if (response.data && response.data.length !== 0) {
this.tableData = response.data;
} else {
this.tableData = [];
this.$message.info("未查询到相关数据");
}
})
.catch((error) => {
this.loading = false;
console.error("查询失败:", error);
this.$message.error("查询失败");
});
},
receiveCheck(row) {
// 打开收检对话框并填充数据
this.receiveCheckVisible = true;
console.log(row)
// 从行数据填充基本信息
this.receiveCheckData = {
// 基本信息(从行数据获取)
零件名称: row.物料名称 || "",
零件编码: row.物料编码 || "",
计划号: row.订单编号 || "",
行号: row.行号 || 0,
订单类型: row.订单类型 || "",
// 收检数据(用户输入)
检测数量: row.入库数量 || 0,
合格数: row.入库数量 || 0,
不合格数: row.不合格数 || 0,
检测人: row.检测人 || "",
检测时间: this.formatDateTime(new Date()),
检测说明: "",
};
console.log(this.receiveCheckData);
},
handleQualifiedChange(value) {
// 自动计算不合格数
this.receiveCheckData.合格数 = this.receiveCheckData.检测数量 - value;
},
confirmReceiveCheck() {
// 验证表单
if (
!this.receiveCheckData.检测数量 ||
this.receiveCheckData.检测数量 <= 0
) {
this.$message.warning("请输入有效的检测数量");
return;
}
if (!this.receiveCheckData.检测人) {
this.$message.warning("请选择检验人");
return;
}
if (!this.receiveCheckData.检测时间) {
this.$message.warning("请选择检验时间");
return;
}
if (!this.receiveCheckData.检测数量 == this.receiveCheckData.合格数 + this.receiveCheckData.不合格数) {
this.$message.warning("合格数加不合格数必须等于检测数量");
return;
}
// 调用存储过程保存数据
this.saveReceiveCheck();
},
getCurrentTime() {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, "0"); // 月份从0开始需要加1
const day = String(now.getDate()).padStart(2, "0");
const hours = String(now.getHours()).padStart(2, "0");
const minutes = String(now.getMinutes()).padStart(2, "0");
const seconds = String(now.getSeconds()).padStart(2, "0");
this.currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
saveReceiveCheck() {
var param = [];
param.push(["检测类型编号", 5]);
param.push(["质检类型", "来料检验"]);
param.push(["零件名称", this.receiveCheckData.零件名称]);
param.push(["零件编码", this.receiveCheckData.零件编码]);
param.push(["计划号", this.receiveCheckData.计划号]);
param.push(["检测数量", this.receiveCheckData.检测数量]);
param.push(["合格数", this.receiveCheckData.合格数]);
param.push(["不合格数", this.receiveCheckData.不合格数]);
param.push(["检测人", this.receiveCheckData.检测人]);
param.push(["检测时间", this.receiveCheckData.检测时间]);
param.push(["检测说明", this.receiveCheckData.检测说明]);
param.push(["行号", this.receiveCheckData.行号]);
param.push(["订单类型", this.receiveCheckData.订单类型]);
console.log(param);
var Data = this.CreateData("12", "质量管理_销售退货检_更新", param);
this.ExecDatabase(Data)
.then((response) => {
if (
response.data &&
response.data[0] &&
response.data[0].result === "1"
) {
this.$message.success("销售退货操作成功");
this.receiveCheckVisible = false;
// 刷新表格数据
this.searchTable();
// this.submitMaterialRequisition();
} else {
this.$message.error("销售退货操作失败");
}
})
.catch((error) => {
console.error("销售退货操作失败:", error);
this.$message.error("销售退货操作失败");
});
},
async submitMaterialRequisition() {
var params = []
var param = []
var param2 = [];
param.push(["doc_date", this.formatDate(this.currentTime)]);
param.push(["doc_type", "202-59"]);
param.push(["external_num", this.receiveCheckData.计划号]);
param.push(["task_items", param2]);
param2.push(["base_type", "202"]);
param2.push(["external_num", this.receiveCheckData.计划号])
param2.push(["item_code", this.receiveCheckData.零件编码]);
param2.push(["item_name", this.receiveCheckData.零件名称]);
param2.push(["whs_code", ""]);
param2.push(["manage_type", 'B']);
param2.push(["price", 0]);
param2.push(["quantity", this.receiveCheckData.合格数]);
param2.push(["base_line_num",this.receiveCheckData.行号]);
param2.push(["base_entry", this.receiveCheckData.计划号]);
params.push(param)
const result = this.transformData(params);
// const jsonString = JSON.stringify(result, null, 2);
// console.log(jsonString);
const result2 = await posttm('/stocktask/task/issueordertask',result)
console.log(result2)
},
transformData(rawArray) {
console.log("原始数据:", rawArray);
// 初始化结果对象
const result = {
doc_date: "",
doc_type: "",
external_num: 0,
task_items: []
};
// 遍历所有文档,合并 task_items
for (const docArray of rawArray) {
// 将单个文档的二维数组转换为对象
const map = {};
for (const [key, value] of docArray) {
map[key] = value;
}
// 设置文档级别信息(使用第一个文档的信息)
if (result.task_items.length === 0) {
result.doc_date = map.doc_date;
result.doc_type = map.doc_type;
result.external_num = map.external_num;
}
// 处理 task_items
const taskItemsArray = map.task_items;
console.log("当前文档的 task_items:", taskItemsArray);
if (Array.isArray(taskItemsArray)) {
// 将 task_items 的二维数组转换为对象
const taskMap = {};
for (const [k, v] of taskItemsArray) {
taskMap[k] = v;
}
// 将每个文档的 task_item 添加到结果中
result.task_items.push({
base_line_num: taskMap.base_line_num,
base_entry: taskMap.base_entry,
base_type: taskMap.base_type,
external_num: taskMap.external_num,
item_code: taskMap.item_code,
item_name: taskMap.item_name,
whs_code: '', // 原值被清空
manage_type: taskMap.manage_type,
price: taskMap.price,
quantity: taskMap.quantity,
});
}
}
return result;
},
formatDateTime(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
// 导出Excel功能
exportToExcel() {
if (this.tableData.length === 0) {
this.$message.warning("没有数据可导出");
return;
}
try {
// 准备导出数据
const exportData = this.tableData.map((item, index) => {
return {
序号: index + 1,
合同号: item.内部合同号 || "",
订单编号: item.计划号 || "",
零件名称: item.零件名称 || "",
零件编码: item.零件编码 || "",
工序名称: item.工序名称 || "",
计划生产数: item.计划生产数 || 0,
检验数量: item.检验数量 || 0,
检验合格数量: item.合格数 || 0,
检验不合格数量: item.不合格数 || 0,
检验操作人: item.检测人 || "",
检验时间: item.检测时间 || "",
};
});
// 创建工作簿
const wb = XLSX.utils.book_new();
// 创建工作表
const ws = XLSX.utils.json_to_sheet(exportData);
// 设置列宽
const colWidth = [
{ wch: 8 }, // 序号
{ wch: 15 }, // 合同号
{ wch: 15 }, // 订单编号
{ wch: 20 }, // 零件名称
{ wch: 15 }, // 零件编码
{ wch: 12 }, // 工序名称
{ wch: 12 }, // 计划生产数
{ wch: 10 }, // 检验数量
{ wch: 15 }, // 检验合格数量
{ wch: 15 }, // 检验不合格数量
{ wch: 12 }, // 检验操作人
{ wch: 20 }, // 检验时间
];
ws["!cols"] = colWidth;
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(wb, ws, "序检收检记录");
// 生成文件名(包含当前时间)
const fileName = `序检收检记录_${this.formatDateForFileName(
new Date()
)}.xlsx`;
// 导出文件
XLSX.writeFile(wb, fileName);
this.$message.success("导出成功");
} catch (error) {
console.error("导出失败:", error);
this.$message.error("导出失败");
}
},
// 格式化日期用于文件名
formatDateForFileName(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
},
},
};
</script>
<style>
.search-container {
margin-bottom: 20px;
}
.show-text {
margin-right: 5px;
line-height: 32px;
}
.operation-cell {
display: flex;
justify-content: space-between;
width: 100%;
}
.operation-btn {
flex: 1;
margin: 0 5px;
padding: 0;
min-width: 0;
}
.active {
color: skyblue;
margin-left: 5px;
}
.info-container {
border: 1px solid #ccc;
display: flex;
}
.info-item {
display: flex;
flex: 1;
border-right: 1px solid #ccc;
}
.info-item:last-child {
border-right: none;
}
.info-label {
width: 30%;
padding: 8px;
background-color: #f5f7fa;
border-right: 1px solid #ccc;
}
.info-value {
flex: 1;
padding: 5px;
}
.info-label,
.info-value {
display: flex;
align-items: center;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,308 @@
<template>
<!-- 模板部分保持不变 -->
<div>
<el-card>
<div>
<span class="show-text">生产订单号:</span>
<el-input v-model="orderNo" placeholder="请输入订单号" clearable style="width: 100px; margin-right: 10px" />
<!-- <span class="show-text">合同号:</span>
<el-input v-model="contractNo" placeholder="请输入合同号" clearable style="width: 130px; margin-right: 10px" /> -->
<span class="show-text">零件编码:</span>
<el-input v-model="productCode" placeholder="请输入零件编码" clearable style="width: 150px; margin-right: 10px" />
<span class="show-text">零件名称:</span>
<el-input v-model="productName" placeholder="请输入零件名称" clearable style="width: 100px; margin-right: 10px" />
<span class="show-text">质检类型:</span>
<el-select
v-model="QualityStatus"
clearable
placeholder="请选择质检类型"
style="width: 150px; margin-right: 10px"
>
<el-option label="全部" value="10" />
<el-option label="收检" value="0" />
<el-option label="终检" value="1" />
<el-option label="来料检验" value="2" />
<el-option label="退库检验" value="3" />
</el-select>
<span class="show-text">质检日期起:</span>
<el-date-picker
v-model="startDate"
type="date"
placeholder="选择开始日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 150px; margin-right: 10px" />
<span class="show-text">质检日期止:</span>
<el-date-picker
v-model="endDate"
type="date"
placeholder="选择结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 150px; margin-right: 10px" />
<el-button :disabled="!!loading" icon="el-icon-search" plain type="primary" @click="searchTable()">查询</el-button>
<el-button style="width: 100px;" icon="el-icon-download" type="primary" @click="exportExcel">Excel导出</el-button>
</div>
<el-tabs v-model="activeTab" type="card" class="custom-tabs">
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%;margin-top: 20px;"
tooltip-effect="dark"
:row-class-name="tableRowClassName"
@row-click="handleRowClick">
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" label="序号" type="index" width="50" fixed />
<el-table-column align="center" prop="质检类型" label="质检类型" width="80" fixed />
<el-table-column align="center" prop="零件编码" label="零件编码" width="220" fixed />
<el-table-column align="center" prop="零件名称" label="零件名称" width="190" />
<el-table-column align="center" prop="内部合同号" label="销售订单号" width="100" />
<el-table-column align="center" prop="计划号" label="生产订单号" width="80" />
<el-table-column align="center" prop="工序名称" label="工序名称" width="100" />
<el-table-column align="center" prop="工位名称" label="工位名称" width="100" />
<el-table-column align="center" prop="供应商代码" label="供应商代码" width="120" />
<el-table-column align="center" prop="检验数量" label="检验数量" width="120" />
<el-table-column align="center" prop="合格数" label="合格数" width="120" />
<el-table-column align="center" prop="不合格数" label="不合格数" width="120" />
<el-table-column align="center" prop="检测人" label="检测人" width="100" />
<el-table-column align="center" label="检测时间" width="160">
<template slot-scope="scope">
{{ formatDateTime(scope.row.检测时间) }}
</template>
</el-table-column>
<el-table-column align="center" prop="检测说明" label="检测说明" width="160"/>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[20, 50, 100]"
:page-size="pageSize"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges" />
</div>
</el-tabs>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
// 分页
pageCurrent: 1,
pageSize: 20,
total1: 0,
// 搜索条件
QualityStatus:'10',
startDate:null,
endDate:null,
orderNo:'',
contractNo:'',
productCode:'',
productName:'',
// 表格数据
loading: false,
activeTab: 'first',
tableData: [],
// 新增相关数据
orderList: [],
exporting: false,
// processList: [],
// personnelList: [],
}
},
mounted() {
this.searchTable()
},
methods: {
// ============ 表格相关方法 ============
tableRowClassName({ row, rowIndex }) {
if (!row.结束时间 || row.结束时间 === '') {
return 'row-without-endtime'
}
return ''
},
handleRowClick(row) {
this.currentTask = row
},
handleSelectionChange(val) {
this.multipleSelection = val
},
exportExcel() {
// 校验日期是否已选择
// if (!this.startDate || !this.endDate) {
// this.$message.warning('请选择开始日期和结束日期')
// return
// }
// // 校验开始日期不能大于结束日期
// if (this.startDate > this.endDate) {
// this.$message.warning('开始日期不能大于结束日期')
// return
// }
const param = []
param.push(["质检类型", this.QualityStatus]);
param.push(["开始日期", this.startDate]);
param.push(["结束日期", this.endDate]);
param.push(["订单号", this.orderNo ]);
param.push(["合同号", this.contractNo ]);
param.push(["零件编码", this.productCode ]);
param.push(["零件名称", this.productName ]);
this.exporting = true
const Data = this.CreateData('2001', '质量管理_质检明细_导出', param)
this.exportExcel_NPOI(Data).finally(() => {
this.exporting = false
})
},
// ============ 数据加载方法 ============
// loadPersonnelList() {
// var param = []
// var Data = this.CreateData('11', '系统管理_人员管理_所有有效人员查询', param)
// this.ExecDatabase(Data).then(response => {
// if (response.data && response.data.length > 0) {
// this.personnelList = response.data.map(person => ({
// key: person.人员编号,
// label: person.人员姓名,
// disabled: false
// }))
// }
// })
// },
// loadOrderList(orderId) {
// var param = []
// param.push(['订单编号', orderId])
// var Data = this.CreateData('11', '工时校验_获取订单列表', param)
// this.ExecDatabase(Data).then(response => {
// this.orderList = response.data || []
// }).catch(error => {
// console.error('加载订单列表失败:', error)
// this.orderList = []
// })
// },
// loadProcessList(orderId) {
// var param = [['订单编号', orderId]]
// var Data = this.CreateData('11', '工时校验_获取订单工序', param)
// this.ExecDatabase(Data).then(response => {
// this.processList = response.data || []
// }).catch(error => {
// console.error('加载工序列表失败:', error)
// this.processList = []
// })
// },
// ============ 分页方法 ============
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
},
searchTable() {
this.loading = true
var param = []
param.push(["质检类型", this.QualityStatus]);
param.push(["开始日期", this.startDate]);
param.push(["结束日期", this.endDate]);
param.push(["订单号", this.orderNo ]);
param.push(["合同号", this.contractNo ]);
param.push(["零件编码", this.productCode ]);
param.push(["零件名称", this.productName ]);
param.push(['PageCurrent', this.pageCurrent])
param.push(['pageSize', this.pageSize])
param.push(['PageCount', '1111', 'int', '1'])
param.push(['ItemCount', '1111', 'int', '1'])
var Data = this.CreateData('11', '质量管理_质检明细_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.result || []
this.total1 = parseInt(response.data.output[0].ItemCount)
this.loading = false
}).catch(error => {
this.$message.error('查询失败:' + error.message)
this.loading = false
})
},
// ============ 工具方法 ============
getCurrentUser() {
return this.$store.state.user.name
},
formatDateTime(dateTime) {
if (!dateTime) return ''
const date = new Date(dateTime)
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
}).replace(/\//g, '-')
},
}
}
</script>
<style scoped>
.search-container {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10px;
}
.show-text {
white-space: nowrap;
}
.custom-tabs {
margin-top: 10px;
}
.dialog-footer {
text-align: center;
}
/* ::v-deep .row-without-endtime {
background-color: #f56c6c !important;
color: #000000 !important;
} */
</style>

View File

@@ -0,0 +1,816 @@
<template>
<div>
<el-card>
<div class="search-container">
<span class="show-text">零件号:</span>
<el-select
v-model="partNo"
placeholder="请选择零件号"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in partNoList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">工序名称:</span>
<el-select
v-model="process"
placeholder="请选择工序"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in processList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">类型:</span>
<el-select
v-model="type"
placeholder="请选择类型"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
clearable
filterable
/>
</el-select>
<el-button
:disabled="loading"
plain
type="primary"
@click="searchTable()"
>查询</el-button
>
<el-button
:disabled="loading"
plain
type="primary"
@click="addCheckType()"
>新增标准</el-button
>
</div>
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%; margin-top: 20px"
tooltip-effect="dark"
>
<el-table-column
align="center"
label="序号"
type="index"
width="50"
fixed
/>
<el-table-column align="center" label="零件号" width="120">
<template slot-scope="scope">
{{ scope.row.零件号 }}
</template>
</el-table-column>
<el-table-column align="center" label="工序" width="100">
<template slot-scope="scope">
{{ scope.row.工序 }}
</template>
</el-table-column>
<el-table-column align="center" label="类型" width="100">
<template slot-scope="scope">
{{ scope.row.类型 }}
</template>
</el-table-column>
<el-table-column align="center" label="检验项目" width="120">
<template slot-scope="scope">
{{ scope.row.检验项目 }}
</template>
</el-table-column>
<el-table-column align="center" label="检验内容" width="150">
<template slot-scope="scope">
{{ scope.row.检验内容 }}
</template>
</el-table-column>
<el-table-column align="center" label="上限值" width="80">
<template slot-scope="scope">
{{ scope.row.上限值 }}
</template>
</el-table-column>
<el-table-column align="center" label="下限值" width="80">
<template slot-scope="scope">
{{ scope.row.下限值 }}
</template>
</el-table-column>
<el-table-column align="center" label="单位" width="80">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column align="center" label="检验比例" width="80">
<template slot-scope="scope">
{{ scope.row.检验比例 }}
</template>
</el-table-column>
<el-table-column align="center" label="检具" width="100">
<template slot-scope="scope">
{{ scope.row.检具 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="150">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<div class="operation-cell">
<el-button
type="text"
size="mini"
@click="editInspectionStandard(scope.row)"
>修改</el-button
>
<el-button
type="text"
size="mini"
@click="deleteInspectionStandard(scope.row)"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<el-dialog
:visible.sync="dialogVisibleAdd"
:title="dialogTitle"
center=""
width="850px"
style="text-align: center"
>
<el-form
ref="checkForm"
:model="checkForm"
label-position="right"
label-width="140px"
size="mini"
>
<el-row>
<el-col :span="12">
<el-form-item label="零件号">
<el-input
v-model="checkForm.零件号"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序">
<el-input
v-model="checkForm.工序"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="类型">
<el-input
v-model="checkForm.类型"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验比例">
<el-input
v-model="checkForm.检验比例"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检验项目">
<el-input
v-model="checkForm.检验项目"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验内容">
<el-input
v-model="checkForm.检验内容"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="上限值">
<el-input
v-model="checkForm.上限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下限值">
<el-input
v-model="checkForm.下限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="单位">
<el-input
v-model="checkForm.单位"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检具">
<el-input
v-model="checkForm.检具"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input
v-model="checkForm.备注"
type="textarea"
:rows="3"
resize="vertical"
size="mini"
style="width: 400px"
/>
</el-form-item>
</el-col>
</el-row>
<div class="dialog-footer">
<div style="margin-bottom: 20px">
<el-button
type="primary"
@click="submitInspection('checkForm', checkForm)"
>确定</el-button
>
<el-button @click="dialogVisibleAdd = false"> </el-button>
</div>
</div>
</el-form>
</el-dialog>
<el-dialog
:visible.sync="dialogVisibleChange"
:title="dialogTitle"
center=""
width="850px"
style="text-align: center"
>
<el-form
ref="checkForm"
:model="checkForm"
label-position="right"
label-width="140px"
size="mini"
>
<el-row>
<el-col :span="12">
<el-form-item label="零件号">
<el-input
v-model="checkForm.零件号"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序">
<el-input
v-model="checkForm.工序"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="类型">
<el-input
v-model="checkForm.类型"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验比例">
<el-input
v-model="checkForm.检验比例"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检验项目">
<el-input
v-model="checkForm.检验项目"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验内容">
<el-input
v-model="checkForm.检验内容"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="上限值">
<el-input
v-model="checkForm.上限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下限值">
<el-input
v-model="checkForm.下限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="单位">
<el-input
v-model="checkForm.单位"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检具">
<el-input
v-model="checkForm.检具"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input
v-model="checkForm.备注"
type="textarea"
:rows="3"
resize="vertical"
size="mini"
style="width: 400px"
/>
</el-form-item>
</el-col>
</el-row>
<div class="dialog-footer">
<div style="margin-bottom: 20px">
<el-button type="primary" @click="updateInspection('checkForm')"
>确定</el-button
>
<el-button @click="dialogVisibleChange = false"> </el-button>
</div>
</div>
</el-form>
</el-dialog>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
partNo: "",
partNoList: [],
process: "",
processList: [],
type: "",
typeList: [],
dialogVisibleAdd: false,
dialogVisibleChange: false,
dialogTitle: "新增检验标准",
checkForm: {
零件号: "",
工序: "",
类型: "",
检验比例: "",
检验项目: "",
检验内容: "",
上限值: "",
下限值: "",
单位: "",
检具: "",
备注: "",
},
currentEditRow: null,
loading: false,
};
},
created() {
this.getNoList();
this.getProcessList();
this.getTypeList();
this.searchTable();
},
methods: {
getNoList() {
this.partNoList = [
{ label: "零件A", value: "PART001" },
{ label: "零件B", value: "PART002" },
{ label: "零件C", value: "PART003" },
{ label: "零件D", value: "PART004" },
{ label: "零件E", value: "PART005" },
];
// 如果需要从接口获取真实数据,可以取消下面的注释并替换存储过程名
/*
this.partNoList = [];
var Data = this.CreateData("11", "查询零件号"); // 这里替换为实际的存储过程名
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
// 根据实际返回的数据结构调整字段名
this.partNoList.push({
label: response.data[i].零件名称, // 根据实际字段名调整
value: response.data[i].零件编号, // 根据实际字段名调整
});
}
});
*/
},
getProcessList() {
this.processList = [];
var Data = this.CreateData("11", "Prog_MES_LoadProcess");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.processList.push({
label: response.data[i].StatgeName,
value: response.data[i].StageID,
});
}
});
},
getTypeList() {
this.typeList = [];
var Data = this.CreateData("11", "查询字典");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
// 假设 YL_基础表_数据字典 返回的字段是 DictName 和 DictID
if (response.data[i].数据类别 === "检测类型") {
this.typeList.push({
label: response.data[i].词条名称,
value: response.data[i].词条编号,
});
}
}
});
},
addCheckType() {
// 根据选中的值查找对应的标签文字
const partNoItem = this.partNoList.find(
(item) => item.value === this.partNo
);
const processItem = this.processList.find(
(item) => item.value === this.process
);
const typeItem = this.typeList.find((item) => item.value === this.type);
const partNoLabel = partNoItem ? partNoItem.label : this.partNo;
const processLabel = processItem ? processItem.label : this.process;
const typeLabel = typeItem ? typeItem.label : this.type;
this.checkForm = {
零件号: partNoLabel,
类型: typeLabel,
工序: processLabel,
检验比例: "",
检验项目: "",
检验内容: "",
上限值: "",
下限值: "",
单位: "",
检具: "",
备注: "",
};
this.dialogTitle = "新增检验标准";
this.dialogVisibleAdd = true;
},
submitInspection(formName, row) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 获取选中项的编号
const partNoItem = this.partNoList.find(
(item) => item.label === this.checkForm.零件号
);
const processItem = this.processList.find(
(item) => item.label === this.checkForm.工序
);
const typeItem = this.typeList.find(
(item) => item.label === this.checkForm.类型
);
// 调用存储过程
const param = [];
param.push(["零件号", this.checkForm.零件号]);
param.push(["零件编号", partNoItem ? partNoItem.value : ""]);
param.push(["工序", this.checkForm.工序]);
param.push(["工序编号", processItem ? processItem.value : ""]);
param.push(["类型", this.checkForm.类型]);
param.push(["类型编号", typeItem ? typeItem.value : ""]);
param.push(["检验比例", this.checkForm.检验比例]);
param.push(["检验项目", this.checkForm.检验项目]);
param.push(["检验内容", this.checkForm.检验内容]);
param.push(["上限值", this.checkForm.上限值]);
param.push(["下限值", this.checkForm.下限值]);
param.push(["单位", this.checkForm.单位]);
param.push(["检具", this.checkForm.检具]);
param.push(["备注", this.checkForm.备注]);
const data = this.CreateData("12", "质量管理_检验标准表_新增", param);
this.ExecDatabase(data)
.then((response) => {
if (response.data[0].result !== "1") {
this.$message({
message: "检验标准提交失败!",
type: "error",
});
return;
}
this.$message({
message: "检验标准提交成功",
type: "success",
});
this.dialogVisibleAdd = false;
this.searchTable();
})
.catch((error) => {
this.$message({
message: "检验标准提交失败: " + error,
type: "error",
});
});
}
});
},
searchTable() {
this.loading = true;
this.tableData = [];
this.selectedRow = null;
console.log("查询条件:", {
零件编号: this.partNo,
工序编号: this.process,
类型编号: this.type,
});
var param = [];
if (this.partNo) {
param.push(["零件编号", this.partNo]);
}
if (this.process) {
param.push(["工序编号", this.process]);
}
if (this.type) {
param.push(["类型编号", this.type]);
}
var Data = this.CreateData("11", "质量管理_检验标准表_查询", param);
this.ExecDatabase(Data)
.then((response) => {
this.loading = false;
console.log("查询返回的数据:", response.data);
if (response.data.length !== 0) {
this.tableData = response.data;
console.log("表格数据:", this.tableData);
} else {
console.log("查询结果为空,参数:", param);
}
})
.catch((error) => {
this.loading = false;
console.error("查询出错:", error);
this.$message({
message: "查询失败",
type: "error",
});
});
},
editInspectionStandard(row) {
// 获取选中行的数据,并填充到表单中
this.checkForm = {
零件号: row.零件号,
工序: row.工序,
类型: row.类型,
检验比例: row.检验比例,
检验项目: row.检验项目,
检验内容: row.检验内容,
上限值: row.上限值,
下限值: row.下限值,
单位: row.单位,
检具: row.检具,
备注: row.备注,
};
// 保存当前编辑的行数据,用于后续更新操作
this.currentEditRow = row;
this.dialogTitle = "修改检验标准";
// 显示对话框
this.dialogVisibleChange = true;
},
updateInspection(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 获取编号信息
const partNoItem = this.partNoList.find(
(item) => item.label === this.checkForm.零件号
);
const processItem = this.processList.find(
(item) => item.label === this.checkForm.工序
);
const typeItem = this.typeList.find(
(item) => item.label === this.checkForm.类型
);
// 构建更新参数
const param = [];
param.push(["ID", this.currentEditRow.ID]);
param.push(["零件号", this.checkForm.零件号]);
param.push([
"零件编号",
this.currentEditRow.零件编号 ||
(partNoItem ? partNoItem.value : ""),
]);
param.push(["工序", this.checkForm.工序]);
param.push([
"工序编号",
this.currentEditRow.工序编号 ||
(processItem ? processItem.value : ""),
]);
param.push(["类型", this.checkForm.类型]);
param.push([
"类型编号",
this.currentEditRow.类型编号 || (typeItem ? typeItem.value : ""),
]);
param.push(["检验比例", this.checkForm.检验比例]);
param.push(["检验项目", this.checkForm.检验项目]);
param.push(["检验内容", this.checkForm.检验内容]);
param.push(["上限值", this.checkForm.上限值]);
param.push(["下限值", this.checkForm.下限值]);
param.push(["单位", this.checkForm.单位]);
param.push(["检具", this.checkForm.检具]);
param.push(["备注", this.checkForm.备注]);
// 调用更新存储过程
const data = this.CreateData("12", "质量管理_检验标准表_修改", param);
this.ExecDatabase(data)
.then((response) => {
if (response.data[0].result !== "1") {
this.$message({
message: "检验标准更新失败!",
type: "error",
});
return;
}
this.$message({
message: "检验标准更新成功",
type: "success",
});
this.dialogVisibleChange = false;
this.searchTable(); // 刷新表格数据
})
.catch((error) => {
this.$message({
message: "检验标准更新失败: " + error,
type: "error",
});
});
}
});
},
deleteInspectionStandard(row) {
this.$confirm("此操作将永久删除该检验标准, 是否继续?", "提示", {
cancelButtonText: "取消",
confirmButtonText: "确定",
type: "warning",
})
.then(() => {
// 构建删除参数
const param = [];
param.push(["ID", row.ID]);
// 调用删除存储过程
const data = this.CreateData("12", "质量管理_检验标准表_删除", param);
this.ExecDatabase(data)
.then((response) => {
if (response.data[0].result !== "1") {
this.$message({
message: "检验标准删除失败!",
type: "error",
});
return;
}
this.$message({
message: "检验标准删除成功",
type: "success",
});
this.searchTable(); // 刷新表格数据
})
.catch((error) => {
this.$message({
message: "检验标准删除失败: " + error,
type: "error",
});
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
},
};
</script>
<style scoped lang="scss">
.search-container {
margin-bottom: 20px;
}
.dialog-footer {
margin-top: 20px;
display: flex;
justify-content: center;
}
</style>

View File

@@ -0,0 +1,786 @@
<template>
<div>
<el-card>
<div class="search-container">
<span class="show-text">物料编号:</span>
<el-select
v-model="物料编号"
placeholder="请选择物料编号"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in partNoList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">工序名称:</span>
<el-select
v-model="工序名称编号"
placeholder="请选择工序"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in processList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">检测类别:</span>
<el-select
v-model="检测类别编号"
placeholder="请选择检测类别"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button
:disabled="loading"
plain
type="primary"
@click="searchTable()"
>查询</el-button
>
<el-button
:disabled="loading"
plain
type="primary"
@click="addCheckType()"
>新增标准</el-button
>
</div>
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%; margin-top: 20px"
tooltip-effect="dark"
>
<el-table-column
align="center"
label="序号"
type="index"
width="50"
fixed
/>
<el-table-column align="center" label="物料编号" width="240">
<template slot-scope="scope">
{{ scope.row.物料编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="工序名称" width="100">
<template slot-scope="scope">
{{ getProcessLabel(scope.row.工序名称编号) }}
</template>
</el-table-column>
<el-table-column align="center" label="检测类别" width="100">
<template slot-scope="scope">
{{ getDetectionTypeLabel(scope.row.检测类别编号) }}
</template>
</el-table-column>
<el-table-column align="center" label="检测项目" width="120">
<template slot-scope="scope">
{{ scope.row.检测项目 }}
</template>
</el-table-column>
<el-table-column align="center" label="上限值" width="80">
<template slot-scope="scope">
{{ scope.row.上限值 }}
</template>
</el-table-column>
<el-table-column align="center" label="下限值" width="80">
<template slot-scope="scope">
{{ scope.row.下限值 }}
</template>
</el-table-column>
<el-table-column align="center" label="测量单位" width="80">
<template slot-scope="scope">
{{ scope.row.测量单位 }}
</template>
</el-table-column>
<el-table-column align="center" label="检验比例" width="80">
<template slot-scope="scope">
{{ scope.row.检验比例 }}
</template>
</el-table-column>
<el-table-column align="center" label="检具" width="100">
<template slot-scope="scope">
{{ scope.row.检具 }}
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="150">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<div class="operation-cell">
<el-button
type="text"
size="mini"
@click="editInspectionStandard(scope.row)"
>修改</el-button
>
<el-button
type="text"
size="mini"
@click="deleteInspectionStandard(scope.row)"
>删除</el-button
>
</div>
</template>
</el-table-column>
</el-table>
<!-- 新增标准弹窗 -->
<el-dialog
:visible.sync="dialogVisibleAdd"
:title="dialogTitle"
center=""
width="850px"
style="text-align: center"
>
<el-form
ref="checkForm"
:model="checkForm"
label-position="right"
label-width="140px"
size="mini"
:rules="formRules"
>
<el-row>
<el-col :span="12">
<el-form-item label="物料编号" prop="物料编号">
<el-select
v-model="checkForm.物料编号"
placeholder="请选择物料编号"
clearable
style="width: 200px"
filterable
>
<el-option
v-for="item in partNoList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序名称" prop="工序名称编号">
<el-select
v-model="checkForm.工序名称编号"
placeholder="请选择工序名称"
clearable
style="width: 200px"
filterable
>
<el-option
v-for="item in processList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检测类别" prop="检测类别编号">
<el-select
v-model="checkForm.检测类别编号"
placeholder="请选择检测类别"
clearable
style="width: 200px"
filterable
>
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检具">
<el-input
v-model="checkForm.检具"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检测项目">
<el-input
v-model="checkForm.检测项目"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="理论值">
<el-input
v-model="checkForm.理论值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="上限值">
<el-input
v-model="checkForm.上限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下限值">
<el-input
v-model="checkForm.下限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="测量单位">
<el-input
v-model="checkForm.测量单位"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验比例">
<el-input
v-model="checkForm.检验比例"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input
v-model="checkForm.备注"
type="textarea"
:rows="3"
resize="vertical"
size="mini"
style="width: 400px"
/>
</el-form-item>
</el-col>
</el-row>
<div class="dialog-footer">
<div style="margin-bottom: 20px">
<el-button type="primary" @click="submitInspection('checkForm')"
>确定</el-button
>
<el-button @click="dialogVisibleAdd = false"> </el-button>
</div>
</div>
</el-form>
</el-dialog>
<!-- 修改标准弹窗 -->
<el-dialog
:visible.sync="dialogVisibleChange"
:title="dialogTitle"
center=""
width="850px"
style="text-align: center"
>
<el-form
ref="checkForm"
:model="checkForm"
label-position="right"
label-width="140px"
size="mini"
>
<el-row>
<el-col :span="12">
<el-form-item label="物料编号" prop="物料编号">
<el-input
v-model="checkForm.物料编号"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序名称" prop="工序名称">
<el-input
:value="getProcessLabel(checkForm.工序名称编号)"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检测类别编号" prop="检测类别编号">
<el-input
:value="getDetectionTypeLabel(checkForm.检测类别编号)"
size="mini"
readonly=""
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检验比例">
<el-input
v-model="checkForm.检验比例"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="检测项目">
<el-input
v-model="checkForm.检测项目"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="理论值">
<el-input
v-model="checkForm.理论值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="上限值">
<el-input
v-model="checkForm.上限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下限值">
<el-input
v-model="checkForm.下限值"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="测量单位">
<el-input
v-model="checkForm.测量单位"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检具">
<el-input
v-model="checkForm.检具"
size="mini"
style="width: 200px"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注">
<el-input
v-model="checkForm.备注"
type="textarea"
:rows="3"
resize="vertical"
size="mini"
style="width: 400px"
/>
</el-form-item>
</el-col>
</el-row>
<div class="dialog-footer">
<div style="margin-bottom: 20px">
<el-button type="primary" @click="updateInspection('checkForm')"
>确定</el-button
>
<el-button @click="dialogVisibleChange = false"> </el-button>
</div>
</div>
</el-form>
</el-dialog>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
物料编号: "", // 搜索条件
工序名称编号: "", // 搜索条件
检测类别编号: "", // 搜索条件
partNoList: [],
processList: [],
typeList: [],
dialogVisibleAdd: false,
dialogVisibleChange: false,
dialogTitle: "新增检验标准",
checkForm: {
AID: "",
物料编号: "",
工序名称编号: "",
检测类别编号: "",
检测项编号: "",
检测项目: "",
理论值: "",
上限值: "",
下限值: "",
测量单位: "",
检验比例: "",
检具: "",
备注: "",
阶段标识: "",
},
formRules: {
物料编号: [
{ required: true, message: "请选择物料编号", trigger: "change" },
],
工序名称编号: [
{ required: true, message: "请选择工序名称", trigger: "change" },
],
检测类别编号: [
{ required: true, message: "请选择检测类别", trigger: "change" },
],
},
currentEditRow: null,
loading: false,
tableData: [],
};
},
created() {
this.getNoList();
this.getProcessList();
this.getTypeList();
this.searchTable();
},
methods: {
getNoList() {
this.partNoList = [];
var Data = this.CreateData("11", "MES_ProcessManagement_PartGet");
this.ExecDatabase(Data).then((response) => {
// 使用对象来去重
const uniqueObj = {};
const uniqueList = [];
response.data.forEach((item) => {
const materialNo = item.物料编号;
if (!uniqueObj[materialNo]) {
uniqueObj[materialNo] = true;
uniqueList.push({
label: item.物料名称 || item.物料编号,
value: materialNo,
});
}
});
this.partNoList = uniqueList;
});
},
getProcessList() {
this.processList = [];
var Data = this.CreateData("11", "Prog_MES_LoadProcess");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.processList.push({
label: response.data[i].工序名称,
value: response.data[i].阶段标识 || response.data[i].工艺编号,
});
}
});
},
getTypeList() {
this.typeList = [];
var Data = this.CreateData("11", "查询字典");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].数据类别 === "检测类型") {
this.typeList.push({
label: response.data[i].词条名称,
value: response.data[i].词条编号,
});
}
}
});
},
getDetectionTypeLabel(value) {
const type = this.typeList.find((item) => item.value === value);
return type ? type.label : value;
},
getProcessLabel(value) {
const process = this.processList.find((item) => item.value === value);
return process ? process.label : value;
},
addCheckType() {
this.checkForm = {
AID: "",
物料编号: "",
工序名称编号: "",
检测类别编号: "",
检测项目: "",
理论值: "",
上限值: "",
下限值: "",
测量单位: "",
检验比例: "",
检具: "",
备注: "",
};
this.dialogTitle = "新增检验标准";
this.dialogVisibleAdd = true;
},
submitInspection(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
const param = [];
param.push(["物料编号", this.checkForm.物料编号]);
param.push(["工序名称编号", this.checkForm.工序名称编号]);
param.push(["检测类别编号", this.checkForm.检测类别编号]);
param.push(["检测项目", this.checkForm.检测项目]);
param.push(["理论值", this.checkForm.理论值]);
param.push(["上限值", this.checkForm.上限值]);
param.push(["下限值", this.checkForm.下限值]);
param.push(["测量单位", this.checkForm.测量单位]);
param.push(["检验比例", this.checkForm.检验比例]);
param.push(["检具", this.checkForm.检具]);
param.push(["备注", this.checkForm.备注]);
const data = this.CreateData("12", "质量管理_检验标准表_新增", param);
this.ExecDatabase(data)
.then((response) => {
if (response.data[0].result !== "1") {
this.$message({
message: "检验标准提交失败!" + response.data[0].message,
type: "error",
});
return;
}
this.$message({
message: "检验标准提交成功",
type: "success",
});
this.dialogVisibleAdd = false;
this.searchTable();
})
.catch((error) => {
this.$message({
message: "检验标准提交失败: " + error,
type: "error",
});
});
}
});
},
searchTable() {
this.loading = true;
this.tableData = [];
var param = [];
if (this.物料编号) {
param.push(["物料编号", this.物料编号]);
}
if (this.工序名称编号) {
param.push(["工序名称编号", this.工序名称编号]);
}
if (this.检测类别编号) {
param.push(["检测类别编号", this.检测类别编号]);
}
var Data = this.CreateData("11", "质量管理_检验标准表_查询", param);
this.ExecDatabase(Data)
.then((response) => {
this.loading = false;
if (response.data.length !== 0) {
this.tableData = response.data;
}
})
.catch((error) => {
this.loading = false;
this.$message.error("查询失败");
});
},
editInspectionStandard(row) {
this.checkForm = {
AID: row.AID,
物料编号: row.物料编号,
工序名称编号: row.工序名称编号,
检测类别编号: row.检测类别编号,
检测项编号: row.检测项编号,
检测项目: row.检测项目,
理论值: row.理论值,
上限值: row.上限值,
下限值: row.下限值,
测量单位: row.测量单位,
检验比例: row.检验比例,
检具: row.检具,
备注: row.备注,
};
this.currentEditRow = row;
this.dialogTitle = "修改检验标准";
this.dialogVisibleChange = true;
},
updateInspection(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// 构建更新参数 - 使用与存储过程一致的参数名
const param = [];
param.push(["AID", this.checkForm.AID]);
param.push(["物料编号", this.checkForm.物料编号]);
param.push(["工序名称编号", this.checkForm.工序名称编号]);
param.push(["检测项目", this.checkForm.检测项目]);
param.push(["理论值", this.checkForm.理论值]);
param.push(["上限值", this.checkForm.上限值]);
param.push(["下限值", this.checkForm.下限值]);
param.push(["测量单位", this.checkForm.测量单位]);
param.push(["检验比例", this.checkForm.检验比例]);
param.push(["检具", this.checkForm.检具]);
param.push(["备注", this.checkForm.备注]);
param.push(["检测类别编号", this.checkForm.检测类别编号]);
// 调用更新存储过程
const data = this.CreateData("12", "质量管理_检验标准表_修改", param);
this.ExecDatabase(data)
.then((response) => {
if (response.data[0].result !== "1") {
this.$message({
message:
"检验标准更新失败!" + (response.data[0].message || ""),
type: "error",
});
return;
}
this.$message({
message: "检验标准更新成功",
type: "success",
});
this.dialogVisibleChange = false;
this.searchTable(); // 刷新表格数据
})
.catch((error) => {
this.$message({
message: "检验标准更新失败: " + error,
type: "error",
});
});
}
});
},
deleteInspectionStandard(row) {
this.$confirm("此操作将永久删除该检验标准, 是否继续?", "提示", {
cancelButtonText: "取消",
confirmButtonText: "确定",
type: "warning",
})
.then(() => {
// 构建删除参数
const param = [];
param.push(["AID", row.AID]); // 使用传入row参数中的AID而不是currentEditRow
// 调用删除存储过程
const data = this.CreateData("12", "质量管理_检验标准表_删除", param);
this.ExecDatabase(data)
.then((response) => {
if (response.data[0].result !== "1") {
this.$message({
message:
"检验标准删除失败!" + (response.data[0].message || ""),
type: "error",
});
return;
}
this.$message({
message: "检验标准删除成功",
type: "success",
});
this.searchTable(); // 刷新表格数据
})
.catch((error) => {
this.$message({
message: "检验标准删除失败: " + error,
type: "error",
});
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
},
};
</script>
<style scoped lang="scss">
.search-container {
margin-bottom: 20px;
}
.dialog-footer {
margin-top: 20px;
display: flex;
justify-content: center;
}
</style>

View File

@@ -0,0 +1,577 @@
<template>
<!-- 模板部分保持不变 -->
<div>
<el-card>
<div>
<span class="show-text">订单号:</span>
<el-input v-model="orderNo" placeholder="请输入订单号" clearable style="width: 100px; margin-right: 10px" />
<!-- <span class="show-text">合同号:</span>
<el-input v-model="contractNo" placeholder="请输入合同号" clearable style="width: 130px; margin-right: 10px" /> -->
<span class="show-text">零件编码:</span>
<el-input v-model="productCode" placeholder="请输入零件编码" clearable style="width: 150px; margin-right: 10px" />
<span class="show-text">零件名称:</span>
<el-input v-model="productName" placeholder="请输入零件名称" clearable style="width: 100px; margin-right: 10px" />
<span class="show-text">检测人:</span>
<el-select
v-model="checker"
placeholder="请选择检测人"
clearable
style="width: 150px; margin-right: 10px"
filterable
>
<el-option
v-for="item in checkerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span class="show-text">质检类型:</span>
<el-select
v-model="QualityStatus"
clearable
placeholder="请选择质检类型"
style="width: 150px; margin-right: 10px"
>
<el-option label="全部" value="10" />
<el-option label="收检" value="0" />
<el-option label="终检" value="1" />
<el-option label="来料检验" value="2" />
<el-option label="退库检验" value="3" />
</el-select>
<span class="show-text">质检日期起:</span>
<el-date-picker
v-model="startDate"
type="date"
placeholder="选择开始日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 150px; margin-right: 10px" />
<span class="show-text">质检日期止:</span>
<el-date-picker
v-model="endDate"
type="date"
placeholder="选择结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
style="width: 150px; margin-right: 10px" />
<el-button :disabled="!!loading" icon="el-icon-search" plain type="primary" @click="searchTable()">查询</el-button>
<!-- <el-button style="width: 100px;" icon="el-icon-download" type="primary" @click="exportExcel">Excel导出</el-button> -->
</div>
<el-tabs v-model="activeTab" type="card" class="custom-tabs">
<el-table
v-loading="loading"
:data="tableData"
:height="'67vh'"
border
element-loading-background="rgba(0, 0, 0, 0.2)"
element-loading-spinner="el-icon-loading"
highlight-current-row
size="mini"
style="width: 100%;margin-top: 20px;"
tooltip-effect="dark"
:row-class-name="tableRowClassName"
@row-click="handleRowClick">
<el-table-column align="center" label="序号" type="index" width="50" fixed />
<el-table-column align="center" prop="质检类型" label="质检类型" width="80" fixed />
<el-table-column align="center" prop="零件编码" label="零件编码" width="220" fixed />
<el-table-column align="center" prop="零件名称" label="零件名称" width="190" />
<el-table-column align="center" prop="内部合同号" label="内部合同号" width="100" />
<el-table-column align="center" prop="计划号" label="计划号" width="80" />
<el-table-column align="center" prop="工序名称" label="工序名称" width="100" />
<el-table-column align="center" prop="工位名称" label="工位名称" width="100" />
<el-table-column align="center" prop="供应商代码" label="供应商代码" width="120" />
<el-table-column align="center" prop="检验数量" label="检验数量" width="120" />
<el-table-column align="center" prop="合格数" label="合格数" width="120" />
<el-table-column align="center" prop="不合格数" label="不合格数" width="120" />
<el-table-column align="center" prop="检测人" label="检测人" width="100" />
<el-table-column align="center" label="检测时间" width="160">
<template slot-scope="scope">
{{ formatDateTime(scope.row.检测时间) }}
</template>
</el-table-column>
<el-table-column align="center" prop="检测说明" label="检测说明" width="160"/>
<el-table-column label="操作" align="center" width="100px" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
style="margin-right: 5px; padding:0; width:auto"
@click="print(scope.row)">打印
</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[20, 50, 100]"
:page-size="pageSize"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges" />
</div>
</el-tabs>
</el-card>
<div class="print-page2" style=" display: none; width: 20cm;height: 11.5cm;background-color: #fff; page-break-after: always;" >
<div style="margin-bottom: 20px;">
<div style="display: flex;">
<div style="width: 30%;
height: 40px;
background: url(/static/img/logo.6454a812.png);
background-size: contain;
background-repeat: no-repeat;
"></div>
<div style="width: 40%;text-align: center;font-size: 25px;line-height: 40px;">不合格品处置单</div>
</div>
</div>
<div class="field-container">
<!-- 第一行订单号合同号发生日期 -->
<div class="field-row">
<div class="field-group" style="width: 33%;">
<span class="field-label">订单号</span>
<span class="field-value">{{ printData2.计划号 }}</span>
</div>
<div class="field-group">
<span class="field-label" style="width: 33%;" >合同号</span>
<span class="field-value">{{ printData2.内部合同号 }}</span>
</div>
<div class="field-group">
<span class="field-label" >检测时间</span>
<span class="field-value">{{ printData2.检测时间 }}</span>
</div>
</div>
<!-- 第三行物料编码零件名称 -->
<div class="field-row">
<div class="field-group" style="width: 60%;">
<span class="field-label">物料编码</span>
<span class="field-value">{{ printData2.零件编码 }}</span>
</div>
<div class="field-group">
<span class="field-label">物料名称</span>
<span class="field-value">{{ printData2.零件名称 }}</span>
</div>
</div>
<div class="field-row">
<div class="field-group" style="width: 33%;">
<span class="field-label">供应商编码</span>
<span class="field-value"></span>
</div>
<div class="field-group" style="width: 33%;">
<span class="field-label">批次号</span>
<span class="field-value"></span>
</div>
<div class="field-group" >
<span class="field-label">采购员</span>
<span class="field-value"></span>
</div>
</div>
<!-- 第二行发生场所发现人员供应商编码批次号 -->
<div class="field-row">
<div class="field-group" style="width: 33%;">
<span class="field-label">发生日期</span>
<span class="field-value"></span>
</div>
<div class="field-group" style="width: 33%;">
<span class="field-label">发生场所</span>
<span class="field-value"></span>
</div>
<div class="field-group">
<span class="field-label">发现人员</span>
<span class="field-value"></span>
</div>
</div>
<!-- 第四行加工数量不良数量质检员 -->
<div class="field-row">
<div class="field-group" style="width: 33%;">
<span class="field-label">加工数量</span>
<span class="field-value">{{ printData2.检验数量 }}</span>
</div>
<div class="field-group" style="width: 33%;">
<span class="field-label">不良数量</span>
<span class="field-value">{{ printData2.不合格数 }}</span>
</div>
<div class="field-group">
<span class="field-label">质检员</span>
<span class="field-value">{{ printData2.检测人}}</span>
</div>
</div>
<!-- 第五行不良内容描述 (占两行) -->
<div class="field-row" style="height: 40px;">
<div class="field-group" style="width: 100%; height: 100%;">
<span class="field-label" style="width: 20%; height: 100%; line-height: 60px;">不良内容描述</span>
<span class="field-value" style="width: 80%; height: 100%;">{{ printData2.检测说明 }}</span>
</div>
</div>
<!-- 第六行质量部处理措施 (占两行) -->
<div class="field-row" style="height: 40px;">
<div class="field-group" style="width: 100%; height: 100%;">
<span class="field-label" style="width: 20%; height: 100%; line-height: 60px;">质量部处理措施</span>
<span class="field-value" style="width: 80%; height: 100%; display: flex; align-items: center; gap: 20px;">
<span>让步放行</span>
<span>返工返修</span>
<span>报废</span>
<span>其他</span>
</span>
</div>
</div>
<!-- 第七行采购处理措施 (占两行) -->
<div class="field-row" style="height: 40px;">
<div class="field-group" style="width: 100%; height: 100%;">
<span class="field-label" style="width: 20%; height: 100%; line-height: 60px;">采购处理措施</span>
<span class="field-value" style="width: 80%; height: 100%; display: flex; align-items: center; gap: 20px;">
<span>费用扣除</span>
<span>返工返修</span>
<span>退换货</span>
<span>其他</span>
</span>
</div>
</div>
<!-- 第八行采购员备注 -->
<div class="field-row">
<div class="field-group">
<span class="field-label">备注</span>
<span class="field-value"></span>
</div>
</div>
<!-- 第九行配发部门 -->
<div class="field-row">
<div class="field-group" style="width: 100%;">
<span class="field-label" style="width: 10%;">配发部门</span>
<span class="field-value" style="width: 90%; display: flex; gap: 20px; flex-wrap: wrap;">
<span>生产部</span>
<span>采购部</span>
<span>工艺部</span>
<span>技术部</span>
<span>机加车间</span>
<span>库房</span>
<span>质量部</span>
<span>其他</span>
</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import $ from 'jquery'
export default {
data() {
return {
// 分页
pageCurrent: 1,
pageSize: 20,
total1: 0,
// 搜索条件
QualityStatus:'10',
startDate:null,
endDate:null,
orderNo:'',
contractNo:'',
productCode:'',
productName:'',
// 表格数据
loading: false,
activeTab: 'first',
tableData: [],
// 新增相关数据
orderList: [],
exporting: false,
// processList: [],
// personnelList: [],
printData2:[],
checkerList: [],
checker: "",
checkerLabel: "",
}
},
mounted() {
this.searchTable()
this.getCheckerList();
},
methods: {
getCheckerList() {
this.checkerList = [];
var Data = this.CreateData("11", "人员管理_人员信息查询_质检部门_查询");
this.ExecDatabase(Data).then((response) => {
for (let i = 0; i < response.data.length; i++) {
this.checkerList.push({
label: response.data[i].Personnel_Name,
value: response.data[i].Personnel_Number,
});
}
});
},
// ============ 表格相关方法 ============
tableRowClassName({ row, rowIndex }) {
if (!row.结束时间 || row.结束时间 === '') {
return 'row-without-endtime'
}
return ''
},
handleRowClick(row) {
this.currentTask = row
},
handleSelectionChange(val) {
this.multipleSelection = val
},
// ============ 分页方法 ============
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.searchTable()
},
searchTable() {
this.loading = true
var param = []
param.push(["质检类型", this.QualityStatus]);
param.push(["开始日期", this.startDate]);
param.push(["结束日期", this.endDate]);
param.push(["订单号", this.orderNo ]);
param.push(["合同号", this.contractNo ]);
param.push(["零件编码", this.productCode ]);
param.push(["零件名称", this.productName ]);
const selectedChecker = this.checkerList.find(
(item) => item.value === this.checker
);
param.push(['检测人', selectedChecker ? selectedChecker.label : 0])
param.push(['PageCurrent', this.pageCurrent])
param.push(['pageSize', this.pageSize])
param.push(['PageCount', '1111', 'int', '1'])
param.push(['ItemCount', '1111', 'int', '1'])
console.log(selectedChecker)
var Data = this.CreateData('11', '质量管理_不合格品处置_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.result || []
this.total1 = parseInt(response.data.output[0].ItemCount)
this.loading = false
}).catch(error => {
this.$message.error('查询失败:' + error.message)
this.loading = false
})
},
//打印
print(row){
this.printData2 = row
console.log(this.printData2)
this.numname = this.$store.state.user.name
try {
this.$nextTick(() => {
setTimeout(() => {
this.executePrint2()
}, 500)
})
} catch (error) {
console.error('获取打印数据失败:', error)
this.$message.error('获取打印数据失败')
} finally {
this.loading = false
}
},
executePrint2() {
return new Promise((resolve, reject) => {
this.historyVisible = false
try {
const originalStyles = {}
$('.print-page2').each(function(index) {
originalStyles[index] = $(this).attr('style')
})
const body = $('body')
// 隐藏原始内容
body.children().hide()
// 创建打印容器
const printContainer = $('<div class="print-container"></div>')
// 复制所有打印页面到打印容器
$('.print-page2').each(function() {
const pageClone = $(this).clone()
pageClone.css({
display: 'block',
width: '20cm',
height: '11.5cm',
'background-color': '#fff',
'page-break-after': 'always',
margin: '0',
padding: '0'
})
printContainer.append(pageClone)
})
// 添加到body
body.append(printContainer)
// 打印后恢复
const restorePage = () => {
try {
printContainer.remove()
body.children().show()
// 恢复原始样式
$('.print-page2').each(function(index) {
if (originalStyles[index]) {
$(this).attr('style', originalStyles[index])
} else {
$(this).css('display', 'none')
}
})
if (window.matchMedia) {
window.matchMedia('print').removeListener(handlePrintChange)
}
resolve()
} catch (error) {
reject(error)
}
}
const handlePrintChange = (mql) => {
if (!mql.matches) {
restorePage()
}
}
// 添加打印状态监听
if (window.matchMedia) {
window.matchMedia('print').addListener(handlePrintChange)
}
// 设置超时恢复(备用)
setTimeout(restorePage, 5000)
// 触发打印
setTimeout(() => {
window.print()
}, 1000);
} catch (error) {
reject(error)
}
})
},
// ============ 工具方法 ============
getCurrentUser() {
return this.$store.state.user.name
},
formatDate(date) {
if (!date) return ''
return date.split(' ').length > 1 ? date.split(' ')[0] : date
},
formatDateTime(dateTime) {
if (!dateTime) return ''
const date = new Date(dateTime)
return date.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false
}).replace(/\//g, '-')
},
}
}
</script>
<style scoped>
.search-container {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10px;
}
.show-text {
white-space: nowrap;
}
.custom-tabs {
margin-top: 10px;
}
.dialog-footer {
text-align: center;
}
.field-container {
border: 1px solid #000;
border-bottom:0px
}
.field-row {
display: flex;
width: 100%;
border-bottom: 1px solid #000;
}
.field-group {
display: flex;
width: 25%;
align-items: stretch;
border-right: 1px solid #000;
}
.field-group:last-child {
border-right: none;
}
.field-label {
width: 40%;
color: #000;
text-align: right;
padding: 8px 5px;
border-right: 1px solid #000;
display: flex;
align-items: center;
justify-content: flex-end;
}
.field-value {
width: 60%;
color: #303133;
word-break: break-word;
overflow-wrap: break-word;
padding: 12px 10px;
display: flex;
align-items: center;
}
/* ::v-deep .row-without-endtime {
background-color: #f56c6c !important;
color: #000000 !important;
} */
</style>