Kaynağa Gözat

Merge branch 'feature_20241224_客资任务跟踪题目填写添加表格选项'

zhujindu 11 ay önce
ebeveyn
işleme
63baa28667

+ 33 - 9
src/mixin/clew.js

@@ -114,25 +114,49 @@ export const clewMixins = {
           } else if (optionList[i].answerType == 'bg') {
             // 表格
             let tableData = optionList[i].tableData;
-            if (!this.filterBGData(tableData).length) {
+            let filterBGData = this.filterBGData(tableData);
+            if (filterBGData.hasAllFilledRow && filterBGData.filledRow == '') {
+              optionList[i].answerValue = JSON.stringify(tableData);
+            } else {
               this.requiredFlag = false;
-              this.requiredMessage = '请填写' + optionList[i].customerClueName;
+              this.requiredMessage =
+                filterBGData.filledRow != ''
+                  ? filterBGData.filledRow
+                  : '请填写' + optionList[i].customerClueName;
               return;
-            } else {
-              optionList[i].answerValue = JSON.stringify(tableData);
             }
           }
         }
       }
     },
     filterBGData(tableData) {
-      let data = [];
-      const isValid = tableData.data.some((row) => {
-        if (Object.values(row).every((value) => value.trim() !== '')) {
-          data.push(row);
+      // 如果一行中有一个输入框输入了内容,其他输入框没有内容,就弹框提示当前行其它输入框也要填写,
+      // 整个表格必须有一行所有输入框都输入了内容
+      let hasAllFilledRow = false; // 是否有整行都填写
+      let filledRow = ''; // 有内容行
+      tableData.data.forEach((row, rowIndex) => {
+        const hasContent = Object.values(row).some(
+          (cell, index) => index !== 0 && cell.trim() !== ''
+        );
+        const allFilled = Object.values(row).every((cell, index) => {
+          return cell.trim() !== '';
+        });
+        if (hasContent && !allFilled) {
+          filledRow = `${row.typeName}请填写完整`;
+          return;
+        }
+        if (allFilled) {
+          hasAllFilledRow = true;
         }
       });
-      return data;
+      return { hasAllFilledRow, filledRow };
+      // let data = [];
+      // const isValid = tableData.data.some((row) => {
+      //   if (Object.values(row).every((value) => value.trim() !== '')) {
+      //     data.push(row);
+      //   }
+      // });
+      // return data;
     },
   },
 };

+ 2 - 1
src/views/clew/complaintDetail/radioGroup.vue

@@ -109,8 +109,9 @@
               <template v-if="item.answerType == 'wb'">
                 <van-field v-model="scope.row[item.prop]" />
               </template>
+              <!-- 正整数 digit -->
               <template v-if="item.answerType == 'sz'">
-                <van-field v-model="scope.row[item.prop]" type="number" />
+                <van-field v-model="scope.row[item.prop]" type="digit" />
               </template>
             </template>
           </el-table-column>