Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

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