Compare commits
No commits in common. "d5738ca35d973c5d587c7e616bd5ab17b4c574fd" and "bdc91f4f8b46f9927e9407011bda780cde54248b" have entirely different histories.
d5738ca35d
...
bdc91f4f8b
|
|
@ -9,11 +9,6 @@ backend/src/main/resources/application-local.yml
|
||||||
*.log
|
*.log
|
||||||
!backend/.env.example
|
!backend/.env.example
|
||||||
.omx/
|
.omx/
|
||||||
/backend/target/
|
|
||||||
/.idea
|
|
||||||
/.vscode
|
|
||||||
/.codegraph
|
|
||||||
/.agents
|
|
||||||
/backend/.env.example
|
/backend/.env.example
|
||||||
/backend/.mvn-settings-ali.xml
|
/backend/.mvn-settings-ali.xml
|
||||||
/backend/.mvn-settings-codex.xml
|
/backend/.mvn-settings-codex.xml
|
||||||
|
|
|
||||||
|
|
@ -427,14 +427,7 @@
|
||||||
"paramKeyPlaceholder": "sys.config.example",
|
"paramKeyPlaceholder": "sys.config.example",
|
||||||
"paramValuePlaceholder": "Enter parameter value",
|
"paramValuePlaceholder": "Enter parameter value",
|
||||||
"systemHint": "System parameters are usually protected from deletion and used directly by the platform.",
|
"systemHint": "System parameters are usually protected from deletion and used directly by the platform.",
|
||||||
"descriptionPlaceholder": "Describe the purpose of this parameter",
|
"descriptionPlaceholder": "Describe the purpose of this parameter"
|
||||||
"numberPlaceholder": "Enter a number",
|
|
||||||
"numberInvalid": "Please enter a valid number",
|
|
||||||
"booleanTrue": "Yes",
|
|
||||||
"booleanFalse": "No",
|
|
||||||
"jsonPlaceholder": "{ \"key\": \"value\" }",
|
|
||||||
"jsonFormat": "Format",
|
|
||||||
"jsonInvalid": "Invalid JSON, please check the syntax"
|
|
||||||
},
|
},
|
||||||
"orgsExt": {
|
"orgsExt": {
|
||||||
"enabled": "Enabled",
|
"enabled": "Enabled",
|
||||||
|
|
|
||||||
|
|
@ -425,14 +425,7 @@
|
||||||
"paramKeyPlaceholder": "sys.config.example",
|
"paramKeyPlaceholder": "sys.config.example",
|
||||||
"paramValuePlaceholder": "请输入参数值",
|
"paramValuePlaceholder": "请输入参数值",
|
||||||
"systemHint": "系统参数通常受保护,并会被平台直接使用。",
|
"systemHint": "系统参数通常受保护,并会被平台直接使用。",
|
||||||
"descriptionPlaceholder": "请描述该参数的用途",
|
"descriptionPlaceholder": "请描述该参数的用途"
|
||||||
"numberPlaceholder": "请输入数字",
|
|
||||||
"numberInvalid": "请输入有效的数字",
|
|
||||||
"booleanTrue": "是",
|
|
||||||
"booleanFalse": "否",
|
|
||||||
"jsonPlaceholder": "{ \"key\": \"value\" }",
|
|
||||||
"jsonFormat": "格式化",
|
|
||||||
"jsonInvalid": "JSON 格式不正确,请检查"
|
|
||||||
},
|
},
|
||||||
"orgsExt": {
|
"orgsExt": {
|
||||||
"enabled": "启用",
|
"enabled": "启用",
|
||||||
|
|
|
||||||
|
|
@ -776,7 +776,7 @@ const Meetings: React.FC = () => {
|
||||||
render: (text: string) => <Text type="secondary">{text || "未知"}</Text>,
|
render: (text: string) => <Text type="secondary">{text || "未知"}</Text>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "来源",
|
title: "鏉ユ簮",
|
||||||
dataIndex: "meetingSource",
|
dataIndex: "meetingSource",
|
||||||
key: "meetingSource",
|
key: "meetingSource",
|
||||||
width: 80,
|
width: 80,
|
||||||
|
|
@ -789,7 +789,7 @@ const Meetings: React.FC = () => {
|
||||||
render: (text: string) => <Text type="secondary" ellipsis style={{ maxWidth: 180 }}>{text || "无参会人员"}</Text>,
|
render: (text: string) => <Text type="secondary" ellipsis style={{ maxWidth: 180 }}>{text || "无参会人员"}</Text>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "鎿嶄綔",
|
||||||
key: "action",
|
key: "action",
|
||||||
width: 220,
|
width: 220,
|
||||||
render: (_: unknown, record: MeetingVO) => (
|
render: (_: unknown, record: MeetingVO) => (
|
||||||
|
|
|
||||||
|
|
@ -31,21 +31,3 @@
|
||||||
.param-type-tag {
|
.param-type-tag {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.param-boolean-segmented {
|
|
||||||
.ant-segmented-item-selected {
|
|
||||||
background: var(--app-primary-color) !important;
|
|
||||||
color: #fff !important;
|
|
||||||
box-shadow: 0 2px 6px rgba(22, 119, 255, 0.35);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-segmented-item {
|
|
||||||
color: var(--app-text-secondary, rgba(0, 0, 0, 0.65));
|
|
||||||
transition: all 0.2s;
|
|
||||||
|
|
||||||
&:hover:not(.ant-segmented-item-selected) {
|
|
||||||
color: var(--app-primary-color);
|
|
||||||
background: rgba(22, 119, 255, 0.06);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, Card, Col, Drawer, Form, Input, Popconfirm, Row, Segmented, Select, Space, Switch, Tag, Tooltip, Typography, message } from "antd";
|
import { Button, Card, Col, Drawer, Form, Input, Popconfirm, Row, Select, Space, Switch, Tag, Tooltip, Typography, message } from "antd";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { DeleteOutlined, EditOutlined, InfoCircleOutlined, PlusOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
import { DeleteOutlined, EditOutlined, InfoCircleOutlined, PlusOutlined, SearchOutlined, SettingOutlined } from "@ant-design/icons";
|
||||||
|
|
@ -14,10 +14,6 @@ import "./index.less";
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
/** Normalize paramType to title-case for case-insensitive comparison */
|
|
||||||
const isType = (actual: string | undefined, expected: string) =>
|
|
||||||
(actual || "").toLowerCase() === expected.toLowerCase();
|
|
||||||
|
|
||||||
export default function SysParams() {
|
export default function SysParams() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { can } = usePermission();
|
const { can } = usePermission();
|
||||||
|
|
@ -30,54 +26,8 @@ export default function SysParams() {
|
||||||
const [queryParams, setQueryParams] = useState<SysParamQuery>({ pageNum: 1, pageSize: 10 });
|
const [queryParams, setQueryParams] = useState<SysParamQuery>({ pageNum: 1, pageSize: 10 });
|
||||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||||
const [editing, setEditing] = useState<SysParamVO | null>(null);
|
const [editing, setEditing] = useState<SysParamVO | null>(null);
|
||||||
const [jsonError, setJsonError] = useState<string | null>(null);
|
|
||||||
const [searchForm] = Form.useForm<SysParamQuery>();
|
const [searchForm] = Form.useForm<SysParamQuery>();
|
||||||
const [drawerForm] = Form.useForm<SysParamVO>();
|
const [drawerForm] = Form.useForm<SysParamVO>();
|
||||||
const paramType = Form.useWatch("paramType", drawerForm) as string | undefined;
|
|
||||||
|
|
||||||
const valueRules = (() => {
|
|
||||||
const required = [{ required: true, message: t("sysParams.paramValue") }];
|
|
||||||
if (isType(paramType, "Number")) {
|
|
||||||
return [
|
|
||||||
...required,
|
|
||||||
{
|
|
||||||
validator: (_: unknown, value: string) =>
|
|
||||||
value === "" || value == null || !Number.isNaN(Number(value))
|
|
||||||
? Promise.resolve()
|
|
||||||
: Promise.reject(new Error(t("sysParamsExt.numberInvalid")))
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
if (isType(paramType, "JSON")) {
|
|
||||||
return [
|
|
||||||
...required,
|
|
||||||
{
|
|
||||||
validator: (_: unknown, value: string) => {
|
|
||||||
if (value === "" || value == null) return Promise.resolve();
|
|
||||||
try {
|
|
||||||
JSON.parse(value);
|
|
||||||
return Promise.resolve();
|
|
||||||
} catch {
|
|
||||||
return Promise.reject(new Error(t("sysParamsExt.jsonInvalid")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
return required;
|
|
||||||
})();
|
|
||||||
|
|
||||||
const formatJson = () => {
|
|
||||||
const raw = drawerForm.getFieldValue("paramValue");
|
|
||||||
if (!raw) return;
|
|
||||||
try {
|
|
||||||
const parsed = JSON.parse(raw);
|
|
||||||
drawerForm.setFieldValue("paramValue", JSON.stringify(parsed, null, 2));
|
|
||||||
setJsonError(null);
|
|
||||||
} catch {
|
|
||||||
setJsonError(t("sysParamsExt.jsonInvalid"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const loadData = useCallback(async (query = queryParams) => {
|
const loadData = useCallback(async (query = queryParams) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
@ -110,15 +60,13 @@ export default function SysParams() {
|
||||||
|
|
||||||
const openCreate = () => {
|
const openCreate = () => {
|
||||||
setEditing(null);
|
setEditing(null);
|
||||||
setJsonError(null);
|
|
||||||
drawerForm.resetFields();
|
drawerForm.resetFields();
|
||||||
drawerForm.setFieldsValue({ isSystem: 0, status: 1 });
|
drawerForm.setFieldsValue({isSystem: 0, status: 1});
|
||||||
setDrawerOpen(true);
|
setDrawerOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const openEdit = (record: SysParamVO) => {
|
const openEdit = (record: SysParamVO) => {
|
||||||
setEditing(record);
|
setEditing(record);
|
||||||
setJsonError(null);
|
|
||||||
drawerForm.resetFields();
|
drawerForm.resetFields();
|
||||||
drawerForm.setFieldsValue(record);
|
drawerForm.setFieldsValue(record);
|
||||||
setDrawerOpen(true);
|
setDrawerOpen(true);
|
||||||
|
|
@ -171,50 +119,23 @@ export default function SysParams() {
|
||||||
dataIndex: "paramValue",
|
dataIndex: "paramValue",
|
||||||
key: "paramValue",
|
key: "paramValue",
|
||||||
width: 360,
|
width: 360,
|
||||||
render: (text: string, record: SysParamVO) => {
|
ellipsis: { showTitle: false },
|
||||||
const type = record.paramType;
|
render: (text: string) => (
|
||||||
// Boolean: 彩色标签显示 是/否
|
<Tooltip title={text}>
|
||||||
if (isType(type, "Boolean")) {
|
<Text
|
||||||
const isTrue = text === "true";
|
code
|
||||||
return <Tag color={isTrue ? "green" : "default"}>{isTrue ? t("sysParamsExt.booleanTrue") : t("sysParamsExt.booleanFalse")}</Tag>;
|
style={{
|
||||||
}
|
display: "block",
|
||||||
// JSON: 等宽字体,以纯字符串显示
|
maxWidth: "100%",
|
||||||
if (isType(type, "JSON")) {
|
overflow: "hidden",
|
||||||
return (
|
textOverflow: "ellipsis",
|
||||||
<Tooltip title={text}>
|
whiteSpace: "nowrap"
|
||||||
<Text
|
}}
|
||||||
code
|
>
|
||||||
style={{
|
{text}
|
||||||
display: "block",
|
</Text>
|
||||||
maxWidth: "100%",
|
</Tooltip>
|
||||||
overflow: "hidden",
|
)
|
||||||
textOverflow: "ellipsis",
|
|
||||||
whiteSpace: "nowrap"
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</Text>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Number / String: 等宽代码文本 + Tooltip
|
|
||||||
return (
|
|
||||||
<Tooltip title={text}>
|
|
||||||
<Text
|
|
||||||
code
|
|
||||||
style={{
|
|
||||||
display: "block",
|
|
||||||
maxWidth: "100%",
|
|
||||||
overflow: "hidden",
|
|
||||||
textOverflow: "ellipsis",
|
|
||||||
whiteSpace: "nowrap"
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{text}
|
|
||||||
</Text>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("sysParams.paramType"),
|
title: t("sysParams.paramType"),
|
||||||
|
|
@ -256,7 +177,7 @@ export default function SysParams() {
|
||||||
title={t("sysParams.title")}
|
title={t("sysParams.title")}
|
||||||
subtitle={t("sysParams.subtitle")}
|
subtitle={t("sysParams.subtitle")}
|
||||||
headerExtra={
|
headerExtra={
|
||||||
<Button type="primary" icon={<PlusOutlined />} onClick={openCreate}>
|
<Button type="primary" icon={<PlusOutlined />} onClick={() => setDrawerOpen(true)}>
|
||||||
{t("common.create")}
|
{t("common.create")}
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +221,7 @@ export default function SysParams() {
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Drawer
|
<Drawer
|
||||||
title={<Space size={8}><SettingOutlined />{editing ? t("sysParams.drawerTitleEdit") : t("sysParams.drawerTitleCreate")}</Space>}
|
title={<span><SettingOutlined className="mr-2" />{editing ? t("sysParams.drawerTitleEdit") : t("sysParams.drawerTitleCreate")}</span>}
|
||||||
open={drawerOpen}
|
open={drawerOpen}
|
||||||
onClose={closeDrawer}
|
onClose={closeDrawer}
|
||||||
width={500}
|
width={500}
|
||||||
|
|
@ -313,13 +234,13 @@ export default function SysParams() {
|
||||||
<Form.Item label={t("sysParams.paramKey")} name="paramKey" rules={[{ required: true, message: t("sysParams.paramKey") }]}>
|
<Form.Item label={t("sysParams.paramKey")} name="paramKey" rules={[{ required: true, message: t("sysParams.paramKey") }]}>
|
||||||
<Input placeholder={t("sysParamsExt.paramKeyPlaceholder")} disabled={!!editing} />
|
<Input placeholder={t("sysParamsExt.paramKeyPlaceholder")} disabled={!!editing} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label={t("sysParams.paramValue")} name="paramValue" rules={[{ required: true, message: t("sysParams.paramValue") }]}>
|
||||||
|
<Input.TextArea rows={4} placeholder={t("sysParamsExt.paramValuePlaceholder")} />
|
||||||
|
</Form.Item>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item label={t("sysParams.paramType")} name="paramType" rules={[{ required: true, message: t("sysParams.paramType") }]}>
|
<Form.Item label={t("sysParams.paramType")} name="paramType" rules={[{ required: true, message: t("sysParams.paramType") }]}>
|
||||||
<Select placeholder={t("sysParams.paramType")} options={paramTypeDict.map((item) => ({ label: item.itemLabel, value: item.itemValue }))} onChange={(value) => {
|
<Select options={paramTypeDict.map((item) => ({ label: item.itemLabel, value: item.itemValue }))} />
|
||||||
drawerForm.setFieldValue("paramValue", isType(value, "Boolean") ? "true" : "");
|
|
||||||
setJsonError(null);
|
|
||||||
}} />
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
|
|
@ -328,65 +249,6 @@ export default function SysParams() {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{isType(paramType, "JSON") && (
|
|
||||||
<div style={{ marginBottom: 8 }}>
|
|
||||||
<Button size="small" onClick={formatJson}>{t("sysParamsExt.jsonFormat")}</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<Form.Item
|
|
||||||
key={paramType || "default"}
|
|
||||||
label={t("sysParams.paramValue")}
|
|
||||||
name="paramValue"
|
|
||||||
rules={valueRules}
|
|
||||||
// The value is stored as a backend TEXT/string regardless of type.
|
|
||||||
// TextArea/Input pass a change event (read .target.value);
|
|
||||||
// InputNumber/Segmented pass the value directly. Number → stringify.
|
|
||||||
getValueFromEvent={(e: unknown) => {
|
|
||||||
const v = e && typeof e === "object" && "target" in (e as { target?: { value?: unknown } })
|
|
||||||
? (e as { target: { value?: unknown } }).target.value
|
|
||||||
: e;
|
|
||||||
return typeof v === "number" ? String(v) : (v ?? "");
|
|
||||||
}}
|
|
||||||
extra={isType(paramType, "JSON") && jsonError ? <span style={{ color: "#ff4d4f" }}>{jsonError}</span> : undefined}
|
|
||||||
>
|
|
||||||
{isType(paramType, "Number") ? (
|
|
||||||
<Input style={{ width: "100%" }} placeholder={t("sysParamsExt.numberPlaceholder")} />
|
|
||||||
) : isType(paramType, "Boolean") ? (
|
|
||||||
<Segmented
|
|
||||||
className="param-boolean-segmented"
|
|
||||||
block
|
|
||||||
options={[
|
|
||||||
{ label: t("sysParamsExt.booleanTrue"), value: "true" },
|
|
||||||
{ label: t("sysParamsExt.booleanFalse"), value: "false" }
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
) : isType(paramType, "JSON") ? (
|
|
||||||
<Input.TextArea
|
|
||||||
rows={6}
|
|
||||||
style={{ fontFamily: "'SFMono-Regular', Consolas, Menlo, monospace" }}
|
|
||||||
placeholder={t("sysParamsExt.jsonPlaceholder")}
|
|
||||||
onFocus={() => {
|
|
||||||
const v = drawerForm.getFieldValue("paramValue");
|
|
||||||
if (!v) drawerForm.setFieldValue("paramValue", JSON.stringify({ key: "value" }));
|
|
||||||
}}
|
|
||||||
onChange={(e) => {
|
|
||||||
const v = e.target.value;
|
|
||||||
if (!v) {
|
|
||||||
setJsonError(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JSON.parse(v);
|
|
||||||
setJsonError(null);
|
|
||||||
} catch {
|
|
||||||
setJsonError(t("sysParamsExt.jsonInvalid"));
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Input.TextArea rows={3} placeholder={t("sysParamsExt.paramValuePlaceholder")} />
|
|
||||||
)}
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={<Space>{t("sysParams.isSystem")}<Tooltip title={t("sysParamsExt.systemHint")}><InfoCircleOutlined style={{ color: "#8c8c8c" }} /></Tooltip></Space>}
|
label={<Space>{t("sysParams.isSystem")}<Tooltip title={t("sysParamsExt.systemHint")}><InfoCircleOutlined style={{ color: "#8c8c8c" }} /></Tooltip></Space>}
|
||||||
name="isSystem"
|
name="isSystem"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue