From 6a1cc54c8ba709fc70e0264ed631493bc0ab3c90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=B4=E7=BA=A2=E5=85=B5?= <374362909@qq.com>
Date: Tue, 3 Mar 2026 17:44:49 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=87=87=E8=B4=AD?=
=?UTF-8?q?=E8=A7=84=E5=88=99=E9=85=8D=E7=BD=AE=E9=87=91=E9=A2=9D=E5=AD=97?=
=?UTF-8?q?=E6=AE=B5=E6=B8=85=E7=A9=BA=E5=90=8E=E6=9C=AA=E7=BD=AE=E7=A9=BA?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- el-input-number 清空时显式设置 null
- 提交时确保 amountMin/amountMax 为 null 而非 undefined
- 添加 @change 事件处理金额字段变化
---
.../purchase/purchasingRuleConfig/form.vue | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/views/purchase/purchasingRuleConfig/form.vue b/src/views/purchase/purchasingRuleConfig/form.vue
index 98aab36..a584e40 100644
--- a/src/views/purchase/purchasingRuleConfig/form.vue
+++ b/src/views/purchase/purchasingRuleConfig/form.vue
@@ -51,6 +51,7 @@
:controls="false"
placeholder="金额下限"
style="width: 200px;"
+ @change="handleAmountMinChange"
/>
元
至
@@ -61,6 +62,7 @@
:controls="false"
placeholder="金额上限"
style="width: 200px;"
+ @change="handleAmountMaxChange"
/>
元
(不填表示不限)
@@ -224,13 +226,18 @@ const resetForm = () => {
const handleSubmit = async () => {
await formRef.value?.validate();
+ const submitData = {
+ ...form,
+ amountMin: form.amountMin ?? null,
+ amountMax: form.amountMax ?? null
+ };
submitLoading.value = true;
try {
if (isEdit.value) {
- await putObj(form);
+ await putObj(submitData);
useMessage().success('修改成功');
} else {
- await addObj(form);
+ await addObj(submitData);
useMessage().success('新增成功');
}
visible.value = false;
@@ -242,5 +249,13 @@ const handleSubmit = async () => {
}
};
+const handleAmountMinChange = (val: number | undefined) => {
+ form.amountMin = val ?? null;
+};
+
+const handleAmountMaxChange = (val: number | undefined) => {
+ form.amountMax = val ?? null;
+};
+
defineExpose({ openDialog });
\ No newline at end of file