Export Excel operation and create a new routing file: /apis/utils.http.json
The code is as follows:
{"name": "Download Excel","version": "1.0.0","description": "Download Excel","group": "utils","guard": "-","paths": [{"guard": "-","path": "/export/:name","method": "GET","process": "flows.utils.export","in": ["$param.name"],"out": {"status": 200,"type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","headers": {"Content-Disposition": "attachment;filename=export data.xlsx"}}}]}
New file: /flows/utils/export.flow.json
The code is as follows:
{"label": "Download","version": "1.0.0","description": "Download","nodes": [{"name": "file","process": "xiang.table.Export","args": ["{{$in.0}}", {}, 20]},{"name": "Data","process": "xiang.fs.ReadFile","args": ["{{$res.file}}", false]}],"output": "{{$res.data.content}}"}
If there is a table named: /tables/pet.tab.json
, to export the list data of the table only need to request: /utils/export/pet
Export Excel operation and create a new routing file: /apis/utils.http.json
The code is as follows:
{"name": "Download Excel","version": "1.0.0","description": "Download Excel","group": "utils","guard": "-","paths": [{"guard": "-","path": "/export/:name","method": "GET","process": "flows.utils.export","in": ["$param.name"],"out": {"status": 200,"type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","headers": {"Content-Disposition": "attachment;filename=export data.xlsx"}}}]}
New file: /flows/utils/export.flow.json
The code is as follows:
{"label": "Download","version": "1.0.0","description": "Download","nodes": [{"name": "file","process": "xiang.table.Export","args": ["{{$in.0}}", {}, 20]},{"name": "Data","process": "xiang.fs.ReadFile","args": ["{{$res.file}}", false]}],"output": "{{$res.data.content}}"}
If there is a table named: /tables/pet.tab.json
, to export the list data of the table only need to request: /utils/export/pet