fix(frontend): allow evidence export for aggregate growth view
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
:value="person.extPartyId"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button :icon="Download" :disabled="!evidence || !extPartyId.trim()" @click="exportEvidenceCsv">导出证据包</el-button>
|
||||
<el-button :icon="Download" :disabled="!evidence" @click="exportEvidenceCsv">导出证据包</el-button>
|
||||
<el-button type="danger" :icon="Refresh" :loading="loading" @click="loadAll">刷新</el-button>
|
||||
</div>
|
||||
</section>
|
||||
@@ -237,13 +237,13 @@ const appendCsvRow = (rows: string[], ...values: unknown[]) => {
|
||||
};
|
||||
|
||||
const exportEvidenceCsv = () => {
|
||||
const party = extPartyId.value.trim();
|
||||
if (!evidence.value || !party) {
|
||||
ElMessage.warning('请先选择或输入员工');
|
||||
const party = extPartyId.value.trim() || evidence.value?.extPartyId?.trim() || 'all';
|
||||
if (!evidence.value) {
|
||||
ElMessage.warning('证据包数据加载后才能导出');
|
||||
return;
|
||||
}
|
||||
const rows: string[] = [];
|
||||
const personName = selectedPerson.value?.personName || party;
|
||||
const personName = selectedPerson.value?.personName || (party === 'all' ? '全部员工' : party);
|
||||
appendCsvRow(rows, 'section', 'field', 'value');
|
||||
appendCsvRow(rows, 'summary', 'employee', personName);
|
||||
appendCsvRow(rows, 'summary', 'ext_party_id', party);
|
||||
@@ -253,11 +253,17 @@ const exportEvidenceCsv = () => {
|
||||
appendCsvRow(rows, 'summary', 'contribution', evidence.value.contribution);
|
||||
appendCsvRow(rows, 'summary', 'completed', evidence.value.completed);
|
||||
appendCsvRow(rows, 'summary', 'pending_review', evidence.value.pendingReview);
|
||||
profile.value?.growthPath.forEach((stage) => appendCsvRow(rows, 'growth_path', `${stage.level} ${stage.status}`, `${stage.progress}% ${stage.evidence}`));
|
||||
profile.value?.growthPath.forEach((stage) =>
|
||||
appendCsvRow(rows, 'growth_path', `${stage.level} ${stage.status}`, `${stage.progress}% ${stage.evidence}`)
|
||||
);
|
||||
evidence.value.dimensions.forEach((item) => appendCsvRow(rows, 'dimension', item.label, `${item.value} ${item.note}`));
|
||||
evidence.value.evidenceItems.forEach((item, index) => appendCsvRow(rows, 'evidence_item', index + 1, item));
|
||||
evidence.value.latestRecords.forEach((item) => appendCsvRow(rows, 'latest_record', item.scene, `${item.score} ${item.status} ${item.time} ${item.summary}`));
|
||||
evidence.value.assignments.forEach((item) => appendCsvRow(rows, 'assignment', item.scenarioName, `${item.status} ${item.createTime} ${item.reason}`));
|
||||
evidence.value.latestRecords.forEach((item) =>
|
||||
appendCsvRow(rows, 'latest_record', item.scene, `${item.score} ${item.status} ${item.time} ${item.summary}`)
|
||||
);
|
||||
evidence.value.assignments.forEach((item) =>
|
||||
appendCsvRow(rows, 'assignment', item.scenarioName, `${item.status} ${item.createTime} ${item.reason}`)
|
||||
);
|
||||
FileSaver.saveAs(new Blob([`\uFEFF${rows.join('\n')}`], { type: 'text/csv;charset=utf-8' }), `aihr-promotion-evidence-${party}.csv`);
|
||||
ElMessage.success('成长证据包 CSV 已导出');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user