Browse Source

添加提测验证

qinzhipeng_v@didiglobal.com 4 năm trước cách đây
mục cha
commit
6091ffa41b

+ 13 - 0
src/views/reportManagement/Testing/newTestingTemplate.vue

@@ -342,6 +342,19 @@ export default {
 
     // 创建提测报告
     reportreleaseCreate(val) {
+      let show = '0'
+      this.from.customFields.map(item => {
+        if (item.bool && item.required && item.type < 4) {
+          item.type < 4 && item.content ? '' : show = item.fieldName
+        }
+        if (item.bool && item.required && item.type === 4) {
+          item.contents ? '' : show = item.fieldName
+        }
+      })
+      if (show !== '0') {
+        this.$message({ type: 'warning', message: `${show}不能为空` })
+        return
+      }
       this.$refs.fromCreateData.validate(async(valid) => {
         if (valid) {
           this.loading = true

+ 37 - 37
src/views/reportManagement/components/template/nodule.vue

@@ -1,7 +1,7 @@
 <template>
   <el-row>
-    <el-col v-for="(item, index) in customs" :key="index" :span="12" class="Layout_space_between">
-      <span v-show="item.bools" class="parent-style">
+    <el-col v-for="(item, index) in data.customFields" :key="index" :span="12" class="Layout_space_between">
+      <span v-show="item.bool" class="parent-style">
         <span class="parent-fieldName">{{ item.fieldName }}:</span>
         <span v-if="item.type !== 4">{{ item.content }}</span>
         <span v-else>{{ item.contents.join(',') }}</span>
@@ -14,42 +14,42 @@
 export default {
   props: {
     data: { type: Object, required: true }
-  },
-  data() {
-    return {
-      customs: []
-    }
-  },
-  watch: {
-    data: {
-      handler(newV) {
-        if (newV.customFields) {
-          this.customs = newV.customFields.map(item => ({
-            ...item,
-            bools: item.conditions === '默认展示' || this.getBoolValue(item.conditions)
-          }))
-        }
-      },
-      immediate: true
-    }
-  },
-  methods: {
-    getBoolValue(conditions) {
-      const checkList = []
-      this.customs.forEach(item => {
-        if (item.content && item.type < 4) {
-          checkList.push(`${item.fieldKey}_${item.content}`)
-        }
-        if (item.contents && item.type === 4) {
-          item.contents.forEach(contentItem => {
-            checkList.push(`${item.fieldKey}_${contentItem}`)
-          })
-        }
-      })
-      console.log(checkList.indexOf(conditions) !== -1)
-      return checkList.indexOf(conditions) !== -1
-    }
   }
+  // data() {
+  //   return {
+  //     customs: []
+  //   }
+  // },
+  // watch: {
+  //   data: {
+  //     handler(newV) {
+  //       if (newV.customFields) {
+  //         this.customs = newV.customFields.map(item => ({
+  //           ...item,
+  //           bools: item.conditions === '默认展示' || this.getBoolValue(item.conditions)
+  //         }))
+  //       }
+  //     },
+  //     immediate: true
+  //   }
+  // },
+  // methods: {
+  //   getBoolValue(conditions) {
+  //     const checkList = []
+  //     this.customs.forEach(item => {
+  //       if (item.content && item.type < 4) {
+  //         checkList.push(`${item.fieldKey}_${item.content}`)
+  //       }
+  //       if (item.contents && item.type === 4) {
+  //         item.contents.forEach(contentItem => {
+  //           checkList.push(`${item.fieldKey}_${contentItem}`)
+  //         })
+  //       }
+  //     })
+  //     console.log(checkList.indexOf(conditions) !== -1)
+  //     return checkList.indexOf(conditions) !== -1
+  //   }
+  // }
 }
 </script>