diff --git a/src/views/personnelEfficiencyManagement/performanceManagement/components/reportingPerf.vue b/src/views/personnelEfficiencyManagement/performanceManagement/components/reportingPerf.vue index ec110a1e..ecc7e3d0 100644 --- a/src/views/personnelEfficiencyManagement/performanceManagement/components/reportingPerf.vue +++ b/src/views/personnelEfficiencyManagement/performanceManagement/components/reportingPerf.vue @@ -18,7 +18,7 @@ - + { + .catch(error => { + console.error('读取文件失败:', error); this.$message.error('文件读取接口异常'); }); }, - // 提交表单 submitForm() { if (!this.attachId) { this.$message.error('请先上传文件'); return; } - let params = {}; - if (!this.isDetail) { - params = { - id: this.row.id, - attachId: this.attachId, - table: { - tableData: this.tableData, - tableColumn: this.tableColumn, - }, - }; - reportBsEfficiencyTask(params).then(res => { - if (res.data.code === 200) { - this.$message.success('提交成功'); - this.closeDialog(true); - } else { - this.$message.error('提交失败'); - } - }); + // 1. 判断状态 + const hasPending = this.row.subTasks?.some(t => t.status === 1); + const hasError = this.tableData.some(item => item.isSysUser == 0); + // 2. 提示语(优先级:未完成 > 错误 > 正常) + let msg = '确认提交绩效数据?'; + if (hasPending && hasError) { + msg = '本月有未完成绩效任务,数据可能存在错误,确认提交绩效数据?'; + } else if (hasError) { + msg = '数据可能存在错误,确认提交绩效数据?'; + } else if (hasPending) { + msg = '本月有未完成绩效任务,确认提交绩效数据?'; } else { - params = { - id: this.row.id, - attachId: this.attachId, - }; - subReportBsEfficiencyTask(params).then(res => { - if (res.data.code === 200) { - this.$message.success('提交成功'); - this.closeDialog(true); - } else { - this.$message.error('提交失败'); + msg = '确认提交绩效数据?'; + } + this.$confirm(msg, '', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then(() => { + const params = { + id: this.row.id, + attachId: this.attachId, + }; + if (!this.isDetail) { + params.table = { + tableData: this.tableData, + tableColumn: this.tableColumn, + }; } + const api = this.isDetail ? subReportBsEfficiencyTask : reportBsEfficiencyTask; + + api(params) + .then(res => { + if (res.data.code === 200) { + this.$message.success('提交成功'); + this.closeDialog(true); + } else { + this.$message.error('提交失败'); + } + }) + .catch(error => { + console.error('提交失败:', error); + this.$message.error('提交失败,请检查网络或稍后重试'); + }); + }) + .catch(() => { + // 取消提交 }); - } }, }, }; - \ No newline at end of file + + \ No newline at end of file diff --git a/src/views/personnelEfficiencyManagement/performanceManagement/dataReporting.vue b/src/views/personnelEfficiencyManagement/performanceManagement/dataReporting.vue index 7e3e44dc..0cc1dd0f 100644 --- a/src/views/personnelEfficiencyManagement/performanceManagement/dataReporting.vue +++ b/src/views/personnelEfficiencyManagement/performanceManagement/dataReporting.vue @@ -40,7 +40,7 @@