|
|
|
|
@ -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, |
|
|
|
|
const query = |
|
|
|
|
this.type === '1' |
|
|
|
|
? { id: this.row.id } |
|
|
|
|
: { |
|
|
|
|
employeeCodeExact: this.row.employeeCodeExact || '', |
|
|
|
|
employeeNameExact: this.row.employeeNameExact || '', |
|
|
|
|
status: this.row.status, |
|
|
|
|
}; |
|
|
|
|
detailBsEfficiencyTask(params) |
|
|
|
|
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; |
|
|
|
|
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 }); |
|
|
|
|
res.data.data.table.tableColumn = arr.map(item => ({ ...item, sortable: true })); |
|
|
|
|
this.option.column = res.data.data.table.tableColumn; |
|
|
|
|
} 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> |