This commit is contained in:
longdayi 2025-02-27 23:05:12 +08:00
parent f352a55c02
commit 52fa9a031a
2 changed files with 10 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import { useTusUpload } from "@web/src/hooks/useTusUpload";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useAuth } from "@web/src/providers/auth-provider"; import { useAuth } from "@web/src/providers/auth-provider";
import { MIND_OPTIONS } from "./constant"; import { MIND_OPTIONS } from "./constant";
import { SaveOutlined } from "@ant-design/icons";
export default function MindEditor({ id }: { id?: string }) { export default function MindEditor({ id }: { id?: string }) {
//containerRef 容器ref instance 实例 //containerRef 容器ref instance 实例
const containerRef = useRef<HTMLDivElement>(null); const containerRef = useRef<HTMLDivElement>(null);
@ -170,7 +171,7 @@ export default function MindEditor({ id }: { id?: string }) {
return ( return (
<div className="grid grid-cols-1 flex-col w-[90vw] my-5 h-[80vh] border rounded-lg mx-auto"> <div className="grid grid-cols-1 flex-col w-[90vw] my-5 h-[80vh] border rounded-lg mx-auto">
{canEdit && taxonomies && ( {taxonomies && (
<Form form={form} className=" bg-white p-4 "> <Form form={form} className=" bg-white p-4 ">
<div className="flex items-center justify-between gap-4"> <div className="flex items-center justify-between gap-4">
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
@ -181,6 +182,7 @@ export default function MindEditor({ id }: { id?: string }) {
// rules={[{ required: true }]} // rules={[{ required: true }]}
noStyle> noStyle>
<TermSelect <TermSelect
disabled={!canEdit}
className=" w-48" className=" w-48"
placeholder={`请选择${tax.name}`} placeholder={`请选择${tax.name}`}
taxonomyId={tax.id} taxonomyId={tax.id}
@ -192,19 +194,21 @@ export default function MindEditor({ id }: { id?: string }) {
name="deptIds" name="deptIds"
noStyle> noStyle>
<DepartmentSelect <DepartmentSelect
disabled={!canEdit}
className="w-96" className="w-96"
placeholder="请选择制作单位" placeholder="请选择制作单位"
multiple multiple
/> />
</Form.Item> </Form.Item>
</div> </div>
<Button {canEdit && <Button
ghost ghost
type="primary" type="primary"
icon={<SaveOutlined></SaveOutlined>}
onSubmit={(e) => e.preventDefault()} onSubmit={(e) => e.preventDefault()}
onClick={handleSave}> onClick={handleSave}>
{id ? "更新" : "保存"} {id ? "更新" : "保存"}
</Button> </Button>}
</div> </div>
</Form> </Form>
)} )}

View File

@ -70,7 +70,9 @@ export const routes: CustomRouteObject[] = [
}, },
{ {
path: "editor/:id?", path: "editor/:id?",
element: <PathEditorPage></PathEditorPage>, element: <WithAuth>
<PathEditorPage></PathEditorPage>
</WithAuth>,
}, },
], ],
}, },