feat(mes/eqp/check): 替换字典选型为动态产线下拉选单
1. 统一替换页面中原有的dict-select为通过接口获取的动态产线列表 2. 新增产线默认选中酸轧线的逻辑 3. 修复产线参数传递不匹配的问题,同步前后端参数字段
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
@change="handleQuery" style="width: 260px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产线">
|
||||
<dict-select v-model="productionLine" dict-type="sys_lines" placeholder="请选择产线"
|
||||
clearable @change="handleQuery" style="width: 150px;" />
|
||||
<el-select v-model="productionLine" placeholder="请选择产线" 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-button type="primary" @click="handleQuery">查询</el-button>
|
||||
@@ -105,15 +106,16 @@
|
||||
<script>
|
||||
import { listEquipmentPart } from "@/api/mes/eqp/equipmentPart";
|
||||
import { listEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord";
|
||||
import { listProductionLine } from "@/api/wms/productionLine";
|
||||
|
||||
export default {
|
||||
name: "DailyInspectionReport",
|
||||
dicts: ['sys_lines'],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
dateRange: [this.getToday(), this.getToday()],
|
||||
productionLine: '酸轧线',
|
||||
productionLine: 2,
|
||||
lineList: [],
|
||||
partList: [],
|
||||
records: [],
|
||||
};
|
||||
@@ -125,6 +127,10 @@ export default {
|
||||
partName: cl.partName || p.inspectPart,
|
||||
})));
|
||||
},
|
||||
selectedLineName() {
|
||||
const found = this.lineList.find(l => l.lineId === this.productionLine);
|
||||
return found ? found.lineName : '';
|
||||
},
|
||||
tableData() {
|
||||
const recordMap = {};
|
||||
this.records.forEach(r => {
|
||||
@@ -227,13 +233,14 @@ export default {
|
||||
this.loading = true;
|
||||
try {
|
||||
const partParams = {};
|
||||
if (this.productionLine) partParams.productionLine = this.productionLine;
|
||||
const productionLine = this.productionLine;
|
||||
if (productionLine) partParams.productionLine = productionLine;
|
||||
const recordParams = {
|
||||
startInspectTime: this.dateRange[0] + ' 00:00:00',
|
||||
endInspectTime: this.dateRange[1] + ' 23:59:59',
|
||||
pageSize: 9999,
|
||||
};
|
||||
if (this.productionLine) recordParams.productionLine = this.productionLine;
|
||||
if (productionLine) recordParams.productionLine = productionLine;
|
||||
const [partRes, recordRes] = await Promise.all([
|
||||
listEquipmentPart(partParams),
|
||||
listEquipmentInspectionRecord(recordParams),
|
||||
@@ -246,9 +253,20 @@ export default {
|
||||
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() {
|
||||
this.handleQuery();
|
||||
this.loadLineList();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<dict-select v-model="sharedQueryParams.productionLine" dict-type="sys_lines" placeholder="请选择产线" renderType="radio"
|
||||
clearable kisv @change="handleQuery" />
|
||||
<el-radio-group v-model="sharedQueryParams.productionLine" @change="handleQuery" size="small" style="margin-bottom: 10px;">
|
||||
<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"
|
||||
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-form ref="partForm" :model="partForm" :rules="partRules" label-width="80px">
|
||||
<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 label="产线段" prop="lineSection">
|
||||
<el-input v-model="partForm.lineSection" placeholder="请输入产线段" />
|
||||
@@ -206,20 +209,21 @@ import html2canvas from 'html2canvas';
|
||||
import { PDFDocument } from 'pdf-lib';
|
||||
import { listEquipmentPart, getEquipmentPart, delEquipmentPart, addEquipmentPart, updateEquipmentPart } from "@/api/mes/eqp/equipmentPart";
|
||||
import { listEquipmentChecklist, getEquipmentChecklist, delEquipmentChecklist, addEquipmentChecklist, updateEquipmentChecklist } from "@/api/mes/eqp/equipmentChecklist";
|
||||
import { listProductionLine } from '@/api/wms/productionLine'
|
||||
|
||||
export default {
|
||||
name: "EquipmentPartChecklist",
|
||||
components: { DragResizePanel, QRCode },
|
||||
dicts: ['sys_lines'],
|
||||
data() {
|
||||
return {
|
||||
showSearch: true,
|
||||
|
||||
// Shared query params (productionLine & lineSection)
|
||||
sharedQueryParams: {
|
||||
productionLine: '酸轧线',
|
||||
lineId: null,
|
||||
lineSection: undefined
|
||||
},
|
||||
lineList: [],
|
||||
|
||||
// Part (left side)
|
||||
partLoading: false,
|
||||
@@ -285,13 +289,28 @@ export default {
|
||||
computed: {
|
||||
currentPartId() {
|
||||
return this.currentPart?.partId || "";
|
||||
},
|
||||
selectedLineName() {
|
||||
const found = this.lineList.find(l => l.lineId === this.sharedQueryParams.lineId);
|
||||
return found ? found.lineName : '';
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getPartList();
|
||||
this.getChecklistList();
|
||||
this.loadLineList();
|
||||
},
|
||||
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 ==========
|
||||
applySharedParams() {
|
||||
this.partQueryParams.productionLine = this.sharedQueryParams.productionLine;
|
||||
@@ -357,6 +376,7 @@ export default {
|
||||
partId: undefined,
|
||||
inspectPart: undefined,
|
||||
remark: undefined,
|
||||
lineId: undefined,
|
||||
productionLine: undefined,
|
||||
lineSection: undefined
|
||||
};
|
||||
@@ -368,8 +388,8 @@ export default {
|
||||
},
|
||||
handlePartAdd() {
|
||||
this.resetPartForm();
|
||||
if (this.sharedQueryParams.productionLine) {
|
||||
this.partForm.productionLine = this.sharedQueryParams.productionLine;
|
||||
if (this.sharedQueryParams.lineId) {
|
||||
this.partForm.lineId = this.sharedQueryParams.lineId;
|
||||
}
|
||||
if (this.sharedQueryParams.lineSection) {
|
||||
this.partForm.lineSection = this.sharedQueryParams.lineSection;
|
||||
@@ -384,6 +404,10 @@ export default {
|
||||
getEquipmentPart(partId).then(response => {
|
||||
this.partLoading = false;
|
||||
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.partTitle = "修改检验部位";
|
||||
});
|
||||
@@ -392,6 +416,10 @@ export default {
|
||||
this.$refs["partForm"].validate(valid => {
|
||||
if (valid) {
|
||||
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) {
|
||||
updateEquipmentPart(this.partForm).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<!-- <el-form-item label="检验清单ID" prop="checkId">
|
||||
<el-input
|
||||
v-model="queryParams.checkId"
|
||||
placeholder="请输入检验清单ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产线">
|
||||
<el-select v-model="queryParams.productionLine" placeholder="请选择产线" 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 label="班次" prop="shift">
|
||||
<el-select v-model="queryParams.shift" placeholder="请选择班次" clearable
|
||||
@change="handleQuery" style="width: 150px;">
|
||||
@@ -158,7 +155,7 @@
|
||||
<el-form-item label="检验清单" prop="checkId">
|
||||
<checklist-select v-model="form.checkId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班次" prop="shift">
|
||||
<el-form-item label="班次" prop="shift">
|
||||
<el-select v-model="form.shift" placeholder="请选择班次">
|
||||
<el-option label="白班" :value="1" />
|
||||
<el-option label="夜班" :value="0" />
|
||||
@@ -198,6 +195,7 @@
|
||||
|
||||
<script>
|
||||
import { listEquipmentInspectionRecord, getEquipmentInspectionRecord, delEquipmentInspectionRecord, addEquipmentInspectionRecord, updateEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord";
|
||||
import { listProductionLine } from "@/api/wms/productionLine";
|
||||
import ChecklistSelect from "@/components/ChecklistSelect";
|
||||
|
||||
export default {
|
||||
@@ -227,6 +225,7 @@ export default {
|
||||
open: false,
|
||||
// 时间段筛选
|
||||
dateRange: undefined,
|
||||
lineList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -238,6 +237,7 @@ export default {
|
||||
runStatus: undefined,
|
||||
inspector: undefined,
|
||||
abnormalDesc: undefined,
|
||||
productionLine: 2,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@@ -247,9 +247,16 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.loadLineList();
|
||||
},
|
||||
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() {
|
||||
this.loading = true;
|
||||
|
||||
Reference in New Issue
Block a user