All checks were successful
Build and Push Docker Image / build (push) Successful in 5m10s
79 lines
2.2 KiB
TypeScript
79 lines
2.2 KiB
TypeScript
import {
|
|
MyBetaModalFormProps,
|
|
MyButtons,
|
|
MyFormItems,
|
|
MyModalFormProps,
|
|
rulesHelper,
|
|
} from '@/common';
|
|
import { Selects } from '@/components/Select';
|
|
import { Apis } from '@/gen/Apis';
|
|
import { SurveyReleasesTypeEnum } from '@/gen/Enums';
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
import { Form, message } from 'antd';
|
|
export default function SurveyReleasesCreate(props: MyBetaModalFormProps) {
|
|
const [form] = Form.useForm();
|
|
|
|
return (
|
|
<BetaSchemaForm<ApiTypes.Survey.SurveyReleases.Store>
|
|
{...MyModalFormProps.props}
|
|
form={form}
|
|
title={`添加${props.title}`}
|
|
wrapperCol={{ span: 24 }}
|
|
key={new Date().getTime()}
|
|
width="600px"
|
|
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
|
onOpenChange={(open: any) => {
|
|
if (open) {
|
|
form.resetFields(); // 清空表单数据
|
|
}
|
|
}}
|
|
onFinish={async (values) => {
|
|
console.log(values);
|
|
return Apis.Survey.SurveyReleases.Store({
|
|
...values,
|
|
})
|
|
.then(() => {
|
|
props.reload?.();
|
|
message.success(props.title + '成功');
|
|
return true;
|
|
})
|
|
.catch(() => false);
|
|
}}
|
|
columns={[
|
|
Selects?.Surveys({
|
|
colProps: { span: 24 },
|
|
required: true,
|
|
}),
|
|
MyFormItems.EnumRadio({
|
|
key: 'release_type',
|
|
title: '发布方式',
|
|
valueEnum: SurveyReleasesTypeEnum,
|
|
colProps: { span: 24 },
|
|
formItemProps: { ...rulesHelper.text },
|
|
}),
|
|
{
|
|
key: 'start_date',
|
|
title: '有效日期开始',
|
|
valueType: 'dateTime',
|
|
colProps: { span: 12 },
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
{
|
|
key: 'end_date',
|
|
title: '有效日期结束',
|
|
colProps: { span: 12 },
|
|
valueType: 'dateTime',
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
MyFormItems.UploadImages({
|
|
key: 'cover_image',
|
|
title: '封面图',
|
|
colProps: { span: 24 },
|
|
max: 1,
|
|
}),
|
|
// MyFormItems.ColorPicker(),
|
|
]}
|
|
/>
|
|
);
|
|
}
|