人效管理-绩效管理-绩效填报-接口对接

dev-scheduling
ysn 1 month ago
parent 7e43f907ef
commit c6d0246962
  1. 169
      src/views/personnelEfficiencyManagement/performanceManagement/components/reportingPerf.vue
  2. 82
      src/views/personnelEfficiencyManagement/performanceManagement/dataReporting.vue

@ -18,7 +18,7 @@
</el-button> </el-button>
</template> </template>
</avue-form> </avue-form>
<el-table v-show="isRead && !isDetail" :data="tableData"> <el-table v-show="isRead && !isDetail" :data="tableData" :row-class-name="tableRowClassName">
<el-table-column type="index" width="50" label="序号" /> <el-table-column type="index" width="50" label="序号" />
<el-table-column <el-table-column
v-for="item in tableColumn" v-for="item in tableColumn"
@ -43,31 +43,18 @@ import {
reportBsEfficiencyTask, reportBsEfficiencyTask,
subReportBsEfficiencyTask, subReportBsEfficiencyTask,
} from '@/api/performanceManagement/dataReporting'; } from '@/api/performanceManagement/dataReporting';
export default { export default {
props: { props: {
title: { title: { type: String, default: '' },
type: String, showReport: { type: Boolean, default: false },
default: '', isDetail: { type: Boolean, default: false },
}, row: { type: Object, default: null },
showReport: {
type: Boolean,
default: false,
},
isDetail: {
type: Boolean,
default: false,
},
row: {
type: Object,
default: null,
},
}, },
data() { data() {
return { return {
openShow: false, openShow: false,
excelForm: { excelForm: { excelFile: [] },
excelFile: [],
},
excelOption: { excelOption: {
submitBtn: false, submitBtn: false,
emptyBtn: false, emptyBtn: false,
@ -81,63 +68,58 @@ export default {
fileSize: 50000, fileSize: 50000,
propsHttp: { propsHttp: {
res: 'data', res: 'data',
attachId: 'attachId', // ID
}, },
dataType: 'object',
accept: '.xls,.xlsx', accept: '.xls,.xlsx',
tip: '请上传 .xls,.xlsx 标准格式文件,文件最大5M', tip: '请上传 .xls,.xlsx 标准格式文件,文件最大5M',
action: '/api/blade-resource/oss/endpoint/put-file-attach', action: '/api/blade-resource/oss/endpoint/put-file-attach',
rules: [ rules: [{ required: true, message: '请上传文件', trigger: 'blur' }],
{
required: true,
message: '请上传文件',
trigger: 'blur',
},
],
},
{
label: '',
prop: 'readExcel',
formslot: true,
span: 12,
}, },
{ label: '', prop: 'readExcel', formslot: true, span: 12 },
], ],
}, },
tableData: [], tableData: [],
isRead: false, isRead: false,
tableColumn: [ tableColumn: [],
{ label: '员工工号', prop: 'cardNo' },
{ label: '姓名', prop: 'name' },
],
attachId: null, attachId: null,
formData: null, formData: null,
}; };
}, },
created() { watch: {
this.openShow = this.showReport; showReport: {
handler(val) {
this.openShow = val;
},
immediate: true,
},
}, },
methods: { methods: {
tableRowClassName({ row }) {
if (row.isSysUser == '0' || row.isSysUser == 0) {
return 'warning-row';
}
return '';
},
closeDialog(val) { closeDialog(val) {
this.openShow = false; this.openShow = false;
//
this.excelForm = { excelFile: [] }; this.excelForm = { excelFile: [] };
this.attachId = null; this.attachId = null;
this.tableData = []; this.tableData = [];
this.isRead = false; this.isRead = false;
this.$emit('closeDialog', val); this.$emit('closeDialog', val);
}, },
//
uploadBefore(file, done, loading, column) { uploadBefore(file, done, loading, column) {
this.formData = file; this.formData = file;
done(); // done(file);
}, },
// uploadAfter(res, done, loading, column) {
uploadAfter(file, done, loading, column) { // action
console.log('上传成功返回:', file); this.attachId = res.attachId;
// attachId
this.attachId = file.attachId || file.data?.attachId;
done(); done();
}, },
// Excel
readExcel() { readExcel() {
if (!this.attachId) { if (!this.attachId) {
this.$message.warning('请先上传文件'); this.$message.warning('请先上传文件');
@ -151,52 +133,75 @@ export default {
this.isRead = true; this.isRead = true;
this.$message.success('文件读取成功'); this.$message.success('文件读取成功');
} else { } else {
this.$message.error('文件读取失败'); this.$message.error(res.data.msg || '读取失败');
} }
}) })
.catch(() => { .catch(error => {
console.error('读取文件失败:', error);
this.$message.error('文件读取接口异常'); this.$message.error('文件读取接口异常');
}); });
}, },
//
submitForm() { submitForm() {
if (!this.attachId) { if (!this.attachId) {
this.$message.error('请先上传文件'); this.$message.error('请先上传文件');
return; return;
} }
let params = {}; // 1.
if (!this.isDetail) { const hasPending = this.row.subTasks?.some(t => t.status === 1);
params = { const hasError = this.tableData.some(item => item.isSysUser == 0);
id: this.row.id, // 2. > >
attachId: this.attachId, let msg = '确认提交绩效数据?';
table: { if (hasPending && hasError) {
tableData: this.tableData, msg = '本月有未完成绩效任务,数据可能存在错误,确认提交绩效数据?';
tableColumn: this.tableColumn, } else if (hasError) {
}, msg = '数据可能存在错误,确认提交绩效数据?';
}; } else if (hasPending) {
reportBsEfficiencyTask(params).then(res => { msg = '本月有未完成绩效任务,确认提交绩效数据?';
if (res.data.code === 200) {
this.$message.success('提交成功');
this.closeDialog(true);
} else {
this.$message.error('提交失败');
}
});
} else { } else {
params = { msg = '确认提交绩效数据?';
id: this.row.id, }
attachId: this.attachId, this.$confirm(msg, '', {
}; confirmButtonText: '确定',
subReportBsEfficiencyTask(params).then(res => { cancelButtonText: '取消',
if (res.data.code === 200) { type: 'warning',
this.$message.success('提交成功'); })
this.closeDialog(true); .then(() => {
} else { const params = {
this.$message.error('提交失败'); 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(() => {
//
}); });
}
}, },
}, },
}; };
</script> </script>
<style>
/* 高亮样式 权重提升 确保生效 */
.warning-row {
background: #fff800 !important;
}
</style>

@ -40,7 +40,7 @@
</template> </template>
<template #menu="scope"> <template #menu="scope">
<el-button <el-button
v-if="scope.row.status == 1 || scope.row.status == 2" v-if="scope.row.status == 1 || scope.row.status == 2 || scope.row.status == 5"
type="text" type="text"
@click="downloadTask(scope.row)" @click="downloadTask(scope.row)"
> >
@ -92,24 +92,13 @@
:showDetail="showDetail" :showDetail="showDetail"
@closeDetail="closeDetail" @closeDetail="closeDetail"
:row="currentRow" :row="currentRow"
:type="'1'"
/> />
<el-dialog append-to-body title="审批" v-model="showExamine" width="85%"> <el-dialog append-to-body title="审批" v-model="showExamine" width="85%">
<div style="margin-top: 20px"> <avue-form :option="examineOption" v-model="examineForm" ref="examineForm" />
<div style="display: flex; align-items: center; margin-bottom: 10px">
<div style="width: 100px">审批结果</div>
<el-select v-model="resultValue" style="margin-right: 10px">
<el-option label="通过" value="1"></el-option>
<el-option label="不通过" value="2"></el-option>
</el-select>
</div>
<div style="display: flex; align-items: center">
<div style="width: 100px">审批意见</div>
<el-input v-model="opinion" type="textarea"></el-input>
</div>
</div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="showExamine = false"> </el-button> <el-button @click="closeExamine"> </el-button>
<el-button type="primary" @click="handleApproval"> </el-button> <el-button type="primary" @click="handleApproval"> </el-button>
</span> </span>
</template> </template>
@ -151,6 +140,33 @@ export default {
currentRow: null, currentRow: null,
showDetail: false, showDetail: false,
showExamine: false, showExamine: false,
examineForm: {
result: '',
remark: '',
},
examineOption: {
submitBtn: false,
emptyBtn: false,
column: [
{
label: '审批结果',
prop: 'result',
type: 'radio',
dicData: [
{ label: '通过', value: '1' },
{ label: '不通过', value: '2' },
],
span: 24,
rules: [{ required: true, message: '请选择审批结果', trigger: 'blur' }],
},
{
label: '审批意见',
prop: 'remark',
type: 'textarea',
span: 24,
},
],
},
loading: false, loading: false,
data: [], data: [],
form: {}, form: {},
@ -171,7 +187,7 @@ export default {
searchMenuSpan: 12, searchMenuSpan: 12,
searchIcon: true, searchIcon: true,
searchIndex: 3, searchIndex: 3,
tree: false, tree: true,
treeProps: { treeProps: {
children: 'subTasks', children: 'subTasks',
hasChildren: 'hasChildren', hasChildren: 'hasChildren',
@ -373,16 +389,28 @@ export default {
}); });
}); });
}, },
//
closeExamine() {
this.showExamine = false;
//
this.examineForm = {
result: '',
remark: '',
};
},
// //
handleApproval() { handleApproval() {
if (!this.currentRow) return; if (!this.currentRow) return;
if (this.resultValue === '1') { //
this.approvalRow(this.currentRow); this.$refs.examineForm.validate(valid => {
} else if (this.resultValue === '2') { if (valid) {
this.rejectRow(this.currentRow); if (this.examineForm.result === '1') {
} else { this.approvalRow(this.currentRow);
this.$message.error('请选择审批结果'); } else if (this.examineForm.result === '2') {
} this.rejectRow(this.currentRow);
}
}
});
}, },
// //
removeRow(row) { removeRow(row) {
@ -408,10 +436,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'success', type: 'success',
}).then(() => { }).then(() => {
approvalBsEfficiencyTask({ id: row.id, remark: this.opinion }).then(res => { approvalBsEfficiencyTask({ id: row.id, remark: this.examineForm.remark }).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.$message.success('审批通过成功'); this.$message.success('审批通过成功');
this.showExamine = false; this.closeExamine();
this.onLoad(); this.onLoad();
} else { } else {
this.$message.error('审批通过失败'); this.$message.error('审批通过失败');
@ -426,10 +454,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}).then(() => { }).then(() => {
rejectBsEfficiencyTask({ id: row.id, remark: this.opinion }).then(res => { rejectBsEfficiencyTask({ id: row.id, remark: this.examineForm.remark }).then(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
this.$message.success('审批不通过成功'); this.$message.success('审批不通过成功');
this.showExamine = false; this.closeExamine();
this.onLoad(); this.onLoad();
} else { } else {
this.$message.error('审批不通过失败'); this.$message.error('审批不通过失败');

Loading…
Cancel
Save