人效管理-绩效管理-绩效公示-接口对接

dev-scheduling
ysn 2 months ago
parent 5fe2875c46
commit 7e43f907ef
  1. 90
      src/views/personnelEfficiencyManagement/performanceManagement/components/prefDetail.vue
  2. 90
      src/views/personnelEfficiencyManagement/performanceManagement/performanceDisclosure.vue

@ -22,8 +22,12 @@
@refresh-change="refreshChange"
>
<template #menu-right>
<el-button type="primary" @click="downloadDetail">附件下载(明细)</el-button>
<el-button type="primary" @click="downloadSummary">附件下载(汇总)</el-button>
<el-button type="primary" @click="downloadDetail" v-if="type == 1">
附件下载(明细)
</el-button>
<el-button type="primary" @click="downloadSummary" v-if="type == 1">
附件下载(汇总)
</el-button>
</template>
</avue-crud>
</el-dialog>
@ -33,7 +37,7 @@ import {
detailBsEfficiencyTask,
downloadBsEfficiencyTaskTemplate,
} from '@/api/performanceManagement/dataReporting';
import { downloadXls, downloadFile, downloadFileBlob } from '@/utils/util';
import { downloadFileBlob } from '@/utils/util';
export default {
props: {
showDetail: {
@ -44,12 +48,17 @@ export default {
type: Object,
default: () => ({}),
},
type: {
type: String,
default: '1',
},
},
data() {
return {
openShow: false,
loading: false,
form: {},
query: {},
option: {
height: 'auto',
align: 'center',
@ -83,15 +92,12 @@ export default {
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
columnSort: true,
excelBtn: true,
filterBtn: true,
searchShowBtn: true,
columnSort: true,
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'center',
@ -105,19 +111,22 @@ export default {
total: 0,
},
data: [],
columnData: [
{ label: '员工工号', prop: 'cardNo' },
{ label: '姓名', prop: 'name' },
],
rowData: {},
};
},
created() {
this.openShow = this.showDetail;
if (this.type === '2') {
this.query = { yearMonth: this.row.yearMonth || '' };
}
this.onLoad();
},
methods: {
closeDialog(val) {
this.openShow = false;
this.form = {};
this.query = {};
this.data = [];
this.$emit('closeDetail', val);
},
searchChange(params, done) {
@ -132,28 +141,49 @@ export default {
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
this.onLoad();
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
this.onLoad();
},
refreshChange() {
this.onLoad();
},
onLoad() {
this.loading = true;
const params = {
id: this.row.id,
...this.query,
};
detailBsEfficiencyTask(params)
const query =
this.type === '1'
? { id: this.row.id }
: {
employeeCodeExact: this.row.employeeCodeExact || '',
employeeNameExact: this.row.employeeNameExact || '',
status: this.row.status,
};
detailBsEfficiencyTask({ ...query, ...this.query })
.then(res => {
if (res.data.code === 200) {
this.data = res.data.data.table.tableDataList || [];
const arr = res.data.data.table.tableColumn;
arr.push({ ...arr[0], prop: arr[0].prop + 'Exact', hide: true, search: true });
arr.push({ ...arr[1], prop: arr[1].prop + 'Exact', hide: true, search: true });
res.data.data.table.tableColumn = arr.map(item => ({ ...item, sortable: true }));
this.option.column = res.data.data.table.tableColumn;
if (this.type === '1') {
arr.push({ ...arr[0], prop: arr[0].prop + 'Exact', hide: true, search: true });
arr.push({ ...arr[1], prop: arr[1].prop + 'Exact', hide: true, search: true });
} else if (this.type === '2') {
arr.push({
label: '年月',
prop: 'yearMonth',
hide: true,
search: true,
type: 'month',
format: 'YYYY-MM',
valueFormat: 'YYYY-MM',
});
}
this.option.column = arr.map(item => ({
...item,
sortable: true,
}));
this.rowData = res.data.data || {};
} else {
this.data = [];
this.page.total = 0;
@ -167,28 +197,24 @@ export default {
});
},
downloadDetail() {
const completedTasks = this.row.subTasks.filter(task => task.status === 2);
if (!this.row.subTasks || this.row.subTasks.length === 0 || completedTasks.length === 0) {
const completedTasks = this.rowData.subTasks?.filter(task => task.status == 2) || [];
if (completedTasks.length === 0) {
this.$message.warning('暂无可下载文件!');
return;
}
this.row.subTasks.forEach(task => {
if (task.attachLink != '') {
completedTasks.forEach(task => {
if (task.attachLink) {
downloadFileBlob(task.attachLink, task.taskName + '.xlsx');
return;
}
});
},
downloadSummary() {
if (this.row.attachLink == '') {
if (!this.rowData.attachLink) {
this.$message.warning('暂无可下载文件!');
return;
}
downloadFileBlob(this.row.attachLink, this.row.taskName + '.xlsx');
downloadFileBlob(this.rowData.attachLink, this.rowData.taskName + '.xlsx');
},
},
};
</script>
<style>
</style>
</script>

@ -17,16 +17,24 @@
@cell-click="cellClick"
>
</avue-crud>
<prefDetail
v-if="showDetail"
:showDetail="showDetail"
@closeDetail="closeDetail"
:row="currentRow"
:type="'2'"
/>
</basic-container>
</template>
<script>
import { pageBsEfficiencyTaskReport } from '@/api/performanceManagement/performanceDisclosure';
import prefDetail from './components/prefDetail.vue';
export default {
name: 'PerformanceDisclosure',
components: { prefDetail },
data() {
return {
showExcel: false,
monthValue: '',
//
detailList: [],
@ -45,6 +53,8 @@ export default {
const year = new Date().getFullYear();
return time.getFullYear() !== year; //
},
currentRow: null,
showDetail: false,
option: {
height: 'auto',
align: 'center',
@ -106,6 +116,9 @@ export default {
sortable: true,
overHidden: true,
width: 120,
formatter: val => {
return val.employeeName + '(' + val.year + ')';
},
},
{
label: '一月',
@ -223,47 +236,33 @@ export default {
'm11Score',
'm12Score',
];
// if (monthProps.includes(column.property)) {
// const monthMap = {
// january: '01',
// february: '02',
// march: '03',
// april: '04',
// may: '05',
// june: '06',
// july: '07',
// august: '08',
// september: '09',
// october: '10',
// november: '11',
// december: '12',
// };
// const currentYear = new Date().getFullYear();
// this.monthValue = `${currentYear}-${monthMap[column.property]}`;
this.showExcel = true;
// }
},
//
async queryPerformance() {
if (!this.monthValue) {
this.$message.warning('请选择月份');
return;
}
this.loading = true;
try {
//
// const res = await getPerformanceDetail({ month: this.monthValue });
// this.detailList = res.data || [];
// /
this.detailList = [];
} finally {
this.loading = false;
if (monthProps.includes(column.property)) {
const monthMap = {
m01Score: '01',
m02Score: '02',
m03Score: '03',
m04Score: '04',
m05Score: '05',
m06Score: '06',
m07Score: '07',
m08Score: '08',
m09Score: '09',
m10Score: '10',
m11Score: '11',
m12Score: '12',
};
this.currentRow = {
employeeCodeExact: row.employeeCode,
employeeNameExact: row.employeeName,
yearMonth: `${row.year}-${monthMap[column.property]}`,
status: 4,
};
this.showDetail = true;
}
},
closeDetail(val) {
this.showDetail = false;
},
// //
currentChange(currentPage) {
this.page.currentPage = currentPage;
@ -299,7 +298,16 @@ export default {
};
const res = await pageBsEfficiencyTaskReport(params);
if (res.data.code === 200) {
this.data = res.data.data.records || [];
this.data = (res.data.data.records || []).map(record => {
// 1-12-10
for (let i = 1; i <= 12; i++) {
const monthProp = `m${i.toString().padStart(2, '0')}Score`;
if (record[monthProp] === -1) {
record[monthProp] = '';
}
}
return record;
});
this.page.total = res.data.data.total || 0;
}
} catch (error) {

Loading…
Cancel
Save