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.

​
​
​
​
​
​
​
​
​
​
​
​
vor 2 Jahren
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
vor 2 Jahren
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
vor 2 Jahren
​
​
​
vor 2 Jahren
vor 2 Jahren
​
vor 2 Jahren
​
​
​
​
​
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // material-ui
  2. import {
  3. Autocomplete,
  4. TextField,
  5. Typography
  6. } from '@mui/material';
  7. import MainCard from "components/MainCard";
  8. import * as React from "react";
  9. import { FiDataGrid } from "components/FiDataGrid";
  10. import { GET_SYS_PARAMS, GET_SYS_PARAM_NAMES } from "utils/ApiPathConst";
  11. import SafeHtml from 'components/SafeHtml';
  12. import * as HttpUtils from "utils/HttpUtils";
  13. import { useIntl } from "react-intl";
  14. const LANG_SUFFIX = /\.(en|zh|cn)$/i;
  15. function toSearchKey(name) {
  16. return String(name || "").replace(LANG_SUFFIX, "");
  17. }
  18. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  19. const Table = ({onRowClick, searchCriteria, refreshTrigger}) => {
  20. const intl = useIntl();
  21. const [_searchCriteria, set_searchCriteria] = React.useState(searchCriteria);
  22. const [nameOptions, setNameOptions] = React.useState([]);
  23. const [selectedName, setSelectedName] = React.useState("");
  24. React.useEffect(() => {
  25. HttpUtils.get({
  26. url: GET_SYS_PARAM_NAMES,
  27. onSuccess: (responseData) => {
  28. const keys = (Array.isArray(responseData) ? responseData : [])
  29. .map((item) => toSearchKey(item?.label ?? item))
  30. .filter(Boolean);
  31. setNameOptions([...new Set(keys)].sort((a, b) => a.localeCompare(b)));
  32. }
  33. });
  34. }, []);
  35. React.useEffect(() => {
  36. const next = { ...searchCriteria };
  37. if (selectedName) {
  38. next.name = selectedName;
  39. } else {
  40. delete next.name;
  41. }
  42. set_searchCriteria(next);
  43. }, [searchCriteria, selectedName]);
  44. const columns = [
  45. {
  46. field: 'name',
  47. headerName: 'Name',
  48. width: 300,
  49. },
  50. {
  51. id: 'type',
  52. field: 'type',
  53. headerName: 'Type',
  54. width: 150,
  55. valueGetter: (params) => {
  56. return params.row.type
  57. }
  58. },
  59. {
  60. id: 'category',
  61. field: 'category',
  62. headerName: 'Category',
  63. width: 150,
  64. },
  65. {
  66. id: 'value',
  67. field: 'value',
  68. headerName: 'Value',
  69. flex: 1,
  70. minWidth: 400,
  71. renderCell:(params)=>{
  72. return <SafeHtml html={params.value} />
  73. }
  74. },
  75. ];
  76. return (
  77. <MainCard elevation={0}
  78. border={false}
  79. content={false}
  80. height='100%'
  81. >
  82. <Typography variant="h5" sx={{mt: 3, ml: 3, mr: 3, borderBottom: "1px solid black"}}>
  83. System Params
  84. </Typography>
  85. <Autocomplete
  86. disablePortal
  87. options={nameOptions}
  88. value={selectedName || null}
  89. onChange={(event, newValue) => {
  90. setSelectedName(newValue || "");
  91. }}
  92. getOptionLabel={(option) => (option != null ? String(option) : "")}
  93. isOptionEqualToValue={(option, value) => String(option) === String(value)}
  94. sx={{
  95. mt: 2,
  96. ml: 3,
  97. mr: 3,
  98. maxWidth: 480,
  99. '& .MuiInputBase-root': { alignItems: 'center' },
  100. '& .MuiAutocomplete-endAdornment': { top: '50%', transform: 'translateY(-50%)' },
  101. '& .MuiOutlinedInput-root': { height: 40 }
  102. }}
  103. renderInput={(params) => (
  104. <TextField
  105. {...params}
  106. label={intl.formatMessage({ id: "systemSettingName" })}
  107. InputLabelProps={{ shrink: true }}
  108. />
  109. )}
  110. clearText={intl.formatMessage({ id: "muiClear" })}
  111. closeText={intl.formatMessage({ id: "muiClose" })}
  112. openText={intl.formatMessage({ id: "muiOpen" })}
  113. noOptionsText={intl.formatMessage({ id: "muiNoOptions" })}
  114. />
  115. <div style={{ width: { xs: '92vw', sm: '96.5vw', md: "auto" }, }}>
  116. {/* <Box width= '100%' sx={{ backgroundColor: "#fff", ml: 2 }} height='100%'> */}
  117. <FiDataGrid
  118. columns={columns}
  119. customPageSize={10}
  120. getRowHeight={() => 'auto'}
  121. onRowClick={onRowClick}
  122. doLoad={React.useMemo(() => ({
  123. url:GET_SYS_PARAMS,
  124. params:_searchCriteria
  125. }), [_searchCriteria, refreshTrigger])}
  126. />
  127. {/* </Box> */}
  128. </div>
  129. </MainCard>
  130. );
  131. };
  132. export default Table;