Ver código fonte

payment-record. 处理新增行表单, statement name 校验逻辑.

peter 1 ano atrás
pai
commit
af52387176
1 arquivos alterados com 14 adições e 5 exclusões
  1. 14 5
      src/pages/payment-record/components/edit.vue

+ 14 - 5
src/pages/payment-record/components/edit.vue

@@ -192,9 +192,10 @@ import {
   ElButton,
 } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
-import { 
+import {
   // IPoItem,
-   IOptionItem } from '../inteface'
+  IOptionItem,
+} from '../inteface'
 
 const props = defineProps({
   visible: {
@@ -247,7 +248,7 @@ const paymentOption = [
 const dialogVisible = ref(false)
 
 const mainForm = ref<FormInstance>()
-const form:any = ref({})
+const form: any = ref({})
 const formRule = ref<FormRules>({
   po_number: {
     required: true,
@@ -261,8 +262,16 @@ const formRule = ref<FormRules>({
   // },
   statement: {
     required: true,
-    message: '必填项',
-    trigger: 'blur',
+    trigger: 'change',
+    asyncValidator: (rule, v) => {
+      return new Promise((resolve, reject) => {
+        if (v.value && v.label) {
+          resolve()
+        } else {
+          reject('必填项')
+        }
+      })
+    },
   },
   total: {
     required: true,