您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

135 行
4.6 KiB

  1. // material-ui
  2. import {
  3. Grid,
  4. Typography,
  5. Stack
  6. } from '@mui/material';
  7. import MainCard from "components/MainCard";
  8. import * as React from "react";
  9. import * as HttpUtils from "utils/HttpUtils";
  10. import * as DateUtils from "utils/DateUtils";
  11. import {GET_ORG_COMBO, GET_ISSUE_COMBO} from "utils/ApiPathConst";
  12. import { getSearchCriteria } from "auth/utils";
  13. import Loadable from 'components/Loadable';
  14. const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
  15. const SearchForm = Loadable(React.lazy(() => import('./SearchForm')));
  16. const EventTable = Loadable(React.lazy(() => import('./DataGrid')));
  17. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  18. const BackgroundHead = {
  19. backgroundImage: `url(${titleBackgroundImg})`,
  20. width: '100%',
  21. height: '100%',
  22. backgroundSize: 'contain',
  23. backgroundRepeat: 'no-repeat',
  24. backgroundColor: '#0C489E',
  25. backgroundPosition: 'right'
  26. }
  27. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  28. const UserSearchPage_Individual = () => {
  29. const [orgCombo, setOrgCombo] = React.useState([]);
  30. const [issueCombo, setIssueCombo] = React.useState([]);
  31. const [searchCriteria, setSearchCriteria] = React.useState({});
  32. const [onReady, setOnReady] = React.useState(false);
  33. const [onGridReady, setGridOnReady] = React.useState(false);
  34. React.useEffect(() => {
  35. getOrgCombo();
  36. getIssueCombo();
  37. if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){
  38. setSearchCriteria(getSearchCriteria(window.location.pathname))
  39. }else{
  40. localStorage.setItem('searchCriteria',"")
  41. setSearchCriteria({
  42. dateTo: DateUtils.dateValue(new Date()),
  43. dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)),
  44. })
  45. }
  46. }, []);
  47. React.useEffect(() => {
  48. setOnReady(true);
  49. }, [searchCriteria]);
  50. function getOrgCombo() {
  51. HttpUtils.get({
  52. url: GET_ORG_COMBO,
  53. onSuccess: function (responseData) {
  54. let combo = responseData;
  55. setOrgCombo(combo);
  56. }
  57. });
  58. }
  59. function getIssueCombo() {
  60. HttpUtils.get({
  61. url: GET_ISSUE_COMBO,
  62. onSuccess: function (responseData) {
  63. let combo = responseData;
  64. setIssueCombo(combo);
  65. }
  66. });
  67. }
  68. function applySearch(input) {
  69. setGridOnReady(true)
  70. setSearchCriteria(input);
  71. localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:input}))
  72. }
  73. function applyGridOnReady(input) {
  74. setGridOnReady(input);
  75. }
  76. return (
  77. !onReady ?
  78. <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center">
  79. <Grid item>
  80. <LoadingComponent />
  81. </Grid>
  82. </Grid>
  83. :
  84. <Grid container sx={{ minHeight: '87vh', backgroundColor: 'backgroundColor.default' }} direction="column">
  85. <Grid item xs={12}>
  86. <div style={BackgroundHead}>
  87. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  88. <Typography ml={15} color='#FFF' variant="h4" sx={{ "textShadow": "0px 0px 25px #0C489E" }}>Proof</Typography>
  89. </Stack>
  90. </div>
  91. </Grid>
  92. {/*row 1*/}
  93. <Grid item xs={12} md={12} lg={12} sx={{mb:-1}}>
  94. <SearchForm
  95. applySearch={applySearch}
  96. orgComboData={orgCombo}
  97. issueComboData={issueCombo}
  98. searchCriteria={searchCriteria}
  99. onGridReady={onGridReady}
  100. />
  101. </Grid>
  102. {/*row 2*/}
  103. <Grid item xs={12} md={12} lg={12}>
  104. <MainCard elevation={0}
  105. border={false}
  106. content={false}
  107. sx={{backgroundColor:"#fff"}}
  108. >
  109. <EventTable
  110. searchCriteria={searchCriteria}
  111. applyGridOnReady={applyGridOnReady}
  112. applySearch={applySearch}
  113. />
  114. </MainCard>
  115. </Grid>
  116. </Grid>
  117. );
  118. };
  119. export default UserSearchPage_Individual;