From c0db1d4fa603e227695ffc8738a30843c28f5dd6 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 07 四月 2026 16:30:06 +0800
Subject: [PATCH] 新增和编辑页面工资定额输入验证,确保其不小于0

---
 src/views/productionManagement/productionProcess/New.vue |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/views/productionManagement/productionProcess/New.vue b/src/views/productionManagement/productionProcess/New.vue
index a5f00aa..0688f10 100644
--- a/src/views/productionManagement/productionProcess/New.vue
+++ b/src/views/productionManagement/productionProcess/New.vue
@@ -40,8 +40,17 @@
             <el-option label="璁′欢" :value="1" />
           </el-select>
         </el-form-item>
-        <el-form-item label="宸ヨ祫瀹氶" prop="salaryQuota">
-          <el-input v-model="formState.salaryQuota" type="number" :step="0.001">
+        <el-form-item
+            label="宸ヨ祫瀹氶"
+            prop="salaryQuota"
+            :rules="[
+              {
+                validator: validateSalaryQuota,
+                trigger: ['blur', 'change']
+              }
+            ]"
+        >
+          <el-input v-model="formState.salaryQuota" type="number" :step="0.001" :min="0">
             <template #append>鍏�</template>
           </el-input>
         </el-form-item>
@@ -95,6 +104,18 @@
 
 let { proxy } = getCurrentInstance()
 
+const validateSalaryQuota = (rule, value, callback) => {
+  if (value === '' || value === null || value === undefined) {
+    callback();
+    return;
+  }
+  if (Number(value) < 0) {
+    callback(new Error('宸ヨ祫瀹氶涓嶈兘灏忎簬0'));
+    return;
+  }
+  callback();
+};
+
 const closeModal = () => {
   isShow.value = false;
 };

--
Gitblit v1.9.3