Prechádzať zdrojové kódy

市政 图片自定义规则校验

付宇航 1 rok pred
rodič
commit
ffa3ee9858
1 zmenil súbory, kde vykonal 22 pridanie a 3 odobranie
  1. 22 3
      src/views/zdsz/engineeringIndustry/index.vue

+ 22 - 3
src/views/zdsz/engineeringIndustry/index.vue

@@ -317,6 +317,25 @@ export default {
     EngineePipe
   },
   data() {
+    var validatePicPass = (rule, value, callback) => {
+        console.log('校验值', this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList)
+        let p = new Promise((resolve, reject) => {
+            if(this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList.length != 0){
+              this.$message({
+                message: '校验通过',
+                type: 'success'
+              });
+              return true
+            }else{
+              this.$message({
+                message: 'no pass',
+                type: 'error'
+              });
+              return false
+            }
+        });
+        return p;
+    };
     return {
       // 按钮loading
       buttonLoading: false,
@@ -467,9 +486,9 @@ export default {
         // constructAddre: [
         //   {required: true, message: "施工地址不能为空", trigger: 'blur'}
         // ],
-        // zEngiineeringPhotoBoList: [
-        //   {required: true, message: "图片不能为空", trigger: 'blur'}
-        // ],
+        zEngiineeringPhotoBoList: [
+          {required: true, message: "图片不能为空", trigger: 'change', validator: validatePicPass}
+        ],
 
       },
       currentType: null, // 附件组件类型 put修改 add新增