2025-07-16 10:18:01 +08:00
|
|
|
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 { ButtonProps, Form, message } from 'antd';
|
|
|
|
|
|
|
|
|
|
export default function Create(
|
|
|
|
|
props: { buttonProps?: ButtonProps } & MyBetaModalFormProps,
|
|
|
|
|
) {
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
return (
|
|
|
|
|
<BetaSchemaForm<ApiTypes.Grid.Grids.AddManager>
|
|
|
|
|
{...MyModalFormProps.props}
|
|
|
|
|
title={`设置网格员`}
|
|
|
|
|
wrapperCol={{ span: 24 }}
|
|
|
|
|
width="500px"
|
|
|
|
|
form={form}
|
|
|
|
|
trigger={<MyButtons.Default title="网格员" type="link" />}
|
|
|
|
|
request={() => Promise.resolve(props.item)}
|
|
|
|
|
onOpenChange={(open: any) => {
|
|
|
|
|
if (open && props.item) {
|
|
|
|
|
// 获取详情数据
|
|
|
|
|
Apis.Grid.Grids.Show({
|
2025-07-17 13:58:54 +08:00
|
|
|
id: props?.item?.id,
|
2025-07-16 10:18:01 +08:00
|
|
|
}).then((res) => {
|
|
|
|
|
form.setFieldsValue({
|
|
|
|
|
...res.data,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
onFinish={async (values: any) =>
|
|
|
|
|
Apis.Grid.Grids.AddManager({
|
|
|
|
|
...values,
|
|
|
|
|
id: props?.item?.id,
|
|
|
|
|
})
|
|
|
|
|
.then(() => {
|
|
|
|
|
props.reload?.();
|
|
|
|
|
message.success('成功');
|
|
|
|
|
return true;
|
|
|
|
|
})
|
|
|
|
|
.catch(() => false)
|
|
|
|
|
}
|
|
|
|
|
columns={[
|
|
|
|
|
Selects?.Employees({
|
|
|
|
|
title: '设置网格员',
|
|
|
|
|
dataIndex: 'company_employees_id',
|
|
|
|
|
colProps: { span: 24 },
|
|
|
|
|
formItemProps: { ...rulesHelper.text },
|
|
|
|
|
required: true,
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|