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

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

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

@ -40,7 +40,7 @@
</template>
<template #menu="scope">
<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"
@click="downloadTask(scope.row)"
>
@ -92,24 +92,13 @@
:showDetail="showDetail"
@closeDetail="closeDetail"
:row="currentRow"
:type="'1'"
/>
<el-dialog append-to-body title="审批" v-model="showExamine" width="85%">
<div style="margin-top: 20px">
<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>
<avue-form :option="examineOption" v-model="examineForm" ref="examineForm" />
<template #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>
</span>
</template>
@ -151,6 +140,33 @@ export default {
currentRow: null,
showDetail: 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,
data: [],
form: {},
@ -171,7 +187,7 @@ export default {
searchMenuSpan: 12,
searchIcon: true,
searchIndex: 3,
tree: false,
tree: true,
treeProps: {
children: 'subTasks',
hasChildren: 'hasChildren',
@ -373,16 +389,28 @@ export default {
});
});
},
//
closeExamine() {
this.showExamine = false;
//
this.examineForm = {
result: '',
remark: '',
};
},
//
handleApproval() {
if (!this.currentRow) return;
if (this.resultValue === '1') {
//
this.$refs.examineForm.validate(valid => {
if (valid) {
if (this.examineForm.result === '1') {
this.approvalRow(this.currentRow);
} else if (this.resultValue === '2') {
} else if (this.examineForm.result === '2') {
this.rejectRow(this.currentRow);
} else {
this.$message.error('请选择审批结果');
}
}
});
},
//
removeRow(row) {
@ -408,10 +436,10 @@ export default {
cancelButtonText: '取消',
type: 'success',
}).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) {
this.$message.success('审批通过成功');
this.showExamine = false;
this.closeExamine();
this.onLoad();
} else {
this.$message.error('审批通过失败');
@ -426,10 +454,10 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).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) {
this.$message.success('审批不通过成功');
this.showExamine = false;
this.closeExamine();
this.onLoad();
} else {
this.$message.error('审批不通过失败');

Loading…
Cancel
Save