瀏覽代碼

refactor(forecast): 移除年份验证规则并将年份改为字符串类型

yz 1 周之前
父節點
當前提交
53bc21a1d2
共有 1 個文件被更改,包括 1 次插入12 次删除
  1. 1 12
      src/constants/forecast.js

+ 1 - 12
src/constants/forecast.js

@@ -117,17 +117,6 @@ export const FORECAST_FORM_RULES = {
   /** 年份验证规则 */
   year: [
     { required: true, message: '请选择年份', trigger: 'change' },
-    {
-      validator: (rule, value, callback) => {
-        const year = parseInt(value)
-        if (isNaN(year) || year < 2020 || year > 2050) {
-          callback(new Error('年份必须在2020-2050之间'))
-        } else {
-          callback()
-        }
-      },
-      trigger: 'change'
-    }
   ],
   /** 月份验证规则 */
   month: [
@@ -164,7 +153,7 @@ export const FORECAST_FORM_RULES = {
  */
 export const DEFAULT_FORECAST_FORM = {
   forecastCode: '',
-  year: new Date().getFullYear(),
+  year: new Date().getFullYear().toString(), // 改为字符串类型
   month: new Date().getMonth() + 1,
   customerId: null,
   customerCode: '',