25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

85 lines
2.3 KiB

  1. // material-ui
  2. import * as React from 'react';
  3. import {FiDataGrid} from "components/FiDataGrid";
  4. import {
  5. Button
  6. } from '@mui/material';
  7. import * as DateUtils from "utils/DateUtils"
  8. // ==============================|| EVENT TABLE ||============================== //
  9. export default function BaseGrid({rows}) {
  10. const columns = [
  11. {
  12. id: 'appNo',
  13. field: 'appNo',
  14. headerName: 'Application No.',
  15. flex: 1,
  16. },
  17. {
  18. id: 'created',
  19. field: 'created',
  20. headerName: 'Created',
  21. flex: 1,
  22. valueGetter:(params)=>{
  23. return DateUtils.datetimeStr(params?.value);
  24. }
  25. },
  26. {
  27. id: 'contactPerson',
  28. field: 'contactPerson',
  29. headerName: 'Contact Person',
  30. flex: 2,
  31. renderCell: (params) => {
  32. let phone = JSON.parse(params.row.contactTelNo);
  33. let faxNo = JSON.parse(params.row.contactFaxNo);
  34. let contact = "";
  35. if (phone) {
  36. contact = "電話: " + phone?.countryCode + " " + phone?.phoneNumber
  37. }
  38. if (faxNo) {
  39. if (contact != "")
  40. contact = contact + ", "
  41. contact = contact + "傳真:" + faxNo?.countryCode + " " + faxNo?.faxNumber
  42. }
  43. return (<>
  44. {params?.value}<br />
  45. {contact}
  46. </>);
  47. }
  48. },
  49. {
  50. id: 'remarks',
  51. field: 'remarks',
  52. headerName: 'remarks',
  53. flex: 3,
  54. },
  55. {
  56. field: 'actions',
  57. type: 'actions',
  58. headerName: '',
  59. width: 50,
  60. cellClassName: 'actions',
  61. renderCell: () => {
  62. return <Button onClick={()=>{}}>查看詳細</Button>;
  63. },
  64. }
  65. ];
  66. return (
  67. <div style={{height:'20%', width: '100%'}}>
  68. <FiDataGrid
  69. rows={rows}
  70. columns={columns}
  71. initialState={{
  72. pagination: {
  73. paginationModel: {page: 0, pageSize: 5},
  74. },
  75. }}
  76. />
  77. </div>
  78. );
  79. }