trithuc-mvc-react 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/index.js CHANGED
@@ -51,7 +51,11 @@ export const changeStatusDataToTable = async ({ tableName, id }) => {
51
51
  return res.data;
52
52
  };
53
53
 
54
- export const exportExcel = async ({ tableName }) => {
55
- const res = await api.get(`/Admin/${tableName}/ExportData`);
54
+ export const exportExcel = async ({ tableName,data }) => {
55
+ const res = await api.get(`/Admin/${tableName}/ExportData`,{
56
+ params: {
57
+ json: JSON.stringify(data),
58
+ }
59
+ });
56
60
  return res.data;
57
61
  };
@@ -3,25 +3,25 @@ import { exportExcel } from "../../api";
3
3
  import { Button } from "@mui/material";
4
4
  import { Download } from "@mui/icons-material";
5
5
 
6
- const ExportExcelButton = ({ tableName })=>{
7
- const handleExportExcel = async (tableName) => {
8
- const data = await exportExcel({ tableName });
9
- if (data.status) {
10
- window.open(data.url, "_blank").focus();
11
- } else {
12
- toast.error("Xuất file thất bại!");
13
- }
14
- };
15
- return (
16
- <Button
17
- variant="outlined"
18
- startIcon={<Download />}
19
- onClick={() => {
20
- handleExportExcel(tableName);
21
- }}
22
- >
23
- Excel
24
- </Button>
25
- );
6
+ const ExportExcelButton = ({ tableName, data }) => {
7
+ const handleExportExcel = async (tableName, data) => {
8
+ const _data = await exportExcel({ tableName, data });
9
+ if (_data.status) {
10
+ window.open(_data.url, "_blank").focus();
11
+ } else {
12
+ toast.error("Xuất file thất bại!");
13
+ }
14
+ };
15
+ return (
16
+ <Button
17
+ variant="outlined"
18
+ startIcon={<Download />}
19
+ onClick={() => {
20
+ handleExportExcel(tableName);
21
+ }}
22
+ >
23
+ Excel
24
+ </Button>
25
+ );
26
26
  }
27
27
  export default ExportExcelButton;
@@ -80,7 +80,7 @@ function DataManagement({ columns = [], title, tableName, selectedField = "Id",
80
80
  </IconButton>
81
81
  </Tooltip>
82
82
 
83
- <ExportExcelButton tableName={tableName} />
83
+ <ExportExcelButton tableName={tableName} data={dataSearch} />
84
84
  {(!Permission || Permission.Create) && (
85
85
  <Button
86
86
  variant="contained"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"