Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

122 строки
4.1 KiB

  1. import {
  2. Grid,
  3. Typography,
  4. Stack,
  5. // Box,
  6. } from '@mui/material';
  7. import * as React from "react";
  8. import { GET_SYS_PARAMS } from "utils/ApiPathConst";
  9. import Loadable from 'components/Loadable';
  10. import MainCard from "components/MainCard";
  11. const Table = Loadable(React.lazy(() => import('./Table')));
  12. const Form = Loadable(React.lazy(() => import('./Form')));
  13. import { notifyActionSuccess } from 'utils/CommonFunction';
  14. import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
  15. import * as HttpUtils from "utils/HttpUtils";
  16. const BackgroundHead = {
  17. backgroundImage: `url(${titleBackgroundImg})`,
  18. width: '100%',
  19. height: '100%',
  20. backgroundSize: 'contain',
  21. backgroundRepeat: 'no-repeat',
  22. backgroundColor: '#0C489E',
  23. backgroundPosition: 'right'
  24. }
  25. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  26. const SystemSetting = () => {
  27. const [searchCriteria, setSearchCriteria] = React.useState({});
  28. const [selectedItem, setSelectedItem] = React.useState({});
  29. const [reloadTime, setReloadTime] = React.useState(new Date())
  30. React.useEffect(()=>{
  31. setSearchCriteria({})
  32. }, []);
  33. const onRowClick = (param) => {
  34. setSelectedItem(param.row);
  35. }
  36. React.useEffect(() => {
  37. searchCriteria.reloadTime = reloadTime;
  38. setSearchCriteria(searchCriteria);
  39. }, [reloadTime]);
  40. const onSave = (param) => {
  41. HttpUtils.post({
  42. url: GET_SYS_PARAMS + "/update",
  43. params: {
  44. name: param.name,
  45. value: param.value
  46. },
  47. onSuccess: () => {
  48. notifyActionSuccess();
  49. setReloadTime(new Date());
  50. }
  51. });
  52. }
  53. return (
  54. <Grid container sx={{ minHeight: '87vh', backgroundColor: 'backgroundColor.default' }} direction="column"
  55. justifyContent="flex-start">
  56. <>
  57. <Grid item xs={12}>
  58. <div style={BackgroundHead}>
  59. <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">
  60. <Typography ml={15} color='#FFF' variant="h4">System Setting</Typography>
  61. </Stack>
  62. </div>
  63. </Grid>
  64. {/*col 1*/}
  65. <Grid item xs={12} >
  66. <Grid container direction="row" sx={{ p: 2 }} spacing={1} >
  67. <Grid item xs={12} sm={8} md={8} lg={8} >
  68. <Grid container>
  69. <Grid item xs={12} md={12}>
  70. <MainCard elevation={0}
  71. border={false}
  72. content={false}
  73. >
  74. <Table
  75. searchCriteria={searchCriteria}
  76. onRowClick={onRowClick}
  77. />
  78. </MainCard>
  79. </Grid>
  80. </Grid>
  81. </Grid>
  82. <Grid item xs={12} sm={4} md={4} lg={4}>
  83. <Grid container>
  84. <Grid item xs={12} md={12}>
  85. <MainCard elevation={0}
  86. border={false}
  87. content={false}
  88. >
  89. <Form
  90. selectedItem={selectedItem}
  91. onSave={onSave}
  92. />
  93. </MainCard>
  94. </Grid>
  95. </Grid>
  96. </Grid>
  97. </Grid>
  98. </Grid>
  99. {/*col 2*/}
  100. </>
  101. </Grid>
  102. );
  103. };
  104. export default SystemSetting;