60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import {
|
|
MyBetaModalFormProps,
|
|
MyButtons,
|
|
MyModalFormProps,
|
|
rulesHelper,
|
|
} from '@/common';
|
|
|
|
import { Selects } from '@/components/Select';
|
|
import { Apis } from '@/gen/Apis';
|
|
import { BetaSchemaForm } from '@ant-design/pro-components';
|
|
import { Form, message } from 'antd';
|
|
export default function Update(props: MyBetaModalFormProps) {
|
|
const [form] = Form.useForm();
|
|
return (
|
|
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Update>
|
|
{...MyModalFormProps.props}
|
|
title={`组织调整`}
|
|
trigger={<MyButtons.Edit title="组织" type="primary" />}
|
|
wrapperCol={{ span: 24 }}
|
|
width="500px"
|
|
key={new Date().getTime()}
|
|
form={form}
|
|
onOpenChange={(open: any) => {
|
|
if (open) {
|
|
form.resetFields(); // 清空表单数据
|
|
}
|
|
}}
|
|
onFinish={async (values: any) =>
|
|
Apis.Company.CompanyEmployees.Update({
|
|
...values,
|
|
id: props.item?.id ?? 0,
|
|
name: props.item?.name ?? '',
|
|
phone: props.item?.phone ?? '',
|
|
type: props.item?.type ?? '',
|
|
organizations_id:
|
|
values?.organizations_id?.[values.organizations_id.length - 1],
|
|
})
|
|
.then(() => {
|
|
props.reload?.();
|
|
message.success(props.title + '成功');
|
|
return true;
|
|
})
|
|
.catch(() => false)
|
|
}
|
|
columns={[
|
|
Selects?.OrganizationsTree({
|
|
title: '选择组织',
|
|
key: 'organizations_id',
|
|
params: { companies_id: props?.item?.companies_id },
|
|
colProps: { span: 24 },
|
|
fieldProps: {
|
|
showSearch: true,
|
|
},
|
|
formItemProps: { ...rulesHelper.text },
|
|
}),
|
|
]}
|
|
/>
|
|
);
|
|
}
|