From 2699402b7a2cfe907442e971f4430cee1fd58ead Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 19 Jan 2026 19:17:20 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=EF=BC=8C=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen/ApiTypes.d.ts | 202 +++++++++++ src/gen/Apis.ts | 129 +++++++ src/gen/Enums.ts | 109 +++++- src/pages/approval/approval/index.tsx | 86 +++++ src/pages/approval/cc_me/index.tsx | 74 ++++ src/pages/approval/cc_me/modals/Show.tsx | 250 ++++++++++++++ src/pages/approval/my_apply/index.tsx | 99 ++++++ src/pages/approval/my_processed/index.tsx | 63 ++++ .../approval/my_processed/modals/Show.tsx | 250 ++++++++++++++ src/pages/approval/pending/index.tsx | 86 +++++ src/pages/approval/pending/modals/Audit.tsx | 320 ++++++++++++++++++ .../approval/pending/modals/Forwarded.tsx | 59 ++++ src/pages/approval/templates/index.tsx | 83 +++++ .../templates/modals/BatchModifyApprover.tsx | 62 ++++ .../approval/templates/modals/Create.tsx | 141 ++++++++ .../approval/templates/modals/Update.tsx | 168 +++++++++ src/pages/bills/house_bills/index.tsx | 42 +-- .../bills/house_bills/modals/BillRefund.tsx | 13 +- src/pages/charge/refunds/index.tsx | 136 ++++++++ src/pages/charge/refunds/modals/Refund.tsx | 75 ++++ 20 files changed, 2416 insertions(+), 31 deletions(-) create mode 100644 src/pages/approval/approval/index.tsx create mode 100644 src/pages/approval/cc_me/index.tsx create mode 100644 src/pages/approval/cc_me/modals/Show.tsx create mode 100644 src/pages/approval/my_apply/index.tsx create mode 100644 src/pages/approval/my_processed/index.tsx create mode 100644 src/pages/approval/my_processed/modals/Show.tsx create mode 100644 src/pages/approval/pending/index.tsx create mode 100644 src/pages/approval/pending/modals/Audit.tsx create mode 100644 src/pages/approval/pending/modals/Forwarded.tsx create mode 100644 src/pages/approval/templates/index.tsx create mode 100644 src/pages/approval/templates/modals/BatchModifyApprover.tsx create mode 100644 src/pages/approval/templates/modals/Create.tsx create mode 100644 src/pages/approval/templates/modals/Update.tsx create mode 100644 src/pages/charge/refunds/index.tsx create mode 100644 src/pages/charge/refunds/modals/Refund.tsx diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index be6afa2..523f7f7 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -63,6 +63,88 @@ declare namespace ApiTypes { }; } } + namespace Approval { + namespace ApprovalInstances { + type PendingList = { + "type"?: string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "applicant_name"?: string; // 申请人姓名 + "asset_projects_id"?: number; // 所属项目id + "status"?: string; // 状态,[enum:ApprovalRecordsStatusEnum] + }; + type Show = { + "id": number; // 审批实例id + }; + type Approve = { + "record_id": number; // 审批记录id + "status": string; // 审批结果,[enum:ApprovalRecordsStatusEnum] + "opinion"?: string; // 审批意见 + }; + type Cancel = { + "id": number; // 审批实例id + }; + type Transfer = { + "record_id": number; // 审批记录id + "to_employee_id": number; // 接收人id,[ref:company_employees] + "opinion"?: string; // 转交理由 + }; + type List = { + "type"?: string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "status"?: string; // 状态,[enum:ApprovalInstancesStatusEnum] + "applicant_name"?: string; // 申请人姓名 + "asset_projects_id"?: number; // 所属项目id + }; + type ProcessedList = { + "type"?: string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "status"?: string; // 审批结果,[enum:ApprovalRecordsStatusEnum] + "asset_projects_id"?: number; // 所属项目id + }; + type CcList = { + "type"?: string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "asset_projects_id"?: number; // 所属项目id + }; + } + namespace ApprovalTemplates { + type List = { + "name"?: string; // 模糊搜索:名称 + "type"?: string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "is_enabled"?: boolean; // 是否启用 + "asset_projects_id"?: number; // 所属项目id + }; + type Store = { + "name": string; // 模板名称 + "code": string; // 模板编码 + "type": string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "description"?: string; // 模板描述 + "is_enabled"?: boolean; // 是否启用 + "asset_projects_id"?: number; // 所属项目id + "nodes": string[]; // 审批节点列表 + }; + type Update = { + "id": number; // id + "name": string; // 模板名称 + "code": string; // 模板编码 + "type": string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "description"?: string; // 模板描述 + "is_enabled"?: boolean; // 是否启用 + "asset_projects_id"?: number; // 所属项目id + "nodes": string[]; // 审批节点列表 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type ToggleEnabled = { + "id": number; // id + "is_enabled": boolean; // 是否启用 + }; + type Select = { + "type"?: string; // 业务类型,[enum:ApprovalTemplatesTypeEnum] + "asset_projects_id"?: number; // 所属项目id + }; + } + } namespace Archive { namespace HouseOccupants { type List = { @@ -760,6 +842,17 @@ declare namespace ApiTypes { "organizations_id"?: number; // 所属组织id,[ref:organizations] "keywords"?: string; // 关键词 }; + type Import = { + "upload_file": mimes:xlsx,xls; // 上传文件 + }; + type Export = { + "organizations_id"?: number; // 组织机构ID + "organization_name"?: string; // 组织机构名称 + "name"?: string; // 模糊搜索:名称 + "phone"?: string; // 模糊搜索:手机号 + "download_type"?: string; // 下载类型:all-全部,page-当前页 + "current"?: number; // 当前页偏移量 + }; } namespace CompanyPositions { type List = { @@ -946,6 +1039,51 @@ declare namespace ApiTypes { }; } } + namespace GoodsReleases { + namespace GoodsReleases { + type List = { + "code"?: string; // 放行码 + "apply_name"?: string; // 申请人姓名 + "apply_phone"?: string; // 申请人电话 + "status"?: string; // 状态,[enum:GoodsReleasesStatusEnum] + "passed_type"?: string; // 通行类型,[enum:GoodsReleasesPassedTypeEnum] + "asset_projects_id"?: number; // 所属项目 + "asset_houses_id"?: number; // 房屋 + }; + type Store = { + "asset_houses_id": number; // 访问房屋 + "apply_name": string; // 申请人姓名 + "apply_phone": string; // 申请人电话 + "passed_type": string; // 通行类型,[enum:GoodsReleasesPassedTypeEnum] + "goods": string[]; // 放行物品信息 + "passed_time": Date; // 通行时间 + "remark"?: string; // 备注 + }; + type Update = { + "id": number; // id + "apply_name"?: string; // 申请人姓名 + "apply_phone"?: string; // 申请人电话 + "passed_type"?: string; // 通行类型,[enum:GoodsReleasesPassedTypeEnum] + "goods"?: string[]; // 放行物品信息 + "passed_time"?: Date; // 通行时间 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type ApproveByEmployee = { + "id": number; // id + "status": string; // 审核状态(Approved/Rejected) + "reason"?: string; // 驳回原因 + }; + type Release = { + "id": number; // id + }; + type ScanRelease = { + "code": string; // 放行码 + }; + } + } namespace Grid { namespace Grids { type List = { @@ -1548,6 +1686,70 @@ declare namespace ApiTypes { }; } } + namespace Refund { + namespace Refunds { + type List = { + "type"?: string; // 退款类型,[enum:RefundsTypeEnum] + "business_id"?: number; // 业务ID(配合type使用) + "refund_status"?: string; // 退款状态,[enum:RefundsStatusEnum] + "applicant_name"?: string; // 申请人姓名 + "asset_projects_id"?: number; // 项目ID + "apply_time"?: string[]; // 申请时间范围 + "asset_houses_id"?: number; // 房屋ID + }; + type Store = { + "type": string; // 退款类型,[enum:RefundsTypeEnum] + "business_id"?: number; // 业务ID(根据type对应不同表) + "refund_amount": number; // 退款金额(单位元) + "company_receipt_accounts_id": number; // 出款账户id + "payee_name"?: string; // 收款人姓名 + "payee_bank"?: string; // 收款银行 + "payee_account"?: string; // 收款账号 + "reason"?: string; // 退款原因 + "asset_projects_id"?: number; // 项目ID + "approval_templates_id"?: number; // 审批模板ID + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type Show = { + "id": number; // id + }; + type Complete = { + "id": number; // id + "serial_number"?: string; // 退款流水号 + "refund_time"?: Date; // 退款时间 + "voucher"?: string[]; // 退款凭证 + }; + type Cancel = { + "id": number; // id + }; + } + } + namespace Visitor { + namespace VisitorApplies { + type List = { + "status"?: string; // 审核状态,[enum:VisitorAppliesStatusEnum] + "visit_start_time"?: Date; // 预计到访时间 + "visitor_name"?: string; // 模糊搜索:访客姓名 + "visitor_phone"?: string; // 模糊搜索:访客电话 + "host_phone"?: string; // 模糊搜索:被访人电话 + "asset_projects_id"?: number; // 项目ID + }; + type Show = { + "id": number; // 申请id + }; + type Approve = { + "id": number; // 访客申请id + }; + type Reject = { + "id": number; // 访客申请id + "remark": string; // 驳回原因 + }; + type Scan = { + "code": string; // 通行码 + "scan_type": string; // 扫码类型:进入/离开,[enum:VisitorScanTypeEnum] + }; + } + } namespace WorkOrder { namespace HouseWorkLogs { type List = { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 8f5c1bc..5e49099 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -41,6 +41,63 @@ export const Apis = { }, }, }, + Approval: { + ApprovalInstances: { + PendingList(data?: ApiTypes.Approval.ApprovalInstances.PendingList): Promise { + return request('company/approval/approval_instances/pending_list', { data }); + }, + PendingCount(): Promise { + return request('company/approval/approval_instances/pending_count', {}); + }, + MyApplyList(): Promise { + return request('company/approval/approval_instances/my_apply_list', {}); + }, + Show(data: ApiTypes.Approval.ApprovalInstances.Show): Promise { + return request('company/approval/approval_instances/show', { data }); + }, + Approve(data: ApiTypes.Approval.ApprovalInstances.Approve): Promise { + return request('company/approval/approval_instances/approve', { data }); + }, + Cancel(data: ApiTypes.Approval.ApprovalInstances.Cancel): Promise { + return request('company/approval/approval_instances/cancel', { data }); + }, + Transfer(data: ApiTypes.Approval.ApprovalInstances.Transfer): Promise { + return request('company/approval/approval_instances/transfer', { data }); + }, + List(data?: ApiTypes.Approval.ApprovalInstances.List): Promise { + return request('company/approval/approval_instances/list', { data }); + }, + ProcessedList(data?: ApiTypes.Approval.ApprovalInstances.ProcessedList): Promise { + return request('company/approval/approval_instances/processed_list', { data }); + }, + CcList(data?: ApiTypes.Approval.ApprovalInstances.CcList): Promise { + return request('company/approval/approval_instances/cc_list', { data }); + }, + }, + ApprovalTemplates: { + List(data?: ApiTypes.Approval.ApprovalTemplates.List): Promise { + return request('company/approval/approval_templates/list', { data }); + }, + Store(data: ApiTypes.Approval.ApprovalTemplates.Store): Promise { + return request('company/approval/approval_templates/store', { data }); + }, + Update(data: ApiTypes.Approval.ApprovalTemplates.Update): Promise { + return request('company/approval/approval_templates/update', { data }); + }, + Show(data: ApiTypes.Approval.ApprovalTemplates.Show): Promise { + return request('company/approval/approval_templates/show', { data }); + }, + SoftDelete(data: ApiTypes.Approval.ApprovalTemplates.SoftDelete): Promise { + return request('company/approval/approval_templates/soft_delete', { data }); + }, + ToggleEnabled(data: ApiTypes.Approval.ApprovalTemplates.ToggleEnabled): Promise { + return request('company/approval/approval_templates/toggle_enabled', { data }); + }, + Select(data?: ApiTypes.Approval.ApprovalTemplates.Select): Promise { + return request('company/approval/approval_templates/select', { data }); + }, + }, + }, Archive: { HouseOccupants: { List(data?: ApiTypes.Archive.HouseOccupants.List): Promise { @@ -366,6 +423,15 @@ export const Apis = { Select(data?: ApiTypes.Company.CompanyEmployees.Select): Promise { return request('company/company/company_employees/select', { data }); }, + Import(data: ApiTypes.Company.CompanyEmployees.Import): Promise { + return request('company/company/company_employees/import', { data }); + }, + DownloadTemplate(): Promise { + return request('company/company/company_employees/download_template', {responseType: 'blob',}); + }, + Export(data?: ApiTypes.Company.CompanyEmployees.Export): Promise { + return request('company/company/company_employees/export', { responseType: 'blob',data }); + }, }, CompanyPositions: { List(data?: ApiTypes.Company.CompanyPositions.List): Promise { @@ -500,6 +566,31 @@ export const Apis = { }, }, }, + GoodsReleases: { + GoodsReleases: { + List(data?: ApiTypes.GoodsReleases.GoodsReleases.List): Promise { + return request('company/goods_releases/goods_releases/list', { data }); + }, + Store(data: ApiTypes.GoodsReleases.GoodsReleases.Store): Promise { + return request('company/goods_releases/goods_releases/store', { data }); + }, + Update(data: ApiTypes.GoodsReleases.GoodsReleases.Update): Promise { + return request('company/goods_releases/goods_releases/update', { data }); + }, + Show(data: ApiTypes.GoodsReleases.GoodsReleases.Show): Promise { + return request('company/goods_releases/goods_releases/show', { data }); + }, + ApproveByEmployee(data: ApiTypes.GoodsReleases.GoodsReleases.ApproveByEmployee): Promise { + return request('company/goods_releases/goods_releases/approve_by_employee', { data }); + }, + Release(data: ApiTypes.GoodsReleases.GoodsReleases.Release): Promise { + return request('company/goods_releases/goods_releases/release', { data }); + }, + ScanRelease(data: ApiTypes.GoodsReleases.GoodsReleases.ScanRelease): Promise { + return request('company/goods_releases/goods_releases/scan_release', { data }); + }, + }, + }, Grid: { Grids: { List(data?: ApiTypes.Grid.Grids.List): Promise { @@ -864,6 +955,44 @@ export const Apis = { }, }, }, + Refund: { + Refunds: { + List(data?: ApiTypes.Refund.Refunds.List): Promise { + return request('company/refund/refunds/list', { data }); + }, + Store(data: ApiTypes.Refund.Refunds.Store): Promise { + return request('company/refund/refunds/store', { data }); + }, + Show(data: ApiTypes.Refund.Refunds.Show): Promise { + return request('company/refund/refunds/show', { data }); + }, + Complete(data: ApiTypes.Refund.Refunds.Complete): Promise { + return request('company/refund/refunds/complete', { data }); + }, + Cancel(data: ApiTypes.Refund.Refunds.Cancel): Promise { + return request('company/refund/refunds/cancel', { data }); + }, + }, + }, + Visitor: { + VisitorApplies: { + List(data?: ApiTypes.Visitor.VisitorApplies.List): Promise { + return request('company/visitor/visitor_applies/list', { data }); + }, + Show(data: ApiTypes.Visitor.VisitorApplies.Show): Promise { + return request('company/visitor/visitor_applies/show', { data }); + }, + Approve(data: ApiTypes.Visitor.VisitorApplies.Approve): Promise { + return request('company/visitor/visitor_applies/approve', { data }); + }, + Reject(data: ApiTypes.Visitor.VisitorApplies.Reject): Promise { + return request('company/visitor/visitor_applies/reject', { data }); + }, + Scan(data: ApiTypes.Visitor.VisitorApplies.Scan): Promise { + return request('company/visitor/visitor_applies/scan', { data }); + }, + }, + }, WorkOrder: { HouseWorkLogs: { List(data: ApiTypes.WorkOrder.HouseWorkLogs.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 844c78c..c6b82ff 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -26,6 +26,41 @@ export const ActivityEnrollsStatusEnum= { 'Cancelled': {"text":"取消","color":"#ff9800","value":"Cancelled"}, }; +// 审批实例状态枚举 +export const ApprovalInstancesStatusEnum= { + 'Pending': {"text":"待审批","color":"#ff9800","value":"Pending"}, + 'Approved': {"text":"已通过","color":"#4caf50","value":"Approved"}, + 'Rejected': {"text":"已拒绝","color":"#f44336","value":"Rejected"}, + 'Cancelled': {"text":"已取消","color":"#9e9e9e","value":"Cancelled"}, +}; + +// 审批记录状态枚举 +export const ApprovalRecordsStatusEnum= { + 'Pending': {"text":"待审批","color":"#ff9800","value":"Pending"}, + 'Approved': {"text":"同意","color":"#4caf50","value":"Approved"}, + 'Rejected': {"text":"拒绝","color":"#f44336","value":"Rejected"}, + 'Transferred': {"text":"转交","color":"#9c27b0","value":"Transferred"}, +}; + +// 审批方式枚举 +export const ApprovalTemplateNodesApproveTypeEnum= { + 'And': {"text":"会签","color":"#4caf50","value":"And"}, + 'Or': {"text":"或签","color":"#ff9800","value":"Or"}, +}; + +// 审批节点类型枚举 +export const ApprovalTemplateNodesNodeTypeEnum= { + 'Approver': {"text":"审批人","color":"#2196f3","value":"Approver"}, + 'CC': {"text":"抄送人","color":"#9e9e9e","value":"CC"}, +}; + +// 审批业务类型枚举 +export const ApprovalTemplatesTypeEnum= { + 'Contract': {"text":"合同","color":"#2196f3","value":"Contract"}, + 'Finance': {"text":"财务","color":"#4caf50","value":"Finance"}, + 'Refund': {"text":"退款","color":"#f44336","value":"Refund"}, +}; + // 车位产权类型 export const AssetCarPortsPropertyTypeEnum= { 'Ownership': {"text":"产权车位","color":"#1e90ff","value":"Ownership"}, @@ -216,7 +251,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#6f374e","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#817c26","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -346,6 +381,29 @@ export const CustomerOpinionsTypeEnum= { 'FeatureSuggestion': {"text":"新功能建议","color":"#00bfff","value":"FeatureSuggestion"}, }; +// 物品放行审核状态 +export const GoodsReleasesAuditStatusEnum= { + 'Pending': {"text":"待审核","color":"#faad14","value":"Pending"}, + 'Approved': {"text":"已通过","color":"#52c41a","value":"Approved"}, + 'Rejected': {"text":"已退回","color":"#ff4d4f","value":"Rejected"}, +}; + +// 物品放行通行类型 +export const GoodsReleasesPassedTypeEnum= { + 'Moving': {"text":"搬家","color":"#1890ff","value":"Moving"}, + 'Delivery': {"text":"出货","color":"#52c41a","value":"Delivery"}, + 'Other': {"text":"其他","color":"#faad14","value":"Other"}, +}; + +// 物品放行状态 +export const GoodsReleasesStatusEnum= { + 'Pending': {"text":"待审核","color":"#faad14","value":"Pending"}, + 'OwnerApproved': {"text":"业主已审","color":"#1890ff","value":"OwnerApproved"}, + 'Approved': {"text":"已通过","color":"#52c41a","value":"Approved"}, + 'Rejected': {"text":"已退回","color":"#ff4d4f","value":"Rejected"}, + 'Released': {"text":"已放行","color":"#722ed1","value":"Released"}, +}; + // 账单状态枚举 export const HouseBillsBillStatusEnum= { 'PendingPayment': {"text":"待支付","color":"#facc15","value":"PendingPayment"}, @@ -733,6 +791,17 @@ export const RefundsStatusEnum= { 'Cancelled': {"text":"已取消","color":"#9e9e9e","value":"Cancelled"}, }; +// 退款类型枚举 +export const RefundsTypeEnum= { + 'HouseBill': {"text":"物业费退款","color":"#2196f3","value":"HouseBill"}, + 'Bill': {"text":"账单退款","color":"#4caf50","value":"Bill"}, + 'ContractBill': {"text":"合同退款","color":"#ff9800","value":"ContractBill"}, + 'RenovationApply': {"text":"退保证金","color":"#86aac3ff","value":"RenovationApply"}, + 'HouseDoorCard': {"text":"门禁退款","color":"#9c27b0","value":"HouseDoorCard"}, + 'HouseWorkOrder': {"text":"工单退款","color":"#00bcd4","value":"HouseWorkOrder"}, + 'Other': {"text":"其他退款","color":"#607d8b","value":"Other"}, +}; + // 性别 export const SexEnum= { 'Male': {"text":"男","color":"#0000ff","value":"Male"}, @@ -753,6 +822,44 @@ export const SysPermissionsTypeEnum= { 'Button': {"text":"按钮","color":"#97224f","value":"Button"}, }; +// 来访事由 +export const VisitReasonEnum= { + 'Visit': {"text":"拜访","color":"#2196f3","value":"Visit"}, + 'Business': {"text":"商务","color":"#3f51b5","value":"Business"}, + 'Interview': {"text":"面试","color":"#9c27b0","value":"Interview"}, + 'Private': {"text":"私人","color":"#e91e63","value":"Private"}, + 'Express': {"text":"快递","color":"#00bcd4","value":"Express"}, + 'Renovation': {"text":"装修","color":"#ff5722","value":"Renovation"}, + 'Other': {"text":"其他","color":"#607d8b","value":"Other"}, +}; + +// 访客申请状态 +export const VisitorAppliesStatusEnum= { + 'Pending': {"text":"审核中","color":"#ff9800","value":"Pending"}, + 'Approved': {"text":"已通过","color":"#4caf50","value":"Approved"}, + 'Rejected': {"text":"已驳回","color":"#f44336","value":"Rejected"}, + 'Expired': {"text":"已失效","color":"#9e9e9e","value":"Expired"}, +}; + +// 访客申请类型 +export const VisitorApplyTypeEnum= { + 'invite': {"text":"业主邀请","color":"#2196f3","value":"invite"}, + 'register': {"text":"访客登记","color":"#ff9800","value":"register"}, +}; + +// 通行码状态 +export const VisitorCodeStatusEnum= { + 'unused': {"text":"未使用","color":"#2196f3","value":"unused"}, + 'used': {"text":"已使用","color":"#4caf50","value":"used"}, + 'expired': {"text":"已过期","color":"#f44336","value":"expired"}, +}; + +// 访客扫码类型 +export const VisitorScanTypeEnum= { + 'enter': {"text":"进入","color":"#4caf50","value":"enter"}, + 'exit': {"text":"离开","color":"#f44336","value":"exit"}, +}; + // WechatAuthsPlatformEnum export const WechatAuthsPlatformEnum= { 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, diff --git a/src/pages/approval/approval/index.tsx b/src/pages/approval/approval/index.tsx new file mode 100644 index 0000000..8b5cf9a --- /dev/null +++ b/src/pages/approval/approval/index.tsx @@ -0,0 +1,86 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalInstancesStatusEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import Audit from '../pending/modals/Audit'; + +export default function Index({ title = '待我审批' }) { + const navigate = useNavigate(); + return ( + + + MyProTableProps.request( + { + status: 'Pending', + ...params, + }, + sort, + Apis.Approval.ApprovalInstances.PendingList, + ) + } + headerTitle="待我审批" + columns={[ + MyColumns.ID({ search: false }), + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ApprovalInstancesStatusEnum, + }), + MyColumns.EnumTag({ + dataIndex: ['approval_instance', 'type'], + title: '类型', + valueEnum: ApprovalTemplatesTypeEnum, + search: false, + }), + { + title: '申请事项', + dataIndex: ['approval_instance', 'title'], + search: false, + }, + { + title: '关联项目', + dataIndex: ['approval_instance', 'asset_project', 'name'], + search: false, + }, + + { + title: '申请人', + dataIndex: 'approver_name', + }, + + // { + // title: '有效期', + // search: false, + // render: (_, item: any) => { + // return `${dayjs( + // item?.approval_instance?.model?.start_time, + // ).format('YYYY-MM-DD')}至${dayjs( + // item?.approval_instance?.model?.end_time, + // ).format('YYYY-MM-DD')}`; + // }, + // }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/approval/cc_me/index.tsx b/src/pages/approval/cc_me/index.tsx new file mode 100644 index 0000000..5ff00f6 --- /dev/null +++ b/src/pages/approval/cc_me/index.tsx @@ -0,0 +1,74 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalInstancesStatusEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Show from './modals/Show'; +export default function Index({ title = '抄送我的' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Approval.ApprovalInstances.CcList, + ) + } + headerTitle={title} + columns={[ + MyColumns.ID({ search: false }), + { + title: '申请事项', + dataIndex: 'title', + search: false, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ApprovalInstancesStatusEnum, + }), + MyColumns.EnumTag({ + dataIndex: 'type', + title: '业务类型', + valueEnum: ApprovalTemplatesTypeEnum, + search: false, + }), + + // { + // title: '项目ID', + // dataIndex: 'asset_projects_id', + // hidden: true, + // }, + // { + // title: '申请人', + // dataIndex: 'applicant_name', + // search: false, + // }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/approval/cc_me/modals/Show.tsx b/src/pages/approval/cc_me/modals/Show.tsx new file mode 100644 index 0000000..7b99ee2 --- /dev/null +++ b/src/pages/approval/cc_me/modals/Show.tsx @@ -0,0 +1,250 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + renderTextHelper, +} from '@/common'; + +import { Apis } from '@/gen/Apis'; +import { RefundsTypeEnum } from '@/gen/Enums'; +import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo'; +import { + BetaSchemaForm, + ProCard, + ProDescriptions, +} from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, Space, Steps } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + + return ( + + {...MyModalFormProps.props} + title={props.title} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={() => { + if (props?.item?.id) { + Apis.Approval.ApprovalInstances.Show({ + id: props.item?.model_id, + }).then((res) => { + form.setFieldsValue({ + info_display: res?.data, + }); + }); + } + }} + columns={[ + { + // title: '登记信息', + dataIndex: 'info_display', + valueType: 'text', + renderFormItem: (_, config) => ( + +
+ {/* 退款详情 */} + {config?.value?.type === 'Refund' && ( + + + + {config?.value?.title || '-'} + + + + + + + {config?.value?.model?.refund_amount || '-'} + 元 + + + + + {config?.value?.model?.payer_name || '-'}| + {config?.value?.model?.payer_bank || '-'}| + {config?.value?.model?.payer_account || '-'} + + + {config?.value?.model?.payee_name || '-'} + {config?.value?.model?.payee_bank || '-'} + {config?.value?.model?.payee_account || '-'} + + + {props?.item?.applicant?.name || '-'}: + {props?.item?.applicant?.phone || '-'} + + + {props?.item?.created_at || '-'} + + + + )} + {/* 合同详情 */} + {config?.value?.type === 'Contract' && ( + + + + {config?.value?.model?.name || '-'} + + + + + {config?.value?.model?.code || '-'} + + { + navigate( + `/contract/contracts/show/${config?.value?.model?.id}`, + ); + }} + /> + + + {/* + + */} + {/* + + */} + + {config?.value?.model?.contract_type_name || '-'} + + {/* + + */} + + {config?.value?.model?.total_amount || '-'} + + + {config?.value?.model?.deposit_amount || '无'} + + + {config?.value?.model?.sign_subject || '-'} + + + {config?.value?.model?.sign_department || '-'} + + + {config?.value?.model?.project_name || '-'} + + + {config?.value?.model?.contract_liaison || '-'} + + + {config?.value?.model?.start_time?.substring(0, 10)}至 + {config?.value?.model?.end_time?.substring(0, 10)} + + + {props?.item?.applicant?.name || '-'}: + {props?.item?.applicant?.phone || '-'} + + + {props?.item?.created_at || '-'} + + + {config?.value?.model?.attachments.map((item: any) => { + const handleDownload = async ( + e: React.MouseEvent, + ) => { + e.preventDefault(); + try { + const response = await fetch(item.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = item.name; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(item.url, '_blank'); + } + }; + + return ( + + ); + })} + + + + )} + + + + + + item?.node_type === 'Approver' + ? { + title: `${ + item.company_employee?.name || '-' + }-${item?.company_employee?.phone}`, + description: `${ + item.status === 'Approved' + ? `通过 - ${item.opinion || '-'} - ${ + item.created_at || '-' + }` + : '待审核' + }`, + } + : '', + )} + /> + + + + +
+
+ ), + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/approval/my_apply/index.tsx b/src/pages/approval/my_apply/index.tsx new file mode 100644 index 0000000..f159a8e --- /dev/null +++ b/src/pages/approval/my_apply/index.tsx @@ -0,0 +1,99 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalInstancesStatusEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +export default function Index({ title = '我的发起' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Approval.ApprovalInstances.MyApplyList, + ) + } + headerTitle={title} + columns={[ + MyColumns.ID({ search: false }), + { + title: '申请事项', + dataIndex: 'title', + search: false, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ApprovalInstancesStatusEnum, + }), + MyColumns.EnumTag({ + dataIndex: 'type', + title: '业务类型', + valueEnum: ApprovalTemplatesTypeEnum, + search: false, + }), + { + title: '当前审批人', + dataIndex: ['approval_records', 'approver_name'], + search: false, + render: (_, item: any) => + `${item?.approval_records?.[0]?.company_employee?.name || ''}-${ + item?.approval_records?.[0]?.company_employee?.phone || '' + }`, + }, + // { + // title: '项目ID', + // dataIndex: 'asset_projects_id', + // hidden: true, + // }, + // { + // title: '申请人', + // dataIndex: 'applicant_name', + // search: false, + // }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + {/* */} + + Apis.Approval.ApprovalInstances.Cancel({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/approval/my_processed/index.tsx b/src/pages/approval/my_processed/index.tsx new file mode 100644 index 0000000..e10fb98 --- /dev/null +++ b/src/pages/approval/my_processed/index.tsx @@ -0,0 +1,63 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalInstancesStatusEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Show from './modals/Show'; +export default function Index({ title = '我的发起' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Approval.ApprovalInstances.ProcessedList, + ) + } + headerTitle={title} + columns={[ + MyColumns.ID({ search: false }), + { + title: '申请事项', + dataIndex: 'title', + search: false, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ApprovalInstancesStatusEnum, + }), + MyColumns.EnumTag({ + dataIndex: 'type', + title: '业务类型', + valueEnum: ApprovalTemplatesTypeEnum, + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/approval/my_processed/modals/Show.tsx b/src/pages/approval/my_processed/modals/Show.tsx new file mode 100644 index 0000000..c8f48f6 --- /dev/null +++ b/src/pages/approval/my_processed/modals/Show.tsx @@ -0,0 +1,250 @@ +import { MyBetaModalFormProps, MyButtons, MyModalFormProps } from '@/common'; + +import { Apis } from '@/gen/Apis'; +// import { +// ContractsContractNatureEnum, +// ContractsSettlementModeEnum, +// ContractTemplatesIncomeExpenseTypeEnum, +// RefundsTypeEnum, +// } from '@/gen/Enums'; +import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo'; +import { + BetaSchemaForm, + ProCard, + ProDescriptions, +} from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, Space, Steps } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + + return ( + + {...MyModalFormProps.props} + title={props.title} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={() => { + if (props?.item?.id) { + Apis.Approval.ApprovalInstances.Show({ + id: props.item?.model_id, + }).then((res) => { + form.setFieldsValue({ + info_display: res?.data, + }); + }); + } + }} + columns={[ + { + // title: '登记信息', + dataIndex: 'info_display', + valueType: 'text', + renderFormItem: (_, config) => ( + +
+ {/* 退款详情 */} + {config?.value?.type === 'Refund' && ( + + + + {config?.value?.title || '-'} + + {/* + + */} + + + {config?.value?.model?.refund_amount || '-'} + 元 + + + + + {config?.value?.model?.payer_name || '-'}| + {config?.value?.model?.payer_bank || '-'}| + {config?.value?.model?.payer_account || '-'} + + + {config?.value?.model?.payee_name || '-'} + {config?.value?.model?.payee_bank || '-'} + {config?.value?.model?.payee_account || '-'} + + + {props?.item?.applicant?.name || '-'}: + {props?.item?.applicant?.phone || '-'} + + + {props?.item?.created_at || '-'} + + + + )} + {/* 合同详情 */} + {config?.value?.type === 'Contract' && ( + + + + {config?.value?.model?.name || '-'} + + + + + {config?.value?.model?.code || '-'} + + { + navigate( + `/contract/contracts/show/${config?.value?.model?.id}`, + ); + }} + /> + + + {/* + + */} + {/* + + */} + + {config?.value?.model?.contract_type_name || '-'} + + {/* + + */} + + {config?.value?.model?.total_amount || '-'} + + + {config?.value?.model?.deposit_amount || '无'} + + + {config?.value?.model?.sign_subject || '-'} + + + {config?.value?.model?.sign_department || '-'} + + + {config?.value?.model?.project_name || '-'} + + + {config?.value?.model?.contract_liaison || '-'} + + + {config?.value?.model?.start_time?.substring(0, 10)}至 + {config?.value?.model?.end_time?.substring(0, 10)} + + + {props?.item?.applicant?.name || '-'}: + {props?.item?.applicant?.phone || '-'} + + + {props?.item?.created_at || '-'} + + + {config?.value?.model?.attachments.map((item: any) => { + const handleDownload = async ( + e: React.MouseEvent, + ) => { + e.preventDefault(); + try { + const response = await fetch(item.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = item.name; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(item.url, '_blank'); + } + }; + + return ( + + ); + })} + + + + )} + + + + + + item?.node_type === 'Approver' + ? { + title: `${ + item.company_employee?.name || '-' + }-${item?.company_employee?.phone}`, + description: `${ + item.status === 'Approved' + ? `通过 - ${item.opinion || '-'} - ${ + item.created_at || '-' + }` + : '待审核' + }`, + } + : '', + )} + /> + + + + +
+
+ ), + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/approval/pending/index.tsx b/src/pages/approval/pending/index.tsx new file mode 100644 index 0000000..e92006b --- /dev/null +++ b/src/pages/approval/pending/index.tsx @@ -0,0 +1,86 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalInstancesStatusEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Audit from './modals/Audit'; +import Forwarded from './modals/Forwarded'; +export default function Index({ title = '我的待办' }) { + return ( + + + MyProTableProps.request( + { + ...params, + status: ApprovalInstancesStatusEnum.Pending.value, + }, + sort, + Apis.Approval.ApprovalInstances.PendingList, + ) + } + headerTitle={title} + columns={[ + MyColumns.ID({ search: false }), + { + title: '申请事项', + dataIndex: ['approval_instance', 'title'], + search: false, + }, + { + title: '关联项目', + dataIndex: ['approval_instance', 'asset_project', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: ['approval_instance', 'status'], + valueEnum: ApprovalInstancesStatusEnum, + }), + MyColumns.EnumTag({ + dataIndex: ['approval_instance', 'type'], + title: '业务类型', + valueEnum: ApprovalTemplatesTypeEnum, + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Approval.ApprovalInstances.Cancel({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/approval/pending/modals/Audit.tsx b/src/pages/approval/pending/modals/Audit.tsx new file mode 100644 index 0000000..58479f2 --- /dev/null +++ b/src/pages/approval/pending/modals/Audit.tsx @@ -0,0 +1,320 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + renderTextHelper, + rulesHelper, +} from '@/common'; + +import { Apis } from '@/gen/Apis'; +import { HouseRegistersStatusEnum, RefundsTypeEnum } from '@/gen/Enums'; +import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo'; +import { + BetaSchemaForm, + ProCard, + ProDescriptions, +} from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space, Steps } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + + // 监听status字段变化,动态设置默认审批意见 + const handleStatusChange = (changedValues: any) => { + if (changedValues.status) { + if (changedValues.status === HouseRegistersStatusEnum.Approved.value) { + form.setFieldsValue({ opinion: '同意' }); + } else if ( + changedValues.status === HouseRegistersStatusEnum.Rejected.value + ) { + form.setFieldsValue({ opinion: '不同意' }); + } + } + }; + + return ( + + {...MyModalFormProps.props} + title={props.title} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={() => { + if (props?.item?.id) { + Apis.Approval.ApprovalInstances.Show({ + id: props.item?.approval_instances_id, + }).then((res) => { + form.setFieldsValue({ + info_display: res?.data, + }); + }); + } + }} + initialValues={{ + // 默认选择通过,审批意见为同意 + status: HouseRegistersStatusEnum.Approved.value, + opinion: '同意', + }} + onValuesChange={handleStatusChange} + onFinish={async (values: any) => + Apis.Approval.ApprovalInstances.Approve({ + record_id: props.item?.id ?? 0, + ...values, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + // title: '登记信息', + dataIndex: 'info_display', + valueType: 'text', + renderFormItem: (_, config) => ( + +
+ {/* 退款详情 */} + {config?.value?.type === 'Refund' && ( + + + + {config?.value?.title || '-'} + + + + + + + {config?.value?.model?.refund_amount || '-'} + 元 + + + + + {config?.value?.model?.payer_name || '-'}| + {config?.value?.model?.payer_bank || '-'}| + {config?.value?.model?.payer_account || '-'} + + + {config?.value?.model?.payee_name || '-'} + {config?.value?.model?.payee_bank || '-'} + {config?.value?.model?.payee_account || '-'} + + + + {props?.item?.created_at || '-'} + + + + )} + {/* 合同详情 */} + {config?.value?.type === 'Contract' && ( + + + + {config?.value?.model?.name || '-'} + + + + + {config?.value?.model?.code || '-'} + + { + navigate( + `/contract/contracts/show/${config?.value?.model?.id}`, + ); + }} + /> + + + {/* + + */} + {/* + + */} + + {config?.value?.model?.contract_type_name || '-'} + + {/* + + */} + + {config?.value?.model?.total_amount || '-'} + + + {config?.value?.model?.deposit_amount || '无'} + + + {config?.value?.model?.sign_subject || '-'} + + + {config?.value?.model?.sign_department || '-'} + + + {config?.value?.model?.project_name || '-'} + + + {config?.value?.model?.contract_liaison || '-'} + + + {config?.value?.model?.start_time?.substring(0, 10)}至 + {config?.value?.model?.end_time?.substring(0, 10)} + + + {props?.item?.created_at || '-'} + + + {config?.value?.model?.attachments.map((item: any) => { + const handleDownload = async ( + e: React.MouseEvent, + ) => { + e.preventDefault(); + try { + const response = await fetch(item.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = item.name; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(item.url, '_blank'); + } + }; + + return ( + + ); + })} + + + + )} + + + + + + item?.node_type === 'Approver' + ? { + title: `${ + item.company_employee?.name || '-' + }-${item?.company_employee?.phone}`, + description: `${ + item.status === 'Approved' + ? `通过 - ${item.opinion || '-'} - ${ + item.created_at || '-' + }` + : '待审核' + }`, + } + : '', + )} + /> + + + + +
+
+ ), + colProps: { span: 24 }, + }, + { + valueType: 'group', + // title: '审核操作', + columns: [ + MyFormItems.EnumRadio({ + key: 'status', + title: '审核操作', + colProps: { span: 24 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseRegistersStatusEnum), + ); + delete obj.Pending; + return obj; + }, + required: true, + }), + { + valueType: 'dependency', + name: ['status'], + columns: ({ status }) => { + return status === 'Rejected' + ? [ + { + title: '审批意见', + dataIndex: 'opinion', + valueType: 'textarea', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + ] + : [ + { + title: '审批意见', + dataIndex: 'opinion', + valueType: 'textarea', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + ]; + }, + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/approval/pending/modals/Forwarded.tsx b/src/pages/approval/pending/modals/Forwarded.tsx new file mode 100644 index 0000000..6d00f09 --- /dev/null +++ b/src/pages/approval/pending/modals/Forwarded.tsx @@ -0,0 +1,59 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Index(props: MyBetaModalFormProps & { item: any }) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`转交他人审核`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={ + + } + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({}); + } + }} + key={new Date().getTime()} + form={form} + onFinish={async (values: any) => { + Apis.Approval.ApprovalInstances.Transfer({ + ...values, + record_id: props.item.id, + }) + .then(() => { + props.reload?.(); + message.success('转交成功!'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '选择新的审核人', + key: 'to_employee_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + { + title: '转交理由', + valueType: 'textarea', + key: 'opinion', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/approval/templates/index.tsx b/src/pages/approval/templates/index.tsx new file mode 100644 index 0000000..0345c32 --- /dev/null +++ b/src/pages/approval/templates/index.tsx @@ -0,0 +1,83 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ApprovalTemplatesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import BatchModifyApprover from './modals/BatchModifyApprover'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '审批模板' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Approval.ApprovalTemplates.List, + ) + } + headerTitle={title} + toolBarRender={(action) => [ + , + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + MyColumns.EnumTag({ + title: '业务类型', + dataIndex: 'type', + valueEnum: ApprovalTemplatesTypeEnum, + }), + { + title: '模版名称', + dataIndex: 'name', + }, + { + title: '模版编码', + dataIndex: 'code', + search: false, + }, + + MyColumns.ToggleEnabled({ + onToggleEnabled: Apis.Approval.ApprovalTemplates.ToggleEnabled, + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Approval.ApprovalTemplates.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/approval/templates/modals/BatchModifyApprover.tsx b/src/pages/approval/templates/modals/BatchModifyApprover.tsx new file mode 100644 index 0000000..fa787fa --- /dev/null +++ b/src/pages/approval/templates/modals/BatchModifyApprover.tsx @@ -0,0 +1,62 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Index(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`批量修改审批人`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); + } + }} + key={new Date().getTime()} + form={form} + onFinish={async (values: any) => { + return Apis.Approval.ApprovalTemplates.ReplaceApprover(values) + .then(() => { + props.reload?.(); + message.success('修改成功!'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '原审批人', + key: 'from_employee_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + Selects?.Employees({ + title: '选择新的审批人', + key: 'to_employee_id', + tooltip: '所有涉及到的审批模版,都修改成当前人', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + ]} + /> + ); +} diff --git a/src/pages/approval/templates/modals/Create.tsx b/src/pages/approval/templates/modals/Create.tsx new file mode 100644 index 0000000..cc16960 --- /dev/null +++ b/src/pages/approval/templates/modals/Create.tsx @@ -0,0 +1,141 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +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="700px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Approval.ApprovalTemplates.Store({ + ...values, + is_enabled: true, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '业务类型', + valueEnum: ApprovalTemplatesTypeEnum, + required: true, + colProps: { span: 24 }, + }), + { + key: 'name', + title: '模板名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'code', + title: '模板编码', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + valueType: 'formList', + dataIndex: 'nodes', + title: '设置审批节点', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'node_type', + title: `类型`, + valueEnum: ApprovalTemplateNodesNodeTypeEnum, + colProps: { span: 5 }, + formItemProps: { + ...rulesHelper.text, + }, + }), + { + title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + }, + + // MyFormItems.EnumSelect({ + // key: 'approve_type', + // title: `审批方式`, + // valueEnum: ApprovalTemplateNodesApproveTypeEnum, + // colProps: { span: 5 }, + // }), + + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: `审批人员`, + colProps: { span: 13 }, + fieldProps: { + mode: 'multiple', + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ? 1 + : 9, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + { + title: '备注', + key: 'description', + colProps: { span: 24 }, + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/approval/templates/modals/Update.tsx b/src/pages/approval/templates/modals/Update.tsx new file mode 100644 index 0000000..d31481f --- /dev/null +++ b/src/pages/approval/templates/modals/Update.tsx @@ -0,0 +1,168 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +let showInfo: any = []; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + key={new Date().getTime()} + wrapperCol={{ span: 24 }} + width="700px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + Apis.Approval.ApprovalTemplates.Show({ + id: props.item?.id ?? 0, + }).then((res: any) => { + showInfo = res?.data?.approval_template_nodes; + form.setFieldsValue({ + ...res?.data, + nodes: res?.data?.approval_template_nodes?.map((item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + })), + }); + }); + } + }} + onFinish={async (values) => + Apis.Approval.ApprovalTemplates.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '业务类型', + valueEnum: ApprovalTemplatesTypeEnum, + required: true, + colProps: { span: 24 }, + }), + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'code', + title: '模板编码', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + + { + valueType: 'formList', + dataIndex: 'nodes', + title: '审批节点', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'node_type', + title: `类型`, + valueEnum: ApprovalTemplateNodesNodeTypeEnum, + colProps: { span: 5 }, + formItemProps: { + ...rulesHelper.text, + }, + }), + { + title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + }, + { + valueType: 'dependency', + name: ['node_type', 'name'], + columns: ({ node_type, name }) => { + return [ + Selects.Employees({ + key: 'members', + title: `审批人员`, + colProps: { span: 13 }, + fieldProps: { + mode: 'multiple', + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + console.log(res, showInfo, name, '222'); + if (res?.label) { + return res?.label; + } else { + return showInfo?.map((i: any) => { + if (i?.name === name) { + return i?.approval_template_node_members?.map( + (k: any) => { + if ( + k?.company_employees_id === res?.value + ) { + return k?.company_employee?.name || '-'; + } + }, + ); + } + }); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + { + title: '备注', + key: 'description', + colProps: { span: 24 }, + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/bills/house_bills/index.tsx b/src/pages/bills/house_bills/index.tsx index 0ceb238..0426bee 100644 --- a/src/pages/bills/house_bills/index.tsx +++ b/src/pages/bills/house_bills/index.tsx @@ -52,21 +52,17 @@ export default function Index({ title = '账单明细' }) { return { full_name: value }; }, }, - render: (_, record) => { - return record.asset_houses_id ? ( + render: (_, res) => { + return res.asset_houses_id ? ( { - record.asset_houses_id - ? navigate( - `/bills/summary/show/${record.asset_houses_id}`, - ) - : ''; + navigate(`/bills/summary/show/${res.asset_houses_id}`); }} /> ) : ( - '车位| ' + record.asset_car_port.full_name + '车位| ' + res.asset_car_port.full_name ); }, }, @@ -139,22 +135,18 @@ export default function Index({ title = '账单明细' }) { title="查看" /> - {item.bill_status === - HouseBillsBillStatusEnum.PartiallyPaid.value || - (item.bill_status === HouseBillsBillStatusEnum.Paid.value && ( - - ))} + Apis.Bill.HouseBills.Delete({ id: item.id }).then(() => diff --git a/src/pages/bills/house_bills/modals/BillRefund.tsx b/src/pages/bills/house_bills/modals/BillRefund.tsx index 97cccd5..95894ef 100644 --- a/src/pages/bills/house_bills/modals/BillRefund.tsx +++ b/src/pages/bills/house_bills/modals/BillRefund.tsx @@ -9,19 +9,22 @@ import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { BetaSchemaForm } from '@ant-design/pro-components'; import { Form, message } from 'antd'; -import { useRef, useState } from 'react'; +import { useState } from 'react'; export default function Update(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - const modalRef = useRef(); - const [selectedRow, setSelectedRow] = useState({}); const [ApprovalTemplates, setApprovalTemplates] = useState([]); return ( {...MyModalFormProps.props} title={`退款申请单`} - trigger={} + trigger={ + + } layout="horizontal" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} @@ -181,7 +184,7 @@ export default function Update(props: MyBetaModalFormProps) { { valueType: 'dependency', name: ['node_type'], - columns: ({ node_type }) => { + columns: ({}) => { return [ Selects.Employees({ key: 'members', diff --git a/src/pages/charge/refunds/index.tsx b/src/pages/charge/refunds/index.tsx new file mode 100644 index 0000000..6e48fff --- /dev/null +++ b/src/pages/charge/refunds/index.tsx @@ -0,0 +1,136 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { RefundsStatusEnum, RefundsTypeEnum } from '@/gen/Enums'; +import BIllInfo from '@/pages/bills/house_bills/modals/BIllInfo'; +import { ProTable } from '@ant-design/pro-components'; +import { Image, Space } from 'antd'; +import Refund from './modals/Refund'; + +export default function Index({ title = '退款列表' }) { + return ( + + + MyProTableProps.request(params, sort, Apis.Refund.Refunds.List) + } + // toolBarRender={(action) => [ + // , + // ]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '项目名称', + dataIndex: ['asset_project', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: RefundsTypeEnum, + }), + MyColumns.EnumTag({ + title: '退款状态', + dataIndex: 'refund_status', + valueEnum: RefundsStatusEnum, + }), + { + title: '退款申请时间', + dataIndex: 'apply_time', + valueType: 'dateTimeRange', + hidden: true, + }, + { + title: '退款金额', + dataIndex: 'refund_amount', + search: false, + }, + { + dataIndex: 'payee_name', + title: '收款人', + search: false, + }, + { + dataIndex: 'applicant_name', + title: '申请人', + hidden: true, + }, + { + dataIndex: 'payee_bank', + title: '收款银行', + search: false, + }, + { + dataIndex: 'payee_account', + title: '收款账号', + search: false, + }, + { + title: '退款原因', + dataIndex: 'remark', + search: false, + }, + { + title: '退款信息', + search: false, + render: (_, item: any) => { + return item?.serial_number ? ( + +
流水号:{item?.serial_number}
+
退款时间:{item?.refund_time}
+
+ ) : ( + '' + ); + }, + }, + { + title: '退款凭证', + search: false, + render: (_, item: any) => { + return ( + + {item?.voucher?.map((res: any, index: number) => { + return ( + + ); + })} + + ); + }, + }, + // MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/charge/refunds/modals/Refund.tsx b/src/pages/charge/refunds/modals/Refund.tsx new file mode 100644 index 0000000..83ff01e --- /dev/null +++ b/src/pages/charge/refunds/modals/Refund.tsx @@ -0,0 +1,75 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Refund(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={props.title} + width="500px" + wrapperCol={{ span: 24 }} + trigger={ + + } + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Refund.Refunds.Complete({ + ...values, + id: props.item?.id ?? '', + }) + .then(() => { + props.reload?.(); + message.success('提交成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '退款流水号', + colProps: { span: 24 }, + key: 'serial_number', + formItemProps: { ...rulesHelper.text }, + }, + { + title: '退款时间', + key: 'refund_time', + colProps: { span: 24 }, + fieldProps: { + style: { + width: '100%', + }, + }, + valueType: 'dateTime', + }, + MyFormItems.UploadImages({ + key: 'voucher', + title: ' 退款凭证', + uploadType: 'file', + colProps: { span: 24 }, + max: 10, + }), + ]} + /> + ); +}