【发布时间】:2021-10-18 05:31:15
【问题描述】:
所以这是我刚刚从 SQL 数据库中获得的 javascript 对象数据:
0: {ww: "2021-27", area: "F15 WET PROCESS", dissection_name: "WAIT_OTHERS", waiting_time: 5.3670104041}
1: {ww: "2021-26", area: "F15 METROLOGY", dissection_name: "DELIVERY_TIME", waiting_time: 0}
2: {ww: "2021-26", area: "F15 WET PROCESS", dissection_name: "WAIT_FOR_START_RUNNING", waiting_time: 0.1858817617}
3: {ww: "2021-25", area: "F15 CMP", dissection_name: "BATCH_WAIT_TIME", waiting_time: 0}
4: {ww: "2021-25", area: "F15 GENERAL", dissection_name: "WAIT_OTHERS", waiting_time: 0.0326702424}
5: {ww: "2021-27", area: "F15 DRY ETCH", dissection_name: "DELIVERY_TIME", waiting_time: 0}
6: {ww: "2021-27", area: "F15 DIFFUSION", dissection_name: "BATCH_WAIT_TIME", waiting_time: 1.544808954}
7: {ww: "2021-24", area: "F15 METROLOGY", dissection_name: "WAIT_FOR_START_RUNNING", waiting_time: 0.0270019481}
8: {ww: "2021-24", area: "F15 PHOTO", dissection_name: "BATCH_WAIT_TIME", waiting_time: 0.0001341795}
9: {ww: "2021-24", area: "F15 DRY ETCH", dissection_name: "DELIVERY_TIME", waiting_time: 0}
我想对其进行一些操作,以便每个数据块的“waiting_time”列名将更改为它的“ww”值,以像这样转换对象结构:
0: {area: "F15 WET PROCESS", dissection_name: "WAIT_OTHERS", 2021-27: 5.3670104041}
1: { area: "F15 METROLOGY", dissection_name: "DELIVERY_TIME", 2021-27: 0}
2: { area: "F15 WET PROCESS", dissection_name: "WAIT_FOR_START_RUNNING", 2021-26: 0.1858817617}
3: { area: "F15 CMP", dissection_name: "BATCH_WAIT_TIME", 2021-26: 0}
4: { area: "F15 GENERAL", dissection_name: "WAIT_OTHERS", 2021-25: 0.0326702424}
5: { area: "F15 DRY ETCH", dissection_name: "DELIVERY_TIME", 2021-25: 0}
6: {area: "F15 DIFFUSION", dissection_name: "BATCH_WAIT_TIME", 2021-24: 1.544808954}
7: { area: "F15 METROLOGY", dissection_name: "WAIT_FOR_START_RUNNING", 2021-24: 0.0270019481}
8: { area: "F15 PHOTO", dissection_name: "BATCH_WAIT_TIME", 2021-23: 0.0001341795}
9: { area: "F15 DRY ETCH", dissection_name: "DELIVERY_TIME", 2021-23: 0}
最终目标实际上是将转换后的数据加载到这样的角度 ag-grid 表中:
表格示例:
area dissection_name 2021-24 2021-25 2021-26 2021-27
xxx xxx 0 1.55 2.33 5.3670
xxx xxx xxx xxx xxx xxx
有没有办法做到这一点?谢谢
【问题讨论】:
标签: javascript sql angular object ag-grid