From 205768fbc34a92251a0e37e7c100de4866304bd8 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 23 Jul 2026 15:50:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=E5=B7=A5=E8=89=BA=E8=B7=AF=E7=BA=BF?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=AE=8B=E7=95=99=E9=97=AE=E9=A2=98=E6=A0=B9?= =?UTF-8?q?=E6=B2=BB:xtSelect=E5=A4=96=E9=83=A8=E6=B8=85=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E6=97=B6=E5=90=8C=E6=AD=A5=E6=B8=85=E7=A9=BA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=96=87=E5=AD=97(=E6=AE=8B=E7=95=99=E4=B8=BB=E5=9B=A0);?= =?UTF-8?q?=E7=94=BB=E5=B8=83/=E5=8F=B3=E4=BE=A7=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E5=8A=A0key=E6=AF=8F=E6=AC=A1=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=BC=BA=E5=88=B6=E9=87=8D=E5=BB=BA=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?;route=5Fform=E7=BC=96=E8=BE=91=E6=97=B6sort=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=A2=ABcount+1=E8=A6=86=E7=9B=96;=E6=97=A0routeId=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=85=A8=E9=87=8F=E6=8B=89=E8=BE=85=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- src/components/xtFlowEditor.vue | 5 ++++- src/components/xtSelect/index.vue | 15 ++++++++++++--- src/views/mtm/route_form.vue | 8 +++++++- src/views/mtm/routepack_form.vue | 5 ++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/components/xtFlowEditor.vue b/src/components/xtFlowEditor.vue index 4c871628..115ffe28 100644 --- a/src/components/xtFlowEditor.vue +++ b/src/components/xtFlowEditor.vue @@ -87,9 +87,10 @@ - + { const inst = this.$refs.routeForm.open(mode); diff --git a/src/components/xtSelect/index.vue b/src/components/xtSelect/index.vue index 83405748..8eef005f 100644 --- a/src/components/xtSelect/index.vue +++ b/src/components/xtSelect/index.vue @@ -123,8 +123,18 @@ onMounted(() => { const init = () => { if (props.label) { selectLabel.value = props.label; - } else { - if (props.multiple) { + return; + } + // 外部把值清空(表单重置/实例复用)时同步清空显示文字,否则输入框会残留上次选择的内容 + const emptyVal = + props.modelValue == null || + props.modelValue === "" || + (Array.isArray(props.modelValue) && props.modelValue.length === 0); + if (emptyVal) { + selectLabel.value = ""; + return; + } + if (props.multiple) { if (isFixOptions.value) { selectLabel.value = props.options .filter((item) => @@ -149,7 +159,6 @@ const init = () => { selectLabel.value = props.obj[props.labelField]; } } - } } const isFixOptions = ref(false); diff --git a/src/views/mtm/route_form.vue b/src/views/mtm/route_form.vue index 2d620ae0..5d192144 100644 --- a/src/views/mtm/route_form.vue +++ b/src/views/mtm/route_form.vue @@ -397,6 +397,11 @@ export default { }, getroutemats(){ let that = this; + // 无 routeId(画布拉线预填等新增场景)时不请求,避免拉回全量辅料 + if (!that.routeId) { + that.routemats = []; + return; + } that.$API.mtm.routemat.list.req({ route: that.routeId,page: 0}).then((res) => { that.routemats = res; }); @@ -500,7 +505,8 @@ export default { that.resetForm(); that.visible = true; that.$nextTick(() => { - if(that.count){ + // 仅新增时按现有数量预填排序;编辑时保留 setData 带入的原 sort + if(that.count && mode === "add"){ that.form.sort = that.count+1; } that.$refs.dialogForm && that.$refs.dialogForm.clearValidate(); diff --git a/src/views/mtm/routepack_form.vue b/src/views/mtm/routepack_form.vue index 0ea87702..f5806356 100644 --- a/src/views/mtm/routepack_form.vue +++ b/src/views/mtm/routepack_form.vue @@ -184,6 +184,7 @@ { this.$refs.saveDialog.open("add"); }); }, table_edit(row) { + this.dialogSeq += 1; this.dialog.save = true; this.$nextTick(() => { this.$refs.saveDialog.open("edit").setData(row); From dbd93cb9b90683954c11e75f8284fcd6bffe8866 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 23 Jul 2026 15:51:49 +0800 Subject: [PATCH 2/3] release: 3.1.2026072315 --- changelog.md | 4 ++++ src/config/index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 8e97940c..e8cf8452 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## 3.1.2026072315 + +- fix: 问题修复 + - 工艺路线表单残留问题根治:xtSelect外部清空值时同步清空显示文字(残留主因);画布/右侧新增弹框加key每次打开强制重建实例;route_form编辑时sort不再被count+1覆盖;无routeId不再全量拉辅料 [caoqianming] ## 3.1.2026072314 - fix: 问题修复 diff --git a/src/config/index.js b/src/config/index.js index 1c57920e..6b7ff619 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -6,7 +6,7 @@ const DEFAULT_CONFIG = { DASHBOARD_URL: "/dashboard", //版本号 - APP_VER: "3.1.2026072314", + APP_VER: "3.1.2026072315", //内核版本号 CORE_VER: "1.6.9", From a378a399174e395916591cfa7b86bb80dbc5b424 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 23 Jul 2026 16:06:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E5=B7=A5=E8=89=BA=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E6=8B=89=E7=BA=BF=E8=A1=A8=E5=8D=95=E5=B8=A6=E5=85=A5=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E4=BF=A1=E6=81=AF=E6=A0=B9=E5=9B=A0=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?:=E7=A6=81=E7=94=A8VueFlow=20connectOnClick(=E5=8D=95=E5=87=BB?= =?UTF-8?q?=E6=89=8B=E6=9F=84=E4=BC=9A=E6=8C=82=E8=B5=B7=E5=BE=85=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E7=8A=B6=E6=80=81,=E4=B9=8B=E5=90=8E=E5=86=8D?= =?UTF-8?q?=E7=82=B9=E6=89=8B=E6=9F=84=E4=BB=A5=E6=97=A7=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E4=B8=BA=E8=B5=B7=E7=82=B9=E8=A7=A6=E5=8F=91connect,=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E9=97=B4=E6=AD=87=E6=80=A7=E5=B8=A6=E5=85=A5=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E8=BE=93=E5=85=A5/=E8=BE=93=E5=87=BA);=E9=A2=84?= =?UTF-8?q?=E5=A1=AB=E6=94=B9=E4=B8=BAprop=E6=8C=82=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A;=E8=AF=AF=E5=90=B8=E9=99=84=E5=9B=9E?= =?UTF-8?q?=E8=B5=B7=E7=82=B9=E6=8C=89=E6=8B=89=E7=A9=BA=E7=99=BD=E5=A4=84?= =?UTF-8?q?=E7=90=86;=E5=8D=95=E7=BA=AF=E7=82=B9=E5=87=BB=E6=89=8B?= =?UTF-8?q?=E6=9F=84=E4=B8=8D=E5=86=8D=E5=BC=B9=E6=96=B0=E5=A2=9E=E8=A1=A8?= =?UTF-8?q?=E5=8D=95;=E8=8A=82=E7=82=B9=E5=A2=9E=E5=87=8F=E5=90=8E?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E9=80=82=E9=85=8D=E8=A7=86=E9=87=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/xtFlowEditor.vue | 41 +++++++++++++++++++++++++++------ src/views/mtm/route_form.vue | 3 +++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/components/xtFlowEditor.vue b/src/components/xtFlowEditor.vue index 115ffe28..90c93998 100644 --- a/src/components/xtFlowEditor.vue +++ b/src/components/xtFlowEditor.vue @@ -61,6 +61,8 @@ :default-viewport="{ zoom: 0.9 }" :min-zoom="0.2" :max-zoom="2" + :connection-radius="8" + :connect-on-click="false" :nodes-draggable="true" :nodes-connectable="!readonly" :elements-selectable="true" @@ -87,13 +89,14 @@ - + @@ -143,6 +146,7 @@ export default { count: 0, dialogVisible: false, dialogSeq: 0, + formPrefill: null, // 左侧物料面板 matType: "30", matKeyword: "", @@ -153,6 +157,7 @@ export default { // 连线手势内部状态 connectSource: null, connectMade: false, + connectStartPos: null, // 仅初次加载自动适配一次,避免编辑时视图跳动 hasFitted: false, }; @@ -284,9 +289,12 @@ export default { if (pid) routeNodeIds.add(pid); this.seedNodes = this.seedNodes.filter((s) => !routeNodeIds.has(s.id)); + const prevCount = this.nodes.length; this.edges = edges; this.nodes = layoutGraph(routeNodes.concat(this.seedNodes), edges); this.syncStore(); + // 节点增减后 dagre 会整体重排,重新适配视野,避免“看着是空白其实有节点”导致拉线误吸附 + if (this.hasFitted && this.nodes.length !== prevCount) this.doFit(); }, /** 把本地 nodes/edges 命令式同步到 Vue Flow store(先节点后边,避免边找不到端点) */ @@ -376,11 +384,18 @@ export default { onConnectStart(params) { this.connectSource = (params && (params.nodeId || params.source)) || null; this.connectMade = false; + const oe = params && params.event; + this.connectStartPos = oe && oe.clientX != null ? { x: oe.clientX, y: oe.clientY } : null; }, /** 连到已有节点:新建一条 Route,预填输入/输出物料 */ onConnect(conn) { this.connectMade = true; if (this.readonly) return; + // 误吸附保护:吸回起点自身或目标无效时,按“拉到空白”处理,只带输入 + if (!conn.target || conn.target === conn.source) { + this.openAddFrom(conn.source); + return; + } const src = this.nodes.find((n) => n.id === conn.source); const tgt = this.nodes.find((n) => n.id === conn.target); // 注意:id 为雪花大整数,必须保持字符串,切勿 Number() 否则精度丢失 @@ -392,16 +407,28 @@ export default { }); }, /** 拉线到空白处:新建工序,输出物料留空由后端自动生成下一节点 */ - onConnectEnd() { + onConnectEnd(evt) { const src = this.connectSource; const made = this.connectMade; + const startPos = this.connectStartPos; this.connectSource = null; this.connectMade = false; + this.connectStartPos = null; if (this.readonly || made || !src) return; - const node = this.nodes.find((n) => n.id === src); + // 单纯点击手柄(几乎无位移)不算拉线,不弹新增表单 + const oe = evt && evt.clientX != null ? evt : evt && evt.event; + if (startPos && oe && oe.clientX != null) { + const dist = Math.hypot(oe.clientX - startPos.x, oe.clientY - startPos.y); + if (dist < 8) return; + } + this.openAddFrom(src); + }, + /** 以某节点为输入新建工序:只带输入物料,其余字段一律默认值 */ + openAddFrom(srcId) { + const node = this.nodes.find((n) => n.id === srcId); // id 为雪花大整数,保持字符串 this.openForm("add", { - material_in: src, + material_in: srcId, material_in_name: node ? node.data.label : "", }); }, @@ -479,13 +506,13 @@ export default { this.openForm("add", null); }, - /** 打开单步表单;prefill 为 null 表示纯新增 */ + /** 打开单步表单;prefill 为 null 表示纯新增。预填经 prop 传入,在表单挂载 open 时一次性应用 */ openForm(mode, prefill) { this.dialogSeq += 1; + this.formPrefill = prefill || null; this.dialogVisible = true; this.$nextTick(() => { - const inst = this.$refs.routeForm.open(mode); - if (prefill) inst.setData(prefill); + this.$refs.routeForm.open(mode); }); }, diff --git a/src/views/mtm/route_form.vue b/src/views/mtm/route_form.vue index 5d192144..aefbcd5d 100644 --- a/src/views/mtm/route_form.vue +++ b/src/views/mtm/route_form.vue @@ -305,6 +305,8 @@ export default { props: { count: { type: Number, default : 0 }, routepack: { type: String, default: "" }, + // 打开时的预填数据(画布拉线传入):挂载即确定,避免事后setData在任何时序下带入脏数据 + prefill: { type: Object, default: null }, }, emits: ["success", "closed"], data() { @@ -503,6 +505,7 @@ export default { let that = this; that.mode = mode; that.resetForm(); + if (that.prefill) that.setData(that.prefill); that.visible = true; that.$nextTick(() => { // 仅新增时按现有数量预填排序;编辑时保留 setData 带入的原 sort