From 3d3e5c260cbc99604d32ec1e519b352de895ee6b Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Thu, 10 Jul 2025 18:01:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=88=BF=E5=B1=8B=E7=99=BB=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/rulesHelper.ts | 21 + src/components/Select.tsx | 34 ++ src/gen/ApiTypes.d.ts | 10 +- src/gen/Apis.ts | 5 +- src/gen/Enums.ts | 439 +++++++++++------- src/pages/archive/asset_house/$id.tsx | 46 ++ .../asset_house/components/HouseInfo.tsx | 71 +++ src/pages/archive/asset_house/index.tsx | 119 +++++ .../asset_house/modals/AddOccupant.tsx | 220 +++++++++ .../asset_house/modals/Delivery.tsx} | 127 ++--- .../archive/asset_house/modals/MoveOut.tsx | 48 ++ .../archive/asset_house/modals/Transfer.tsx | 179 +++++++ .../archive/asset_house/modals/Update.tsx | 151 ++++++ .../asset_house/table/OccupantsNow.tsx | 109 +++++ .../components/AssetBuildings.tsx | 46 +- .../asset_projects/components/AssetInfo.tsx | 8 +- .../asset_projects/modals/AssetUpdate.tsx | 9 +- .../asset_projects/modals/BindCompany.tsx | 51 ++ .../asset_projects/modals/HousesCreate.tsx | 4 +- .../asset_projects/modals/HousesUpdate.tsx | 1 - .../companies/components/ComponentsInfo.tsx | 15 +- .../companies/components/Employees.tsx | 17 +- .../companies/components/Positions.tsx | 14 +- .../company/companies/components/Projects.tsx | 108 +++-- .../companies/modals/EmployeesCreate.tsx | 32 +- .../companies/modals/EmployeesUpdate.tsx | 21 +- src/pages/company/companies/modals/Update.tsx | 33 +- src/pages/{company => }/employees/index.tsx | 27 +- .../{company => }/employees/modals/Create.tsx | 30 +- .../{company => }/employees/modals/Update.tsx | 17 +- src/pages/{archive => }/house_bills/index.tsx | 82 ++-- .../house_bills/modals/Create.tsx | 89 +++- .../house_bills/modals/Update.tsx | 48 +- 33 files changed, 1761 insertions(+), 470 deletions(-) create mode 100644 src/pages/archive/asset_house/$id.tsx create mode 100644 src/pages/archive/asset_house/components/HouseInfo.tsx create mode 100644 src/pages/archive/asset_house/index.tsx create mode 100644 src/pages/archive/asset_house/modals/AddOccupant.tsx rename src/pages/{asset/asset_projects/modals/RegistersCreate.tsx => archive/asset_house/modals/Delivery.tsx} (62%) create mode 100644 src/pages/archive/asset_house/modals/MoveOut.tsx create mode 100644 src/pages/archive/asset_house/modals/Transfer.tsx create mode 100644 src/pages/archive/asset_house/modals/Update.tsx create mode 100644 src/pages/archive/asset_house/table/OccupantsNow.tsx create mode 100644 src/pages/asset/asset_projects/modals/BindCompany.tsx rename src/pages/{company => }/employees/index.tsx (88%) rename src/pages/{company => }/employees/modals/Create.tsx (75%) rename src/pages/{company => }/employees/modals/Update.tsx (86%) rename src/pages/{archive => }/house_bills/index.tsx (69%) rename src/pages/{archive => }/house_bills/modals/Create.tsx (58%) rename src/pages/{archive => }/house_bills/modals/Update.tsx (84%) diff --git a/src/common/utils/rulesHelper.ts b/src/common/utils/rulesHelper.ts index 2d9ff1e..e2c27ef 100644 --- a/src/common/utils/rulesHelper.ts +++ b/src/common/utils/rulesHelper.ts @@ -13,6 +13,27 @@ export const rulesHelper = { }), ] as Rule[], }, + + phone: { + required: true, + rules: [ + () => ({ + validator(_, value) { + let phoneRegex = /^1[3-9]\d{9}$/; + if (!value) { + return Promise.reject(new Error('请输入手机号')); + } + if (value?.length !== 11) { + return Promise.reject(new Error('手机号至少11位')); + } + if (!phoneRegex.test(value)) { + return Promise.reject(new Error('请输入正确的手机号')); + } + return Promise.resolve(); + }, + }), + ] as Rule[], + }, upload(props?: { max?: number; errMsg?: string }) { return { required: true, diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 97953a5..d98c0ed 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -250,6 +250,40 @@ export const Selects = { }, }; }, + //岗位 + Positions(props?: PropsType): ReturnType { + const { + title = '岗位', + key = 'positions_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => + ( + await Apis.Company.CompanyPositions.Select({ + keywords: params?.KeyWords, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, //项目 AssetProjects(props?: PropsType): ReturnType { const { diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 56c9a04..48f4343 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -2,8 +2,8 @@ declare namespace ApiTypes { namespace Archive { namespace HouseOccupants { type List = { - "asset_houses_id": number; // 资产房屋ID - "status"?: number; // 状态,[enum:HouseOccupantsStatusEnum] + "asset_houses_id"?: number; // 资产房屋ID + "status"?: string; // 状态,[enum:HouseOccupantsStatusEnum] }; type Show = { "id": number; // id @@ -23,6 +23,7 @@ declare namespace ApiTypes { "usage_plan"?: string; // 使用计划,[enum:HouseRegistersUsagePlanEnum] "customer_type"?: string; // 客户类型,[enum:HouseRegistersCustomerTypeEnum] "customer_info"?: string[]; // 客户信息 + "ownership_info"?: string[]; // 产权信息 }; type Update = { "id": number; // id @@ -32,6 +33,7 @@ declare namespace ApiTypes { "usage_plan"?: string; // 使用计划,[enum:HouseRegistersUsagePlanEnum] "customer_type"?: string; // 客户类型,[enum:HouseRegistersCustomerTypeEnum] "customer_info"?: string[]; // 客户信息 + "ownership_info"?: string[]; // 产权信息 }; type Show = { "id": number; // id @@ -193,6 +195,10 @@ declare namespace ApiTypes { "takeover_date"?: Date; // 接管日期 "closure_date"?: Date; // 封园日期 }; + type BindCompany = { + "projects_id": number; // 项目id + "companies_id": number; // 机构id + }; type Show = { "id": number; // id }; diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 1545535..912d9da 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -4,7 +4,7 @@ import { request } from '@umijs/max'; export const Apis = { Archive: { HouseOccupants: { - List(data: ApiTypes.Archive.HouseOccupants.List): Promise { + List(data?: ApiTypes.Archive.HouseOccupants.List): Promise { return request('admin/archive/house_occupants/list', { data }); }, Show(data: ApiTypes.Archive.HouseOccupants.Show): Promise { @@ -89,6 +89,9 @@ export const Apis = { Update(data: ApiTypes.Asset.AssetProjects.Update): Promise { return request('admin/asset/asset_projects/update', { data }); }, + BindCompany(data: ApiTypes.Asset.AssetProjects.BindCompany): Promise { + return request('admin/asset/asset_projects/bind_company', { data }); + }, Show(data: ApiTypes.Asset.AssetProjects.Show): Promise { return request('admin/asset/asset_projects/show', { data }); }, diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index a1836a6..69946e7 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -1,242 +1,371 @@ // 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', + }, }; // 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' }, +}; + +// 缓存类型 +export const CacheTypeEnum = { + MobilePhoneVerificationCode: { + text: '手机验证码', + color: '#3be235', + 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' }, +}; + +// CompanyAppsModuleEnum +export const CompanyAppsModuleEnum = { + Employee: { text: '员工端', color: '#3b82f6', value: 'Employee' }, + Customer: { text: '客户端', color: '#10b981', value: 'Customer' }, }; // 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' }, }; // 账单状态枚举 -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', + }, }; // 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"}, - 'Resident': {"text":"住户","color":"#87d068","value":"Resident"}, - 'Tenant': {"text":"租户","color":"#fa8c16","value":"Tenant"}, +export const HouseOccupantsHouseRelationEnum = { + Owner: { text: '产权人', color: '#2db7f5', value: 'Owner' }, + Resident: { text: '住户', color: '#87d068', value: 'Resident' }, + Tenant: { text: '租客', color: '#fa8c16', value: 'Tenant' }, }; // HouseOccupantsRelationWithOwnerEnum -export const HouseOccupantsRelationWithOwnerEnum= { - 'Self': {"text":"本人","color":"#52c41a","value":"Self"}, - 'Spouse': {"text":"夫妻","color":"#2db7f5","value":"Spouse"}, - 'FatherSon': {"text":"父子","color":"#faad14","value":"FatherSon"}, - 'MotherSon': {"text":"母子","color":"#fa8c16","value":"MotherSon"}, - 'Children': {"text":"子女","color":"#87d068","value":"Children"}, - 'ContactPerson': {"text":"指定联系人","color":"#f5222d","value":"ContactPerson"}, +export const HouseOccupantsRelationWithOwnerEnum = { + Self: { text: '本人', color: '#52c41a', value: 'Self' }, + Spouse: { text: '夫妻', color: '#2db7f5', value: 'Spouse' }, + FatherSon: { text: '父子', color: '#faad14', value: 'FatherSon' }, + MotherSon: { text: '母子', color: '#fa8c16', value: 'MotherSon' }, + Children: { text: '子女', color: '#87d068', value: 'Children' }, + ContactPerson: { + text: '指定联系人', + color: '#f5222d', + value: 'ContactPerson', + }, }; // 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"}, +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' }, }; // 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' }, }; // 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= { - 'Delivery': {"text":"交付登记","color":"#2db7f5","value":"Delivery"}, - 'Transfer': {"text":"过户登记","color":"#87d068","value":"Transfer"}, - 'AddOccupant': {"text":"添加住户","color":"#108ee9","value":"AddOccupant"}, +export const HouseRegistersTypeEnum = { + Delivery: { text: '交付登记', color: '#2db7f5', value: 'Delivery' }, + Transfer: { text: '过户登记', color: '#87d068', value: 'Transfer' }, + AddOccupant: { text: '添加住户', color: '#108ee9', value: 'AddOccupant' }, + MoveOut: { text: '搬离登记', color: '#f50', value: 'MoveOut' }, }; // 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' }, }; // 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' }, +}; diff --git a/src/pages/archive/asset_house/$id.tsx b/src/pages/archive/asset_house/$id.tsx new file mode 100644 index 0000000..6b514e4 --- /dev/null +++ b/src/pages/archive/asset_house/$id.tsx @@ -0,0 +1,46 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProCard } from '@ant-design/pro-components'; +import { useParams } from '@umijs/max'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import HouseInfo from './components/HouseInfo'; +import OccupantsNow from './table/OccupantsNow'; + +export default function Show({ title = '房屋详情' }) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.Asset.AssetHouses.Show(paramsId).then((res) => { + setShow(res?.data); + }); + }; + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '当前信息', + key: '1', + closable: false, + children: loadShow()} />, + }, + { + label: '历史信息', + key: '2', + closable: false, + // children: , + }, + ]; + + return ( + + + + + + + ); +} diff --git a/src/pages/archive/asset_house/components/HouseInfo.tsx b/src/pages/archive/asset_house/components/HouseInfo.tsx new file mode 100644 index 0000000..001e3ff --- /dev/null +++ b/src/pages/archive/asset_house/components/HouseInfo.tsx @@ -0,0 +1,71 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { + AssetHousesOrientationEnum, + AssetHousesOwnershipTypeEnum, + AssetHousesStatusEnum, + AssetHousesUsageEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + return ( + + + + + {props?.item?.full_name} + + + {props?.item?.name} + + + {props?.item?.floor}层 + + + + + + + + + {props?.item?.built_area}m² + + + {props?.item?.inside_area}m² + + + {props?.item?.chargeable_area}m² + + + + + + {props?.item?.room || ''}房{props?.item?.hall || ''}厅 + {props?.item?.bathroom || ''}卫{props?.item?.kitchen || ''}厨 + {props?.item?.balcony || ''}阳台 + + + + + + + + ); +} diff --git a/src/pages/archive/asset_house/index.tsx b/src/pages/archive/asset_house/index.tsx new file mode 100644 index 0000000..0374cc7 --- /dev/null +++ b/src/pages/archive/asset_house/index.tsx @@ -0,0 +1,119 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + AssetHousesOwnershipTypeEnum, + AssetHousesStatusEnum, + AssetHousesUsageEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import Delivery from './modals/Delivery'; + +export default function Index({ title = '房屋档案' }) { + const navigate = useNavigate(); + + return ( + + + MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List) + } + columns={[ + MyColumns.ID(), + MyColumns.EnumTag({ + title: '产权性质', + dataIndex: 'ownership_type', + valueEnum: AssetHousesOwnershipTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '用途', + dataIndex: 'usage', + valueEnum: AssetHousesUsageEnum, + search: false, + width: 80, + }), + { + title: '房屋名称', + dataIndex: 'full_name', + }, + { + title: '楼层', + dataIndex: 'floor', + render(_, record) { + return `${record?.floor}层`; + }, + search: false, + width: 60, + }, + { + title: '建筑面积', + dataIndex: 'built_area', + render(_, record) { + return `${record?.built_area} m²`; + }, + search: false, + width: 80, + }, + { + title: '套内面积', + dataIndex: 'inside_area', + render(_, record) { + return `${record?.inside_area} m²`; + }, + search: false, + width: 80, + }, + { + title: '计费面积', + dataIndex: 'chargeable_area', + render(_, record) { + return `${record?.chargeable_area} m²`; + }, + search: false, + width: 80, + }, + + MyColumns.EnumTag({ + title: '房屋状态', + dataIndex: 'status', + valueEnum: AssetHousesStatusEnum, + search: false, + }), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + {/* + */} + { + navigate(`/archive/asset_house/${item.id}`); + }} + /> + {!item?.house_occupants?.length && ( + + )} + + Apis.Asset.AssetBuildings.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/archive/asset_house/modals/AddOccupant.tsx b/src/pages/archive/asset_house/modals/AddOccupant.tsx new file mode 100644 index 0000000..82fc9a3 --- /dev/null +++ b/src/pages/archive/asset_house/modals/AddOccupant.tsx @@ -0,0 +1,220 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}`} + wrapperCol={{ span: 24 }} + width="900px" + form={form} + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Archive.HouseRegisters.Store({ + ...values, + asset_houses_id: props?.item?.id, + type: 'AddOccupant', + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + valueType: 'formList', + dataIndex: 'customer_info', + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + creatorButtonProps: { + creatorButtonText: '添加住户', + style: { color: 'red' }, + danger: true, + }, + itemRender: ( + { listDom, action }: any, + { index }: { index: number }, + ) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'house_relation', + title: '住户类型', + colProps: { span: 4 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseOccupantsHouseRelationEnum), + ); + delete obj.Owner; + return obj; + }, + required: true, + }), + { + name: ['house_relation'], + valueType: 'dependency', + columns: ({ house_relation }: any) => { + return house_relation === 'Resident' + ? [ + MyFormItems.EnumRadio({ + key: 'relation_with_owner', + title: '住户类型', + colProps: { span: 12 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseOccupantsRelationWithOwnerEnum, + ), + ); + delete obj.Self; + delete obj.ContactPerson; + return obj; + }, + required: true, + }), + ] + : [ + MyFormItems.EnumRadio({ + key: 'relation_with_owner', + title: '住户类型', + colProps: { span: 12 }, + // valueEnum: HouseOccupantsRelationWithOwnerEnum, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseOccupantsRelationWithOwnerEnum, + ), + ); + delete obj.ContactPerson; + return obj; + }, + required: true, + }), + ]; + }, + }, + { + title: '是否入住', + dataIndex: 'is_live_in', + colProps: { span: 4 }, + valueType: 'switch', + }, + { + name: ['is_live_in'], + valueType: 'dependency', + columns: ({ is_live_in }: any) => { + return is_live_in + ? [ + { + title: '入住日期', + dataIndex: 'move_in_date', + valueType: 'date', + colProps: { span: 4 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : [,]; + }, + }, + { + title: '姓名', + dataIndex: 'name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 6 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 6 }, + fieldProps: { + maxLength: 18, + }, + formItemProps: { ...rulesHelper.text }, + }, + + { + valueType: 'group', + columns: [ + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + max: 1, + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + max: 1, + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/asset/asset_projects/modals/RegistersCreate.tsx b/src/pages/archive/asset_house/modals/Delivery.tsx similarity index 62% rename from src/pages/asset/asset_projects/modals/RegistersCreate.tsx rename to src/pages/archive/asset_house/modals/Delivery.tsx index 46996dd..c292a2b 100644 --- a/src/pages/asset/asset_projects/modals/RegistersCreate.tsx +++ b/src/pages/archive/asset_house/modals/Delivery.tsx @@ -8,11 +8,8 @@ import { import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, - HouseOccupantsHouseRelationEnum, - HouseOccupantsRelationWithOwnerEnum, HouseRegistersCustomerTypeEnum, HouseRegistersHouseStatusEnum, - HouseRegistersTypeEnum, HouseRegistersUsagePlanEnum, } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; @@ -39,6 +36,7 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Archive.HouseRegisters.Store({ ...values, asset_houses_id: props?.item?.id, + type: 'Delivery', }) .then(() => { props.reload?.(); @@ -49,11 +47,23 @@ export default function Create(props: MyBetaModalFormProps) { } columns={[ MyFormItems.EnumRadio({ - key: 'type', - title: '类型', - colProps: { span: 24 }, - valueEnum: HouseRegistersTypeEnum, - required: true, + key: 'customer_type', + title: '客户类型', + colProps: { span: 12 }, + valueEnum: HouseRegistersCustomerTypeEnum, + }), + MyFormItems.EnumRadio({ + key: 'house_status', + title: '房屋状态', + colProps: { span: 6 }, + valueEnum: HouseRegistersHouseStatusEnum, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.EnumSelect({ + key: 'usage_plan', + title: '使用计划', + colProps: { span: 6 }, + valueEnum: HouseRegistersUsagePlanEnum, }), { valueType: 'formList', @@ -62,7 +72,9 @@ export default function Create(props: MyBetaModalFormProps) { fieldProps: { copyIconProps: false, creatorButtonProps: { - creatorButtonText: '添加客户', + creatorButtonText: '增加产权人', + style: { color: 'red' }, + danger: true, }, itemRender: ( { listDom, action }: any, @@ -72,7 +84,7 @@ export default function Create(props: MyBetaModalFormProps) { @@ -88,125 +100,78 @@ export default function Create(props: MyBetaModalFormProps) { { title: '姓名', dataIndex: 'name', - colProps: { span: 8 }, + colProps: { span: 12 }, formItemProps: { ...rulesHelper.text }, }, { title: '手机号', dataIndex: 'phone', - colProps: { span: 8 }, + colProps: { span: 6 }, fieldProps: { maxLength: 11, }, formItemProps: { ...rulesHelper.text }, }, - MyFormItems.EnumSelect({ - key: 'house_relation', - title: '房客关系', - colProps: { span: 8 }, - valueEnum: HouseOccupantsHouseRelationEnum, - required: true, - }), - { - title: '客户地址', - dataIndex: 'address', - colProps: { span: 8 }, - formItemProps: { ...rulesHelper.text }, - }, - { - title: '解除时间', - dataIndex: 'unbound_time', - colProps: { span: 8 }, - valueType: 'date', + title: '备用手机号', + dataIndex: 'reserve_phone', + colProps: { span: 6 }, fieldProps: { - style: { width: '100%' }, + maxLength: 11, }, - formItemProps: { ...rulesHelper.text }, }, - MyFormItems.EnumSelect({ - key: 'relation_with_owner', - title: '与产权人关系', - colProps: { span: 8 }, - valueEnum: HouseOccupantsRelationWithOwnerEnum, - required: true, - }), MyFormItems.EnumSelect({ key: 'card_type', title: '证件类型', - colProps: { span: 8 }, + colProps: { span: 12 }, valueEnum: HouseOccupantsCardTypeEnum, required: true, }), { title: '证件号码', dataIndex: 'id_card', - colProps: { span: 8 }, + colProps: { span: 12 }, fieldProps: { maxLength: 18, }, formItemProps: { ...rulesHelper.text }, }, - { - title: '是否在居住中', - dataIndex: 'is_live_in', - colProps: { span: 8 }, - valueType: 'switch', - }, + + // { + // title: '是否在居住中', + // dataIndex: 'is_live_in', + // colProps: { span: 8 }, + // valueType: 'switch', + // }, { valueType: 'group', columns: [ MyFormItems.UploadImages({ key: 'card_front_image', - title: '身份证正面', + title: '证件正面', max: 1, - colProps: { span: 8 }, + colProps: { span: 4 }, formItemProps: { ...rulesHelper.text }, }), MyFormItems.UploadImages({ key: 'card_back_image', - title: '身份证反面', + title: '证件反面', max: 1, - colProps: { span: 8 }, + colProps: { span: 4 }, formItemProps: { ...rulesHelper.text }, }), ], }, - MyFormItems.UploadImages({ - key: 'ownership_info', - title: '产权信息', - max: 100, - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.array }, - }), ], }, ], }, - - MyFormItems.EnumRadio({ - key: 'customer_type', - title: '客户类型', + MyFormItems.UploadImages({ + key: 'ownership_info', + title: '产权文件', + max: 100, colProps: { span: 24 }, - valueEnum: HouseRegistersCustomerTypeEnum, - }), - MyFormItems.EnumRadio({ - key: 'usage_plan', - title: '使用计划', - colProps: { span: 24 }, - valueEnum: HouseRegistersUsagePlanEnum, - }), - // MyFormItems.EnumRadio({ - // key: 'status', - // title: '状态', - // colProps: { span: 24 }, - // valueEnum: HouseRegistersStatusEnum, - // }), - MyFormItems.EnumRadio({ - key: 'house_status', - title: '房屋状态', - colProps: { span: 24 }, - valueEnum: HouseRegistersHouseStatusEnum, + formItemProps: { ...rulesHelper.array }, }), ]} /> diff --git a/src/pages/archive/asset_house/modals/MoveOut.tsx b/src/pages/archive/asset_house/modals/MoveOut.tsx new file mode 100644 index 0000000..e58e608 --- /dev/null +++ b/src/pages/archive/asset_house/modals/MoveOut.tsx @@ -0,0 +1,48 @@ +import { MyBetaModalFormProps, MyButtons, MyModalFormProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="500px" + form={form} + trigger={ + + } + onFinish={async (values) => + Apis.Archive.HouseRegisters.Store({ + ...values, + asset_houses_id: props?.item?.id, + type: 'MoveOut', + customer_info: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '搬离日期', + valueType: 'date', + dataIndex: '', + colProps: { span: 24 }, + fieldProps: { + maxLength: 11, + style: { + width: '100%', + }, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/archive/asset_house/modals/Transfer.tsx b/src/pages/archive/asset_house/modals/Transfer.tsx new file mode 100644 index 0000000..27d7ffd --- /dev/null +++ b/src/pages/archive/asset_house/modals/Transfer.tsx @@ -0,0 +1,179 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseRegistersCustomerTypeEnum, + HouseRegistersHouseStatusEnum, + HouseRegistersUsagePlanEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}`} + wrapperCol={{ span: 24 }} + width="900px" + form={form} + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Archive.HouseRegisters.Store({ + ...values, + asset_houses_id: props?.item?.id, + type: 'Transfer', + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'customer_type', + title: '客户类型', + colProps: { span: 12 }, + valueEnum: HouseRegistersCustomerTypeEnum, + }), + MyFormItems.EnumRadio({ + key: 'house_status', + title: '房屋状态', + colProps: { span: 6 }, + valueEnum: HouseRegistersHouseStatusEnum, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.EnumSelect({ + key: 'usage_plan', + title: '使用计划', + colProps: { span: 6 }, + valueEnum: HouseRegistersUsagePlanEnum, + }), + { + valueType: 'formList', + dataIndex: 'customer_info', + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + creatorButtonProps: { + creatorButtonText: '增加产权人', + style: { color: 'red' }, + danger: true, + }, + itemRender: ( + { listDom, action }: any, + { index }: { index: number }, + ) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'group', + columns: [ + { + title: '姓名', + dataIndex: 'name', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '备用手机号', + dataIndex: 'reserve_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 12 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 12 }, + fieldProps: { + maxLength: 18, + }, + formItemProps: { ...rulesHelper.text }, + }, + + // { + // title: '是否在居住中', + // dataIndex: 'is_live_in', + // colProps: { span: 8 }, + // valueType: 'switch', + // }, + { + valueType: 'group', + columns: [ + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + max: 1, + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + max: 1, + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + ], + }, + ], + }, + MyFormItems.UploadImages({ + key: 'ownership_info', + title: '产权文件', + max: 100, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + ]} + /> + ); +} diff --git a/src/pages/archive/asset_house/modals/Update.tsx b/src/pages/archive/asset_house/modals/Update.tsx new file mode 100644 index 0000000..b5d92cf --- /dev/null +++ b/src/pages/archive/asset_house/modals/Update.tsx @@ -0,0 +1,151 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Address } from '@/components/Address'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + AssetProjectsChargeEnum, + AssetProjectsEntrustTypeEnum, + AssetProjectsPropertyTypeEnum, + AssetProjectsStatusEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="800px" + request={() => + Promise.resolve({ + ...props.item, + casacader: [ + props.item?.province_id || '', + props.item?.city_id || '', + props.item?.area_id || '', + props.item?.street_id || '', + ], + }) + } + onFinish={async (values) => + Apis.Archive.HouseRegisters.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '项目名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'alias_name', + title: '项目别名', + colProps: { span: 6 }, + }, + Selects?.Companies({ + key: 'companies_id', + title: '所属机构', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.number }, + }), + // { + // key: 'code', + // title: '项目编码', + // colProps: { span: 8 }, + // formItemProps: { ...rulesHelper.text }, + // }, + Address.Cascader({ + key: 'casacader', + title: '选择地址', + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + required: true, + }), + { + key: 'address', + title: '详细地址', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'longitude', + title: '经度', + colProps: { span: 3 }, + }, + { + key: 'latitude', + title: '纬度', + colProps: { span: 3 }, + }, + MyFormItems.EnumSelect({ + key: 'property_type', + title: '项目类型', + colProps: { span: 6 }, + valueEnum: AssetProjectsPropertyTypeEnum, + // required: true, + }), + MyFormItems.EnumSelect({ + key: 'status', + title: '项目状态', + colProps: { span: 6 }, + valueEnum: AssetProjectsStatusEnum, + // required: true, + }), + MyFormItems.EnumSelect({ + key: 'entrust_type', + title: '委托类型', + colProps: { span: 6 }, + valueEnum: AssetProjectsEntrustTypeEnum, + // required: true, + }), + MyFormItems.EnumRadio({ + key: 'charge', + title: '收费方式', + colProps: { span: 6 }, + valueEnum: AssetProjectsChargeEnum, + // required: true, + }), + { + key: 'takeover_date', + title: '接管日期', + valueType: 'date', + fieldProps: { + style: { + width: '100%', + }, + }, + colProps: { span: 6 }, + }, + { + key: 'closure_date', + title: '封园日期', + valueType: 'date', + fieldProps: { + style: { + width: '100%', + }, + }, + colProps: { span: 6 }, + }, + ]} + /> + ); +} diff --git a/src/pages/archive/asset_house/table/OccupantsNow.tsx b/src/pages/archive/asset_house/table/OccupantsNow.tsx new file mode 100644 index 0000000..d1d839e --- /dev/null +++ b/src/pages/archive/asset_house/table/OccupantsNow.tsx @@ -0,0 +1,109 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import { useEffect, useRef } from 'react'; +import AddOccupant from '../modals/AddOccupant'; +import MoveOut from '../modals/MoveOut'; +import Transfer from '../modals/Transfer'; + +export default function Index({ ...rest }) { + const actionLooks = useRef(); + useEffect(() => { + actionLooks?.current.reloadAndRest(); + }, [rest.loadmore]); + + return ( + <> + > + {...MyProTableProps.props} + actionRef={actionLooks} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + asset_houses_id: rest.item?.id, + status: 'Normal', + }, + sort, + Apis.Archive.HouseOccupants.List, + ) + } + toolBarRender={(action) => [ + , + , + ]} + search={false} + columns={[ + MyColumns.EnumTag({ + title: '房客关系', + dataIndex: 'house_relation', + valueEnum: HouseOccupantsHouseRelationEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '与产权人关系', + dataIndex: 'relation_with_owner', + valueEnum: HouseOccupantsRelationWithOwnerEnum, + search: false, + }), + { + title: '姓名', + dataIndex: 'name', + }, + { + title: '电话', + dataIndex: 'phone', + }, + + { + title: '是否入住', + dataIndex: 'is_live_in', + render(_, record) { + return `${record?.is_live_in ? '是' : '-'} `; + }, + }, + { + title: '入住日期', + dataIndex: 'is_live_in', + render(_, record) { + return `待补充`; + }, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: HouseOccupantsStatusEnum, + search: false, + }), + // MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + {/* */} + {item?.is_live_in && ( + + )} + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/asset/asset_projects/components/AssetBuildings.tsx b/src/pages/asset/asset_projects/components/AssetBuildings.tsx index becd646..4adb324 100644 --- a/src/pages/asset/asset_projects/components/AssetBuildings.tsx +++ b/src/pages/asset/asset_projects/components/AssetBuildings.tsx @@ -5,20 +5,15 @@ import { MyProTableProps, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { - AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, - AssetHousesUsageEnum, -} from '@/gen/Enums'; +import { AssetHousesUsageEnum } from '@/gen/Enums'; import { ProCard, ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useRef, useState } from 'react'; import BuildingsCreate from '../modals/BuildingsCreate'; import AssetBuildingsUpdate from '../modals/BuildingsUpdate'; import AssetHousesCreate from '../modals/HousesCreate'; -import AssetHousesShow from '../modals/HousesShow'; -import AssetHousesUpdate from '../modals/HousesUpdate'; -import RegistersCreate from '../modals/RegistersCreate'; +import HousesShow from '../modals/HousesShow'; +import HousesUpdate from '../modals/HousesUpdate'; import AssetUnitsCreate from '../modals/UnitsCreate'; import AssetUnitsUpdate from '../modals/UnitsUpdate'; @@ -91,7 +86,7 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { } options={false} columns={[ - MyColumns.ID(), + // MyColumns.ID(), { title: '楼栋名称', dataIndex: 'name', @@ -148,7 +143,7 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { }} options={false} columns={[ - MyColumns.ID(), + // MyColumns.ID(), { title: '单元名称', dataIndex: 'name', @@ -192,7 +187,6 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { options={false} columns={[ MyColumns.ID(), - MyColumns.EnumTag({ title: '用途', dataIndex: 'usage', @@ -209,30 +203,26 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { return `${record?.floor}层`; }, }, - MyColumns.EnumTag({ - title: '产权性质', - dataIndex: 'ownership_type', - valueEnum: AssetHousesOwnershipTypeEnum, - }), - MyColumns.EnumTag({ - title: '房屋状态', - dataIndex: 'status', - valueEnum: AssetHousesStatusEnum, - }), + // MyColumns.EnumTag({ + // title: '产权性质', + // dataIndex: 'ownership_type', + // valueEnum: AssetHousesOwnershipTypeEnum, + // }), + // MyColumns.EnumTag({ + // title: '房屋状态', + // dataIndex: 'status', + // valueEnum: AssetHousesStatusEnum, + // }), MyColumns.Option({ render: (_, item: any, index, action) => ( - - + - + Apis.Asset.AssetBuildings.Delete({ id: item.id }).then( diff --git a/src/pages/asset/asset_projects/components/AssetInfo.tsx b/src/pages/asset/asset_projects/components/AssetInfo.tsx index b33829d..175f4d9 100644 --- a/src/pages/asset/asset_projects/components/AssetInfo.tsx +++ b/src/pages/asset/asset_projects/components/AssetInfo.tsx @@ -8,6 +8,7 @@ import { import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; import AssetUpdate from '../modals/AssetUpdate'; +import BindCompany from '../modals/BindCompany'; export default function info(props: MyBetaModalFormProps) { return ( @@ -16,7 +17,9 @@ export default function info(props: MyBetaModalFormProps) { - {props?.item?.name} +
+ 【{props?.item?.id}】{props?.item?.name} +
【{props?.item?.company?.id}】{props?.item?.company?.name} +
- +
diff --git a/src/pages/asset/asset_projects/modals/AssetUpdate.tsx b/src/pages/asset/asset_projects/modals/AssetUpdate.tsx index 71f9c73..4e8a41e 100644 --- a/src/pages/asset/asset_projects/modals/AssetUpdate.tsx +++ b/src/pages/asset/asset_projects/modals/AssetUpdate.tsx @@ -22,14 +22,7 @@ export default function Update(props: MyBetaModalFormProps) { {...MyModalFormProps.props} title={`编辑${props.title}`} - trigger={ - - } + trigger={} wrapperCol={{ span: 24 }} width="800px" request={() => diff --git a/src/pages/asset/asset_projects/modals/BindCompany.tsx b/src/pages/asset/asset_projects/modals/BindCompany.tsx new file mode 100644 index 0000000..c823ed6 --- /dev/null +++ b/src/pages/asset/asset_projects/modals/BindCompany.tsx @@ -0,0 +1,51 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={ + + } + wrapperCol={{ span: 24 }} + width="500px" + request={() => + Promise.resolve({ + ...props.item, + }) + } + onFinish={async (values) => + Apis.Asset.AssetProjects.BindCompany({ ...values, projects_id: props.item?.id ?? 0 }) + .then(() => { + props.reload?.(); + message.success(props.title + '关联机构修改成功'); + return true; + }) + .catch(() => false) + } + columns={[ + + Selects?.Companies({ + key: 'companies_id', + title: '所属机构', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), + ]} + /> + ); +} diff --git a/src/pages/asset/asset_projects/modals/HousesCreate.tsx b/src/pages/asset/asset_projects/modals/HousesCreate.tsx index efed27a..ef05f08 100644 --- a/src/pages/asset/asset_projects/modals/HousesCreate.tsx +++ b/src/pages/asset/asset_projects/modals/HousesCreate.tsx @@ -178,8 +178,8 @@ export default function Create(props: MyBetaModalFormProps) { // }, MyFormItems.EnumRadio({ key: 'orientation', - title: '房屋状态', - colProps: { span: 6 }, + title: '房屋朝向', + colProps: { span: 24 }, valueEnum: AssetHousesOrientationEnum, // required: true, }), diff --git a/src/pages/asset/asset_projects/modals/HousesUpdate.tsx b/src/pages/asset/asset_projects/modals/HousesUpdate.tsx index f128483..c3e6061 100644 --- a/src/pages/asset/asset_projects/modals/HousesUpdate.tsx +++ b/src/pages/asset/asset_projects/modals/HousesUpdate.tsx @@ -18,7 +18,6 @@ import { Form, message } from 'antd'; export default function Update(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - console.log(props?.item, 'item'); return ( {...MyModalFormProps.props} diff --git a/src/pages/company/companies/components/ComponentsInfo.tsx b/src/pages/company/companies/components/ComponentsInfo.tsx index 8263b88..1f8363c 100644 --- a/src/pages/company/companies/components/ComponentsInfo.tsx +++ b/src/pages/company/companies/components/ComponentsInfo.tsx @@ -9,18 +9,12 @@ export default function info(props: MyBetaModalFormProps) { - + {props?.item?.name} - - {props?.item?.short_name} - - - {props?.item?.business_license_number} - + + {props?.item?.short_name} + + + {props?.item?.business_license_number} + + {props?.item?.contact_name} diff --git a/src/pages/company/companies/components/Employees.tsx b/src/pages/company/companies/components/Employees.tsx index 37ca36c..9cc66d2 100644 --- a/src/pages/company/companies/components/Employees.tsx +++ b/src/pages/company/companies/components/Employees.tsx @@ -33,6 +33,12 @@ export default function Index(props: MyBetaModalFormProps) { options={false} columns={[ MyColumns.ID(), + //to-do 按层级选择 + { + title: '组织', + dataIndex: ['organization', 'name'], + search: false, + }, { title: '姓名', dataIndex: 'name', @@ -42,17 +48,12 @@ export default function Index(props: MyBetaModalFormProps) { dataIndex: 'phone', }, { - title: '机构', - dataIndex: ['company', 'name'], - search: false, - }, - { - title: '组织', - dataIndex: ['organization', 'name'], + title: '岗位', + dataIndex: ['position', 'name'], search: false, }, MyColumns.UpdatedAt(), - MyColumns.CreatedAt(), + // MyColumns.CreatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( diff --git a/src/pages/company/companies/components/Positions.tsx b/src/pages/company/companies/components/Positions.tsx index 8a9aa2b..e22ccac 100644 --- a/src/pages/company/companies/components/Positions.tsx +++ b/src/pages/company/companies/components/Positions.tsx @@ -44,18 +44,18 @@ export default function Organizations(props: MyBetaModalFormProps) { dataIndex: 'code', search: false, }, + // { + // title: '岗位排序', + // dataIndex: 'sort', + // search: false, + // }, { - title: '岗位排序', - dataIndex: 'sort', - search: false, - }, - { - title: '备注', + title: '岗位备注', dataIndex: 'remark', search: false, }, MyColumns.UpdatedAt(), - MyColumns.CreatedAt(), + // MyColumns.CreatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( diff --git a/src/pages/company/companies/components/Projects.tsx b/src/pages/company/companies/components/Projects.tsx index 87afca4..11d11ee 100644 --- a/src/pages/company/companies/components/Projects.tsx +++ b/src/pages/company/companies/components/Projects.tsx @@ -5,13 +5,15 @@ import { MyProTableProps, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { OrganizationsTypeEnum } from '@/gen/Enums'; +import { AssetProjectsChargeEnum, AssetProjectsEntrustTypeEnum, AssetProjectsPropertyTypeEnum, AssetProjectsStatusEnum, OrganizationsTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; -import OrganizationsCreate from '../modals/OrganizationsCreate'; -import OrganizationsUpdate from '../modals/OrganizationsUpdate'; +import { useNavigate } from 'react-router-dom'; + + +export default function Index(props: MyBetaModalFormProps) { + const navigate = useNavigate(); -export default function Organizations(props: MyBetaModalFormProps) { return ( <> [ - , - ]} - options={false} + // toolBarRender={(action) => [ + // , + // ]} + // options={false} columns={[ MyColumns.ID(), - { - title: '上级组织', - dataIndex: ['organization_parent', 'name'], - }, - { - title: '组织', - dataIndex: 'name', - }, MyColumns.EnumTag({ - title: '类型', - dataIndex: 'type', - valueEnum: OrganizationsTypeEnum, + title: '项目类型', + dataIndex: 'property_type', + valueEnum: AssetProjectsPropertyTypeEnum, + search: false, }), { - title: '负责人', - dataIndex: ['manager', 'name'], + title: '项目名称', + dataIndex: 'name', }, { - title: '联系电话', - dataIndex: 'manager_phone', + title: '项目别名', + dataIndex: 'alias_name', }, + // { + // title: '项目编码', + // dataIndex: 'code', + // search: false, + // }, + { + title: '地址', + render: (_, i: any) => { + return `${i?.province || ''}${i?.city || ''}${i?.district || ''}${ + i?.address || '' + }`; + }, + search: false, + }, + MyColumns.EnumTag({ + title: '项目状态', + dataIndex: 'status', + valueEnum: AssetProjectsStatusEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '委托类型', + dataIndex: 'entrust_type', + valueEnum: AssetProjectsEntrustTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '收费方式', + dataIndex: 'charge', + valueEnum: AssetProjectsChargeEnum, + search: false, + }), + MyColumns.SoftDelete({ + title: '启/禁用', + onRestore: Apis.Asset.AssetProjects.Restore, + onSoftDelete: Apis.Asset.AssetProjects.SoftDelete, + search: false, + }), + // MyColumns.CreatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( - - - Apis.Company.Organizations.Delete({ id: item.id }).then( - () => action?.reload(), - ) - } + { + navigate(`/asset/asset_projects/${item.id}`); + }} /> ), diff --git a/src/pages/company/companies/modals/EmployeesCreate.tsx b/src/pages/company/companies/modals/EmployeesCreate.tsx index 896cb18..ac223ee 100644 --- a/src/pages/company/companies/modals/EmployeesCreate.tsx +++ b/src/pages/company/companies/modals/EmployeesCreate.tsx @@ -9,9 +9,10 @@ import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { SexEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; -import { message } from 'antd'; +import { Form, message } from 'antd'; export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); return ( {...MyModalFormProps.props} @@ -19,6 +20,12 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="500px" trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} onFinish={async (values) => Apis.Company.CompanyEmployees.Store(values) .then(() => { @@ -30,7 +37,7 @@ export default function Create(props: MyBetaModalFormProps) { } columns={[ Selects?.Organizations({ - title: '所属组织', + title: '设置所属组织', params: { companies_id: props?.item?.companies_id }, key: 'organizations_id', formItemProps: { ...rulesHelper.text }, @@ -49,7 +56,7 @@ export default function Create(props: MyBetaModalFormProps) { maxLength: 11, }, colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.phone }, }, MyFormItems.EnumRadio({ key: 'sex', @@ -58,13 +65,18 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: SexEnum, required: true, }), - - { - key: 'password', - title: '密码', - colProps: { span: 24 }, - valueType: 'password', - }, + Selects?.Positions({ + title: '岗位', + params: { companies_id: props?.item?.companies_id }, + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + }), + // { + // key: 'password', + // title: '密码', + // colProps: { span: 24 }, + // valueType: 'password', + // }, { key: 'remark', title: '备注', diff --git a/src/pages/company/companies/modals/EmployeesUpdate.tsx b/src/pages/company/companies/modals/EmployeesUpdate.tsx index f017165..9ba5ed2 100644 --- a/src/pages/company/companies/modals/EmployeesUpdate.tsx +++ b/src/pages/company/companies/modals/EmployeesUpdate.tsx @@ -62,7 +62,7 @@ export default function Update(props: MyBetaModalFormProps) { maxLength: 11, }, colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.phone }, }, MyFormItems.EnumRadio({ key: 'sex', @@ -71,13 +71,18 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: SexEnum, required: true, }), - - { - key: 'password', - title: '密码', - colProps: { span: 24 }, - valueType: 'password', - }, + Selects?.Positions({ + title: '岗位', + params: { companies_id: props?.item?.companies_id }, + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + }), + // { + // key: 'password', + // title: '密码', + // colProps: { span: 24 }, + // valueType: 'password', + // }, { key: 'remark', title: '备注', diff --git a/src/pages/company/companies/modals/Update.tsx b/src/pages/company/companies/modals/Update.tsx index 8f57ed5..e36b4bf 100644 --- a/src/pages/company/companies/modals/Update.tsx +++ b/src/pages/company/companies/modals/Update.tsx @@ -20,9 +20,8 @@ export default function Update(props: MyBetaModalFormProps) { form={form} trigger={ } @@ -90,29 +89,29 @@ export default function Update(props: MyBetaModalFormProps) { title: '联系人邮箱', colProps: { span: 8 }, }, - { - key: 'contact_address', - title: '联系人地址', - colProps: { span: 24 }, - }, - MyFormItems.EnumRadio({ - key: 'merchant_type', - title: '商户类型', - colProps: { span: 24 }, - valueEnum: CompaniesMerchantTypeEnum, - required: true, - }), + // { + // key: 'contact_address', + // title: '联系人地址', + // colProps: { span: 16 }, + // }, + // MyFormItems.EnumRadio({ + // key: 'merchant_type', + // title: '商户类型', + // colProps: { span: 24 }, + // valueEnum: CompaniesMerchantTypeEnum, + // required: true, + // }), Address.Cascader({ key: 'casacader', title: '选择地址', - colProps: { span: 24 }, + colProps: { span:16 }, keys: ['province', 'city', 'area', 'street'], required: true, }), { key: 'address', title: '详细地址', - colProps: { span: 24 }, + colProps: { span:8 }, }, ]} /> diff --git a/src/pages/company/employees/index.tsx b/src/pages/employees/index.tsx similarity index 88% rename from src/pages/company/employees/index.tsx rename to src/pages/employees/index.tsx index 66f3745..99b4a59 100644 --- a/src/pages/company/employees/index.tsx +++ b/src/pages/employees/index.tsx @@ -31,26 +31,35 @@ export default function Index({ title = '员工管理' }) { MyColumns.Companies({ title: '选择机构', }), - { - title: '姓名', - dataIndex: 'name', - }, - { - title: '手机号', - dataIndex: 'phone', - }, { title: '机构', dataIndex: ['company', 'name'], search: false, + width: 220, }, { title: '组织', dataIndex: ['organization', 'name'], search: false, + width: 150, + }, + { + title: '姓名', + dataIndex: 'name', + width: 150, + }, + { + title: '手机号', + dataIndex: 'phone', + width: 150, + }, + { + title: '岗位', + dataIndex: ['position', 'name'], + width: 150, }, MyColumns.UpdatedAt(), - MyColumns.CreatedAt(), + // MyColumns.CreatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( diff --git a/src/pages/company/employees/modals/Create.tsx b/src/pages/employees/modals/Create.tsx similarity index 75% rename from src/pages/company/employees/modals/Create.tsx rename to src/pages/employees/modals/Create.tsx index 5cb299a..6cd0485 100644 --- a/src/pages/company/employees/modals/Create.tsx +++ b/src/pages/employees/modals/Create.tsx @@ -9,9 +9,10 @@ import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { SexEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; -import { message } from 'antd'; +import { Form, message } from 'antd'; export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); return ( {...MyModalFormProps.props} @@ -19,6 +20,12 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="500px" trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} onFinish={async (values) => Apis.Company.CompanyEmployees.Store(values) .then(() => { @@ -60,7 +67,7 @@ export default function Create(props: MyBetaModalFormProps) { maxLength: 11, }, colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.phone }, }, MyFormItems.EnumRadio({ key: 'sex', @@ -69,13 +76,22 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: SexEnum, required: true, }), - { - key: 'password', - title: '密码', - colProps: { span: 24 }, - valueType: 'password', + valueType: 'dependency', + name: ['companies_id'], + columns: ({ companies_id }) => [ + Selects?.Positions({ + title: '岗位', + params: { companies_id: companies_id }, + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + }), + ], }, + { key: 'remark', title: '备注', diff --git a/src/pages/company/employees/modals/Update.tsx b/src/pages/employees/modals/Update.tsx similarity index 86% rename from src/pages/company/employees/modals/Update.tsx rename to src/pages/employees/modals/Update.tsx index 30237bf..292d71b 100644 --- a/src/pages/company/employees/modals/Update.tsx +++ b/src/pages/employees/modals/Update.tsx @@ -73,7 +73,7 @@ export default function Update(props: MyBetaModalFormProps) { maxLength: 11, }, colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.phone }, }, MyFormItems.EnumRadio({ key: 'sex', @@ -82,12 +82,17 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: SexEnum, required: true, }), - { - key: 'password', - title: '密码', - colProps: { span: 24 }, - valueType: 'password', + valueType: 'dependency', + name: ['companies_id'], + columns: ({ companies_id }) => [ + Selects?.Positions({ + title: '岗位', + params: { companies_id: companies_id }, + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + }), + ], }, { key: 'remark', diff --git a/src/pages/archive/house_bills/index.tsx b/src/pages/house_bills/index.tsx similarity index 69% rename from src/pages/archive/house_bills/index.tsx rename to src/pages/house_bills/index.tsx index 49c6dae..408479c 100644 --- a/src/pages/archive/house_bills/index.tsx +++ b/src/pages/house_bills/index.tsx @@ -24,51 +24,73 @@ export default function Index({ title = '账单' }) { ]} columns={[ MyColumns.ID(), - { - title: '金额', - dataIndex: 'amount', - }, - { - title: '优惠金额', - dataIndex: 'discount_amount', - search: false, - }, - { - title: '滞纳金', - dataIndex: 'late_fee', - search: false, - }, MyColumns.EnumTag({ title: '类型', dataIndex: 'type', valueEnum: HouseBillsTypeEnum, }), + { + title: '房屋', + dataIndex: ['asset_house', 'full_name'], + search: { + transform: (value) => { + return { full_name: value }; + }, + }, + }, + { + title: '账单月份', + dataIndex: 'month', + width: 100, + }, + { + title: '金额', + dataIndex: 'amount', + search: false, + width: 100, + }, + { + title: '优惠金额', + dataIndex: 'discount_amount', + search: false, + width: 100, + }, + { + title: '滞纳金', + dataIndex: 'late_fee', + search: false, + width: 100, + }, + { title: '计费开始日期', dataIndex: 'start_date', search: false, + width: 120, }, { title: '计费结束日期', dataIndex: 'end_date', search: false, + width: 120, }, - { - title: '滞纳金起算日期', - dataIndex: 'late_start_date', - search: false, - }, - { - title: '已收滞纳金天数', - dataIndex: 'collected_late_fee_days', - search: false, - }, - { - title: '备注', - dataIndex: 'remark', - search: false, - }, - MyColumns.CreatedAt(), + // { + // title: '滞纳金起算日期', + // dataIndex: 'late_start_date', + // search: false, + // }, + // { + // title: '已收滞纳金天数', + // dataIndex: 'collected_late_fee_days', + // search: false, + // // }, + // { + // title: '备注', + // dataIndex: 'remark', + // search: false, + // }, + // MyColumns.CreatedAt(), + MyColumns.UpdatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( diff --git a/src/pages/archive/house_bills/modals/Create.tsx b/src/pages/house_bills/modals/Create.tsx similarity index 58% rename from src/pages/archive/house_bills/modals/Create.tsx rename to src/pages/house_bills/modals/Create.tsx index 536d4dc..4aaa20c 100644 --- a/src/pages/archive/house_bills/modals/Create.tsx +++ b/src/pages/house_bills/modals/Create.tsx @@ -38,28 +38,72 @@ export default function Create(props: MyBetaModalFormProps) { Selects?.AssetProjects({ title: '选择项目', key: 'asset_projects_id', - colProps: { span: 12 }, + colProps: { span: 24 }, formItemProps: { ...rulesHelper.text }, }), { valueType: 'dependency', - name: ['asset_projects_id'], - columns: ({ asset_projects_id }) => [ - Selects?.AssetHouses({ - title: '选择房屋', - key: 'asset_houses_id', - params: { asset_projects_id: asset_projects_id }, - formItemProps: { ...rulesHelper.text }, - colProps: { span: 12 }, - }), - ], + name: ['asset_projects_id', 'asset_buildings_id', 'asset_units_id'], + columns: ({ + asset_projects_id, + asset_buildings_id, + asset_units_id, + }) => { + return [ + { + valueType: 'group', + columns: [ + Selects?.AssetBuildings({ + key: 'asset_buildings_id', + title: '选择楼栋', + params: { + asset_projects_id: asset_projects_id, + }, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + showSearch: true, + onChange: () => { + form.setFieldsValue({ + asset_units_id: undefined, + asset_floors_id: undefined, + }); + }, + }, + }), + Selects?.AssetUnits({ + key: 'asset_units_id', + title: '选择单元', + params: { + asset_projects_id: asset_projects_id, + asset_buildings_id: asset_buildings_id, + }, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.number }, + }), + Selects?.AssetHouses({ + title: '选择房屋', + key: 'asset_houses_id', + params: { + asset_projects_id: asset_projects_id, + asset_buildings_id: asset_buildings_id, + asset_units_id: asset_units_id, + }, + formItemProps: { ...rulesHelper.text }, + colProps: { span: 8 }, + }), + ], + }, + ]; + }, }, { key: 'amount', - title: '金额', + title: '账单金额', valueType: 'digit', colProps: { span: 8 }, fieldProps: { + addonAfter: '元', style: { width: '100%', }, @@ -71,18 +115,19 @@ export default function Create(props: MyBetaModalFormProps) { title: '优惠金额', valueType: 'digit', fieldProps: { + addonAfter: '元', style: { width: '100%', }, }, colProps: { span: 8 }, }, - { key: 'late_fee', title: '滞纳金', valueType: 'digit', fieldProps: { + addonAfter: '元', style: { width: '100%', }, @@ -91,11 +136,26 @@ export default function Create(props: MyBetaModalFormProps) { }, MyFormItems.EnumRadio({ key: 'type', - title: '类型', + title: '收费项目', colProps: { span: 24 }, valueEnum: HouseBillsTypeEnum, required: true, }), + { + key: 'month', + title: '账单月份', + valueType: 'date', + colProps: { span: 8 }, + fieldProps: { + picker: 'month', + format: 'YYYY-MM', + valueFormat: 'YYYY-MM', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, { key: 'start_date', title: '计费开始日期', @@ -118,7 +178,6 @@ export default function Create(props: MyBetaModalFormProps) { width: '100%', }, }, - formItemProps: { ...rulesHelper.text }, }, { key: 'late_start_date', diff --git a/src/pages/archive/house_bills/modals/Update.tsx b/src/pages/house_bills/modals/Update.tsx similarity index 84% rename from src/pages/archive/house_bills/modals/Update.tsx rename to src/pages/house_bills/modals/Update.tsx index bfdea43..5a7adfd 100644 --- a/src/pages/archive/house_bills/modals/Update.tsx +++ b/src/pages/house_bills/modals/Update.tsx @@ -5,7 +5,6 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; -import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { HouseBillsTypeEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -36,25 +35,13 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - Selects?.AssetProjects({ - title: '选择项目', - key: 'asset_projects_id', - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, }), - { - valueType: 'dependency', - name: ['asset_projects_id'], - columns: ({ asset_projects_id }) => [ - Selects?.AssetHouses({ - title: '选择房屋', - key: 'asset_houses_id', - params: { asset_projects_id: asset_projects_id }, - formItemProps: { ...rulesHelper.text }, - colProps: { span: 12 }, - }), - ], - }, { key: 'amount', title: '金额', @@ -90,13 +77,22 @@ export default function Update(props: MyBetaModalFormProps) { }, colProps: { span: 8 }, }, - MyFormItems.EnumRadio({ - key: 'type', - title: '类型', - colProps: { span: 24 }, - valueEnum: HouseBillsTypeEnum, - required: true, - }), + + { + key: 'month', + title: '账单月份', + valueType: 'date', + colProps: { span: 8 }, + fieldProps: { + picker: 'month', + format: 'YYYY-MM', + valueFormat: 'YYYY-MM', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, { key: 'start_date', title: '计费开始日期',