61 lines
1.4 KiB
TypeScript
61 lines
1.4 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 Update(props: MyBetaModalFormProps) {
|
||
|
|
const [form] = Form.useForm();
|
||
|
|
|
||
|
|
return (
|
||
|
|
<BetaSchemaForm<ApiTypes.Asset.AssetBuildings.Update>
|
||
|
|
{...MyModalFormProps.props}
|
||
|
|
form={form}
|
||
|
|
title={`编辑`}
|
||
|
|
wrapperCol={{ span: 24 }}
|
||
|
|
width="500px"
|
||
|
|
trigger={
|
||
|
|
<MyButtons.Default
|
||
|
|
title={`编辑` } size='small' type='link'
|
||
|
|
/>
|
||
|
|
}
|
||
|
|
onOpenChange={(open: any) => {
|
||
|
|
if (open) {
|
||
|
|
form.setFieldsValue(props?.item); // 编辑赋值
|
||
|
|
}
|
||
|
|
}}
|
||
|
|
onFinish={async (values) =>
|
||
|
|
Apis.Asset.AssetBuildings.Update({
|
||
|
|
...values,
|
||
|
|
asset_projects_id: props?.item?.asset_projects_id,
|
||
|
|
id: props?.item?.id,
|
||
|
|
})
|
||
|
|
.then(() => {
|
||
|
|
props.reload?.();
|
||
|
|
message.success('楼栋编辑成功');
|
||
|
|
return true;
|
||
|
|
})
|
||
|
|
.catch(() => false)
|
||
|
|
}
|
||
|
|
columns={[
|
||
|
|
{
|
||
|
|
key: 'name',
|
||
|
|
title: '楼栋名称',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
formItemProps: { ...rulesHelper.text },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key: 'alias_name',
|
||
|
|
title: '楼栋别名',
|
||
|
|
colProps: { span: 24 },
|
||
|
|
},
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|