From a72aff44170536c56d1441eb94c46d15912849e3 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 19 一月 2026 10:19:57 +0800
Subject: [PATCH] 采购台账中涉及到价格、数量等输入框时,限制为大于等于0的数字输入
---
src/views/procurementManagement/procurementLedger/index.vue | 80 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 191dfe1..9b86624 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -391,6 +391,15 @@
prop="taxExclusiveTotalPrice"
:formatter="formattedNumber"
width="150" />
+ <el-table-column label="鏄惁璐ㄦ"
+ prop="isChecked"
+ width="150">
+ <template #default="scope">
+ <el-tag :type="scope.row.isChecked ? 'success' : 'info'">
+ {{ scope.row.isChecked ? '鏄�' : '鍚�' }}
+ </el-tag>
+ </template>
+ </el-table-column>
<el-table-column fixed="right"
label="鎿嶄綔"
min-width="60"
@@ -522,6 +531,7 @@
<el-input-number v-model="productForm.taxInclusiveUnitPrice"
:precision="2"
:step="0.1"
+ :min="0"
clearable
style="width: 100%"
@change="mathNum" />
@@ -533,6 +543,7 @@
<el-input-number :step="0.1"
clearable
:precision="2"
+ :min="0"
style="width: 100%"
v-model="productForm.quantity"
placeholder="璇疯緭鍏�"
@@ -547,6 +558,7 @@
<el-input-number v-model="productForm.taxInclusiveTotalPrice"
:precision="2"
:step="0.1"
+ :min="0"
clearable
style="width: 100%"
@change="reverseMathNum('taxInclusiveTotalPrice')" />
@@ -555,8 +567,13 @@
<el-col :span="12">
<el-form-item label="涓嶅惈绋庢�讳环(鍏�)锛�"
prop="taxExclusiveTotalPrice">
- <el-input v-model="productForm.taxExclusiveTotalPrice"
- @change="reverseMathNum('taxExclusiveTotalPrice')" />
+ <el-input-number v-model="productForm.taxExclusiveTotalPrice"
+ :precision="2"
+ :step="0.1"
+ :min="0"
+ clearable
+ style="width: 100%"
+ @change="reverseMathNum('taxExclusiveTotalPrice')" />
</el-form-item>
</el-col>
</el-row>
@@ -580,8 +597,22 @@
<el-input-number v-model="productForm.warnNum"
:precision="2"
:step="0.1"
+ :min="0"
clearable
style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鏄惁璐ㄦ锛�"
+ prop="isChecked">
+ <el-radio-group v-model="productForm.isChecked">
+ <el-radio label="鏄�"
+ :value="true" />
+ <el-radio label="鍚�"
+ :value="false" />
+ </el-radio-group>
</el-form-item>
</el-col>
</el-row>
@@ -999,6 +1030,7 @@
supplierId: "",
paymentMethod: "",
executionDate: "",
+ isChecked: true,
},
rules: {
purchaseContractNumber: [
@@ -1046,6 +1078,7 @@
taxExclusiveTotalPrice: "",
invoiceType: "",
warnNum: "",
+ isChecked: true,
},
productRules: {
productId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -1064,6 +1097,7 @@
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ isChecked: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
},
});
const { productForm, productRules } = toRefs(productFormData);
@@ -1316,6 +1350,10 @@
}
}
+ if (form.value.salesLedgerId == -1) {
+ form.value.salesLedgerId = null;
+ }
+ console.log(form.value, "form.value===========");
dialogFormVisible.value = true;
} catch (error) {
console.error("鎵撳紑琛ㄥ崟澶辫触:", error);
@@ -1635,6 +1673,20 @@
}
const taxRate = Number(productForm.value.taxRate);
if (!taxRate) return;
+
+ // 纭繚杈撳叆鍊间笉涓鸿礋鏁�
+ if (
+ field === "taxInclusiveTotalPrice" ||
+ field === "taxExclusiveTotalPrice"
+ ) {
+ const value = Number(productForm.value[field]);
+ if (value < 0) {
+ productForm.value[field] = "0";
+ proxy.$modal.msgWarning("鍊间笉鑳藉皬浜�0");
+ return;
+ }
+ }
+
if (field === "taxInclusiveTotalPrice") {
// 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
if (productForm.value.quantity) {
@@ -1642,6 +1694,10 @@
Number(productForm.value.taxInclusiveTotalPrice) /
Number(productForm.value.quantity)
).toFixed(2);
+ // 纭繚缁撴灉涓嶄负璐熸暟
+ if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
+ productForm.value.taxInclusiveUnitPrice = "0";
+ }
}
// 宸茬煡鍚◣鎬讳环鍜屽惈绋庡崟浠凤紝鍙嶇畻鏁伴噺
else if (productForm.value.taxInclusiveUnitPrice) {
@@ -1649,24 +1705,40 @@
Number(productForm.value.taxInclusiveTotalPrice) /
Number(productForm.value.taxInclusiveUnitPrice)
).toFixed(2);
+ // 纭繚缁撴灉涓嶄负璐熸暟
+ if (Number(productForm.value.quantity) < 0) {
+ productForm.value.quantity = "0";
+ }
}
// 鍙嶇畻涓嶅惈绋庢�讳环
productForm.value.taxExclusiveTotalPrice = (
Number(productForm.value.taxInclusiveTotalPrice) /
(1 + taxRate / 100)
).toFixed(2);
+ // 纭繚缁撴灉涓嶄负璐熸暟
+ if (Number(productForm.value.taxExclusiveTotalPrice) < 0) {
+ productForm.value.taxExclusiveTotalPrice = "0";
+ }
} else if (field === "taxExclusiveTotalPrice") {
// 鍙嶇畻鍚◣鎬讳环
productForm.value.taxInclusiveTotalPrice = (
Number(productForm.value.taxExclusiveTotalPrice) *
(1 + taxRate / 100)
).toFixed(2);
+ // 纭繚缁撴灉涓嶄负璐熸暟
+ if (Number(productForm.value.taxInclusiveTotalPrice) < 0) {
+ productForm.value.taxInclusiveTotalPrice = "0";
+ }
// 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
if (productForm.value.quantity) {
productForm.value.taxInclusiveUnitPrice = (
Number(productForm.value.taxInclusiveTotalPrice) /
Number(productForm.value.quantity)
).toFixed(2);
+ // 纭繚缁撴灉涓嶄负璐熸暟
+ if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
+ productForm.value.taxInclusiveUnitPrice = "0";
+ }
}
// 宸茬煡鍚◣鍗曚环锛屽弽绠楁暟閲�
else if (productForm.value.taxInclusiveUnitPrice) {
@@ -1674,6 +1746,10 @@
Number(productForm.value.taxInclusiveTotalPrice) /
Number(productForm.value.taxInclusiveUnitPrice)
).toFixed(2);
+ // 纭繚缁撴灉涓嶄负璐熸暟
+ if (Number(productForm.value.quantity) < 0) {
+ productForm.value.quantity = "0";
+ }
}
}
};
--
Gitblit v1.9.3