diff --git a/src/common/components/MyIcons.tsx b/src/common/components/MyIcons.tsx index ac21a5c..c781fda 100644 --- a/src/common/components/MyIcons.tsx +++ b/src/common/components/MyIcons.tsx @@ -1,14 +1,42 @@ import { + AliwangwangFilled, + AndroidFilled, + AppleFilled, + AppstoreFilled, AuditOutlined, + BankFilled, BankOutlined, BarChartOutlined, BarcodeOutlined, + BellFilled, + ChromeFilled, ClusterOutlined, ControlOutlined, CreditCardOutlined, + CustomerServiceFilled, + FolderOpenFilled, + HeartFilled, + HomeFilled, + HourglassFilled, + IeSquareFilled, + NotificationFilled, + OpenAIFilled, + ReadFilled, + RocketFilled, + SafetyCertificateFilled, + ScheduleFilled, + SettingFilled, SettingOutlined, + ShopFilled, ShopOutlined, + StarFilled, + TruckFilled, + TwitchFilled, + UnlockFilled, UserOutlined, + WalletFilled, + WindowsFilled, + YoutubeFilled, } from '@ant-design/icons'; export type MyIconsType = @@ -34,4 +62,32 @@ export const MyIcons = { BankOutlined: , UserOutlined: , CreditCardOutlined: , + AndroidFilled: , + AppleFilled: , + WindowsFilled: , + ChromeFilled: , + AliwangwangFilled: , + OpenAIFilled: , + TwitchFilled: , + YoutubeFilled: , + HeartFilled: , + IeSquareFilled: , + TruckFilled: , + UnlockFilled: , + AppstoreFilled: , + BellFilled: , + CustomerServiceFilled: , + WalletFilled: , + StarFilled: , + SafetyCertificateFilled: , + FolderOpenFilled: , + ScheduleFilled: , + HourglassFilled: , + BankFilled: , + ShopFilled: , + HomeFilled: , + SettingFilled: , + ReadFilled: , + RocketFilled: , + NotificationFilled: , }; diff --git a/src/common/components/formFields/MyUploadImages.tsx b/src/common/components/formFields/MyUploadImages.tsx index 3ad268b..937948b 100644 --- a/src/common/components/formFields/MyUploadImages.tsx +++ b/src/common/components/formFields/MyUploadImages.tsx @@ -73,15 +73,15 @@ export function MyUploadImages({ uploadType === 'image' ? (
-
Upload
) : ( - + ); const customRequest = ({ file, onError, onProgress, onSuccess }: any) => { - Apis.Auth.PreUpload({ + Apis.Common.Auth.PreUpload({ filename: file.name, + alc: 'public-read', }).then(async (res) => { axios .put(res.data.url, file, { diff --git a/src/common/components/schema/MyColumns.tsx b/src/common/components/schema/MyColumns.tsx index b0d1086..b7b15b3 100644 --- a/src/common/components/schema/MyColumns.tsx +++ b/src/common/components/schema/MyColumns.tsx @@ -1,7 +1,7 @@ import { MyResponseType, renderTextHelper } from '@/common'; import { Apis } from '@/gen/Apis'; import { ProColumns } from '@ant-design/pro-components'; -import { Popconfirm, Tag } from 'antd'; +import { Image, Popconfirm, Tag } from 'antd'; type ReturnType = ProColumns, 'text'>; @@ -193,4 +193,13 @@ export const MyColumns = { ...rest, }; }, + Image({ ...rest }) { + return { + search: false, + renderText(text: { url: string }[]) { + return ; + }, + ...rest, + }; + }, }; diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 938958b..97953a5 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -250,6 +250,40 @@ export const Selects = { }, }; }, + //项目 + AssetProjects(props?: PropsType): ReturnType { + const { + title = '选择项目', + key = 'asset_projects_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => + ( + await Apis.Asset.AssetProjects.Select({ + keywords: params?.KeyWords, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, //房屋 AssetHouses(props?: PropsType): ReturnType { const { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index fbbf1ce..fcdc916 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -127,7 +127,12 @@ export const HouseOccupantsHouseRelationEnum= { // HouseOccupantsRelationWithOwnerEnum export const HouseOccupantsRelationWithOwnerEnum= { - 'Value': {"text":"Label","color":"#ff0000","value":"Value"}, + 'Self': {"text":"本人","color":"#52c41a","value":"Self"}, + 'Spouse': {"text":"夫妻","color":"#2db7f5","value":"Spouse"}, + 'FatherSon': {"text":"父子","color":"#faad14","value":"FatherSon"}, + 'MotherSon': {"text":"母子","color":"#fa8c16","value":"MotherSon"}, + 'Children': {"text":"子女","color":"#87d068","value":"Children"}, + 'ContactPerson': {"text":"指定联系人","color":"#f5222d","value":"ContactPerson"}, }; // HouseOccupantsStatusEnum diff --git a/src/pages/archive/house_registers/$id.tsx b/src/pages/archive/house_registers/$id.tsx new file mode 100644 index 0000000..7971ec1 --- /dev/null +++ b/src/pages/archive/house_registers/$id.tsx @@ -0,0 +1,37 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProCard } from '@ant-design/pro-components'; +import { useParams } from '@umijs/max'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import HouseOccupants from './components/HouseOccupants'; +export default function Show({ title = '机构详情' }) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.Archive.HouseRegisters.Show(paramsId).then((res) => { + setShow(res?.data); + }); + }; + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '入住人', + key: '1', + closable: false, + children: , + }, + ]; + return ( + + + + + + ); +} diff --git a/src/pages/archive/house_registers/components/HouseOccupants.tsx b/src/pages/archive/house_registers/components/HouseOccupants.tsx new file mode 100644 index 0000000..fb23ff0 --- /dev/null +++ b/src/pages/archive/house_registers/components/HouseOccupants.tsx @@ -0,0 +1,70 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { ...params, asset_houses_id: props.item?.asset_house?.id }, + sort, + Apis.Archive.HouseOccupants.List, + ) + } + columns={[ + MyColumns.ID(), + { + title: '姓名', + dataIndex: 'name', + }, + { + title: '手机号', + dataIndex: 'phone', + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: HouseOccupantsStatusEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '与产权人关系', + dataIndex: 'relation_with_owner', + valueEnum: HouseOccupantsRelationWithOwnerEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '房客关系', + dataIndex: 'house_relation', + valueEnum: HouseOccupantsHouseRelationEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '证件类型', + dataIndex: 'card_type', + valueEnum: HouseOccupantsCardTypeEnum, + search: false, + }), + MyColumns?.Image({ + title: '身份证正面', + dataIndex: 'card_front_image', + }), + MyColumns?.Image({ + title: '身份证正面', + dataIndex: 'card_back_image', + }), + MyColumns.CreatedAt(), + ]} + /> + ); +} diff --git a/src/pages/archive/house_registers/index.tsx b/src/pages/archive/house_registers/index.tsx index 0b209fe..3fc15d4 100644 --- a/src/pages/archive/house_registers/index.tsx +++ b/src/pages/archive/house_registers/index.tsx @@ -13,11 +13,12 @@ import { HouseRegistersUsagePlanEnum, } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; -import Create from './modals/Create'; -import Update from './modals/Update'; +import OccupantsCreate from './modals/OccupantsCreate'; export default function Index({ title = '房屋登记' }) { + const navigate = useNavigate(); return ( [ - , + , ]} columns={[ MyColumns.ID(), @@ -71,7 +76,12 @@ export default function Index({ title = '房屋登记' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( - + { + navigate(`/archive/house_registers/${item.id}`); + }} + /> Apis.Archive.HouseRegisters.Delete({ id: item.id }).then( diff --git a/src/pages/archive/house_registers/modals/Create.tsx b/src/pages/archive/house_registers/modals/Create.tsx deleted file mode 100644 index 1c16833..0000000 --- a/src/pages/archive/house_registers/modals/Create.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { - HouseRegistersCustomerTypeEnum, - HouseRegistersHouseStatusEnum, - HouseRegistersStatusEnum, - HouseRegistersTypeEnum, - HouseRegistersUsagePlanEnum, -} from '@/gen/Enums'; -import { BetaSchemaForm } from '@ant-design/pro-components'; -import { message } from 'antd'; - -export default function Create(props: MyBetaModalFormProps) { - return ( - - {...MyModalFormProps.props} - title={`添加${props.title}`} - wrapperCol={{ span: 24 }} - width="800px" - trigger={} - onFinish={async (values) => - Apis.Archive.HouseRegisters.Store(values) - .then(() => { - props.reload?.(); - message.success(props.title + '成功'); - return true; - }) - .catch(() => false) - } - columns={[ - Selects?.AssetHouses({ - title: '选择房屋', - key: 'asset_houses_id', - formItemProps: { ...rulesHelper.text }, - colProps: { span: 12 }, - }), - MyFormItems.EnumRadio({ - key: 'type', - title: '类型', - colProps: { span: 12 }, - valueEnum: HouseRegistersTypeEnum, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'customer_type', - title: '客户类型', - colProps: { span: 12 }, - valueEnum: HouseRegistersCustomerTypeEnum, - }), - MyFormItems.EnumRadio({ - key: 'usage_plan', - title: '使用计划', - colProps: { span: 12 }, - valueEnum: HouseRegistersUsagePlanEnum, - }), - MyFormItems.EnumRadio({ - key: 'status', - title: '状态', - colProps: { span: 12 }, - valueEnum: HouseRegistersStatusEnum, - }), - MyFormItems.EnumRadio({ - key: 'house_status', - title: '房屋状态', - colProps: { span: 12 }, - valueEnum: HouseRegistersHouseStatusEnum, - }), - ]} - /> - ); -} diff --git a/src/pages/archive/house_registers/modals/OccupantsCreate.tsx b/src/pages/archive/house_registers/modals/OccupantsCreate.tsx new file mode 100644 index 0000000..04fdee9 --- /dev/null +++ b/src/pages/archive/house_registers/modals/OccupantsCreate.tsx @@ -0,0 +1,230 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, + HouseRegistersCustomerTypeEnum, + HouseRegistersHouseStatusEnum, + HouseRegistersTypeEnum, + HouseRegistersUsagePlanEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="900px" + form={form} + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Archive.HouseRegisters.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => [ + Selects?.AssetHouses({ + title: '选择房屋', + key: 'asset_houses_id', + params: { asset_projects_id: asset_projects_id }, + formItemProps: { ...rulesHelper.text }, + colProps: { span: 8 }, + }), + ], + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 8 }, + valueEnum: HouseRegistersTypeEnum, + required: true, + }), + { + valueType: 'formList', + dataIndex: 'customer_info', + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + creatorButtonProps: { + creatorButtonText: '添加客户', + }, + itemRender: ( + { listDom, action }: any, + { index }: { index: number }, + ) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'group', + columns: [ + { + title: '姓名', + dataIndex: 'name', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 8 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'house_relation', + title: '房客关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsHouseRelationEnum, + required: true, + }), + + { + title: '客户地址', + dataIndex: 'address', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '解除时间', + dataIndex: 'unbound_time', + colProps: { span: 8 }, + valueType: 'date', + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'relation_with_owner', + title: '与产权人关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsRelationWithOwnerEnum, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 8 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 8 }, + fieldProps: { + maxLength: 18, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '是否在居住中', + dataIndex: 'is_live_in', + colProps: { span: 8 }, + valueType: 'switch', + }, + { + valueType: 'group', + columns: [ + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '身份证正面', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '身份证反面', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + MyFormItems.UploadImages({ + key: 'ownership_info', + title: '产权信息', + max: 100, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + ], + }, + ], + }, + + MyFormItems.EnumRadio({ + key: 'customer_type', + title: '客户类型', + colProps: { span: 24 }, + valueEnum: HouseRegistersCustomerTypeEnum, + }), + MyFormItems.EnumRadio({ + key: 'usage_plan', + title: '使用计划', + colProps: { span: 24 }, + valueEnum: HouseRegistersUsagePlanEnum, + }), + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '状态', + // colProps: { span: 24 }, + // valueEnum: HouseRegistersStatusEnum, + // }), + MyFormItems.EnumRadio({ + key: 'house_status', + title: '房屋状态', + colProps: { span: 24 }, + valueEnum: HouseRegistersHouseStatusEnum, + }), + ]} + /> + ); +} diff --git a/src/pages/archive/house_registers/modals/OccupantsUpdate.tsx b/src/pages/archive/house_registers/modals/OccupantsUpdate.tsx new file mode 100644 index 0000000..f109fe1 --- /dev/null +++ b/src/pages/archive/house_registers/modals/OccupantsUpdate.tsx @@ -0,0 +1,236 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; + +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, + HouseRegistersCustomerTypeEnum, + HouseRegistersHouseStatusEnum, + HouseRegistersTypeEnum, + HouseRegistersUsagePlanEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="900px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + asset_houses_id: props.item?.asset_house?.id, + }); + } + }} + onFinish={async (values) => + Apis.Archive.HouseRegisters.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => [ + Selects?.AssetHouses({ + title: '选择房屋', + key: 'asset_houses_id', + params: { asset_projects_id: asset_projects_id }, + formItemProps: { ...rulesHelper.text }, + colProps: { span: 8 }, + }), + ], + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 8 }, + valueEnum: HouseRegistersTypeEnum, + required: true, + }), + { + valueType: 'formList', + dataIndex: 'customer_info', + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + creatorButtonProps: { + creatorButtonText: '添加客户', + }, + itemRender: ( + { listDom, action }: any, + { index }: { index: number }, + ) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'group', + columns: [ + { + title: '姓名', + dataIndex: 'name', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 8 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'house_relation', + title: '房客关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsHouseRelationEnum, + required: true, + }), + + { + title: '客户地址', + dataIndex: 'address', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '解除时间', + dataIndex: 'unbound_time', + colProps: { span: 8 }, + valueType: 'date', + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'relation_with_owner', + title: '与产权人关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsRelationWithOwnerEnum, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 8 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 8 }, + fieldProps: { + maxLength: 18, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '是否在居住中', + dataIndex: 'is_live_in', + colProps: { span: 8 }, + valueType: 'switch', + }, + { + valueType: 'group', + columns: [ + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '身份证正面', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '身份证反面', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + MyFormItems.UploadImages({ + key: 'ownership_info', + title: '产权信息', + max: 100, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + ], + }, + ], + }, + + MyFormItems.EnumRadio({ + key: 'customer_type', + title: '客户类型', + colProps: { span: 24 }, + valueEnum: HouseRegistersCustomerTypeEnum, + }), + MyFormItems.EnumRadio({ + key: 'usage_plan', + title: '使用计划', + colProps: { span: 24 }, + valueEnum: HouseRegistersUsagePlanEnum, + }), + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '状态', + // colProps: { span: 24 }, + // valueEnum: HouseRegistersStatusEnum, + // }), + MyFormItems.EnumRadio({ + key: 'house_status', + title: '房屋状态', + colProps: { span: 24 }, + valueEnum: HouseRegistersHouseStatusEnum, + }), + ]} + /> + ); +} diff --git a/src/pages/archive/house_registers/modals/Update.tsx b/src/pages/archive/house_registers/modals/Update.tsx deleted file mode 100644 index c54deba..0000000 --- a/src/pages/archive/house_registers/modals/Update.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; - -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { - HouseRegistersCustomerTypeEnum, - HouseRegistersHouseStatusEnum, - HouseRegistersStatusEnum, - HouseRegistersTypeEnum, - HouseRegistersUsagePlanEnum, -} from '@/gen/Enums'; -import { BetaSchemaForm } from '@ant-design/pro-components'; -import { Form, message } from 'antd'; -export default function Update(props: MyBetaModalFormProps) { - const [form] = Form.useForm(); - return ( - - {...MyModalFormProps.props} - title={`编辑员工`} - trigger={} - wrapperCol={{ span: 24 }} - width="800px" - form={form} - onOpenChange={(open: any) => { - if (open && props.item) { - form.setFieldsValue({ - ...props.item, - roles_id: props.item?.roles?.map((item: any) => item.value), - }); - } - }} - onFinish={async (values) => - Apis.Archive.HouseRegisters.Update({ - ...values, - id: props.item?.id ?? 0, - }) - .then(() => { - props.reload?.(); - message.success(props.title + '成功'); - return true; - }) - .catch(() => false) - } - columns={[ - Selects?.AssetHouses({ - title: '选择房屋', - key: 'asset_houses_id', - formItemProps: { ...rulesHelper.text }, - colProps: { span: 8 }, - }), - MyFormItems.EnumRadio({ - key: 'type', - title: '类型', - colProps: { span: 12 }, - valueEnum: HouseRegistersTypeEnum, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'customer_type', - title: '客户类型', - colProps: { span: 12 }, - valueEnum: HouseRegistersCustomerTypeEnum, - }), - MyFormItems.EnumRadio({ - key: 'usage_plan', - title: '使用计划', - colProps: { span: 12 }, - valueEnum: HouseRegistersUsagePlanEnum, - }), - MyFormItems.EnumRadio({ - key: 'status', - title: '状态', - colProps: { span: 12 }, - valueEnum: HouseRegistersStatusEnum, - }), - MyFormItems.EnumRadio({ - key: 'house_status', - title: '房屋状态', - colProps: { span: 12 }, - valueEnum: HouseRegistersHouseStatusEnum, - }), - ]} - /> - ); -} diff --git a/src/pages/asset/asset_projects/components/AssetBuildings.tsx b/src/pages/asset/asset_projects/components/AssetBuildings.tsx index 99a10cd..becd646 100644 --- a/src/pages/asset/asset_projects/components/AssetBuildings.tsx +++ b/src/pages/asset/asset_projects/components/AssetBuildings.tsx @@ -18,6 +18,7 @@ import AssetBuildingsUpdate from '../modals/BuildingsUpdate'; import AssetHousesCreate from '../modals/HousesCreate'; import AssetHousesShow from '../modals/HousesShow'; import AssetHousesUpdate from '../modals/HousesUpdate'; +import RegistersCreate from '../modals/RegistersCreate'; import AssetUnitsCreate from '../modals/UnitsCreate'; import AssetUnitsUpdate from '../modals/UnitsUpdate'; @@ -222,7 +223,16 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { render: (_, item: any, index, action) => ( - + + Apis.Asset.AssetBuildings.Delete({ id: item.id }).then( diff --git a/src/pages/asset/asset_projects/modals/GridCreate.tsx b/src/pages/asset/asset_projects/modals/GridCreate.tsx index 86a7ab9..65fbf66 100644 --- a/src/pages/asset/asset_projects/modals/GridCreate.tsx +++ b/src/pages/asset/asset_projects/modals/GridCreate.tsx @@ -26,7 +26,7 @@ export default function Create(props: MyBetaModalFormProps) { } }} onFinish={async (values: any) => { - values?.grid_ranges?.map((res: { asset_projects_id: string }) => { + values?.grid_ranges?.forEach((res: { asset_projects_id: string }) => { res.asset_projects_id = props?.item?.id; }); return Apis.Grid.Grids.Store({ diff --git a/src/pages/asset/asset_projects/modals/HousesUpdate.tsx b/src/pages/asset/asset_projects/modals/HousesUpdate.tsx index 77adbdf..f128483 100644 --- a/src/pages/asset/asset_projects/modals/HousesUpdate.tsx +++ b/src/pages/asset/asset_projects/modals/HousesUpdate.tsx @@ -22,10 +22,12 @@ export default function Update(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`编辑房屋`} + title={props.title} wrapperCol={{ span: 24 }} - width="800px" - trigger={} + width="900px" + trigger={ + + } form={form} onOpenChange={(open: any) => { if (open) { diff --git a/src/pages/asset/asset_projects/modals/RegistersCreate.tsx b/src/pages/asset/asset_projects/modals/RegistersCreate.tsx new file mode 100644 index 0000000..46996dd --- /dev/null +++ b/src/pages/asset/asset_projects/modals/RegistersCreate.tsx @@ -0,0 +1,214 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, + HouseRegistersCustomerTypeEnum, + HouseRegistersHouseStatusEnum, + HouseRegistersTypeEnum, + HouseRegistersUsagePlanEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="900px" + form={form} + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Archive.HouseRegisters.Store({ + ...values, + asset_houses_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: HouseRegistersTypeEnum, + required: true, + }), + { + valueType: 'formList', + dataIndex: 'customer_info', + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + creatorButtonProps: { + creatorButtonText: '添加客户', + }, + itemRender: ( + { listDom, action }: any, + { index }: { index: number }, + ) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'group', + columns: [ + { + title: '姓名', + dataIndex: 'name', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 8 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'house_relation', + title: '房客关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsHouseRelationEnum, + required: true, + }), + + { + title: '客户地址', + dataIndex: 'address', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '解除时间', + dataIndex: 'unbound_time', + colProps: { span: 8 }, + valueType: 'date', + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'relation_with_owner', + title: '与产权人关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsRelationWithOwnerEnum, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 8 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 8 }, + fieldProps: { + maxLength: 18, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '是否在居住中', + dataIndex: 'is_live_in', + colProps: { span: 8 }, + valueType: 'switch', + }, + { + valueType: 'group', + columns: [ + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '身份证正面', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '身份证反面', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + MyFormItems.UploadImages({ + key: 'ownership_info', + title: '产权信息', + max: 100, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + ], + }, + ], + }, + + MyFormItems.EnumRadio({ + key: 'customer_type', + title: '客户类型', + colProps: { span: 24 }, + valueEnum: HouseRegistersCustomerTypeEnum, + }), + MyFormItems.EnumRadio({ + key: 'usage_plan', + title: '使用计划', + colProps: { span: 24 }, + valueEnum: HouseRegistersUsagePlanEnum, + }), + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '状态', + // colProps: { span: 24 }, + // valueEnum: HouseRegistersStatusEnum, + // }), + MyFormItems.EnumRadio({ + key: 'house_status', + title: '房屋状态', + colProps: { span: 24 }, + valueEnum: HouseRegistersHouseStatusEnum, + }), + ]} + /> + ); +} diff --git a/src/pages/examine/AuditEnum.ts b/src/pages/examine/AuditEnum.ts new file mode 100644 index 0000000..2e0f0c6 --- /dev/null +++ b/src/pages/examine/AuditEnum.ts @@ -0,0 +1,4 @@ +export const AuditEnum = { + Approved: { text: '通过', color: '#007bff', value: 'Approved' }, + Rejected: { text: '拒绝', color: '#28a745', value: 'Rejected' }, +}; diff --git a/src/pages/examine/house_registers_audit/index.tsx b/src/pages/examine/house_registers_audit/index.tsx new file mode 100644 index 0000000..4cc7862 --- /dev/null +++ b/src/pages/examine/house_registers_audit/index.tsx @@ -0,0 +1,72 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseRegistersCustomerTypeEnum, + HouseRegistersHouseStatusEnum, + HouseRegistersStatusEnum, + HouseRegistersTypeEnum, + HouseRegistersUsagePlanEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Audit from './modals/Audit'; + +export default function Index({ title = '房屋登记审核' }) { + return ( + + + MyProTableProps.request( + { status: 'Pending', ...params }, + sort, + Apis.Archive.HouseRegisters.List, + ) + } + columns={[ + MyColumns.ID(), + { + title: '房屋', + dataIndex: ['asset_house', 'full_name'], + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: HouseRegistersTypeEnum, + }), + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: HouseRegistersStatusEnum, + }), + MyColumns.EnumTag({ + title: '房屋状态', + dataIndex: 'house_status', + valueEnum: HouseRegistersHouseStatusEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '使用计划', + dataIndex: 'usage_plan', + valueEnum: HouseRegistersUsagePlanEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '客户类型', + dataIndex: 'customer_type', + valueEnum: HouseRegistersCustomerTypeEnum, + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx new file mode 100644 index 0000000..f104a22 --- /dev/null +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -0,0 +1,62 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; + +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { AuditEnum } from '../../AuditEnum'; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={props.title} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + form={form} + onFinish={async (values: any) => + Apis.Archive.HouseRegisters.Audit({ + id: props.item?.id ?? 0, + ...values, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'status', + title: '审核', + colProps: { span: 24 }, + valueEnum: AuditEnum, + required: true, + }), + { + valueType: 'dependency', + name: ['status'], + columns: ({ status }) => { + return status === 'Rejected' + ? [ + { + title: '驳回原因', + dataIndex: 'reason', + valueType: 'textarea', + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + ]} + /> + ); +}