From 599abd4e7302982950fdc8912ab823a7d2028cd4 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Thu, 19 Mar 2026 11:28:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=B1=A0=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/production/andonRule/index.vue | 37 +++++++++++++++++++----- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/views/production/andonRule/index.vue b/src/views/production/andonRule/index.vue index 5f2b297..1b60534 100644 --- a/src/views/production/andonRule/index.vue +++ b/src/views/production/andonRule/index.vue @@ -86,7 +86,11 @@ - + + + @@ -155,9 +159,9 @@ @@ -210,7 +214,6 @@ import { listAndonRule, getAndonRule, delAndonRule, addAndonRule, updateAndonRule } from "@/api/production/andonRule"; import { selectUserList } from "@/api/system/user"; import { findProductLineList } from "@/api/base/productLine"; -import { listProcessStation } from "@/api/base/processStation"; import { getTeamMemberList } from "@/api/base/teamMembers"; import { getDeviceLedgerList } from "@/api/base/deviceLedger"; @@ -241,7 +244,7 @@ export default { defaultUserId: null, // 产线下拉选项 productLineList: [], - // 工位/工序下拉选项 + // 工位下拉选项 processStationList: [], // 班组下拉选项 teamMembersList: [], @@ -443,8 +446,25 @@ export default { const nameMap = new Map(this.userOptions.map(u => [String(u.userId), (u.nickName || u.userName || String(u.userId))])); return ids.map(id => nameMap.get(String(id)) || id).join(', '); }, + // 安灯规则按工位编码落库,这里统一将编码映射为“工位名称(编码)”,避免列表和下拉展示口径不一致。 + formatStationLabel(stationCode) { + if (!stationCode) return ''; + const station = this.processStationList.find(item => String(item.productLineCode) === String(stationCode)); + if (!station) return stationCode; + return this.formatStationOptionLabel(station); + }, + // 这里复用工位主数据页面的字段定义,工位实际走 productLine 接口,编码/名称字段分别是 productLineCode/productLineName。 + formatStationOptionLabel(station) { + if (!station) return ''; + const stationName = station.productLineName || station.stationName || ''; + const stationCode = station.productLineCode || station.stationCode || ''; + if (stationName && stationCode) { + return `${stationName} (${stationCode})`; + } + return stationName || stationCode; + }, /** 删除按钮操作 */ - handleDelete(row) {listProcessStation + handleDelete(row) { const ruleIds = row.ruleId || this.ids; this.$modal.confirm('是否确认删除安灯规则配置编号为"' + ruleIds + '"的数据项?').then(function() { return delAndonRule(ruleIds); @@ -467,8 +487,9 @@ export default { this.productLineList = []; }); }, - /** 加载工位/工序下拉选项 */ + /** 加载工位下拉选项 */ loadProcessStations() { + // 业务上安灯规则绑定的是“工位”,而项目中的工位主数据挂在 productLine 体系下,productLineType=2 代表工位。 findProductLineList({ productLineType: 2 }).then(res => { this.processStationList = res.data || res.rows || []; }).catch(() => {