feat: 素材处理管线——自动处理、审核流程、6状态机
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { App as AntApp, DatePicker, Form, Input, Modal } from "antd";
|
||||
import { App as AntApp, DatePicker, Form, Input, Modal, Select } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import type { CreateMaterialRequest, Material } from "../types";
|
||||
import type { CreateMaterialRequest, Material, MaterialType } from "../types";
|
||||
|
||||
interface AddMaterialModalProps {
|
||||
onAdd: (body: CreateMaterialRequest) => Promise<Material>;
|
||||
@@ -13,8 +13,14 @@ interface AddMaterialModalProps {
|
||||
interface FormValues {
|
||||
associatedDate: dayjs.Dayjs;
|
||||
description: string;
|
||||
materialType: MaterialType;
|
||||
}
|
||||
|
||||
const MATERIAL_TYPE_OPTIONS = [
|
||||
{ label: "通用", value: "general" },
|
||||
{ label: "会议", value: "meeting" },
|
||||
];
|
||||
|
||||
export function AddMaterialModal({ onAdd, onOpenChange, open }: AddMaterialModalProps) {
|
||||
const { message } = AntApp.useApp();
|
||||
const [form] = Form.useForm<FormValues>();
|
||||
@@ -29,6 +35,7 @@ export function AddMaterialModal({ onAdd, onOpenChange, open }: AddMaterialModal
|
||||
const body: CreateMaterialRequest = {
|
||||
associatedDate: values.associatedDate.format("YYYY-MM-DD"),
|
||||
description: values.description,
|
||||
materialType: values.materialType,
|
||||
};
|
||||
|
||||
setSubmitting(true);
|
||||
@@ -55,7 +62,7 @@ export function AddMaterialModal({ onAdd, onOpenChange, open }: AddMaterialModal
|
||||
>
|
||||
<Form
|
||||
form={form}
|
||||
initialValues={{ associatedDate: dayjs() }}
|
||||
initialValues={{ associatedDate: dayjs(), materialType: "general" as MaterialType }}
|
||||
layout="vertical"
|
||||
onFinish={(values) => void handleFinish(values)}
|
||||
>
|
||||
@@ -69,6 +76,9 @@ export function AddMaterialModal({ onAdd, onOpenChange, open }: AddMaterialModal
|
||||
<Form.Item label="关联时间" name="associatedDate" rules={[{ message: "请选择关联时间", required: true }]}>
|
||||
<DatePicker className="app-inbox-datepicker" />
|
||||
</Form.Item>
|
||||
<Form.Item label="素材类型" name="materialType" rules={[{ message: "请选择素材类型", required: true }]}>
|
||||
<Select options={MATERIAL_TYPE_OPTIONS} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user