From 8f9c9fc6a178e48f3b005af0b9bea92dc894e06f Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Tue, 2 Sep 2025 16:22:57 +0800 Subject: [PATCH] =?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