64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import {
|
|
MyBetaModalFormProps,
|
|
MyButtons,
|
|
MyModalFormProps,
|
|
rulesHelper,
|
|
} from '@/common';
|
|
import { Apis } from '@/gen/Apis';
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
import { Form, message } from 'antd';
|
|
|
|
export default function Create(props: MyBetaModalFormProps) {
|
|
const [form] = Form.useForm();
|
|
return (
|
|
<BetaSchemaForm<ApiTypes.Common.Positions.Store>
|
|
{...MyModalFormProps.props}
|
|
title={`添加岗位`}
|
|
layout="horizontal"
|
|
labelCol={{ span: 6 }}
|
|
wrapperCol={{ span: 18 }}
|
|
width="450px"
|
|
trigger={<MyButtons.Create title={`添加岗位`} />}
|
|
form={form}
|
|
key={new Date().getTime()}
|
|
onOpenChange={(open: any) => {
|
|
if (open) {
|
|
form.resetFields(); // 清空表单数据
|
|
}
|
|
}}
|
|
onFinish={async (values: any) =>
|
|
Apis.Common.Positions.Store({
|
|
...values,
|
|
is_use: 1,
|
|
})
|
|
.then(() => {
|
|
props.reload?.();
|
|
message.success(props.title + '成功');
|
|
return true;
|
|
})
|
|
.catch(() => false)
|
|
}
|
|
columns={[
|
|
{
|
|
key: 'name',
|
|
title: '岗位名称',
|
|
colProps: { span: 24 },
|
|
formItemProps: { ...rulesHelper.text },
|
|
},
|
|
// {
|
|
// key: 'code',
|
|
// title: '岗位编号',
|
|
// colProps: { span: 24 },
|
|
// formItemProps: { ...rulesHelper.text },
|
|
// },
|
|
{
|
|
key: 'remark',
|
|
title: '岗位说明',
|
|
colProps: { span: 24 },
|
|
valueType: 'textarea',
|
|
},
|
|
]}
|
|
/>
|
|
);
|
|
}
|