From 1275c157f58b27d4d2b966e91a73bab4f3360be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BA=AD?= Date: Mon, 25 Aug 2025 16:18:20 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/develop.yml | 2 +- .github/workflows/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index eae615c..a970c57 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -64,7 +64,7 @@ jobs: with: host: ${{ vars.DEV_HOST_IP }} port: 22 - username: 'ubuntu' + username: 'root' password: ${{ secrets.DEV_HOST_PASSWORD }} script: | docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_URL}} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2844942..e25ea88 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: with: host: ${{ vars.LOAN_MAIN_HOST_IP_PHP }} port: 22 - username: 'ubuntu' + username: 'root' password: ${{ secrets.LOAN_MAIN_HOST_PASSWORD }} script: | docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_URL}} From f1e03910b969dea04ef34d06f1494bd75107b882 Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Wed, 27 Aug 2025 11:24:29 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix=EF=BC=9A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.ts | 1 + src/common/components/MyButtons.tsx | 4 +- .../components/layout/MyImportModal.tsx | 5 +- src/components/MyModal.tsx | 11 +- src/gen/ApiTypes.d.ts | 13 +- src/gen/Apis.ts | 6 + src/gen/Enums.ts | 41 ++- src/pages/archive/components/OccupantsNow.tsx | 40 +-- .../archive/components/modals/AddOccupant.tsx | 47 ++-- src/pages/archive/index.tsx | 13 +- src/pages/archive/modals/Delivery.tsx | 52 ++-- src/pages/asset/$id.tsx | 4 +- src/pages/asset/components/AssetInfo.tsx | 2 +- .../asset/components/modals/HousesCreate.tsx | 63 +++-- .../asset/components/modals/HousesUpdate.tsx | 68 +++-- src/pages/asset/index.tsx | 13 +- src/pages/asset/modals/AssetCreate.tsx | 4 + src/pages/asset/modals/AssetUpdate.tsx | 13 +- src/pages/asset_houses/index.tsx | 29 +-- src/pages/banner/index.tsx | 2 +- src/pages/banner_space/index.tsx | 2 +- src/pages/company/$id.tsx | 41 ++- .../components/{Projects.tsx => Assets.tsx} | 19 +- .../company/components/ComponentsInfo.tsx | 109 ++++---- .../company/components/Organizations.tsx | 2 +- src/pages/company/index.tsx | 14 +- .../house_registers_audit/modals/Audit.tsx | 9 +- src/pages/tabs-demo.tsx | 243 ------------------ 28 files changed, 343 insertions(+), 527 deletions(-) rename src/pages/company/components/{Projects.tsx => Assets.tsx} (88%) delete mode 100644 src/pages/tabs-demo.tsx diff --git a/.umirc.ts b/.umirc.ts index 4edb548..9539141 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -16,6 +16,7 @@ export default defineConfig({ '/api/': { // target: 'http://yt:8003', target: 'http://10.39.13.80:8001', + // target: 'https://weapp-api.linyikj.com.cn/', // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', changeOrigin: true, diff --git a/src/common/components/MyButtons.tsx b/src/common/components/MyButtons.tsx index 951028a..86a4e81 100644 --- a/src/common/components/MyButtons.tsx +++ b/src/common/components/MyButtons.tsx @@ -49,14 +49,14 @@ export const MyButtons = { }, View({ title, ...rest }: MyButtonsType): JSX.Element { return ( - ); }, Edit({ title = '编辑', ...rest }: MyButtonsType): JSX.Element { return ( - ); diff --git a/src/common/components/layout/MyImportModal.tsx b/src/common/components/layout/MyImportModal.tsx index 07ee28e..9685dc6 100644 --- a/src/common/components/layout/MyImportModal.tsx +++ b/src/common/components/layout/MyImportModal.tsx @@ -54,7 +54,10 @@ export function MyImportModal(props: MyImportModalType) { }); }} confirmLoading={loading} - destroyOnClose={true} + // 使用 destroyOnClose 已弃用,建议使用 afterClose 处理清理逻辑 + afterClose={() => { + setFormData(undefined); + }} maskClosable={false} footer={(dom) => { return ( diff --git a/src/components/MyModal.tsx b/src/components/MyModal.tsx index 671d149..3daae85 100644 --- a/src/components/MyModal.tsx +++ b/src/components/MyModal.tsx @@ -1,15 +1,15 @@ import { MyButtons } from '@/common'; import { Modal } from 'antd'; -import { useImperativeHandle, useState } from 'react'; +import { useImperativeHandle, useState } from 'react'; export function MyModal(props?: any) { const [open, setOpen] = useState(false); const close = () => { - setOpen(false) - } + setOpen(false); + }; useImperativeHandle(props.myRef, () => ({ - close - })); + close, + })); return ( <> {props?.trigger ? ( @@ -17,6 +17,7 @@ export function MyModal(props?: any) { ) : ( setOpen(true)} /> )} diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 969daac..2b3f86c 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -46,18 +46,12 @@ declare namespace ApiTypes { "asset_houses_id": number; // 房屋ID "type": string; // 类型,[enum:HouseRegistersTypeEnum] "status"?: string; // 状态,[enum:HouseRegistersStatusEnum] - "house_status"?: string; // 房屋状态,[enum:HouseRegistersHouseStatusEnum] - "usage_plan"?: string; // 使用计划,[enum:HouseRegistersUsagePlanEnum] - "customer_type"?: string; // 客户类型,[enum:HouseRegistersCustomerTypeEnum] "customer_info"?: string[]; // 客户信息 "ownership_info"?: string[]; // 产权信息 }; type Update = { "id": number; // id "type": string; // 类型,[enum:HouseRegistersTypeEnum] - "house_status"?: string; // 房屋状态,[enum:HouseRegistersHouseStatusEnum] - "usage_plan"?: string; // 使用计划,[enum:HouseRegistersUsagePlanEnum] - "customer_type"?: string; // 客户类型,[enum:HouseRegistersCustomerTypeEnum] "customer_info"?: string[]; // 客户信息 "ownership_info"?: string[]; // 产权信息 }; @@ -181,6 +175,10 @@ declare namespace ApiTypes { "asset_units_id"?: number; // 所属单元id,[ref:asset_units] "keywords"?: string; // 关键词 }; + type Import = { + "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] + "upload_file"?: mimes:xlsx,xls; // 上传的时候必填文件 + }; } namespace AssetProjects { type List = { @@ -420,6 +418,7 @@ declare namespace ApiTypes { "asset_houses_id"?: number; // 房屋id,[ref:asset_houses] "channel"?: string; // 通知渠道,[enum:HouseCollectionTasksChannelEnum] "status"?: string; // 通知状态,[enum:HouseCollectionRecordsStatusEnum] + "full_name"?: string; // 房屋名称 }; type Show = { "id": number; // id @@ -960,10 +959,10 @@ declare namespace ApiTypes { "id": number; // id "type": string; // 工单类型,[enum:HouseWorkOrdersTypeEnum] "level": string; // 优先级,[enum:HouseWorkOrdersLevelEnum] - "title": string; // 工单标题 "content": string; // 工单内容 "reporter_name"?: string; // 上报人名称 "reporter_phone"?: string; // 上报人手机 + "contact_phone"?: string; // 联系人电话 "attachments"?: string[]; // 工单附件 "asset_houses_id": number; // 资产房屋id,[ref:asset_houses] }; diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 3b32f20..acf3f0d 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -96,6 +96,12 @@ export const Apis = { Select(data?: ApiTypes.Asset.AssetHouses.Select): Promise { return request('admin/asset/asset_houses/select', { data }); }, + Import(data?: ApiTypes.Asset.AssetHouses.Import): Promise { + return request('admin/asset/asset_houses/import', { data }); + }, + DownloadTemplate(): Promise { + return request('admin/asset/asset_houses/download_template', {responseType: 'blob',}); + }, }, AssetProjects: { List(data?: ApiTypes.Asset.AssetProjects.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index ccd2165..bca742a 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#f8c2db","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#2f067d","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -148,6 +148,18 @@ export const CompanyAppsModuleEnum= { 'Customer': {"text":"客户端","color":"#10b981","value":"Customer"}, }; +// CompanyEmployeeBacklogsStatusEnum +export const CompanyEmployeeBacklogsStatusEnum= { + 'Pending': {"text":"待办","color":"#FF6600","value":"Pending"}, + 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, +}; + +// CompanyEmployeeBacklogsTypeEnum +export const CompanyEmployeeBacklogsTypeEnum= { + 'WorkOrder': {"text":"工单","color":"#FF6600","value":"WorkOrder"}, + 'Contract': {"text":"合同","color":"#2A82E4","value":"Contract"}, +}; + // CompanyReceiptAccountsPayChannelEnum export const CompanyReceiptAccountsPayChannelEnum= { 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, @@ -159,7 +171,7 @@ export const CompanyReceiptAccountsPayChannelEnum= { // CustomerBacklogsStatusEnum export const CustomerBacklogsStatusEnum= { 'Pending': {"text":"待办","color":"#faad14","value":"Pending"}, - 'Done': {"text":"已办","color":"#52c41a","value":"Done"}, + 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, }; // CustomerBacklogsTypeEnum @@ -234,18 +246,23 @@ export const HouseOccupantsCardTypeEnum= { // HouseOccupantsHouseRelationEnum export const HouseOccupantsHouseRelationEnum= { 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, - 'Resident': {"text":"住户","color":"#87d068","value":"Resident"}, - 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, + 'NonOwner': {"text":"非产权人","color":"#fa8c16","value":"NonOwner"}, }; // HouseOccupantsRelationWithOwnerEnum export const HouseOccupantsRelationWithOwnerEnum= { - 'Self': {"text":"本人","color":"#52c41a","value":"Self"}, - 'Spouse': {"text":"夫妻","color":"#2db7f5","value":"Spouse"}, - 'FatherSon': {"text":"父子","color":"#faad14","value":"FatherSon"}, - 'MotherSon': {"text":"母子","color":"#fa8c16","value":"MotherSon"}, + 'Spouse': {"text":"配偶","color":"#2db7f5","value":"Spouse"}, 'Children': {"text":"子女","color":"#87d068","value":"Children"}, - 'ContactPerson': {"text":"指定联系人","color":"#f5222d","value":"ContactPerson"}, + 'Parents': {"text":"父母","color":"#faad14","value":"Parents"}, + 'Siblings': {"text":"兄弟姐妹","color":"#fa8c16","value":"Siblings"}, + 'OtherRelatives': {"text":"其他亲属","color":"#f5222d","value":"OtherRelatives"}, +}; + +// HouseOccupantsResidentialRelationEnum +export const HouseOccupantsResidentialRelationEnum= { + 'Resident': {"text":"住户","color":"#2db7f5","value":"Resident"}, + 'PrimaryTenant': {"text":"主租人","color":"#87d068","value":"PrimaryTenant"}, + 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, }; // HouseOccupantsStatusEnum @@ -302,12 +319,12 @@ export const HouseRegistersStatusEnum= { // HouseRegistersTypeEnum export const HouseRegistersTypeEnum= { - 'Delivery': {"text":"入户登记","color":"#2db7f5","value":"Delivery"}, - 'Transfer': {"text":"过户登记","color":"#87d068","value":"Transfer"}, + 'AddOwner': {"text":"添加产权人","color":"#52c41a","value":"AddOwner"}, + 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, 'AddOccupant': {"text":"添加住户","color":"#108ee9","value":"AddOccupant"}, + 'RemoveOccupant': {"text":"移除住户","color":"#fa8c16","value":"RemoveOccupant"}, 'MoveOut': {"text":"搬离登记","color":"#f50","value":"MoveOut"}, 'MoveIn': {"text":"搬入登记","color":"#ffc53d","value":"MoveIn"}, - 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, }; // HouseRegistersUsagePlanEnum diff --git a/src/pages/archive/components/OccupantsNow.tsx b/src/pages/archive/components/OccupantsNow.tsx index 2f93e0e..a77e6b1 100644 --- a/src/pages/archive/components/OccupantsNow.tsx +++ b/src/pages/archive/components/OccupantsNow.tsx @@ -8,8 +8,8 @@ import { import { ProTable } from '@ant-design/pro-components'; import { Popconfirm, Space, Tag } from 'antd'; import { useEffect, useRef } from 'react'; +import Delivery from '../modals/Delivery'; import AddOccupant from './modals/AddOccupant'; -import AddRent from './modals/AddRent'; import MoveIn from './modals/MoveIn'; import MoveOut from './modals/MoveOut'; import OccupantShow from './modals/OccupantShow'; @@ -45,24 +45,30 @@ export default function Index({ ...rest }) { ) } toolBarRender={(action) => [ - , - , - , + !rest.item?.house_occupants?.length ? ( + '' + ) : ( + <> + + + + ), ]} search={false} columns={[ diff --git a/src/pages/archive/components/modals/AddOccupant.tsx b/src/pages/archive/components/modals/AddOccupant.tsx index 8f5c430..3e20db9 100644 --- a/src/pages/archive/components/modals/AddOccupant.tsx +++ b/src/pages/archive/components/modals/AddOccupant.tsx @@ -10,11 +10,13 @@ import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsResidentialRelationEnum, + HouseRegistersTypeEnum, } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; import { Form, message } from 'antd'; -export default function Create(props: MyBetaModalFormProps) { +export default function AddOccupant(props: MyBetaModalFormProps) { const [form] = Form.useForm(); return ( @@ -36,7 +38,13 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Archive.HouseRegisters.Store({ ...values, asset_houses_id: props?.item?.id, - type: 'AddOccupant', + type: HouseRegistersTypeEnum.AddOccupant.value, + customer_info: values.customer_info?.map((res: any) => { + return { + ...res, + house_relation: HouseOccupantsHouseRelationEnum.NonOwner.value, + }; + }), }) .then(() => { props.reload?.(); @@ -50,10 +58,12 @@ export default function Create(props: MyBetaModalFormProps) { valueType: 'formList', dataIndex: 'customer_info', colProps: { span: 24 }, + initialValue: [''], + fieldProps: { copyIconProps: false, creatorButtonProps: { - creatorButtonText: '添加住户', + creatorButtonText: '添加客户', }, itemRender: ( { listDom, action }: any, @@ -63,7 +73,7 @@ export default function Create(props: MyBetaModalFormProps) { @@ -77,16 +87,17 @@ export default function Create(props: MyBetaModalFormProps) { valueType: 'group', columns: [ MyFormItems.EnumRadio({ - key: 'house_relation', - title: '房客关系', - colProps: { span: 6 }, - valueEnum: () => { - let obj: any = JSON.parse( - JSON.stringify(HouseOccupantsHouseRelationEnum), - ); - delete obj.Tenant; - return obj; - }, + key: 'residential_relation', + title: '居住关系', + colProps: { span: 12 }, + valueEnum: HouseOccupantsResidentialRelationEnum, + // valueEnum: () => { + // let obj: any = JSON.parse( + // JSON.stringify(HouseOccupantsResidentialRelationEnum), + // ); + // delete obj.Tenant; + // return obj; + // }, required: true, }), MyFormItems.EnumRadio({ @@ -94,16 +105,8 @@ export default function Create(props: MyBetaModalFormProps) { title: '关系标记', valueEnum: HouseOccupantsRelationWithOwnerEnum, colProps: { span: 18 }, - // valueEnum: () => { - // let obj: any = JSON.parse( - // JSON.stringify(HouseOccupantsRelationWithOwnerEnum), - // ); - // delete obj.Self; - // return obj; - // }, required: true, }), - { title: '姓名', dataIndex: 'name', diff --git a/src/pages/archive/index.tsx b/src/pages/archive/index.tsx index b98a51d..aa4734a 100644 --- a/src/pages/archive/index.tsx +++ b/src/pages/archive/index.tsx @@ -111,7 +111,7 @@ export default function Index({ title = '房屋档案' }) { render: (_, item: any, index, action) => ( { navigate(`/archive/${item.id}`); }} @@ -120,17 +120,10 @@ export default function Index({ title = '房屋档案' }) { ) : ( - { - navigate(`/archive/asset_house/${item.id}`); - }} - /> + '' )} ), diff --git a/src/pages/archive/modals/Delivery.tsx b/src/pages/archive/modals/Delivery.tsx index edcaecc..ecf078f 100644 --- a/src/pages/archive/modals/Delivery.tsx +++ b/src/pages/archive/modals/Delivery.tsx @@ -9,7 +9,7 @@ import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, - HouseRegistersCustomerTypeEnum, + HouseRegistersTypeEnum, } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; import { Form, message } from 'antd'; @@ -19,12 +19,17 @@ export default function Create(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`添加${props.title}`} + title={`${props.title}`} wrapperCol={{ span: 24 }} width="800px" trigger={ - + } + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { @@ -35,13 +40,11 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Archive.HouseRegisters.Store({ ...values, asset_houses_id: props?.item?.id, - type: 'Delivery', + type: HouseRegistersTypeEnum.AddOwner.value, customer_info: values.customer_info?.map((res: any) => { return { ...res, - house_relation: 'Owner', - house_status: 'SelfOccupied', - relation_with_owner: 'Self', + house_relation: HouseOccupantsHouseRelationEnum.Owner.value, }; }), }) @@ -54,38 +57,25 @@ export default function Create(props: MyBetaModalFormProps) { } columns={[ // MyFormItems.EnumRadio({ - // key: 'house_status', - // title: '房屋状态', + // key: 'customer_type', + // title: '产权归属类型', // colProps: { span: 12 }, - // valueEnum: HouseRegistersHouseStatusEnum, - // formItemProps: { ...rulesHelper.text }, + // valueEnum: HouseRegistersCustomerTypeEnum, // }), - // MyFormItems.EnumRadio({ - // key: 'house_status', - // title: '使用计划', - // colProps: { span: 8 }, - // valueEnum: HouseRegistersUsagePlanEnum, - // formItemProps: { ...rulesHelper.text }, - // }), - MyFormItems.EnumSelect({ - key: 'customer_type', - title: '产权归属', - colProps: { span: 6 }, - valueEnum: HouseRegistersCustomerTypeEnum, - }), MyFormItems.UploadImages({ key: 'ownership_info', title: '产权文件', - tooltip: '上限3张', + tooltip: '上限9张', uploadType: 'file', - max: 3, - colProps: { span: 18 }, + max: 9, + colProps: { span: 24 }, formItemProps: { ...rulesHelper.array }, }), { valueType: 'formList', dataIndex: 'customer_info', colProps: { span: 24 }, + initialValue: [''], fieldProps: { copyIconProps: false, creatorButtonProps: { @@ -159,19 +149,21 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.UploadImages({ key: 'card_front_image', title: '证件正面', - uploadType: 'file', + // uploadType: 'file', + required: true, max: 1, colProps: { span: 6 }, }), MyFormItems.UploadImages({ key: 'card_back_image', title: '证件反面', - uploadType: 'file', + // uploadType: 'file', + required: true, max: 1, colProps: { span: 6 }, }), { - title: '是否办理入住', + title: '是否入住', dataIndex: 'is_live_in', colProps: { span: 6 }, valueType: 'switch', diff --git a/src/pages/asset/$id.tsx b/src/pages/asset/$id.tsx index 3b5dc9b..b73f1b1 100644 --- a/src/pages/asset/$id.tsx +++ b/src/pages/asset/$id.tsx @@ -17,7 +17,7 @@ export default function Show({ title }: { title?: string } = {}) { // 注册当前页面为标签页 const { addTab } = usePageTabs({ tabKey: `asset-show-${id}`, - tabLabel: data?.name || title || '资产详情', + tabLabel: data?.name || title || '项目详情', }); const loadShow = () => { @@ -71,7 +71,7 @@ export default function Show({ title }: { title?: string } = {}) { // }, ]; return ( - + loadShow()} /> diff --git a/src/pages/asset/components/AssetInfo.tsx b/src/pages/asset/components/AssetInfo.tsx index 0609bf5..cd38f5e 100644 --- a/src/pages/asset/components/AssetInfo.tsx +++ b/src/pages/asset/components/AssetInfo.tsx @@ -8,7 +8,7 @@ import { import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; -export default function info(props: MyBetaModalFormProps) { +export default function AssetInfo(props: MyBetaModalFormProps) { return ( diff --git a/src/pages/asset/components/modals/HousesCreate.tsx b/src/pages/asset/components/modals/HousesCreate.tsx index 6e52104..fd2db6b 100644 --- a/src/pages/asset/components/modals/HousesCreate.tsx +++ b/src/pages/asset/components/modals/HousesCreate.tsx @@ -9,7 +9,6 @@ import { Apis } from '@/gen/Apis'; import { AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -53,14 +52,20 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 6 }, formItemProps: { ...rulesHelper.text }, }, + MyFormItems.EnumRadio({ + key: 'ownership_type', + title: '房屋属性', + colProps: { span: 24 }, + valueEnum: AssetHousesOwnershipTypeEnum, + // required: true, + }), MyFormItems.EnumRadio({ key: 'usage', title: '用途', - colProps: { span: 18 }, + colProps: { span: 24 }, valueEnum: AssetHousesUsageEnum, required: true, }), - { key: 'floor', title: '楼层', @@ -162,35 +167,29 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: AssetHousesOrientationEnum, // required: true, }), - MyFormItems.EnumRadio({ - key: 'status', - title: '房屋状态', - colProps: { span: 6 }, - // valueEnum: AssetHousesStatusEnum, - // required: true, - valueEnum: () => { - let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); - delete obj.SelfOccupied; - delete obj.Rented; - delete obj.Vacant; - return obj; - }, - }), - MyFormItems.EnumSelect({ - key: 'ownership_type', - title: '产权性质', - colProps: { span: 6 }, - valueEnum: AssetHousesOwnershipTypeEnum, - // required: true, - }), - { - key: 'ownership_term', - title: '产权年限', - fieldProps: { - addonAfter: '年', - }, - colProps: { span: 6 }, - }, + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '房屋状态', + // colProps: { span: 6 }, + // // valueEnum: AssetHousesStatusEnum, + // // required: true, + // valueEnum: () => { + // let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); + // delete obj.SelfOccupied; + // delete obj.Rented; + // delete obj.Vacant; + // return obj; + // }, + // }), + + // { + // key: 'ownership_term', + // title: '产权年限', + // fieldProps: { + // addonAfter: '年', + // }, + // colProps: { span: 6 }, + // }, ]} /> ); diff --git a/src/pages/asset/components/modals/HousesUpdate.tsx b/src/pages/asset/components/modals/HousesUpdate.tsx index d78e434..8584567 100644 --- a/src/pages/asset/components/modals/HousesUpdate.tsx +++ b/src/pages/asset/components/modals/HousesUpdate.tsx @@ -10,7 +10,6 @@ import { Apis } from '@/gen/Apis'; import { AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -25,7 +24,7 @@ export default function Update(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="800px" trigger={ - + } form={form} key={new Date().getTime()} @@ -87,25 +86,31 @@ export default function Update(props: MyBetaModalFormProps) { colProps: { span: 6 }, formItemProps: { ...rulesHelper.number }, }), + { + key: 'name', + title: '房号', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, ], }, ]; }, }, - { - key: 'name', - title: '房号', - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }, + MyFormItems.EnumRadio({ + key: 'ownership_type', + title: '房屋属性', + colProps: { span: 24 }, + valueEnum: AssetHousesOwnershipTypeEnum, + // required: true, + }), MyFormItems.EnumRadio({ key: 'usage', title: '用途', - colProps: { span: 18 }, + colProps: { span: 24 }, valueEnum: AssetHousesUsageEnum, required: true, }), - { key: 'floor', title: '楼层', @@ -207,35 +212,20 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: AssetHousesOrientationEnum, // required: true, }), - MyFormItems.EnumRadio({ - key: 'status', - title: '房屋状态', - colProps: { span: 6 }, - // valueEnum: AssetHousesStatusEnum, - // required: true, - valueEnum: () => { - let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); - delete obj.SelfOccupied; - delete obj.Rented; - delete obj.Vacant; - return obj; - }, - }), - MyFormItems.EnumSelect({ - key: 'ownership_type', - title: '产权性质', - colProps: { span: 6 }, - valueEnum: AssetHousesOwnershipTypeEnum, - // required: true, - }), - { - key: 'ownership_term', - title: '产权年限', - fieldProps: { - addonAfter: '年', - }, - colProps: { span: 6 }, - }, + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '房屋状态', + // colProps: { span: 6 }, + // // valueEnum: AssetHousesStatusEnum, + // // required: true, + // valueEnum: () => { + // let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); + // delete obj.SelfOccupied; + // delete obj.Rented; + // delete obj.Vacant; + // return obj; + // }, + // }), ]} /> ); diff --git a/src/pages/asset/index.tsx b/src/pages/asset/index.tsx index 915de63..790b414 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -1,6 +1,7 @@ import { MyButtons, MyColumns, + MyImportModal, MyPageContainer, MyProTableProps, usePageTabs, @@ -10,7 +11,7 @@ import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; -import Create from './modals/AssetCreate'; +import AssetCreate from './modals/AssetCreate'; export default function Index({ title = '项目管理' }) { const navigate = useNavigate(); @@ -30,7 +31,7 @@ export default function Index({ title = '项目管理' }) { } // headerTitle="项目列表" toolBarRender={(action) => [ - , + , ]} columns={[ MyColumns.ID(), @@ -101,6 +102,14 @@ export default function Index({ title = '项目管理' }) { navigate(`/asset/${item.id}`); }} /> + Apis.Common.Admins.Delete({ id: item.id }).then(() => diff --git a/src/pages/asset/modals/AssetCreate.tsx b/src/pages/asset/modals/AssetCreate.tsx index eac36f7..f510b83 100644 --- a/src/pages/asset/modals/AssetCreate.tsx +++ b/src/pages/asset/modals/AssetCreate.tsx @@ -27,10 +27,14 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="600px" trigger={} + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + companies_id: props?.item?.id, + }); } }} onFinish={async (values) => diff --git a/src/pages/asset/modals/AssetUpdate.tsx b/src/pages/asset/modals/AssetUpdate.tsx index 542ad78..3f7faba 100644 --- a/src/pages/asset/modals/AssetUpdate.tsx +++ b/src/pages/asset/modals/AssetUpdate.tsx @@ -6,7 +6,6 @@ import { rulesHelper, } from '@/common'; import { Address } from '@/components/Address'; -import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { AssetProjectsChargeEnum, @@ -66,12 +65,12 @@ export default function Update(props: MyBetaModalFormProps) { title: '项目别名', colProps: { span: 12 }, }, - Selects?.Companies({ - key: 'companies_id', - title: '所属机构', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.number }, - }), + // Selects?.Companies({ + // key: 'companies_id', + // title: '所属机构', + // colProps: { span: 24 }, + // formItemProps: { ...rulesHelper.number }, + // }), Address.Cascader({ key: 'casacader', title: '选择地址', diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index a61ccd2..8d985b3 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -8,7 +8,6 @@ import { Apis } from '@/gen/Apis'; import { AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; @@ -92,12 +91,12 @@ export default function Index({ title = '房屋列表' }) { valueEnum: AssetHousesOrientationEnum, search: false, }), - MyColumns.EnumTag({ - title: '房屋状态', - dataIndex: 'status', - valueEnum: AssetHousesStatusEnum, - search: false, - }), + // MyColumns.EnumTag({ + // title: '房屋状态', + // dataIndex: 'status', + // valueEnum: AssetHousesStatusEnum, + // search: false, + // }), MyColumns.EnumTag({ title: '产权性质', dataIndex: 'ownership_type', @@ -105,14 +104,14 @@ export default function Index({ title = '房屋列表' }) { search: false, }), - { - title: '产权年限', - dataIndex: 'ownership_term', - render(_, record) { - return `${record?.ownership_term || '-'} 年`; - }, - search: false, - }, + // { + // title: '产权年限', + // dataIndex: 'ownership_term', + // render(_, record) { + // return `${record?.ownership_term || '-'} 年`; + // }, + // search: false, + // }, MyColumns.Option({ render: (_, item: any, index, action) => ( diff --git a/src/pages/banner/index.tsx b/src/pages/banner/index.tsx index b63c5c8..6d61d9e 100644 --- a/src/pages/banner/index.tsx +++ b/src/pages/banner/index.tsx @@ -14,7 +14,7 @@ import BannerCreate from './modals/BannerCreate'; import BannerShow from './modals/BannerShow'; import BannerUpdate from './modals/BannerUpdate'; -export default function Index({ title = '投放内容' }) { +export default function Index({ title = '内容管理' }) { const navigate = useNavigate(); // 注册当前页面为标签页 diff --git a/src/pages/banner_space/index.tsx b/src/pages/banner_space/index.tsx index f921bd1..8671939 100644 --- a/src/pages/banner_space/index.tsx +++ b/src/pages/banner_space/index.tsx @@ -13,7 +13,7 @@ import { Space } from 'antd'; import BannerSpaceCreate from './modals/BannerSpaceCreate'; import BannerSpaceUpdate from './modals/BannerSpaceUpdate'; -export default function Index({ title = '投放位置' }) { +export default function Index({ title = '点位管理' }) { const navigate = useNavigate(); // 注册当前页面为标签页 diff --git a/src/pages/company/$id.tsx b/src/pages/company/$id.tsx index 01f9851..52d8e52 100644 --- a/src/pages/company/$id.tsx +++ b/src/pages/company/$id.tsx @@ -2,15 +2,17 @@ import { MyPageContainer, usePageTabs } from '@/common'; import { Apis } from '@/gen/Apis'; import { ProCard } from '@ant-design/pro-components'; import { useParams } from '@umijs/max'; -import { Tabs } from 'antd'; +import { Space, Tabs } from 'antd'; import { useEffect, useState } from 'react'; + +import Assets from './components/Assets'; import CompanyApps from './components/CompanyApps'; import ComponentsInfo from './components/ComponentsInfo'; import Employees from './components/Employees'; import Organizations from './components/Organizations'; import Positions from './components/Positions'; -import Projects from './components/Projects'; import ReceiptAccounts from './components/ReceiptAccounts'; +import CompanyUpdate from './modals/CompanyUpdate'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -19,7 +21,7 @@ export default function Show({ title }: { title?: string } = {}) { // 注册当前页面为标签页 const { addTab } = usePageTabs({ tabKey: `company-show-${id}`, - tabLabel: data?.short_name || title || '资产详情', + tabLabel: '配置:' + (data?.short_name || title || '资产详情'), }); const loadShow = () => { let paramsId: any = { id: id ?? 0 }; @@ -41,37 +43,37 @@ export default function Show({ title }: { title?: string } = {}) { let items = [ { - label: '项目管理', + label: '1-项目配置', key: '1', closable: false, - children: , + children: , }, { - label: '组织管理', + label: '2-组织配置', key: '2', closable: false, children: , }, { - label: '岗位管理', + label: '3-岗位配置', key: '3', closable: false, children: , }, { - label: '员工管理', + label: '4-员工配置', key: '4', closable: false, children: , }, { - label: '收款账号', + label: '5-账号配置', key: '5', closable: false, children: , }, { - label: '应用管理', + label: '6-应用配置', key: '6', closable: false, children: , @@ -79,7 +81,24 @@ export default function Show({ title }: { title?: string } = {}) { ]; return ( - + {/* */} + + + + + } + > +
+ * 您可在以下页签中对应配置:项目、组织、岗位、员工、账号、应用; +
+
diff --git a/src/pages/company/components/Projects.tsx b/src/pages/company/components/Assets.tsx similarity index 88% rename from src/pages/company/components/Projects.tsx rename to src/pages/company/components/Assets.tsx index cf2e441..e20111a 100644 --- a/src/pages/company/components/Projects.tsx +++ b/src/pages/company/components/Assets.tsx @@ -9,6 +9,7 @@ import { AssetProjectsPropertyTypeEnum, AssetProjectsStatusEnum, } from '@/gen/Enums'; +import AssetCreate from '@/pages/asset/modals/AssetCreate'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; @@ -27,16 +28,16 @@ export default function Index(props: MyBetaModalFormProps) { Apis.Asset.AssetProjects.List, ) } - // toolBarRender={(action) => [ - // , - // ]} + toolBarRender={(action) => [ + , + ]} // search={false} - options={false} + // options={false} columns={[ MyColumns.ID(), { diff --git a/src/pages/company/components/ComponentsInfo.tsx b/src/pages/company/components/ComponentsInfo.tsx index 109270c..ced50f0 100644 --- a/src/pages/company/components/ComponentsInfo.tsx +++ b/src/pages/company/components/ComponentsInfo.tsx @@ -1,62 +1,69 @@ import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; import { CompaniesMerchantTypeEnum } from '@/gen/Enums'; import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; -import CompanyUpdate from '../modals/CompanyUpdate'; export default function info(props: MyBetaModalFormProps) { return ( - - - - - {props?.item?.short_name} - - - - {props?.item?.name} - - - - - - + + + + + {props?.item?.short_name} + + + + {props?.item?.name} + {/* */} + + + + + - - {props?.item?.business_license_number} - + + {props?.item?.business_license_number} + - - {props?.item?.contact_name} - - - {props?.item?.contact_phone} - - - {props?.item?.contact_email} - - - {props?.item?.province || ''} - {props?.item?.city || ''} - {props?.item?.district || ''} - {props?.item?.address || ''} - - - {props?.item?.created_at} - - - {props?.item?.updated_at} - - - - + + {props?.item?.contact_name} + + + {props?.item?.contact_phone} + + + {props?.item?.contact_email} + + + {props?.item?.province || ''} + {props?.item?.city || ''} + {props?.item?.district || ''} + {props?.item?.address || ''} + + + {props?.item?.created_at} + + + {props?.item?.updated_at} + + +
+ + } + /> ); } diff --git a/src/pages/company/components/Organizations.tsx b/src/pages/company/components/Organizations.tsx index bbfe981..83c3b43 100644 --- a/src/pages/company/components/Organizations.tsx +++ b/src/pages/company/components/Organizations.tsx @@ -33,7 +33,7 @@ export default function Organizations(props: MyBetaModalFormProps) { />, ]} // search={false} - options={false} + // options={false} columns={[ MyColumns.EnumTag({ title: '组织类型', diff --git a/src/pages/company/index.tsx b/src/pages/company/index.tsx index 47d2690..2238d82 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/index.tsx @@ -10,7 +10,9 @@ import { CompaniesMerchantTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; +import ComponentsInfo from './components/ComponentsInfo'; import CompanyCreate from './modals/CompanyCreate'; +import CompanyUpdate from './modals/CompanyUpdate'; export default function Index({ title = '机构列表' }) { const navigate = useNavigate(); @@ -61,8 +63,18 @@ export default function Index({ title = '机构列表' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( + + { navigate(`/company/${item.id}`); }} diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx index 43bf235..af1d819 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -13,7 +13,6 @@ import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, - HouseRegistersHouseStatusEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -57,17 +56,17 @@ export default function Update(props: MyBetaModalFormProps) { valueType: 'text', renderFormItem: () => ( - - + + {props?.item?.asset_house?.full_name || '-'} - + {/* - + */} { - tabsApi.addTab({ - key, - label, - path, - closable: true - }); - // 注意:在实际项目中,这里应该使用 history.push(path) - // 由于这是演示,我们只是添加标签而不实际跳转 - console.log(`模拟跳转到: ${path}`); - }; - - const demoTabs = [ - { - key: 'employees', - label: '员工管理', - path: '/employees', - icon: , - description: '管理公司员工信息' - }, - { - key: 'companies', - label: '公司管理', - path: '/company/companies', - icon: , - description: '管理公司基本信息' - }, - { - key: 'house-bills', - label: '房屋账单', - path: '/house_bills', - icon: , - description: '查看和管理房屋账单' - }, - { - key: 'system-admins', - label: '系统管理员', - path: '/system/admins', - icon: , - description: '管理系统管理员账户' - }, - { - key: 'system-roles', - label: '角色管理', - path: '/system/sys_roles', - icon: , - description: '管理系统角色权限' - } - ]; - - return ( - - - - {/* 统计信息 */} - - - - } - /> - - - - - - - - - - } - /> - - - - - } - /> - - - - - {/* 快速打开标签页 */} - - - {demoTabs.map(tab => ( - - openTab(tab.key, tab.label, tab.path)} - style={{ cursor: 'pointer', textAlign: 'center' }} - > -
- {tab.icon} -
-
- {tab.label} -
-
- {tab.description} -
-
- - ))} -
-
- - {/* 标签页操作 */} - - - - - - - - - - - - - - - {/* 功能说明 */} - - - -

🎯 核心功能

-
    -
  • 多标签页支持:支持同时打开多个页面标签
  • -
  • 右键菜单:右键点击标签页显示操作菜单
  • -
  • 智能导航:关闭标签时自动切换到相邻标签
  • -
  • 状态持久化:标签页状态在组件间共享
  • -
  • 自定义样式:支持主题定制和样式覆盖
  • -
- - - -

🖱️ 右键菜单操作

-
    -
  • 刷新:重新加载当前标签页
  • -
  • 关闭:关闭当前标签页
  • -
  • 关闭其他:关闭除当前标签外的所有标签
  • -
  • 关闭左侧:关闭当前标签左侧的所有标签
  • -
  • 关闭右侧:关闭当前标签右侧的所有标签
  • -
- -
- - - -

💡 使用提示

-
    -
  • 点击上方的页面卡片可以快速打开对应的标签页
  • -
  • 右键点击任意标签页可以看到完整的操作菜单
  • -
  • 使用工具栏按钮可以批量操作标签页
  • -
  • 演示页面(当前页面)被设置为不可关闭
  • -
  • 在实际项目中,标签页会自动与路由系统集成
  • -
-
-
- ); -} \ No newline at end of file From 0e49b5cf60919aa919f96fa0b9b0f9b5768bfa4a Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Fri, 29 Aug 2025 13:56:53 +0800 Subject: [PATCH 3/9] =?UTF-8?q?frat=EF=BC=9A=E6=89=B9=E9=87=8F=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=EF=BC=9B=E5=85=AC=E5=91=8A=EF=BC=9B=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=B0=83=E6=95=B4=EF=BC=9B=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.ts | 5 - .../components/formFields/MyUploadImages.tsx | 59 +++-- .../components/layout/MyImportModal.tsx | 12 +- .../components/layout/MyPageContainer.tsx | 4 +- src/common/components/layout/TabsExample.tsx | 191 -------------- src/common/components/schema/MyFormItems.tsx | 10 +- src/common/index.tsx | 2 +- src/gen/ApiTypes.d.ts | 64 +++++ src/gen/Apis.ts | 37 +++ src/gen/Enums.ts | 2 +- src/pages/announcement/index.tsx | 146 +++++++++++ .../modals/AnnouncementCreate.tsx | 92 +++++++ .../announcement/modals/AnnouncementShow.tsx | 53 ++++ .../modals/AnnouncementUpdate.tsx | 95 +++++++ src/pages/archive/components/OccupantsNow.tsx | 6 +- .../archive/components/modals/AddOccupant.tsx | 246 ++++++++++++------ .../archive/components/modals/AddRent.tsx | 188 ------------- src/pages/asset/$id.tsx | 36 ++- src/pages/asset/components/AssetBuildings.tsx | 43 ++- src/pages/asset/components/AssetGrid.tsx | 8 +- src/pages/asset/components/AssetInfo.tsx | 129 +++++---- src/pages/asset/components/Basic.tsx | 66 ++++- .../asset/components/modals/BindCompany.tsx | 4 +- .../asset/components/modals/GridCreate.tsx | 6 +- .../asset/components/modals/GridMannger.tsx | 4 +- .../asset/components/modals/HousesCreate.tsx | 2 +- .../asset/components/modals/UnitsCreate.tsx | 4 +- .../asset/components/modals/UnitsUpdate.tsx | 4 +- src/pages/asset/index.tsx | 28 +- src/pages/asset_houses/index.tsx | 1 - src/pages/bills/index.tsx | 10 + src/pages/company/components/Employees.tsx | 8 +- .../company/components/Organizations.tsx | 19 +- .../components/modals/OrganizationChange.tsx | 4 +- .../components/modals/OrganizationCreate.tsx | 56 ++-- .../components/modals/OrganizationUpdate.tsx | 18 +- .../modals/ReceiptAccountCreate.tsx | 17 ++ .../modals/ReceiptAccountUpdate.tsx | 17 ++ src/pages/company/index.tsx | 19 +- src/pages/company/modals/CompanyCreate.tsx | 2 + src/pages/employees/index.tsx | 10 +- .../house_registers_audit/modals/Audit.tsx | 31 ++- 42 files changed, 1066 insertions(+), 692 deletions(-) delete mode 100644 src/common/components/layout/TabsExample.tsx create mode 100644 src/pages/announcement/index.tsx create mode 100644 src/pages/announcement/modals/AnnouncementCreate.tsx create mode 100644 src/pages/announcement/modals/AnnouncementShow.tsx create mode 100644 src/pages/announcement/modals/AnnouncementUpdate.tsx delete mode 100644 src/pages/archive/components/modals/AddRent.tsx diff --git a/.umirc.ts b/.umirc.ts index 52c94ec..9539141 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -14,14 +14,9 @@ export default defineConfig({ }, proxy: { '/api/': { -<<<<<<< HEAD // target: 'http://yt:8003', target: 'http://10.39.13.80:8001', // target: 'https://weapp-api.linyikj.com.cn/', -======= - target: 'http://yt:8001', - // target: 'http://10.39.13.80:8001', ->>>>>>> 1275c157f58b27d4d2b966e91a73bab4f3360be2 // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', changeOrigin: true, diff --git a/src/common/components/formFields/MyUploadImages.tsx b/src/common/components/formFields/MyUploadImages.tsx index 9eaa355..c59a0f5 100644 --- a/src/common/components/formFields/MyUploadImages.tsx +++ b/src/common/components/formFields/MyUploadImages.tsx @@ -83,27 +83,44 @@ export function MyUploadImages({ Apis.Common.Auth.PreUpload({ filename: file.name, alc: 'public-read', - }).then(async (res) => { - axios - .put(res.data.url, file, { - headers: res.data.headers, - onUploadProgress: ({ total, loaded }) => { - if (total) - onProgress( - { percent: Math.round((loaded / total) * 100).toFixed(2) }, - file, - ); - }, - }) - .then(({ data: response }) => { - console.log('response', response); - if (response.errorMessage) { - onError(response, file); - } else { - onSuccess(res.data.url.split('?')[0], file); - } - }); - }); + }) + .then(async (res) => { + try { + axios + .put(res.data.url, file, { + headers: res.data.headers, + onUploadProgress: ({ total, loaded }) => { + if (total) + onProgress( + { percent: Math.round((loaded / total) * 100).toFixed(2) }, + file, + ); + }, + }) + .then(({ data: response }) => { + console.log('response', response); + if (response && response.errorMessage) { + onError(response, file); + } else { + // 确保URL正确处理 + const fileUrl = res.data.url.split('?')[0]; + console.log('文件上传成功,URL:', fileUrl); + onSuccess(fileUrl, file); + } + }) + .catch((error) => { + console.error('上传文件时出错:', error); + onError(error, file); + }); + } catch (error) { + console.error('处理上传请求时出错:', error); + onError(error, file); + } + }) + .catch((error) => { + console.error('获取预上传URL时出错:', error); + onError(error, file); + }); return { abort() { diff --git a/src/common/components/layout/MyImportModal.tsx b/src/common/components/layout/MyImportModal.tsx index 9685dc6..7de6d39 100644 --- a/src/common/components/layout/MyImportModal.tsx +++ b/src/common/components/layout/MyImportModal.tsx @@ -7,6 +7,7 @@ type MyImportModalType = { title?: string; type?: any; params?: Record; + size?: 'small' | 'middle' | 'large'; templateApi?: () => Promise; importApi: (data: any) => Promise; reload?: () => void; @@ -17,17 +18,22 @@ export function MyImportModal(props: MyImportModalType) { const [loading, setLoading] = useState(false); const [formData, setFormData] = useState(undefined); - const { title = '批量导入', params = {}, type = 'primary' } = props; + const { + title = '批量导入', + params = {}, + type = 'primary', + size = 'middle', + } = props; return ( <> {type === 'danger' ? ( - ) : ( - diff --git a/src/common/components/layout/MyPageContainer.tsx b/src/common/components/layout/MyPageContainer.tsx index 6341496..d14142b 100644 --- a/src/common/components/layout/MyPageContainer.tsx +++ b/src/common/components/layout/MyPageContainer.tsx @@ -364,7 +364,8 @@ export function MyPageContainer({ onChange={handleTabChange} onEdit={handleTabEdit} hideAdd - size="small" + size="middle" + // 标签size renderTabBar={renderTabBar} items={tabs.map((tab) => ({ key: tab.key, @@ -372,6 +373,7 @@ export function MyPageContainer({ closable: tab.closable, }))} style={{ + marginTop: 6, marginBottom: 0, }} className="tabs-header-only" diff --git a/src/common/components/layout/TabsExample.tsx b/src/common/components/layout/TabsExample.tsx deleted file mode 100644 index f1eaa68..0000000 --- a/src/common/components/layout/TabsExample.tsx +++ /dev/null @@ -1,191 +0,0 @@ -import { PlusOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'; -import { history } from '@umijs/max'; -import { Button, Card, Divider, Space } from 'antd'; -import { MyPageContainer } from './MyPageContainer'; -import { usePageTabs } from './usePageTabs'; - -/** - * 标签页使用示例组件 - * 展示如何使用MyPageContainer的多标签页功能 - */ -export function TabsExample() { - const tabsApi = usePageTabs({ - tabKey: 'tabs-example', - tabLabel: '标签页示例', - }); - - const handleAddTab = (key: string, label: string, path: string) => { - tabsApi.addTab({ - key, - label, - path, - closable: true, - }); - history.push(path); - }; - - const handleAddTabNext = (key: string, label: string, path: string) => { - tabsApi.addTabNext({ - key, - label, - path, - closable: true, - }); - history.push(path); - }; - - return ( - - - - - - - - - - - 在当前标签右侧打开新标签 - - - - - - - - - - - - - - - - - - - - - - - -
-

🎯 核心功能

-
    -
  • - 多标签页支持:支持同时打开多个页面标签 -
  • -
  • - 智能标签插入 - :新标签页默认在当前激活标签页的右边插入 -
  • -
  • - 右键菜单:右键点击标签页显示操作菜单 -
  • -
  • - 智能导航:关闭标签时自动切换到相邻标签 -
  • -
  • - 状态持久化:标签页状态在组件间共享 -
  • -
- -

🖱️ 右键菜单操作

-
    -
  • - 刷新:重新加载当前标签页 -
  • -
  • - 关闭:关闭当前标签页 -
  • -
  • - 关闭其他:关闭除当前标签外的所有标签 -
  • -
  • - 关闭左侧:关闭当前标签左侧的所有标签 -
  • -
  • - 关闭右侧:关闭当前标签右侧的所有标签 -
  • -
- -

💻 使用方法

-
-            {`// 1. 在页面组件中使用
-import { MyPageContainer, usePageTabs } from '@/common';
-
-function YourPage() {
-  usePageTabs({
-    tabKey: 'your-page',
-    tabLabel: '页面标题'
-  });
-
-  return (
-    
-      {/* 页面内容 */}
-    
-  );
-}`}
-          
-
-
-
- ); -} diff --git a/src/common/components/schema/MyFormItems.tsx b/src/common/components/schema/MyFormItems.tsx index 57c4e96..1a932d4 100644 --- a/src/common/components/schema/MyFormItems.tsx +++ b/src/common/components/schema/MyFormItems.tsx @@ -46,15 +46,7 @@ export const MyFormItems = { ...props, }; }, - // RichText(props: PropsType): ReturnType { - // return { - // renderFormItem: () => , - // formItemProps: { - // ...(props?.required ? rulesHelper.richtext : {}), - // }, - // ...props, - // }; - // }, + UploadImages({ max = 1, help, diff --git a/src/common/index.tsx b/src/common/index.tsx index 6cc2566..44c4a49 100644 --- a/src/common/index.tsx +++ b/src/common/index.tsx @@ -10,7 +10,7 @@ export * from './components/layout/MyCommonModal'; export * from './components/layout/MyImportModal'; export * from './components/layout/MyPageContainer'; export * from './components/layout/MyRootContainer'; -export * from './components/layout/TabsExample'; + export * from './components/layout/usePageTabs'; export * from './components/props/MyDrawerProps'; diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 2b3f86c..33c1b83 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -121,6 +121,7 @@ declare namespace ApiTypes { "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] "asset_units_id"?: number; // 所属单元id,[ref:asset_units] "name"?: string; // 模糊搜索:名称 + "full_name"?: string; // 模糊搜索:全称 }; type Store = { "asset_projects_id": number; // 所属项目id,[ref:asset_projects] @@ -179,6 +180,15 @@ declare namespace ApiTypes { "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] "upload_file"?: mimes:xlsx,xls; // 上传的时候必填文件 }; + type Export = { + "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] + "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] + "asset_units_id"?: number; // 所属单元id,[ref:asset_units] + "name"?: string; // 模糊搜索:名称 + "full_name"?: string; // 模糊搜索:全称 + "current"?: number; // 页码 + "download_type": string; // 下载类型:page 当前页(含查询条件),query 所有页(含查询条件),all所有记录 + }; } namespace AssetProjects { type List = { @@ -409,6 +419,9 @@ declare namespace ApiTypes { type Delete = { "id": number; // id }; + type Import = { + "upload_file"?: mimes:xlsx,xls; // 上传的时候必填文件 + }; } } namespace Collcetion { @@ -589,6 +602,7 @@ declare namespace ApiTypes { type List = { "companies_id"?: number; // 机构ID "organizations_id"?: number; // 组织机构ID + "organization_name"?: string; // 组织机构名称 "name"?: string; // 模糊搜索:名称 "phone"?: string; // 模糊搜索:手机号 }; @@ -729,6 +743,12 @@ declare namespace ApiTypes { "name"?: string; // 模糊搜索:名称 "companies_id"?: number; // 机构ID[ref:companies] "parent_id"?: number; // 父级ID + "company_name"?: string; // 机构名称 + }; + type TreeList = { + "name"?: string; // 模糊搜索:名称 + "companies_id"?: number; // 机构ID[ref:companies] + "parent_id"?: number; // 父级ID }; type Store = { "companies_id": number; // 所属机构id,[ref:companies] @@ -852,6 +872,50 @@ declare namespace ApiTypes { }; } } + namespace Msg { + namespace MsgPropertyAnnouncements { + type List = { + "title"?: string; // 模糊搜索:标题 + "asset_projects_id"?: number; // 项目id,[ref:asset_projects] + "project_name"?: string; // 模糊搜索:项目名称 + "is_publish"?: number; // 是否发布 + }; + type Store = { + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "title": string; // 标题 + "content": string; // 内容 + "is_publish"?: number; // 是否发布 + "publish_at"?: Date; // 发布时间 + "sort"?: number; // 排序 + }; + type Update = { + "id": number; // id + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "companies_id": number; // 公司id,[ref:companies] + "title": string; // 标题 + "content": string; // 内容 + "is_publish"?: number; // 是否发布 + "publish_at"?: mixed; // 发布时间 + "sort"?: number; // 排序 + "admins_id"?: number; // 创建人id,[ref:admins] + "company_employees_id"?: number; // 创建员工id,[ref:company_employees] + "last_update_admins_id"?: number; // 最后修改人id,[ref:admins] + "last_update_company_employees"?: number; // 最后修改员工id,[ref:company_employees] + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace Permission { namespace SysPermissions { type List = { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index acf3f0d..40bd372 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -102,6 +102,9 @@ export const Apis = { DownloadTemplate(): Promise { return request('admin/asset/asset_houses/download_template', {responseType: 'blob',}); }, + Export(data: ApiTypes.Asset.AssetHouses.Export): Promise { + return request('admin/asset/asset_houses/export', { responseType: 'blob',data }); + }, }, AssetProjects: { List(data?: ApiTypes.Asset.AssetProjects.List): Promise { @@ -218,6 +221,12 @@ export const Apis = { Delete(data: ApiTypes.Bill.HouseBills.Delete): Promise { return request('admin/bill/house_bills/delete', { data }); }, + Import(data?: ApiTypes.Bill.HouseBills.Import): Promise { + return request('admin/bill/house_bills/import', { data }); + }, + DownloadTemplate(): Promise { + return request('admin/bill/house_bills/download_template', {responseType: 'blob',}); + }, }, }, Collcetion: { @@ -429,6 +438,9 @@ export const Apis = { List(data?: ApiTypes.Company.Organizations.List): Promise { return request('admin/company/organizations/list', { data }); }, + TreeList(data?: ApiTypes.Company.Organizations.TreeList): Promise { + return request('admin/company/organizations/tree_list', { data }); + }, Store(data: ApiTypes.Company.Organizations.Store): Promise { return request('admin/company/organizations/store', { data }); }, @@ -513,6 +525,31 @@ export const Apis = { }, }, }, + Msg: { + MsgPropertyAnnouncements: { + List(data?: ApiTypes.Msg.MsgPropertyAnnouncements.List): Promise { + return request('admin/msg/msg_property_announcements/list', { data }); + }, + Store(data: ApiTypes.Msg.MsgPropertyAnnouncements.Store): Promise { + return request('admin/msg/msg_property_announcements/store', { data }); + }, + Update(data: ApiTypes.Msg.MsgPropertyAnnouncements.Update): Promise { + return request('admin/msg/msg_property_announcements/update', { data }); + }, + Show(data: ApiTypes.Msg.MsgPropertyAnnouncements.Show): Promise { + return request('admin/msg/msg_property_announcements/show', { data }); + }, + SoftDelete(data: ApiTypes.Msg.MsgPropertyAnnouncements.SoftDelete): Promise { + return request('admin/msg/msg_property_announcements/soft_delete', { data }); + }, + Restore(data: ApiTypes.Msg.MsgPropertyAnnouncements.Restore): Promise { + return request('admin/msg/msg_property_announcements/restore', { data }); + }, + Delete(data: ApiTypes.Msg.MsgPropertyAnnouncements.Delete): Promise { + return request('admin/msg/msg_property_announcements/delete', { data }); + }, + }, + }, Permission: { SysPermissions: { List(data: ApiTypes.Permission.SysPermissions.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index bca742a..33fbc82 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#2f067d","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#f002cf","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum diff --git a/src/pages/announcement/index.tsx b/src/pages/announcement/index.tsx new file mode 100644 index 0000000..f35b691 --- /dev/null +++ b/src/pages/announcement/index.tsx @@ -0,0 +1,146 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import AnnouncementCreate from './modals/AnnouncementCreate'; +import AnnouncementShow from './modals/AnnouncementShow'; +import AnnouncementUpdate from './modals/AnnouncementUpdate'; + +export default function Index({ title = '内容管理' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'banners', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Msg.MsgPropertyAnnouncements.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + + { + title: '标题', + dataIndex: 'title', + width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) + render: (text) => ( +
+ {text} +
+ ), + }, + { + title: '内容', + dataIndex: 'content', + valueType: 'textarea', // 仅影响表单编辑时的输入类型,不影响表格展示 + search: false, + width: 200, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) + render: (text) => ( +
+ {text} +
+ ), + }, + { + title: '发布日期', + dataIndex: 'publish_at', + valueType: 'date', + search: false, + }, + { + title: '项目', + dataIndex: ['asset_project', 'name'], + search: false, + render: (_, record) => { + return record?.asset_project?.name; + }, + }, + MyColumns.SoftDelete({ + title: '启/禁用', + onRestore: Apis.Msg.MsgPropertyAnnouncements.Restore, + onSoftDelete: Apis.Msg.MsgPropertyAnnouncements.SoftDelete, + search: false, + }), + { + //创建日期 + title: '创建日期', + dataIndex: 'created_at', + valueType: 'date', + search: false, + // render: (_, record) => { + // return record?.created_at?.substring(0, 10); + // }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Banner.Banners.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/announcement/modals/AnnouncementCreate.tsx b/src/pages/announcement/modals/AnnouncementCreate.tsx new file mode 100644 index 0000000..e7e869f --- /dev/null +++ b/src/pages/announcement/modals/AnnouncementCreate.tsx @@ -0,0 +1,92 @@ +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 Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加公告`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Msg.MsgPropertyAnnouncements.Store(values) + .then(() => { + props.reload?.(); + message.success('添加公告内容成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'title', + title: '公告标题', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'content', + title: '公告内容', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + autoSize: { minRows: 4, maxRows: 6 }, + }, + }, + { + key: 'publish_at', + title: '内容显示的发布日期', + valueType: 'date', + colProps: { span: 12 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '请选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + + // { + // key: 'is_publish', + // title: '是否立刻发布', + // valueType: 'switch', + // colProps: { span: 8 }, + // }, + { + key: 'sort', + title: '排序', + valueType: 'digit', + colProps: { span: 12 }, + tooltip: '数值越大越靠前', + fieldProps: { + placeholder: '数值越大越靠前', + min: 0, + style: { width: '100%' }, + }, + initialValue: 0, + }, + ]} + /> + ); +} diff --git a/src/pages/announcement/modals/AnnouncementShow.tsx b/src/pages/announcement/modals/AnnouncementShow.tsx new file mode 100644 index 0000000..e2b7215 --- /dev/null +++ b/src/pages/announcement/modals/AnnouncementShow.tsx @@ -0,0 +1,53 @@ +import { MyBetaModalFormProps } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Typography } from 'antd'; + +const { Text } = Typography; + +export default function info(props: MyBetaModalFormProps) { + return ( + + + + {props?.item?.title || '-'} + + + +
+ {props?.item?.content || '-'} +
+
+ + + {props?.item?.publish_at || '-'} + + + {props?.item?.asset_project?.name || '-'} + + + {props?.item?.created_at || '-'} + +
+
+ } + /> + ); +} diff --git a/src/pages/announcement/modals/AnnouncementUpdate.tsx b/src/pages/announcement/modals/AnnouncementUpdate.tsx new file mode 100644 index 0000000..2a2043f --- /dev/null +++ b/src/pages/announcement/modals/AnnouncementUpdate.tsx @@ -0,0 +1,95 @@ +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 ( + + {...MyModalFormProps.props} + title={`编辑公告内容`} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Msg.MsgPropertyAnnouncements.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑公告内容成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'title', + title: '公告标题', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'content', + title: '公告内容', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + autoSize: { minRows: 4, maxRows: 6 }, + }, + }, + { + key: 'publish_at', + title: '内容显示的发布日期', + valueType: 'date', + colProps: { span: 12 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '请选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + // { + // key: 'is_publish', + // title: '是否立刻发布', + // valueType: 'switch', + // colProps: { span: 8 }, + // }, + { + key: 'sort', + title: '排序', + valueType: 'digit', + colProps: { span: 12 }, + tooltip: '数值越大越靠前', + fieldProps: { + placeholder: '数值越大越靠前', + min: 0, + style: { width: '100%' }, + }, + initialValue: 0, + }, + ]} + /> + ); +} diff --git a/src/pages/archive/components/OccupantsNow.tsx b/src/pages/archive/components/OccupantsNow.tsx index a77e6b1..7066593 100644 --- a/src/pages/archive/components/OccupantsNow.tsx +++ b/src/pages/archive/components/OccupantsNow.tsx @@ -79,9 +79,9 @@ export default function Index({ ...rest }) { search: false, }), MyColumns.EnumTag({ - // title: - // rest?.item?.status === 'Rented' ? '与租客关系' : '与业主关系', - title: '关系说明', + title: + rest?.item?.status === 'Rented' ? '与主租人关系' : '与产权人关系', + // title: '关系说明', dataIndex: 'relation_with_owner', valueEnum: HouseOccupantsRelationWithOwnerEnum, search: false, diff --git a/src/pages/archive/components/modals/AddOccupant.tsx b/src/pages/archive/components/modals/AddOccupant.tsx index 3e20db9..fcd3e5f 100644 --- a/src/pages/archive/components/modals/AddOccupant.tsx +++ b/src/pages/archive/components/modals/AddOccupant.tsx @@ -59,7 +59,6 @@ export default function AddOccupant(props: MyBetaModalFormProps) { dataIndex: 'customer_info', colProps: { span: 24 }, initialValue: [''], - fieldProps: { copyIconProps: false, creatorButtonProps: { @@ -86,27 +85,47 @@ export default function AddOccupant(props: MyBetaModalFormProps) { { valueType: 'group', columns: [ - MyFormItems.EnumRadio({ - key: 'residential_relation', - title: '居住关系', - colProps: { span: 12 }, - valueEnum: HouseOccupantsResidentialRelationEnum, - // valueEnum: () => { - // let obj: any = JSON.parse( - // JSON.stringify(HouseOccupantsResidentialRelationEnum), - // ); - // delete obj.Tenant; - // return obj; - // }, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'relation_with_owner', - title: '关系标记', - valueEnum: HouseOccupantsRelationWithOwnerEnum, - colProps: { span: 18 }, - required: true, - }), + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'residential_relation', + title: '居住关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsResidentialRelationEnum, + // valueEnum: () => { + // let obj: any = JSON.parse( + // JSON.stringify(HouseOccupantsResidentialRelationEnum), + // ); + // delete obj.Tenant; + // return obj; + // }, + required: true, + }), + { + name: ['residential_relation'], + valueType: 'dependency', + columns: ({ residential_relation }: any) => { + return residential_relation !== + HouseOccupantsResidentialRelationEnum.PrimaryTenant + .value + ? [ + MyFormItems.EnumRadio({ + key: 'relation_with_owner', + title: + residential_relation === 'Resident' + ? '与产权人关系' + : '与主租人关系', + valueEnum: HouseOccupantsRelationWithOwnerEnum, + colProps: { span: 16 }, + required: true, + }), + ] + : []; + }, + }, + ], + }, { title: '姓名', dataIndex: 'name', @@ -122,69 +141,130 @@ export default function AddOccupant(props: MyBetaModalFormProps) { }, formItemProps: { ...rulesHelper.phone }, }, - MyFormItems.EnumSelect({ - key: 'card_type', - title: '证件类型', - colProps: { span: 6 }, - valueEnum: HouseOccupantsCardTypeEnum, - required: true, - }), - { - title: '证件号码', - dataIndex: 'id_card', - colProps: { span: 6 }, - fieldProps: { - maxLength: 18, - }, - formItemProps: { ...rulesHelper.text }, - }, { - valueType: 'group', - columns: [ - MyFormItems.UploadImages({ - key: 'card_front_image', - title: '证件正面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - MyFormItems.UploadImages({ - key: 'card_back_image', - title: '证件反面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - { - title: '是否入住', - dataIndex: 'is_live_in', - colProps: { span: 6 }, - valueType: 'switch', - }, - { - name: ['is_live_in'], - valueType: 'dependency', - columns: ({ is_live_in }: any) => { - return is_live_in - ? [ - { - title: '入住日期', - dataIndex: 'move_in_date', - valueType: 'date', - colProps: { span: 6 }, - fieldProps: { - style: { width: '100%' }, - }, - formItemProps: { ...rulesHelper.text }, - }, - ] - : []; - }, - }, - ], + name: ['residential_relation'], + valueType: 'dependency', + columns: ({ residential_relation }: any) => { + return residential_relation === + HouseOccupantsResidentialRelationEnum.PrimaryTenant.value + ? [ + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 6 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 6 }, + required: true, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '是否入住', + dataIndex: 'is_live_in', + colProps: { span: 6 }, + valueType: 'switch', + }, + { + name: ['is_live_in'], + valueType: 'dependency', + columns: ({ is_live_in }: any) => { + return is_live_in + ? [ + { + title: '入住日期', + dataIndex: 'move_in_date', + valueType: 'date', + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + ] + : [ + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 6 }, + valueEnum: HouseOccupantsCardTypeEnum, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 6 }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + { + title: '是否入住', + dataIndex: 'is_live_in', + colProps: { span: 6 }, + valueType: 'switch', + }, + { + name: ['is_live_in'], + valueType: 'dependency', + columns: ({ is_live_in }: any) => { + return is_live_in + ? [ + { + title: '入住日期', + dataIndex: 'move_in_date', + valueType: 'date', + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + ]; + }, }, ], }, diff --git a/src/pages/archive/components/modals/AddRent.tsx b/src/pages/archive/components/modals/AddRent.tsx deleted file mode 100644 index 65a87df..0000000 --- a/src/pages/archive/components/modals/AddRent.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Apis } from '@/gen/Apis'; -import { - HouseOccupantsCardTypeEnum, - HouseOccupantsHouseRelationEnum, - HouseOccupantsRelationWithOwnerEnum, -} 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" - trigger={ - - } - key={new Date().getTime()} - form={form} - onOpenChange={(open: any) => { - if (open) { - form.resetFields(); // 清空表单数据 - } - }} - onFinish={async (values) => - Apis.Archive.HouseRegisters.Store({ - ...values, - asset_houses_id: props?.item?.id, - house_status: 'Rented', - type: 'AddOccupant', - }) - .then(() => { - props.reload?.(); - message.success(props.title + '成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - 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: [ - MyFormItems.EnumRadio({ - key: 'house_relation', - title: '房客关系', - colProps: { span: 6 }, - valueEnum: () => { - let obj: any = JSON.parse( - JSON.stringify(HouseOccupantsHouseRelationEnum), - ); - delete obj.Owner; - delete obj.Resident; - return obj; - }, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'relation_with_owner', - title: '关系标记', - colProps: { span: 18 }, - valueEnum: HouseOccupantsRelationWithOwnerEnum, - required: true, - }), - - { - title: '姓名', - dataIndex: 'name', - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }, - { - title: '手机号', - dataIndex: 'phone', - colProps: { span: 6 }, - fieldProps: { - maxLength: 11, - }, - formItemProps: { ...rulesHelper.text }, - }, - MyFormItems.EnumSelect({ - key: 'card_type', - title: '证件类型', - colProps: { span: 6 }, - valueEnum: HouseOccupantsCardTypeEnum, - required: true, - }), - { - title: '证件号码', - dataIndex: 'id_card', - colProps: { span: 6 }, - fieldProps: { - maxLength: 18, - }, - formItemProps: { ...rulesHelper.text }, - }, - - { - valueType: 'group', - columns: [ - MyFormItems.UploadImages({ - key: 'card_front_image', - title: '证件正面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - MyFormItems.UploadImages({ - key: 'card_back_image', - title: '证件反面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - { - title: '是否入住', - dataIndex: 'is_live_in', - colProps: { span: 6 }, - valueType: 'switch', - }, - { - name: ['is_live_in'], - valueType: 'dependency', - columns: ({ is_live_in }: any) => { - return is_live_in - ? [ - { - title: '入住日期', - dataIndex: 'move_in_date', - valueType: 'date', - colProps: { span: 6 }, - fieldProps: { - style: { width: '100%' }, - }, - formItemProps: { ...rulesHelper.text }, - }, - ] - : []; - }, - }, - ], - }, - ], - }, - ], - }, - ]} - /> - ); -} diff --git a/src/pages/asset/$id.tsx b/src/pages/asset/$id.tsx index b73f1b1..0dcae2c 100644 --- a/src/pages/asset/$id.tsx +++ b/src/pages/asset/$id.tsx @@ -2,13 +2,14 @@ import { MyPageContainer, usePageTabs } from '@/common'; import { Apis } from '@/gen/Apis'; import { ProCard } from '@ant-design/pro-components'; import { useParams } from '@umijs/max'; -import { Tabs } from 'antd'; +import { Space, Tabs } from 'antd'; import { useEffect, useState } from 'react'; import AssetAccounts from './components/AssetAccounts'; import MyAssetBuildings from './components/AssetBuildings'; import AssetGrid from './components/AssetGrid'; import AssetInfo from './components/AssetInfo'; -import Basic from './components/Basic'; +import BindCompany from './components/modals/BindCompany'; +import AssetUpdate from './modals/AssetUpdate'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -39,12 +40,12 @@ export default function Show({ title }: { title?: string } = {}) { }, [id]); let items = [ - { - label: '基本信息', - key: 'info', - closable: false, - children: loadShow()} />, - }, + // { + // label: '基本信息', + // key: 'info', + // closable: false, + // children: loadShow()} />, + // }, { label: '楼栋管理', key: 'asset_buildings', @@ -52,7 +53,7 @@ export default function Show({ title }: { title?: string } = {}) { children: , }, { - label: '网格管理', + label: '楼栋划分', key: 'grid', closable: false, children: , @@ -72,7 +73,22 @@ export default function Show({ title }: { title?: string } = {}) { ]; return ( - loadShow()} /> + + + + +
+ } + > +
* 您可在以下页签中对应管理:楼栋管理、楼栋划分、收款账号;
+
diff --git a/src/pages/asset/components/AssetBuildings.tsx b/src/pages/asset/components/AssetBuildings.tsx index 0f6a0d0..6f0a0ab 100644 --- a/src/pages/asset/components/AssetBuildings.tsx +++ b/src/pages/asset/components/AssetBuildings.tsx @@ -2,17 +2,20 @@ import { MyBetaModalFormProps, MyButtons, MyColumns, + MyImportModal, MyProTableProps, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { AssetHousesUsageEnum } from '@/gen/Enums'; +import { + AssetHousesOwnershipTypeEnum, + AssetHousesUsageEnum, +} from '@/gen/Enums'; import { ProCard, ProTable } from '@ant-design/pro-components'; import { Alert, message, Space, Typography } from 'antd'; import { useCallback, useRef, useState } from 'react'; import BuildingsCreate from './modals/BuildingsCreate'; import AssetBuildingsUpdate from './modals/BuildingsUpdate'; import HousesCreate from './modals/HousesCreate'; -import HousesShow from './modals/HousesShow'; import HousesUpdate from './modals/HousesUpdate'; import AssetUnitsCreate from './modals/UnitsCreate'; import AssetUnitsUpdate from './modals/UnitsUpdate'; @@ -70,7 +73,7 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { 楼栋信息 + actionUnitsRef?.current?.reload()} - title={`${selectedBuilding.name}单元`} + title="单元" + // title={`添加${selectedBuilding.name}单元`} /> )} @@ -256,7 +270,8 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { asset_units_id: selectedUnit?.id, }} reload={() => actionHousesRef?.current?.reload()} - title={`${selectedUnit.name}房屋`} + title="房屋" + // title={`${selectedUnit.name}房屋`} /> )} @@ -284,11 +299,6 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { showSizeChanger: false, }} columns={[ - { - title: '房号', - dataIndex: 'name', - width: 80, - }, { title: '楼层', dataIndex: 'floor', @@ -297,17 +307,28 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { return `${record?.floor}层`; }, }, + { + title: '房号', + dataIndex: 'name', + width: 80, + }, MyColumns.EnumTag({ title: '用途', dataIndex: 'usage', valueEnum: AssetHousesUsageEnum, width: 100, }), + MyColumns.EnumTag({ + title: '房屋属性', + dataIndex: 'ownership_type', + valueEnum: AssetHousesOwnershipTypeEnum, + width: 100, + }), MyColumns.Option({ width: 150, render: (_, item: any, index, action) => ( - + {/* */} `${item?.company_employee?.name || ''}-${ diff --git a/src/pages/asset/components/AssetInfo.tsx b/src/pages/asset/components/AssetInfo.tsx index cd38f5e..7f49348 100644 --- a/src/pages/asset/components/AssetInfo.tsx +++ b/src/pages/asset/components/AssetInfo.tsx @@ -1,4 +1,5 @@ import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; import { AssetProjectsChargeEnum, AssetProjectsEntrustTypeEnum, @@ -10,62 +11,82 @@ import { Space } from 'antd'; export default function AssetInfo(props: MyBetaModalFormProps) { return ( - - - - - {props?.item?.alias_name} - - - {props?.item?.province || ''} - {props?.item?.city || ''} - {props?.item?.district || ''} - {props?.item?.address || ''} - - - - - - - - - - - - - + + + + + +
+ {props?.item?.name} + {props?.item?.alias_name + ? `(${props?.item?.alias_name})` + : ''} +
+
+
+ + +
{props?.item?.company?.name}
+
+
- - {props?.item?.takeover_date} - - - {props?.item?.closure_date} - + + {props?.item?.province || ''} + {props?.item?.city || ''} + {props?.item?.district || ''} + {props?.item?.address || ''} + + + + + + + + + + + + + - + + {props?.item?.takeover_date} + + + {props?.item?.closure_date} + + + {/* {props?.item?.created_at} - - - {props?.item?.updated_at} - -
-
-
+ */} + + {props?.item?.updated_at} + + +
+ + } + /> ); } diff --git a/src/pages/asset/components/Basic.tsx b/src/pages/asset/components/Basic.tsx index 701c760..7933ef7 100644 --- a/src/pages/asset/components/Basic.tsx +++ b/src/pages/asset/components/Basic.tsx @@ -1,4 +1,10 @@ -import { MyBetaModalFormProps } from '@/common'; +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { + AssetProjectsChargeEnum, + AssetProjectsEntrustTypeEnum, + AssetProjectsPropertyTypeEnum, + AssetProjectsStatusEnum, +} from '@/gen/Enums'; import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; import AssetUpdate from '../modals/AssetUpdate'; @@ -11,7 +17,12 @@ export default function info(props: MyBetaModalFormProps) { -
{props?.item?.name}
+
+ {props?.item?.name} + {props?.item?.alias_name + ? `(${props?.item?.alias_name})` + : ''} +
- +
{props?.item?.company?.name}
+ + + {props?.item?.province || ''} + {props?.item?.city || ''} + {props?.item?.district || ''} + {props?.item?.address || ''} + + + + + + + + + + + + + + + + {props?.item?.takeover_date} + + + {props?.item?.closure_date} + + + {/* + {props?.item?.created_at} + */} + + {props?.item?.updated_at} +
diff --git a/src/pages/asset/components/modals/BindCompany.tsx b/src/pages/asset/components/modals/BindCompany.tsx index ec4023c..97dcd0e 100644 --- a/src/pages/asset/components/modals/BindCompany.tsx +++ b/src/pages/asset/components/modals/BindCompany.tsx @@ -14,8 +14,8 @@ export default function Update(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`调整${props.title}`} - trigger={} + title={`换绑${props.title}`} + trigger={} wrapperCol={{ span: 24 }} width="500px" request={() => diff --git a/src/pages/asset/components/modals/GridCreate.tsx b/src/pages/asset/components/modals/GridCreate.tsx index 7d16696..c806170 100644 --- a/src/pages/asset/components/modals/GridCreate.tsx +++ b/src/pages/asset/components/modals/GridCreate.tsx @@ -15,10 +15,10 @@ export default function Create(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`创建网格`} + title={`创建板块`} wrapperCol={{ span: 24 }} width="700px" - trigger={} + trigger={} form={form} key={new Date().getTime()} onOpenChange={(open: any) => { @@ -70,7 +70,7 @@ export default function Create(props: MyBetaModalFormProps) { diff --git a/src/pages/asset/components/modals/GridMannger.tsx b/src/pages/asset/components/modals/GridMannger.tsx index bf2c787..5aff682 100644 --- a/src/pages/asset/components/modals/GridMannger.tsx +++ b/src/pages/asset/components/modals/GridMannger.tsx @@ -16,12 +16,12 @@ export default function Create( return ( {...MyModalFormProps.props} - title={`设置网格员`} + title={`设置管理员`} wrapperCol={{ span: 24 }} width="500px" form={form} key={new Date().getTime()} - trigger={} + trigger={} request={() => Promise.resolve(props.item)} onOpenChange={(open: any) => { if (open && props.item) { diff --git a/src/pages/asset/components/modals/HousesCreate.tsx b/src/pages/asset/components/modals/HousesCreate.tsx index fd2db6b..31443e7 100644 --- a/src/pages/asset/components/modals/HousesCreate.tsx +++ b/src/pages/asset/components/modals/HousesCreate.tsx @@ -23,7 +23,7 @@ export default function Create(props: MyBetaModalFormProps) { title={`添加${props.title}`} wrapperCol={{ span: 24 }} width="800px" - trigger={} + trigger={} form={form} key={new Date().getTime()} onOpenChange={(open: any) => { diff --git a/src/pages/asset/components/modals/UnitsCreate.tsx b/src/pages/asset/components/modals/UnitsCreate.tsx index b333039..27d1d95 100644 --- a/src/pages/asset/components/modals/UnitsCreate.tsx +++ b/src/pages/asset/components/modals/UnitsCreate.tsx @@ -59,14 +59,14 @@ export default function Create(props: MyBetaModalFormProps) { title: '建筑结构', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingStructureEnum, - required: true, + // required: true, }), MyFormItems.EnumRadio({ key: 'building_type', title: '建筑类型', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingTypeEnum, - required: true, + // required: true, }), { key: 'elevator_count', diff --git a/src/pages/asset/components/modals/UnitsUpdate.tsx b/src/pages/asset/components/modals/UnitsUpdate.tsx index 765c6b8..e37206f 100644 --- a/src/pages/asset/components/modals/UnitsUpdate.tsx +++ b/src/pages/asset/components/modals/UnitsUpdate.tsx @@ -69,14 +69,14 @@ export default function Update(props: MyBetaModalFormProps) { title: '建筑结构', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingStructureEnum, - required: true, + // required: true, }), MyFormItems.EnumRadio({ key: 'building_type', title: '建筑类型', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingTypeEnum, - required: true, + // required: true, }), { key: 'elevator_count', diff --git a/src/pages/asset/index.tsx b/src/pages/asset/index.tsx index 790b414..0087d13 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -1,7 +1,6 @@ import { MyButtons, MyColumns, - MyImportModal, MyPageContainer, MyProTableProps, usePageTabs, @@ -11,9 +10,11 @@ import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; +import AssetInfo from './components/AssetInfo'; import AssetCreate from './modals/AssetCreate'; +import AssetUpdate from './modals/AssetUpdate'; -export default function Index({ title = '项目管理' }) { +export default function Index({ title = '项目列表' }) { const navigate = useNavigate(); // 注册当前页面为标签页 @@ -36,7 +37,7 @@ export default function Index({ title = '项目管理' }) { columns={[ MyColumns.ID(), MyColumns.EnumTag({ - title: '项目类型', + title: '类型', dataIndex: 'property_type', valueEnum: AssetProjectsPropertyTypeEnum, search: false, @@ -82,6 +83,15 @@ export default function Index({ title = '项目管理' }) { onSoftDelete: Apis.Asset.AssetProjects.SoftDelete, search: false, }), + { + title: '绑定机构', + dataIndex: ['company', 'name'], + search: { + transform: (value) => { + return { company_name: value }; + }, + }, + }, // { // title: '接管日期', // dataIndex: 'takeover_date', @@ -96,20 +106,14 @@ export default function Index({ title = '项目管理' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( + + { navigate(`/asset/${item.id}`); }} /> - Apis.Common.Admins.Delete({ id: item.id }).then(() => diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index 8d985b3..49e33e7 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -35,7 +35,6 @@ export default function Index({ title = '房屋列表' }) { { title: '房屋名称', dataIndex: 'full_name', - ellipsis: true, }, MyColumns.EnumTag({ diff --git a/src/pages/bills/index.tsx b/src/pages/bills/index.tsx index 865e4b6..c223188 100644 --- a/src/pages/bills/index.tsx +++ b/src/pages/bills/index.tsx @@ -1,6 +1,7 @@ import { MyButtons, MyColumns, + MyImportModal, MyPageContainer, MyProTableProps, usePageTabs, @@ -32,6 +33,15 @@ export default function Index({ title = '账单' }) { MyProTableProps.request(params, sort, Apis.Bill.HouseBills.List) } toolBarRender={(action) => [ + , , ]} columns={[ diff --git a/src/pages/company/components/Employees.tsx b/src/pages/company/components/Employees.tsx index 0551abb..38e825d 100644 --- a/src/pages/company/components/Employees.tsx +++ b/src/pages/company/components/Employees.tsx @@ -36,8 +36,12 @@ export default function Index(props: MyBetaModalFormProps) { //to-do 按层级选择 { title: '所在组织', - dataIndex: ['organization', 'name'], - search: false, + dataIndex: 'organization_path', + search: { + transform: (value) => { + return { organization_name: value }; + }, + }, }, { title: '姓名', diff --git a/src/pages/company/components/Organizations.tsx b/src/pages/company/components/Organizations.tsx index 83c3b43..e979bf2 100644 --- a/src/pages/company/components/Organizations.tsx +++ b/src/pages/company/components/Organizations.tsx @@ -21,7 +21,7 @@ export default function Organizations(props: MyBetaModalFormProps) { MyProTableProps.request( { ...params, companies_id: props?.item?.id }, sort, - Apis.Company.Organizations.List, + Apis.Company.Organizations.TreeList, ) } toolBarRender={(action) => [ @@ -35,12 +35,6 @@ export default function Organizations(props: MyBetaModalFormProps) { // search={false} // options={false} columns={[ - MyColumns.EnumTag({ - title: '组织类型', - dataIndex: 'type', - valueEnum: OrganizationsTypeEnum, - search: false, - }), { title: '组织名称', dataIndex: 'name', @@ -50,6 +44,13 @@ export default function Organizations(props: MyBetaModalFormProps) { dataIndex: 'id', search: false, }, + MyColumns.EnumTag({ + title: '组织类型', + dataIndex: 'type', + valueEnum: OrganizationsTypeEnum, + search: false, + }), + { title: '上级组织', dataIndex: ['organization_parent', 'name'], @@ -58,12 +59,12 @@ export default function Organizations(props: MyBetaModalFormProps) { MyColumns.Option({ render: (_, item: any, index, action) => ( - - } + trigger={ + + } wrapperCol={{ span: 24 }} width="500px" onOpenChange={(open: any) => { diff --git a/src/pages/company/components/modals/OrganizationCreate.tsx b/src/pages/company/components/modals/OrganizationCreate.tsx index a8990be..460c47e 100644 --- a/src/pages/company/components/modals/OrganizationCreate.tsx +++ b/src/pages/company/components/modals/OrganizationCreate.tsx @@ -41,18 +41,6 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - Selects?.OrganizationsTree({ - title: '上级组织', - key: 'parent_id', - params: { companies_id: props?.item?.id }, - colProps: { span: 24 }, - }), - { - key: 'name', - title: '组织名称', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, MyFormItems.EnumRadio({ key: 'type', title: '组织类型', @@ -60,24 +48,32 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: OrganizationsTypeEnum, required: true, }), - // Selects?.Employees({ - // title: '负责人', - // colProps: { span: 8 }, - // }), - // { - // key: 'manager_phone', - // title: '负责人手机', - // colProps: { span: 8 }, - // valueType: 'number', - // fieldProps: { - // maxLength: 11, - // }, - // }, - // { - // key: 'manager_email', - // title: '负责人邮箱', - // colProps: { span: 8 }, - // }, + { + key: 'name', + title: '组织名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + name: ['type'], + valueType: 'dependency', + columns: ({ type }: any) => { + return type !== OrganizationsTypeEnum.Group.value + ? [ + Selects?.OrganizationsTree({ + title: '请设置上级组织', + key: 'parent_id', + params: { companies_id: props?.item?.id }, + colProps: { span: 24 }, + fieldProps: { + placeholder: '可搜索或手动选择上级组织', + }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : []; + }, + }, ]} /> ); diff --git a/src/pages/company/components/modals/OrganizationUpdate.tsx b/src/pages/company/components/modals/OrganizationUpdate.tsx index 482ddcc..6014b58 100644 --- a/src/pages/company/components/modals/OrganizationUpdate.tsx +++ b/src/pages/company/components/modals/OrganizationUpdate.tsx @@ -40,12 +40,6 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - { - key: 'name', - title: '组织名称', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, MyFormItems.EnumRadio({ key: 'type', title: '类型', @@ -53,12 +47,12 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: OrganizationsTypeEnum, required: true, }), - // Selects?.OrganizationsTree({ - // title: '上级组织', - // key: 'parent_id', - // params: { companies_id: props?.item?.companies_id }, - // colProps: { span: 24 }, - // }), + { + key: 'name', + title: '组织名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, ]} /> ); diff --git a/src/pages/company/components/modals/ReceiptAccountCreate.tsx b/src/pages/company/components/modals/ReceiptAccountCreate.tsx index 4952433..14af4f1 100644 --- a/src/pages/company/components/modals/ReceiptAccountCreate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountCreate.tsx @@ -65,6 +65,23 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: CompanyReceiptAccountsPayChannelEnum, required: true, }), + { + name: ['pay_channel'], + valueType: 'dependency', + columns: ({ pay_channel }: any) => { + return pay_channel === + CompanyReceiptAccountsPayChannelEnum.TongLian.value + ? [ + { + key: 'merchant_id', + title: '商户ID', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, // { // key: 'is_default', // title: '是否设为默认账号', diff --git a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx index 316ded2..67ecbcf 100644 --- a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx @@ -65,6 +65,23 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: CompanyReceiptAccountsPayChannelEnum, required: true, }), + { + name: ['pay_channel'], + valueType: 'dependency', + columns: ({ pay_channel }: any) => { + return pay_channel === + CompanyReceiptAccountsPayChannelEnum.TongLian.value + ? [ + { + key: 'merchant_id', + title: '商户ID', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, // { // key: 'is_default', // title: '是否设为默认账号', diff --git a/src/pages/company/index.tsx b/src/pages/company/index.tsx index 2238d82..2fcd988 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/index.tsx @@ -6,7 +6,6 @@ import { usePageTabs, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { CompaniesMerchantTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; @@ -41,19 +40,21 @@ export default function Index({ title = '机构列表' }) { columns={[ MyColumns.ID(), { - title: '组织简称', + title: '机构简称', dataIndex: 'short_name', + search: false, }, { title: '企业名称', dataIndex: 'name', }, - MyColumns.EnumTag({ - title: '类型', - dataIndex: 'merchant_type', - valueEnum: CompaniesMerchantTypeEnum, - search: false, - }), + + // MyColumns.EnumTag({ + // title: '类型', + // dataIndex: 'merchant_type', + // valueEnum: CompaniesMerchantTypeEnum, + // search: false, + // }), MyColumns.SoftDelete({ onRestore: Apis.Company.Companies.Restore, onSoftDelete: Apis.Company.Companies.SoftDelete, @@ -81,7 +82,7 @@ export default function Index({ title = '机构列表' }) { /> - Apis.Common.Admins.Delete({ id: item.id }).then(() => + Apis.Company.Companies.Delete({ id: item.id }).then(() => action?.reload(), ) } diff --git a/src/pages/company/modals/CompanyCreate.tsx b/src/pages/company/modals/CompanyCreate.tsx index c03dd9d..680b72d 100644 --- a/src/pages/company/modals/CompanyCreate.tsx +++ b/src/pages/company/modals/CompanyCreate.tsx @@ -47,11 +47,13 @@ export default function Create(props: MyBetaModalFormProps) { key: 'business_license_number', title: '营业执照号', colProps: { span: 24 }, + tooltip: '限制20位', formItemProps: { ...rulesHelper.text }, fieldProps: { maxLength: 18, }, }, + { key: 'contact_name', title: '联系人姓名', diff --git a/src/pages/employees/index.tsx b/src/pages/employees/index.tsx index a4b61f5..dae6194 100644 --- a/src/pages/employees/index.tsx +++ b/src/pages/employees/index.tsx @@ -50,9 +50,13 @@ export default function Index({ title = '员工管理' }) { search: false, }, { - title: '组织', - dataIndex: ['organization', 'name'], - search: false, + title: '所在组织', + dataIndex: 'organization_path', + search: { + transform: (value) => { + return { organization_name: value }; + }, + }, }, { title: '姓名', diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx index af1d819..003c514 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -12,7 +12,7 @@ import { import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, - HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -31,7 +31,7 @@ export default function Update(props: MyBetaModalFormProps) { title={props.title} trigger={} wrapperCol={{ span: 24 }} - width="1000px" + width="800px" modalProps={{ bodyStyle: { maxHeight: '70vh', overflowY: 'auto' }, }} @@ -81,7 +81,7 @@ export default function Update(props: MyBetaModalFormProps) { {props?.item?.customer_info && props?.item?.customer_info?.length > 0 && ( - + record?.id_card || index} size="small" columns={[ + // MyColumns.EnumTag({ + // title: '房客关系', + // dataIndex: 'house_relation', + // valueEnum: HouseOccupantsHouseRelationEnum, + // width: 100, + // }), MyColumns.EnumTag({ - title: '房客关系', - dataIndex: 'house_relation', - valueEnum: HouseOccupantsHouseRelationEnum, - width: 100, + title: + props?.item?.status === 'Rented' + ? '与主租人关系' + : '与产权人关系', + // title: '关系说明', + dataIndex: 'relation_with_owner', + valueEnum: HouseOccupantsRelationWithOwnerEnum, + search: false, }), { title: '姓名', dataIndex: 'name', - width: 100, }, { title: '手机号', dataIndex: 'phone', - width: 120, }, MyColumns.EnumTag({ title: '证件类型', dataIndex: 'card_type', valueEnum: HouseOccupantsCardTypeEnum, - width: 120, }), { title: '证件号码', dataIndex: 'id_card', - width: 180, }, { title: '证件资料', - width: 120, render: (_, item) => { return ( @@ -147,7 +152,7 @@ export default function Update(props: MyBetaModalFormProps) { )} - {props?.item?.type === 'Delivery' && + {props?.item?.type === 'AddOwner' && props?.item?.ownership_info && props?.item?.ownership_info?.length > 0 && ( From 6edacd4926e47fab517a2d508405da68ce1c589e Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Mon, 1 Sep 2025 21:32:29 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat=EF=BC=9A=E6=94=B6=E8=B4=B9=E6=A0=87?= =?UTF-8?q?=E5=87=860.5=20+=20=E6=88=BF=E5=B1=8B=E7=BB=91=E5=AE=9A0.5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen/ApiTypes.d.ts | 96 +++- src/gen/Apis.ts | 42 ++ src/gen/Enums.ts | 60 ++- src/pages/asset/$id.tsx | 7 + src/pages/asset/components/AssetAccounts.tsx | 2 +- src/pages/asset/components/ChargeStandard.tsx | 124 +++++ .../modals/ChargeStandardCreate.tsx | 423 +++++++++++++++ .../modals/ChargeStandardHasHouse.tsx | 491 ++++++++++++++++++ src/pages/banner/modals/BannerCreate.tsx | 8 + .../banner_space/components/BannerList.tsx | 5 +- .../banner_space/modals/BannerSpaceCreate.tsx | 1 + src/pages/company/components/Employees.tsx | 2 +- .../components/modals/EmployeeCreate.tsx | 16 +- .../components/modals/EmployeeUpdate.tsx | 7 +- src/pages/company/modals/CompanyCreate.tsx | 4 +- src/pages/company/modals/CompanyUpdate.tsx | 4 +- src/pages/employees/index.tsx | 11 +- src/pages/house_charge/$id.tsx | 52 ++ .../house_charge/components/BannerList.tsx | 86 +++ .../components/BannerSpaceInfo.tsx | 31 ++ src/pages/house_charge/index.tsx | 95 ++++ .../house_charge/modals/HouseChargeCreate.tsx | 227 ++++++++ .../house_charge/modals/HouseChargeUpdate.tsx | 66 +++ .../work_order/modals/WorkOrderCreate.tsx | 29 +- 24 files changed, 1839 insertions(+), 50 deletions(-) create mode 100644 src/pages/asset/components/ChargeStandard.tsx create mode 100644 src/pages/asset/components/modals/ChargeStandardCreate.tsx create mode 100644 src/pages/asset/components/modals/ChargeStandardHasHouse.tsx create mode 100644 src/pages/house_charge/$id.tsx create mode 100644 src/pages/house_charge/components/BannerList.tsx create mode 100644 src/pages/house_charge/components/BannerSpaceInfo.tsx create mode 100644 src/pages/house_charge/index.tsx create mode 100644 src/pages/house_charge/modals/HouseChargeCreate.tsx create mode 100644 src/pages/house_charge/modals/HouseChargeUpdate.tsx diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 33c1b83..974a17d 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -835,6 +835,87 @@ declare namespace ApiTypes { }; } } + namespace HouseCharage { + namespace HouseChargeHasHouses { + type List = { + "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] + }; + type Store = { + "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] + "houses_ids": string[]; // 房屋id,[ref:houses] + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace HouseChargeStandards { + type List = { + "name"?: string; // 模糊搜索:名称 + }; + type Store = { + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "name": string; // 收费标准名称 + "type": string; // 收费类型,[enum:HouseChargeStandardsTypeEnum] + "charge_type": string; // 收费类型,[enum:HouseBillsTypeEnum] + "calculation_mode": string; // 计费模式,[enum:HouseChargeStandardsCalculationModeEnum] + "calculation_method": string; // 计量方式,[enum:HouseChargeStandardsCalculationMethodEnum] + "price_algorithm": string; // 单价算法,[enum:HouseChargeStandardsPriceAlgorithmEnum] + "price"?: number; // 单价 + "calculation_period"?: string; // 计费周期,[enum:HouseChargeStandardsCalculationPeriodEnum] + "auto_date"?: Date; // 自动生成日期 + "is_tiered"?: number; // 是否阶梯收费 + "tiered_rates"?: string[]; // 阶梯收费标准 + "is_apportionment"?: number; // 是否分摊 + "apportionment_method"?: string; // 分摊方式,[enum:HouseChargeStandardsApportionmentMethodEnum] + "has_late_fee"?: number; // 是否滞纳金 + "late_fee_start_days"?: number; // 生成几天后开始收取滞纳金 + "late_fee_rate"?: number; // 滞纳金费率(百分比) + "late_fee_cap_days"?: number; // 滞纳金封顶天数 + "has_minimum_charge"?: number; // 是否保底价 + "minimum_charge_amount"?: number; // 保底价金额 + "remark"?: string; // 备注 + }; + type Update = { + "id": number; // id + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "name": string; // 收费标准名称 + "type": string; // 收费类型,[enum:HouseChargeStandardsTypeEnum] + "charge_type": string; // 收费类型,[enum:HouseBillsTypeEnum] + "calculation_mode": string; // 计费模式,[enum:HouseChargeStandardsCalculationModeEnum] + "calculation_method": string; // 计量方式,[enum:HouseChargeStandardsCalculationMethodEnum] + "price_algorithm": string; // 单价算法,[enum:HouseChargeStandardsPriceAlgorithmEnum] + "price"?: number; // 单价 + "calculation_period"?: string; // 计费周期,[enum:HouseChargeStandardsCalculationPeriodEnum] + "auto_date"?: Date; // 自动生成日期 + "is_tiered"?: number; // 是否阶梯收费 + "tiered_rates"?: string[]; // 阶梯收费标准 + "is_apportionment"?: number; // 是否分摊 + "apportionment_method"?: string; // 分摊方式,[enum:HouseChargeStandardsApportionmentMethodEnum] + "has_late_fee"?: number; // 是否滞纳金 + "late_fee_start_days"?: number; // 生成几天后开始收取滞纳金 + "late_fee_rate"?: number; // 滞纳金费率(百分比) + "late_fee_cap_days"?: number; // 滞纳金封顶天数 + "has_minimum_charge"?: number; // 是否保底价 + "minimum_charge_amount"?: number; // 保底价金额 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace HouseOrder { namespace HouseOrderPayments { type List = { @@ -884,27 +965,26 @@ declare namespace ApiTypes { "asset_projects_id": number; // 项目id,[ref:asset_projects] "title": string; // 标题 "content": string; // 内容 - "is_publish"?: number; // 是否发布 + "is_publish"?: boolean; // 是否发布 "publish_at"?: Date; // 发布时间 "sort"?: number; // 排序 }; type Update = { "id": number; // id "asset_projects_id": number; // 项目id,[ref:asset_projects] - "companies_id": number; // 公司id,[ref:companies] "title": string; // 标题 "content": string; // 内容 - "is_publish"?: number; // 是否发布 - "publish_at"?: mixed; // 发布时间 + "is_publish"?: boolean; // 是否发布 + "publish_at"?: Date; // 发布时间 "sort"?: number; // 排序 - "admins_id"?: number; // 创建人id,[ref:admins] - "company_employees_id"?: number; // 创建员工id,[ref:company_employees] - "last_update_admins_id"?: number; // 最后修改人id,[ref:admins] - "last_update_company_employees"?: number; // 最后修改员工id,[ref:company_employees] }; type Show = { "id": number; // id }; + type IsPublish = { + "id": number; // id + "is_publish": boolean; // 是否发布 + }; type SoftDelete = { "id": number; // id }; diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 40bd372..d10448b 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -495,6 +495,45 @@ export const Apis = { }, }, }, + HouseCharage: { + HouseChargeHasHouses: { + List(data: ApiTypes.HouseCharage.HouseChargeHasHouses.List): Promise { + return request('admin/house_charage/house_charge_has_houses/list', { data }); + }, + Store(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Store): Promise { + return request('admin/house_charage/house_charge_has_houses/store', { data }); + }, + Show(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Show): Promise { + return request('admin/house_charage/house_charge_has_houses/show', { data }); + }, + Delete(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Delete): Promise { + return request('admin/house_charage/house_charge_has_houses/delete', { data }); + }, + }, + HouseChargeStandards: { + List(data?: ApiTypes.HouseCharage.HouseChargeStandards.List): Promise { + return request('admin/house_charage/house_charge_standards/list', { data }); + }, + Store(data: ApiTypes.HouseCharage.HouseChargeStandards.Store): Promise { + return request('admin/house_charage/house_charge_standards/store', { data }); + }, + Update(data: ApiTypes.HouseCharage.HouseChargeStandards.Update): Promise { + return request('admin/house_charage/house_charge_standards/update', { data }); + }, + Show(data: ApiTypes.HouseCharage.HouseChargeStandards.Show): Promise { + return request('admin/house_charage/house_charge_standards/show', { data }); + }, + SoftDelete(data: ApiTypes.HouseCharage.HouseChargeStandards.SoftDelete): Promise { + return request('admin/house_charage/house_charge_standards/soft_delete', { data }); + }, + Restore(data: ApiTypes.HouseCharage.HouseChargeStandards.Restore): Promise { + return request('admin/house_charage/house_charge_standards/restore', { data }); + }, + Delete(data: ApiTypes.HouseCharage.HouseChargeStandards.Delete): Promise { + return request('admin/house_charage/house_charge_standards/delete', { data }); + }, + }, + }, HouseOrder: { HouseOrderPayments: { List(data: ApiTypes.HouseOrder.HouseOrderPayments.List): Promise { @@ -539,6 +578,9 @@ export const Apis = { Show(data: ApiTypes.Msg.MsgPropertyAnnouncements.Show): Promise { return request('admin/msg/msg_property_announcements/show', { data }); }, + IsPublish(data: ApiTypes.Msg.MsgPropertyAnnouncements.IsPublish): Promise { + return request('admin/msg/msg_property_announcements/is_publish', { data }); + }, SoftDelete(data: ApiTypes.Msg.MsgPropertyAnnouncements.SoftDelete): Promise { return request('admin/msg/msg_property_announcements/soft_delete', { data }); }, diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 33fbc82..324e482 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#f002cf","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#649200","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -200,6 +200,64 @@ export const HouseBillsTypeEnum= { 'SharedElectricityFee': {"text":"公摊电费","color":"#ec4899","value":"SharedElectricityFee"}, }; +// HouseChargeStandardsApportionmentMethodEnum +export const HouseChargeStandardsApportionmentMethodEnum= { + 'HouseCount': {"text":"房屋数分摊","color":"#3b82f6","value":"HouseCount"}, + 'AreaProportion': {"text":"房屋计费面积分摊","color":"#10b981","value":"AreaProportion"}, + 'FixedRatio': {"text":"按固定比例分摊","color":"#f59e0b","value":"FixedRatio"}, +}; + +// HouseChargeStandardsCalculationMethodEnum +export const HouseChargeStandardsCalculationMethodEnum= { + 'ChargeableArea': {"text":"计费面积","color":"#3b82f6","value":"ChargeableArea"}, + 'BuiltArea': {"text":"建筑面积","color":"#10b981","value":"BuiltArea"}, + 'InsideArea': {"text":"套内面积","color":"#f59e0b","value":"InsideArea"}, + 'PerUnit': {"text":"按套","color":"#06b6d4","value":"PerUnit"}, + 'ElectricityUsage': {"text":"用电量","color":"#8b5cf6","value":"ElectricityUsage"}, + 'WaterUsage': {"text":"用水量","color":"#ec4899","value":"WaterUsage"}, +}; + +// HouseChargeStandardsCalculationModeEnum +export const HouseChargeStandardsCalculationModeEnum= { + 'FixedAmount': {"text":"固定金额","color":"#3b82f6","value":"FixedAmount"}, + 'QuantityPrice': {"text":"数量*单价","color":"#10b981","value":"QuantityPrice"}, +}; + +// HouseChargeStandardsCalculationPeriodEnum +export const HouseChargeStandardsCalculationPeriodEnum= { + 'PerTime': {"text":"按次","color":"#3b82f6","value":"PerTime"}, + 'PerDay': {"text":"按日","color":"#10b981","value":"PerDay"}, + 'PerMonth': {"text":"按月","color":"#f59e0b","value":"PerMonth"}, + 'PerYear': {"text":"按年","color":"#8b5cf6","value":"PerYear"}, +}; + +// HouseChargeStandardsPriceAlgorithmEnum +export const HouseChargeStandardsPriceAlgorithmEnum= { + 'Fixed': {"text":"固定","color":"#4caf50","value":"Fixed"}, + 'Tiered': {"text":"分级价阶梯","color":"#2196f3","value":"Tiered"}, + 'Peak': {"text":"最高价阶梯","color":"#ff9800","value":"Peak"}, +}; + +// HouseChargeStandardsStatusEnum +export const HouseChargeStandardsStatusEnum= { + 'Active': {"text":"启用","color":"#3b82f6","value":"Active"}, + 'Inactive': {"text":"禁用","color":"#ef4444","value":"Inactive"}, +}; + +// HouseChargeStandardsTypeEnum +export const HouseChargeStandardsTypeEnum= { + 'House': {"text":"房屋","color":"#3b82f6","value":"House"}, + 'Meter': {"text":"仪表","color":"#10b981","value":"Meter"}, +}; + +// HouseChargeTasksStatusEnum +export const HouseChargeTasksStatusEnum= { + 'Pending': {"text":"待执行","color":"#f59e0b","value":"Pending"}, + 'InProgress': {"text":"执行中","color":"#3b82f6","value":"InProgress"}, + 'Completed': {"text":"已完成","color":"#10b981","value":"Completed"}, + 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, +}; + // HouseCollectionRecordsCollectionResultEnum export const HouseCollectionRecordsCollectionResultEnum= { 'PromiseToPay': {"text":"承诺缴费","color":"#4caf50","value":"PromiseToPay"}, diff --git a/src/pages/asset/$id.tsx b/src/pages/asset/$id.tsx index 0dcae2c..91bbae5 100644 --- a/src/pages/asset/$id.tsx +++ b/src/pages/asset/$id.tsx @@ -8,6 +8,7 @@ import AssetAccounts from './components/AssetAccounts'; import MyAssetBuildings from './components/AssetBuildings'; import AssetGrid from './components/AssetGrid'; import AssetInfo from './components/AssetInfo'; +import ChargeStandard from './components/ChargeStandard'; import BindCompany from './components/modals/BindCompany'; import AssetUpdate from './modals/AssetUpdate'; @@ -58,6 +59,12 @@ export default function Show({ title }: { title?: string } = {}) { closable: false, children: , }, + { + label: '收费标准', + key: 'charge_standard', + closable: false, + children: , + }, { label: '收款账号', key: 'asset_accounts', diff --git a/src/pages/asset/components/AssetAccounts.tsx b/src/pages/asset/components/AssetAccounts.tsx index 4d29893..3ab4e2f 100644 --- a/src/pages/asset/components/AssetAccounts.tsx +++ b/src/pages/asset/components/AssetAccounts.tsx @@ -37,7 +37,7 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { // options={false} columns={[ { - title: '配置id', + title: 'ID', dataIndex: 'id', // width: 360, }, diff --git a/src/pages/asset/components/ChargeStandard.tsx b/src/pages/asset/components/ChargeStandard.tsx new file mode 100644 index 0000000..f6b7031 --- /dev/null +++ b/src/pages/asset/components/ChargeStandard.tsx @@ -0,0 +1,124 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import ChargeStandardCreate from './modals/ChargeStandardCreate'; +import ChargeStandardHasHouse from './modals/ChargeStandardHasHouse'; + +export default function ReceiptAccounts(props: MyBetaModalFormProps) { + return ( + <> + + MyProTableProps.request( + { + ...params, + asset_projects_id: props?.item?.id, + }, + sort, + Apis.HouseCharage.HouseChargeStandards.List, + ) + } + toolBarRender={(action) => [ + , + ]} + // options={false} + columns={[ + { + title: 'ID', + dataIndex: 'id', + }, + { + title: 'name', + dataIndex: 'name', + search: false, + }, + MyColumns.EnumTag({ + title: '收费项目', + dataIndex: 'charge_type', + valueEnum: HouseBillsTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '计量单位', + dataIndex: 'calculation_method', + valueEnum: HouseChargeStandardsCalculationMethodEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '计费模式', + dataIndex: 'calculation_mode', + valueEnum: HouseChargeStandardsCalculationModeEnum, + search: false, + }), + { + title: '单价', + dataIndex: 'price', + search: false, + }, + MyColumns.EnumTag({ + title: '账单计费周期', + dataIndex: 'calculation_period', + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + search: false, + }), + { + title: '账单自动生成日期', + dataIndex: 'auto_date', + search: false, + }, + { + title: '是否分摊', + dataIndex: 'is_apportionment', + search: false, + render(_, record) { + return `${record?.is_apportionment ? '是' : '否'} `; + }, + }, + + // MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.HouseCharage.HouseChargeStandards.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/asset/components/modals/ChargeStandardCreate.tsx b/src/pages/asset/components/modals/ChargeStandardCreate.tsx new file mode 100644 index 0000000..e63b3c2 --- /dev/null +++ b/src/pages/asset/components/modals/ChargeStandardCreate.tsx @@ -0,0 +1,423 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`创建收费标准`} + wrapperCol={{ span: 24 }} + width="580px" + trigger={} + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => { + values?.grid_ranges?.forEach((res: { asset_projects_id: string }) => { + res.asset_projects_id = props?.item?.id; + }); + return Apis.HouseCharage.HouseChargeStandards.Store({ + ...values, + asset_projects_id: props?.item?.id, + type: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? HouseChargeStandardsTypeEnum.House.value + : HouseChargeStandardsTypeEnum.Meter.value, + is_apportionment: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? 1 + : 0, + // 按套 + calculation_mode: + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsCalculationModeEnum.FixedAmount.value + : values?.calculation_mode, + // 按固定金额 + price_algorithm: + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value || + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + : values?.price_algorithm, + }) + .then(() => { + props.reload?.(); + message.success('收费标准创建成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'name', + title: '收费标准名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'charge_type', + title: '收费项目', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, + }), + // Selects?.AssetProjects({ + // key: 'asset_projects_id', + // title: '项目', + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.PropertyFee.value || + charge_type === HouseBillsTypeEnum.MaintenanceFund.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 24 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ElectricityUsage; + delete obj.WaterUsage; + return obj; + }, + required: true, + }), + ] + : charge_type === HouseBillsTypeEnum.WaterFee.value || + charge_type === HouseBillsTypeEnum.ElectricityFee.value || + charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 24 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ChargeableArea; + delete obj.BuiltArea; + delete obj.InsideArea; + delete obj.PerUnit; + return obj; + }, + required: true, + }), + ] + : []; + }, + }, + { + name: ['calculation_method'], + valueType: 'dependency', + columns: ({ calculation_method }: any) => { + return calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : !calculation_method + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + ]; + }, + }, + + { + name: ['calculation_mode'], + valueType: 'dependency', + columns: ({ calculation_mode }: any) => { + return calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : calculation_mode === + HouseChargeStandardsCalculationModeEnum.QuantityPrice.value + ? [ + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + // valueEnum: () => { + // let obj: any = JSON.parse( + // JSON.stringify(HouseChargeStandardsPriceAlgorithmEnum), + // ); + // delete obj.Fixed; + // return obj; + // }, + // fieldProps: { + // onChange: () => { + // // 切换计费算法时清空阶梯配置 + // form.setFieldValue('scheme', undefined); + // }, + // }, + }), + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + // addonBefore: `第${index + 1}阶梯`, + addonBefore: `第1阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + // addonBefore: `第${index + 1}阶梯`, + addonBefore: `第1阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ] + : []; + }, + }, + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + ], + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx b/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx new file mode 100644 index 0000000..fb639bb --- /dev/null +++ b/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx @@ -0,0 +1,491 @@ +import { MyBetaModalFormProps, MyButtons } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ProCard } from '@ant-design/pro-components'; +import { + Alert, + Button, + Checkbox, + message, + Space, + Tree, + Typography, +} from 'antd'; +import { CheckboxChangeEvent } from 'antd/es/checkbox'; +import type { DataNode } from 'antd/es/tree'; +import { useEffect, useRef, useState } from 'react'; + +const { Title } = Typography; + +interface TreeNodeType extends DataNode { + id: number; + key: string; + title: string; + isLeaf?: boolean; + children?: TreeNodeType[]; + asset_buildings_id?: number; + asset_units_id?: number; +} + +// 扩展 MyBetaModalFormProps 接口,添加 onCancel 属性 +interface ChargeStandardHasHouseProps extends MyBetaModalFormProps { + onCancel?: () => void; +} + +export default function ChargeStandardHasHouse( + props: ChargeStandardHasHouseProps, +) { + const [treeData, setTreeData] = useState([]); + const [expandedKeys, setExpandedKeys] = useState([]); + const [checkedKeys, setCheckedKeys] = useState([]); + const [selectedKeys, setSelectedKeys] = useState([]); + const [autoExpandParent, setAutoExpandParent] = useState(true); + const [loading, setLoading] = useState(false); + const [selectAll, setSelectAll] = useState(false); + const [selectedHouses, setSelectedHouses] = useState< + { id: number; name: string }[] + >([]); + const modalRef: any = useRef(null); + + // 加载楼栋数据 + const loadBuildings = async () => { + setLoading(true); + + try { + const res = await Apis.Asset.AssetBuildings.List({ + asset_projects_id: props?.item?.asset_projects_id, + }); + if (res?.data) { + const buildings = res.data.map((building: any) => ({ + id: building.id, + key: `building-${building.id}`, + title: building.name, + children: [], + isLeaf: false, + })); + setTreeData(buildings); + } + } catch (error) { + console.error('加载楼栋失败:', error); + } finally { + setLoading(false); + } + }; + + // 加载单元数据 + const loadUnits = async (buildingId: number, buildingKey: string) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetUnits.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + }); + + if (res?.data) { + const units = res.data.map((unit: any) => ({ + id: unit.id, + key: `unit-${unit.id}`, + title: unit.name, + children: [], + isLeaf: false, + asset_buildings_id: buildingId, + })); + + // 更新树形数据 + const newTreeData = [...treeData]; + const buildingNode = newTreeData.find( + (node) => node.key === buildingKey, + ); + if (buildingNode) { + buildingNode.children = units; + } + + setTreeData(newTreeData); + } + } catch (error) { + console.error('加载单元失败:', error); + } finally { + setLoading(false); + } + }; + + // 加载房屋数据 + const loadHouses = async ( + buildingId: number, + unitId: number, + unitKey: string, + ) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + asset_units_id: unitId, + }); + + if (res?.data) { + const houses = res.data.map((house: any) => ({ + id: house.id, + key: `house-${house.id}`, + title: `${house.name} (${house.floor}层)`, + isLeaf: true, + asset_buildings_id: buildingId, + asset_units_id: unitId, + })); + + // 更新树形数据 + const newTreeData = [...treeData]; + const buildingNode = newTreeData.find( + (node) => + node.asset_buildings_id === undefined && node.id === buildingId, + ); + + if (buildingNode && buildingNode.children) { + const unitNode = buildingNode.children.find( + (node) => node.key === unitKey, + ); + if (unitNode) { + unitNode.children = houses; + } + } + + setTreeData(newTreeData); + } + } catch (error) { + console.error('加载房屋失败:', error); + } finally { + setLoading(false); + } + }; + + // 初始化加载数据 + useEffect(() => { + if (props?.item?.asset_projects_id) { + loadBuildings(); + } else { + console.warn('缺少 asset_projects_id 参数'); + } + }, [props?.item?.id]); + + // 处理节点展开 + const onExpand = (expandedKeysValue: React.Key[]) => { + setExpandedKeys(expandedKeysValue); + setAutoExpandParent(false); + }; + + // 处理节点选中 + const onCheck = ( + checkedKeysValue: + | React.Key[] + | { checked: React.Key[]; halfChecked: React.Key[] }, + ) => { + // 处理不同格式的返回值 + const keys = Array.isArray(checkedKeysValue) + ? checkedKeysValue + : checkedKeysValue.checked; + + // 获取之前的选中状态,用于比较变化 + const prevKeys = new Set(checkedKeys); + const newKeys = new Set(keys); + + // 找出新取消选中的节点 + const uncheckedKeys = [...prevKeys].filter((key) => !newKeys.has(key)); + + // 如果有节点被取消选中,同步取消其所有子节点 + if (uncheckedKeys.length > 0) { + const keysToRemove = new Set(); + const findChildKeys = (nodes: TreeNodeType[], parentKey: React.Key) => { + nodes.forEach((node) => { + if (node.key === parentKey) { + // 将当前节点及其所有子节点的key加入待移除集合 + const collectKeys = (n: TreeNodeType) => { + keysToRemove.add(n.key); + if (n.children) { + n.children.forEach(collectKeys); + } + }; + collectKeys(node); + } else if (node.children) { + findChildKeys(node.children, parentKey); + } + }); + }; + + uncheckedKeys.forEach((key) => { + findChildKeys(treeData, key); + }); + + // 从选中keys中移除所有需要取消的节点 + const finalKeys = keys.filter((key) => !keysToRemove.has(key)); + setCheckedKeys(finalKeys); + } else { + setCheckedKeys(keys); + } + + // 收集所有选中的房屋 + const selectedHousesList: { id: number; name: string }[] = []; + + // 遍历树形数据,收集选中节点下的所有房屋 + const collectHouses = (nodes: TreeNodeType[], checkedKeys: React.Key[]) => { + nodes.forEach((node) => { + if (checkedKeys.includes(node.key)) { + if (node.isLeaf) { + // 如果是房屋节点,直接添加 + selectedHousesList.push({ + id: node.id, + name: node.title as string, + }); + } else { + // 如果是楼栋或单元节点,递归收集其下的所有房屋 + if (node.children) { + collectHouses(node.children, checkedKeys); + } + } + } + }); + }; + + collectHouses(treeData, keys); + + setSelectedHouses(selectedHousesList); + setSelectAll( + selectedHousesList.length > 0 && + selectedHousesList.length === + treeData.reduce( + (total, building) => + total + + (building.children?.reduce( + (unitTotal, unit) => unitTotal + (unit.children?.length || 0), + 0, + ) || 0), + 0, + ), + ); + }; + + // 处理节点选择 + const onSelect = (selectedKeysValue: React.Key[]) => { + setSelectedKeys(selectedKeysValue); + }; + + // 处理动态加载数据 + const onLoadData = async (node: TreeNodeType) => { + if (node.isLeaf) { + return Promise.resolve(); + } + + // 加载楼栋下的单元 + if (node.key.toString().startsWith('building-')) { + const buildingId = node.id; + await loadUnits(buildingId, node.key as string); + + // 如果楼栋被选中,加载并选中其下所有单元和房屋 + if (checkedKeys.includes(node.key)) { + const newTreeData = [...treeData]; + const buildingNode = newTreeData.find((n) => n.key === node.key); + if (buildingNode?.children) { + // 加载每个单元下的房屋 + for (const unit of buildingNode.children) { + await loadHouses(buildingId, unit.id, unit.key as string); + } + // 更新树形数据 + setTreeData(newTreeData); + // 收集所有房屋的key + const allKeys: React.Key[] = []; + const collectKeys = (nodes: TreeNodeType[]) => { + nodes.forEach((node) => { + allKeys.push(node.key); + if (node.children) { + collectKeys(node.children); + } + }); + }; + collectKeys([buildingNode]); + // 更新选中状态 + setCheckedKeys(Array.from(new Set([...checkedKeys, ...allKeys]))); + } + } + return Promise.resolve(); + } + + // 加载单元下的房屋 + if (node.key.toString().startsWith('unit-')) { + const unitId = node.id; + const buildingId = node.asset_buildings_id as number; + await loadHouses(buildingId, unitId, node.key as string); + + // 如果单元被选中,选中其下所有房屋 + if (checkedKeys.includes(node.key)) { + const newTreeData = [...treeData]; + const buildingNode = newTreeData.find((n) => + n.children?.some((unit) => unit.key === node.key), + ); + const unitNode = buildingNode?.children?.find( + (n) => n.key === node.key, + ); + if (unitNode?.children) { + const houseKeys = unitNode.children.map((house) => house.key); + setCheckedKeys(Array.from(new Set([...checkedKeys, ...houseKeys]))); + } + } + return Promise.resolve(); + } + + return Promise.resolve(); + }; + + // 处理全选 + const handleSelectAll = (e: CheckboxChangeEvent) => { + setSelectAll(e.target.checked); + + if (e.target.checked) { + // 收集所有房屋节点的key + const allHouseKeys: React.Key[] = []; + const allHouses: { id: number; name: string }[] = []; + + treeData.forEach((building) => { + building.children?.forEach((unit) => { + unit.children?.forEach((house) => { + if (house.isLeaf) { + allHouseKeys.push(house.key); + allHouses.push({ + id: house.id, + name: house.title as string, + }); + } + }); + }); + }); + + setCheckedKeys(allHouseKeys); + setSelectedHouses(allHouses); + } else { + // 取消全选 + setCheckedKeys([]); + setSelectedHouses([]); + } + }; + + // 提交选中的房屋 + const handleSubmit = async () => { + if (selectedHouses.length === 0) { + message.warning('请至少选择一个房屋'); + return; + } + + try { + setLoading(true); + // 将 number[] 转换为 string[] + const houses_ids = selectedHouses.map((house) => house.id.toString()); + + await Apis.HouseCharage.HouseChargeHasHouses.Store({ + house_charge_standards_id: props?.item?.id, + houses_ids, + }); + + message.success('绑定房屋成功'); + props?.reload?.(); + props?.onCancel?.(); + } catch (error) { + console.error('绑定房屋失败:', error); + message.error('绑定房屋失败'); + } finally { + setLoading(false); + } + }; + + return ( + + } + node={ + + } + > +
+
+
+ + 全选 + +
+ + {loading &&
加载中...
} + + +
+ +
+
+ 已选房屋 ({selectedHouses.length}) +
+ +
+ {selectedHouses.length > 0 ? ( +
    + {selectedHouses.map((house) => ( +
  • {house.name}
  • + ))} +
+ ) : ( +
+ 暂无选中房屋{' '} +
+ )} +
+
+
+ +
+ + + + +
+
+ } + /> + ); +} diff --git a/src/pages/banner/modals/BannerCreate.tsx b/src/pages/banner/modals/BannerCreate.tsx index f606a9d..291bfa8 100644 --- a/src/pages/banner/modals/BannerCreate.tsx +++ b/src/pages/banner/modals/BannerCreate.tsx @@ -20,10 +20,14 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="600px" trigger={} + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + banner_spaces_id: props.item?.banner_spaces_id, + }); } }} onFinish={async (values) => @@ -41,6 +45,10 @@ export default function Create(props: MyBetaModalFormProps) { title: '选择广告位', colProps: { span: 12 }, formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + optionFilterProp: 'label', + }, }), { key: 'name', diff --git a/src/pages/banner_space/components/BannerList.tsx b/src/pages/banner_space/components/BannerList.tsx index c64e740..8c7386f 100644 --- a/src/pages/banner_space/components/BannerList.tsx +++ b/src/pages/banner_space/components/BannerList.tsx @@ -32,7 +32,10 @@ export default function Index({ ...rest }) { toolBarRender={(action) => [ , diff --git a/src/pages/banner_space/modals/BannerSpaceCreate.tsx b/src/pages/banner_space/modals/BannerSpaceCreate.tsx index def0cfe..c3117de 100644 --- a/src/pages/banner_space/modals/BannerSpaceCreate.tsx +++ b/src/pages/banner_space/modals/BannerSpaceCreate.tsx @@ -18,6 +18,7 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="500px" trigger={} + key={new Date().getTime()} onFinish={async (values) => Apis.Banner.BannerSpaces.Store(values) .then(() => { diff --git a/src/pages/company/components/Employees.tsx b/src/pages/company/components/Employees.tsx index 38e825d..7c04237 100644 --- a/src/pages/company/components/Employees.tsx +++ b/src/pages/company/components/Employees.tsx @@ -25,7 +25,7 @@ export default function Index(props: MyBetaModalFormProps) { toolBarRender={(action) => [ , diff --git a/src/pages/company/components/modals/EmployeeCreate.tsx b/src/pages/company/components/modals/EmployeeCreate.tsx index 0fda94b..7949d13 100644 --- a/src/pages/company/components/modals/EmployeeCreate.tsx +++ b/src/pages/company/components/modals/EmployeeCreate.tsx @@ -24,6 +24,9 @@ export default function Create(props: MyBetaModalFormProps) { onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + companies_id: props?.item?.id, + }); } }} onFinish={async (values: any) => @@ -40,17 +43,18 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - // Selects?.Organizations({ - // title: '设置所属组织', - // params: { companies_id: props?.item?.companies_id }, - // key: 'organizations_id', - // formItemProps: { ...rulesHelper.text }, - // }), + Selects?.Companies({ + key: 'companies_id', + title: '所属机构', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), Selects?.OrganizationsTree({ title: '选择组织', key: 'organizations_id', params: { companies_id: props?.item?.companies_id }, colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, }), { key: 'name', diff --git a/src/pages/company/components/modals/EmployeeUpdate.tsx b/src/pages/company/components/modals/EmployeeUpdate.tsx index 5a32033..373774a 100644 --- a/src/pages/company/components/modals/EmployeeUpdate.tsx +++ b/src/pages/company/components/modals/EmployeeUpdate.tsx @@ -46,12 +46,6 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - // Selects?.Organizations({ - // title: '所属组织', - // params: { companies_id: props?.item?.companies_id }, - // key: 'organizations_id', - // formItemProps: { ...rulesHelper.text }, - // }), Selects?.OrganizationsTree({ title: '选择组织', key: 'organizations_id', @@ -60,6 +54,7 @@ export default function Update(props: MyBetaModalFormProps) { fieldProps: { showSearch: true, }, + formItemProps: { ...rulesHelper.text }, }), { key: 'name', diff --git a/src/pages/company/modals/CompanyCreate.tsx b/src/pages/company/modals/CompanyCreate.tsx index 680b72d..8d1e024 100644 --- a/src/pages/company/modals/CompanyCreate.tsx +++ b/src/pages/company/modals/CompanyCreate.tsx @@ -58,7 +58,7 @@ export default function Create(props: MyBetaModalFormProps) { key: 'contact_name', title: '联系人姓名', colProps: { span: 6 }, - // formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.text }, }, { key: 'contact_phone', @@ -68,7 +68,7 @@ export default function Create(props: MyBetaModalFormProps) { fieldProps: { maxLength: 11, }, - // formItemProps: { ...rulesHelper.phone }, + formItemProps: { ...rulesHelper.phone }, }, { key: 'contact_email', diff --git a/src/pages/company/modals/CompanyUpdate.tsx b/src/pages/company/modals/CompanyUpdate.tsx index 7b72009..2737c9d 100644 --- a/src/pages/company/modals/CompanyUpdate.tsx +++ b/src/pages/company/modals/CompanyUpdate.tsx @@ -69,7 +69,7 @@ export default function Update(props: MyBetaModalFormProps) { key: 'contact_name', title: '联系人姓名', colProps: { span: 6 }, - // formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.text }, }, { key: 'contact_phone', @@ -79,7 +79,7 @@ export default function Update(props: MyBetaModalFormProps) { fieldProps: { maxLength: 11, }, - // formItemProps: { ...rulesHelper.phone }, + formItemProps: { ...rulesHelper.phone }, }, { key: 'contact_email', diff --git a/src/pages/employees/index.tsx b/src/pages/employees/index.tsx index dae6194..4f7b76a 100644 --- a/src/pages/employees/index.tsx +++ b/src/pages/employees/index.tsx @@ -8,6 +8,7 @@ import { import { Apis } from '@/gen/Apis'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; +import EmployeeCreate from '../company/components/modals/EmployeeCreate'; import EmployeeUpdate from '../company/components/modals/EmployeeUpdate'; export default function Index({ title = '员工管理' }) { @@ -35,13 +36,9 @@ export default function Index({ title = '员工管理' }) { Apis.Company.CompanyEmployees.List, ) } - // toolBarRender={(action) => [ - // , - // ]} + toolBarRender={(action) => [ + , + ]} columns={[ MyColumns.ID(), { diff --git a/src/pages/house_charge/$id.tsx b/src/pages/house_charge/$id.tsx new file mode 100644 index 0000000..425ccca --- /dev/null +++ b/src/pages/house_charge/$id.tsx @@ -0,0 +1,52 @@ +import { MyPageContainer, usePageTabs } 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 BannerList from './components/BannerList'; +import BannerSpaceInfo from './components/BannerSpaceInfo'; + +export default function Show({ title }: { title?: string } = {}) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + // 注册当前页面为标签页 + const { addTab } = usePageTabs({ + tabKey: `banner-space-${id}`, + tabLabel: data?.name || title || '广告位详情', + }); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.Banner.BannerSpaces.Show(paramsId).then((res) => { + setShow(res?.data); + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '关联房屋', + key: '1', + closable: false, + children: ( + loadShow()} + /> + ), + }, + ]; + return ( + + + + + + + ); +} diff --git a/src/pages/house_charge/components/BannerList.tsx b/src/pages/house_charge/components/BannerList.tsx new file mode 100644 index 0000000..8c7386f --- /dev/null +++ b/src/pages/house_charge/components/BannerList.tsx @@ -0,0 +1,86 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannersRedirectTypeEnum, BannersTypeEnum } from '@/gen/Enums'; +import BannerCreate from '@/pages/banner/modals/BannerCreate'; +import BannerShow from '@/pages/banner/modals/BannerShow'; +import BannerUpdate from '@/pages/banner/modals/BannerUpdate'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import { useEffect, useRef } from 'react'; + +export default function Index({ ...rest }) { + const actionLooks = useRef(); + useEffect(() => { + actionLooks?.current.reloadAndRest(); + }, [rest.loadmore]); + + return ( + <> + > + {...MyProTableProps.props} + actionRef={actionLooks} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + banner_spaces_id: rest.item?.banner_spaces_id, + }, + sort, + Apis.Banner.Banners.List, + ) + } + toolBarRender={(action) => [ + , + ]} + search={false} + columns={[ + MyColumns.ID(), + { + title: '广告名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: BannersTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '跳转类型', + dataIndex: 'redirect_type', + valueEnum: BannersRedirectTypeEnum, + search: false, + }), + { + title: '开始时间', + dataIndex: 'start_time', + valueType: 'dateTime', + search: false, + }, + { + title: '结束时间', + dataIndex: 'end_time', + valueType: 'dateTime', + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/house_charge/components/BannerSpaceInfo.tsx b/src/pages/house_charge/components/BannerSpaceInfo.tsx new file mode 100644 index 0000000..2d9297e --- /dev/null +++ b/src/pages/house_charge/components/BannerSpaceInfo.tsx @@ -0,0 +1,31 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { BannerSpacesTypeEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + const { item } = props; + + return ( + + + + + {item?.name} + + + + + + + {item?.remark} + + + + + ); +} diff --git a/src/pages/house_charge/index.tsx b/src/pages/house_charge/index.tsx new file mode 100644 index 0000000..a89faf4 --- /dev/null +++ b/src/pages/house_charge/index.tsx @@ -0,0 +1,95 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannerSpacesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import HouseChargeCreate from './modals/HouseChargeCreate'; +import HouseChargeUpdate from './modals/HouseChargeUpdate'; + +export default function Index({ title = '收费标准' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'house-charge', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.HouseCharage.HouseChargeStandards.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '广告位名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: BannerSpacesTypeEnum, + search: false, + }), + { + title: '备注', + dataIndex: 'remark', + search: false, + ellipsis: true, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate(`/house_charge/${item.id}`); + }} + /> + + + Apis.HouseCharage.HouseChargeStandards.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/house_charge/modals/HouseChargeCreate.tsx b/src/pages/house_charge/modals/HouseChargeCreate.tsx new file mode 100644 index 0000000..7689299 --- /dev/null +++ b/src/pages/house_charge/modals/HouseChargeCreate.tsx @@ -0,0 +1,227 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const actionRef = useRef(); + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`添加收费标准`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + key={new Date().getTime()} + form={form} + onFinish={async (values) => + Apis.HouseCharage.HouseChargeStandards.Store(values) + .then(() => { + props.reload?.(); + message.success('添加收费标准成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '收费标准名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '适用对象', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsTypeEnum, + required: true, + }), + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 24 }, + valueEnum: HouseChargeStandardsCalculationMethodEnum, + required: true, + }), + + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + fieldProps: { + onChange: () => { + // 切换计费算法时清空阶梯配置 + form.setFieldValue('scheme', undefined); + }, + }, + }), + { + valueType: '', + }, + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 7 }, + title: '起始值', + valueType: 'number', + fieldProps: { min: 0 }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 7 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [] + : []; + }, + }, + { + valueType: 'group', + columns: [ + { + title: '是否分摊', + dataIndex: 'is_apportionment', + colProps: { span: 6 }, + valueType: 'switch', + formItemProps: { ...rulesHelper.text }, + }, + { + name: ['is_apportionment'], + valueType: 'dependency', + columns: ({ is_apportionment }: any) => { + return is_apportionment + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + ], + }, + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '计费周期', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'remark', + title: '备注', + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/house_charge/modals/HouseChargeUpdate.tsx b/src/pages/house_charge/modals/HouseChargeUpdate.tsx new file mode 100644 index 0000000..eb86cfd --- /dev/null +++ b/src/pages/house_charge/modals/HouseChargeUpdate.tsx @@ -0,0 +1,66 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannerSpacesTypeEnum } 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="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Banner.BannerSpaces.Update({ ...values, id: props.item?.id ?? 0 }) + .then(() => { + props.reload?.(); + message.success('编辑广告位成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '广告位名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: BannerSpacesTypeEnum, + required: true, + }), + { + key: 'remark', + title: '备注', + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ]} + /> + ); +} \ No newline at end of file diff --git a/src/pages/work_order/modals/WorkOrderCreate.tsx b/src/pages/work_order/modals/WorkOrderCreate.tsx index e8ce280..e45d8b2 100644 --- a/src/pages/work_order/modals/WorkOrderCreate.tsx +++ b/src/pages/work_order/modals/WorkOrderCreate.tsx @@ -45,19 +45,12 @@ export default function WorkOrderCreate(props: MyBetaModalFormProps) { required: true, }), - { - key: 'title', - title: '工单标题', - colProps: { span: 18 }, - formItemProps: { ...rulesHelper.text }, - }, - MyFormItems.EnumSelect({ - key: 'level', - title: '优先级', - colProps: { span: 6 }, - valueEnum: HouseWorkOrdersLevelEnum, - required: true, - }), + // { + // key: 'title', + // title: '工单标题', + // colProps: { span: 18 }, + // formItemProps: { ...rulesHelper.text }, + // }, { key: 'content', title: '工单描述', @@ -68,7 +61,13 @@ export default function WorkOrderCreate(props: MyBetaModalFormProps) { placeholder: '请详细描述工单内容', }, }, - + MyFormItems.EnumRadio({ + key: 'level', + title: '优先级', + colProps: { span: 24 }, + valueEnum: HouseWorkOrdersLevelEnum, + required: true, + }), { valueType: 'dependency', name: ['asset_projects_id', 'asset_buildings_id', 'asset_units_id'], @@ -147,7 +146,7 @@ export default function WorkOrderCreate(props: MyBetaModalFormProps) { { key: 'reporter_phone', title: '上报人手机', - formItemProps: { ...rulesHelper.phone }, + // formItemProps: { ...rulesHelper.phone }, colProps: { span: 12 }, fieldProps: { placeholder: '请输入手机号码', From 8f9c9fc6a178e48f3b005af0b9bea92dc894e06f Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Tue, 2 Sep 2025 16:22:57 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat=EF=BC=9A=E6=94=B6=E8=B4=B9=E6=A0=87?= =?UTF-8?q?=E5=87=860.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.ts | 2 +- src/components/Address.tsx | 7 +- src/gen/ApiTypes.d.ts | 9 + src/gen/Apis.ts | 3 + src/gen/Enums.ts | 724 +++++++++++------- .../components/modals/RegistersShow.tsx | 8 +- src/pages/archive/index.tsx | 24 +- src/pages/asset/$id.tsx | 4 +- src/pages/asset/components/Basic.tsx | 96 --- src/pages/asset/components/ChargeStandard.tsx | 9 +- .../modals/ChargeStandardCreate.tsx | 131 ++-- .../modals/ChargeStandardHasHouse.tsx | 383 +++++++-- .../modals/ChargeStandardUpdate.tsx | 435 +++++++++++ src/pages/asset/index.tsx | 2 +- src/pages/asset/modals/AssetCreate.tsx | 23 +- src/pages/asset/modals/AssetUpdate.tsx | 30 +- src/pages/asset_houses/index.tsx | 9 + .../{house_charge => charge_standard}/$id.tsx | 16 +- .../charge_standard/components/ChargeInfo.tsx | 52 ++ .../components/HasHouse.tsx} | 60 +- src/pages/charge_standard/index.tsx | 145 ++++ .../charge_standard/modals/ChargeCreate.tsx | 447 +++++++++++ src/pages/company/index.tsx | 2 +- .../house_registers_audit/modals/Audit.tsx | 29 +- .../components/BannerSpaceInfo.tsx | 31 - src/pages/house_charge/index.tsx | 95 --- .../house_charge/modals/HouseChargeCreate.tsx | 227 ------ .../house_charge/modals/HouseChargeUpdate.tsx | 66 -- 28 files changed, 2065 insertions(+), 1004 deletions(-) delete mode 100644 src/pages/asset/components/Basic.tsx create mode 100644 src/pages/asset/components/modals/ChargeStandardUpdate.tsx rename src/pages/{house_charge => charge_standard}/$id.tsx (72%) create mode 100644 src/pages/charge_standard/components/ChargeInfo.tsx rename src/pages/{house_charge/components/BannerList.tsx => charge_standard/components/HasHouse.tsx} (55%) create mode 100644 src/pages/charge_standard/index.tsx create mode 100644 src/pages/charge_standard/modals/ChargeCreate.tsx delete mode 100644 src/pages/house_charge/components/BannerSpaceInfo.tsx delete mode 100644 src/pages/house_charge/index.tsx delete mode 100644 src/pages/house_charge/modals/HouseChargeCreate.tsx delete mode 100644 src/pages/house_charge/modals/HouseChargeUpdate.tsx diff --git a/.umirc.ts b/.umirc.ts index 9539141..6fc5cab 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -16,7 +16,7 @@ export default defineConfig({ '/api/': { // target: 'http://yt:8003', target: 'http://10.39.13.80:8001', - // target: 'https://weapp-api.linyikj.com.cn/', + // target: 'https://test-admin.linyikj.com.cn/', // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', changeOrigin: true, diff --git a/src/components/Address.tsx b/src/components/Address.tsx index 14b6f5f..6d78126 100644 --- a/src/components/Address.tsx +++ b/src/components/Address.tsx @@ -5,6 +5,7 @@ import { ProFormText, } from '@ant-design/pro-components'; +import { rulesHelper } from '@/common'; import { DefaultOptionType } from 'antd/es/cascader'; import data from './city.json'; const request = async () => Promise.resolve(data as Record[]); @@ -45,9 +46,9 @@ export const Address = { return accumulator; }, {} as Record); }, - // formItemProps: { - // ...(required ? rulesHelper.array : {}), - // }, + formItemProps: { + ...(required ? rulesHelper.array : {}), + }, fieldProps: { showSearch: true, changeOnSelect: true, diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 974a17d..9b5337b 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -122,6 +122,7 @@ declare namespace ApiTypes { "asset_units_id"?: number; // 所属单元id,[ref:asset_units] "name"?: string; // 模糊搜索:名称 "full_name"?: string; // 模糊搜索:全称 + "project_name"?: string; // 模糊搜索:项目名称 }; type Store = { "asset_projects_id": number; // 所属项目id,[ref:asset_projects] @@ -844,6 +845,9 @@ declare namespace ApiTypes { "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] "houses_ids": string[]; // 房屋id,[ref:houses] }; + type GetChargeStandardHouseIds = { + "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] + }; type Show = { "id": number; // id }; @@ -854,6 +858,11 @@ declare namespace ApiTypes { namespace HouseChargeStandards { type List = { "name"?: string; // 模糊搜索:名称 + "project_name"?: string; // 模糊搜索:项目名称 + "company_name"?: string; // 模糊搜索:机构名称 + "charge_type"?: string; // 收费类型,[enum:HouseBillsTypeEnum] + "asset_projects_id"?: number; // 项目id,[ref:asset_projects] + "companies_id"?: number; // 机构id,[ref:companies] }; type Store = { "asset_projects_id": number; // 项目id,[ref:asset_projects] diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index d10448b..079d4f5 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -503,6 +503,9 @@ export const Apis = { Store(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Store): Promise { return request('admin/house_charage/house_charge_has_houses/store', { data }); }, + GetChargeStandardHouseIds(data: ApiTypes.HouseCharage.HouseChargeHasHouses.GetChargeStandardHouseIds): Promise { + return request('admin/house_charage/house_charge_has_houses/get_charge_standard_house_ids', { data }); + }, Show(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Show): Promise { return request('admin/house_charage/house_charge_has_houses/show', { data }); }, diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 324e482..3b56461 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -1,460 +1,616 @@ // AssetHousesOrientationEnum -export const AssetHousesOrientationEnum= { - 'East': {"text":"东","color":"#007bff","value":"East"}, - 'South': {"text":"南","color":"#28a745","value":"South"}, - 'West': {"text":"西","color":"#ffc107","value":"West"}, - 'North': {"text":"北","color":"#dc3545","value":"North"}, - 'Southeast': {"text":"东南","color":"#20c997","value":"Southeast"}, - 'Northeast': {"text":"东北","color":"#6f42c1","value":"Northeast"}, - 'Southwest': {"text":"西南","color":"#fd7e14","value":"Southwest"}, - 'Northwest': {"text":"西北","color":"#17a2b8","value":"Northwest"}, - 'EastWest': {"text":"东西","color":"#6610f2","value":"EastWest"}, - 'SouthNorth': {"text":"南北","color":"#e83e8c","value":"SouthNorth"}, +export const AssetHousesOrientationEnum = { + East: { text: '东', color: '#007bff', value: 'East' }, + South: { text: '南', color: '#28a745', value: 'South' }, + West: { text: '西', color: '#ffc107', value: 'West' }, + North: { text: '北', color: '#dc3545', value: 'North' }, + Southeast: { text: '东南', color: '#20c997', value: 'Southeast' }, + Northeast: { text: '东北', color: '#6f42c1', value: 'Northeast' }, + Southwest: { text: '西南', color: '#fd7e14', value: 'Southwest' }, + Northwest: { text: '西北', color: '#17a2b8', value: 'Northwest' }, + EastWest: { text: '东西', color: '#6610f2', value: 'EastWest' }, + SouthNorth: { text: '南北', color: '#e83e8c', value: 'SouthNorth' }, }; // AssetHousesOwnershipTypeEnum -export const AssetHousesOwnershipTypeEnum= { - 'CommodityHousing': {"text":"商品房","color":"#007bff","value":"CommodityHousing"}, - 'FundedHousing': {"text":"集资房","color":"#28a745","value":"FundedHousing"}, - 'MilitaryHousing': {"text":"军产房","color":"#17a2b8","value":"MilitaryHousing"}, - 'AffordableHousing': {"text":"保障房","color":"#ffc107","value":"AffordableHousing"}, - 'RuralHousing': {"text":"农民房","color":"#6f42c1","value":"RuralHousing"}, - 'CommercialOffice': {"text":"商业写字楼","color":"#fd7e14","value":"CommercialOffice"}, - 'CommercialComplex': {"text":"商业综合体","color":"#dc3545","value":"CommercialComplex"}, - 'ResettlementHousing': {"text":"回迁房","color":"#20c997","value":"ResettlementHousing"}, +export const AssetHousesOwnershipTypeEnum = { + CommodityHousing: { + text: '商品房', + color: '#007bff', + value: 'CommodityHousing', + }, + FundedHousing: { text: '集资房', color: '#28a745', value: 'FundedHousing' }, + MilitaryHousing: { + text: '军产房', + color: '#17a2b8', + value: 'MilitaryHousing', + }, + AffordableHousing: { + text: '保障房', + color: '#ffc107', + value: 'AffordableHousing', + }, + RuralHousing: { text: '农民房', color: '#6f42c1', value: 'RuralHousing' }, + CommercialOffice: { + text: '商业写字楼', + color: '#fd7e14', + value: 'CommercialOffice', + }, + CommercialComplex: { + text: '商业综合体', + color: '#dc3545', + value: 'CommercialComplex', + }, + ResettlementHousing: { + text: '回迁房', + color: '#20c997', + value: 'ResettlementHousing', + }, }; // AssetHousesPropertyOwnershipEnum -export const AssetHousesPropertyOwnershipEnum= { - 'Individual': {"text":"个人","color":"#2db7f5","value":"Individual"}, - 'Enterprise': {"text":"企业","color":"#87d068","value":"Enterprise"}, - 'Developer': {"text":"开发商","color":"#fa8c16","value":"Developer"}, - 'Government': {"text":"政府","color":"#f5222d","value":"Government"}, +export const AssetHousesPropertyOwnershipEnum = { + Individual: { text: '个人', color: '#2db7f5', value: 'Individual' }, + Enterprise: { text: '企业', color: '#87d068', value: 'Enterprise' }, + Developer: { text: '开发商', color: '#fa8c16', value: 'Developer' }, + Government: { text: '政府', color: '#f5222d', value: 'Government' }, }; // AssetHousesStatusEnum -export const AssetHousesStatusEnum= { - 'Unsold': {"text":"未售","color":"#6c757d","value":"Unsold"}, - 'SoldNotDelivered': {"text":"已售未交房","color":"#ffc107","value":"SoldNotDelivered"}, - 'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"}, - 'Rented': {"text":"出租","color":"#007bff","value":"Rented"}, - 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, +export const AssetHousesStatusEnum = { + Unsold: { text: '未售', color: '#6c757d', value: 'Unsold' }, + SoldNotDelivered: { + text: '已售未交房', + color: '#ffc107', + value: 'SoldNotDelivered', + }, + SelfOccupied: { text: '自住', color: '#28a745', value: 'SelfOccupied' }, + Rented: { text: '出租', color: '#007bff', value: 'Rented' }, + Vacant: { text: '空置', color: '#dc3545', value: 'Vacant' }, }; // AssetHousesUsageEnum -export const AssetHousesUsageEnum= { - 'Residence': {"text":"住宅","color":"#007bff","value":"Residence"}, - 'Apartment': {"text":"公寓","color":"#28a745","value":"Apartment"}, - 'Villa': {"text":"别墅","color":"#17a2b8","value":"Villa"}, - 'Shop': {"text":"商铺","color":"#ffc107","value":"Shop"}, - 'ParkingSpace': {"text":"车位","color":"#6c757d","value":"ParkingSpace"}, - 'Office': {"text":"写字楼","color":"#6610f2","value":"Office"}, - 'Clubhouse': {"text":"会所","color":"#fd7e14","value":"Clubhouse"}, - 'PropertyRoom': {"text":"物业用房","color":"#dc3545","value":"PropertyRoom"}, +export const AssetHousesUsageEnum = { + Residence: { text: '住宅', color: '#007bff', value: 'Residence' }, + Apartment: { text: '公寓', color: '#28a745', value: 'Apartment' }, + Villa: { text: '别墅', color: '#17a2b8', value: 'Villa' }, + Shop: { text: '商铺', color: '#ffc107', value: 'Shop' }, + ParkingSpace: { text: '车位', color: '#6c757d', value: 'ParkingSpace' }, + Office: { text: '写字楼', color: '#6610f2', value: 'Office' }, + Clubhouse: { text: '会所', color: '#fd7e14', value: 'Clubhouse' }, + PropertyRoom: { text: '物业用房', color: '#dc3545', value: 'PropertyRoom' }, }; // AssetProjectsChargeEnum -export const AssetProjectsChargeEnum= { - 'Contract': {"text":"包干制","color":"#007bff","value":"Contract"}, - 'Commission': {"text":"酬金制","color":"#28a745","value":"Commission"}, +export const AssetProjectsChargeEnum = { + Contract: { text: '包干制', color: '#007bff', value: 'Contract' }, + Commission: { text: '酬金制', color: '#28a745', value: 'Commission' }, }; // AssetProjectsEntrustTypeEnum -export const AssetProjectsEntrustTypeEnum= { - 'DeveloperJointEntrust': {"text":"开发商全委","color":"#007bff","value":"DeveloperJointEntrust"}, - 'OwnersFullEntrust': {"text":"业委会全委","color":"#28a745","value":"OwnersFullEntrust"}, - 'GovernmentFullEntrust': {"text":"政府类全委","color":"#ffc107","value":"GovernmentFullEntrust"}, +export const AssetProjectsEntrustTypeEnum = { + DeveloperJointEntrust: { + text: '开发商全委', + color: '#007bff', + value: 'DeveloperJointEntrust', + }, + OwnersFullEntrust: { + text: '业委会全委', + color: '#28a745', + value: 'OwnersFullEntrust', + }, + GovernmentFullEntrust: { + text: '政府类全委', + color: '#ffc107', + value: 'GovernmentFullEntrust', + }, }; // AssetProjectsPropertyTypeEnum -export const AssetProjectsPropertyTypeEnum= { - 'Residence': {"text":"住宅","color":"#ff0000","value":"Residence"}, - 'Commercial': {"text":"商业","color":"#ff6600","value":"Commercial"}, - 'Office': {"text":"办公","color":"#ffcc00","value":"Office"}, - 'IndustrialPark': {"text":"产业园","color":"#00cc66","value":"IndustrialPark"}, - 'Complex': {"text":"综合体","color":"#0099ff","value":"Complex"}, - 'Municipal': {"text":"市政设施","color":"#6633cc","value":"Municipal"}, - 'Venue': {"text":"场馆","color":"#9966ff","value":"Venue"}, - 'Education': {"text":"教育","color":"#339999","value":"Education"}, - 'Medical': {"text":"医疗","color":"#cc3366","value":"Medical"}, +export const AssetProjectsPropertyTypeEnum = { + Residence: { text: '住宅', color: '#ff0000', value: 'Residence' }, + Commercial: { text: '商业', color: '#ff6600', value: 'Commercial' }, + Office: { text: '办公', color: '#ffcc00', value: 'Office' }, + IndustrialPark: { text: '产业园', color: '#00cc66', value: 'IndustrialPark' }, + Complex: { text: '综合体', color: '#0099ff', value: 'Complex' }, + Municipal: { text: '市政设施', color: '#6633cc', value: 'Municipal' }, + Venue: { text: '场馆', color: '#9966ff', value: 'Venue' }, + Education: { text: '教育', color: '#339999', value: 'Education' }, + Medical: { text: '医疗', color: '#cc3366', value: 'Medical' }, }; // AssetProjectsStatusEnum -export const AssetProjectsStatusEnum= { - 'SignedNotDelivered': {"text":"签约未交付","color":"#6c757d","value":"SignedNotDelivered"}, - 'RollingDevelopment': {"text":"滚动开发","color":"#007bff","value":"RollingDevelopment"}, - 'ManagedAndClosed': {"text":"在管封园","color":"#ffc107","value":"ManagedAndClosed"}, - 'Exited': {"text":"退出","color":"#dc3545","value":"Exited"}, +export const AssetProjectsStatusEnum = { + SignedNotDelivered: { + text: '签约未交付', + color: '#6c757d', + value: 'SignedNotDelivered', + }, + RollingDevelopment: { + text: '滚动开发', + color: '#007bff', + value: 'RollingDevelopment', + }, + ManagedAndClosed: { + text: '在管封园', + color: '#ffc107', + value: 'ManagedAndClosed', + }, + Exited: { text: '退出', color: '#dc3545', value: 'Exited' }, }; // AssetUnitsBuildingStructureEnum -export const AssetUnitsBuildingStructureEnum= { - 'SteelConcrete': {"text":"钢混","color":"#007bff","value":"SteelConcrete"}, - 'SteelStructure': {"text":"钢结构","color":"#28a745","value":"SteelStructure"}, - 'BrickConcrete': {"text":"砖混","color":"#ffc107","value":"BrickConcrete"}, - 'BrickWood': {"text":"砖木","color":"#dc3545","value":"BrickWood"}, +export const AssetUnitsBuildingStructureEnum = { + SteelConcrete: { text: '钢混', color: '#007bff', value: 'SteelConcrete' }, + SteelStructure: { text: '钢结构', color: '#28a745', value: 'SteelStructure' }, + BrickConcrete: { text: '砖混', color: '#ffc107', value: 'BrickConcrete' }, + BrickWood: { text: '砖木', color: '#dc3545', value: 'BrickWood' }, }; // AssetUnitsBuildingTypeEnum -export const AssetUnitsBuildingTypeEnum= { - 'SlabAndTower': {"text":"板塔结合","color":"#007bff","value":"SlabAndTower"}, - 'Slab': {"text":"板楼","color":"#28a745","value":"Slab"}, - 'Tower': {"text":"塔楼","color":"#ffc107","value":"Tower"}, +export const AssetUnitsBuildingTypeEnum = { + SlabAndTower: { text: '板塔结合', color: '#007bff', value: 'SlabAndTower' }, + Slab: { text: '板楼', color: '#28a745', value: 'Slab' }, + Tower: { text: '塔楼', color: '#ffc107', value: 'Tower' }, }; // BannerSpacesTypeEnum -export const BannerSpacesTypeEnum= { - 'Popup': {"text":"弹窗","color":"#ff0000","value":"Popup"}, - 'Banner': {"text":"横幅广告","color":"#00ff00","value":"Banner"}, - 'FloatingButton': {"text":"悬浮按钮","color":"#0000ff","value":"FloatingButton"}, +export const BannerSpacesTypeEnum = { + Popup: { text: '弹窗', color: '#ff0000', value: 'Popup' }, + Banner: { text: '横幅广告', color: '#00ff00', value: 'Banner' }, + FloatingButton: { + text: '悬浮按钮', + color: '#0000ff', + value: 'FloatingButton', + }, }; // BannersRedirectTypeEnum -export const BannersRedirectTypeEnum= { - 'InnerPage': {"text":"跳内页","color":"#ff0000","value":"InnerPage"}, - 'H5': {"text":"跳H5","color":"#00ff00","value":"H5"}, - 'MiniProgramHome': {"text":"跳小程序首屏","color":"#0000ff","value":"MiniProgramHome"}, - 'AnotherMiniProgram': {"text":"跳另一个小程序","color":"#ffa500","value":"AnotherMiniProgram"}, +export const BannersRedirectTypeEnum = { + InnerPage: { text: '跳内页', color: '#ff0000', value: 'InnerPage' }, + H5: { text: '跳H5', color: '#00ff00', value: 'H5' }, + MiniProgramHome: { + text: '跳小程序首屏', + color: '#0000ff', + value: 'MiniProgramHome', + }, + AnotherMiniProgram: { + text: '跳另一个小程序', + color: '#ffa500', + value: 'AnotherMiniProgram', + }, }; // BannersTypeEnum -export const BannersTypeEnum= { - 'Image': {"text":"图片","color":"#ff0000","value":"Image"}, - 'Video': {"text":"视频","color":"#00ff00","value":"Video"}, - 'Text': {"text":"文本","color":"#0000ff","value":"Text"}, +export const BannersTypeEnum = { + Image: { text: '图片', color: '#ff0000', value: 'Image' }, + Video: { text: '视频', color: '#00ff00', value: 'Video' }, + Text: { text: '文本', color: '#0000ff', value: 'Text' }, }; // 缓存类型 -export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#649200","value":"MobilePhoneVerificationCode"}, +export const CacheTypeEnum = { + MobilePhoneVerificationCode: { + text: '手机验证码', + color: '#2432a3', + value: 'MobilePhoneVerificationCode', + }, }; // CompaniesMerchantTypeEnum -export const CompaniesMerchantTypeEnum= { - 'PropertyManagement': {"text":"物业公司","color":"#007bff","value":"PropertyManagement"}, - 'ServiceProvider': {"text":"服务商","color":"#28a745","value":"ServiceProvider"}, +export const CompaniesMerchantTypeEnum = { + PropertyManagement: { + text: '物业公司', + color: '#007bff', + value: 'PropertyManagement', + }, + ServiceProvider: { + text: '服务商', + color: '#28a745', + value: 'ServiceProvider', + }, }; // CompanyAppsAppTypeEnum -export const CompanyAppsAppTypeEnum= { - 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, - 'MpOfficial': {"text":"微信公众号","color":"#22c55e","value":"MpOfficial"}, - 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, +export const CompanyAppsAppTypeEnum = { + MiniProgram: { text: '微信小程序', color: '#3b82f6', value: 'MiniProgram' }, + MpOfficial: { text: '微信公众号', color: '#22c55e', value: 'MpOfficial' }, + WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, }; // CompanyAppsModuleEnum -export const CompanyAppsModuleEnum= { - 'Employee': {"text":"员工端","color":"#3b82f6","value":"Employee"}, - 'Customer': {"text":"客户端","color":"#10b981","value":"Customer"}, +export const CompanyAppsModuleEnum = { + Employee: { text: '员工端', color: '#3b82f6', value: 'Employee' }, + Customer: { text: '客户端', color: '#10b981', value: 'Customer' }, }; // CompanyEmployeeBacklogsStatusEnum -export const CompanyEmployeeBacklogsStatusEnum= { - 'Pending': {"text":"待办","color":"#FF6600","value":"Pending"}, - 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, +export const CompanyEmployeeBacklogsStatusEnum = { + Pending: { text: '待办', color: '#FF6600', value: 'Pending' }, + Completed: { text: '已办', color: '#2A82E4', value: 'Completed' }, }; // CompanyEmployeeBacklogsTypeEnum -export const CompanyEmployeeBacklogsTypeEnum= { - 'WorkOrder': {"text":"工单","color":"#FF6600","value":"WorkOrder"}, - 'Contract': {"text":"合同","color":"#2A82E4","value":"Contract"}, +export const CompanyEmployeeBacklogsTypeEnum = { + WorkOrder: { text: '工单', color: '#FF6600', value: 'WorkOrder' }, + Contract: { text: '合同', color: '#2A82E4', value: 'Contract' }, }; // CompanyReceiptAccountsPayChannelEnum -export const CompanyReceiptAccountsPayChannelEnum= { - 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, - 'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"}, - 'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"}, - 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, +export const CompanyReceiptAccountsPayChannelEnum = { + WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, + Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, + BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, + TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, }; // CustomerBacklogsStatusEnum -export const CustomerBacklogsStatusEnum= { - 'Pending': {"text":"待办","color":"#faad14","value":"Pending"}, - 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, +export const CustomerBacklogsStatusEnum = { + Pending: { text: '待办', color: '#faad14', value: 'Pending' }, + Completed: { text: '已办', color: '#2A82E4', value: 'Completed' }, }; // CustomerBacklogsTypeEnum -export const CustomerBacklogsTypeEnum= { - 'RegisterApply': {"text":"登记申请","color":"#2db7f5","value":"RegisterApply"}, - 'PaymentPending': {"text":"费用待缴","color":"#faad14","value":"PaymentPending"}, - 'ContractTodo': {"text":"合同待办","color":"#722ed1","value":"ContractTodo"}, +export const CustomerBacklogsTypeEnum = { + RegisterApply: { text: '登记申请', color: '#2db7f5', value: 'RegisterApply' }, + PaymentPending: { + text: '费用待缴', + color: '#faad14', + value: 'PaymentPending', + }, + ContractTodo: { text: '合同待办', color: '#722ed1', value: 'ContractTodo' }, }; // 账单状态枚举 -export const HouseBillsBillStatusEnum= { - 'PendingPayment': {"text":"待支付","color":"#facc15","value":"PendingPayment"}, - 'PartiallyPaid': {"text":"部分支付","color":"#60a5fa","value":"PartiallyPaid"}, - 'Paid': {"text":"已支付","color":"#10b981","value":"Paid"}, - 'Overdue': {"text":"已逾期","color":"#ef4444","value":"Overdue"}, - 'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"}, +export const HouseBillsBillStatusEnum = { + PendingPayment: { text: '待支付', color: '#facc15', value: 'PendingPayment' }, + PartiallyPaid: { text: '部分支付', color: '#60a5fa', value: 'PartiallyPaid' }, + Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, + Overdue: { text: '已逾期', color: '#ef4444', value: 'Overdue' }, + Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, }; // 房屋账单类型枚举 -export const HouseBillsTypeEnum= { - 'PropertyFee': {"text":"物业费","color":"#3b82f6","value":"PropertyFee"}, - 'MaintenanceFund': {"text":"维修基金","color":"#10b981","value":"MaintenanceFund"}, - 'WaterFee': {"text":"水费","color":"#06b6d4","value":"WaterFee"}, - 'ElectricityFee': {"text":"电费","color":"#f59e0b","value":"ElectricityFee"}, - 'SharedWaterFee': {"text":"公摊水费","color":"#8b5cf6","value":"SharedWaterFee"}, - 'SharedElectricityFee': {"text":"公摊电费","color":"#ec4899","value":"SharedElectricityFee"}, +export const HouseBillsTypeEnum = { + PropertyFee: { text: '物业费', color: '#3b82f6', value: 'PropertyFee' }, + MaintenanceFund: { + text: '维修基金', + color: '#10b981', + value: 'MaintenanceFund', + }, + WaterFee: { text: '水费', color: '#06b6d4', value: 'WaterFee' }, + ElectricityFee: { text: '电费', color: '#f59e0b', value: 'ElectricityFee' }, + SharedWaterFee: { + text: '公摊水费', + color: '#8b5cf6', + value: 'SharedWaterFee', + }, + SharedElectricityFee: { + text: '公摊电费', + color: '#ec4899', + value: 'SharedElectricityFee', + }, }; // HouseChargeStandardsApportionmentMethodEnum -export const HouseChargeStandardsApportionmentMethodEnum= { - 'HouseCount': {"text":"房屋数分摊","color":"#3b82f6","value":"HouseCount"}, - 'AreaProportion': {"text":"房屋计费面积分摊","color":"#10b981","value":"AreaProportion"}, - 'FixedRatio': {"text":"按固定比例分摊","color":"#f59e0b","value":"FixedRatio"}, +export const HouseChargeStandardsApportionmentMethodEnum = { + HouseCount: { text: '房屋数分摊', color: '#3b82f6', value: 'HouseCount' }, + AreaProportion: { + text: '房屋计费面积分摊', + color: '#10b981', + value: 'AreaProportion', + }, + FixedRatio: { text: '按固定比例分摊', color: '#f59e0b', value: 'FixedRatio' }, }; // HouseChargeStandardsCalculationMethodEnum -export const HouseChargeStandardsCalculationMethodEnum= { - 'ChargeableArea': {"text":"计费面积","color":"#3b82f6","value":"ChargeableArea"}, - 'BuiltArea': {"text":"建筑面积","color":"#10b981","value":"BuiltArea"}, - 'InsideArea': {"text":"套内面积","color":"#f59e0b","value":"InsideArea"}, - 'PerUnit': {"text":"按套","color":"#06b6d4","value":"PerUnit"}, - 'ElectricityUsage': {"text":"用电量","color":"#8b5cf6","value":"ElectricityUsage"}, - 'WaterUsage': {"text":"用水量","color":"#ec4899","value":"WaterUsage"}, +export const HouseChargeStandardsCalculationMethodEnum = { + ChargeableArea: { + text: '计费面积', + color: '#3b82f6', + value: 'ChargeableArea', + }, + BuiltArea: { text: '建筑面积', color: '#10b981', value: 'BuiltArea' }, + InsideArea: { text: '套内面积', color: '#f59e0b', value: 'InsideArea' }, + PerUnit: { text: '按套', color: '#06b6d4', value: 'PerUnit' }, + ElectricityUsage: { + text: '用电量', + color: '#8b5cf6', + value: 'ElectricityUsage', + }, + WaterUsage: { text: '用水量', color: '#ec4899', value: 'WaterUsage' }, }; // HouseChargeStandardsCalculationModeEnum -export const HouseChargeStandardsCalculationModeEnum= { - 'FixedAmount': {"text":"固定金额","color":"#3b82f6","value":"FixedAmount"}, - 'QuantityPrice': {"text":"数量*单价","color":"#10b981","value":"QuantityPrice"}, +export const HouseChargeStandardsCalculationModeEnum = { + FixedAmount: { text: '固定金额', color: '#3b82f6', value: 'FixedAmount' }, + QuantityPrice: { + text: '数量*单价', + color: '#10b981', + value: 'QuantityPrice', + }, }; // HouseChargeStandardsCalculationPeriodEnum -export const HouseChargeStandardsCalculationPeriodEnum= { - 'PerTime': {"text":"按次","color":"#3b82f6","value":"PerTime"}, - 'PerDay': {"text":"按日","color":"#10b981","value":"PerDay"}, - 'PerMonth': {"text":"按月","color":"#f59e0b","value":"PerMonth"}, - 'PerYear': {"text":"按年","color":"#8b5cf6","value":"PerYear"}, +export const HouseChargeStandardsCalculationPeriodEnum = { + PerTime: { text: '按次', color: '#3b82f6', value: 'PerTime' }, + PerDay: { text: '按日', color: '#10b981', value: 'PerDay' }, + PerMonth: { text: '按月', color: '#f59e0b', value: 'PerMonth' }, + PerYear: { text: '按年', color: '#8b5cf6', value: 'PerYear' }, }; // HouseChargeStandardsPriceAlgorithmEnum -export const HouseChargeStandardsPriceAlgorithmEnum= { - 'Fixed': {"text":"固定","color":"#4caf50","value":"Fixed"}, - 'Tiered': {"text":"分级价阶梯","color":"#2196f3","value":"Tiered"}, - 'Peak': {"text":"最高价阶梯","color":"#ff9800","value":"Peak"}, +export const HouseChargeStandardsPriceAlgorithmEnum = { + Fixed: { text: '固定', color: '#4caf50', value: 'Fixed' }, + Tiered: { text: '分级价阶梯', color: '#2196f3', value: 'Tiered' }, + Peak: { text: '最高价阶梯', color: '#ff9800', value: 'Peak' }, }; // HouseChargeStandardsStatusEnum -export const HouseChargeStandardsStatusEnum= { - 'Active': {"text":"启用","color":"#3b82f6","value":"Active"}, - 'Inactive': {"text":"禁用","color":"#ef4444","value":"Inactive"}, +export const HouseChargeStandardsStatusEnum = { + Active: { text: '启用', color: '#3b82f6', value: 'Active' }, + Inactive: { text: '禁用', color: '#ef4444', value: 'Inactive' }, }; // HouseChargeStandardsTypeEnum -export const HouseChargeStandardsTypeEnum= { - 'House': {"text":"房屋","color":"#3b82f6","value":"House"}, - 'Meter': {"text":"仪表","color":"#10b981","value":"Meter"}, +export const HouseChargeStandardsTypeEnum = { + House: { text: '房屋', color: '#3b82f6', value: 'House' }, + Meter: { text: '仪表', color: '#10b981', value: 'Meter' }, +}; + +// HouseChargeTaskDetailsStatusEnum +export const HouseChargeTaskDetailsStatusEnum = { + Pending: { text: '待处理', color: '#f59e0b', value: 'Pending' }, + Success: { text: '成功', color: '#22c55e', value: 'Success' }, + Failed: { text: '失败', color: '#ef4444', value: 'Failed' }, }; // HouseChargeTasksStatusEnum -export const HouseChargeTasksStatusEnum= { - 'Pending': {"text":"待执行","color":"#f59e0b","value":"Pending"}, - 'InProgress': {"text":"执行中","color":"#3b82f6","value":"InProgress"}, - 'Completed': {"text":"已完成","color":"#10b981","value":"Completed"}, - 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, +export const HouseChargeTasksStatusEnum = { + Pending: { text: '待执行', color: '#f59e0b', value: 'Pending' }, + InProgress: { text: '执行中', color: '#3b82f6', value: 'InProgress' }, + Completed: { text: '已完成', color: '#10b981', value: 'Completed' }, + Failed: { text: '失败', color: '#ef4444', value: 'Failed' }, +}; + +// HouseChargeTasksTypeEnum +export const HouseChargeTasksTypeEnum = { + Scheduled: { text: '定时创建', color: '#3b82f6', value: 'Scheduled' }, + Manual: { text: '手动创建', color: '#10b981', value: 'Manual' }, }; // HouseCollectionRecordsCollectionResultEnum -export const HouseCollectionRecordsCollectionResultEnum= { - 'PromiseToPay': {"text":"承诺缴费","color":"#4caf50","value":"PromiseToPay"}, - 'RefuseToPay': {"text":"拒绝缴费","color":"#f44336","value":"RefuseToPay"}, - 'NotReached': {"text":"未联系到","color":"#9e9e9e","value":"NotReached"}, - 'NeedFollowUp': {"text":"需要跟进","color":"#ff9800","value":"NeedFollowUp"}, +export const HouseCollectionRecordsCollectionResultEnum = { + PromiseToPay: { text: '承诺缴费', color: '#4caf50', value: 'PromiseToPay' }, + RefuseToPay: { text: '拒绝缴费', color: '#f44336', value: 'RefuseToPay' }, + NotReached: { text: '未联系到', color: '#9e9e9e', value: 'NotReached' }, + NeedFollowUp: { text: '需要跟进', color: '#ff9800', value: 'NeedFollowUp' }, }; // HouseCollectionRecordsSmsStatusEnum -export const HouseCollectionRecordsStatusEnum= { - 'NotNotified': {"text":"未通知","color":"#808080","value":"NotNotified"}, - 'Notified': {"text":"已通知","color":"#00cc00","value":"Notified"}, - 'Failed': {"text":"失败","color":"#ff0000","value":"Failed"}, +export const HouseCollectionRecordsStatusEnum = { + NotNotified: { text: '未通知', color: '#808080', value: 'NotNotified' }, + Notified: { text: '已通知', color: '#00cc00', value: 'Notified' }, + Failed: { text: '失败', color: '#ff0000', value: 'Failed' }, }; // HouseCollectionTasksChannelEnum -export const HouseCollectionTasksChannelEnum= { - 'SMS': {"text":"短信","color":"#1E90FF","value":"SMS"}, - 'MiniProgram': {"text":"小程序","color":"#00BFFF","value":"MiniProgram"}, - 'OfficialAccount': {"text":"公众号","color":"#32CD32","value":"OfficialAccount"}, - 'PhoneCall': {"text":"电话催缴","color":"#FF8C00","value":"PhoneCall"}, - 'Visit': {"text":"上门催缴","color":"#8B4513","value":"Visit"}, - 'WeChat': {"text":"微信联系","color":"#20B2AA","value":"WeChat"}, - 'WrittenNotice': {"text":"书面通知","color":"#708090","value":"WrittenNotice"}, +export const HouseCollectionTasksChannelEnum = { + SMS: { text: '短信', color: '#1E90FF', value: 'SMS' }, + MiniProgram: { text: '小程序', color: '#00BFFF', value: 'MiniProgram' }, + OfficialAccount: { + text: '公众号', + color: '#32CD32', + value: 'OfficialAccount', + }, + PhoneCall: { text: '电话催缴', color: '#FF8C00', value: 'PhoneCall' }, + Visit: { text: '上门催缴', color: '#8B4513', value: 'Visit' }, + WeChat: { text: '微信联系', color: '#20B2AA', value: 'WeChat' }, + WrittenNotice: { text: '书面通知', color: '#708090', value: 'WrittenNotice' }, }; // HouseCollectionTasksStatusEnum -export const HouseCollectionTasksStatusEnum= { - 'Processing': {"text":"进行中","color":"#ffcc00","value":"Processing"}, - 'Completed': {"text":"已完成","color":"#00cc00","value":"Completed"}, - 'Failed': {"text":"失败","color":"#ff0000","value":"Failed"}, +export const HouseCollectionTasksStatusEnum = { + Processing: { text: '进行中', color: '#ffcc00', value: 'Processing' }, + Completed: { text: '已完成', color: '#00cc00', value: 'Completed' }, + Failed: { text: '失败', color: '#ff0000', value: 'Failed' }, }; // HouseOccupantsCardTypeEnum -export const HouseOccupantsCardTypeEnum= { - 'MainlandID': {"text":"中国大陆居民身份证","color":"#2db7f5","value":"MainlandID"}, - 'HKPermit': {"text":"香港来往大陆通行证(回乡证)","color":"#fa8c16","value":"HKPermit"}, - 'MOPermit': {"text":"澳门来往大陆通行证(回乡证)","color":"#faad14","value":"MOPermit"}, - 'TWPermit': {"text":"台湾来往大陆通行证(台胞证)","color":"#87d068","value":"TWPermit"}, - 'Passport': {"text":"护照","color":"#108ee9","value":"Passport"}, - 'BusinessLicense': {"text":"营业执照","color":"#f5222d","value":"BusinessLicense"}, +export const HouseOccupantsCardTypeEnum = { + MainlandID: { + text: '中国大陆居民身份证', + color: '#2db7f5', + value: 'MainlandID', + }, + HKPermit: { + text: '香港来往大陆通行证(回乡证)', + color: '#fa8c16', + value: 'HKPermit', + }, + MOPermit: { + text: '澳门来往大陆通行证(回乡证)', + color: '#faad14', + value: 'MOPermit', + }, + TWPermit: { + text: '台湾来往大陆通行证(台胞证)', + color: '#87d068', + value: 'TWPermit', + }, + Passport: { text: '护照', color: '#108ee9', value: 'Passport' }, + BusinessLicense: { + text: '营业执照', + color: '#f5222d', + value: 'BusinessLicense', + }, }; // HouseOccupantsHouseRelationEnum -export const HouseOccupantsHouseRelationEnum= { - 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, - 'NonOwner': {"text":"非产权人","color":"#fa8c16","value":"NonOwner"}, +export const HouseOccupantsHouseRelationEnum = { + Owner: { text: '产权人', color: '#2db7f5', value: 'Owner' }, + NonOwner: { text: '非产权人', color: '#fa8c16', value: 'NonOwner' }, }; // HouseOccupantsRelationWithOwnerEnum -export const HouseOccupantsRelationWithOwnerEnum= { - 'Spouse': {"text":"配偶","color":"#2db7f5","value":"Spouse"}, - 'Children': {"text":"子女","color":"#87d068","value":"Children"}, - 'Parents': {"text":"父母","color":"#faad14","value":"Parents"}, - 'Siblings': {"text":"兄弟姐妹","color":"#fa8c16","value":"Siblings"}, - 'OtherRelatives': {"text":"其他亲属","color":"#f5222d","value":"OtherRelatives"}, +export const HouseOccupantsRelationWithOwnerEnum = { + Spouse: { text: '配偶', color: '#2db7f5', value: 'Spouse' }, + Children: { text: '子女', color: '#87d068', value: 'Children' }, + Parents: { text: '父母', color: '#faad14', value: 'Parents' }, + Siblings: { text: '兄弟姐妹', color: '#fa8c16', value: 'Siblings' }, + OtherRelatives: { + text: '其他亲属', + color: '#f5222d', + value: 'OtherRelatives', + }, }; // HouseOccupantsResidentialRelationEnum -export const HouseOccupantsResidentialRelationEnum= { - 'Resident': {"text":"住户","color":"#2db7f5","value":"Resident"}, - 'PrimaryTenant': {"text":"主租人","color":"#87d068","value":"PrimaryTenant"}, - 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, +export const HouseOccupantsResidentialRelationEnum = { + Resident: { text: '住户', color: '#2db7f5', value: 'Resident' }, + PrimaryTenant: { text: '主租人', color: '#87d068', value: 'PrimaryTenant' }, + Tenant: { text: '租客', color: '#fa8c16', value: 'Tenant' }, }; // HouseOccupantsStatusEnum -export const HouseOccupantsStatusEnum= { - 'Normal': {"text":"正常","color":"#52c41a","value":"Normal"}, - 'Unbound': {"text":"已解除","color":"#f5222d","value":"Unbound"}, +export const HouseOccupantsStatusEnum = { + Normal: { text: '正常', color: '#52c41a', value: 'Normal' }, + Unbound: { text: '已解除', color: '#f5222d', value: 'Unbound' }, }; // 订单状态枚举 -export const HouseOrdersOrderStatusEnum= { - 'Pending': {"text":"待支付","color":"#facc15","value":"Pending"}, - 'Paid': {"text":"已支付","color":"#10b981","value":"Paid"}, - 'Refunded': {"text":"已退款","color":"#60a5fa","value":"Refunded"}, - 'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"}, - 'Failed': {"text":"支付失败","color":"#ef4444","value":"Failed"}, +export const HouseOrdersOrderStatusEnum = { + Pending: { text: '待支付', color: '#facc15', value: 'Pending' }, + Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, + Refunded: { text: '已退款', color: '#60a5fa', value: 'Refunded' }, + Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, + Failed: { text: '支付失败', color: '#ef4444', value: 'Failed' }, }; // HouseOrdersPaymentMethodEnum -export const HouseOrdersPaymentMethodEnum= { - 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, - 'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"}, - 'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"}, - 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, +export const HouseOrdersPaymentMethodEnum = { + WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, + Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, + BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, + TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, }; // HouseRegistersCustomerTypeEnum -export const HouseRegistersCustomerTypeEnum= { - 'Individual': {"text":"个人客户","color":"#2db7f5","value":"Individual"}, - 'Enterprise': {"text":"普通企业","color":"#87d068","value":"Enterprise"}, - 'Developer': {"text":"开发企业","color":"#fa8c16","value":"Developer"}, - 'Government': {"text":"政府组织","color":"#f5222d","value":"Government"}, +export const HouseRegistersCustomerTypeEnum = { + Individual: { text: '个人客户', color: '#2db7f5', value: 'Individual' }, + Enterprise: { text: '普通企业', color: '#87d068', value: 'Enterprise' }, + Developer: { text: '开发企业', color: '#fa8c16', value: 'Developer' }, + Government: { text: '政府组织', color: '#f5222d', value: 'Government' }, }; // HouseRegistersHouseStatusEnum -export const HouseRegistersHouseStatusEnum= { - 'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"}, - 'Rented': {"text":"出租","color":"#007bff","value":"Rented"}, - 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, +export const HouseRegistersHouseStatusEnum = { + SelfOccupied: { text: '自住', color: '#28a745', value: 'SelfOccupied' }, + Rented: { text: '出租', color: '#007bff', value: 'Rented' }, + Vacant: { text: '空置', color: '#dc3545', value: 'Vacant' }, }; // 房屋登记身份类型 -export const HouseRegistersIdentityTypeEnum= { - 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, - 'Tenant': {"text":"租客","color":"#87d068","value":"Tenant"}, - 'CoResident': {"text":"同住人(亲属)","color":"#108ee9","value":"CoResident"}, +export const HouseRegistersIdentityTypeEnum = { + Owner: { text: '产权人', color: '#2db7f5', value: 'Owner' }, + Tenant: { text: '租客', color: '#87d068', value: 'Tenant' }, + CoResident: { text: '同住人(亲属)', color: '#108ee9', value: 'CoResident' }, }; // HouseRegistersStatusEnum -export const HouseRegistersStatusEnum= { - 'Pending': {"text":"待审","color":"#faad14","value":"Pending"}, - 'Approved': {"text":"已审","color":"#52c41a","value":"Approved"}, - 'Rejected': {"text":"驳回","color":"#f5222d","value":"Rejected"}, +export const HouseRegistersStatusEnum = { + Pending: { text: '待审', color: '#faad14', value: 'Pending' }, + Approved: { text: '通过', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '驳回', color: '#f5222d', value: 'Rejected' }, }; // HouseRegistersTypeEnum -export const HouseRegistersTypeEnum= { - 'AddOwner': {"text":"添加产权人","color":"#52c41a","value":"AddOwner"}, - 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, - 'AddOccupant': {"text":"添加住户","color":"#108ee9","value":"AddOccupant"}, - 'RemoveOccupant': {"text":"移除住户","color":"#fa8c16","value":"RemoveOccupant"}, - 'MoveOut': {"text":"搬离登记","color":"#f50","value":"MoveOut"}, - 'MoveIn': {"text":"搬入登记","color":"#ffc53d","value":"MoveIn"}, +export const HouseRegistersTypeEnum = { + AddOwner: { text: '添加产权人', color: '#52c41a', value: 'AddOwner' }, + RemoveOwner: { text: '减少产权人', color: '#d9363e', value: 'RemoveOwner' }, + AddOccupant: { text: '添加住户', color: '#108ee9', value: 'AddOccupant' }, + RemoveOccupant: { + text: '移除住户', + color: '#fa8c16', + value: 'RemoveOccupant', + }, + MoveOut: { text: '搬离登记', color: '#f50', value: 'MoveOut' }, + MoveIn: { text: '搬入登记', color: '#ffc53d', value: 'MoveIn' }, }; // HouseRegistersUsagePlanEnum -export const HouseRegistersUsagePlanEnum= { - 'Permanent': {"text":"常住","color":"#52c41a","value":"Permanent"}, - 'Vacation': {"text":"度假","color":"#faad14","value":"Vacation"}, - 'Rental': {"text":"出租","color":"#2db7f5","value":"Rental"}, - 'Commercial': {"text":"商用","color":"#f5222d","value":"Commercial"}, +export const HouseRegistersUsagePlanEnum = { + Permanent: { text: '常住', color: '#52c41a', value: 'Permanent' }, + Vacation: { text: '度假', color: '#faad14', value: 'Vacation' }, + Rental: { text: '出租', color: '#2db7f5', value: 'Rental' }, + Commercial: { text: '商用', color: '#f5222d', value: 'Commercial' }, }; // HouseWorkOrdersAssignStatusEnum -export const HouseWorkOrdersAssignStatusEnum= { - 'Unassigned': {"text":"未指派","color":"#ff0000","value":"Unassigned"}, - 'Assigned': {"text":"已指派","color":"#00ff00","value":"Assigned"}, +export const HouseWorkOrdersAssignStatusEnum = { + Unassigned: { text: '未指派', color: '#ff0000', value: 'Unassigned' }, + Assigned: { text: '已指派', color: '#00ff00', value: 'Assigned' }, }; // HouseWorkOrdersLevelEnum -export const HouseWorkOrdersLevelEnum= { - 'Urgent': {"text":"紧急","color":"#ff0000","value":"Urgent"}, - 'High': {"text":"高","color":"#ff7f00","value":"High"}, - 'Medium': {"text":"中","color":"#00cc00","value":"Medium"}, - 'Low': {"text":"低","color":"#999999","value":"Low"}, +export const HouseWorkOrdersLevelEnum = { + Urgent: { text: '紧急', color: '#ff0000', value: 'Urgent' }, + High: { text: '高', color: '#ff7f00', value: 'High' }, + Medium: { text: '中', color: '#00cc00', value: 'Medium' }, + Low: { text: '低', color: '#999999', value: 'Low' }, }; // HouseWorkOrdersStatusEnum -export const HouseWorkOrdersStatusEnum= { - 'Pending': {"text":"待处理","color":"#FFA500","value":"Pending"}, - 'Processing': {"text":"处理中","color":"#1E90FF","value":"Processing"}, - 'Completed': {"text":"已完成","color":"#28A745","value":"Completed"}, - 'Closed': {"text":"已关闭","color":"#6C757D","value":"Closed"}, +export const HouseWorkOrdersStatusEnum = { + Pending: { text: '待处理', color: '#FFA500', value: 'Pending' }, + Processing: { text: '处理中', color: '#1E90FF', value: 'Processing' }, + Completed: { text: '已完成', color: '#28A745', value: 'Completed' }, + Closed: { text: '已关闭', color: '#6C757D', value: 'Closed' }, }; // HouseWorkOrdersTypeEnum -export const HouseWorkOrdersTypeEnum= { - 'Maintenance': {"text":"维修","color":"#ff0000","value":"Maintenance"}, - 'Installation': {"text":"安装","color":"#00aaff","value":"Installation"}, - 'Consultation': {"text":"咨询","color":"#ffaa00","value":"Consultation"}, - 'Complaint': {"text":"投诉","color":"#aa00ff","value":"Complaint"}, - 'Other': {"text":"其它","color":"#00aa55","value":"Other"}, +export const HouseWorkOrdersTypeEnum = { + Maintenance: { text: '维修', color: '#ff0000', value: 'Maintenance' }, + Installation: { text: '安装', color: '#00aaff', value: 'Installation' }, + Consultation: { text: '咨询', color: '#ffaa00', value: 'Consultation' }, + Complaint: { text: '投诉', color: '#aa00ff', value: 'Complaint' }, + Other: { text: '其它', color: '#00aa55', value: 'Other' }, }; // OrganizationsTypeEnum -export const OrganizationsTypeEnum= { - 'Group': {"text":"集团","color":"#007bff","value":"Group"}, - 'Company': {"text":"公司","color":"#28a745","value":"Company"}, - 'ManagementOffice': {"text":"管理处","color":"#ffc107","value":"ManagementOffice"}, - 'Department': {"text":"部门","color":"#dc3545","value":"Department"}, +export const OrganizationsTypeEnum = { + Group: { text: '集团', color: '#007bff', value: 'Group' }, + Company: { text: '公司', color: '#28a745', value: 'Company' }, + ManagementOffice: { + text: '管理处', + color: '#ffc107', + value: 'ManagementOffice', + }, + Department: { text: '部门', color: '#dc3545', value: 'Department' }, }; // 性别 -export const SexEnum= { - 'Male': {"text":"男","color":"#0000ff","value":"Male"}, - 'FeMale': {"text":"女","color":"#ff0000","value":"FeMale"}, +export const SexEnum = { + Male: { text: '男', color: '#0000ff', value: 'Male' }, + FeMale: { text: '女', color: '#ff0000', value: 'FeMale' }, }; // SysModuleEnum -export const SysModuleEnum= { - 'Admin': {"text":"管理员","color":"#cf1322","value":"Admin"}, - 'Customer': {"text":"客户","color":"#d4b106","value":"Customer"}, +export const SysModuleEnum = { + Admin: { text: '管理员', color: '#cf1322', value: 'Admin' }, + Customer: { text: '客户', color: '#d4b106', value: 'Customer' }, }; // SysPermissionsTypeEnum -export const SysPermissionsTypeEnum= { - 'Directory': {"text":"目录","color":"#6d7e14","value":"Directory"}, - 'Page': {"text":"页面","color":"#4d9a13","value":"Page"}, - 'Button': {"text":"按钮","color":"#97224f","value":"Button"}, +export const SysPermissionsTypeEnum = { + Directory: { text: '目录', color: '#6d7e14', value: 'Directory' }, + Page: { text: '页面', color: '#4d9a13', value: 'Page' }, + Button: { text: '按钮', color: '#97224f', value: 'Button' }, }; // WechatAuthsPlatformEnum -export const WechatAuthsPlatformEnum= { - 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, - 'MpOfficial': {"text":"微信公众号","color":"#22c55e","value":"MpOfficial"}, - 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, +export const WechatAuthsPlatformEnum = { + MiniProgram: { text: '微信小程序', color: '#3b82f6', value: 'MiniProgram' }, + MpOfficial: { text: '微信公众号', color: '#22c55e', value: 'MpOfficial' }, + WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, }; - diff --git a/src/pages/archive/components/modals/RegistersShow.tsx b/src/pages/archive/components/modals/RegistersShow.tsx index 27aaedc..a3cf902 100644 --- a/src/pages/archive/components/modals/RegistersShow.tsx +++ b/src/pages/archive/components/modals/RegistersShow.tsx @@ -8,7 +8,7 @@ import { MyModal } from '@/components/MyModal'; import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, - HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsResidentialRelationEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -63,9 +63,9 @@ export default function RegistersShow(props: MyBetaModalFormProps) { valueEnum: HouseOccupantsHouseRelationEnum, }), MyColumns.EnumTag({ - title: '关系说明', - dataIndex: 'relation_with_owner', - valueEnum: HouseOccupantsRelationWithOwnerEnum, + title: '居住关系', + dataIndex: 'residential_relation', + valueEnum: HouseOccupantsResidentialRelationEnum, }), { title: '姓名', diff --git a/src/pages/archive/index.tsx b/src/pages/archive/index.tsx index aa4734a..5d98c75 100644 --- a/src/pages/archive/index.tsx +++ b/src/pages/archive/index.tsx @@ -8,7 +8,6 @@ import { import { Apis } from '@/gen/Apis'; import { AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; @@ -32,17 +31,26 @@ export default function Index({ title = '房屋档案' }) { } columns={[ MyColumns.ID(), + { + title: '项目名称', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, { title: '房屋名称', dataIndex: 'full_name', ellipsis: true, }, - MyColumns.EnumTag({ - title: '房屋状态', - dataIndex: 'status', - valueEnum: AssetHousesStatusEnum, - search: false, - }), + // MyColumns.EnumTag({ + // title: '房屋状态', + // dataIndex: 'status', + // valueEnum: AssetHousesStatusEnum, + // search: false, + // }), MyColumns.EnumTag({ title: '产权性质', @@ -71,7 +79,7 @@ export default function Index({ title = '房屋档案' }) { search: false, }, { - title: '产权人/住户', + title: '客户信息', render(_, record) { const owners = record?.house_occupants?.filter( diff --git a/src/pages/asset/$id.tsx b/src/pages/asset/$id.tsx index 91bbae5..939d715 100644 --- a/src/pages/asset/$id.tsx +++ b/src/pages/asset/$id.tsx @@ -81,7 +81,9 @@ export default function Show({ title }: { title?: string } = {}) { return ( - - - - -
- {props?.item?.name} - {props?.item?.alias_name - ? `(${props?.item?.alias_name})` - : ''} -
- -
-
- - -
{props?.item?.company?.name}
- -
-
- - - {props?.item?.province || ''} - {props?.item?.city || ''} - {props?.item?.district || ''} - {props?.item?.address || ''} - - - - - - - - - - - - - - - - {props?.item?.takeover_date} - - - {props?.item?.closure_date} - - - {/* - {props?.item?.created_at} - */} - - {props?.item?.updated_at} - -
-
-
- ); -} diff --git a/src/pages/asset/components/ChargeStandard.tsx b/src/pages/asset/components/ChargeStandard.tsx index f6b7031..2ec8416 100644 --- a/src/pages/asset/components/ChargeStandard.tsx +++ b/src/pages/asset/components/ChargeStandard.tsx @@ -15,6 +15,7 @@ import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import ChargeStandardCreate from './modals/ChargeStandardCreate'; import ChargeStandardHasHouse from './modals/ChargeStandardHasHouse'; +import ChargeStandardUpdate from './modals/ChargeStandardUpdate'; export default function ReceiptAccounts(props: MyBetaModalFormProps) { return ( @@ -47,7 +48,7 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { dataIndex: 'id', }, { - title: 'name', + title: '收费标准名称', dataIndex: 'name', search: false, }, @@ -99,10 +100,16 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { MyColumns.Option({ render: (_, item: any, index, action) => ( + } form={form} key={new Date().getTime()} @@ -90,6 +90,25 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: HouseBillsTypeEnum, required: true, }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + // Selects?.AssetProjects({ // key: 'asset_projects_id', // title: '项目', @@ -106,7 +125,7 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '计量单位', - colProps: { span: 24 }, + colProps: { span: 16 }, valueEnum: () => { let obj: any = JSON.parse( JSON.stringify( @@ -128,7 +147,7 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '计量单位', - colProps: { span: 24 }, + colProps: { span: 16 }, valueEnum: () => { let obj: any = JSON.parse( JSON.stringify( @@ -164,7 +183,9 @@ export default function Create(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.number }, }, ] - : !calculation_method + : !calculation_method && + calculation_method !== + HouseChargeStandardsCalculationMethodEnum.PerUnit.value ? [] : [ MyFormItems.EnumRadio({ @@ -204,13 +225,6 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 14 }, valueEnum: HouseChargeStandardsPriceAlgorithmEnum, required: true, - // valueEnum: () => { - // let obj: any = JSON.parse( - // JSON.stringify(HouseChargeStandardsPriceAlgorithmEnum), - // ); - // delete obj.Fixed; - // return obj; - // }, // fieldProps: { // onChange: () => { // // 切换计费算法时清空阶梯配置 @@ -267,8 +281,12 @@ export default function Create(props: MyBetaModalFormProps) { valueType: 'number', fieldProps: { min: 0, - // addonBefore: `第${index + 1}阶梯`, - addonBefore: `第1阶梯`, + addonBefore: ( + _: any, + { + field, + }: { field: { index: number[] } }, + ) => `第${field.index[1] + 1}阶梯`, }, width: '100%', formItemProps: { ...rulesHelper.number }, @@ -330,8 +348,12 @@ export default function Create(props: MyBetaModalFormProps) { valueType: 'number', fieldProps: { min: 0, - // addonBefore: `第${index + 1}阶梯`, - addonBefore: `第1阶梯`, + addonBefore: ( + _: any, + { + field, + }: { field: { name: number[] } }, + ) => `第${field.name[1] + 1}阶梯`, }, width: '100%', formItemProps: { ...rulesHelper.number }, @@ -369,54 +391,49 @@ export default function Create(props: MyBetaModalFormProps) { }, }, { - name: ['charge_type'], + name: ['price', 'price_algorithm'], valueType: 'dependency', - columns: ({ charge_type }: any) => { - return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || - charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + columns: ({ price, price_algorithm }: any) => { + return price || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value ? [ - MyFormItems.EnumRadio({ - key: 'calculation_method', - title: '分摊方式', - colProps: { span: 18 }, - valueEnum: HouseChargeStandardsApportionmentMethodEnum, - required: true, - }), + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ], + }, ] : []; }, }, - - { - valueType: 'group', - columns: [ - MyFormItems.EnumRadio({ - key: 'calculation_period', - title: '账单计费周期', - colProps: { span: 14 }, - valueEnum: HouseChargeStandardsCalculationPeriodEnum, - required: true, - }), - { - key: 'auto_date', - title: '账单自动生成日期', - colProps: { span: 10 }, - valueType: 'date', - width: '100%', - }, - ], - }, - { - key: 'remark', - title: '备注', - colProps: { span: 24 }, - valueType: 'textarea', - fieldProps: { - rows: 4, - maxLength: 500, - showCount: true, - }, - }, ]} /> ); diff --git a/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx b/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx index fb639bb..fbd06f7 100644 --- a/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx +++ b/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx @@ -1,6 +1,11 @@ -import { MyBetaModalFormProps, MyButtons } from '@/common'; +import { MyBetaModalFormProps, MyButtons, renderTextHelper } from '@/common'; import { MyModal } from '@/components/MyModal'; import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; import { ProCard } from '@ant-design/pro-components'; import { Alert, @@ -174,7 +179,7 @@ export default function ChargeStandardHasHouse( }; // 处理节点选中 - const onCheck = ( + const onCheck = async ( checkedKeysValue: | React.Key[] | { checked: React.Key[]; halfChecked: React.Key[] }, @@ -188,9 +193,39 @@ export default function ChargeStandardHasHouse( const prevKeys = new Set(checkedKeys); const newKeys = new Set(keys); + // 找出新选中的节点 + const newlyCheckedKeys = [...newKeys].filter((key) => !prevKeys.has(key)); + // 找出新取消选中的节点 const uncheckedKeys = [...prevKeys].filter((key) => !newKeys.has(key)); + // 处理新选中的节点 + for (const key of newlyCheckedKeys) { + const keyStr = key.toString(); + + // 如果选中的是楼栋 + if (keyStr.startsWith('building-')) { + const buildingNode = treeData.find((node) => node.key === key); + if (buildingNode) { + // 调用接口获取该楼栋下所有房屋 + await loadBuildingHouses(buildingNode.id); + } + } + + // 如果选中的是单元 + else if (keyStr.startsWith('unit-')) { + // 查找该单元所属的楼栋和单元ID + for (const building of treeData) { + const unitNode = building.children?.find((unit) => unit.key === key); + if (unitNode) { + // 调用接口获取该单元下所有房屋 + await loadUnitHouses(building.id, unitNode.id); + break; + } + } + } + } + // 如果有节点被取消选中,同步取消其所有子节点 if (uncheckedKeys.length > 0) { const keysToRemove = new Set(); @@ -218,23 +253,72 @@ export default function ChargeStandardHasHouse( // 从选中keys中移除所有需要取消的节点 const finalKeys = keys.filter((key) => !keysToRemove.has(key)); setCheckedKeys(finalKeys); + + // 更新selectedHouses,移除被取消选中的房屋 + const houseKeysToRemove = new Set(); + keysToRemove.forEach((key) => { + if (key.toString().startsWith('house-')) { + houseKeysToRemove.add(key.toString().replace('house-', '')); + } + }); + + const updatedHouses = selectedHouses.filter( + (house) => !houseKeysToRemove.has(house.id.toString()), + ); + + setSelectedHouses(updatedHouses); } else { setCheckedKeys(keys); } // 收集所有选中的房屋 - const selectedHousesList: { id: number; name: string }[] = []; + const selectedHousesList: { + id: number; + name: string; + buildingName?: string; + unitName?: string; + }[] = [...selectedHouses]; // 遍历树形数据,收集选中节点下的所有房屋 const collectHouses = (nodes: TreeNodeType[], checkedKeys: React.Key[]) => { nodes.forEach((node) => { if (checkedKeys.includes(node.key)) { if (node.isLeaf) { - // 如果是房屋节点,直接添加 - selectedHousesList.push({ - id: node.id, - name: node.title as string, - }); + // 如果是房屋节点,检查是否已经存在 + const houseId = node.id; + const exists = selectedHousesList.some( + (house) => house.id === houseId, + ); + + if (!exists) { + // 查找楼栋和单元信息 + let buildingName = ''; + let unitName = ''; + + // 查找楼栋和单元 + for (const building of treeData) { + if (building.id === node.asset_buildings_id) { + buildingName = building.title as string; + + // 查找单元 + const unit = building.children?.find( + (u) => u.id === node.asset_units_id, + ); + if (unit) { + unitName = unit.title as string; + } + break; + } + } + + // 添加到选中列表 + selectedHousesList.push({ + id: houseId, + name: `${buildingName} ${unitName} ${node.title}(${houseId})`, + buildingName, + unitName, + }); + } } else { // 如果是楼栋或单元节点,递归收集其下的所有房屋 if (node.children) { @@ -276,57 +360,33 @@ export default function ChargeStandardHasHouse( // 加载楼栋下的单元 if (node.key.toString().startsWith('building-')) { - const buildingId = node.id; + console.log('node.key', node.key); + // 从key中提取buildingId,格式为'building-{id}' + const buildingId = parseInt( + node.key.toString().replace('building-', ''), + 10, + ); await loadUnits(buildingId, node.key as string); // 如果楼栋被选中,加载并选中其下所有单元和房屋 if (checkedKeys.includes(node.key)) { - const newTreeData = [...treeData]; - const buildingNode = newTreeData.find((n) => n.key === node.key); - if (buildingNode?.children) { - // 加载每个单元下的房屋 - for (const unit of buildingNode.children) { - await loadHouses(buildingId, unit.id, unit.key as string); - } - // 更新树形数据 - setTreeData(newTreeData); - // 收集所有房屋的key - const allKeys: React.Key[] = []; - const collectKeys = (nodes: TreeNodeType[]) => { - nodes.forEach((node) => { - allKeys.push(node.key); - if (node.children) { - collectKeys(node.children); - } - }); - }; - collectKeys([buildingNode]); - // 更新选中状态 - setCheckedKeys(Array.from(new Set([...checkedKeys, ...allKeys]))); - } + // 直接调用loadBuildingHouses加载该楼栋下所有房屋 + await loadBuildingHouses(buildingId); } return Promise.resolve(); } // 加载单元下的房屋 if (node.key.toString().startsWith('unit-')) { - const unitId = node.id; + // 从key中提取unitId,格式为'unit-{id}' + const unitId = parseInt(node.key.toString().replace('unit-', ''), 10); const buildingId = node.asset_buildings_id as number; await loadHouses(buildingId, unitId, node.key as string); // 如果单元被选中,选中其下所有房屋 if (checkedKeys.includes(node.key)) { - const newTreeData = [...treeData]; - const buildingNode = newTreeData.find((n) => - n.children?.some((unit) => unit.key === node.key), - ); - const unitNode = buildingNode?.children?.find( - (n) => n.key === node.key, - ); - if (unitNode?.children) { - const houseKeys = unitNode.children.map((house) => house.key); - setCheckedKeys(Array.from(new Set([...checkedKeys, ...houseKeys]))); - } + // 直接调用loadUnitHouses加载该单元下所有房屋 + await loadUnitHouses(buildingId, unitId); } return Promise.resolve(); } @@ -334,31 +394,186 @@ export default function ChargeStandardHasHouse( return Promise.resolve(); }; + // 加载所有房屋数据 + const loadAllHouses = async () => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + }); + + if (res?.data) { + const allHouseKeys: React.Key[] = []; + const allHouses: { + id: number; + name: string; + buildingName: string; + unitName: string; + }[] = []; + + // 创建映射以快速查找楼栋和单元名称 + const buildingMap = new Map(); + const unitMap = new Map(); + + // 填充楼栋映射 + treeData.forEach((building) => { + buildingMap.set(building.id, building.title); + building.children?.forEach((unit) => { + unitMap.set(unit.id, unit.title); + }); + }); + + res.data.forEach((house: any) => { + const houseKey = `house-${house.id}`; + allHouseKeys.push(houseKey); + + const buildingName = buildingMap.get(house.asset_buildings_id) || ''; + const unitName = unitMap.get(house.asset_units_id) || ''; + + allHouses.push({ + id: house.id, + name: `${buildingName} ${unitName} ${house.name}(${house.id})`, + buildingName: buildingName as string, + unitName: unitName as string, + }); + }); + + setCheckedKeys(allHouseKeys); + setSelectedHouses(allHouses); + } + } catch (error) { + console.error('加载所有房屋失败:', error); + message.error('加载所有房屋失败'); + } finally { + setLoading(false); + } + }; + + // 加载楼栋下所有房屋 + const loadBuildingHouses = async (buildingId: number) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + }); + + if (res?.data) { + const buildingHouseKeys: React.Key[] = []; + const buildingHouses: { + id: number; + name: string; + buildingName: string; + unitName: string; + }[] = []; + + // 获取楼栋名称 + const building = treeData.find((b) => b.id === buildingId); + const buildingName = building?.title || ''; + + // 创建单元映射 + const unitMap = new Map(); + building?.children?.forEach((unit) => { + unitMap.set(unit.id, unit.title); + }); + + res.data.forEach((house: any) => { + const houseKey = `house-${house.id}`; + buildingHouseKeys.push(houseKey); + + const unitName = unitMap.get(house.asset_units_id) || ''; + + buildingHouses.push({ + id: house.id, + name: `${buildingName} ${unitName} ${house.name}(${house.id})`, + buildingName: buildingName as string, + unitName: unitName as string, + }); + }); + + // 合并当前选中的keys和新的keys + const newCheckedKeys = Array.from( + new Set([...checkedKeys, ...buildingHouseKeys]), + ); + setCheckedKeys(newCheckedKeys); + + // 合并当前选中的房屋和新的房屋 + const existingIds = new Set(selectedHouses.map((h) => h.id)); + const newHouses = buildingHouses.filter((h) => !existingIds.has(h.id)); + setSelectedHouses([...selectedHouses, ...newHouses]); + } + } catch (error) { + console.error('加载楼栋房屋失败:', error); + message.error('加载楼栋房屋失败'); + } finally { + setLoading(false); + } + }; + + // 加载单元下所有房屋 + const loadUnitHouses = async (buildingId: number, unitId: number) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + asset_units_id: unitId, + }); + + if (res?.data) { + const unitHouseKeys: React.Key[] = []; + const unitHouses: { + id: number; + name: string; + buildingName: string; + unitName: string; + }[] = []; + + // 获取楼栋和单元名称 + const building = treeData.find((b) => b.id === buildingId); + const buildingName = building?.title || ''; + + const unit = building?.children?.find((u) => u.id === unitId); + const unitName = unit?.title || ''; + + res.data.forEach((house: any) => { + const houseKey = `house-${house.id}`; + unitHouseKeys.push(houseKey); + + unitHouses.push({ + id: house.id, + name: `${buildingName} ${unitName} ${house.name}(${house.id})`, + buildingName: buildingName as string, + unitName: unitName as string, + }); + }); + + // 合并当前选中的keys和新的keys + const newCheckedKeys = Array.from( + new Set([...checkedKeys, ...unitHouseKeys]), + ); + setCheckedKeys(newCheckedKeys); + + // 合并当前选中的房屋和新的房屋 + const existingIds = new Set(selectedHouses.map((h) => h.id)); + const newHouses = unitHouses.filter((h) => !existingIds.has(h.id)); + setSelectedHouses([...selectedHouses, ...newHouses]); + } + } catch (error) { + console.error('加载单元房屋失败:', error); + message.error('加载单元房屋失败'); + } finally { + setLoading(false); + } + }; + // 处理全选 - const handleSelectAll = (e: CheckboxChangeEvent) => { + const handleSelectAll = async (e: CheckboxChangeEvent) => { setSelectAll(e.target.checked); if (e.target.checked) { - // 收集所有房屋节点的key - const allHouseKeys: React.Key[] = []; - const allHouses: { id: number; name: string }[] = []; - - treeData.forEach((building) => { - building.children?.forEach((unit) => { - unit.children?.forEach((house) => { - if (house.isLeaf) { - allHouseKeys.push(house.key); - allHouses.push({ - id: house.id, - name: house.title as string, - }); - } - }); - }); - }); - - setCheckedKeys(allHouseKeys); - setSelectedHouses(allHouses); + // 调用接口获取所有房屋 + await loadAllHouses(); } else { // 取消全选 setCheckedKeys([]); @@ -402,19 +617,43 @@ export default function ChargeStandardHasHouse( trigger={ } node={ +
+ + <div> + <div>收费标准名称:{props?.item?.name || '标准名称'}</div> + <Space> + <renderTextHelper.Tag + Enums={HouseBillsTypeEnum} + value={props?.item?.charge_type} + key="type" + /> + <renderTextHelper.Tag + Enums={HouseChargeStandardsCalculationModeEnum} + value={props?.item?.calculation_mode} + key="type" + /> + <renderTextHelper.Tag + Enums={HouseChargeStandardsCalculationPeriodEnum} + value={props?.item?.calculation_period} + key="type" + /> + </Space> + </div> + + +
} >
diff --git a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx new file mode 100644 index 0000000..902b672 --- /dev/null +++ b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx @@ -0,0 +1,435 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={props.title} + wrapperCol={{ span: 24 }} + width="600px" + trigger={ + + } + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue(props?.item); // 编辑赋值 + } + }} + onFinish={async (values) => + Apis.HouseCharage.HouseChargeStandards.Update({ + ...values, + asset_projects_id: props?.item?.asset_projects_id, + + type: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? HouseChargeStandardsTypeEnum.House.value + : HouseChargeStandardsTypeEnum.Meter.value, + is_apportionment: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? 1 + : 0, + // 按套 + calculation_mode: + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsCalculationModeEnum.FixedAmount.value + : values?.calculation_mode, + // 按固定金额 + price_algorithm: + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value || + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + : values?.price_algorithm, + id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success('收费标准编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '收费标准名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'charge_type', + title: '收费项目', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, + }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.PropertyFee.value || + charge_type === HouseBillsTypeEnum.MaintenanceFund.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ElectricityUsage; + delete obj.WaterUsage; + return obj; + }, + required: true, + }), + ] + : charge_type === HouseBillsTypeEnum.WaterFee.value || + charge_type === HouseBillsTypeEnum.ElectricityFee.value || + charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ChargeableArea; + delete obj.BuiltArea; + delete obj.InsideArea; + delete obj.PerUnit; + return obj; + }, + required: true, + }), + ] + : []; + }, + }, + { + name: ['calculation_method'], + valueType: 'dependency', + columns: ({ calculation_method }: any) => { + return calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : !calculation_method && + calculation_method !== + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + ]; + }, + }, + + { + name: ['calculation_mode'], + valueType: 'dependency', + columns: ({ calculation_mode }: any) => { + return calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : calculation_mode === + HouseChargeStandardsCalculationModeEnum.QuantityPrice.value + ? [ + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + // fieldProps: { + // onChange: () => { + // // 切换计费算法时清空阶梯配置 + // form.setFieldValue('scheme', undefined); + // }, + // }, + }), + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { index: number[] } }, + ) => `第${field.index[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { name: number[] } }, + ) => `第${field.name[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ] + : []; + }, + }, + { + name: ['price', 'price_algorithm'], + valueType: 'dependency', + columns: ({ price, price_algorithm }: any) => { + return price || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/asset/index.tsx b/src/pages/asset/index.tsx index 0087d13..de28134 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -109,7 +109,7 @@ export default function Index({ title = '项目列表' }) { { navigate(`/asset/${item.id}`); }} diff --git a/src/pages/asset/modals/AssetCreate.tsx b/src/pages/asset/modals/AssetCreate.tsx index f510b83..f65644a 100644 --- a/src/pages/asset/modals/AssetCreate.tsx +++ b/src/pages/asset/modals/AssetCreate.tsx @@ -38,7 +38,11 @@ export default function Create(props: MyBetaModalFormProps) { } }} onFinish={async (values) => - Apis.Asset.AssetProjects.Store(values) + Apis.Asset.AssetProjects.Store({ + ...values, + longitude: values?.location ? values.location.split(',')[0] : '', + latitude: values?.location ? values.location.split(',')[1] : '', + }) .then(() => { props.reload?.(); message.success(props.title + '成功'); @@ -128,6 +132,23 @@ export default function Create(props: MyBetaModalFormProps) { }, colProps: { span: 8 }, }, + { + title: '项目经纬度', + dataIndex: 'location', + colProps: { span: 24 }, + fieldProps: { + addonAfter: ( + { + window.open( + 'https://api.map.baidu.com/lbsapi/getpoint/index.html', + ); + }} + /> + ), + }, + }, ]} /> ); diff --git a/src/pages/asset/modals/AssetUpdate.tsx b/src/pages/asset/modals/AssetUpdate.tsx index 3f7faba..002ab97 100644 --- a/src/pages/asset/modals/AssetUpdate.tsx +++ b/src/pages/asset/modals/AssetUpdate.tsx @@ -28,9 +28,13 @@ export default function Update(props: MyBetaModalFormProps) { width="600px" key={new Date().getTime()} form={form} - onOpenChange={(open: any) => { + onOpenChange={(open: any, props: any) => { if (open && props.item) { form.setFieldsValue(props.item); + form.setFieldValue( + 'location', + `${props.item?.longitude},${props.item?.latitude}`, + ); } }} request={() => @@ -45,7 +49,12 @@ export default function Update(props: MyBetaModalFormProps) { }) } onFinish={async (values) => - Apis.Asset.AssetProjects.Update({ ...values, id: props.item?.id ?? 0 }) + Apis.Asset.AssetProjects.Update({ + ...values, + id: props.item?.id ?? 0, + longitude: values?.location ? values.location.split(',')[0] : '', + latitude: values?.location ? values.location.split(',')[1] : '', + }) .then(() => { props.reload?.(); message.success(props.title + '成功'); @@ -135,6 +144,23 @@ export default function Update(props: MyBetaModalFormProps) { }, colProps: { span: 8 }, }, + { + title: '项目经纬度', + dataIndex: 'location', + colProps: { span: 24 }, + fieldProps: { + addonAfter: ( + { + window.open( + 'https://api.map.baidu.com/lbsapi/getpoint/index.html', + ); + }} + /> + ), + }, + }, ]} /> ); diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index 49e33e7..7153260 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -32,6 +32,15 @@ export default function Index({ title = '房屋列表' }) { } columns={[ MyColumns.ID(), + { + title: '项目名称', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, { title: '房屋名称', dataIndex: 'full_name', diff --git a/src/pages/house_charge/$id.tsx b/src/pages/charge_standard/$id.tsx similarity index 72% rename from src/pages/house_charge/$id.tsx rename to src/pages/charge_standard/$id.tsx index 425ccca..ea63d30 100644 --- a/src/pages/house_charge/$id.tsx +++ b/src/pages/charge_standard/$id.tsx @@ -4,8 +4,8 @@ import { ProCard } from '@ant-design/pro-components'; import { useParams } from '@umijs/max'; import { Tabs } from 'antd'; import { useEffect, useState } from 'react'; -import BannerList from './components/BannerList'; -import BannerSpaceInfo from './components/BannerSpaceInfo'; +import ChargeInfo from './components/ChargeInfo'; +import HasHouse from './components/HasHouse'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -13,13 +13,13 @@ export default function Show({ title }: { title?: string } = {}) { // 注册当前页面为标签页 const { addTab } = usePageTabs({ - tabKey: `banner-space-${id}`, - tabLabel: data?.name || title || '广告位详情', + tabKey: `charge-standard-${id}`, + tabLabel: '收费标准详情', }); const loadShow = () => { let paramsId: any = { id: id ?? 0 }; - Apis.Banner.BannerSpaces.Show(paramsId).then((res) => { + Apis.HouseCharage.HouseChargeStandards.Show(paramsId).then((res) => { setShow(res?.data); }); }; @@ -34,8 +34,8 @@ export default function Show({ title }: { title?: string } = {}) { key: '1', closable: false, children: ( - loadShow()} /> ), @@ -43,7 +43,7 @@ export default function Show({ title }: { title?: string } = {}) { ]; return ( - + diff --git a/src/pages/charge_standard/components/ChargeInfo.tsx b/src/pages/charge_standard/components/ChargeInfo.tsx new file mode 100644 index 0000000..9e48fe4 --- /dev/null +++ b/src/pages/charge_standard/components/ChargeInfo.tsx @@ -0,0 +1,52 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + const { item } = props; + + return ( + + + + + {item?.name} + + + {item?.asset_project?.name} + + + + + + + + + + + + + {item?.remark} + + + + + ); +} diff --git a/src/pages/house_charge/components/BannerList.tsx b/src/pages/charge_standard/components/HasHouse.tsx similarity index 55% rename from src/pages/house_charge/components/BannerList.tsx rename to src/pages/charge_standard/components/HasHouse.tsx index 8c7386f..234c1e5 100644 --- a/src/pages/house_charge/components/BannerList.tsx +++ b/src/pages/charge_standard/components/HasHouse.tsx @@ -1,9 +1,6 @@ -import { MyColumns, MyProTableProps } from '@/common'; +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; import { Apis } from '@/gen/Apis'; -import { BannersRedirectTypeEnum, BannersTypeEnum } from '@/gen/Enums'; import BannerCreate from '@/pages/banner/modals/BannerCreate'; -import BannerShow from '@/pages/banner/modals/BannerShow'; -import BannerUpdate from '@/pages/banner/modals/BannerUpdate'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useEffect, useRef } from 'react'; @@ -23,10 +20,10 @@ export default function Index({ ...rest }) { MyProTableProps.request( { ...params, - banner_spaces_id: rest.item?.banner_spaces_id, + house_charge_standards_id: rest.item?.id, }, sort, - Apis.Banner.Banners.List, + Apis.HouseCharage.HouseChargeHasHouses.List, ) } toolBarRender={(action) => [ @@ -44,38 +41,41 @@ export default function Index({ ...rest }) { columns={[ MyColumns.ID(), { - title: '广告名称', + title: '房屋名称', + dataIndex: 'full_name', + }, + { + title: '项目名称', + dataIndex: 'project_name', + }, + { + title: '楼栋名称', + dataIndex: 'building_name', + }, + { + title: '单元名称', + dataIndex: 'unit_name', + }, + { + title: '房号', dataIndex: 'name', }, - MyColumns.EnumTag({ - title: '类型', - dataIndex: 'type', - valueEnum: BannersTypeEnum, - search: false, - }), - MyColumns.EnumTag({ - title: '跳转类型', - dataIndex: 'redirect_type', - valueEnum: BannersRedirectTypeEnum, - search: false, - }), + { - title: '开始时间', - dataIndex: 'start_time', - valueType: 'dateTime', - search: false, - }, - { - title: '结束时间', - dataIndex: 'end_time', - valueType: 'dateTime', + title: '绑定时间', + dataIndex: 'updated_at', search: false, }, MyColumns.Option({ render: (_, item: any, index, action) => ( - - + + Apis.HouseCharage.HouseChargeHasHouses.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> ), }), diff --git a/src/pages/charge_standard/index.tsx b/src/pages/charge_standard/index.tsx new file mode 100644 index 0000000..0961704 --- /dev/null +++ b/src/pages/charge_standard/index.tsx @@ -0,0 +1,145 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import ChargeStandardHasHouse from '../asset/components/modals/ChargeStandardHasHouse'; +import ChargeStandardUpdate from '../asset/components/modals/ChargeStandardUpdate'; +import ChargeCreate from './modals/ChargeCreate'; + +export default function Index({ title = '收费标准' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'house-charge', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.HouseCharage.HouseChargeStandards.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: '收费标准名称', + dataIndex: 'name', + search: false, + }, + MyColumns.EnumTag({ + title: '收费项目', + dataIndex: 'charge_type', + valueEnum: HouseBillsTypeEnum, + }), + MyColumns.EnumTag({ + title: '计量单位', + dataIndex: 'calculation_method', + valueEnum: HouseChargeStandardsCalculationMethodEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '计费模式', + dataIndex: 'calculation_mode', + valueEnum: HouseChargeStandardsCalculationModeEnum, + search: false, + }), + { + title: '单价', + dataIndex: 'price', + search: false, + }, + MyColumns.EnumTag({ + title: '账单计费周期', + dataIndex: 'calculation_period', + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + search: false, + }), + { + title: '账单自动生成日期', + dataIndex: 'auto_date', + search: false, + }, + { + title: '是否分摊', + dataIndex: 'is_apportionment', + search: false, + render(_, record) { + return `${record?.is_apportionment ? '是' : '否'} `; + }, + }, + + // MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate(`/charge_standard/${item.id}`); + }} + /> + + + + Apis.HouseCharage.HouseChargeStandards.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/charge_standard/modals/ChargeCreate.tsx b/src/pages/charge_standard/modals/ChargeCreate.tsx new file mode 100644 index 0000000..5518869 --- /dev/null +++ b/src/pages/charge_standard/modals/ChargeCreate.tsx @@ -0,0 +1,447 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`创建收费标准`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => { + values?.grid_ranges?.forEach((res: { asset_projects_id: string }) => { + res.asset_projects_id = props?.item?.id; + }); + return Apis.HouseCharage.HouseChargeStandards.Store({ + ...values, + asset_projects_id: props?.item?.id, + type: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? HouseChargeStandardsTypeEnum.House.value + : HouseChargeStandardsTypeEnum.Meter.value, + is_apportionment: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? 1 + : 0, + // 按套 + calculation_mode: + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsCalculationModeEnum.FixedAmount.value + : values?.calculation_mode, + // 按固定金额 + price_algorithm: + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value || + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + : values?.price_algorithm, + }) + .then(() => { + props.reload?.(); + message.success('收费标准创建成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'name', + title: '收费标准名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'charge_type', + title: '收费项目', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, + }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + + // Selects?.AssetProjects({ + // key: 'asset_projects_id', + // title: '项目', + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.PropertyFee.value || + charge_type === HouseBillsTypeEnum.MaintenanceFund.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ElectricityUsage; + delete obj.WaterUsage; + return obj; + }, + required: true, + }), + ] + : charge_type === HouseBillsTypeEnum.WaterFee.value || + charge_type === HouseBillsTypeEnum.ElectricityFee.value || + charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ChargeableArea; + delete obj.BuiltArea; + delete obj.InsideArea; + delete obj.PerUnit; + return obj; + }, + required: true, + }), + ] + : []; + }, + }, + { + name: ['calculation_method'], + valueType: 'dependency', + columns: ({ calculation_method }: any) => { + return calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : !calculation_method && + calculation_method !== + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + ]; + }, + }, + + { + name: ['calculation_mode'], + valueType: 'dependency', + columns: ({ calculation_mode }: any) => { + return calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : calculation_mode === + HouseChargeStandardsCalculationModeEnum.QuantityPrice.value + ? [ + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + // fieldProps: { + // onChange: () => { + // // 切换计费算法时清空阶梯配置 + // form.setFieldValue('scheme', undefined); + // }, + // }, + }), + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { index: number[] } }, + ) => `第${field.index[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'formList', + dataIndex: 'scheme', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { name: number[] } }, + ) => `第${field.name[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ] + : []; + }, + }, + { + name: ['price', 'price_algorithm'], + valueType: 'dependency', + columns: ({ price, price_algorithm }: any) => { + return price || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/company/index.tsx b/src/pages/company/index.tsx index 2fcd988..882bc74 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/index.tsx @@ -48,7 +48,6 @@ export default function Index({ title = '机构列表' }) { title: '企业名称', dataIndex: 'name', }, - // MyColumns.EnumTag({ // title: '类型', // dataIndex: 'merchant_type', @@ -76,6 +75,7 @@ export default function Index({ title = '机构列表' }) { /> { navigate(`/company/${item.id}`); }} diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx index 003c514..a848186 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -12,7 +12,7 @@ import { import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, - HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsResidentialRelationEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -91,22 +91,21 @@ export default function Update(props: MyBetaModalFormProps) { rowKey={(record, index) => record?.id_card || index} size="small" columns={[ - // MyColumns.EnumTag({ - // title: '房客关系', - // dataIndex: 'house_relation', - // valueEnum: HouseOccupantsHouseRelationEnum, - // width: 100, - // }), MyColumns.EnumTag({ - title: - props?.item?.status === 'Rented' - ? '与主租人关系' - : '与产权人关系', - // title: '关系说明', - dataIndex: 'relation_with_owner', - valueEnum: HouseOccupantsRelationWithOwnerEnum, - search: false, + title: '居住关系', + dataIndex: 'residential_relation', + valueEnum: HouseOccupantsResidentialRelationEnum, }), + // MyColumns.EnumTag({ + // title: + // props?.item?.status === 'Rented' + // ? '与主租人关系' + // : '与产权人关系', + // // title: '关系说明', + // dataIndex: 'relation_with_owner', + // valueEnum: HouseOccupantsRelationWithOwnerEnum, + // search: false, + // }), { title: '姓名', dataIndex: 'name', diff --git a/src/pages/house_charge/components/BannerSpaceInfo.tsx b/src/pages/house_charge/components/BannerSpaceInfo.tsx deleted file mode 100644 index 2d9297e..0000000 --- a/src/pages/house_charge/components/BannerSpaceInfo.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { MyBetaModalFormProps, renderTextHelper } from '@/common'; -import { BannerSpacesTypeEnum } from '@/gen/Enums'; -import { ProCard, ProDescriptions } from '@ant-design/pro-components'; -import { Space } from 'antd'; - -export default function info(props: MyBetaModalFormProps) { - const { item } = props; - - return ( - - - - - {item?.name} - - - - - - - {item?.remark} - - - - - ); -} diff --git a/src/pages/house_charge/index.tsx b/src/pages/house_charge/index.tsx deleted file mode 100644 index a89faf4..0000000 --- a/src/pages/house_charge/index.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { - MyButtons, - MyColumns, - MyPageContainer, - MyProTableProps, - usePageTabs, -} from '@/common'; -import { Apis } from '@/gen/Apis'; -import { BannerSpacesTypeEnum } from '@/gen/Enums'; -import { ProTable } from '@ant-design/pro-components'; -import { useNavigate } from '@umijs/max'; -import { Space } from 'antd'; -import HouseChargeCreate from './modals/HouseChargeCreate'; -import HouseChargeUpdate from './modals/HouseChargeUpdate'; - -export default function Index({ title = '收费标准' }) { - const navigate = useNavigate(); - - // 注册当前页面为标签页 - usePageTabs({ - tabKey: 'house-charge', - tabLabel: title, - }); - - return ( - - - MyProTableProps.request( - params, - sort, - Apis.HouseCharage.HouseChargeStandards.List, - ) - } - toolBarRender={(action) => [ - , - ]} - columns={[ - MyColumns.ID(), - { - title: '广告位名称', - dataIndex: 'name', - }, - MyColumns.EnumTag({ - title: '类型', - dataIndex: 'type', - valueEnum: BannerSpacesTypeEnum, - search: false, - }), - { - title: '备注', - dataIndex: 'remark', - search: false, - ellipsis: true, - }, - MyColumns.CreatedAt(), - MyColumns.Option({ - render: (_, item: any, index, action) => ( - - { - navigate(`/house_charge/${item.id}`); - }} - /> - - - Apis.HouseCharage.HouseChargeStandards.Delete({ - id: item.id, - }).then(() => action?.reload()) - } - /> - - ), - }), - ]} - /> - - ); -} diff --git a/src/pages/house_charge/modals/HouseChargeCreate.tsx b/src/pages/house_charge/modals/HouseChargeCreate.tsx deleted file mode 100644 index 7689299..0000000 --- a/src/pages/house_charge/modals/HouseChargeCreate.tsx +++ /dev/null @@ -1,227 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { - HouseChargeStandardsApportionmentMethodEnum, - HouseChargeStandardsCalculationMethodEnum, - HouseChargeStandardsCalculationModeEnum, - HouseChargeStandardsCalculationPeriodEnum, - HouseChargeStandardsPriceAlgorithmEnum, - HouseChargeStandardsTypeEnum, -} from '@/gen/Enums'; -import { BetaSchemaForm } from '@ant-design/pro-components'; -import { Form, message } from 'antd'; -import { useRef } from 'react'; - -export default function Create(props: MyBetaModalFormProps) { - const actionRef = useRef(); - const [form] = Form.useForm(); - - return ( - - {...MyModalFormProps.props} - title={`添加收费标准`} - wrapperCol={{ span: 24 }} - width="600px" - trigger={} - key={new Date().getTime()} - form={form} - onFinish={async (values) => - Apis.HouseCharage.HouseChargeStandards.Store(values) - .then(() => { - props.reload?.(); - message.success('添加收费标准成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - key: 'name', - title: '收费标准名称', - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - }, - MyFormItems.EnumRadio({ - key: 'type', - title: '适用对象', - colProps: { span: 12 }, - valueEnum: HouseChargeStandardsTypeEnum, - required: true, - }), - Selects?.AssetProjects({ - key: 'asset_projects_id', - title: '项目', - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - }), - - MyFormItems.EnumRadio({ - key: 'calculation_mode', - title: '计费模式', - colProps: { span: 12 }, - valueEnum: HouseChargeStandardsCalculationModeEnum, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'calculation_method', - title: '计量单位', - colProps: { span: 24 }, - valueEnum: HouseChargeStandardsCalculationMethodEnum, - required: true, - }), - - MyFormItems.EnumRadio({ - key: 'price_algorithm', - title: '计费算法', - colProps: { span: 14 }, - valueEnum: HouseChargeStandardsPriceAlgorithmEnum, - required: true, - fieldProps: { - onChange: () => { - // 切换计费算法时清空阶梯配置 - form.setFieldValue('scheme', undefined); - }, - }, - }), - { - valueType: '', - }, - { - name: ['price_algorithm'], - valueType: 'dependency', - columns: ({ price_algorithm }: any) => { - return price_algorithm === - HouseChargeStandardsPriceAlgorithmEnum.Fixed.value - ? [ - { - key: 'price', - title: '固定单价', - colProps: { span: 10 }, - fieldProps: { - addonAfter: '元', - }, - }, - ] - : price_algorithm === - HouseChargeStandardsPriceAlgorithmEnum.Tiered.value - ? [ - { - valueType: 'formList', - dataIndex: 'scheme', - title: '阶梯标准', - formItemProps: { ...rulesHelper.array }, - initialValue: [ - { - start: 0, - end: null, - price: null, - }, - ], - fieldProps: { - actionRef: actionRef, - copyIconProps: false, - // deleteIconProps: false, - }, - columns: [ - { - valueType: 'group', - colProps: { span: 24 }, - columns: [ - { - key: 'start', - colProps: { span: 7 }, - title: '起始值', - valueType: 'number', - fieldProps: { min: 0 }, - width: '100%', - formItemProps: { ...rulesHelper.number }, - }, - { - key: 'end', - colProps: { span: 7 }, - title: '结束值', - valueType: 'number', - width: '100%', - formItemProps: { ...rulesHelper.number }, - fieldProps: { maxLength: 12 }, - }, - { - key: 'price', - colProps: { span: 8 }, - title: '阶梯单价', - valueType: 'number', - fieldProps: { - addonAfter: '元', - min: 0, - }, - formItemProps: { ...rulesHelper.number }, - }, - ], - }, - ], - }, - ] - : price_algorithm === - HouseChargeStandardsPriceAlgorithmEnum.Peak.value - ? [] - : []; - }, - }, - { - valueType: 'group', - columns: [ - { - title: '是否分摊', - dataIndex: 'is_apportionment', - colProps: { span: 6 }, - valueType: 'switch', - formItemProps: { ...rulesHelper.text }, - }, - { - name: ['is_apportionment'], - valueType: 'dependency', - columns: ({ is_apportionment }: any) => { - return is_apportionment - ? [ - MyFormItems.EnumRadio({ - key: 'calculation_method', - title: '计量单位', - colProps: { span: 18 }, - valueEnum: HouseChargeStandardsApportionmentMethodEnum, - required: true, - }), - ] - : []; - }, - }, - ], - }, - MyFormItems.EnumRadio({ - key: 'calculation_period', - title: '计费周期', - colProps: { span: 18 }, - valueEnum: HouseChargeStandardsCalculationPeriodEnum, - required: true, - }), - { - key: 'remark', - title: '备注', - valueType: 'textarea', - colProps: { span: 24 }, - fieldProps: { - rows: 4, - maxLength: 500, - showCount: true, - }, - }, - ]} - /> - ); -} diff --git a/src/pages/house_charge/modals/HouseChargeUpdate.tsx b/src/pages/house_charge/modals/HouseChargeUpdate.tsx deleted file mode 100644 index eb86cfd..0000000 --- a/src/pages/house_charge/modals/HouseChargeUpdate.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Apis } from '@/gen/Apis'; -import { BannerSpacesTypeEnum } 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="600px" - key={new Date().getTime()} - form={form} - onOpenChange={(open: any) => { - if (open && props.item) { - form.setFieldsValue(props.item); - } - }} - onFinish={async (values) => - Apis.Banner.BannerSpaces.Update({ ...values, id: props.item?.id ?? 0 }) - .then(() => { - props.reload?.(); - message.success('编辑广告位成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - key: 'name', - title: '广告位名称', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, - MyFormItems.EnumRadio({ - key: 'type', - title: '类型', - colProps: { span: 24 }, - valueEnum: BannerSpacesTypeEnum, - required: true, - }), - { - key: 'remark', - title: '备注', - valueType: 'textarea', - colProps: { span: 24 }, - fieldProps: { - rows: 4, - maxLength: 500, - showCount: true, - }, - }, - ]} - /> - ); -} \ No newline at end of file From 14004b9022a3f4b0db4928d325eea10902ea0feb Mon Sep 17 00:00:00 2001 From: zsqtony <450952271@qq.com> Date: Tue, 2 Sep 2025 16:24:52 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix=EF=BC=9A=E5=AF=8C=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Editor/custom-types.d.ts | 14 +++ src/common/components/Editor/index.tsx | 113 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 src/common/components/Editor/custom-types.d.ts create mode 100644 src/common/components/Editor/index.tsx diff --git a/src/common/components/Editor/custom-types.d.ts b/src/common/components/Editor/custom-types.d.ts new file mode 100644 index 0000000..4c7f653 --- /dev/null +++ b/src/common/components/Editor/custom-types.d.ts @@ -0,0 +1,14 @@ +import { SlateDescendant } from '@wangeditor/editor'; + +declare module '@wangeditor/editor' { + // 扩展 Text + interface SlateText { + text: string; + } + + // 扩展 Element + interface SlateElement { + type: string; + children: SlateDescendant[]; + } +} diff --git a/src/common/components/Editor/index.tsx b/src/common/components/Editor/index.tsx new file mode 100644 index 0000000..dac622e --- /dev/null +++ b/src/common/components/Editor/index.tsx @@ -0,0 +1,113 @@ +import { Apis } from '@/gen/Apis'; +import { IDomEditor, IToolbarConfig } from '@wangeditor/editor'; +import { Editor, Toolbar } from '@wangeditor/editor-for-react'; +import '@wangeditor/editor/dist/css/style.css'; // 引入 css +import axios from 'axios'; +import { useEffect, useState } from 'react'; +type InsertFnType = (url: string) => void; +function MyEditor(props: any) { + // editor 实例 + const [editor, setEditor] = useState(null); // TS 语法 + + // 编辑器内容 + const [html, setHtml] = useState(''); + + useEffect(() => { + setTimeout(() => { + setHtml(props.value || ''); + }, 500); + }, []); + + // 工具栏配置 + const toolbarConfig: Partial = {}; // TS 语法 + // const toolbarConfig = { } // JS 语法 + const customRequest = ( + file: any, + onSuccess: (url: string, file: any) => void, + ) => { + Apis.Auth.PreUpload({ + filename: file.name, + alc: 'public-read', + }).then(async (res) => { + axios + .put(res.data.url, file, { + headers: res.data.headers, + onUploadProgress: ({ total, loaded }) => { + console.log('loaded', total, loaded); + }, + }) + .then(({ data: response }) => { + console.log('response', response); + if (response.errorMessage) { + console.log(response, file); + } else { + onSuccess(res.data.url.split('?')[0], file); + } + }); + }); + + return { + abort() { + console.log('upload progress is aborted.'); + }, + }; + }; + // 编辑器配置 + const editorConfig: Partial = { + // TS 语法 + // const editorConfig = { // JS 语法 + placeholder: '请输入内容...', + MENU_CONF: { + uploadVideo: { + async customUpload(file: File, insertFn: InsertFnType) { + // TS 语法 + customRequest(file, (url) => { + console.log(url, '视频'); + insertFn(url); + }); + }, + }, + uploadImage: { + async customUpload(file: File, insertFn: InsertFnType) { + // TS 语法 + customRequest(file, (url) => { + console.log(url, '图片'); + insertFn(url); + }); + }, + }, + }, + }; + + // 及时销毁 editor ,重要! + useEffect(() => { + return () => { + if (editor === null) return; + editor.destroy(); + setEditor(null); + }; + }, [editor]); + + return ( +
+ + props?.onChange?.(editor.getHtml())} + mode="default" + style={{ height: '500px', overflowY: 'hidden' }} + /> +
+ ); +} + +export default MyEditor; From bca4eff39ba027fe7c926212e73ee1d1e3ea381f Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Tue, 2 Sep 2025 18:42:14 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat=EF=BC=9A=E4=BE=BF=E6=B0=91=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen/ApiTypes.d.ts | 22 + src/gen/Apis.ts | 17 + src/gen/Enums.ts | 733 +++++++----------- .../modals/ChargeStandardCreate.tsx | 23 +- .../modals/ChargeStandardUpdate.tsx | 51 +- src/pages/charge_standard/index.tsx | 2 +- .../charge_standard/modals/ChargeCreate.tsx | 15 +- src/pages/convenience_services/index.tsx | 115 +++ .../modals/ServiceCreate.tsx | 109 +++ .../modals/ServiceUpdate.tsx | 112 +++ 10 files changed, 736 insertions(+), 463 deletions(-) create mode 100644 src/pages/convenience_services/index.tsx create mode 100644 src/pages/convenience_services/modals/ServiceCreate.tsx create mode 100644 src/pages/convenience_services/modals/ServiceUpdate.tsx diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 9b5337b..2962ef0 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -503,6 +503,28 @@ declare namespace ApiTypes { "filename": string; // 文件名称 }; } + namespace ConvenienceServices { + type List = { + "name"?: string; // 模糊搜索:名称 + }; + type Store = { + "type": string; // 类型,[enum:ConvenienceServicesTypeEnum] + "name": string; // 名称 + "content": string[]; // 内容 + }; + type Update = { + "id": number; // id + "type": string; // 类型,[enum:ConvenienceServicesTypeEnum] + "name": string; // 名称 + "content": string[]; // 内容 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } } namespace Company { namespace Companies { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 079d4f5..1e64ee1 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -300,6 +300,23 @@ export const Apis = { return request('admin/common/auth/temporary_url', { data }); }, }, + ConvenienceServices: { + List(data?: ApiTypes.Common.ConvenienceServices.List): Promise { + return request('admin/common/convenience_services/list', { data }); + }, + Store(data: ApiTypes.Common.ConvenienceServices.Store): Promise { + return request('admin/common/convenience_services/store', { data }); + }, + Update(data: ApiTypes.Common.ConvenienceServices.Update): Promise { + return request('admin/common/convenience_services/update', { data }); + }, + Show(data: ApiTypes.Common.ConvenienceServices.Show): Promise { + return request('admin/common/convenience_services/show', { data }); + }, + Delete(data: ApiTypes.Common.ConvenienceServices.Delete): Promise { + return request('admin/common/convenience_services/delete', { data }); + }, + }, }, Company: { Companies: { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 3b56461..0f7a2f4 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -1,616 +1,481 @@ // AssetHousesOrientationEnum -export const AssetHousesOrientationEnum = { - East: { text: '东', color: '#007bff', value: 'East' }, - South: { text: '南', color: '#28a745', value: 'South' }, - West: { text: '西', color: '#ffc107', value: 'West' }, - North: { text: '北', color: '#dc3545', value: 'North' }, - Southeast: { text: '东南', color: '#20c997', value: 'Southeast' }, - Northeast: { text: '东北', color: '#6f42c1', value: 'Northeast' }, - Southwest: { text: '西南', color: '#fd7e14', value: 'Southwest' }, - Northwest: { text: '西北', color: '#17a2b8', value: 'Northwest' }, - EastWest: { text: '东西', color: '#6610f2', value: 'EastWest' }, - SouthNorth: { text: '南北', color: '#e83e8c', value: 'SouthNorth' }, +export const AssetHousesOrientationEnum= { + 'East': {"text":"东","color":"#007bff","value":"East"}, + 'South': {"text":"南","color":"#28a745","value":"South"}, + 'West': {"text":"西","color":"#ffc107","value":"West"}, + 'North': {"text":"北","color":"#dc3545","value":"North"}, + 'Southeast': {"text":"东南","color":"#20c997","value":"Southeast"}, + 'Northeast': {"text":"东北","color":"#6f42c1","value":"Northeast"}, + 'Southwest': {"text":"西南","color":"#fd7e14","value":"Southwest"}, + 'Northwest': {"text":"西北","color":"#17a2b8","value":"Northwest"}, + 'EastWest': {"text":"东西","color":"#6610f2","value":"EastWest"}, + 'SouthNorth': {"text":"南北","color":"#e83e8c","value":"SouthNorth"}, }; // AssetHousesOwnershipTypeEnum -export const AssetHousesOwnershipTypeEnum = { - CommodityHousing: { - text: '商品房', - color: '#007bff', - value: 'CommodityHousing', - }, - FundedHousing: { text: '集资房', color: '#28a745', value: 'FundedHousing' }, - MilitaryHousing: { - text: '军产房', - color: '#17a2b8', - value: 'MilitaryHousing', - }, - AffordableHousing: { - text: '保障房', - color: '#ffc107', - value: 'AffordableHousing', - }, - RuralHousing: { text: '农民房', color: '#6f42c1', value: 'RuralHousing' }, - CommercialOffice: { - text: '商业写字楼', - color: '#fd7e14', - value: 'CommercialOffice', - }, - CommercialComplex: { - text: '商业综合体', - color: '#dc3545', - value: 'CommercialComplex', - }, - ResettlementHousing: { - text: '回迁房', - color: '#20c997', - value: 'ResettlementHousing', - }, +export const AssetHousesOwnershipTypeEnum= { + 'CommodityHousing': {"text":"商品房","color":"#007bff","value":"CommodityHousing"}, + 'FundedHousing': {"text":"集资房","color":"#28a745","value":"FundedHousing"}, + 'MilitaryHousing': {"text":"军产房","color":"#17a2b8","value":"MilitaryHousing"}, + 'AffordableHousing': {"text":"保障房","color":"#ffc107","value":"AffordableHousing"}, + 'RuralHousing': {"text":"农民房","color":"#6f42c1","value":"RuralHousing"}, + 'CommercialOffice': {"text":"商业写字楼","color":"#fd7e14","value":"CommercialOffice"}, + 'CommercialComplex': {"text":"商业综合体","color":"#dc3545","value":"CommercialComplex"}, + 'ResettlementHousing': {"text":"回迁房","color":"#20c997","value":"ResettlementHousing"}, }; // AssetHousesPropertyOwnershipEnum -export const AssetHousesPropertyOwnershipEnum = { - Individual: { text: '个人', color: '#2db7f5', value: 'Individual' }, - Enterprise: { text: '企业', color: '#87d068', value: 'Enterprise' }, - Developer: { text: '开发商', color: '#fa8c16', value: 'Developer' }, - Government: { text: '政府', color: '#f5222d', value: 'Government' }, +export const AssetHousesPropertyOwnershipEnum= { + 'Individual': {"text":"个人","color":"#2db7f5","value":"Individual"}, + 'Enterprise': {"text":"企业","color":"#87d068","value":"Enterprise"}, + 'Developer': {"text":"开发商","color":"#fa8c16","value":"Developer"}, + 'Government': {"text":"政府","color":"#f5222d","value":"Government"}, }; // AssetHousesStatusEnum -export const AssetHousesStatusEnum = { - Unsold: { text: '未售', color: '#6c757d', value: 'Unsold' }, - SoldNotDelivered: { - text: '已售未交房', - color: '#ffc107', - value: 'SoldNotDelivered', - }, - SelfOccupied: { text: '自住', color: '#28a745', value: 'SelfOccupied' }, - Rented: { text: '出租', color: '#007bff', value: 'Rented' }, - Vacant: { text: '空置', color: '#dc3545', value: 'Vacant' }, +export const AssetHousesStatusEnum= { + 'Unsold': {"text":"未售","color":"#6c757d","value":"Unsold"}, + 'SoldNotDelivered': {"text":"已售未交房","color":"#ffc107","value":"SoldNotDelivered"}, + 'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"}, + 'Rented': {"text":"出租","color":"#007bff","value":"Rented"}, + 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, }; // AssetHousesUsageEnum -export const AssetHousesUsageEnum = { - Residence: { text: '住宅', color: '#007bff', value: 'Residence' }, - Apartment: { text: '公寓', color: '#28a745', value: 'Apartment' }, - Villa: { text: '别墅', color: '#17a2b8', value: 'Villa' }, - Shop: { text: '商铺', color: '#ffc107', value: 'Shop' }, - ParkingSpace: { text: '车位', color: '#6c757d', value: 'ParkingSpace' }, - Office: { text: '写字楼', color: '#6610f2', value: 'Office' }, - Clubhouse: { text: '会所', color: '#fd7e14', value: 'Clubhouse' }, - PropertyRoom: { text: '物业用房', color: '#dc3545', value: 'PropertyRoom' }, +export const AssetHousesUsageEnum= { + 'Residence': {"text":"住宅","color":"#007bff","value":"Residence"}, + 'Apartment': {"text":"公寓","color":"#28a745","value":"Apartment"}, + 'Villa': {"text":"别墅","color":"#17a2b8","value":"Villa"}, + 'Shop': {"text":"商铺","color":"#ffc107","value":"Shop"}, + 'ParkingSpace': {"text":"车位","color":"#6c757d","value":"ParkingSpace"}, + 'Office': {"text":"写字楼","color":"#6610f2","value":"Office"}, + 'Clubhouse': {"text":"会所","color":"#fd7e14","value":"Clubhouse"}, + 'PropertyRoom': {"text":"物业用房","color":"#dc3545","value":"PropertyRoom"}, }; // AssetProjectsChargeEnum -export const AssetProjectsChargeEnum = { - Contract: { text: '包干制', color: '#007bff', value: 'Contract' }, - Commission: { text: '酬金制', color: '#28a745', value: 'Commission' }, +export const AssetProjectsChargeEnum= { + 'Contract': {"text":"包干制","color":"#007bff","value":"Contract"}, + 'Commission': {"text":"酬金制","color":"#28a745","value":"Commission"}, }; // AssetProjectsEntrustTypeEnum -export const AssetProjectsEntrustTypeEnum = { - DeveloperJointEntrust: { - text: '开发商全委', - color: '#007bff', - value: 'DeveloperJointEntrust', - }, - OwnersFullEntrust: { - text: '业委会全委', - color: '#28a745', - value: 'OwnersFullEntrust', - }, - GovernmentFullEntrust: { - text: '政府类全委', - color: '#ffc107', - value: 'GovernmentFullEntrust', - }, +export const AssetProjectsEntrustTypeEnum= { + 'DeveloperJointEntrust': {"text":"开发商全委","color":"#007bff","value":"DeveloperJointEntrust"}, + 'OwnersFullEntrust': {"text":"业委会全委","color":"#28a745","value":"OwnersFullEntrust"}, + 'GovernmentFullEntrust': {"text":"政府类全委","color":"#ffc107","value":"GovernmentFullEntrust"}, }; // AssetProjectsPropertyTypeEnum -export const AssetProjectsPropertyTypeEnum = { - Residence: { text: '住宅', color: '#ff0000', value: 'Residence' }, - Commercial: { text: '商业', color: '#ff6600', value: 'Commercial' }, - Office: { text: '办公', color: '#ffcc00', value: 'Office' }, - IndustrialPark: { text: '产业园', color: '#00cc66', value: 'IndustrialPark' }, - Complex: { text: '综合体', color: '#0099ff', value: 'Complex' }, - Municipal: { text: '市政设施', color: '#6633cc', value: 'Municipal' }, - Venue: { text: '场馆', color: '#9966ff', value: 'Venue' }, - Education: { text: '教育', color: '#339999', value: 'Education' }, - Medical: { text: '医疗', color: '#cc3366', value: 'Medical' }, +export const AssetProjectsPropertyTypeEnum= { + 'Residence': {"text":"住宅","color":"#ff0000","value":"Residence"}, + 'Commercial': {"text":"商业","color":"#ff6600","value":"Commercial"}, + 'Office': {"text":"办公","color":"#ffcc00","value":"Office"}, + 'IndustrialPark': {"text":"产业园","color":"#00cc66","value":"IndustrialPark"}, + 'Complex': {"text":"综合体","color":"#0099ff","value":"Complex"}, + 'Municipal': {"text":"市政设施","color":"#6633cc","value":"Municipal"}, + 'Venue': {"text":"场馆","color":"#9966ff","value":"Venue"}, + 'Education': {"text":"教育","color":"#339999","value":"Education"}, + 'Medical': {"text":"医疗","color":"#cc3366","value":"Medical"}, }; // AssetProjectsStatusEnum -export const AssetProjectsStatusEnum = { - SignedNotDelivered: { - text: '签约未交付', - color: '#6c757d', - value: 'SignedNotDelivered', - }, - RollingDevelopment: { - text: '滚动开发', - color: '#007bff', - value: 'RollingDevelopment', - }, - ManagedAndClosed: { - text: '在管封园', - color: '#ffc107', - value: 'ManagedAndClosed', - }, - Exited: { text: '退出', color: '#dc3545', value: 'Exited' }, +export const AssetProjectsStatusEnum= { + 'SignedNotDelivered': {"text":"签约未交付","color":"#6c757d","value":"SignedNotDelivered"}, + 'RollingDevelopment': {"text":"滚动开发","color":"#007bff","value":"RollingDevelopment"}, + 'ManagedAndClosed': {"text":"在管封园","color":"#ffc107","value":"ManagedAndClosed"}, + 'Exited': {"text":"退出","color":"#dc3545","value":"Exited"}, }; // AssetUnitsBuildingStructureEnum -export const AssetUnitsBuildingStructureEnum = { - SteelConcrete: { text: '钢混', color: '#007bff', value: 'SteelConcrete' }, - SteelStructure: { text: '钢结构', color: '#28a745', value: 'SteelStructure' }, - BrickConcrete: { text: '砖混', color: '#ffc107', value: 'BrickConcrete' }, - BrickWood: { text: '砖木', color: '#dc3545', value: 'BrickWood' }, +export const AssetUnitsBuildingStructureEnum= { + 'SteelConcrete': {"text":"钢混","color":"#007bff","value":"SteelConcrete"}, + 'SteelStructure': {"text":"钢结构","color":"#28a745","value":"SteelStructure"}, + 'BrickConcrete': {"text":"砖混","color":"#ffc107","value":"BrickConcrete"}, + 'BrickWood': {"text":"砖木","color":"#dc3545","value":"BrickWood"}, }; // AssetUnitsBuildingTypeEnum -export const AssetUnitsBuildingTypeEnum = { - SlabAndTower: { text: '板塔结合', color: '#007bff', value: 'SlabAndTower' }, - Slab: { text: '板楼', color: '#28a745', value: 'Slab' }, - Tower: { text: '塔楼', color: '#ffc107', value: 'Tower' }, +export const AssetUnitsBuildingTypeEnum= { + 'SlabAndTower': {"text":"板塔结合","color":"#007bff","value":"SlabAndTower"}, + 'Slab': {"text":"板楼","color":"#28a745","value":"Slab"}, + 'Tower': {"text":"塔楼","color":"#ffc107","value":"Tower"}, }; // BannerSpacesTypeEnum -export const BannerSpacesTypeEnum = { - Popup: { text: '弹窗', color: '#ff0000', value: 'Popup' }, - Banner: { text: '横幅广告', color: '#00ff00', value: 'Banner' }, - FloatingButton: { - text: '悬浮按钮', - color: '#0000ff', - value: 'FloatingButton', - }, +export const BannerSpacesTypeEnum= { + 'Popup': {"text":"弹窗","color":"#ff0000","value":"Popup"}, + 'Banner': {"text":"横幅广告","color":"#00ff00","value":"Banner"}, + 'FloatingButton': {"text":"悬浮按钮","color":"#0000ff","value":"FloatingButton"}, }; // BannersRedirectTypeEnum -export const BannersRedirectTypeEnum = { - InnerPage: { text: '跳内页', color: '#ff0000', value: 'InnerPage' }, - H5: { text: '跳H5', color: '#00ff00', value: 'H5' }, - MiniProgramHome: { - text: '跳小程序首屏', - color: '#0000ff', - value: 'MiniProgramHome', - }, - AnotherMiniProgram: { - text: '跳另一个小程序', - color: '#ffa500', - value: 'AnotherMiniProgram', - }, +export const BannersRedirectTypeEnum= { + 'InnerPage': {"text":"跳内页","color":"#ff0000","value":"InnerPage"}, + 'H5': {"text":"跳H5","color":"#00ff00","value":"H5"}, + 'MiniProgramHome': {"text":"跳小程序首屏","color":"#0000ff","value":"MiniProgramHome"}, + 'AnotherMiniProgram': {"text":"跳另一个小程序","color":"#ffa500","value":"AnotherMiniProgram"}, }; // BannersTypeEnum -export const BannersTypeEnum = { - Image: { text: '图片', color: '#ff0000', value: 'Image' }, - Video: { text: '视频', color: '#00ff00', value: 'Video' }, - Text: { text: '文本', color: '#0000ff', value: 'Text' }, +export const BannersTypeEnum= { + 'Image': {"text":"图片","color":"#ff0000","value":"Image"}, + 'Video': {"text":"视频","color":"#00ff00","value":"Video"}, + 'Text': {"text":"文本","color":"#0000ff","value":"Text"}, }; // 缓存类型 -export const CacheTypeEnum = { - MobilePhoneVerificationCode: { - text: '手机验证码', - color: '#2432a3', - value: 'MobilePhoneVerificationCode', - }, +export const CacheTypeEnum= { + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#a10533","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum -export const CompaniesMerchantTypeEnum = { - PropertyManagement: { - text: '物业公司', - color: '#007bff', - value: 'PropertyManagement', - }, - ServiceProvider: { - text: '服务商', - color: '#28a745', - value: 'ServiceProvider', - }, +export const CompaniesMerchantTypeEnum= { + 'PropertyManagement': {"text":"物业公司","color":"#007bff","value":"PropertyManagement"}, + 'ServiceProvider': {"text":"服务商","color":"#28a745","value":"ServiceProvider"}, }; // CompanyAppsAppTypeEnum -export const CompanyAppsAppTypeEnum = { - MiniProgram: { text: '微信小程序', color: '#3b82f6', value: 'MiniProgram' }, - MpOfficial: { text: '微信公众号', color: '#22c55e', value: 'MpOfficial' }, - WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, +export const CompanyAppsAppTypeEnum= { + 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, + 'MpOfficial': {"text":"微信公众号","color":"#22c55e","value":"MpOfficial"}, + 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, }; // CompanyAppsModuleEnum -export const CompanyAppsModuleEnum = { - Employee: { text: '员工端', color: '#3b82f6', value: 'Employee' }, - Customer: { text: '客户端', color: '#10b981', value: 'Customer' }, +export const CompanyAppsModuleEnum= { + 'Employee': {"text":"员工端","color":"#3b82f6","value":"Employee"}, + 'Customer': {"text":"客户端","color":"#10b981","value":"Customer"}, }; // CompanyEmployeeBacklogsStatusEnum -export const CompanyEmployeeBacklogsStatusEnum = { - Pending: { text: '待办', color: '#FF6600', value: 'Pending' }, - Completed: { text: '已办', color: '#2A82E4', value: 'Completed' }, +export const CompanyEmployeeBacklogsStatusEnum= { + 'Pending': {"text":"待办","color":"#FF6600","value":"Pending"}, + 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, }; // CompanyEmployeeBacklogsTypeEnum -export const CompanyEmployeeBacklogsTypeEnum = { - WorkOrder: { text: '工单', color: '#FF6600', value: 'WorkOrder' }, - Contract: { text: '合同', color: '#2A82E4', value: 'Contract' }, +export const CompanyEmployeeBacklogsTypeEnum= { + 'WorkOrder': {"text":"工单","color":"#FF6600","value":"WorkOrder"}, + 'Contract': {"text":"合同","color":"#2A82E4","value":"Contract"}, }; // CompanyReceiptAccountsPayChannelEnum -export const CompanyReceiptAccountsPayChannelEnum = { - WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, - Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, - BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, - TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, +export const CompanyReceiptAccountsPayChannelEnum= { + 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, + 'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"}, + 'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"}, + 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, +}; + +// ConvenienceServicesTypeEnum +export const ConvenienceServicesTypeEnum= { + 'EmergencyRepair': {"text":"紧急抢修","color":"#ef4444","value":"EmergencyRepair"}, + 'LifeService': {"text":"生活服务","color":"#3b82f6","value":"LifeService"}, + 'GovernmentConsulting': {"text":"政务咨询","color":"#10b981","value":"GovernmentConsulting"}, + 'PropertyExclusive': {"text":"物业专属","color":"#8b5cf6","value":"PropertyExclusive"}, }; // CustomerBacklogsStatusEnum -export const CustomerBacklogsStatusEnum = { - Pending: { text: '待办', color: '#faad14', value: 'Pending' }, - Completed: { text: '已办', color: '#2A82E4', value: 'Completed' }, +export const CustomerBacklogsStatusEnum= { + 'Pending': {"text":"待办","color":"#faad14","value":"Pending"}, + 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, }; // CustomerBacklogsTypeEnum -export const CustomerBacklogsTypeEnum = { - RegisterApply: { text: '登记申请', color: '#2db7f5', value: 'RegisterApply' }, - PaymentPending: { - text: '费用待缴', - color: '#faad14', - value: 'PaymentPending', - }, - ContractTodo: { text: '合同待办', color: '#722ed1', value: 'ContractTodo' }, +export const CustomerBacklogsTypeEnum= { + 'RegisterApply': {"text":"登记申请","color":"#2db7f5","value":"RegisterApply"}, + 'PaymentPending': {"text":"费用待缴","color":"#faad14","value":"PaymentPending"}, + 'ContractTodo': {"text":"合同待办","color":"#722ed1","value":"ContractTodo"}, }; // 账单状态枚举 -export const HouseBillsBillStatusEnum = { - PendingPayment: { text: '待支付', color: '#facc15', value: 'PendingPayment' }, - PartiallyPaid: { text: '部分支付', color: '#60a5fa', value: 'PartiallyPaid' }, - Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, - Overdue: { text: '已逾期', color: '#ef4444', value: 'Overdue' }, - Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, +export const HouseBillsBillStatusEnum= { + 'PendingPayment': {"text":"待支付","color":"#facc15","value":"PendingPayment"}, + 'PartiallyPaid': {"text":"部分支付","color":"#60a5fa","value":"PartiallyPaid"}, + 'Paid': {"text":"已支付","color":"#10b981","value":"Paid"}, + 'Overdue': {"text":"已逾期","color":"#ef4444","value":"Overdue"}, + 'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"}, }; // 房屋账单类型枚举 -export const HouseBillsTypeEnum = { - PropertyFee: { text: '物业费', color: '#3b82f6', value: 'PropertyFee' }, - MaintenanceFund: { - text: '维修基金', - color: '#10b981', - value: 'MaintenanceFund', - }, - WaterFee: { text: '水费', color: '#06b6d4', value: 'WaterFee' }, - ElectricityFee: { text: '电费', color: '#f59e0b', value: 'ElectricityFee' }, - SharedWaterFee: { - text: '公摊水费', - color: '#8b5cf6', - value: 'SharedWaterFee', - }, - SharedElectricityFee: { - text: '公摊电费', - color: '#ec4899', - value: 'SharedElectricityFee', - }, +export const HouseBillsTypeEnum= { + 'PropertyFee': {"text":"物业费","color":"#3b82f6","value":"PropertyFee"}, + 'MaintenanceFund': {"text":"维修基金","color":"#10b981","value":"MaintenanceFund"}, + 'WaterFee': {"text":"水费","color":"#06b6d4","value":"WaterFee"}, + 'ElectricityFee': {"text":"电费","color":"#f59e0b","value":"ElectricityFee"}, + 'SharedWaterFee': {"text":"公摊水费","color":"#8b5cf6","value":"SharedWaterFee"}, + 'SharedElectricityFee': {"text":"公摊电费","color":"#ec4899","value":"SharedElectricityFee"}, }; // HouseChargeStandardsApportionmentMethodEnum -export const HouseChargeStandardsApportionmentMethodEnum = { - HouseCount: { text: '房屋数分摊', color: '#3b82f6', value: 'HouseCount' }, - AreaProportion: { - text: '房屋计费面积分摊', - color: '#10b981', - value: 'AreaProportion', - }, - FixedRatio: { text: '按固定比例分摊', color: '#f59e0b', value: 'FixedRatio' }, +export const HouseChargeStandardsApportionmentMethodEnum= { + 'HouseCount': {"text":"房屋数分摊","color":"#3b82f6","value":"HouseCount"}, + 'AreaProportion': {"text":"房屋计费面积分摊","color":"#10b981","value":"AreaProportion"}, + 'FixedRatio': {"text":"按固定比例分摊","color":"#f59e0b","value":"FixedRatio"}, }; // HouseChargeStandardsCalculationMethodEnum -export const HouseChargeStandardsCalculationMethodEnum = { - ChargeableArea: { - text: '计费面积', - color: '#3b82f6', - value: 'ChargeableArea', - }, - BuiltArea: { text: '建筑面积', color: '#10b981', value: 'BuiltArea' }, - InsideArea: { text: '套内面积', color: '#f59e0b', value: 'InsideArea' }, - PerUnit: { text: '按套', color: '#06b6d4', value: 'PerUnit' }, - ElectricityUsage: { - text: '用电量', - color: '#8b5cf6', - value: 'ElectricityUsage', - }, - WaterUsage: { text: '用水量', color: '#ec4899', value: 'WaterUsage' }, +export const HouseChargeStandardsCalculationMethodEnum= { + 'ChargeableArea': {"text":"计费面积","color":"#3b82f6","value":"ChargeableArea"}, + 'BuiltArea': {"text":"建筑面积","color":"#10b981","value":"BuiltArea"}, + 'InsideArea': {"text":"套内面积","color":"#f59e0b","value":"InsideArea"}, + 'PerUnit': {"text":"按套","color":"#06b6d4","value":"PerUnit"}, + 'ElectricityUsage': {"text":"用电量","color":"#8b5cf6","value":"ElectricityUsage"}, + 'WaterUsage': {"text":"用水量","color":"#ec4899","value":"WaterUsage"}, }; // HouseChargeStandardsCalculationModeEnum -export const HouseChargeStandardsCalculationModeEnum = { - FixedAmount: { text: '固定金额', color: '#3b82f6', value: 'FixedAmount' }, - QuantityPrice: { - text: '数量*单价', - color: '#10b981', - value: 'QuantityPrice', - }, +export const HouseChargeStandardsCalculationModeEnum= { + 'FixedAmount': {"text":"固定金额","color":"#3b82f6","value":"FixedAmount"}, + 'QuantityPrice': {"text":"数量*单价","color":"#10b981","value":"QuantityPrice"}, }; // HouseChargeStandardsCalculationPeriodEnum -export const HouseChargeStandardsCalculationPeriodEnum = { - PerTime: { text: '按次', color: '#3b82f6', value: 'PerTime' }, - PerDay: { text: '按日', color: '#10b981', value: 'PerDay' }, - PerMonth: { text: '按月', color: '#f59e0b', value: 'PerMonth' }, - PerYear: { text: '按年', color: '#8b5cf6', value: 'PerYear' }, +export const HouseChargeStandardsCalculationPeriodEnum= { + 'PerTime': {"text":"按次","color":"#3b82f6","value":"PerTime"}, + 'PerDay': {"text":"按日","color":"#10b981","value":"PerDay"}, + 'PerMonth': {"text":"按月","color":"#f59e0b","value":"PerMonth"}, + 'PerYear': {"text":"按年","color":"#8b5cf6","value":"PerYear"}, }; // HouseChargeStandardsPriceAlgorithmEnum -export const HouseChargeStandardsPriceAlgorithmEnum = { - Fixed: { text: '固定', color: '#4caf50', value: 'Fixed' }, - Tiered: { text: '分级价阶梯', color: '#2196f3', value: 'Tiered' }, - Peak: { text: '最高价阶梯', color: '#ff9800', value: 'Peak' }, +export const HouseChargeStandardsPriceAlgorithmEnum= { + 'Fixed': {"text":"固定","color":"#4caf50","value":"Fixed"}, + 'Tiered': {"text":"分级价阶梯","color":"#2196f3","value":"Tiered"}, + 'Peak': {"text":"最高价阶梯","color":"#ff9800","value":"Peak"}, }; // HouseChargeStandardsStatusEnum -export const HouseChargeStandardsStatusEnum = { - Active: { text: '启用', color: '#3b82f6', value: 'Active' }, - Inactive: { text: '禁用', color: '#ef4444', value: 'Inactive' }, +export const HouseChargeStandardsStatusEnum= { + 'Active': {"text":"启用","color":"#3b82f6","value":"Active"}, + 'Inactive': {"text":"禁用","color":"#ef4444","value":"Inactive"}, }; // HouseChargeStandardsTypeEnum -export const HouseChargeStandardsTypeEnum = { - House: { text: '房屋', color: '#3b82f6', value: 'House' }, - Meter: { text: '仪表', color: '#10b981', value: 'Meter' }, +export const HouseChargeStandardsTypeEnum= { + 'House': {"text":"房屋","color":"#3b82f6","value":"House"}, + 'Meter': {"text":"仪表","color":"#10b981","value":"Meter"}, }; // HouseChargeTaskDetailsStatusEnum -export const HouseChargeTaskDetailsStatusEnum = { - Pending: { text: '待处理', color: '#f59e0b', value: 'Pending' }, - Success: { text: '成功', color: '#22c55e', value: 'Success' }, - Failed: { text: '失败', color: '#ef4444', value: 'Failed' }, +export const HouseChargeTaskDetailsStatusEnum= { + 'Pending': {"text":"待处理","color":"#f59e0b","value":"Pending"}, + 'Success': {"text":"成功","color":"#22c55e","value":"Success"}, + 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, }; // HouseChargeTasksStatusEnum -export const HouseChargeTasksStatusEnum = { - Pending: { text: '待执行', color: '#f59e0b', value: 'Pending' }, - InProgress: { text: '执行中', color: '#3b82f6', value: 'InProgress' }, - Completed: { text: '已完成', color: '#10b981', value: 'Completed' }, - Failed: { text: '失败', color: '#ef4444', value: 'Failed' }, +export const HouseChargeTasksStatusEnum= { + 'Pending': {"text":"待执行","color":"#f59e0b","value":"Pending"}, + 'InProgress': {"text":"执行中","color":"#3b82f6","value":"InProgress"}, + 'Completed': {"text":"已完成","color":"#10b981","value":"Completed"}, + 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, }; // HouseChargeTasksTypeEnum -export const HouseChargeTasksTypeEnum = { - Scheduled: { text: '定时创建', color: '#3b82f6', value: 'Scheduled' }, - Manual: { text: '手动创建', color: '#10b981', value: 'Manual' }, +export const HouseChargeTasksTypeEnum= { + 'Scheduled': {"text":"定时创建","color":"#3b82f6","value":"Scheduled"}, + 'Manual': {"text":"手动创建","color":"#10b981","value":"Manual"}, }; // HouseCollectionRecordsCollectionResultEnum -export const HouseCollectionRecordsCollectionResultEnum = { - PromiseToPay: { text: '承诺缴费', color: '#4caf50', value: 'PromiseToPay' }, - RefuseToPay: { text: '拒绝缴费', color: '#f44336', value: 'RefuseToPay' }, - NotReached: { text: '未联系到', color: '#9e9e9e', value: 'NotReached' }, - NeedFollowUp: { text: '需要跟进', color: '#ff9800', value: 'NeedFollowUp' }, +export const HouseCollectionRecordsCollectionResultEnum= { + 'PromiseToPay': {"text":"承诺缴费","color":"#4caf50","value":"PromiseToPay"}, + 'RefuseToPay': {"text":"拒绝缴费","color":"#f44336","value":"RefuseToPay"}, + 'NotReached': {"text":"未联系到","color":"#9e9e9e","value":"NotReached"}, + 'NeedFollowUp': {"text":"需要跟进","color":"#ff9800","value":"NeedFollowUp"}, }; // HouseCollectionRecordsSmsStatusEnum -export const HouseCollectionRecordsStatusEnum = { - NotNotified: { text: '未通知', color: '#808080', value: 'NotNotified' }, - Notified: { text: '已通知', color: '#00cc00', value: 'Notified' }, - Failed: { text: '失败', color: '#ff0000', value: 'Failed' }, +export const HouseCollectionRecordsStatusEnum= { + 'NotNotified': {"text":"未通知","color":"#808080","value":"NotNotified"}, + 'Notified': {"text":"已通知","color":"#00cc00","value":"Notified"}, + 'Failed': {"text":"失败","color":"#ff0000","value":"Failed"}, }; // HouseCollectionTasksChannelEnum -export const HouseCollectionTasksChannelEnum = { - SMS: { text: '短信', color: '#1E90FF', value: 'SMS' }, - MiniProgram: { text: '小程序', color: '#00BFFF', value: 'MiniProgram' }, - OfficialAccount: { - text: '公众号', - color: '#32CD32', - value: 'OfficialAccount', - }, - PhoneCall: { text: '电话催缴', color: '#FF8C00', value: 'PhoneCall' }, - Visit: { text: '上门催缴', color: '#8B4513', value: 'Visit' }, - WeChat: { text: '微信联系', color: '#20B2AA', value: 'WeChat' }, - WrittenNotice: { text: '书面通知', color: '#708090', value: 'WrittenNotice' }, +export const HouseCollectionTasksChannelEnum= { + 'SMS': {"text":"短信","color":"#1E90FF","value":"SMS"}, + 'MiniProgram': {"text":"小程序","color":"#00BFFF","value":"MiniProgram"}, + 'OfficialAccount': {"text":"公众号","color":"#32CD32","value":"OfficialAccount"}, + 'PhoneCall': {"text":"电话催缴","color":"#FF8C00","value":"PhoneCall"}, + 'Visit': {"text":"上门催缴","color":"#8B4513","value":"Visit"}, + 'WeChat': {"text":"微信联系","color":"#20B2AA","value":"WeChat"}, + 'WrittenNotice': {"text":"书面通知","color":"#708090","value":"WrittenNotice"}, }; // HouseCollectionTasksStatusEnum -export const HouseCollectionTasksStatusEnum = { - Processing: { text: '进行中', color: '#ffcc00', value: 'Processing' }, - Completed: { text: '已完成', color: '#00cc00', value: 'Completed' }, - Failed: { text: '失败', color: '#ff0000', value: 'Failed' }, +export const HouseCollectionTasksStatusEnum= { + 'Processing': {"text":"进行中","color":"#ffcc00","value":"Processing"}, + 'Completed': {"text":"已完成","color":"#00cc00","value":"Completed"}, + 'Failed': {"text":"失败","color":"#ff0000","value":"Failed"}, }; // HouseOccupantsCardTypeEnum -export const HouseOccupantsCardTypeEnum = { - MainlandID: { - text: '中国大陆居民身份证', - color: '#2db7f5', - value: 'MainlandID', - }, - HKPermit: { - text: '香港来往大陆通行证(回乡证)', - color: '#fa8c16', - value: 'HKPermit', - }, - MOPermit: { - text: '澳门来往大陆通行证(回乡证)', - color: '#faad14', - value: 'MOPermit', - }, - TWPermit: { - text: '台湾来往大陆通行证(台胞证)', - color: '#87d068', - value: 'TWPermit', - }, - Passport: { text: '护照', color: '#108ee9', value: 'Passport' }, - BusinessLicense: { - text: '营业执照', - color: '#f5222d', - value: 'BusinessLicense', - }, +export const HouseOccupantsCardTypeEnum= { + 'MainlandID': {"text":"中国大陆居民身份证","color":"#2db7f5","value":"MainlandID"}, + 'HKPermit': {"text":"香港来往大陆通行证(回乡证)","color":"#fa8c16","value":"HKPermit"}, + 'MOPermit': {"text":"澳门来往大陆通行证(回乡证)","color":"#faad14","value":"MOPermit"}, + 'TWPermit': {"text":"台湾来往大陆通行证(台胞证)","color":"#87d068","value":"TWPermit"}, + 'Passport': {"text":"护照","color":"#108ee9","value":"Passport"}, + 'BusinessLicense': {"text":"营业执照","color":"#f5222d","value":"BusinessLicense"}, }; // HouseOccupantsHouseRelationEnum -export const HouseOccupantsHouseRelationEnum = { - Owner: { text: '产权人', color: '#2db7f5', value: 'Owner' }, - NonOwner: { text: '非产权人', color: '#fa8c16', value: 'NonOwner' }, +export const HouseOccupantsHouseRelationEnum= { + 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, + 'NonOwner': {"text":"非产权人","color":"#fa8c16","value":"NonOwner"}, }; // HouseOccupantsRelationWithOwnerEnum -export const HouseOccupantsRelationWithOwnerEnum = { - Spouse: { text: '配偶', color: '#2db7f5', value: 'Spouse' }, - Children: { text: '子女', color: '#87d068', value: 'Children' }, - Parents: { text: '父母', color: '#faad14', value: 'Parents' }, - Siblings: { text: '兄弟姐妹', color: '#fa8c16', value: 'Siblings' }, - OtherRelatives: { - text: '其他亲属', - color: '#f5222d', - value: 'OtherRelatives', - }, +export const HouseOccupantsRelationWithOwnerEnum= { + 'Spouse': {"text":"配偶","color":"#2db7f5","value":"Spouse"}, + 'Children': {"text":"子女","color":"#87d068","value":"Children"}, + 'Parents': {"text":"父母","color":"#faad14","value":"Parents"}, + 'Siblings': {"text":"兄弟姐妹","color":"#fa8c16","value":"Siblings"}, + 'OtherRelatives': {"text":"其他亲属","color":"#f5222d","value":"OtherRelatives"}, }; // HouseOccupantsResidentialRelationEnum -export const HouseOccupantsResidentialRelationEnum = { - Resident: { text: '住户', color: '#2db7f5', value: 'Resident' }, - PrimaryTenant: { text: '主租人', color: '#87d068', value: 'PrimaryTenant' }, - Tenant: { text: '租客', color: '#fa8c16', value: 'Tenant' }, +export const HouseOccupantsResidentialRelationEnum= { + 'Resident': {"text":"住户","color":"#2db7f5","value":"Resident"}, + 'PrimaryTenant': {"text":"主租人","color":"#87d068","value":"PrimaryTenant"}, + 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, }; // HouseOccupantsStatusEnum -export const HouseOccupantsStatusEnum = { - Normal: { text: '正常', color: '#52c41a', value: 'Normal' }, - Unbound: { text: '已解除', color: '#f5222d', value: 'Unbound' }, +export const HouseOccupantsStatusEnum= { + 'Normal': {"text":"正常","color":"#52c41a","value":"Normal"}, + 'Unbound': {"text":"已解除","color":"#f5222d","value":"Unbound"}, }; // 订单状态枚举 -export const HouseOrdersOrderStatusEnum = { - Pending: { text: '待支付', color: '#facc15', value: 'Pending' }, - Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, - Refunded: { text: '已退款', color: '#60a5fa', value: 'Refunded' }, - Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, - Failed: { text: '支付失败', color: '#ef4444', value: 'Failed' }, +export const HouseOrdersOrderStatusEnum= { + 'Pending': {"text":"待支付","color":"#facc15","value":"Pending"}, + 'Paid': {"text":"已支付","color":"#10b981","value":"Paid"}, + 'Refunded': {"text":"已退款","color":"#60a5fa","value":"Refunded"}, + 'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"}, + 'Failed': {"text":"支付失败","color":"#ef4444","value":"Failed"}, }; // HouseOrdersPaymentMethodEnum -export const HouseOrdersPaymentMethodEnum = { - WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, - Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, - BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, - TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, +export const HouseOrdersPaymentMethodEnum= { + 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, + 'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"}, + 'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"}, + 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, }; // HouseRegistersCustomerTypeEnum -export const HouseRegistersCustomerTypeEnum = { - Individual: { text: '个人客户', color: '#2db7f5', value: 'Individual' }, - Enterprise: { text: '普通企业', color: '#87d068', value: 'Enterprise' }, - Developer: { text: '开发企业', color: '#fa8c16', value: 'Developer' }, - Government: { text: '政府组织', color: '#f5222d', value: 'Government' }, +export const HouseRegistersCustomerTypeEnum= { + 'Individual': {"text":"个人客户","color":"#2db7f5","value":"Individual"}, + 'Enterprise': {"text":"普通企业","color":"#87d068","value":"Enterprise"}, + 'Developer': {"text":"开发企业","color":"#fa8c16","value":"Developer"}, + 'Government': {"text":"政府组织","color":"#f5222d","value":"Government"}, }; // HouseRegistersHouseStatusEnum -export const HouseRegistersHouseStatusEnum = { - SelfOccupied: { text: '自住', color: '#28a745', value: 'SelfOccupied' }, - Rented: { text: '出租', color: '#007bff', value: 'Rented' }, - Vacant: { text: '空置', color: '#dc3545', value: 'Vacant' }, +export const HouseRegistersHouseStatusEnum= { + 'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"}, + 'Rented': {"text":"出租","color":"#007bff","value":"Rented"}, + 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, }; // 房屋登记身份类型 -export const HouseRegistersIdentityTypeEnum = { - Owner: { text: '产权人', color: '#2db7f5', value: 'Owner' }, - Tenant: { text: '租客', color: '#87d068', value: 'Tenant' }, - CoResident: { text: '同住人(亲属)', color: '#108ee9', value: 'CoResident' }, +export const HouseRegistersIdentityTypeEnum= { + 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, + 'Tenant': {"text":"租客","color":"#87d068","value":"Tenant"}, + 'CoResident': {"text":"同住人(亲属)","color":"#108ee9","value":"CoResident"}, }; // HouseRegistersStatusEnum -export const HouseRegistersStatusEnum = { - Pending: { text: '待审', color: '#faad14', value: 'Pending' }, - Approved: { text: '通过', color: '#52c41a', value: 'Approved' }, - Rejected: { text: '驳回', color: '#f5222d', value: 'Rejected' }, +export const HouseRegistersStatusEnum= { + 'Pending': {"text":"待审","color":"#faad14","value":"Pending"}, + 'Approved': {"text":"通过","color":"#52c41a","value":"Approved"}, + 'Rejected': {"text":"驳回","color":"#f5222d","value":"Rejected"}, }; // HouseRegistersTypeEnum -export const HouseRegistersTypeEnum = { - AddOwner: { text: '添加产权人', color: '#52c41a', value: 'AddOwner' }, - RemoveOwner: { text: '减少产权人', color: '#d9363e', value: 'RemoveOwner' }, - AddOccupant: { text: '添加住户', color: '#108ee9', value: 'AddOccupant' }, - RemoveOccupant: { - text: '移除住户', - color: '#fa8c16', - value: 'RemoveOccupant', - }, - MoveOut: { text: '搬离登记', color: '#f50', value: 'MoveOut' }, - MoveIn: { text: '搬入登记', color: '#ffc53d', value: 'MoveIn' }, +export const HouseRegistersTypeEnum= { + 'AddOwner': {"text":"添加产权人","color":"#52c41a","value":"AddOwner"}, + 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, + 'AddOccupant': {"text":"添加住户","color":"#108ee9","value":"AddOccupant"}, + 'RemoveOccupant': {"text":"移除住户","color":"#fa8c16","value":"RemoveOccupant"}, + 'MoveOut': {"text":"搬离登记","color":"#f50","value":"MoveOut"}, + 'MoveIn': {"text":"搬入登记","color":"#ffc53d","value":"MoveIn"}, }; // HouseRegistersUsagePlanEnum -export const HouseRegistersUsagePlanEnum = { - Permanent: { text: '常住', color: '#52c41a', value: 'Permanent' }, - Vacation: { text: '度假', color: '#faad14', value: 'Vacation' }, - Rental: { text: '出租', color: '#2db7f5', value: 'Rental' }, - Commercial: { text: '商用', color: '#f5222d', value: 'Commercial' }, +export const HouseRegistersUsagePlanEnum= { + 'Permanent': {"text":"常住","color":"#52c41a","value":"Permanent"}, + 'Vacation': {"text":"度假","color":"#faad14","value":"Vacation"}, + 'Rental': {"text":"出租","color":"#2db7f5","value":"Rental"}, + 'Commercial': {"text":"商用","color":"#f5222d","value":"Commercial"}, }; // HouseWorkOrdersAssignStatusEnum -export const HouseWorkOrdersAssignStatusEnum = { - Unassigned: { text: '未指派', color: '#ff0000', value: 'Unassigned' }, - Assigned: { text: '已指派', color: '#00ff00', value: 'Assigned' }, +export const HouseWorkOrdersAssignStatusEnum= { + 'Unassigned': {"text":"未指派","color":"#ff0000","value":"Unassigned"}, + 'Assigned': {"text":"已指派","color":"#00ff00","value":"Assigned"}, }; // HouseWorkOrdersLevelEnum -export const HouseWorkOrdersLevelEnum = { - Urgent: { text: '紧急', color: '#ff0000', value: 'Urgent' }, - High: { text: '高', color: '#ff7f00', value: 'High' }, - Medium: { text: '中', color: '#00cc00', value: 'Medium' }, - Low: { text: '低', color: '#999999', value: 'Low' }, +export const HouseWorkOrdersLevelEnum= { + 'Urgent': {"text":"紧急","color":"#ff0000","value":"Urgent"}, + 'High': {"text":"高","color":"#ff7f00","value":"High"}, + 'Medium': {"text":"中","color":"#00cc00","value":"Medium"}, + 'Low': {"text":"低","color":"#999999","value":"Low"}, }; // HouseWorkOrdersStatusEnum -export const HouseWorkOrdersStatusEnum = { - Pending: { text: '待处理', color: '#FFA500', value: 'Pending' }, - Processing: { text: '处理中', color: '#1E90FF', value: 'Processing' }, - Completed: { text: '已完成', color: '#28A745', value: 'Completed' }, - Closed: { text: '已关闭', color: '#6C757D', value: 'Closed' }, +export const HouseWorkOrdersStatusEnum= { + 'Pending': {"text":"待处理","color":"#FFA500","value":"Pending"}, + 'Processing': {"text":"处理中","color":"#1E90FF","value":"Processing"}, + 'Completed': {"text":"已完成","color":"#28A745","value":"Completed"}, + 'Closed': {"text":"已关闭","color":"#6C757D","value":"Closed"}, }; // HouseWorkOrdersTypeEnum -export const HouseWorkOrdersTypeEnum = { - Maintenance: { text: '维修', color: '#ff0000', value: 'Maintenance' }, - Installation: { text: '安装', color: '#00aaff', value: 'Installation' }, - Consultation: { text: '咨询', color: '#ffaa00', value: 'Consultation' }, - Complaint: { text: '投诉', color: '#aa00ff', value: 'Complaint' }, - Other: { text: '其它', color: '#00aa55', value: 'Other' }, +export const HouseWorkOrdersTypeEnum= { + 'Maintenance': {"text":"维修","color":"#ff0000","value":"Maintenance"}, + 'Installation': {"text":"安装","color":"#00aaff","value":"Installation"}, + 'Consultation': {"text":"咨询","color":"#ffaa00","value":"Consultation"}, + 'Complaint': {"text":"投诉","color":"#aa00ff","value":"Complaint"}, + 'Other': {"text":"其它","color":"#00aa55","value":"Other"}, }; // OrganizationsTypeEnum -export const OrganizationsTypeEnum = { - Group: { text: '集团', color: '#007bff', value: 'Group' }, - Company: { text: '公司', color: '#28a745', value: 'Company' }, - ManagementOffice: { - text: '管理处', - color: '#ffc107', - value: 'ManagementOffice', - }, - Department: { text: '部门', color: '#dc3545', value: 'Department' }, +export const OrganizationsTypeEnum= { + 'Group': {"text":"集团","color":"#007bff","value":"Group"}, + 'Company': {"text":"公司","color":"#28a745","value":"Company"}, + 'ManagementOffice': {"text":"管理处","color":"#ffc107","value":"ManagementOffice"}, + 'Department': {"text":"部门","color":"#dc3545","value":"Department"}, }; // 性别 -export const SexEnum = { - Male: { text: '男', color: '#0000ff', value: 'Male' }, - FeMale: { text: '女', color: '#ff0000', value: 'FeMale' }, +export const SexEnum= { + 'Male': {"text":"男","color":"#0000ff","value":"Male"}, + 'FeMale': {"text":"女","color":"#ff0000","value":"FeMale"}, }; // SysModuleEnum -export const SysModuleEnum = { - Admin: { text: '管理员', color: '#cf1322', value: 'Admin' }, - Customer: { text: '客户', color: '#d4b106', value: 'Customer' }, +export const SysModuleEnum= { + 'Admin': {"text":"管理员","color":"#cf1322","value":"Admin"}, + 'Customer': {"text":"客户","color":"#d4b106","value":"Customer"}, }; // SysPermissionsTypeEnum -export const SysPermissionsTypeEnum = { - Directory: { text: '目录', color: '#6d7e14', value: 'Directory' }, - Page: { text: '页面', color: '#4d9a13', value: 'Page' }, - Button: { text: '按钮', color: '#97224f', value: 'Button' }, +export const SysPermissionsTypeEnum= { + 'Directory': {"text":"目录","color":"#6d7e14","value":"Directory"}, + 'Page': {"text":"页面","color":"#4d9a13","value":"Page"}, + 'Button': {"text":"按钮","color":"#97224f","value":"Button"}, }; // WechatAuthsPlatformEnum -export const WechatAuthsPlatformEnum = { - MiniProgram: { text: '微信小程序', color: '#3b82f6', value: 'MiniProgram' }, - MpOfficial: { text: '微信公众号', color: '#22c55e', value: 'MpOfficial' }, - WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, +export const WechatAuthsPlatformEnum= { + 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, + 'MpOfficial': {"text":"微信公众号","color":"#22c55e","value":"MpOfficial"}, + 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, }; + diff --git a/src/pages/asset/components/modals/ChargeStandardCreate.tsx b/src/pages/asset/components/modals/ChargeStandardCreate.tsx index e4aad78..a81d43e 100644 --- a/src/pages/asset/components/modals/ChargeStandardCreate.tsx +++ b/src/pages/asset/components/modals/ChargeStandardCreate.tsx @@ -68,6 +68,17 @@ export default function Create(props: MyBetaModalFormProps) { HouseChargeStandardsCalculationMethodEnum.PerUnit.value ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value : values?.price_algorithm, + tiered_rates: values.tiered_rates?.map((res: any) => { + return { + ...res, + }; + }), + // 避免计费模式切换导致的价格异常 + price: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? values.price + : 0, }) .then(() => { props.reload?.(); @@ -254,7 +265,7 @@ export default function Create(props: MyBetaModalFormProps) { ? [ { valueType: 'formList', - dataIndex: 'scheme', + dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, initialValue: [ @@ -275,7 +286,7 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 24 }, columns: [ { - key: 'start', + key: 'min_quantity', colProps: { span: 10 }, title: '起始值', valueType: 'number', @@ -292,7 +303,7 @@ export default function Create(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.number }, }, { - key: 'end', + key: 'max_quantity', colProps: { span: 6 }, title: '结束值', valueType: 'number', @@ -321,7 +332,7 @@ export default function Create(props: MyBetaModalFormProps) { ? [ { valueType: 'formList', - dataIndex: 'scheme', + dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, initialValue: [ @@ -342,7 +353,7 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 24 }, columns: [ { - key: 'start', + key: 'min_quantity', colProps: { span: 10 }, title: '起始值', valueType: 'number', @@ -359,7 +370,7 @@ export default function Create(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.number }, }, { - key: 'end', + key: 'max_quantity', colProps: { span: 6 }, title: '结束值', valueType: 'number', diff --git a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx index 902b672..6f9d9ae 100644 --- a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx +++ b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx @@ -69,6 +69,17 @@ export default function Update(props: MyBetaModalFormProps) { ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value : values?.price_algorithm, id: props?.item?.id, + tiered_rates: values.tiered_rates?.map((res: any) => { + return { + ...res, + }; + }), + // 避免计费模式切换导致的价格异常 + price: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? values.price + : 0, }) .then(() => { props.reload?.(); @@ -249,16 +260,16 @@ export default function Update(props: MyBetaModalFormProps) { ? [ { valueType: 'formList', - dataIndex: 'scheme', + dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, - initialValue: [ - { - start: 0, - end: null, - price: null, - }, - ], + // initialValue: [ + // { + // start: 0, + // end: null, + // price: null, + // }, + // ], fieldProps: { actionRef: actionRef, copyIconProps: false, @@ -270,7 +281,7 @@ export default function Update(props: MyBetaModalFormProps) { colProps: { span: 24 }, columns: [ { - key: 'start', + key: 'min_quantity', colProps: { span: 10 }, title: '起始值', valueType: 'number', @@ -287,7 +298,7 @@ export default function Update(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.number }, }, { - key: 'end', + key: 'max_quantity', colProps: { span: 6 }, title: '结束值', valueType: 'number', @@ -316,16 +327,16 @@ export default function Update(props: MyBetaModalFormProps) { ? [ { valueType: 'formList', - dataIndex: 'scheme', + dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, - initialValue: [ - { - start: 0, - end: null, - price: null, - }, - ], + // initialValue: [ + // { + // start: 0, + // end: null, + // price: null, + // }, + // ], fieldProps: { actionRef: actionRef, copyIconProps: false, @@ -337,7 +348,7 @@ export default function Update(props: MyBetaModalFormProps) { colProps: { span: 24 }, columns: [ { - key: 'start', + key: 'min_quantity', colProps: { span: 10 }, title: '起始值', valueType: 'number', @@ -354,7 +365,7 @@ export default function Update(props: MyBetaModalFormProps) { formItemProps: { ...rulesHelper.number }, }, { - key: 'end', + key: 'max_quantity', colProps: { span: 6 }, title: '结束值', valueType: 'number', diff --git a/src/pages/charge_standard/index.tsx b/src/pages/charge_standard/index.tsx index 0961704..b3e5ddd 100644 --- a/src/pages/charge_standard/index.tsx +++ b/src/pages/charge_standard/index.tsx @@ -126,7 +126,7 @@ export default function Index({ title = '收费标准' }) { ...item, }} reload={action?.reload} - title={'绑定房屋'} + title={'绑房'} /> diff --git a/src/pages/charge_standard/modals/ChargeCreate.tsx b/src/pages/charge_standard/modals/ChargeCreate.tsx index 5518869..19a8699 100644 --- a/src/pages/charge_standard/modals/ChargeCreate.tsx +++ b/src/pages/charge_standard/modals/ChargeCreate.tsx @@ -69,6 +69,17 @@ export default function Create(props: MyBetaModalFormProps) { HouseChargeStandardsCalculationMethodEnum.PerUnit.value ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value : values?.price_algorithm, + tiered_rates: values.tiered_rates?.map((res: any) => { + return { + ...res, + }; + }), + // 避免计费模式切换导致的价格异常 + price: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? values.price + : 0, }) .then(() => { props.reload?.(); @@ -261,7 +272,7 @@ export default function Create(props: MyBetaModalFormProps) { ? [ { valueType: 'formList', - dataIndex: 'scheme', + dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, initialValue: [ @@ -328,7 +339,7 @@ export default function Create(props: MyBetaModalFormProps) { ? [ { valueType: 'formList', - dataIndex: 'scheme', + dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, initialValue: [ diff --git a/src/pages/convenience_services/index.tsx b/src/pages/convenience_services/index.tsx new file mode 100644 index 0000000..59f2ca2 --- /dev/null +++ b/src/pages/convenience_services/index.tsx @@ -0,0 +1,115 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ConvenienceServicesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import BannerCreate from './modals/ServiceCreate'; +import ServiceUpdate from './modals/ServiceUpdate'; + +export default function Index({ title = '便民服务' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'convenience_services', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Common.ConvenienceServices.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: ConvenienceServicesTypeEnum, + search: false, + }), + { + title: '服务名称', + dataIndex: 'name', + }, + + { + title: '联系方式', + render(_, record) { + const content = record?.content || []; + + // 过滤有效数据 + const validItems = content.filter( + (item: any) => item?.name && item?.phone, + ); + + return ( +
+ {validItems.length > 0 ? ( + validItems.map((item: any, index: number) => ( + // 每个客户信息单独一行 +
+ {item.name}: {item.phone} +
+ )) + ) : ( + 暂无客户信息 + )} +
+ ); + }, + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Common.ConvenienceServices.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/convenience_services/modals/ServiceCreate.tsx b/src/pages/convenience_services/modals/ServiceCreate.tsx new file mode 100644 index 0000000..ed5a013 --- /dev/null +++ b/src/pages/convenience_services/modals/ServiceCreate.tsx @@ -0,0 +1,109 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ConvenienceServicesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`添加便民服务`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Common.ConvenienceServices.Store(values) + .then(() => { + props.reload?.(); + message.success('添加便民服务成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: ConvenienceServicesTypeEnum, + required: true, + }), + { + key: 'name', + title: '名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'formList', + dataIndex: 'content', + title: '服务内容', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + name: null, + phone: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'name', + colProps: { span: 12 }, + // title: '服务名称', + fieldProps: { + addonBefore: '联系对象', + }, + width: '100%', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + colProps: { span: 12 }, + // title: '阶梯单价', + fieldProps: { + addonBefore: '联系电话', + }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/convenience_services/modals/ServiceUpdate.tsx b/src/pages/convenience_services/modals/ServiceUpdate.tsx new file mode 100644 index 0000000..9cfb066 --- /dev/null +++ b/src/pages/convenience_services/modals/ServiceUpdate.tsx @@ -0,0 +1,112 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ConvenienceServicesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`编辑便民服务`} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Common.ConvenienceServices.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑便民服务成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: ConvenienceServicesTypeEnum, + required: true, + }), + { + key: 'name', + title: '名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'formList', + dataIndex: 'content', + title: '服务内容', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + name: null, + phone: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'name', + colProps: { span: 12 }, + // title: '服务名称', + fieldProps: { + addonBefore: '联系对象', + }, + width: '100%', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + colProps: { span: 12 }, + // title: '阶梯单价', + fieldProps: { + addonBefore: '联系电话', + }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + ]} + /> + ); +} From 036c7b4118aacadbbd4d34b3dafbb693f6b79f0d Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Wed, 3 Sep 2025 09:25:23 +0800 Subject: [PATCH 8/9] =?UTF-8?q?feat=EF=BC=9A=E6=88=BF=E5=B1=8B=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyExport.tsx | 45 ++++++++++++++ src/pages/announcement/index.tsx | 10 +-- src/pages/asset/index.tsx | 2 +- src/pages/asset_houses/index.tsx | 61 ++++++++++++++----- .../modals/ReceiptAccountCreate.tsx | 2 +- .../modals/ReceiptAccountUpdate.tsx | 1 + 6 files changed, 98 insertions(+), 23 deletions(-) create mode 100644 src/components/MyExport.tsx diff --git a/src/components/MyExport.tsx b/src/components/MyExport.tsx new file mode 100644 index 0000000..d9363fe --- /dev/null +++ b/src/components/MyExport.tsx @@ -0,0 +1,45 @@ +import { Button, Dropdown, MenuProps } from 'antd'; + +export const MyExport = (props: any) => { + const items: MenuProps['items'] = [ + { + key: '1', + label: '当前页(含查询条件)', + onClick: () => + props?.keyParams + ? props?.download?.({ download_type: 'page', ...props?.item }) + : props?.download?.Export?.({ + download_type: 'page', + ...props?.item, + }), + }, + { + key: '2', + label: '所有页(含查询条件)', + onClick: () => + props?.keyParams + ? props?.download?.({ download_type: 'query', ...props?.item }) + : props?.download?.Export?.({ + download_type: 'query', + ...props?.item, + }), + }, + { + key: '3', + label: '所有记录', + onClick: () => + props?.keyParams + ? props?.download?.({ download_type: 'all', ...props?.item }) + : props?.download?.Export?.({ + download_type: 'all', + ...props?.item, + }), + }, + ]; + + return ( + + + + ); +}; diff --git a/src/pages/announcement/index.tsx b/src/pages/announcement/index.tsx index f35b691..d3d6327 100644 --- a/src/pages/announcement/index.tsx +++ b/src/pages/announcement/index.tsx @@ -13,12 +13,12 @@ import AnnouncementCreate from './modals/AnnouncementCreate'; import AnnouncementShow from './modals/AnnouncementShow'; import AnnouncementUpdate from './modals/AnnouncementUpdate'; -export default function Index({ title = '内容管理' }) { +export default function Index({ title = '公告管理' }) { const navigate = useNavigate(); // 注册当前页面为标签页 usePageTabs({ - tabKey: 'banners', + tabKey: 'Msg', tabLabel: title, }); @@ -131,9 +131,9 @@ export default function Index({ title = '内容管理' }) { /> - Apis.Banner.Banners.Delete({ id: item.id }).then(() => - action?.reload(), - ) + Apis.Msg.MsgPropertyAnnouncements.Delete({ + id: item.id, + }).then(() => action?.reload()) } /> diff --git a/src/pages/asset/index.tsx b/src/pages/asset/index.tsx index de28134..c36d0c1 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -109,7 +109,7 @@ export default function Index({ title = '项目列表' }) { { navigate(`/asset/${item.id}`); }} diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index 7153260..bb6fc6c 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -1,22 +1,26 @@ import { + MyButtons, MyColumns, MyPageContainer, MyProTableProps, usePageTabs, } from '@/common'; +import { MyExport } from '@/components/MyExport'; import { Apis } from '@/gen/Apis'; import { - AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; +import { useState } from 'react'; import HousesShow from '../asset/components/modals/HousesShow'; import HousesUpdate from '../asset/components/modals/HousesUpdate'; export default function Index({ title = '房屋列表' }) { + const [getParams, setParams] = useState({}); + const navigate = useNavigate(); // 注册当前页面为标签页 usePageTabs({ @@ -27,9 +31,21 @@ export default function Index({ title = '房屋列表' }) { - MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List) - } + request={async (params, sort) => { + setParams(params); + return MyProTableProps.request( + params, + sort, + Apis.Asset.AssetHouses.List, + ); + }} + toolBarRender={() => [ + , + ]} columns={[ MyColumns.ID(), { @@ -64,7 +80,9 @@ export default function Index({ title = '房屋列表' }) { title: '建筑面积', dataIndex: 'built_area', render(_, record) { - return `${record?.built_area || ''} m²`; + return `${ + record?.built_area ? record?.built_area + ' m²' : '-' + } `; }, search: false, }, @@ -72,7 +90,9 @@ export default function Index({ title = '房屋列表' }) { title: '套内面积', dataIndex: 'inside_area', render(_, record) { - return `${record?.inside_area || ''} m²`; + return `${ + record?.inside_area ? record?.inside_area + ' m²' : '-' + } `; }, search: false, }, @@ -80,25 +100,27 @@ export default function Index({ title = '房屋列表' }) { title: '计费面积', dataIndex: 'chargeable_area', render(_, record) { - return `${record?.chargeable_area || ''} m²`; + return `${ + record?.chargeable_area ? record?.chargeable_area + ' m²' : '-' + } `; }, search: false, }, { title: '户型', render(_, record) { - return `${record?.room || ''}室${record?.hall || ''}厅${ - record?.bathroom || '' - }卫${record?.kitchen || ''}厨${record?.balcony || ''}阳台`; + return `${record?.room || 'x'}室${record?.hall || 'x'}厅${ + record?.bathroom || 'x' + }卫${record?.kitchen || 'x'}厨${record?.balcony || 'x'}阳台`; }, search: false, }, - MyColumns.EnumTag({ - title: '朝向', - dataIndex: 'orientation', - valueEnum: AssetHousesOrientationEnum, - search: false, - }), + // MyColumns.EnumTag({ + // title: '朝向', + // dataIndex: 'orientation', + // valueEnum: AssetHousesOrientationEnum, + // search: false, + // }), // MyColumns.EnumTag({ // title: '房屋状态', // dataIndex: 'status', @@ -129,6 +151,13 @@ export default function Index({ title = '房屋列表' }) { reload={action?.reload} title="编辑" /> + + Apis.Asset.AssetHouses.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> ), }), diff --git a/src/pages/company/components/modals/ReceiptAccountCreate.tsx b/src/pages/company/components/modals/ReceiptAccountCreate.tsx index 14af4f1..0525449 100644 --- a/src/pages/company/components/modals/ReceiptAccountCreate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountCreate.tsx @@ -30,7 +30,7 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Company.CompanyReceiptAccounts.Store({ ...values, companies_id: props?.item?.id, - is_default: values.is_default ? 1 : 0, + is_default: 0, }) .then(() => { props.reload?.(); diff --git a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx index 67ecbcf..9ce19ba 100644 --- a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx @@ -31,6 +31,7 @@ export default function Update(props: MyBetaModalFormProps) { ...values, companies_id: props?.item?.companies_id, id: props.item?.id ?? 0, + is_default: 0, }) .then(() => { props.reload?.(); From 0704cfd063ac32aaa1a361118859e0d6e0e6af03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BA=AD?= Date: Fri, 5 Sep 2025 09:08:37 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20ci/cd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 46 +++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e25ea88..608fc34 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,10 +12,6 @@ env: jobs: build: runs-on: ubuntu-latest - container: - image: zuogeus/act-ubuntu:node18 - options: --add-host nexus.zzwb.cc:192.168.2.7 - steps: - name: Setup Environments shell: bash @@ -25,54 +21,54 @@ jobs: echo "IMAGE_NAME=${{ vars.REGISTRY_URL }}/${{ vars.REGISTRY_NAMESPACE }}/$REPO:$GITHUB_REF_NAME" >> $GITHUB_ENV - name: Checkout - uses: https://gitee.com/zuowenbo/checkout@v4.1.1 + uses: https://gitee.com/zuowenbo/checkout@v4.2.2 - - name: Get npm cache directory - id: npm-cache-dir - shell: bash - run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} - - - name: Set node_modules cache - uses: https://gitee.com/zuowenbo/cache@v4.0.0 - id: npm-cache + - name: Cache Docker layers + uses: https://gitee.com/zuowenbo/cache@v4.2.1 with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-umi4-${{ hashFiles('**/package-lock.json') }} + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ env.REPO_NAME }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-node-umi4- - - - run: npm install --registry=https://registry.npmmirror.com - - run: npm run build + ${{ runner.os }}-buildx-${{ env.REPO_NAME }}- - name: Set up Docker Buildx - uses: https://gitee.com/zuowenbo/setup-buildx-action@v3.0.0 + uses: https://gitee.com/zuowenbo/setup-buildx-action@v3.9.0 with: - driver-opts: network=host + driver-opts: image=registry.cn-shenzhen.aliyuncs.com/zuoge-proxy/buildkit:buildx-stable-1 - name: Login to Docker Hub - uses: https://gitee.com/zuowenbo/login-action@v3.0.0 + uses: https://gitee.com/zuowenbo/login-action@v3.3.0 with: registry: ${{ vars.REGISTRY_URL }} username: ${{ vars.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Build and push final image - uses: https://gitee.com/zuowenbo/build-push-action@v5.1.0 + uses: https://gitee.com/zuowenbo/build-push-action@v6.14.0 with: context: . tags: ${{ env.IMAGE_NAME }} push: true + platforms: linux/amd64 build-args: BRANCH=${{ env.GITHUB_REF_NAME }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache - name: Deploy to remote uses: https://gitee.com/zuowenbo/ssh-action@v1.0.3 with: - host: ${{ vars.LOAN_MAIN_HOST_IP_PHP }} + host: ${{ vars.MAIN_HOST_IP }} port: 22 username: 'root' - password: ${{ secrets.LOAN_MAIN_HOST_PASSWORD }} + password: ${{ secrets.MAIN_HOST_PASSWORD }} script: | docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_URL}} + docker volume create ${{ env.REPO_NAME }} || true docker pull ${{ env.IMAGE_NAME }} docker stop ${{ env.REPO_NAME }} || true docker rm ${{ env.REPO_NAME }} || true