Issue #97: Done.

This commit is contained in:
chiayin
2023-09-21 12:04:58 +08:00
parent bcda6345c6
commit 0d930238dd

View File

@@ -116,11 +116,13 @@ export default {
}, },
columnData: function() { columnData: function() {
const data = JSON.parse(JSON.stringify(this.cases)); // 深拷貝原始 cases 的內容 const data = JSON.parse(JSON.stringify(this.cases)); // 深拷貝原始 cases 的內容
const facetName = facName => facName.trim().replace(/^(.)(.*)$/, (match, firstChar, restOfString) => firstChar.toUpperCase() + restOfString.toLowerCase());
const result = [ const result = [
{ field: 'id', header: 'Case Id' }, { field: 'id', header: 'Case Id' },
{ field: 'started_at', header: 'Start Date' }, { field: 'started_at', header: 'Start Date' },
{ field: 'completed_at', header: 'End Date' }, { field: 'completed_at', header: 'End Date' },
...data[0].facets.map((fac, index) => ({ field: `fac_${index}`, header: fac.name })), ...data[0].facets.map((fac, index) => ({ field: `fac_${index}`, header: facetName(fac.name) })),
...data[0].attributes.map((att, index) => ({ field: `att_${index}`, header: att.key })), ...data[0].attributes.map((att, index) => ({ field: `att_${index}`, header: att.key })),
]; ];
return result return result