diff --git a/src/pages/Proof/Search_Public/DataGrid.js b/src/pages/Proof/Search_Public/DataGrid.js index c70e17f..edcf348 100644 --- a/src/pages/Proof/Search_Public/DataGrid.js +++ b/src/pages/Proof/Search_Public/DataGrid.js @@ -1,7 +1,7 @@ // material-ui import * as React from 'react'; import { - Button + Button, useMediaQuery } from '@mui/material'; import * as DateUtils from "utils/DateUtils"; import * as FormatUtils from "utils/FormatUtils" @@ -11,11 +11,14 @@ import { FiDataGrid } from "components/FiDataGrid"; import { isORGLoggedIn, } from "utils/Utils"; +import {useTheme} from "@emotion/react"; // ==============================|| EVENT TABLE ||============================== // export default function SearchPublicNoticeTable({ recordList }) { const [rows, setRows] = React.useState(recordList); const navigate = useNavigate() + const theme = useTheme(); + const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); const _sx = { padding: "4 2 4 2", @@ -63,7 +66,8 @@ export default function SearchPublicNoticeTable({ recordList }) { { field: 'actions', headerName: '校對編號', - width: 250, + width: isMdOrLg ? 'auto' : 250, + flex: isMdOrLg ? 1.5 : undefined, cellClassName: 'actions', renderCell: (params) => { return ; @@ -73,7 +77,8 @@ export default function SearchPublicNoticeTable({ recordList }) { id: 'appId', field: 'appId', headerName: isORGLoggedIn()?"憲報期數 / Care Of/ 我的備註":"憲報期數 / 我的備註", - flex: 1, + width: isMdOrLg ? 'auto' : 160, + flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { // let appNo = params.row.appNo; // let code = params.row.groupNo; @@ -90,7 +95,8 @@ export default function SearchPublicNoticeTable({ recordList }) { id: 'created', field: 'created', headerName: '校對日期', - width: 250, + width: isMdOrLg ? 'auto' : 250, + flex: isMdOrLg ? 1.5 : undefined, valueGetter: (params) => { return DateUtils.datetimeStr(params?.value); } @@ -99,7 +105,8 @@ export default function SearchPublicNoticeTable({ recordList }) { id: 'returnBeforeDate', field: 'returnBeforeDate', headerName: '此日期前回覆', - width: 250, + width: isMdOrLg ? 'auto' : 250, + flex: isMdOrLg ? 1.5 : undefined, valueGetter: (params) => { let returnBeforeDate = DateUtils.convertToDate(params?.value); returnBeforeDate = returnBeforeDate.setHours(14, 0, 0, 0); @@ -110,7 +117,8 @@ export default function SearchPublicNoticeTable({ recordList }) { id: 'replyDate', field: 'replyDate', headerName: '回覆日期', - width: 250, + width: isMdOrLg ? 'auto' : 250, + flex: isMdOrLg ? 1.5 : undefined, valueGetter: (params) => { return params?.value ? DateUtils.datetimeStr(params?.value) : ""; } @@ -118,7 +126,8 @@ export default function SearchPublicNoticeTable({ recordList }) { { id: 'actions', headerName: '狀態', - flex: 1, + width: isMdOrLg ? 'auto' : 160, + flex: isMdOrLg ? 1 : undefined, renderCell: (params) => { return ProofStatus.getStatus_Cht(params); }, @@ -127,7 +136,8 @@ export default function SearchPublicNoticeTable({ recordList }) { id: 'fee', field: 'fee', headerName: '費用', - width: 250, + width: isMdOrLg ? 'auto' : 250, + flex: isMdOrLg ? 1.5 : undefined, valueGetter: (params) => { return (params?.value) ? "$ " + FormatUtils.currencyFormat(params?.value) : ""; } @@ -139,10 +149,9 @@ export default function SearchPublicNoticeTable({ recordList }) { } return ( -