feat(mes/eqp/check): 替换字典选型为动态产线下拉选单

1. 统一替换页面中原有的dict-select为通过接口获取的动态产线列表
2. 新增产线默认选中酸轧线的逻辑
3. 修复产线参数传递不匹配的问题,同步前后端参数字段
This commit is contained in:
2026-05-29 11:41:48 +08:00
parent 82a54e3200
commit 125e07eed4
3 changed files with 79 additions and 26 deletions

View File

@@ -8,8 +8,9 @@
@change="handleQuery" style="width: 260px;" /> @change="handleQuery" style="width: 260px;" />
</el-form-item> </el-form-item>
<el-form-item label="产线"> <el-form-item label="产线">
<dict-select v-model="productionLine" dict-type="sys_lines" placeholder="请选择产线" <el-select v-model="productionLine" placeholder="请选择产线" clearable @change="handleQuery" style="width: 150px;">
clearable @change="handleQuery" style="width: 150px;" /> <el-option v-for="item in lineList" :key="item.lineId" :label="item.lineName" :value="item.lineId" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button> <el-button type="primary" @click="handleQuery">查询</el-button>
@@ -105,15 +106,16 @@
<script> <script>
import { listEquipmentPart } from "@/api/mes/eqp/equipmentPart"; import { listEquipmentPart } from "@/api/mes/eqp/equipmentPart";
import { listEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord"; import { listEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord";
import { listProductionLine } from "@/api/wms/productionLine";
export default { export default {
name: "DailyInspectionReport", name: "DailyInspectionReport",
dicts: ['sys_lines'],
data() { data() {
return { return {
loading: false, loading: false,
dateRange: [this.getToday(), this.getToday()], dateRange: [this.getToday(), this.getToday()],
productionLine: '酸轧线', productionLine: 2,
lineList: [],
partList: [], partList: [],
records: [], records: [],
}; };
@@ -125,6 +127,10 @@ export default {
partName: cl.partName || p.inspectPart, partName: cl.partName || p.inspectPart,
}))); })));
}, },
selectedLineName() {
const found = this.lineList.find(l => l.lineId === this.productionLine);
return found ? found.lineName : '';
},
tableData() { tableData() {
const recordMap = {}; const recordMap = {};
this.records.forEach(r => { this.records.forEach(r => {
@@ -227,13 +233,14 @@ export default {
this.loading = true; this.loading = true;
try { try {
const partParams = {}; const partParams = {};
if (this.productionLine) partParams.productionLine = this.productionLine; const productionLine = this.productionLine;
if (productionLine) partParams.productionLine = productionLine;
const recordParams = { const recordParams = {
startInspectTime: this.dateRange[0] + ' 00:00:00', startInspectTime: this.dateRange[0] + ' 00:00:00',
endInspectTime: this.dateRange[1] + ' 23:59:59', endInspectTime: this.dateRange[1] + ' 23:59:59',
pageSize: 9999, pageSize: 9999,
}; };
if (this.productionLine) recordParams.productionLine = this.productionLine; if (productionLine) recordParams.productionLine = productionLine;
const [partRes, recordRes] = await Promise.all([ const [partRes, recordRes] = await Promise.all([
listEquipmentPart(partParams), listEquipmentPart(partParams),
listEquipmentInspectionRecord(recordParams), listEquipmentInspectionRecord(recordParams),
@@ -246,9 +253,20 @@ export default {
this.loading = false; this.loading = false;
} }
}, },
async loadLineList() {
try {
const res = await listProductionLine({ pageSize: 999 });
if (res.rows) this.lineList = res.rows;
if (this.lineList.length > 0) {
const suanYa = this.lineList.find(l => l.lineName === '酸轧线');
this.productionLine = suanYa ? suanYa.lineId : this.lineList[0].lineId;
}
this.handleQuery();
} catch (e) { console.error('加载产线列表失败', e); }
},
}, },
mounted() { mounted() {
this.handleQuery(); this.loadLineList();
}, },
}; };
</script> </script>

View File

@@ -1,7 +1,8 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<dict-select v-model="sharedQueryParams.productionLine" dict-type="sys_lines" placeholder="请选择产线" renderType="radio" <el-radio-group v-model="sharedQueryParams.productionLine" @change="handleQuery" size="small" style="margin-bottom: 10px;">
clearable kisv @change="handleQuery" /> <el-radio-button v-for="item in lineList" :key="item.lineId" :label="item.lineId">{{ item.lineName }}</el-radio-button>
</el-radio-group>
<DragResizePanel direction="horizontal" :initialSize="500" :minSize="350" <DragResizePanel direction="horizontal" :initialSize="500" :minSize="350"
style="height: calc(100vh - 164px); margin-top: 10px;"> style="height: calc(100vh - 164px); margin-top: 10px;">
@@ -132,7 +133,9 @@
<el-dialog :title="partTitle" :visible.sync="partOpen" width="500px" append-to-body> <el-dialog :title="partTitle" :visible.sync="partOpen" width="500px" append-to-body>
<el-form ref="partForm" :model="partForm" :rules="partRules" label-width="80px"> <el-form ref="partForm" :model="partForm" :rules="partRules" label-width="80px">
<el-form-item label="产线" prop="productionLine"> <el-form-item label="产线" prop="productionLine">
<dict-select v-model="partForm.productionLine" dict-type="sys_lines" kisv placeholder="请选择产线" /> <el-select v-model="partForm.lineId" placeholder="请选择产线" style="width: 100%;">
<el-option v-for="item in lineList" :key="item.lineId" :label="item.lineName" :value="item.lineId" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="产线段" prop="lineSection"> <el-form-item label="产线段" prop="lineSection">
<el-input v-model="partForm.lineSection" placeholder="请输入产线段" /> <el-input v-model="partForm.lineSection" placeholder="请输入产线段" />
@@ -206,20 +209,21 @@ import html2canvas from 'html2canvas';
import { PDFDocument } from 'pdf-lib'; import { PDFDocument } from 'pdf-lib';
import { listEquipmentPart, getEquipmentPart, delEquipmentPart, addEquipmentPart, updateEquipmentPart } from "@/api/mes/eqp/equipmentPart"; import { listEquipmentPart, getEquipmentPart, delEquipmentPart, addEquipmentPart, updateEquipmentPart } from "@/api/mes/eqp/equipmentPart";
import { listEquipmentChecklist, getEquipmentChecklist, delEquipmentChecklist, addEquipmentChecklist, updateEquipmentChecklist } from "@/api/mes/eqp/equipmentChecklist"; import { listEquipmentChecklist, getEquipmentChecklist, delEquipmentChecklist, addEquipmentChecklist, updateEquipmentChecklist } from "@/api/mes/eqp/equipmentChecklist";
import { listProductionLine } from '@/api/wms/productionLine'
export default { export default {
name: "EquipmentPartChecklist", name: "EquipmentPartChecklist",
components: { DragResizePanel, QRCode }, components: { DragResizePanel, QRCode },
dicts: ['sys_lines'],
data() { data() {
return { return {
showSearch: true, showSearch: true,
// Shared query params (productionLine & lineSection) // Shared query params (productionLine & lineSection)
sharedQueryParams: { sharedQueryParams: {
productionLine: '酸轧线', lineId: null,
lineSection: undefined lineSection: undefined
}, },
lineList: [],
// Part (left side) // Part (left side)
partLoading: false, partLoading: false,
@@ -285,13 +289,28 @@ export default {
computed: { computed: {
currentPartId() { currentPartId() {
return this.currentPart?.partId || ""; return this.currentPart?.partId || "";
},
selectedLineName() {
const found = this.lineList.find(l => l.lineId === this.sharedQueryParams.lineId);
return found ? found.lineName : '';
} }
}, },
created() { created() {
this.getPartList(); this.loadLineList();
this.getChecklistList();
}, },
methods: { methods: {
async loadLineList() {
try {
const res = await listProductionLine({ pageSize: 999 });
if (res.rows) this.lineList = res.rows;
if (this.lineList.length > 0) {
const suanYa = this.lineList.find(l => l.lineName === '酸轧线');
this.sharedQueryParams.productionLine = suanYa ? suanYa.lineId : this.lineList[0].lineId;
}
this.getPartList();
this.getChecklistList();
} catch (e) { console.error('加载产线列表失败', e); }
},
// ========== Shared ========== // ========== Shared ==========
applySharedParams() { applySharedParams() {
this.partQueryParams.productionLine = this.sharedQueryParams.productionLine; this.partQueryParams.productionLine = this.sharedQueryParams.productionLine;
@@ -357,6 +376,7 @@ export default {
partId: undefined, partId: undefined,
inspectPart: undefined, inspectPart: undefined,
remark: undefined, remark: undefined,
lineId: undefined,
productionLine: undefined, productionLine: undefined,
lineSection: undefined lineSection: undefined
}; };
@@ -368,8 +388,8 @@ export default {
}, },
handlePartAdd() { handlePartAdd() {
this.resetPartForm(); this.resetPartForm();
if (this.sharedQueryParams.productionLine) { if (this.sharedQueryParams.lineId) {
this.partForm.productionLine = this.sharedQueryParams.productionLine; this.partForm.lineId = this.sharedQueryParams.lineId;
} }
if (this.sharedQueryParams.lineSection) { if (this.sharedQueryParams.lineSection) {
this.partForm.lineSection = this.sharedQueryParams.lineSection; this.partForm.lineSection = this.sharedQueryParams.lineSection;
@@ -384,6 +404,10 @@ export default {
getEquipmentPart(partId).then(response => { getEquipmentPart(partId).then(response => {
this.partLoading = false; this.partLoading = false;
this.partForm = response.data; this.partForm = response.data;
if (this.partForm.productionLine && this.lineList.length) {
const line = this.lineList.find(l => l.lineName === this.partForm.productionLine);
if (line) this.$set(this.partForm, 'lineId', line.lineId);
}
this.partOpen = true; this.partOpen = true;
this.partTitle = "修改检验部位"; this.partTitle = "修改检验部位";
}); });
@@ -392,6 +416,10 @@ export default {
this.$refs["partForm"].validate(valid => { this.$refs["partForm"].validate(valid => {
if (valid) { if (valid) {
this.partButtonLoading = true; this.partButtonLoading = true;
if (this.partForm.lineId) {
const line = this.lineList.find(l => l.lineId === this.partForm.lineId);
if (line) this.partForm.productionLine = line.lineName;
}
if (this.partForm.partId != null) { if (this.partForm.partId != null) {
updateEquipmentPart(this.partForm).then(response => { updateEquipmentPart(this.partForm).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");

View File

@@ -1,14 +1,11 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="检验清单ID" prop="checkId"> <el-form-item label="产线">
<el-input <el-select v-model="queryParams.productionLine" placeholder="请选择产线" clearable @change="handleQuery" style="width: 150px;">
v-model="queryParams.checkId" <el-option v-for="item in lineList" :key="item.lineId" :label="item.lineName" :value="item.lineId" />
placeholder="请输入检验清单ID" </el-select>
clearable </el-form-item>
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<el-form-item label="班次" prop="shift"> <el-form-item label="班次" prop="shift">
<el-select v-model="queryParams.shift" placeholder="请选择班次" clearable <el-select v-model="queryParams.shift" placeholder="请选择班次" clearable
@change="handleQuery" style="width: 150px;"> @change="handleQuery" style="width: 150px;">
@@ -198,6 +195,7 @@
<script> <script>
import { listEquipmentInspectionRecord, getEquipmentInspectionRecord, delEquipmentInspectionRecord, addEquipmentInspectionRecord, updateEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord"; import { listEquipmentInspectionRecord, getEquipmentInspectionRecord, delEquipmentInspectionRecord, addEquipmentInspectionRecord, updateEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord";
import { listProductionLine } from "@/api/wms/productionLine";
import ChecklistSelect from "@/components/ChecklistSelect"; import ChecklistSelect from "@/components/ChecklistSelect";
export default { export default {
@@ -227,6 +225,7 @@ export default {
open: false, open: false,
// 时间段筛选 // 时间段筛选
dateRange: undefined, dateRange: undefined,
lineList: [],
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@@ -238,6 +237,7 @@ export default {
runStatus: undefined, runStatus: undefined,
inspector: undefined, inspector: undefined,
abnormalDesc: undefined, abnormalDesc: undefined,
productionLine: 2,
}, },
// 表单参数 // 表单参数
form: {}, form: {},
@@ -247,9 +247,16 @@ export default {
}; };
}, },
created() { created() {
this.getList(); this.loadLineList();
}, },
methods: { methods: {
async loadLineList() {
try {
const res = await listProductionLine({ pageSize: 999 });
if (res.rows) this.lineList = res.rows;
this.getList();
} catch (e) { console.error('加载产线列表失败', e); }
},
/** 查询设备巡检记录列表 */ /** 查询设备巡检记录列表 */
getList() { getList() {
this.loading = true; this.loading = true;