|
@@ -17,6 +17,7 @@ export const clewMixins = {
|
|
|
params.customerClueItemList.push(...this.deepClone(this.taskGather, 0));
|
|
params.customerClueItemList.push(...this.deepClone(this.taskGather, 0));
|
|
|
this.filterOption(this.taskGather, params);
|
|
this.filterOption(this.taskGather, params);
|
|
|
console.log(JSON.stringify(params));
|
|
console.log(JSON.stringify(params));
|
|
|
|
|
+ debugger;
|
|
|
// 必填验证
|
|
// 必填验证
|
|
|
if (this.requiredFlag) {
|
|
if (this.requiredFlag) {
|
|
|
callback && callback(params);
|
|
callback && callback(params);
|
|
@@ -114,9 +115,10 @@ export const clewMixins = {
|
|
|
} else if (optionList[i].answerType == 'bg') {
|
|
} else if (optionList[i].answerType == 'bg') {
|
|
|
// 表格
|
|
// 表格
|
|
|
let tableData = optionList[i].tableData;
|
|
let tableData = optionList[i].tableData;
|
|
|
- if (!this.filterBGData(tableData).length) {
|
|
|
|
|
- this.requiredFlag = false;
|
|
|
|
|
- this.requiredMessage = '请填写' + optionList[i].customerClueName;
|
|
|
|
|
|
|
+ let filterBGData = this.filterBGData(tableData);
|
|
|
|
|
+ if (!filterBGData) {
|
|
|
|
|
+ // this.requiredFlag = false;
|
|
|
|
|
+ // this.requiredMessage = '请填写' + optionList[i].customerClueName;
|
|
|
return;
|
|
return;
|
|
|
} else {
|
|
} else {
|
|
|
optionList[i].answerValue = JSON.stringify(tableData);
|
|
optionList[i].answerValue = JSON.stringify(tableData);
|
|
@@ -126,13 +128,39 @@ export const clewMixins = {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
filterBGData(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;
|
|
|
|
|
+ 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) => index !== 0 || cell.trim() !== ''
|
|
|
|
|
+ );
|
|
|
|
|
+ if (hasContent && !allFilled) {
|
|
|
|
|
+ alert(`第 ${rowIndex + 1} 行的其他输入框也要填写`);
|
|
|
|
|
+ this.requiredFlag = false;
|
|
|
|
|
+ this.requiredMessage = `第 ${rowIndex + 1} 行的其他输入框也要填写`;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (allFilled) {
|
|
|
|
|
+ hasAllFilledRow = true;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- return data;
|
|
|
|
|
|
|
+ if (!hasAllFilledRow) {
|
|
|
|
|
+ alert('整个表格必须有一行所有输入框都输入了内容');
|
|
|
|
|
+ this.requiredFlag = false;
|
|
|
|
|
+ this.requiredMessage = '整个表格必须有一行所有输入框都输入了内容';
|
|
|
|
|
+ return false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ // let data = [];
|
|
|
|
|
+ // const isValid = tableData.data.some((row) => {
|
|
|
|
|
+ // if (Object.values(row).every((value) => value.trim() !== '')) {
|
|
|
|
|
+ // data.push(row);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // return data;
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|