代码优化async handlSumbmitData thissubmitCheckInfoappraiseeIds = ; thissubmitCheckInfoappraiseeNames = ; if thistableDatalength thistableData flatMap scoreList = scoreLis
async handlSumbmitData() { this.submitCheckInfo.appraiseeIds = []; this.submitCheckInfo.appraiseeNames = [];
if (this.tableData?.length) { const assessScores = this.tableData .flatMap(({ scoreList }) => scoreList) .filter(item => item.assessScore == "" || item.assessScore == null);
this.submitCheckInfo.appraiseeIds = [...new Set(assessScores.map(item => item.appraiseeId))];
this.tableData.forEach(s => {
if (this.submitCheckInfo.appraiseeIds.includes(s.assesseeId)) {
this.submitCheckInfo.appraiseeNames.push(s.assessee);
}
});
if (this.submitCheckInfo.appraiseeNames?.length) {
this.submitCheckInfo.message = this.submitCheckInfo.appraiseeNames.join("、");
const message = `请先完成所有评分,再提交。未完成评分的部门有:${this.submitCheckInfo.message}。`;
const options = {
confirmButtonText: "确定",
showCancelButton: false,
type: "warning",
dangerouslyUseHTMLString: true,
};
await $MessageBox.$confirm(message, options);
return;
}
}
原文地址: http://www.cveoy.top/t/topic/h9YC 著作权归作者所有。请勿转载和采集!