Просмотр исходного кода

参加外部质量活动计划导入验证

shenqilong 5 месяцев назад
Родитель
Сommit
e4f16eb9e3
1 измененных файлов с 28 добавлено и 14 удалено
  1. 28 14
      src/views/component/sjzlpjjhx/sjzlpjjhx.vue

+ 28 - 14
src/views/component/sjzlpjjhx/sjzlpjjhx.vue

@@ -496,17 +496,17 @@ export default {
         for (let i = 0; i < list.length; i++) {
           list[i].yanZhengLeiXing = list[i].yanZhengLeiXing
             ? list[i].yanZhengLeiXing
-                .replace(/' '/g, '')
-                .replace(/\(/g, '(')
-                .replace(/\)/g, ')')
+                .replaceAll(' ', '')
+                .replaceAll('(', '(')
+                .replaceAll(')', ')')
             : ''
           list[i].canYuRenYuan = list[i].canYuRenYuan
-            ? list[i].canYuRenYuan.replace(/' '/g, '').replace(/,/g, ',')
+            ? list[i].canYuRenYuan.replaceAll(' ', '').replaceAll(',', ',')
             : ''
-          if (list[i].tiGongZhe == '/') {
+          if (list[i].tiGongZhe?.trim() == '/') {
             list[i].tiGongZhe = ''
           }
-          if (list[i].biDuiFang == '/') {
+          if (list[i].biDuiFang?.trim() == '/') {
             list[i].biDuiFang = ''
           }
           const item = list[i]
@@ -518,26 +518,40 @@ export default {
     },
     // 导入验证
     validateItem(item, index) {
-      // console.log(item);
+      console.log(item)
 
       const { userList = [] } = this.$store.getters || {}
       if (
-        item.yanZhengLeiXing &&
-        !['能力验证(PT)', '室间质评(EQA)', '室间比对'].includes(
-          item.yanZhengLeiXing
-        )
+        !item.yanZhengLeiXing ||
+        (item.yanZhengLeiXing &&
+          !['能力验证(PT)', '室间质评(EQA)', '室间比对'].includes(
+            item.yanZhengLeiXing
+          ))
+      ) {
+        this.$message.warning(`第${index + 2}行验证类型为空或不存在!`)
+
+        return false
+      }
+      if (!item.huoDongMing) {
+        this.$message.warning(`第${index + 2}行活动名称不能为空!`)
+        return false
+      }
+      if (
+        (item.tiGongZhe && item.biDuiFang) ||
+        (!item.tiGongZhe && !item.biDuiFang)
       ) {
         this.$message.warning(
-          `第${index + 1}行验证类型不存在,请按照规则填写!`
+          `第${
+            index + 2
+          }行能力验证提供者和室间质评组织方或室间比对方不能为空且只能填写其中一个!`
         )
-
         return false
       }
       if (
         item.canYuRenYuan &&
         !this.checkName(item, userList, 'canYuRenYuan')
       ) {
-        this.$message.warning(`第${index + 1}行参加人员不存在`)
+        this.$message.warning(`第${index + 2}行参加人员不存在!`)
 
         return false
       }