From 468f241df751311ee2ce8260ddee3994b9ff80f6 Mon Sep 17 00:00:00 2001 From: uiujun Date: Tue, 14 Apr 2026 10:42:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix=EF=BC=9A=E6=8E=A5=E5=8F=A3=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gencode.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gencode.json b/gencode.json index 750b552..fafe60a 100644 --- a/gencode.json +++ b/gencode.json @@ -1,5 +1,5 @@ { - "url": "http://10.39.13.78:8001/api/docs/openapi", + "url": "http://10.39.13.78:8002/api/docs/openapi", "module": "Company", "outPath": "./src/gen/", "apis": { -- 2.47.2 From 62c7f25e444872a09782b1076e7ce3491f4c318e Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 14 Apr 2026 21:36:19 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=EF=BC=9A=E6=90=AC1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gencode.json | 2 +- .../ModalsContractsArchivedSelectList.tsx | 170 ++ src/components/ModalsContractsSelectList.tsx | 155 ++ src/components/ModalsResourceSelectList.tsx | 122 ++ src/components/Select.tsx | 167 +- src/components/SelectContract.tsx | 277 ++++ src/gen/ApiTypes.d.ts | 1404 +++++++++++++++++ src/gen/Apis.ts | 669 +++++++- src/gen/Enums.ts | 754 ++++++++- .../company/employees/modals/EmployeeShow.tsx | 92 ++ .../contract_archive_use/borrows/index.tsx | 134 ++ .../borrows/modals/Create.tsx | 503 ++++++ .../borrows/modals/Show.tsx | 116 ++ .../borrows/modals/Update.tsx | 215 +++ .../contract/contract_archive_use/index.tsx | 49 + .../contract_archive_use/read/index.tsx | 102 ++ .../contract_archive_use/read/modals/Read.tsx | 176 +++ .../contract_archive_use/read/modals/Show.tsx | 81 + .../contract_archives/finished/index.tsx | 154 ++ .../finished/modals/Save.tsx | 91 ++ .../finished/modals/Show.tsx | 167 ++ .../finished/modals/TransfersCreate.tsx | 101 ++ .../finished/modals/Update.tsx | 282 ++++ .../contract/contract_archives/index.tsx | 55 + .../contract_archives/transfers/index.tsx | 75 + .../contract_archives/unfinished/index.tsx | 108 ++ .../unfinished/modals/Archive.tsx | 286 ++++ .../unfinished/modals/Orther.tsx | 269 ++++ .../contract/contract_bill_payments/index.tsx | 134 ++ .../contract_bill_payments/modals/Create.tsx | 55 + .../contract_bill_payments/modals/Review.tsx | 86 + .../contract_bill_payments/modals/Update.tsx | 56 + .../contract_bill_payments/pages/review.tsx | 207 +++ .../contract/contract_bills/Expense/index.tsx | 183 +++ .../Expense/modals/CompleteApply.tsx | 473 ++++++ .../Expense/modals/CreateBill.tsx | 472 ++++++ .../contract/contract_bills/Income/index.tsx | 170 ++ .../Income/modals/CompleteApply.tsx | 473 ++++++ .../Income/modals/CreateBill.tsx | 472 ++++++ src/pages/contract/contract_bills/index.tsx | 56 + .../contract_bills/modals/CompleteApply.tsx | 473 ++++++ .../contract_bills/modals/CreateBill.tsx | 472 ++++++ .../contract_bills/modals/PayBills.tsx | 236 +++ .../contract/contract_bills/pages/create.tsx | 400 +++++ .../contract/contract_bills/pages/update.tsx | 273 ++++ .../contract/contract_seal_logs/index.tsx | 48 + .../contract_seal_logs/seals/index.tsx | 100 ++ .../seals/modals/Create.tsx | 93 ++ .../seals/modals/Update.tsx | 93 ++ .../contract_seal_logs/unused/index.tsx | 105 ++ .../unused/modals/UseSeal.tsx | 183 +++ .../contract_seal_logs/used/index.tsx | 110 ++ .../contract_seal_logs/used/modals/Show.tsx | 105 ++ .../contract_seal_logs/used/modals/Update.tsx | 144 ++ .../contract/contract_templates/index.tsx | 134 ++ .../contract_templates/modals/Create.tsx | 100 ++ .../contract_templates/modals/Show.tsx | 148 ++ .../contract_templates/modals/Update.tsx | 100 ++ src/pages/contract/contract_types/index.tsx | 66 + .../contract/contract_types/modals/Create.tsx | 52 + .../contract/contract_types/modals/Update.tsx | 59 + src/pages/contract/contracts/index.tsx | 354 +++++ .../contract/contracts/modals/Change.tsx | 118 ++ .../modals/SignSubjectSelectList.tsx | 107 ++ .../contracts/modals/SubmitApproval.tsx | 308 ++++ .../contract/contracts/modals/Terminated.tsx | 305 ++++ .../contract/contracts/modals/Voided.tsx | 58 + .../contract/contracts/pages/contract_add.tsx | 433 +++++ .../contracts/pages/contract_add_update.tsx | 407 +++++ .../contracts/pages/contract_create.tsx | 1018 ++++++++++++ .../contracts/pages/contract_update.tsx | 1063 +++++++++++++ src/pages/contract/contracts/pages/reducer.ts | 4 + src/pages/contract/contracts/show/$id.tsx | 90 ++ .../show/components/ArchivingLogs.tsx | 124 ++ .../show/components/ContractBillObjects.tsx | 59 + .../show/components/ContractBills.tsx | 131 ++ .../components/ContractDisputeRecords.tsx | 82 + .../show/components/ContractsAdd.tsx | 69 + .../show/components/ContractsInfo.tsx | 135 ++ .../show/components/ContractsInfoAdd.tsx | 105 ++ .../contracts/show/components/UsedLogs.tsx | 85 + .../contract/contracts/show/modals/Create.tsx | 67 + .../contract/contracts/show/modals/Update.tsx | 66 + src/pages/contract/contracts_add/index.tsx | 234 +++ .../contract/contracts_add/modals/Change.tsx | 118 ++ .../modals/SignSubjectSelectList.tsx | 107 ++ .../contracts_add/modals/SubmitApproval.tsx | 308 ++++ .../contracts_add/modals/Terminated.tsx | 305 ++++ .../contract/contracts_add/modals/Voided.tsx | 58 + .../contracts_add/pages/contract_add.tsx | 433 +++++ .../pages/contract_add_update.tsx | 407 +++++ .../contracts_add/pages/contract_create.tsx | 980 ++++++++++++ .../contracts_add/pages/contract_update.tsx | 1010 ++++++++++++ .../contract/contracts_add/pages/reducer.ts | 4 + src/pages/contract/contracts_add/show/$id.tsx | 82 + .../show/components/ArchivingLogs.tsx | 130 ++ .../show/components/ContractBillObjects.tsx | 59 + .../show/components/ContractBills.tsx | 109 ++ .../components/ContractDisputeRecords.tsx | 82 + .../show/components/ContractsInfo.tsx | 135 ++ .../show/components/ContractsInfoAdd.tsx | 105 ++ .../show/components/UsedLogs.tsx | 86 + .../contracts_add/show/modals/Create.tsx | 67 + .../contracts_add/show/modals/Update.tsx | 66 + .../contracts_bi/images/30_60_icon.svg | 1 + .../contracts_bi/images/ClosedIcon.svg | 1 + .../contracts_bi/images/InPerformanceIcon.svg | 1 + .../contracts_bi/images/NotClosedIcon.svg | 1 + .../contracts_bi/images/NotFiledIcon.svg | 1 + .../contracts_bi/images/NotStampedIcon.svg | 1 + .../images/PendingApplicationIcon.svg | 1 + .../contracts_bi/images/TerminatedIcon.svg | 1 + .../contracts_bi/images/UnreviewedIcon.svg | 1 + src/pages/contract/contracts_bi/index.tsx | 328 ++++ src/pages/contract/contracts_bi/styleBi.scss | 248 +++ src/pages/contract/contracts_other/index.tsx | 135 ++ .../contracts_other/modals/Create.tsx | 344 ++++ .../contract/contracts_other/modals/Show.tsx | 163 ++ .../contracts_other/modals/Update.tsx | 345 ++++ .../customer/archive/modals/Delivery.tsx | 9 - .../asset_items_maintenances/index.tsx | 33 + .../asset_items_maintenances/list/index.tsx | 101 ++ .../list/modals/Assign.tsx | 57 + .../list/modals/CreateMaintenances.tsx | 110 ++ .../list/modals/Show.tsx | 116 ++ .../maintenance_rules/index.tsx | 88 ++ .../maintenance_rules/modals/RulesCreate.tsx | 138 ++ .../maintenance_rules/modals/RulesUpdate.tsx | 151 ++ .../quality/emergency/categories/index.tsx | 81 + .../emergency/categories/modals/Create.tsx | 50 + .../emergency/categories/modals/Update.tsx | 59 + src/pages/quality/emergency/events/index.tsx | 126 ++ .../emergency/events/modals/ApplyClose.tsx | 53 + .../emergency/events/modals/Create.tsx | 179 +++ .../emergency/events/modals/Review.tsx | 83 + .../emergency/events/modals/Update.tsx | 190 +++ .../quality/emergency/events/show/$id.tsx | 48 + .../emergency/events/show/components/Info.tsx | 87 + src/pages/quality/emergency/follows/index.tsx | 103 ++ .../emergency/follows/modals/Create.tsx | 52 + .../quality/emergency/follows/modals/Show.tsx | 58 + src/pages/quality/emergency/index.tsx | 42 + src/pages/quality/emergency/levels/index.tsx | 76 + .../emergency/levels/modals/Create.tsx | 43 + .../emergency/levels/modals/Update.tsx | 53 + src/pages/quality/emergency/teams/index.tsx | 105 ++ .../quality/emergency/teams/modals/Create.tsx | 97 ++ .../quality/emergency/teams/modals/Update.tsx | 108 ++ src/pages/quality/index/index.tsx | 151 ++ src/pages/quality/index/modals/Create.tsx | 153 ++ src/pages/quality/index/modals/Show.tsx | 123 ++ src/pages/quality/index/modals/Update.tsx | 159 ++ src/pages/quality/marketing/ad/index.tsx | 103 ++ .../marketing/ad/modals/BannerCreate.tsx | 171 ++ .../marketing/ad/modals/BannerShow.tsx | 150 ++ .../marketing/ad/modals/BannerUpdate.tsx | 164 ++ .../quality/marketing/ad_location/$id.tsx | 52 + .../ad_location/components/BannerList.tsx | 88 ++ .../components/BannerSpaceInfo.tsx | 31 + .../quality/marketing/ad_location/index.tsx | 85 + .../ad_location/modals/BannerSpaceCreate.tsx | 59 + .../ad_location/modals/BannerSpaceUpdate.tsx | 66 + .../components/QuestionCategoriesList.tsx | 73 + .../survey/components/QuestionsList.tsx | 80 + .../survey/components/SurveyReleasesList.tsx | 113 ++ .../survey/components/SurveyResponsesList.tsx | 39 + .../survey/components/SurveysList.tsx | 109 ++ src/pages/quality/marketing/survey/index.tsx | 47 + .../modals/QuestionCategoriesCreate.tsx | 56 + .../modals/QuestionCategoriesUpdate.tsx | 57 + .../survey/modals/QuestionsCreate.tsx | 111 ++ .../survey/modals/QuestionsUpdate.tsx | 107 ++ .../survey/modals/SurveyReleasesCreate.tsx | 78 + .../survey/modals/SurveyReleasesUpdate.tsx | 79 + .../survey/modals/SurveyResponsesShow.tsx | 67 + .../survey/modals/SurveysListShow.tsx | 108 ++ .../survey/modals/SurveysSelectList.tsx | 99 ++ .../marketing/survey/pages/create_surveys.tsx | 165 ++ .../marketing/survey/pages/update_surveys.tsx | 189 +++ .../application/components/Deposit.tsx | 85 + .../application/components/WorkerTable.tsx | 108 ++ .../application/components/info.tsx | 200 +++ .../quality/renovation/application/index.tsx | 219 +++ .../renovation/application/pages/create.tsx | 589 +++++++ .../renovation/application/pages/show.tsx | 91 ++ .../renovation/application/pages/update.tsx | 631 ++++++++ src/pages/quality/renovation/audit/index.tsx | 107 ++ .../renovation/audit/modals/Review.tsx | 125 ++ .../quality/renovation/audit/pages/review.tsx | 539 +++++++ src/pages/quality/renovation/config/$id.tsx | 50 + .../quality/renovation/deposit/index.tsx | 110 ++ .../renovation/deposit/modals/PayCreate.tsx | 103 ++ src/pages/quality/renovation/index.tsx | 43 + .../renovation/modals/WorkerCreate.tsx | 117 ++ .../renovation/modals/WorkerUpdate.tsx | 111 ++ .../renovation_inspection_rules/index.tsx | 94 ++ .../modals/Create.tsx | 97 ++ .../modals/Update.tsx | 100 ++ .../renovation/renovation_workers/index.tsx | 109 ++ .../renovation_workers/modals/Create.tsx | 105 ++ .../renovation_workers/modals/Update.tsx | 105 ++ src/pages/supplier/internal/index.tsx | 79 + src/pages/supplier/internal/modals/Create.tsx | 158 ++ src/pages/supplier/internal/modals/Update.tsx | 168 ++ .../outside/components/ContractBill.tsx | 105 ++ .../supplier/outside/components/Credit.tsx | 176 +++ .../supplier/outside/components/GradeList.tsx | 127 ++ .../supplier/outside/components/Info.tsx | 180 +++ .../components/RelatedPartyContract.tsx | 143 ++ .../supplier/outside/components/Survey.tsx | 106 ++ .../outside/components/modals/CreditShow.tsx | 178 +++ .../components/modals/CreditUpdate.tsx | 214 +++ .../outside/components/modals/SurveyShow.tsx | 174 ++ .../components/modals/SurveyUpdate.tsx | 178 +++ src/pages/supplier/outside/index.tsx | 141 ++ .../supplier/outside/modals/AddBlack.tsx | 68 + .../supplier/outside/modals/AddCredit.tsx | 219 +++ .../supplier/outside/modals/AddGrade.tsx | 82 + .../supplier/outside/modals/AddSurvey.tsx | 176 +++ src/pages/supplier/outside/modals/Create.tsx | 283 ++++ src/pages/supplier/outside/modals/Update.tsx | 295 ++++ src/pages/supplier/outside/show/$id.tsx | 98 ++ 222 files changed, 37541 insertions(+), 25 deletions(-) create mode 100644 src/components/ModalsContractsArchivedSelectList.tsx create mode 100644 src/components/ModalsContractsSelectList.tsx create mode 100644 src/components/ModalsResourceSelectList.tsx create mode 100644 src/components/SelectContract.tsx create mode 100644 src/pages/company/employees/modals/EmployeeShow.tsx create mode 100644 src/pages/contract/contract_archive_use/borrows/index.tsx create mode 100644 src/pages/contract/contract_archive_use/borrows/modals/Create.tsx create mode 100644 src/pages/contract/contract_archive_use/borrows/modals/Show.tsx create mode 100644 src/pages/contract/contract_archive_use/borrows/modals/Update.tsx create mode 100644 src/pages/contract/contract_archive_use/index.tsx create mode 100644 src/pages/contract/contract_archive_use/read/index.tsx create mode 100644 src/pages/contract/contract_archive_use/read/modals/Read.tsx create mode 100644 src/pages/contract/contract_archive_use/read/modals/Show.tsx create mode 100644 src/pages/contract/contract_archives/finished/index.tsx create mode 100644 src/pages/contract/contract_archives/finished/modals/Save.tsx create mode 100644 src/pages/contract/contract_archives/finished/modals/Show.tsx create mode 100644 src/pages/contract/contract_archives/finished/modals/TransfersCreate.tsx create mode 100644 src/pages/contract/contract_archives/finished/modals/Update.tsx create mode 100644 src/pages/contract/contract_archives/index.tsx create mode 100644 src/pages/contract/contract_archives/transfers/index.tsx create mode 100644 src/pages/contract/contract_archives/unfinished/index.tsx create mode 100644 src/pages/contract/contract_archives/unfinished/modals/Archive.tsx create mode 100644 src/pages/contract/contract_archives/unfinished/modals/Orther.tsx create mode 100644 src/pages/contract/contract_bill_payments/index.tsx create mode 100644 src/pages/contract/contract_bill_payments/modals/Create.tsx create mode 100644 src/pages/contract/contract_bill_payments/modals/Review.tsx create mode 100644 src/pages/contract/contract_bill_payments/modals/Update.tsx create mode 100644 src/pages/contract/contract_bill_payments/pages/review.tsx create mode 100644 src/pages/contract/contract_bills/Expense/index.tsx create mode 100644 src/pages/contract/contract_bills/Expense/modals/CompleteApply.tsx create mode 100644 src/pages/contract/contract_bills/Expense/modals/CreateBill.tsx create mode 100644 src/pages/contract/contract_bills/Income/index.tsx create mode 100644 src/pages/contract/contract_bills/Income/modals/CompleteApply.tsx create mode 100644 src/pages/contract/contract_bills/Income/modals/CreateBill.tsx create mode 100644 src/pages/contract/contract_bills/index.tsx create mode 100644 src/pages/contract/contract_bills/modals/CompleteApply.tsx create mode 100644 src/pages/contract/contract_bills/modals/CreateBill.tsx create mode 100644 src/pages/contract/contract_bills/modals/PayBills.tsx create mode 100644 src/pages/contract/contract_bills/pages/create.tsx create mode 100644 src/pages/contract/contract_bills/pages/update.tsx create mode 100644 src/pages/contract/contract_seal_logs/index.tsx create mode 100644 src/pages/contract/contract_seal_logs/seals/index.tsx create mode 100644 src/pages/contract/contract_seal_logs/seals/modals/Create.tsx create mode 100644 src/pages/contract/contract_seal_logs/seals/modals/Update.tsx create mode 100644 src/pages/contract/contract_seal_logs/unused/index.tsx create mode 100644 src/pages/contract/contract_seal_logs/unused/modals/UseSeal.tsx create mode 100644 src/pages/contract/contract_seal_logs/used/index.tsx create mode 100644 src/pages/contract/contract_seal_logs/used/modals/Show.tsx create mode 100644 src/pages/contract/contract_seal_logs/used/modals/Update.tsx create mode 100644 src/pages/contract/contract_templates/index.tsx create mode 100644 src/pages/contract/contract_templates/modals/Create.tsx create mode 100644 src/pages/contract/contract_templates/modals/Show.tsx create mode 100644 src/pages/contract/contract_templates/modals/Update.tsx create mode 100644 src/pages/contract/contract_types/index.tsx create mode 100644 src/pages/contract/contract_types/modals/Create.tsx create mode 100644 src/pages/contract/contract_types/modals/Update.tsx create mode 100644 src/pages/contract/contracts/index.tsx create mode 100644 src/pages/contract/contracts/modals/Change.tsx create mode 100644 src/pages/contract/contracts/modals/SignSubjectSelectList.tsx create mode 100644 src/pages/contract/contracts/modals/SubmitApproval.tsx create mode 100644 src/pages/contract/contracts/modals/Terminated.tsx create mode 100644 src/pages/contract/contracts/modals/Voided.tsx create mode 100644 src/pages/contract/contracts/pages/contract_add.tsx create mode 100644 src/pages/contract/contracts/pages/contract_add_update.tsx create mode 100644 src/pages/contract/contracts/pages/contract_create.tsx create mode 100644 src/pages/contract/contracts/pages/contract_update.tsx create mode 100644 src/pages/contract/contracts/pages/reducer.ts create mode 100644 src/pages/contract/contracts/show/$id.tsx create mode 100644 src/pages/contract/contracts/show/components/ArchivingLogs.tsx create mode 100644 src/pages/contract/contracts/show/components/ContractBillObjects.tsx create mode 100644 src/pages/contract/contracts/show/components/ContractBills.tsx create mode 100644 src/pages/contract/contracts/show/components/ContractDisputeRecords.tsx create mode 100644 src/pages/contract/contracts/show/components/ContractsAdd.tsx create mode 100644 src/pages/contract/contracts/show/components/ContractsInfo.tsx create mode 100644 src/pages/contract/contracts/show/components/ContractsInfoAdd.tsx create mode 100644 src/pages/contract/contracts/show/components/UsedLogs.tsx create mode 100644 src/pages/contract/contracts/show/modals/Create.tsx create mode 100644 src/pages/contract/contracts/show/modals/Update.tsx create mode 100644 src/pages/contract/contracts_add/index.tsx create mode 100644 src/pages/contract/contracts_add/modals/Change.tsx create mode 100644 src/pages/contract/contracts_add/modals/SignSubjectSelectList.tsx create mode 100644 src/pages/contract/contracts_add/modals/SubmitApproval.tsx create mode 100644 src/pages/contract/contracts_add/modals/Terminated.tsx create mode 100644 src/pages/contract/contracts_add/modals/Voided.tsx create mode 100644 src/pages/contract/contracts_add/pages/contract_add.tsx create mode 100644 src/pages/contract/contracts_add/pages/contract_add_update.tsx create mode 100644 src/pages/contract/contracts_add/pages/contract_create.tsx create mode 100644 src/pages/contract/contracts_add/pages/contract_update.tsx create mode 100644 src/pages/contract/contracts_add/pages/reducer.ts create mode 100644 src/pages/contract/contracts_add/show/$id.tsx create mode 100644 src/pages/contract/contracts_add/show/components/ArchivingLogs.tsx create mode 100644 src/pages/contract/contracts_add/show/components/ContractBillObjects.tsx create mode 100644 src/pages/contract/contracts_add/show/components/ContractBills.tsx create mode 100644 src/pages/contract/contracts_add/show/components/ContractDisputeRecords.tsx create mode 100644 src/pages/contract/contracts_add/show/components/ContractsInfo.tsx create mode 100644 src/pages/contract/contracts_add/show/components/ContractsInfoAdd.tsx create mode 100644 src/pages/contract/contracts_add/show/components/UsedLogs.tsx create mode 100644 src/pages/contract/contracts_add/show/modals/Create.tsx create mode 100644 src/pages/contract/contracts_add/show/modals/Update.tsx create mode 100644 src/pages/contract/contracts_bi/images/30_60_icon.svg create mode 100644 src/pages/contract/contracts_bi/images/ClosedIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/InPerformanceIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/NotClosedIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/NotFiledIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/NotStampedIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/PendingApplicationIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/TerminatedIcon.svg create mode 100644 src/pages/contract/contracts_bi/images/UnreviewedIcon.svg create mode 100644 src/pages/contract/contracts_bi/index.tsx create mode 100644 src/pages/contract/contracts_bi/styleBi.scss create mode 100644 src/pages/contract/contracts_other/index.tsx create mode 100644 src/pages/contract/contracts_other/modals/Create.tsx create mode 100644 src/pages/contract/contracts_other/modals/Show.tsx create mode 100644 src/pages/contract/contracts_other/modals/Update.tsx create mode 100644 src/pages/quality/asset_items_maintenances/index.tsx create mode 100644 src/pages/quality/asset_items_maintenances/list/index.tsx create mode 100644 src/pages/quality/asset_items_maintenances/list/modals/Assign.tsx create mode 100644 src/pages/quality/asset_items_maintenances/list/modals/CreateMaintenances.tsx create mode 100644 src/pages/quality/asset_items_maintenances/list/modals/Show.tsx create mode 100644 src/pages/quality/asset_items_maintenances/maintenance_rules/index.tsx create mode 100644 src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesCreate.tsx create mode 100644 src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesUpdate.tsx create mode 100644 src/pages/quality/emergency/categories/index.tsx create mode 100644 src/pages/quality/emergency/categories/modals/Create.tsx create mode 100644 src/pages/quality/emergency/categories/modals/Update.tsx create mode 100644 src/pages/quality/emergency/events/index.tsx create mode 100644 src/pages/quality/emergency/events/modals/ApplyClose.tsx create mode 100644 src/pages/quality/emergency/events/modals/Create.tsx create mode 100644 src/pages/quality/emergency/events/modals/Review.tsx create mode 100644 src/pages/quality/emergency/events/modals/Update.tsx create mode 100644 src/pages/quality/emergency/events/show/$id.tsx create mode 100644 src/pages/quality/emergency/events/show/components/Info.tsx create mode 100644 src/pages/quality/emergency/follows/index.tsx create mode 100644 src/pages/quality/emergency/follows/modals/Create.tsx create mode 100644 src/pages/quality/emergency/follows/modals/Show.tsx create mode 100644 src/pages/quality/emergency/index.tsx create mode 100644 src/pages/quality/emergency/levels/index.tsx create mode 100644 src/pages/quality/emergency/levels/modals/Create.tsx create mode 100644 src/pages/quality/emergency/levels/modals/Update.tsx create mode 100644 src/pages/quality/emergency/teams/index.tsx create mode 100644 src/pages/quality/emergency/teams/modals/Create.tsx create mode 100644 src/pages/quality/emergency/teams/modals/Update.tsx create mode 100644 src/pages/quality/index/index.tsx create mode 100644 src/pages/quality/index/modals/Create.tsx create mode 100644 src/pages/quality/index/modals/Show.tsx create mode 100644 src/pages/quality/index/modals/Update.tsx create mode 100644 src/pages/quality/marketing/ad/index.tsx create mode 100644 src/pages/quality/marketing/ad/modals/BannerCreate.tsx create mode 100644 src/pages/quality/marketing/ad/modals/BannerShow.tsx create mode 100644 src/pages/quality/marketing/ad/modals/BannerUpdate.tsx create mode 100644 src/pages/quality/marketing/ad_location/$id.tsx create mode 100644 src/pages/quality/marketing/ad_location/components/BannerList.tsx create mode 100644 src/pages/quality/marketing/ad_location/components/BannerSpaceInfo.tsx create mode 100644 src/pages/quality/marketing/ad_location/index.tsx create mode 100644 src/pages/quality/marketing/ad_location/modals/BannerSpaceCreate.tsx create mode 100644 src/pages/quality/marketing/ad_location/modals/BannerSpaceUpdate.tsx create mode 100644 src/pages/quality/marketing/survey/components/QuestionCategoriesList.tsx create mode 100644 src/pages/quality/marketing/survey/components/QuestionsList.tsx create mode 100644 src/pages/quality/marketing/survey/components/SurveyReleasesList.tsx create mode 100644 src/pages/quality/marketing/survey/components/SurveyResponsesList.tsx create mode 100644 src/pages/quality/marketing/survey/components/SurveysList.tsx create mode 100644 src/pages/quality/marketing/survey/index.tsx create mode 100644 src/pages/quality/marketing/survey/modals/QuestionCategoriesCreate.tsx create mode 100644 src/pages/quality/marketing/survey/modals/QuestionCategoriesUpdate.tsx create mode 100644 src/pages/quality/marketing/survey/modals/QuestionsCreate.tsx create mode 100644 src/pages/quality/marketing/survey/modals/QuestionsUpdate.tsx create mode 100644 src/pages/quality/marketing/survey/modals/SurveyReleasesCreate.tsx create mode 100644 src/pages/quality/marketing/survey/modals/SurveyReleasesUpdate.tsx create mode 100644 src/pages/quality/marketing/survey/modals/SurveyResponsesShow.tsx create mode 100644 src/pages/quality/marketing/survey/modals/SurveysListShow.tsx create mode 100644 src/pages/quality/marketing/survey/modals/SurveysSelectList.tsx create mode 100644 src/pages/quality/marketing/survey/pages/create_surveys.tsx create mode 100644 src/pages/quality/marketing/survey/pages/update_surveys.tsx create mode 100644 src/pages/quality/renovation/application/components/Deposit.tsx create mode 100644 src/pages/quality/renovation/application/components/WorkerTable.tsx create mode 100644 src/pages/quality/renovation/application/components/info.tsx create mode 100644 src/pages/quality/renovation/application/index.tsx create mode 100644 src/pages/quality/renovation/application/pages/create.tsx create mode 100644 src/pages/quality/renovation/application/pages/show.tsx create mode 100644 src/pages/quality/renovation/application/pages/update.tsx create mode 100644 src/pages/quality/renovation/audit/index.tsx create mode 100644 src/pages/quality/renovation/audit/modals/Review.tsx create mode 100644 src/pages/quality/renovation/audit/pages/review.tsx create mode 100644 src/pages/quality/renovation/config/$id.tsx create mode 100644 src/pages/quality/renovation/deposit/index.tsx create mode 100644 src/pages/quality/renovation/deposit/modals/PayCreate.tsx create mode 100644 src/pages/quality/renovation/index.tsx create mode 100644 src/pages/quality/renovation/modals/WorkerCreate.tsx create mode 100644 src/pages/quality/renovation/modals/WorkerUpdate.tsx create mode 100644 src/pages/quality/renovation/renovation_inspection_rules/index.tsx create mode 100644 src/pages/quality/renovation/renovation_inspection_rules/modals/Create.tsx create mode 100644 src/pages/quality/renovation/renovation_inspection_rules/modals/Update.tsx create mode 100644 src/pages/quality/renovation/renovation_workers/index.tsx create mode 100644 src/pages/quality/renovation/renovation_workers/modals/Create.tsx create mode 100644 src/pages/quality/renovation/renovation_workers/modals/Update.tsx create mode 100644 src/pages/supplier/internal/index.tsx create mode 100644 src/pages/supplier/internal/modals/Create.tsx create mode 100644 src/pages/supplier/internal/modals/Update.tsx create mode 100644 src/pages/supplier/outside/components/ContractBill.tsx create mode 100644 src/pages/supplier/outside/components/Credit.tsx create mode 100644 src/pages/supplier/outside/components/GradeList.tsx create mode 100644 src/pages/supplier/outside/components/Info.tsx create mode 100644 src/pages/supplier/outside/components/RelatedPartyContract.tsx create mode 100644 src/pages/supplier/outside/components/Survey.tsx create mode 100644 src/pages/supplier/outside/components/modals/CreditShow.tsx create mode 100644 src/pages/supplier/outside/components/modals/CreditUpdate.tsx create mode 100644 src/pages/supplier/outside/components/modals/SurveyShow.tsx create mode 100644 src/pages/supplier/outside/components/modals/SurveyUpdate.tsx create mode 100644 src/pages/supplier/outside/index.tsx create mode 100644 src/pages/supplier/outside/modals/AddBlack.tsx create mode 100644 src/pages/supplier/outside/modals/AddCredit.tsx create mode 100644 src/pages/supplier/outside/modals/AddGrade.tsx create mode 100644 src/pages/supplier/outside/modals/AddSurvey.tsx create mode 100644 src/pages/supplier/outside/modals/Create.tsx create mode 100644 src/pages/supplier/outside/modals/Update.tsx create mode 100644 src/pages/supplier/outside/show/$id.tsx diff --git a/gencode.json b/gencode.json index 750b552..fafe60a 100644 --- a/gencode.json +++ b/gencode.json @@ -1,5 +1,5 @@ { - "url": "http://10.39.13.78:8001/api/docs/openapi", + "url": "http://10.39.13.78:8002/api/docs/openapi", "module": "Company", "outPath": "./src/gen/", "apis": { diff --git a/src/components/ModalsContractsArchivedSelectList.tsx b/src/components/ModalsContractsArchivedSelectList.tsx new file mode 100644 index 0000000..765af9f --- /dev/null +++ b/src/components/ModalsContractsArchivedSelectList.tsx @@ -0,0 +1,170 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ContractArchivesConfidentialityLevelEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useRef, useState } from 'react'; +import { Selects } from './Select'; + +interface DataType { + key?: React.Key; + id?: React.Key; +} +export default function CompanySealsSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + // const [selectedDataRow, setSelectedDataRow] = useState({}); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: any = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows, 'selectedRows[0]'); + setSelectedRow(selectedRows); + }, + getCheckboxProps: (record: any) => ({ + disabled: record.deleted_at, + checked: props?.item?.some((item: any) => { + console.log(item, record); + return item?.id === record?.id; + }), + }), + defaultSelectedRowKeys: props?.item?.map((item: any) => item?.id) || [], + }; + + return ( + { + setSelectedRow(props?.item || []); + console.log(props?.item, 'props?.item?.id'); + }} + node={ + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractArchives.List, + ) + } + rowSelection={{ type: 'radio', ...rowSelection }} + options={false} + tableAlertOptionRender={() => { + return ( + { + let res: any = getSelectedRow; + props?.onChange?.(res); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + // MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '关联项目', + dataIndex: ['contract', 'asset_projects_id'], + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['contract', 'project_name'], + search: false, + }, + { + title: '合同名称', + dataIndex: 'name', + }, + { + title: '合同编号', + dataIndex: 'code', + // render: (_, item: any) => ( + // + // ), + }, + + MyColumns.EnumTag({ + title: '保密等级', + dataIndex: 'confidentiality_level', + valueEnum: ContractArchivesConfidentialityLevelEnum, + search: false, + }), + // MyColumns.EnumTag({ + // title: '期限类型', + // dataIndex: 'period_type', + // valueEnum: ContractArchivesPeriodTypeEnum, + // search: false, + // }), + { + title: '文件信息', + search: false, + render: (_, item: any) => { + return item?.contract_archive_files?.map((res: any) => { + return ( +
+ {res?.name},已借:{res?.borrowed_number}份,遗失: + {res?.lost_number}份 +
+ ); + }); + }, + }, + // { + // title: '保管年限', + // dataIndex: 'storage_years', + // valueType: 'digit', + // search: false, + // }, + // { + // title: '案卷编号', + // dataIndex: 'file_number', + // }, + // { + // title: '文件盒编号', + // dataIndex: 'box_number', + // }, + // { + // title: '文件柜编号', + // dataIndex: 'cabinet_number', + // }, + // { + // title: '归档年份', + // dataIndex: 'archive_year', + // valueType: 'dateYear', + // search: false, + // }, + // { + // title: '归档日期', + // dataIndex: 'archive_date', + // valueType: 'date', + // search: false, + // }, + ]} + /> + } + >
+ ); +} diff --git a/src/components/ModalsContractsSelectList.tsx b/src/components/ModalsContractsSelectList.tsx new file mode 100644 index 0000000..d94ef2d --- /dev/null +++ b/src/components/ModalsContractsSelectList.tsx @@ -0,0 +1,155 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { + ContractsContractNatureEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import dayjs from 'dayjs'; +import { useRef, useState } from 'react'; +interface DataType { + key?: React.Key; + id?: React.Key; +} +export default function CompanySealsSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + // const [selectedDataRow, setSelectedDataRow] = useState({}); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: any = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows, 'selectedRows[0]'); + setSelectedRow(selectedRows); + }, + getCheckboxProps: (record: any) => ({ + disabled: record.deleted_at, + checked: props?.item?.some((item: any) => { + console.log(item, record); + return item?.id === record?.id; + }), + }), + defaultSelectedRowKeys: props?.item?.map((item: any) => item?.id) || [], + }; + + return ( + { + setSelectedRow(props?.item); + console.log(props?.item, 'props?.item?.id'); + }} + node={ + + MyProTableProps.request( + { + ...params, + // 已通过/已签约/已归档的合同才能申请账单 + status_array: [ + ContractsStatusEnum.Approved.value, + ContractsStatusEnum.Signed.value, + ContractsStatusEnum.Archived.value, + ], + // 收支类型 + income_expense_type_array: [ + ContractTemplatesIncomeExpenseTypeEnum.Income.value, + ContractTemplatesIncomeExpenseTypeEnum.Expense.value, + ], + }, + sort, + Apis.Contract.Contracts.List, + ) + } + rowSelection={{ type: 'radio', ...rowSelection }} + options={false} + tableAlertOptionRender={() => { + return ( + { + let res: any = getSelectedRow; + props?.onChange?.(res); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + MyColumns.ID({ search: false }), + { + title: '合同编号', + dataIndex: 'code', + }, + { + title: '合同名称', + dataIndex: 'name', + }, + + { + title: '签订部门', + dataIndex: 'sign_department', + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + }), + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + }), + MyColumns.EnumTag({ + title: '合同性质', + dataIndex: 'contract_nature', + valueEnum: ContractsContractNatureEnum, + }), + { + title: '合同总价', + search: false, + render: (_, item: any) => { + return `¥${item.total_amount}`; + }, + }, + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '开始时间', + dataIndex: 'start_time', + hidden: true, + }, + { + title: '结束时间', + dataIndex: 'end_time', + hidden: true, + }, + ]} + /> + } + > + ); +} diff --git a/src/components/ModalsResourceSelectList.tsx b/src/components/ModalsResourceSelectList.tsx new file mode 100644 index 0000000..024943f --- /dev/null +++ b/src/components/ModalsResourceSelectList.tsx @@ -0,0 +1,122 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ResourceTypesCategoryEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { type TableProps, Image } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +export default function ModalsResourceSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + // const [selectedDataRow, setSelectedDataRow] = useState({}); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: TableProps['rowSelection'] = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows[0], 'selectedRows[0]'); + setSelectedRow(selectedRows[0]); + }, + getCheckboxProps: (record: any) => ({ + disabled: record.deleted_at, + checked: props?.item?.resources_id === record?.id, + }), + defaultSelectedRowKeys: [props?.item?.resources_id], + }; + + return ( + { + setSelectedRow(props?.item); + }} + node={ + + MyProTableProps.request( + { + ...params, + ...props?.item, + }, + sort, + Apis.Resource.Resources.UsableResourceList, + ) + } + rowSelection={{ type: 'radio', ...rowSelection }} + options={false} + tableAlertOptionRender={() => { + return ( + { + let res: any = getSelectedRow; + props?.onChange?.(res); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'category', + valueEnum: ResourceTypesCategoryEnum, + }), + // MyColumns.EnumTag({ + // title: '状态', + // dataIndex: 'reservation_status', + // valueEnum: ResourcesReservationStatusEnum, + // }), + { + title: '项目', + search: false, + dataIndex: ['asset_project', 'name'], + }, + { + title: '楼栋', + search: false, + dataIndex: ['asset_building', 'name'], + }, + { + title: '单元', + search: false, + dataIndex: ['asset_unit', 'name'], + }, + { + title: '封面', + search: false, + render: (_, item: any) => { + return ; + }, + }, + ]} + /> + } + > + ); +} diff --git a/src/components/Select.tsx b/src/components/Select.tsx index d1da7e4..00eb18f 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -1,6 +1,6 @@ import { rulesHelper } from '@/common'; import { Apis } from '@/gen/Apis'; -import { HouseBillsTypeEnum } from '@/gen/Enums'; +import { CompanySealsTypeEnum, HouseBillsTypeEnum } from '@/gen/Enums'; import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components'; type ReturnType = ProColumns & ProFormColumnsType; @@ -797,4 +797,169 @@ export const Selects = { }, }; }, + + //获取合同类型 + ContractTypes(props?: PropsType): ReturnType { + const { + title = '合同类型', + key = 'contract_types_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => { + let res = await Apis.Contract.ContractTypes.Select({ + ...params, + name: params?.keyWords || undefined, + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + // 选择内部企业 + Supplier(props?: PropsType): ReturnType { + const { + title = '选择企业主体', + key = 'company_suppliers_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => { + let res = await Apis.CompanySupplier.CompanySuppliers.Select({ + ...params, + keyWords: params?.keyWords, + }); + res?.data?.forEach((l: any) => { + l.label = l.name; + l.value = l.id; + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + // 选择印章 + CompanySeals(props?: PropsType): ReturnType { + const { + title = '选择印章', + key = 'id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => { + let res = await Apis.CompanySeal.CompanySeals.List({ + ...params, + keyWords: params?.keyWords, + }); + res?.data?.forEach((l: any) => { + // 获取印章类型的友好显示名称 + let typeText = l.type; + if (typeof l.type === 'string') { + const typeKey = l.type as keyof typeof CompanySealsTypeEnum; + if (CompanySealsTypeEnum[typeKey]?.text) { + typeText = CompanySealsTypeEnum[typeKey].text; + } + } + l.label = `${l.company_supplier.name} (${typeText})`; + l.value = l.id; + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + // 合同拟制,选择印章 + ContractSeals(props?: PropsType): ReturnType { + const { + title = '选择印章', + key = 'id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.array : {}) }, + request: async (params) => { + let res = await Apis.CompanySeal.CompanySeals.List({ + ...params, + keyWords: params?.keyWords, + }); + res?.data?.forEach((l: any) => { + // 获取印章类型的友好显示名称 + let typeText = l.type; + if (typeof l.type === 'string') { + const typeKey = l.type as keyof typeof CompanySealsTypeEnum; + if (CompanySealsTypeEnum[typeKey]?.text) { + typeText = CompanySealsTypeEnum[typeKey].text; + } + } + l.label = `${l.company_supplier.name} (${typeText})`; + l.value = l.id; + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, }; diff --git a/src/components/SelectContract.tsx b/src/components/SelectContract.tsx new file mode 100644 index 0000000..bb78f0a --- /dev/null +++ b/src/components/SelectContract.tsx @@ -0,0 +1,277 @@ +import { rulesHelper } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanySealsTypeEnum } from '@/gen/Enums'; +import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components'; + +type ReturnType = ProColumns & ProFormColumnsType; +type PropsType = { required?: boolean } & ReturnType; + +export const SelectContract = { + //选择合同的企业主体 + SupplierName(props?: PropsType): ReturnType { + const { + title = '选择企业主体', + key = 'company_suppliers_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.text : {}) }, + request: async (params) => { + let res = await Apis.CompanySupplier.CompanySuppliers.Select({ + ...params, + keyWords: params?.keyWords, + }); + res?.data?.forEach((l: any) => { + l.label = l.name; + // l.value = `${l.id}:${l.name}`; + l.value = l.name; + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + + //组织树 - 确保只返回最后一个选中的值 + + OrganizationsName(props?: PropsType): ReturnType { + const { + title = '组织', + key = 'organizations_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'cascader', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.text : {}) }, + request: async (params) => + ( + await Apis.Company.Organizations.SelectTree({ + keywords: params?.keyWords, + companies_id: params?.companies_id, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + changeOnSelect: true, + fieldNames: { + label: 'name', + value: 'name', + children: 'children', + }, + ...rest?.fieldProps, + }, + }; + }, + //获取合同类型 + ContractTypes(props?: PropsType): ReturnType { + const { + title = '合同类型', + key = 'contract_types_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => { + let res = await Apis.Contract.ContractTypes.Select({ + ...params, + name: params?.keyWords || undefined, + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + //项目id + AssetProjects(props?: PropsType): ReturnType { + const { + title = '选择项目', + key = 'asset_projects_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => + ( + await Apis.Asset.AssetProjects.Select({ + keywords: params?.keyWords, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + placeholder: '请选择(支持关键字搜索)', + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + //员工 + EmployeeName(props?: PropsType): ReturnType { + const { + title = '员工', + key = 'contract_liaison', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.text : {}) }, + request: async (params) => + ( + await Apis.Company.CompanyEmployees.Select({ + keywords: params?.keyWords, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'label', + }, + ...rest?.fieldProps, + }, + }; + }, + //审核人 + ExamineEmployees(props?: PropsType): ReturnType { + const { + title = '审核人', + key = 'company_employees_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => { + let value = { + keywords: + params?.keyWords === undefined ? params?.name : params?.keyWords, + }; + console.log(params, 'Employees'); + return ( + await Apis.Company.CompanyEmployees.Select({ + ...params, + ...value, + }) + ).data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + // 合同拟制,选择印章 + ContractSeals(props?: PropsType): ReturnType { + const { + title = '选择印章', + key = 'id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.array : {}) }, + request: async (params) => { + let res = await Apis.CompanySeal.CompanySeals.Select({ + ...params, + keyWords: params?.keyWords, + }); + res?.data?.forEach((l: any) => { + // 获取印章类型的友好显示名称 + let typeText = l.type; + if (typeof l.type === 'string') { + const typeKey = l.type as keyof typeof CompanySealsTypeEnum; + if (CompanySealsTypeEnum[typeKey]?.text) { + typeText = CompanySealsTypeEnum[typeKey].text; + } + } + l.label = `${l.company_supplier.name} (${typeText})`; + l.value = l.id; + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, +}; diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 8def227..3641fe7 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -821,6 +821,82 @@ declare namespace ApiTypes { } } namespace Bill { + namespace BillPayments { + type List = { + "bills_id"?: number; // 账单id,[ref:bills] + "status"?: string; // 状态,[enum:BillPaymentsStatusEnum] + }; + type Store = { + "bills_id": number; // 账单id,[ref:bills] + "payment_method": string; // 支付方式,[enum:HouseOrdersPaymentMethodEnum] + "paid_time"?: Date; // 支付时间 + "accept_account_name"?: string; // 收款账号名称 + "accept_account_number"?: string; // 收款账号 + "accept_serial_number"?: string; // 收款流水号 + "pay_certificate"?: string[]; // 支付凭证 + "remark"?: string; // 备注 + }; + type Update = { + "id": number; // id + "payment_method": string; // 支付方式,[enum:HouseOrdersPaymentMethodEnum] + "paid_time"?: Date; // 支付时间 + "accept_account_name"?: string; // 收款账号名称 + "accept_account_number"?: string; // 收款账号 + "accept_serial_number"?: string; // 收款流水号 + "pay_certificate"?: string[]; // 支付凭证 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type Audit = { + "id": number; // 支付记录id + "status": string; // 审核状态 + "rejected_reason"?: string; // 拒绝原因 + }; + type Delete = { + "id": number; // id + }; + } + namespace BillRefunds { + type List = { + "bill_id"?: number; // 账单id + }; + type Store = { + "bill_id": number; // 账单id + "refund_amount"?: number; // 退款金额(单位分) + "refund_reason"?: string; // 退款原因 + "refund_notes"?: string; // 退款备注 + }; + type Show = { + "id": number; // 退款记录id + }; + type Audit = { + "id": number; // 退款记录id + "approved": boolean; // 是否通过 + "notes"?: string; // 审核备注 + }; + } + namespace Bills { + type List = { + "phone"?: string; // 模糊搜索:手机号 + "type"?: string; // 类型,[enum:BillPaymentsTypeEnum] + "flow_type"?: string; // 收支类型,[enum:BillsFlowTypeEnum] + "status"?: string; // 账单状态,[enum:BillsStatusEnum] + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } namespace HouseBills { type List = { "asset_houses_id"?: number; // 资产房屋id,[ref:asset_houses] @@ -991,6 +1067,7 @@ declare namespace ApiTypes { "sex"?: string; // 性别,[enum:SexEnum] "remark"?: string; // 备注 "roles_id"?: string[]; // 角色ID数组 + "employee_roles_id"?: string[]; // 员工端角色ID数组 }; type Update = { "id": number; // id @@ -1002,6 +1079,7 @@ declare namespace ApiTypes { "sex"?: string; // 性别,[enum:SexEnum] "remark"?: string; // 备注 "roles_id"?: string[]; // 角色ID数组 + "employee_roles_id"?: string[]; // 员工端角色ID数组 }; type ResetPassword = { "id": number; // id @@ -1239,6 +1317,942 @@ declare namespace ApiTypes { }; } } + namespace CompanySeal { + namespace CompanySeals { + type List = { + "company_supplier_name"?: string; // 企业名称 + "type"?: string; // 印章类型,[enum:CompanySealsTypeEnum] + }; + type Store = { + "company_suppliers_id": number; // 企业名称 + "type": string; // 印章类型,[enum:CompanySealsTypeEnum] + "use_date"?: Date; // 启用日期 + "company_employees_id": number; // 保管人id,[ref:company_employees] + "seal_image"?: string[]; // 印章图片 + "is_enabled"?: number; // 是否启用 + "remarks"?: string; // 备注 + }; + type Update = { + "id": number; // id + "company_suppliers_id": number; // 企业名称 + "type": string; // 印章类型,[enum:CompanySealsTypeEnum] + "use_date"?: Date; // 启用日期 + "seal_image"?: string[]; // 印章图片 + "is_enabled"?: number; // 是否启用 + "remarks"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type ExchangeHolder = { + "id": number; // 印章id + "company_employees_id": number; // 新保管人id,[ref:company_employees] + "exchange_date": Date; // 交换日期 + "remark"?: string; // 备注 + }; + type ExchangeRecord = { + "id": number; // 印章id + }; + type Select = { + "company_supplier_name"?: string; // 企业名称 + "type"?: string; // 印章类型,[enum:CompanySealsTypeEnum] + }; + } + } + namespace CompanySupplier { + namespace CompanySupplierGrades { + type List = { + "company_suppliers_id"?: number; // 供应商id,[ref:company_suppliers] + "supplier_name"?: string; // 模糊搜索:供应商名称 + "grade"?: string; // 供应商等级,[enum:CompanySuppliersGradeEnum] + }; + type Store = { + "company_suppliers_id": number; // 供应商id,[ref:company_suppliers] + "grade": string; // 供应商等级,[enum:CompanySuppliersGradeEnum] + "grade_remark"?: string; // 评级备注 + "grade_files"?: string[]; // 评级附件 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace CompanySuppliers { + type List = { + "id"?: number; // id + "name"?: string; // 模糊搜索:名称 + "counterparty"?: string; // 交易方类型,[enum:CompanySuppliersCounterpartyEnum] + "supplier_type"?: string; // 供应商类型,[enum:CompanySuppliersSupplierTypeEnum] + "legal_person"?: string; // 法定代表人 + "contact_name"?: string; // 联系人姓名 + "contact_phone"?: string; // 联系人电话 + "tax_number"?: string; // 纳税人识别号 + "is_blacklisted"?: boolean; // 是否黑名单 0:否 1:是 + }; + type Store = { + "counterparty": string; // 交易方类型,[enum:CompanySuppliersCounterpartyEnum] + "supplier_type": string; // 供应商类型,[enum:CompanySuppliersSupplierTypeEnum] + "name": string; // 供应商名称 + "province"?: string; // 省份 + "city"?: string; // 城市 + "area"?: string; // 区县 + "street"?: string; // 街道 + "address"?: string; // 地址 + "legal_person"?: string; // 法定代表人 + "registered_capital"?: number; // 注册资本 + "business_scope"?: string; // 经营范围 + "certificate_type"?: string; // 证件类型,[enum:CompanySuppliersCertificateTypeEnum] + "certificate_number"?: string; // 证件号码 + "is_blacklisted"?: boolean; // 是否黑名单 0:否 1:是 + "reason"?: string; // 拉黑原因 + "company_name"?: string; // 公司名称 + "tax_number"?: string; // 纳税人识别号 + "tax_address"?: string; // 注册地址 + "tax_phone"?: string; // 注册电话 + "tax_bank_name"?: string; // 开户银行 + "tax_bank_account"?: string; // 银行账号 + "is_general_taxpayer"?: number; // 是否一般纳税人 + "contact_name"?: string; // 联系人姓名 + "contact_phone"?: string; // 联系人电话 + "contact_email"?: string; // 联系人邮箱 + "contact_remark"?: string; // 联系人备注 + "bank_accounts"?: string[]; // 银行账号信息 + "certificates"?: string[]; // 证件资料 + }; + type Update = { + "id": number; // id + "counterparty": string; // 交易方类型,[enum:CompanySuppliersCounterpartyEnum] + "supplier_type": string; // 供应商类型,[enum:CompanySuppliersSupplierTypeEnum] + "name": string; // 供应商名称 + "province"?: string; // 省份 + "city"?: string; // 城市 + "area"?: string; // 区县 + "street"?: string; // 街道 + "address"?: string; // 地址 + "legal_person"?: string; // 法定代表人 + "registered_capital"?: number; // 注册资本 + "business_scope"?: string; // 经营范围 + "certificate_type"?: string; // 证件类型,[enum:CompanySuppliersCertificateTypeEnum] + "certificate_number"?: string; // 证件号码 + "is_blacklisted"?: boolean; // 是否黑名单 0:否 1:是 + "reason"?: string; // 拉黑原因 + "company_name"?: string; // 公司名称 + "tax_number"?: string; // 纳税人识别号 + "tax_address"?: string; // 注册地址 + "tax_phone"?: string; // 注册电话 + "tax_bank_name"?: string; // 开户银行 + "tax_bank_account"?: string; // 银行账号 + "is_general_taxpayer"?: number; // 是否一般纳税人 + "contact_name"?: string; // 联系人姓名 + "contact_phone"?: string; // 联系人电话 + "contact_email"?: string; // 联系人邮箱 + "contact_remark"?: string; // 联系人备注 + "bank_accounts"?: string[]; // 银行账号信息 + "certificates"?: string[]; // 证件资料 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type Select = { + "name"?: string; // 模糊搜索:名称 + "counterparty"?: string; // 交易方类型,[enum:CompanySuppliersCounterpartyEnum] + "supplier_type"?: string; // 供应商类型,[enum:CompanySuppliersSupplierTypeEnum] + "legal_person"?: string; // 法定代表人 + "contact_name"?: string; // 联系人姓名 + "contact_phone"?: string; // 联系人电话 + "tax_number"?: string; // 纳税人识别号 + "is_blacklisted"?: boolean; // 是否黑名单 0:否 1:是 + }; + } + namespace SupplierCreditReports { + type List = { + "company_suppliers_id": number; // 供应商ID + "investigation_agency"?: string; // 调查机构 + "credit_rating"?: string; // 信用评级 + }; + type Store = { + "company_suppliers_id": number; // 供应商ID + "issue_date": Date; // 出具日期 + "expiry_date": Date; // 有效期 + "investigation_agency": string; // 调查机构 + "credit_rating": string; // 信用评级,[enum:CreditRatingEnum] + "rating_outlook": string; // 评级展望,[enum:RatingOutlookEnum] + "has_execution_info": boolean; // 是否有失信被执行信息 + "execution_info"?: required_if:has_execution_info,true; // 执行信息 + "has_lawsuit_record": boolean; // 是否有法律诉讼记录 + "lawsuit_info"?: required_if:has_lawsuit_record,true; // 诉讼信息 + "has_admin_penalty": boolean; // 是否有行政处罚记录 + "admin_penalty_info"?: required_if:has_admin_penalty,true; // 处罚信息 + "performance_evaluation"?: string; // 履约能力评价 + "remark"?: string; // 备注 + "files"?: string[]; // 文件 + }; + type Update = { + "id": number; // id + "issue_date"?: Date; // 出具日期 + "expiry_date"?: Date; // 有效期 + "investigation_agency"?: string; // 调查机构 + "creator_name"?: string; // 创建人姓名 + "creator_phone"?: string; // 创建人电话 + "credit_rating"?: string; // 信用评级,[enum:CreditRatingEnum] + "rating_outlook"?: string; // 评级展望,[enum:RatingOutlookEnum] + "has_execution_info"?: boolean; // 是否有失信被执行信息 + "execution_info"?: string; // 执行信息 + "has_lawsuit_record"?: boolean; // 是否有法律诉讼记录 + "lawsuit_info"?: string; // 诉讼信息 + "has_admin_penalty"?: boolean; // 是否有行政处罚记录 + "admin_penalty_info"?: string; // 处罚信息 + "performance_evaluation"?: string; // 履约能力评价 + "remark"?: string; // 备注 + "files"?: string[]; // 文件 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace SupplierFieldReports { + type List = { + "company_suppliers_id": number; // 供应商ID + "investigator"?: string; // 调查人 + "location"?: string; // 调查地点 + }; + type Store = { + "company_suppliers_id": number; // 供应商ID + "investigation_start_date": Date; // 调查起始日期 + "investigation_end_date": Date; // 调查结束日期 + "location": string; // 调查地点 + "investigator": number; // 调查人id + "issue_date": Date; // 出具日期 + "info_verification": string; // 信息核实,[enum:InfoVerificationEnum] + "discrepancy_note"?: required_if:info_verification,Discrepancy,Fake; // 差异说明 + "qualification_evaluation": string; // 资质评价,[enum:QualificationEvaluationEnum] + "risk_level": string; // 风险等级,[enum:RiskLevelEnum] + "cooperation_suggestion": string; // 合作建议,[enum:CooperationSuggestionEnum] + "comprehensive_explanation"?: string; // 综合说明 + "files"?: string[]; // 文件 + }; + type Update = { + "id": number; // id + "investigation_start_date"?: Date; // 调查起始日期 + "investigation_end_date"?: Date; // 调查结束日期 + "location"?: string; // 调查地点 + "investigator"?: number; // 调查人id + "creator_name"?: string; // 创建人姓名 + "creator_phone"?: string; // 创建人电话 + "issue_date"?: Date; // 出具日期 + "info_verification"?: string; // 信息核实,[enum:InfoVerificationEnum] + "discrepancy_note"?: string; // 差异说明 + "qualification_evaluation"?: string; // 资质评价,[enum:QualificationEvaluationEnum] + "risk_level"?: string; // 风险等级,[enum:RiskLevelEnum] + "cooperation_suggestion"?: string; // 合作建议,[enum:CooperationSuggestionEnum] + "comprehensive_explanation"?: string; // 综合说明 + "files"?: string[]; // 文件 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } + namespace Contract { + namespace ContractArchiveBorrows { + type List = { + "contract_archives_id"?: number; // 归档记录ID + "contracts_id"?: number; // 合同ID + "borrower_name"?: string; // 模糊搜索: 借用人姓名 + "borrow_status"?: string; // 借用状态,[enum:ContractArchiveBorrowStatusEnum] + "return_status"?: string; // 归还状态,[enum:ContractArchiveReturnStatusEnum] + "borrow_date"?: string[]; // 借用日期范围 + "is_need_return"?: boolean; // 是否需要归还 + }; + type Store = { + "contract_archives_id": number; // 归档记录ID + "borrower_id": number; // 借用人ID + "borrow_date": Date; // 借用日期 + "expected_return_date"?: Date; // 预计归还日期 + "borrow_reason"?: string; // 借用原因 + "is_need_return"?: boolean; // 是否需要归还 + "files": string[]; // 借用文件列表 + "approval_templates_id": number; // 审批模板id + "remark"?: string; // 申请备注 + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type Borrow = { + "id": number; // 归档记录ID + }; + type Show = { + "id": number; // id + }; + type Return = { + "id": number; // 借用记录ID + "returner_id": number; // 归还人ID + "files": string[]; // 归还文件列表 + }; + type SoftDelete = { + "id": number; // id + }; + } + namespace ContractArchiveFiles { + type List = { + "contract_archives_id"?: number; // 归档记录ID + "contracts_id"?: number; // 合同ID + "name"?: string; // 模糊搜索: 文件名称 + "type"?: string; // 文件类型,[enum:ContractArchivesFileTypeEnum] + "status"?: string; // 文件状态,[enum:ContractArchivesFileStatusEnum] + }; + type Show = { + "id": number; // id + }; + type GetAvailableFiles = { + "contract_archives_id": number; // 归档记录ID + }; + } + namespace ContractArchiveReads { + type List = { + "contract_archives_id"?: number; // 归档记录ID + "contracts_id"?: number; // 合同ID + "reader_name"?: string; // 模糊搜索: 借阅人姓名 + "read_date"?: string[]; // 借阅日期范围 + }; + type Store = { + "contract_archives_id": number; // 归档记录ID + "reader_id": number; // 借阅人ID + "read_date": Date; // 借阅日期 + "start_time"?: Date; // 开始时间 + "read_reason"?: string; // 借阅原因 + "remark"?: string; // 备注 + "files": string[]; // 借阅文件列表 + }; + type Show = { + "id": number; // id + }; + type EndRead = { + "id": number; // 借阅记录ID + }; + type SoftDelete = { + "id": number; // id + }; + } + namespace ContractArchiveTransfers { + type List = { + "contract_archives_id"?: number; // 归档记录ID + "contracts_id"?: number; // 合同ID + "old_keeper_name"?: string; // 模糊搜索: 原保管人姓名 + "new_keeper_name"?: string; // 模糊搜索: 新保管人姓名 + "transfer_date"?: string[]; // 转交日期范围 + }; + type Store = { + "contract_archives_id": number; // 归档记录ID + "new_keeper_id": number; // 新保管人ID + "new_location"?: string; // 新存放位置 + "province"?: string; // 省份 + "city"?: string; // 城市 + "area"?: string; // 县/区 + "street"?: string; // 街道 + "address"?: string; // 地址 + "file_number"?: string; // 案卷编号 + "box_number"?: string; // 文件盒编号 + "cabinet_number"?: string; // 文件柜编号 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + } + namespace ContractArchives { + type List = { + "code"?: string; // 模糊搜索: 编号 + "name"?: string; // 模糊搜索:名称 + "contracts_id"?: number; // 合同ID + "period_type"?: string; // 保管期限类型,[enum:ContractArchivesPeriodTypeEnum] + "file_number"?: string; // 案卷编号 + "box_number"?: string; // 文件盒编号 + "keeper_name"?: string; // 保管人姓名 + "keeper_phone"?: string; // 保管人电话 + "asset_projects_id"?: number; // 资产项目ID + "is_sealed"?: boolean; // 是否封存: 0:否,1:是 + "seal_date"?: string[]; // 封存日期 + "employee_name"?: string; // 封存人姓名 + }; + type Store = { + "code": string; // 归档编号 + "name": string; // 归档名称 + "contracts_id"?: number; // 合同ID + "period_type": string; // 保管期限类型,[enum:ContractArchivesPeriodTypeEnum] + "storage_years"?: number; // 保管年限 + "confidentiality_level": string; // 保密等级,[enum:ContractArchivesConfidentialityLevelEnum] + "file_number"?: string; // 案卷编号 + "box_number"?: string; // 文件盒编号 + "cabinet_number"?: string; // 文件柜编号 + "province"?: string; // 省份 + "city"?: string; // 城市 + "area"?: string; // 县/区 + "street"?: string; // 街道 + "address"?: string; // 地址 + "is_sealed"?: boolean; // 是否封存: 0:否,1:是 + "seal_date"?: Date; // 封存日期 + "archive_date"?: Date; // 归档日期 + "archive_year"?: number; // 归档年份 + "archive_files"?: string[]; // 归档文件目录 + }; + type Update = { + "id": number; // id + "code": string; // 归档编号 + "name": string; // 归档名称 + "contracts_id"?: number; // 合同ID + "period_type": string; // 保管期限类型,[enum:ContractArchivesPeriodTypeEnum] + "storage_years"?: number; // 保管年限 + "confidentiality_level": string; // 保密等级,[enum:ContractArchivesConfidentialityLevelEnum] + "file_number"?: string; // 案卷编号 + "box_number"?: string; // 文件盒编号 + "cabinet_number"?: string; // 文件柜编号 + "province"?: string; // 省份 + "city"?: string; // 城市 + "area"?: string; // 县/区 + "street"?: string; // 街道 + "address"?: string; // 地址 + "is_sealed"?: boolean; // 是否封存: 0:否,1:是 + "seal_date"?: Date; // 封存日期 + "archive_date"?: Date; // 归档日期 + "archive_year"?: number; // 归档年份 + "archive_files"?: string[]; // 归档文件目录 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type ChangeKeeper = { + "id": number; // id + "company_employee_id": number; // 员工ID + }; + type GetChangeKeeperLog = { + "id": number; // 归档id + }; + } + namespace ContractBillObjects { + type List = { + "contract_bills_id"?: number; // 合同账单id,[ref:contract_bills] + "contracts_id"?: number; // 合同id,[ref:contracts] + "name"?: string; // 标的名称 + "status"?: string; // 标的状态,[enum:ContractBillObjectsStatusEnum] + }; + type Store = { + "contract_bills_id": number; // 合同账单id,[ref:contract_bills] + "name": string; // 标的名称 + "amount": number; // 标的金额(单位元) + "description"?: string; // 标的说明 + "status"?: string; // 标的状态,[enum:ContractBillObjectsStatusEnum] + "attachments"?: string[]; // 附件 + "remark"?: string; // 备注 + }; + type Update = { + "id": number; // id + "name": string; // 标的名称 + "amount": number; // 标的金额(单位元) + "description"?: string; // 标的说明 + "status"?: string; // 标的状态,[enum:ContractBillObjectsStatusEnum] + "attachments"?: string[]; // 附件 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type CompleteApply = { + "id": number; // id + "completed_time": Date; // 完成时间 + "completed_description": string; // 完成说明 + "completed_attachments"?: string[]; // 附件 + "cost_type": string; // 增减费用类型,[enum:ContractBillsIncomeExpenseTypeEnum] + "cost_amount": number; // 减费用金额(单位元) + "approval_templates_id": number; // 审批模板id + "remark"?: string; // 申请备注 + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace ContractBillPayments { + type List = { + "contracts_id"?: number; // 合同id,[ref:contracts] + "contract_bills_id"?: number; // 合同账单id,[ref:contract_bills] + "cost_type"?: string; // 费用类型,[enum:ContractBillsCostTypeEnum] + "status"?: string; // 状态,[enum:ContractBillPaymentsStatusEnum] + "payment_method"?: string; // 支付方式,[enum:HouseOrdersPaymentMethodEnum] + "payment_no"?: string; // 支付发起单号 + "accept_account_number"?: string; // 收款账号 + "accept_serial_number"?: string; // 收款流水号 + }; + type Store = { + "contract_bills_id": number; // 合同账单id,[ref:contract_bills] + "amount": number; // 金额(元) + "payment_method": string; // 支付方式,[enum:HouseOrdersPaymentMethodEnum] + "paid_time": Date; // 支付时间 + "accept_account_name"?: string; // 收款账号名称 + "accept_account_number"?: string; // 收款账号 + "accept_bank_name"?: string; // 收款银行名称 + "accept_serial_number": string; // 收款流水号 + "pay_certificate"?: string[]; // 支付凭证 + "remark"?: string; // 备注 + }; + type Update = { + "id": number; // id + "amount": number; // 金额(元) + "payment_method": string; // 支付方式,[enum:HouseOrdersPaymentMethodEnum] + "paid_time": Date; // 支付时间 + "accept_account_name"?: string; // 收款账号名称 + "accept_account_number"?: string; // 收款账号 + "accept_serial_number": string; // 收款流水号 + "pay_certificate"?: string[]; // 支付凭证 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type Audit = { + "id": number; // id + "status": string; // 审核状态,Approved-通过,Rejected-拒绝 + "rejected_reason"?: string; // 拒绝原因 + }; + } + namespace ContractBills { + type List = { + "contracts_id"?: number; // 合同id,[ref:contracts] + "cost_type"?: string; // 费用类型,[enum:ContractBillsCostTypeEnum] + "payment_status"?: string; // 支付状态,[enum:HouseOrdersOrderStatusEnum] + "year"?: number; // 年 + "month"?: number; // 月份 + "contract_name"?: string; // 合同名称 + "payee"?: string; // 收款方 + "payer"?: string; // 付款方 + "company_suppliers_id"?: number; // 供应商id,[ref:company_suppliers] + "is_valid"?: boolean; // 是否有效 + "audit_status"?: string; // 审核状态,[enum:ContractBillsAuditStatusEnum] + }; + type Store = { + "contracts_id": number; // 合同id,[ref:contracts] + "cost_type": string; // 费用类型,[enum:ContractBillsCostTypeEnum] + "year": number; // 年 + "month": number; // 月份 + "period_num"?: number; // 期数 + "amount": number; // 金额(单位元) + "remark"?: string; // 备注 + "payee"?: string; // 收款方 + "payee_bank"?: string; // 收款方银行 + "payee_account"?: string; // 收款方账号 + "payer"?: string; // 付款方 + "payer_bank"?: string; // 付款方银行 + "payer_account"?: string; // 付款方账号 + "object_name"?: string; // 标的名称 + }; + type BatchStore = { + "contracts_id": number; // 合同id,[ref:contracts] + "bills": string[]; // 账单列表 + }; + type BatchUpdate = { + "contracts_id": number; // 合同id,[ref:contracts] + "bills": string[]; // 账单列表 + }; + type Update = { + "id": number; // id + "cost_type": string; // 费用类型,[enum:ContractBillsCostTypeEnum] + "year": number; // 年 + "month": number; // 月份 + "period_num"?: number; // 期数 + "amount": number; // 金额(单位元) + "payee"?: string; // 收款方 + "payee_bank"?: string; // 收款方银行 + "payee_account"?: string; // 收款方账号 + "payer"?: string; // 付款方 + "payer_bank"?: string; // 付款方银行 + "payer_account"?: string; // 付款方账号 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type Export = { + "contracts_id"?: number; // 合同id,[ref:contracts] + "cost_type"?: string; // 费用类型,[enum:ContractBillsCostTypeEnum] + "payment_status"?: string; // 支付状态,[enum:HouseOrdersOrderStatusEnum] + "year"?: number; // 年 + "month"?: number; // 月份 + "contract_name"?: string; // 合同名称 + "payee"?: string; // 收款方 + "payer"?: string; // 付款方 + "company_suppliers_id"?: number; // 供应商id,[ref:company_suppliers] + "is_valid"?: boolean; // 是否有效 + "audit_status"?: string; // 审核状态,[enum:ContractBillsAuditStatusEnum] + "current"?: number; // 页码 + "pageSize"?: number; // 每页条数 + "download_type": string; // 下载类型:page 当前页(含查询条件),query 所有页(含查询条件),all所有记录 + }; + } + namespace ContractDisputeRecords { + type List = { + "contracts_id": number; // 关联合同id + }; + type Store = { + "contracts_id": number; // 关联合同id,[ref:contracts] + "reason": string; // 争议原因 + "content"?: string; // 处理内容 + "attachments"?: string[]; // 附件 + }; + type Update = { + "id": number; // id + "reason": string; // 争议原因 + "content"?: string; // 处理内容 + "attachments"?: string[]; // 附件 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace ContractOthers { + type List = { + "company_employees_id"?: number; // 申请人 + "asset_projects_id"?: number; // 关联项目 + "title"?: string; // 用印申请/标题(模糊搜索) + "status"?: string; // 审批状态 + "is_sealed"?: boolean; // 是否已用印 + }; + type Store = { + "title": string; // 用印申请/标题 + "asset_projects_id": number; // 关联项目 + "seals": string[]; // 印章快照 + "reason": string; // 简要说明 + "copies": number; // 份数 + "files": string[]; // 附件 + "approval_templates_id": number; // 审批模板id + "remark"?: string; // 备注 + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type Update = { + "id": number; // id + "title"?: string; // 用印申请/标题 + "seals"?: string[]; // 印章快照 + "reason"?: string; // 简要说明 + "copies"?: number; // 份数 + "files"?: string[]; // 附件 + "approval_templates_id": number; // 审批模板id + "remark"?: string; // 备注 + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type Show = { + "id": number; // id + }; + type Seal = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace ContractSealLogs { + type List = { + "contracts_id"?: number; // 合同IDid,[ref:contracts] + "name"?: string; // 模糊搜索:合同名称 + "code"?: string; // 模糊搜索:合同编号 + "is_use_seal"?: boolean; // 是否用印 0:否 1:是 + }; + type Store = { + "company_employees_id": number; // 用印人id,[ref:company_employees] + "contracts_id": number; // 合同IDid,[ref:contracts] + "number_contract_copies": number; // 合同份数 + "is_use_seal"?: boolean; // 是否用印 0:否 1:是 + "use_seal_time"?: Date; // 用印时间 + "is_external_seal_usage"?: number; // 是否外出用印 + "seal_ids"?: string[]; // 印章id列表 + "remarks"?: string; // 备注 + }; + type Update = { + "id": number; // id + "company_employees_id": number; // 用印人id,[ref:company_employees] + "contracts_id": number; // 合同IDid,[ref:contracts] + "number_contract_copies": number; // 合同份数 + "is_use_seal"?: boolean; // 是否用印 0:否 1:是 + "use_seal_time"?: Date; // 用印时间 + "is_external_seal_usage"?: number; // 是否外出用印 + "seal_ids"?: string[]; // 印章id列表 + "remarks"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace ContractTemplates { + type List = { + "name"?: string; // 模糊搜索:名称 + "code"?: string; // 模糊搜索:编号 + "is_enabled"?: number; // 是否启用 + "source"?: string; // 合同模板来源,[enum:ContractTemplatesSourceEnum] + "income_expense_type"?: string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "contract_types_id"?: number; // 合同类型id,[ref:contract_types] + "type_name"?: string; // 合同类型名称 + }; + type Store = { + "name": string; // 合同模板名称 + "code": string; // 合同模板编号 + "source": string; // 合同模板来源,[enum:ContractTemplatesSourceEnum] + "income_expense_type": string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "contract_types_id": number; // 合同类型id,[ref:contract_types] + "is_enabled"?: number; // 是否启用 + "description"?: string; // 合同模板描述 + "attachment"?: string[]; // 合同模板附件 + }; + type Update = { + "id": number; // id + "name": string; // 合同模板名称 + "code": string; // 合同模板编号 + "source": string; // 合同模板来源,[enum:ContractTemplatesSourceEnum] + "income_expense_type": string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "contract_types_id": number; // 合同类型id,[ref:contract_types] + "is_enabled"?: number; // 是否启用 + "description"?: string; // 合同模板描述 + "attachment"?: string[]; // 合同模板附件 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace ContractTypes { + type List = { + "name"?: string; // 模糊搜索:名称 + }; + type Store = { + "name": string; // 名称 + "is_enabled"?: number; // 是否启用 + }; + type Update = { + "id": number; // id + "name": string; // 名称 + "is_enabled"?: number; // 是否启用 + }; + type ChangeStatus = { + "id": number; // id + "is_enabled"?: number; // 是否启用 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type Select = { + "name"?: string; // 模糊搜索:名称 + }; + } + namespace Contracts { + type List = { + "name"?: string; // 模糊搜索:名称 + "code"?: string; // 模糊搜索:编号 + "status"?: string; // 状态,[enum:ContractsStatusEnum] + "status_array"?: string[]; // 状态,[enum:ContractsStatusEnum] + "counterparty"?: string; // 交易方名称 + "is_seal"?: boolean; // 是否用印: 0否,1是 + "end_time"?: Date; // 到期时间 + "contract_types_id"?: number; // 合同类型id,[ref:contract_types] + "contract_type_name"?: string; // 合同类型名称 + "asset_projects_id"?: number; // 关联项目id,[ref:asset_projects] + "project_name"?: string; // 项目名称 + "sign_department"?: string; // 签约部门 + "contract_liaison"?: string; // 合同对接人 + "company_suppliers_id"?: number; // 供应商id,[ref:company_suppliers] + "income_expense_type"?: string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "income_expense_type_array"?: string[]; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "contract_nature"?: string[]; // 合同性质,[enum:ContractsContractNatureEnum] + "parent_id"?: number; // 父级合同id + "is_agreement"?: boolean; // 是否为协议:0否,1是 + }; + type PendingReviewList = { + "name"?: string; // 模糊搜索:名称 + "code"?: string; // 模糊搜索:编号 + "contract_nature"?: string; // 合同性质,[enum:ContractsContractNatureEnum] + }; + type Store = { + "parent_id"?: number; // 父级合同id + "name": string; // 合同名称 + "income_expense_type": string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "contract_nature": string; // 合同性质,[enum:ContractsContractNatureEnum] + "contract_types_id"?: number; // 合同类型id,[ref:contract_types] + "start_time"?: Date; // 合同开始时间 + "end_time"?: Date; // 合同结束时间 + "settlement_mode"?: string; // 结算模式,[enum:ContractsSettlementModeEnum] + "total_amount"?: number; // 合同总金额 + "is_deposit"?: boolean; // 是否有保证金 + "deposit_amount"?: number; // 保证金金额 + "sign_subject": string; // 签约主体 + "asset_projects_id": number; // 关联项目 + "sign_department"?: string; // 签约部门 + "contract_liaison": string; // 合同对接人 + "number_contract_copies": number; // 合同份数 + "remarks"?: string; // 合同备注 + "attachments"?: string[]; // 合同附件 + "seal_info"?: string[]; // 签章信息 + "peoples"?: string[]; // 签约人员列表 + "resources_id"?: number; // 资源id + }; + type Update = { + "id": number; // id + "parent_id"?: number; // 父级合同id + "name": string; // 合同名称 + "income_expense_type": string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "contract_nature": string; // 合同性质,[enum:ContractsContractNatureEnum] + "contract_types_id"?: number; // 合同类型id,[ref:contract_types] + "start_time"?: Date; // 合同开始时间 + "end_time"?: Date; // 合同结束时间 + "settlement_mode"?: string; // 结算模式,[enum:ContractsSettlementModeEnum] + "total_amount"?: number; // 合同总金额 + "is_deposit"?: boolean; // 是否有保证金 + "deposit_amount"?: number; // 保证金金额 + "sign_subject": string; // 签约主体 + "asset_projects_id": number; // 关联项目 + "sign_department"?: string; // 签约部门 + "contract_liaison": string; // 合同对接人 + "number_contract_copies": number; // 合同份数 + "remarks"?: string; // 合同备注 + "attachments"?: string[]; // 合同附件 + "seal_info"?: string[]; // 签章信息 + "peoples"?: string[]; // 签约人员列表 + "resources_id"?: number; // 资源id + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type ContractCopy = { + "id": number; // id + }; + type Terminated = { + "id": number; // 合同id + "terminated_reason"?: string; // 终止合同原因 + "approval_templates_id": number; // 审批模板id + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type Voided = { + "id": number; // id + "voided_reason"?: string; // 作废原因 + }; + type SubmitApproval = { + "id": number; // 合同id + "approval_templates_id": number; // 审批模板id + "remark"?: string; // 备注 + "node_approvers"?: string[]; // 各节点审批人员列表 + }; + type Export = { + "name"?: string; // 模糊搜索:名称 + "code"?: string; // 模糊搜索:编号 + "status"?: string; // 状态,[enum:ContractsStatusEnum] + "status_array"?: string[]; // 状态,[enum:ContractsStatusEnum] + "counterparty"?: string; // 交易方名称 + "is_seal"?: boolean; // 是否用印: 0否,1是 + "end_time"?: Date; // 到期时间 + "contract_types_id"?: number; // 合同类型id,[ref:contract_types] + "contract_type_name"?: string; // 合同类型名称 + "asset_projects_id"?: number; // 关联项目id,[ref:asset_projects] + "project_name"?: string; // 项目名称 + "sign_department"?: string; // 签约部门 + "contract_liaison"?: string; // 合同对接人 + "company_suppliers_id"?: number; // 供应商id,[ref:company_suppliers] + "income_expense_type"?: string; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "income_expense_type_array"?: string[]; // 收支类型,[enum:ContractTemplatesIncomeExpenseTypeEnum] + "parent_id"?: number; // 父级合同id + "is_agreement"?: boolean; // 是否为协议:0否,1是 + "current"?: number; // 页码 + "pageSize"?: number; // 每页条数 + "download_type": string; // 下载类型:page 当前页(含查询条件),query 所有页(含查询条件),all所有记录 + }; + } + } namespace GoodsReleases { namespace GoodsReleases { type List = { @@ -1611,6 +2625,13 @@ declare namespace ApiTypes { "total_payable_amount": number; // 应付金额 "bill_ids": string[]; // 账单id }; + type AlipayQrCode = { + "amount": number; // 金额 + "discount_amount"?: number; // 优惠金额 + "late_fee"?: number; // 滞纳金 + "total_payable_amount": number; // 应付金额 + "bill_ids": string[]; // 账单id + }; type ImportOfflinePayment = { "upload_file": mimes:xlsx,xls; // 上传文件 }; @@ -1925,6 +2946,49 @@ declare namespace ApiTypes { }; } } + namespace QualityCheck { + namespace QualityChecks { + type List = { + "asset_projects_id"?: number; // 资产项目id,[ref:asset_projects] + "project_name"?: string; // 模糊搜索:项目名称 + "check_object"?: string; // 模糊搜索:检查对象 + "check_date"?: string[]; // 检查日期范围 + "employee_name"?: string; // 模糊搜索:检查人姓名 + "employee_phone"?: string; // 模糊搜索:检查人手机 + }; + type Store = { + "asset_projects_id": number; // 资产项目id,[ref:asset_projects] + "check_date": Date; // 检查日期 + "check_object": string; // 检查对象 + "check_score"?: number; // 检查得分 + "check_description"?: string; // 检查描述 + "check_images"?: string[]; // 检查图片 + "is_rectification"?: boolean; // 是否整改 + "rectification_description"?: string; // 整改描述 + "rectification_date"?: Date; // 整改限期 + "rectification_images"?: string[]; // 整改图片 + }; + type Update = { + "id": number; // id + "asset_projects_id": number; // 资产项目id,[ref:asset_projects] + "check_date": Date; // 检查日期 + "check_object": string; // 检查对象 + "check_score"?: number; // 检查得分 + "check_description"?: string; // 检查描述 + "check_images"?: string[]; // 检查图片 + "is_rectification"?: boolean; // 是否整改 + "rectification_description"?: string; // 整改描述 + "rectification_date"?: Date; // 整改限期 + "rectification_images"?: string[]; // 整改图片 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace Refund { namespace Refunds { type List = { @@ -1963,6 +3027,346 @@ declare namespace ApiTypes { }; } } + namespace Renovation { + namespace RenovationApplies { + type List = { + "full_name"?: string; // 模糊搜索:房屋名称 + "status"?: string; // 状态,[enum:RenovationAppliesStatusEnum] + "construction_status"?: string; // 施工状态,[enum:RenovationAppliesConstructionStatusEnum] + "acceptance_status"?: string; // 验收状态,[enum:RenovationAppliesAcceptanceStatusEnum] + "owner_name"?: string; // 业主名称 + "owner_phone"?: string; // 业主手机号 + "agent_name"?: string; // 代理人名称 + "agent_phone"?: string; // 代理人手机号 + }; + type Store = { + "asset_houses_id": number; // 所属房屋id,[ref:asset_houses] + "type": string; // 装修类型,[enum:RenovationAppliesTypeEnum] + "process_type": string; // 办理类型,[enum:RenovationAppliesProcessTypeEnum] + "is_deposit"?: number; // 是否有保证金 + "deposit_amount"?: number; // 保证金金额 + "owner_name": string; // 业主名称 + "owner_phone": string; // 业主手机 + "card_type": string; // 证件类型,[enum:HouseOccupantsCardTypeEnum] + "owner_id_card": string; // 业主身份证 + "id_card_front"?: string[]; // 身份证正面 + "id_card_back"?: string[]; // 身份证反面 + "property_certificate"?: string[]; // 产权证明 + "agent_name"?: string; // 代理人名称 + "agent_phone"?: string; // 代理人手机 + "agent_card_type"?: string; // 代理人证件类型,[enum:HouseOccupantsCardTypeEnum] + "agent_id_card"?: string; // 代理人身份证 + "agent_id_card_front"?: string[]; // 代理人身份证正面 + "agent_id_card_back"?: string[]; // 代理人身份证反面 + "power_attorney"?: string[]; // 代理人授权书 + "construction_principal_name"?: string; // 施工负责人名称 + "construction_principal_phone"?: string; // 施工负责人手机 + "construction_principal_card_type"?: string; // 施工负责人证件类型,[enum:HouseOccupantsCardTypeEnum] + "construction_principal_id_card"?: string; // 施工负责人身份证 + "construction_principal_id_card_front"?: string[]; // 施工负责人身份证正面 + "construction_principal_id_card_back"?: string[]; // 施工负责人身份证反面 + "construction_start_date"?: Date; // 施工开始时间 + "construction_end_date"?: Date; // 施工结束时间 + "renovation_content"?: string; // 装修内容,[enum:RenovationAppliesRenovationContentEnum] + "renovation_remark"?: string; // 装修备注 + "construction_draw"?: string[]; // 施工图 + "construction_commitment_letter"?: string[]; // 施工承诺书 + "company_name"?: string; // 装修公司名称 + "company_principal_name"?: string; // 装修公司负责人名称 + "company_principal_phone"?: string; // 装修公司负责人手机 + "company_business_license_num"?: string; // 装修公司营业执照号 + "company_business_license"?: string[]; // 装修公司营业执照 + "company_asset_certificate"?: string[]; // 装修公司资产证明 + "company_power_attorney"?: string[]; // 装修公司装修授权书 + "other_attachments"?: string[]; // 其他附件 + "major_construction"?: string[]; // 主要施工项 + }; + type Update = { + "id": number; // id + "type": string; // 装修类型,[enum:RenovationAppliesTypeEnum] + "process_type": string; // 办理类型,[enum:RenovationAppliesProcessTypeEnum] + "is_deposit"?: number; // 是否有保证金 + "deposit_amount"?: number; // 保证金金额 + "owner_name": string; // 业主名称 + "owner_phone": string; // 业主手机 + "card_type": string; // 证件类型,[enum:HouseOccupantsCardTypeEnum] + "owner_id_card": string; // 业主身份证 + "id_card_front"?: string[]; // 身份证正面 + "id_card_back"?: string[]; // 身份证反面 + "property_certificate"?: string[]; // 产权证明 + "agent_name"?: string; // 代理人名称 + "agent_phone"?: string; // 代理人手机 + "agent_card_type"?: string; // 代理人证件类型,[enum:HouseOccupantsCardTypeEnum] + "agent_id_card"?: string; // 代理人身份证 + "agent_id_card_front"?: string[]; // 代理人身份证正面 + "agent_id_card_back"?: string[]; // 代理人身份证反面 + "power_attorney"?: string[]; // 代理人授权书 + "construction_principal_name"?: string; // 施工负责人名称 + "construction_principal_phone"?: string; // 施工负责人手机 + "construction_principal_card_type"?: string; // 施工负责人证件类型,[enum:HouseOccupantsCardTypeEnum] + "construction_principal_id_card"?: string; // 施工负责人身份证 + "construction_principal_id_card_front"?: string[]; // 施工负责人身份证正面 + "construction_principal_id_card_back"?: string[]; // 施工负责人身份证反面 + "construction_start_date"?: Date; // 施工开始时间 + "construction_end_date"?: Date; // 施工结束时间 + "renovation_content"?: string; // 装修内容,[enum:RenovationAppliesRenovationContentEnum] + "renovation_remark"?: string; // 装修备注 + "construction_draw"?: string[]; // 施工图 + "construction_commitment_letter"?: string[]; // 施工承诺书 + "company_name"?: string; // 装修公司名称 + "company_principal_name"?: string; // 装修公司负责人名称 + "company_principal_phone"?: string; // 装修公司负责人手机 + "company_business_license_num"?: string; // 装修公司营业执照号 + "company_business_license"?: string[]; // 装修公司营业执照 + "company_asset_certificate"?: string[]; // 装修公司资产证明 + "company_power_attorney"?: string[]; // 装修公司装修授权书 + "other_attachments"?: string[]; // 其他附件 + "major_construction"?: string[]; // 主要施工项 + }; + type Audit = { + "id": number; // id + "status": string; // 状态,[enum:RenovationAppliesStatusEnum] + "renovation_inspection_rules_id"?: number; // 装修巡查规则ID + "audit_remark"?: string; // 驳回理由 + "is_deposit"?: number; // 是否有保证金 + "deposit_amount"?: number; // 保证金金额 + }; + type UpdateDeposit = { + "id": number; // 装修申请id + "deposit_amount": number; // 押金金额(元) + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace RenovationInspectionRules { + type List = { + "name"?: string; // 模糊搜索:名称 + }; + type Store = { + "name": string; // 规则名称 + "rule": string[]; // 规则内容 + "description": string; // 规则描述 + }; + type Update = { + "id": number; // id + "name": string; // 规则名称 + "rule": string[]; // 规则内容 + "description": string; // 规则描述 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type Select = { + "name"?: string; // 模糊搜索:名称 + }; + } + namespace RenovationWorkers { + type List = { + "renovation_applies_id"?: number; // 装修申请id,[ref:renovation_applies] + "worker_name"?: string; // 模糊搜索:工人姓名 + "worker_phone"?: string; // 模糊搜索:工人电话 + }; + type Store = { + "renovation_applies_id": number; // 装修申请id,[ref:renovation_applies] + "worker_name": string; // 工人姓名 + "worker_phone": string; // 工人电话 + "card_type": string; // 证件类型,[enum:HouseOccupantsCardTypeEnum] + "id_card": string; // 证件号 + "card_front"?: string[]; // 证件正面 + "card_back"?: string[]; // 证件反面 + "valid_from"?: Date; // 证件有效期开始 + "valid_to"?: Date; // 证件有效期结束 + "worker_photo"?: string[]; // 工人照片 + }; + type BatchStore = { + "renovation_applies_id": number; // 装修申请id,[ref:renovation_applies] + "workers": string[]; // 工人列表 + }; + type Update = { + "id": number; // id + "worker_name": string; // 工人姓名 + "worker_phone": string; // 工人电话 + "card_type": string; // 证件类型,[enum:HouseOccupantsCardTypeEnum] + "id_card": string; // 证件号 + "card_front"?: string[]; // 证件正面 + "card_back"?: string[]; // 证件反面 + "valid_from"?: Date; // 证件有效期开始 + "valid_to"?: Date; // 证件有效期结束 + "worker_photo"?: string[]; // 工人照片 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } + namespace Resource { + namespace ResourceOrders { + type List = { + "id"?: number; // id + "code"?: string; // 模糊搜索:订单编号 + "resources_id"?: number; // 资源id,[ref:resources] + "resource_name"?: string; // 资源名称 + "category"?: string; // 资源分类 + "status"?: string; // 订单状态 + "customer_name"?: string; // 客户姓名 + "customer_phone"?: string; // 客户电话 + "payment_status"?: string; // 支付状态 + "contracts_id"?: number; // 合同id,[ref:contracts] + "asset_projects_id"?: number; // 资产项目id,[ref:asset_projects] + "project_name"?: string; // 资产项目名称 + "contract_date"?: Date; // 合同日期 + "reserve_date"?: Date; // 预约日期(资源) + }; + type Store = { + "resources_id": number; // 资源id,[ref:resources] + "resource_sessions": string[]; // 资源场次数组 + "customer_name"?: string; // 客户姓名 + "customer_phone"?: string; // 客户电话 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace ResourceTypes { + type List = { + "name"?: string; // 模糊搜索:名称 + "category": string; // 类型,[enum:ResourceTypesCategoryEnum] + }; + type Store = { + "category": string; // 类型,[enum:ResourceTypesCategoryEnum] + "name": string; // 资源分类名称 + "is_enabled"?: number; // 是否启用:0-否 1-是 + "sort"?: number; // 排序(数值越大越靠前) + }; + type Update = { + "id": number; // id + "category": string; // 类型,[enum:ResourceTypesCategoryEnum] + "name": string; // 资源分类名称 + "is_enabled"?: number; // 是否启用:0-否 1-是 + "sort"?: number; // 排序(数值越大越靠前) + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type Select = { + "name"?: string; // 模糊搜索:名称 + "category": string; // 类型,[enum:ResourceTypesCategoryEnum] + }; + } + namespace Resources { + type List = { + "name"?: string; // 模糊搜索:名称 + "category"?: string; // 分类,[enum:ResourceTypesCategoryEnum] + "is_enabled"?: number; // 是否启用:0-否,1-是 + "is_show"?: number; // 是否上架:0-否,1-是 + "reservation_status"?: string; // 预约状态,[enum:ResourcesReservationStatusEnum] + }; + type Store = { + "category": string; // 分类,[enum:ResourceTypesCategoryEnum] + "name": string; // 名称 + "is_enabled"?: number; // 是否启用:0-否,1-是 + "is_show"?: number; // 是否上架:0-否,1-是 + "reservation_status"?: string; // 预约状态,[enum:ResourcesReservationStatusEnum] + "open_days"?: string[]; // 开放日期[enum:ResourcesOpenDaysEnum] + "reservation_rule"?: string; // 预约规则,[enum:ResourcesReservationRuleEnum] + "reservation_days"?: number; // 可提前预定天数 (仅场地资源) + "cancel_minutes"?: number; // 可退订时间(距开始前x分钟) + "cover_image"?: string[]; // 封面图片 + "images"?: string[]; // 资源图片 + "asset_projects_id": number; // 所属项目id,[ref:asset_projects] + "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] + "asset_units_id"?: number; // 所属单元id,[ref:asset_units] + "province"?: string; // 省 + "city"?: string; // 市 + "area"?: string; // 区 + "street"?: string; // 街道 + "address"?: string; // 详细地址 + "sessions"?: string[]; // 场次信息 + }; + type Update = { + "id": number; // id + "category": string; // 分类,[enum:ResourceTypesCategoryEnum] + "name": string; // 名称 + "is_enabled"?: number; // 是否启用:0-否,1-是 + "is_show"?: number; // 是否上架:0-否,1-是 + "reservation_status"?: string; // 预约状态,[enum:ResourcesReservationStatusEnum] + "open_days"?: string[]; // 开放日期[enum:ResourcesOpenDaysEnum] + "reservation_rule"?: string; // 预约规则,[enum:ResourcesReservationRuleEnum] + "reservation_days"?: number; // 可提前预定天数 (仅场地资源) + "cancel_minutes"?: number; // 可退订时间(距开始前x分钟) + "cover_image"?: string[]; // 封面图片 + "images"?: string[]; // 资源图片 + "asset_projects_id": number; // 所属项目id,[ref:asset_projects] + "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] + "asset_units_id"?: number; // 所属单元id,[ref:asset_units] + "province"?: string; // 省 + "city"?: string; // 市 + "area"?: string; // 区 + "street"?: string; // 街道 + "address"?: string; // 详细地址 + "sessions"?: string[]; // 场次信息 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type Select = { + "name"?: string; // 模糊搜索:名称 + "category"?: string; // 分类,[enum:ResourceTypesCategoryEnum] + "is_enabled"?: number; // 是否启用:0-否,1-是 + "is_show"?: number; // 是否上架:0-否,1-是 + "reservation_status"?: string; // 预约状态,[enum:ResourcesReservationStatusEnum] + }; + } + } namespace Statistics { namespace IndexCount { } diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 3314b6c..70a858f 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -418,6 +418,57 @@ export const Apis = { }, }, Bill: { + BillPayments: { + List(data?: ApiTypes.Bill.BillPayments.List): Promise { + return request('company/bill/bill_payments/list', { data }); + }, + Store(data: ApiTypes.Bill.BillPayments.Store): Promise { + return request('company/bill/bill_payments/store', { data }); + }, + Update(data: ApiTypes.Bill.BillPayments.Update): Promise { + return request('company/bill/bill_payments/update', { data }); + }, + Show(data: ApiTypes.Bill.BillPayments.Show): Promise { + return request('company/bill/bill_payments/show', { data }); + }, + Audit(data: ApiTypes.Bill.BillPayments.Audit): Promise { + return request('company/bill/bill_payments/audit', { data }); + }, + Delete(data: ApiTypes.Bill.BillPayments.Delete): Promise { + return request('company/bill/bill_payments/delete', { data }); + }, + }, + BillRefunds: { + List(data?: ApiTypes.Bill.BillRefunds.List): Promise { + return request('company/bill/bill_refunds/list', { data }); + }, + Store(data: ApiTypes.Bill.BillRefunds.Store): Promise { + return request('company/bill/bill_refunds/store', { data }); + }, + Show(data: ApiTypes.Bill.BillRefunds.Show): Promise { + return request('company/bill/bill_refunds/show', { data }); + }, + Audit(data: ApiTypes.Bill.BillRefunds.Audit): Promise { + return request('company/bill/bill_refunds/audit', { data }); + }, + }, + Bills: { + List(data?: ApiTypes.Bill.Bills.List): Promise { + return request('company/bill/bills/list', { data }); + }, + Show(data: ApiTypes.Bill.Bills.Show): Promise { + return request('company/bill/bills/show', { data }); + }, + SoftDelete(data: ApiTypes.Bill.Bills.SoftDelete): Promise { + return request('company/bill/bills/soft_delete', { data }); + }, + Restore(data: ApiTypes.Bill.Bills.Restore): Promise { + return request('company/bill/bills/restore', { data }); + }, + Delete(data: ApiTypes.Bill.Bills.Delete): Promise { + return request('company/bill/bills/delete', { data }); + }, + }, HouseBills: { List(data?: ApiTypes.Bill.HouseBills.List): Promise { return request('company/bill/house_bills/list', { data }); @@ -441,7 +492,7 @@ export const Apis = { return request('company/bill/house_bills/delete', { data }); }, Export(data: ApiTypes.Bill.HouseBills.Export): Promise { - return request('company/bill/house_bills/export', { responseType: 'blob',data }); + return request('company/bill/house_bills/export', { data }); }, }, }, @@ -549,6 +600,9 @@ export const Apis = { Export(data?: ApiTypes.Company.CompanyEmployees.Export): Promise { return request('company/company/company_employees/export', { responseType: 'blob',data }); }, + SyncWechatEmployees(): Promise { + return request('company/company/company_employees/sync_wechat_employees', {}); + }, }, CompanyPositions: { List(data?: ApiTypes.Company.CompanyPositions.List): Promise { @@ -712,6 +766,440 @@ export const Apis = { }, }, }, + CompanySeal: { + CompanySeals: { + List(data?: ApiTypes.CompanySeal.CompanySeals.List): Promise { + return request('company/company_seal/company_seals/list', { data }); + }, + Store(data: ApiTypes.CompanySeal.CompanySeals.Store): Promise { + return request('company/company_seal/company_seals/store', { data }); + }, + Update(data: ApiTypes.CompanySeal.CompanySeals.Update): Promise { + return request('company/company_seal/company_seals/update', { data }); + }, + Show(data: ApiTypes.CompanySeal.CompanySeals.Show): Promise { + return request('company/company_seal/company_seals/show', { data }); + }, + SoftDelete(data: ApiTypes.CompanySeal.CompanySeals.SoftDelete): Promise { + return request('company/company_seal/company_seals/soft_delete', { data }); + }, + Restore(data: ApiTypes.CompanySeal.CompanySeals.Restore): Promise { + return request('company/company_seal/company_seals/restore', { data }); + }, + Delete(data: ApiTypes.CompanySeal.CompanySeals.Delete): Promise { + return request('company/company_seal/company_seals/delete', { data }); + }, + ExchangeHolder(data: ApiTypes.CompanySeal.CompanySeals.ExchangeHolder): Promise { + return request('company/company_seal/company_seals/exchange_holder', { data }); + }, + ExchangeRecord(data: ApiTypes.CompanySeal.CompanySeals.ExchangeRecord): Promise { + return request('company/company_seal/company_seals/exchange_record', { data }); + }, + Select(data?: ApiTypes.CompanySeal.CompanySeals.Select): Promise { + return request('company/company_seal/company_seals/select', { data }); + }, + }, + }, + CompanySupplier: { + CompanySupplierGrades: { + List(data?: ApiTypes.CompanySupplier.CompanySupplierGrades.List): Promise { + return request('company/company_supplier/company_supplier_grades/list', { data }); + }, + Store(data: ApiTypes.CompanySupplier.CompanySupplierGrades.Store): Promise { + return request('company/company_supplier/company_supplier_grades/store', { data }); + }, + Show(data: ApiTypes.CompanySupplier.CompanySupplierGrades.Show): Promise { + return request('company/company_supplier/company_supplier_grades/show', { data }); + }, + Delete(data: ApiTypes.CompanySupplier.CompanySupplierGrades.Delete): Promise { + return request('company/company_supplier/company_supplier_grades/delete', { data }); + }, + }, + CompanySuppliers: { + List(data?: ApiTypes.CompanySupplier.CompanySuppliers.List): Promise { + return request('company/company_supplier/company_suppliers/list', { data }); + }, + Store(data: ApiTypes.CompanySupplier.CompanySuppliers.Store): Promise { + return request('company/company_supplier/company_suppliers/store', { data }); + }, + Update(data: ApiTypes.CompanySupplier.CompanySuppliers.Update): Promise { + return request('company/company_supplier/company_suppliers/update', { data }); + }, + Show(data: ApiTypes.CompanySupplier.CompanySuppliers.Show): Promise { + return request('company/company_supplier/company_suppliers/show', { data }); + }, + SoftDelete(data: ApiTypes.CompanySupplier.CompanySuppliers.SoftDelete): Promise { + return request('company/company_supplier/company_suppliers/soft_delete', { data }); + }, + Restore(data: ApiTypes.CompanySupplier.CompanySuppliers.Restore): Promise { + return request('company/company_supplier/company_suppliers/restore', { data }); + }, + Delete(data: ApiTypes.CompanySupplier.CompanySuppliers.Delete): Promise { + return request('company/company_supplier/company_suppliers/delete', { data }); + }, + Select(data?: ApiTypes.CompanySupplier.CompanySuppliers.Select): Promise { + return request('company/company_supplier/company_suppliers/select', { data }); + }, + }, + SupplierCreditReports: { + List(data: ApiTypes.CompanySupplier.SupplierCreditReports.List): Promise { + return request('company/company_supplier/supplier_credit_reports/list', { data }); + }, + Store(data: ApiTypes.CompanySupplier.SupplierCreditReports.Store): Promise { + return request('company/company_supplier/supplier_credit_reports/store', { data }); + }, + Update(data: ApiTypes.CompanySupplier.SupplierCreditReports.Update): Promise { + return request('company/company_supplier/supplier_credit_reports/update', { data }); + }, + Show(data: ApiTypes.CompanySupplier.SupplierCreditReports.Show): Promise { + return request('company/company_supplier/supplier_credit_reports/show', { data }); + }, + Delete(data: ApiTypes.CompanySupplier.SupplierCreditReports.Delete): Promise { + return request('company/company_supplier/supplier_credit_reports/delete', { data }); + }, + }, + SupplierFieldReports: { + List(data: ApiTypes.CompanySupplier.SupplierFieldReports.List): Promise { + return request('company/company_supplier/supplier_field_reports/list', { data }); + }, + Store(data: ApiTypes.CompanySupplier.SupplierFieldReports.Store): Promise { + return request('company/company_supplier/supplier_field_reports/store', { data }); + }, + Update(data: ApiTypes.CompanySupplier.SupplierFieldReports.Update): Promise { + return request('company/company_supplier/supplier_field_reports/update', { data }); + }, + Show(data: ApiTypes.CompanySupplier.SupplierFieldReports.Show): Promise { + return request('company/company_supplier/supplier_field_reports/show', { data }); + }, + Delete(data: ApiTypes.CompanySupplier.SupplierFieldReports.Delete): Promise { + return request('company/company_supplier/supplier_field_reports/delete', { data }); + }, + }, + }, + Contract: { + ContractArchiveBorrows: { + List(data?: ApiTypes.Contract.ContractArchiveBorrows.List): Promise { + return request('company/contract/contract_archive_borrows/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractArchiveBorrows.Store): Promise { + return request('company/contract/contract_archive_borrows/store', { data }); + }, + Borrow(data: ApiTypes.Contract.ContractArchiveBorrows.Borrow): Promise { + return request('company/contract/contract_archive_borrows/borrow', { data }); + }, + Show(data: ApiTypes.Contract.ContractArchiveBorrows.Show): Promise { + return request('company/contract/contract_archive_borrows/show', { data }); + }, + Return(data: ApiTypes.Contract.ContractArchiveBorrows.Return): Promise { + return request('company/contract/contract_archive_borrows/return', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractArchiveBorrows.SoftDelete): Promise { + return request('company/contract/contract_archive_borrows/soft_delete', { data }); + }, + }, + ContractArchiveFiles: { + List(data?: ApiTypes.Contract.ContractArchiveFiles.List): Promise { + return request('company/contract/contract_archive_files/list', { data }); + }, + Show(data: ApiTypes.Contract.ContractArchiveFiles.Show): Promise { + return request('company/contract/contract_archive_files/show', { data }); + }, + GetAvailableFiles(data: ApiTypes.Contract.ContractArchiveFiles.GetAvailableFiles): Promise { + return request('company/contract/contract_archive_files/get_available_files', { data }); + }, + }, + ContractArchiveReads: { + List(data?: ApiTypes.Contract.ContractArchiveReads.List): Promise { + return request('company/contract/contract_archive_reads/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractArchiveReads.Store): Promise { + return request('company/contract/contract_archive_reads/store', { data }); + }, + Show(data: ApiTypes.Contract.ContractArchiveReads.Show): Promise { + return request('company/contract/contract_archive_reads/show', { data }); + }, + EndRead(data: ApiTypes.Contract.ContractArchiveReads.EndRead): Promise { + return request('company/contract/contract_archive_reads/end_read', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractArchiveReads.SoftDelete): Promise { + return request('company/contract/contract_archive_reads/soft_delete', { data }); + }, + }, + ContractArchiveTransfers: { + List(data?: ApiTypes.Contract.ContractArchiveTransfers.List): Promise { + return request('company/contract/contract_archive_transfers/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractArchiveTransfers.Store): Promise { + return request('company/contract/contract_archive_transfers/store', { data }); + }, + Show(data: ApiTypes.Contract.ContractArchiveTransfers.Show): Promise { + return request('company/contract/contract_archive_transfers/show', { data }); + }, + }, + ContractArchives: { + List(data?: ApiTypes.Contract.ContractArchives.List): Promise { + return request('company/contract/contract_archives/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractArchives.Store): Promise { + return request('company/contract/contract_archives/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractArchives.Update): Promise { + return request('company/contract/contract_archives/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractArchives.Show): Promise { + return request('company/contract/contract_archives/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractArchives.SoftDelete): Promise { + return request('company/contract/contract_archives/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractArchives.Restore): Promise { + return request('company/contract/contract_archives/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractArchives.Delete): Promise { + return request('company/contract/contract_archives/delete', { data }); + }, + ChangeKeeper(data: ApiTypes.Contract.ContractArchives.ChangeKeeper): Promise { + return request('company/contract/contract_archives/change_keeper', { data }); + }, + GetChangeKeeperLog(data: ApiTypes.Contract.ContractArchives.GetChangeKeeperLog): Promise { + return request('company/contract/contract_archives/get_change_keeper_log', { data }); + }, + }, + ContractBillObjects: { + List(data?: ApiTypes.Contract.ContractBillObjects.List): Promise { + return request('company/contract/contract_bill_objects/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractBillObjects.Store): Promise { + return request('company/contract/contract_bill_objects/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractBillObjects.Update): Promise { + return request('company/contract/contract_bill_objects/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractBillObjects.Show): Promise { + return request('company/contract/contract_bill_objects/show', { data }); + }, + CompleteApply(data: ApiTypes.Contract.ContractBillObjects.CompleteApply): Promise { + return request('company/contract/contract_bill_objects/complete_apply', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractBillObjects.SoftDelete): Promise { + return request('company/contract/contract_bill_objects/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractBillObjects.Restore): Promise { + return request('company/contract/contract_bill_objects/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractBillObjects.Delete): Promise { + return request('company/contract/contract_bill_objects/delete', { data }); + }, + }, + ContractBillPayments: { + List(data?: ApiTypes.Contract.ContractBillPayments.List): Promise { + return request('company/contract/contract_bill_payments/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractBillPayments.Store): Promise { + return request('company/contract/contract_bill_payments/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractBillPayments.Update): Promise { + return request('company/contract/contract_bill_payments/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractBillPayments.Show): Promise { + return request('company/contract/contract_bill_payments/show', { data }); + }, + Audit(data: ApiTypes.Contract.ContractBillPayments.Audit): Promise { + return request('company/contract/contract_bill_payments/audit', { data }); + }, + }, + ContractBills: { + List(data?: ApiTypes.Contract.ContractBills.List): Promise { + return request('company/contract/contract_bills/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractBills.Store): Promise { + return request('company/contract/contract_bills/store', { data }); + }, + BatchStore(data: ApiTypes.Contract.ContractBills.BatchStore): Promise { + return request('company/contract/contract_bills/batch_store', { data }); + }, + BatchUpdate(data: ApiTypes.Contract.ContractBills.BatchUpdate): Promise { + return request('company/contract/contract_bills/batch_update', { data }); + }, + Update(data: ApiTypes.Contract.ContractBills.Update): Promise { + return request('company/contract/contract_bills/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractBills.Show): Promise { + return request('company/contract/contract_bills/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractBills.SoftDelete): Promise { + return request('company/contract/contract_bills/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractBills.Restore): Promise { + return request('company/contract/contract_bills/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractBills.Delete): Promise { + return request('company/contract/contract_bills/delete', { data }); + }, + Export(data: ApiTypes.Contract.ContractBills.Export): Promise { + return request('company/contract/contract_bills/export', { responseType: 'blob',data }); + }, + }, + ContractDisputeRecords: { + List(data: ApiTypes.Contract.ContractDisputeRecords.List): Promise { + return request('company/contract/contract_dispute_records/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractDisputeRecords.Store): Promise { + return request('company/contract/contract_dispute_records/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractDisputeRecords.Update): Promise { + return request('company/contract/contract_dispute_records/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractDisputeRecords.Show): Promise { + return request('company/contract/contract_dispute_records/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractDisputeRecords.SoftDelete): Promise { + return request('company/contract/contract_dispute_records/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractDisputeRecords.Restore): Promise { + return request('company/contract/contract_dispute_records/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractDisputeRecords.Delete): Promise { + return request('company/contract/contract_dispute_records/delete', { data }); + }, + }, + ContractOthers: { + List(data?: ApiTypes.Contract.ContractOthers.List): Promise { + return request('company/contract/contract_others/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractOthers.Store): Promise { + return request('company/contract/contract_others/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractOthers.Update): Promise { + return request('company/contract/contract_others/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractOthers.Show): Promise { + return request('company/contract/contract_others/show', { data }); + }, + Seal(data: ApiTypes.Contract.ContractOthers.Seal): Promise { + return request('company/contract/contract_others/seal', { data }); + }, + Delete(data: ApiTypes.Contract.ContractOthers.Delete): Promise { + return request('company/contract/contract_others/delete', { data }); + }, + }, + ContractSealLogs: { + List(data?: ApiTypes.Contract.ContractSealLogs.List): Promise { + return request('company/contract/contract_seal_logs/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractSealLogs.Store): Promise { + return request('company/contract/contract_seal_logs/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractSealLogs.Update): Promise { + return request('company/contract/contract_seal_logs/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractSealLogs.Show): Promise { + return request('company/contract/contract_seal_logs/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractSealLogs.SoftDelete): Promise { + return request('company/contract/contract_seal_logs/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractSealLogs.Restore): Promise { + return request('company/contract/contract_seal_logs/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractSealLogs.Delete): Promise { + return request('company/contract/contract_seal_logs/delete', { data }); + }, + }, + ContractTemplates: { + List(data?: ApiTypes.Contract.ContractTemplates.List): Promise { + return request('company/contract/contract_templates/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractTemplates.Store): Promise { + return request('company/contract/contract_templates/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractTemplates.Update): Promise { + return request('company/contract/contract_templates/update', { data }); + }, + Show(data: ApiTypes.Contract.ContractTemplates.Show): Promise { + return request('company/contract/contract_templates/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractTemplates.SoftDelete): Promise { + return request('company/contract/contract_templates/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractTemplates.Restore): Promise { + return request('company/contract/contract_templates/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractTemplates.Delete): Promise { + return request('company/contract/contract_templates/delete', { data }); + }, + }, + ContractTypes: { + List(data?: ApiTypes.Contract.ContractTypes.List): Promise { + return request('company/contract/contract_types/list', { data }); + }, + Store(data: ApiTypes.Contract.ContractTypes.Store): Promise { + return request('company/contract/contract_types/store', { data }); + }, + Update(data: ApiTypes.Contract.ContractTypes.Update): Promise { + return request('company/contract/contract_types/update', { data }); + }, + ChangeStatus(data: ApiTypes.Contract.ContractTypes.ChangeStatus): Promise { + return request('company/contract/contract_types/change_status', { data }); + }, + Show(data: ApiTypes.Contract.ContractTypes.Show): Promise { + return request('company/contract/contract_types/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.ContractTypes.SoftDelete): Promise { + return request('company/contract/contract_types/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.ContractTypes.Restore): Promise { + return request('company/contract/contract_types/restore', { data }); + }, + Delete(data: ApiTypes.Contract.ContractTypes.Delete): Promise { + return request('company/contract/contract_types/delete', { data }); + }, + Select(data?: ApiTypes.Contract.ContractTypes.Select): Promise { + return request('company/contract/contract_types/select', { data }); + }, + }, + Contracts: { + List(data?: ApiTypes.Contract.Contracts.List): Promise { + return request('company/contract/contracts/list', { data }); + }, + PendingReviewList(data?: ApiTypes.Contract.Contracts.PendingReviewList): Promise { + return request('company/contract/contracts/pending_review_list', { data }); + }, + Store(data: ApiTypes.Contract.Contracts.Store): Promise { + return request('company/contract/contracts/store', { data }); + }, + Update(data: ApiTypes.Contract.Contracts.Update): Promise { + return request('company/contract/contracts/update', { data }); + }, + Show(data: ApiTypes.Contract.Contracts.Show): Promise { + return request('company/contract/contracts/show', { data }); + }, + SoftDelete(data: ApiTypes.Contract.Contracts.SoftDelete): Promise { + return request('company/contract/contracts/soft_delete', { data }); + }, + Restore(data: ApiTypes.Contract.Contracts.Restore): Promise { + return request('company/contract/contracts/restore', { data }); + }, + Delete(data: ApiTypes.Contract.Contracts.Delete): Promise { + return request('company/contract/contracts/delete', { data }); + }, + ContractCopy(data: ApiTypes.Contract.Contracts.ContractCopy): Promise { + return request('company/contract/contracts/contract_copy', { data }); + }, + Terminated(data: ApiTypes.Contract.Contracts.Terminated): Promise { + return request('company/contract/contracts/terminated', { data }); + }, + Voided(data: ApiTypes.Contract.Contracts.Voided): Promise { + return request('company/contract/contracts/voided', { data }); + }, + SubmitApproval(data: ApiTypes.Contract.Contracts.SubmitApproval): Promise { + return request('company/contract/contracts/submit_approval', { data }); + }, + Export(data: ApiTypes.Contract.Contracts.Export): Promise { + return request('company/contract/contracts/export', { responseType: 'blob',data }); + }, + }, + }, GoodsReleases: { GoodsReleases: { List(data?: ApiTypes.GoodsReleases.GoodsReleases.List): Promise { @@ -901,7 +1389,7 @@ export const Apis = { return request('company/house_order/house_orders/delete', { data }); }, Export(data: ApiTypes.HouseOrder.HouseOrders.Export): Promise { - return request('company/house_order/house_orders/export', { responseType: 'blob',data }); + return request('company/house_order/house_orders/export', { data }); }, UpdateSerialNumber(data: ApiTypes.HouseOrder.HouseOrders.UpdateSerialNumber): Promise { return request('company/house_order/house_orders/update_serial_number', { data }); @@ -913,13 +1401,16 @@ export const Apis = { return request('company/house_order/house_orders/import_serial_number', { data }); }, DownloadSerialNumberTemplate(): Promise { - return request('company/house_order/house_orders/download_serial_number_template', {responseType: 'blob',}); + return request('company/house_order/house_orders/download_serial_number_template', {}); }, GetPayCode(data: ApiTypes.HouseOrder.HouseOrders.GetPayCode): Promise { return request('company/house_order/house_orders/get_pay_code', { data }); }, + AlipayQrCode(data: ApiTypes.HouseOrder.HouseOrders.AlipayQrCode): Promise { + return request('company/house_order/house_orders/alipay_qr_code', { data }); + }, DownloadOfflinePaymentTemplate(): Promise { - return request('company/house_order/house_orders/download_offline_payment_template', {responseType: 'blob',}); + return request('company/house_order/house_orders/download_offline_payment_template', {}); }, ImportOfflinePayment(data: ApiTypes.HouseOrder.HouseOrders.ImportOfflinePayment): Promise { return request('company/house_order/house_orders/import_offline_payment', { data }); @@ -1134,6 +1625,25 @@ export const Apis = { }, }, }, + QualityCheck: { + QualityChecks: { + List(data?: ApiTypes.QualityCheck.QualityChecks.List): Promise { + return request('company/quality_check/quality_checks/list', { data }); + }, + Store(data: ApiTypes.QualityCheck.QualityChecks.Store): Promise { + return request('company/quality_check/quality_checks/store', { data }); + }, + Update(data: ApiTypes.QualityCheck.QualityChecks.Update): Promise { + return request('company/quality_check/quality_checks/update', { data }); + }, + Show(data: ApiTypes.QualityCheck.QualityChecks.Show): Promise { + return request('company/quality_check/quality_checks/show', { data }); + }, + Delete(data: ApiTypes.QualityCheck.QualityChecks.Delete): Promise { + return request('company/quality_check/quality_checks/delete', { data }); + }, + }, + }, Refund: { Refunds: { List(data?: ApiTypes.Refund.Refunds.List): Promise { @@ -1153,6 +1663,157 @@ export const Apis = { }, }, }, + Renovation: { + RenovationApplies: { + List(data?: ApiTypes.Renovation.RenovationApplies.List): Promise { + return request('company/renovation/renovation_applies/list', { data }); + }, + Store(data: ApiTypes.Renovation.RenovationApplies.Store): Promise { + return request('company/renovation/renovation_applies/store', { data }); + }, + Update(data: ApiTypes.Renovation.RenovationApplies.Update): Promise { + return request('company/renovation/renovation_applies/update', { data }); + }, + Audit(data: ApiTypes.Renovation.RenovationApplies.Audit): Promise { + return request('company/renovation/renovation_applies/audit', { data }); + }, + UpdateDeposit(data: ApiTypes.Renovation.RenovationApplies.UpdateDeposit): Promise { + return request('company/renovation/renovation_applies/update_deposit', { data }); + }, + Show(data: ApiTypes.Renovation.RenovationApplies.Show): Promise { + return request('company/renovation/renovation_applies/show', { data }); + }, + SoftDelete(data: ApiTypes.Renovation.RenovationApplies.SoftDelete): Promise { + return request('company/renovation/renovation_applies/soft_delete', { data }); + }, + Restore(data: ApiTypes.Renovation.RenovationApplies.Restore): Promise { + return request('company/renovation/renovation_applies/restore', { data }); + }, + Delete(data: ApiTypes.Renovation.RenovationApplies.Delete): Promise { + return request('company/renovation/renovation_applies/delete', { data }); + }, + }, + RenovationInspectionRules: { + List(data?: ApiTypes.Renovation.RenovationInspectionRules.List): Promise { + return request('company/renovation/renovation_inspection_rules/list', { data }); + }, + Store(data: ApiTypes.Renovation.RenovationInspectionRules.Store): Promise { + return request('company/renovation/renovation_inspection_rules/store', { data }); + }, + Update(data: ApiTypes.Renovation.RenovationInspectionRules.Update): Promise { + return request('company/renovation/renovation_inspection_rules/update', { data }); + }, + Show(data: ApiTypes.Renovation.RenovationInspectionRules.Show): Promise { + return request('company/renovation/renovation_inspection_rules/show', { data }); + }, + SoftDelete(data: ApiTypes.Renovation.RenovationInspectionRules.SoftDelete): Promise { + return request('company/renovation/renovation_inspection_rules/soft_delete', { data }); + }, + Restore(data: ApiTypes.Renovation.RenovationInspectionRules.Restore): Promise { + return request('company/renovation/renovation_inspection_rules/restore', { data }); + }, + Delete(data: ApiTypes.Renovation.RenovationInspectionRules.Delete): Promise { + return request('company/renovation/renovation_inspection_rules/delete', { data }); + }, + Select(data?: ApiTypes.Renovation.RenovationInspectionRules.Select): Promise { + return request('company/renovation/renovation_inspection_rules/select', { data }); + }, + }, + RenovationWorkers: { + List(data?: ApiTypes.Renovation.RenovationWorkers.List): Promise { + return request('company/renovation/renovation_workers/list', { data }); + }, + Store(data: ApiTypes.Renovation.RenovationWorkers.Store): Promise { + return request('company/renovation/renovation_workers/store', { data }); + }, + BatchStore(data: ApiTypes.Renovation.RenovationWorkers.BatchStore): Promise { + return request('company/renovation/renovation_workers/batch_store', { data }); + }, + Update(data: ApiTypes.Renovation.RenovationWorkers.Update): Promise { + return request('company/renovation/renovation_workers/update', { data }); + }, + Show(data: ApiTypes.Renovation.RenovationWorkers.Show): Promise { + return request('company/renovation/renovation_workers/show', { data }); + }, + Delete(data: ApiTypes.Renovation.RenovationWorkers.Delete): Promise { + return request('company/renovation/renovation_workers/delete', { data }); + }, + }, + }, + Resource: { + ResourceOrders: { + List(data?: ApiTypes.Resource.ResourceOrders.List): Promise { + return request('company/resource/resource_orders/list', { data }); + }, + Store(data: ApiTypes.Resource.ResourceOrders.Store): Promise { + return request('company/resource/resource_orders/store', { data }); + }, + Show(data: ApiTypes.Resource.ResourceOrders.Show): Promise { + return request('company/resource/resource_orders/show', { data }); + }, + SoftDelete(data: ApiTypes.Resource.ResourceOrders.SoftDelete): Promise { + return request('company/resource/resource_orders/soft_delete', { data }); + }, + Restore(data: ApiTypes.Resource.ResourceOrders.Restore): Promise { + return request('company/resource/resource_orders/restore', { data }); + }, + Delete(data: ApiTypes.Resource.ResourceOrders.Delete): Promise { + return request('company/resource/resource_orders/delete', { data }); + }, + }, + ResourceTypes: { + List(data: ApiTypes.Resource.ResourceTypes.List): Promise { + return request('company/resource/resource_types/list', { data }); + }, + Store(data: ApiTypes.Resource.ResourceTypes.Store): Promise { + return request('company/resource/resource_types/store', { data }); + }, + Update(data: ApiTypes.Resource.ResourceTypes.Update): Promise { + return request('company/resource/resource_types/update', { data }); + }, + Show(data: ApiTypes.Resource.ResourceTypes.Show): Promise { + return request('company/resource/resource_types/show', { data }); + }, + SoftDelete(data: ApiTypes.Resource.ResourceTypes.SoftDelete): Promise { + return request('company/resource/resource_types/soft_delete', { data }); + }, + Restore(data: ApiTypes.Resource.ResourceTypes.Restore): Promise { + return request('company/resource/resource_types/restore', { data }); + }, + Delete(data: ApiTypes.Resource.ResourceTypes.Delete): Promise { + return request('company/resource/resource_types/delete', { data }); + }, + Select(data: ApiTypes.Resource.ResourceTypes.Select): Promise { + return request('company/resource/resource_types/select', { data }); + }, + }, + Resources: { + List(data?: ApiTypes.Resource.Resources.List): Promise { + return request('company/resource/resources/list', { data }); + }, + Store(data: ApiTypes.Resource.Resources.Store): Promise { + return request('company/resource/resources/store', { data }); + }, + Update(data: ApiTypes.Resource.Resources.Update): Promise { + return request('company/resource/resources/update', { data }); + }, + Show(data: ApiTypes.Resource.Resources.Show): Promise { + return request('company/resource/resources/show', { data }); + }, + SoftDelete(data: ApiTypes.Resource.Resources.SoftDelete): Promise { + return request('company/resource/resources/soft_delete', { data }); + }, + Restore(data: ApiTypes.Resource.Resources.Restore): Promise { + return request('company/resource/resources/restore', { data }); + }, + Delete(data: ApiTypes.Resource.Resources.Delete): Promise { + return request('company/resource/resources/delete', { data }); + }, + Select(data?: ApiTypes.Resource.Resources.Select): Promise { + return request('company/resource/resources/select', { data }); + }, + }, + }, Statistics: { IndexCount: { FinancialAnalysis(): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 67bc587..1fa9f98 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -26,6 +26,13 @@ export const ActivityEnrollsStatusEnum = { Cancelled: { text: '取消', color: '#ff9800', value: 'Cancelled' }, }; +// API凭证状态枚举 +export const ApiCredentialStatusEnum = { + Active: { text: '启用', color: '#28A745', value: 'Active' }, + Inactive: { text: '禁用', color: '#6C757D', value: 'Inactive' }, + Expired: { text: '已过期', color: '#DC3545', value: 'Expired' }, +}; + // 审批实例状态枚举 export const ApprovalInstancesStatusEnum = { Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, @@ -59,6 +66,26 @@ export const ApprovalTemplatesTypeEnum = { Contract: { text: '合同', color: '#2196f3', value: 'Contract' }, Finance: { text: '财务', color: '#4caf50', value: 'Finance' }, Refund: { text: '退款', color: '#f44336', value: 'Refund' }, + ContractTermination: { + text: '合同终止', + color: '#ff9800', + value: 'ContractTermination', + }, + ContractBorrow: { + text: '合同借用', + color: '#9c27b0', + value: 'ContractBorrow', + }, + ContractPayment: { + text: '合同支付', + color: '#00bcd4', + value: 'ContractPayment', + }, + OtherContractSeal: { + text: '其它合同用印', + color: '#795548', + value: 'OtherContractSeal', + }, }; // 车位产权类型 @@ -380,7 +407,7 @@ export const BannersTypeEnum = { export const CacheTypeEnum = { MobilePhoneVerificationCode: { text: '手机验证码', - color: '#d35ae4', + color: '#6b3979', value: 'MobilePhoneVerificationCode', }, }; @@ -451,6 +478,230 @@ export const CompanyReceiptAccountsPayChannelEnum = { TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, }; +// CompanySuppliersCertificateTypeEnum +export const CompanySuppliersCertificateTypeEnum = { + IdCard: { text: '身份证', color: '#1e90ff', value: 'IdCard' }, + BusinessLicense: { + text: '营业执照', + color: '#32cd32', + value: 'BusinessLicense', + }, +}; + +// CompanySuppliersCounterpartyEnum +export const CompanySuppliersCounterpartyEnum = { + Supplier: { text: '供应商', color: '#1e90ff', value: 'Supplier' }, + InternalCompany: { + text: '内部企业', + color: '#32cd32', + value: 'InternalCompany', + }, + CustomerCompany: { + text: '客户单位', + color: '#ff8c00', + value: 'CustomerCompany', + }, + Other: { text: '其他', color: '#808080', value: 'Other' }, +}; + +// CompanySuppliersGradeEnum +export const CompanySuppliersGradeEnum = { + Excellent: { text: '优秀', color: '#10b981', value: 'Excellent' }, + Qualified: { text: '合格', color: '#3b82f6', value: 'Qualified' }, + ToImprove: { text: '待整改', color: '#f59e0b', value: 'ToImprove' }, + Eliminated: { text: '淘汰', color: '#ef4444', value: 'Eliminated' }, +}; + +// CompanySuppliersSupplierTypeEnum +export const CompanySuppliersSupplierTypeEnum = { + Individual: { text: '个人', color: '#1e90ff', value: 'Individual' }, + Enterprise: { text: '企业', color: '#32cd32', value: 'Enterprise' }, +}; + +// 合同归档借用状态枚举 +export const ContractArchiveBorrowStatusEnum = { + Pending: { text: '审批中', color: '#f59e0b', value: 'Pending' }, + Approved: { text: '已通过', color: '#10b981', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#ef4444', value: 'Rejected' }, + Borrowing: { text: '借用中', color: '#007bff', value: 'Borrowing' }, + Returned: { text: '已归还', color: '#28a745', value: 'Returned' }, + Overdue: { text: '已逾期', color: '#dc3545', value: 'Overdue' }, +}; + +// 合同归档文件归还状态枚举 +export const ContractArchiveFileReturnStatusEnum = { + NotReturned: { text: '未归还', color: '#6c757d', value: 'NotReturned' }, + Intact: { text: '完好', color: '#28a745', value: 'Intact' }, + PartialLost: { text: '部分遗失', color: '#ffc107', value: 'PartialLost' }, + AllLost: { text: '全部遗失', color: '#dc3545', value: 'AllLost' }, + AllDamaged: { text: '全部损毁', color: '#dc3545', value: 'AllDamaged' }, + PartialDamaged: { + text: '部分损毁', + color: '#fd7e14', + value: 'PartialDamaged', + }, + NoNeedReturn: { text: '无需归还', color: '#17a2b8', value: 'NoNeedReturn' }, +}; + +// 合同归档归还状态枚举 +export const ContractArchiveReturnStatusEnum = { + NotReturned: { text: '未归还', color: '#6c757d', value: 'NotReturned' }, + Returned: { text: '已归还', color: '#28a745', value: 'Returned' }, +}; + +// ContractArchivesConfidentialityLevelEnum +export const ContractArchivesConfidentialityLevelEnum = { + TopSecret: { text: '绝密', color: '#dc3545', value: 'TopSecret' }, + Confidential: { text: '机密', color: '#fd7e14', value: 'Confidential' }, + Secret: { text: '保密', color: '#ffc107', value: 'Secret' }, + Internal: { text: '内部公开', color: '#17a2b8', value: 'Internal' }, + Public: { text: '公开', color: '#28a745', value: 'Public' }, +}; + +// ContractArchivesFileStatusEnum +export const ContractArchivesFileStatusEnum = { + Intact: { text: '完好', color: '#28a745', value: 'Intact' }, + SlightDamage: { text: '轻度损伤', color: '#ffc107', value: 'SlightDamage' }, + ModerateDamage: { + text: '中度损伤', + color: '#fd7e14', + value: 'ModerateDamage', + }, + SevereDamage: { text: '重度损伤', color: '#dc3545', value: 'SevereDamage' }, +}; + +// ContractArchivesFileTypeEnum +export const ContractArchivesFileTypeEnum = { + PaperOriginal: { text: '纸质原件', color: '#007bff', value: 'PaperOriginal' }, + ElectronicOriginal: { + text: '电子原件', + color: '#28a745', + value: 'ElectronicOriginal', + }, + Copy: { text: '复印件', color: '#ffc107', value: 'Copy' }, +}; + +// ContractArchivesPeriodTypeEnum +export const ContractArchivesPeriodTypeEnum = { + FixedTerm: { text: '定期', color: '#007bff', value: 'FixedTerm' }, + Permanent: { text: '永久', color: '#28a745', value: 'Permanent' }, +}; + +// ContractBillObjectsAuditStatusEnum +export const ContractBillObjectsAuditStatusEnum = { + Pending: { text: '审批中', color: '#f59e0b', value: 'Pending' }, + Approved: { text: '已通过', color: '#10b981', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#ef4444', value: 'Rejected' }, +}; + +// ContractBillObjectsStatusEnum +export const ContractBillObjectsStatusEnum = { + Pending: { text: '待执行', color: '#6c757d', value: 'Pending' }, + InProgress: { text: '执行中', color: '#007bff', value: 'InProgress' }, + Completed: { text: '已完成', color: '#28a745', value: 'Completed' }, + Cancelled: { text: '已取消', color: '#dc3545', value: 'Cancelled' }, +}; + +// ContractBillPaymentsStatusEnum +export const ContractBillPaymentsStatusEnum = { + Pending: { text: '待审', color: '#faad14', value: 'Pending' }, + Approved: { text: '已审', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '驳回', color: '#f5222d', value: 'Rejected' }, +}; + +// ContractBillsAuditStatusEnum +export const ContractBillsAuditStatusEnum = { + NotApplied: { text: '未申请', color: '#9ca3af', value: 'NotApplied' }, + Pending: { text: '审批中', color: '#f59e0b', value: 'Pending' }, + Approved: { text: '已通过', color: '#10b981', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#ef4444', value: 'Rejected' }, +}; + +// ContractBillsCostTypeEnum +export const ContractBillsCostTypeEnum = { + Income: { text: '收入', color: '#52c41a', value: 'Income' }, + Expense: { text: '支出', color: '#f5222d', value: 'Expense' }, +}; + +// ContractBillsIncomeExpenseTypeEnum +export const ContractBillsIncomeExpenseTypeEnum = { + Increase: { text: '增加', color: '#10b981', value: 'Increase' }, + Decrease: { text: '减少', color: '#ef4444', value: 'Decrease' }, + Neutral: { text: '不变', color: '#9ca3af', value: 'Neutral' }, +}; + +// ContractOthersStatusEnum +export const ContractOthersStatusEnum = { + Pending: { text: '审批中', color: '#f59e0b', value: 'Pending' }, + Approved: { text: '已通过', color: '#10b981', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#ef4444', value: 'Rejected' }, +}; + +// ContractPeoplesSignPartyEnum +export const ContractPeoplesSignPartyEnum = { + PartyA: { text: '甲方', color: '#007bff', value: 'PartyA' }, + PartyB: { text: '乙方', color: '#28a745', value: 'PartyB' }, + PartyC: { text: '丙方', color: '#ffc107', value: 'PartyC' }, + PartyD: { text: '丁方', color: '#dc3545', value: 'PartyD' }, +}; + +// ContractTemplatesIncomeExpenseTypeEnum +export const ContractTemplatesIncomeExpenseTypeEnum = { + Income: { text: '收入类', color: '#32cd32', value: 'Income' }, + Expense: { text: '支出类', color: '#ff4500', value: 'Expense' }, + None: { text: '无收无支', color: '#808080', value: 'None' }, +}; + +// ContractTemplatesSourceEnum +export const ContractTemplatesSourceEnum = { + Internal: { text: '内部', color: '#1e90ff', value: 'Internal' }, + External: { text: '外部', color: '#32cd32', value: 'External' }, +}; + +// ContractsContractNatureEnum +export const ContractsContractNatureEnum = { + RegularContract: { + text: '常规合同', + color: '#007bff', + value: 'RegularContract', + }, + FrameworkAgreement: { + text: '框架协议', + color: '#28a745', + value: 'FrameworkAgreement', + }, + Other: { text: '其它', color: '#28a745', value: 'Other' }, +}; + +// ContractsSettlementModeEnum +export const ContractsSettlementModeEnum = { + LumpSumContract: { + text: '总价合同', + color: '#007bff', + value: 'LumpSumContract', + }, + OpenContract: { text: '开口合同', color: '#28a745', value: 'OpenContract' }, +}; + +// ContractsStatusEnum +export const ContractsStatusEnum = { + TemporaryStorage: { + text: '暂存', + color: '#6c757d', + value: 'TemporaryStorage', + }, + UnderApproval: { text: '审核中', color: '#007bff', value: 'UnderApproval' }, + Approved: { text: '已通过', color: '#28a745', value: 'Approved' }, + Rejected: { text: '已退回', color: '#dc3545', value: 'Rejected' }, + Signed: { text: '已签约', color: '#17a2b8', value: 'Signed' }, + Archived: { text: '已归档', color: '#20c997', value: 'Archived' }, + Terminating: { text: '解除中', color: '#ffc107', value: 'Terminating' }, + Terminated: { text: '已解除', color: '#fd7e14', value: 'Terminated' }, + Closed: { text: '已终止', color: '#343a40', value: 'Closed' }, + Voided: { text: '已撤销', color: '#6610f2', value: 'Voided' }, + Cancelled: { text: '已取消', color: '#e83e8c', value: 'Cancelled' }, +}; + // ConvenienceServicesTypeEnum export const ConvenienceServicesTypeEnum = { PropertyExclusive: { @@ -471,6 +722,25 @@ export const ConvenienceServicesTypeEnum = { }, }; +// +export const CooperationSuggestionEnum = { + Recommend: { text: '建议合作', color: '#28a745', value: 'Recommend' }, + Restrict: { text: '建议限制合作', color: '#ffc107', value: 'Restrict' }, + Pause: { text: '建议暂不合作', color: '#fd7e14', value: 'Pause' }, + Eliminate: { text: '建议淘汰', color: '#dc3545', value: 'Eliminate' }, +}; + +// +export const CreditRatingEnum = { + AAA: { text: 'AAA', color: '#28a745', value: 'AAA' }, + AA: { text: 'AA', color: '#28a745', value: 'AA' }, + A: { text: 'A', color: '#28a745', value: 'A' }, + BBB: { text: 'BBB', color: '#ffc107', value: 'BBB' }, + BB: { text: 'BB', color: '#ffc107', value: 'BB' }, + B: { text: 'B', color: '#ffc107', value: 'B' }, + CCC: { text: 'CCC', color: '#dc3545', value: 'CCC' }, +}; + // CustomerBacklogsStatusEnum export const CustomerBacklogsStatusEnum = { Pending: { text: '待办', color: '#faad14', value: 'Pending' }, @@ -1017,6 +1287,13 @@ export const HouseWorkOrdersTypeEnum = { Complaint: { text: '投诉', color: '#aa00ff', value: 'Complaint' }, }; +// +export const InfoVerificationEnum = { + Authentic: { text: '真实完整', color: '#28a745', value: 'Authentic' }, + Discrepancy: { text: '存在差异', color: '#ffc107', value: 'Discrepancy' }, + Fake: { text: '信息造假', color: '#dc3545', value: 'Fake' }, +}; + // 公告阅读者类型 export const MsgPropertyAnnouncementReadsReaderTypeEnum = { Customer: { text: '客户', color: '#3b82f6', value: 'Customer' }, @@ -1047,6 +1324,31 @@ export const OrganizationsTypeEnum = { Department: { text: '部门', color: '#dc3545', value: 'Department' }, }; +// PayTypeEnum +export const PayTypeEnum = { + WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, + Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, +}; + +// +export const QualificationEvaluationEnum = { + Compliant: { text: '合规', color: '#28a745', value: 'Compliant' }, + BasicCompliant: { + text: '基本合规', + color: '#ffc107', + value: 'BasicCompliant', + }, + NonCompliant: { text: '不合规', color: '#dc3545', value: 'NonCompliant' }, +}; + +// +export const RatingOutlookEnum = { + Stable: { text: '稳定', color: '#28a745', value: 'Stable' }, + Positive: { text: '正面', color: '#17a2b8', value: 'Positive' }, + Negative: { text: '负面', color: '#dc3545', value: 'Negative' }, + Observation: { text: '观察', color: '#ffc107', value: 'Observation' }, +}; + // 退款状态枚举 export const RefundsStatusEnum = { Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, @@ -1079,6 +1381,67 @@ export const RefundsTypeEnum = { Other: { text: '其他退款', color: '#607d8b', value: 'Other' }, }; +// ResourceOrdersPaymentStatusEnum +export const ResourceOrdersPaymentStatusEnum = { + Unpaid: { text: '未支付', color: '#f59e0b', value: 'Unpaid' }, + Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, + Refunded: { text: '已退款', color: '#3b82f6', value: 'Refunded' }, +}; + +// ResourceOrdersStatusEnum +export const ResourceOrdersStatusEnum = { + Locked: { text: '已锁定', color: '#8b5cf6', value: 'Locked' }, + Reserved: { text: '已预约', color: '#3b82f6', value: 'Reserved' }, + Used: { text: '已使用', color: '#10b981', value: 'Used' }, + Overed: { text: '已结束', color: '#fca5a5', value: 'Overed' }, + Refunding: { text: '退订中', color: '#f59e0b', value: 'Refunding' }, + Refunded: { text: '已退订', color: '#ef4444', value: 'Refunded' }, + Closed: { text: '已关闭', color: '#6b7280', value: 'Closed' }, +}; + +// ResourceTypesTypeEnum +export const ResourceTypesCategoryEnum = { + Advertising: { text: '广告', color: '#ff9800', value: 'Advertising' }, + Venue: { text: '场地', color: '#4caf50', value: 'Venue' }, +}; + +// ResourcesChannelEnum +export const ResourcesChannelEnum = { + Consumer: { text: 'ToC', color: '#3b82f6', value: 'Consumer' }, + Business: { text: 'ToB', color: '#10b981', value: 'Business' }, +}; + +// ResourcesOpenDaysEnum +export const ResourcesOpenDaysEnum = { + Monday: { text: '星期一', color: '#3b82f6', value: 'Monday' }, + Tuesday: { text: '星期二', color: '#3b82f6', value: 'Tuesday' }, + Wednesday: { text: '星期三', color: '#3b82f6', value: 'Wednesday' }, + Thursday: { text: '星期四', color: '#3b82f6', value: 'Thursday' }, + Friday: { text: '星期五', color: '#3b82f6', value: 'Friday' }, + Saturday: { text: '星期六', color: '#10b981', value: 'Saturday' }, + Sunday: { text: '星期日', color: '#ef4444', value: 'Sunday' }, +}; + +// ResourcesReservationRuleEnum +export const ResourcesReservationRuleEnum = { + ByDay: { text: '按天', color: '#3b82f6', value: 'ByDay' }, + BySession: { text: '按场次', color: '#10b981', value: 'BySession' }, +}; + +// ResourcesReservationStatusEnum +export const ResourcesReservationStatusEnum = { + Fully: { text: '全部预约', color: '#4caf50', value: 'Fully' }, + Partially: { text: '部分预约', color: '#ff9800', value: 'Partially' }, + Not: { text: '无预约', color: '#f44336', value: 'Not' }, +}; + +// +export const RiskLevelEnum = { + Low: { text: '低风险', color: '#28a745', value: 'Low' }, + Medium: { text: '中风险', color: '#ffc107', value: 'Medium' }, + High: { text: '高风险', color: '#dc3545', value: 'High' }, +}; + // 性别 export const SexEnum = { Male: { text: '男', color: '#0000ff', value: 'Male' }, @@ -1146,6 +1509,291 @@ export const WechatAuthsPlatformEnum = { WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, }; +// AssetItemDisposalConfirmStatusEnum +export const AssetItemDisposalConfirmStatusEnum = { + Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已通过', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#f44336', value: 'Rejected' }, +}; + +// AssetItemDisposalResultEnum +export const AssetItemDisposalResultEnum = { + Disposing: { text: '处置中', color: '#ff9800', value: 'Disposing' }, + Disposed: { text: '已处置', color: '#4caf50', value: 'Disposed' }, +}; + +// AssetItemInventoryDetailResultEnum +export const AssetItemInventoryDetailResultEnum = { + Normal: { text: '正常', color: '#4caf50', value: 'Normal' }, + Loss: { text: '盘亏', color: '#f44336', value: 'Loss' }, +}; + +// AssetItemInventoryResultEnum +export const AssetItemInventoryResultEnum = { + Normal: { text: '正常', color: '#4caf50', value: 'Normal' }, + Loss: { text: '盘亏', color: '#f44336', value: 'Loss' }, + Surplus: { text: '盘盈', color: '#2196f3', value: 'Surplus' }, +}; + +// AssetItemInventoryStatusEnum +export const AssetItemInventoryStatusEnum = { + Pending: { text: '待处理', color: '#ff9800', value: 'Pending' }, + Processing: { text: '处理中', color: '#2196f3', value: 'Processing' }, + Completed: { text: '已完成', color: '#4caf50', value: 'Completed' }, + Closed: { text: '已关闭', color: '#607d8b', value: 'Closed' }, +}; + +// AssetItemMaintenanceRuleStatusEnum +export const AssetItemMaintenanceRuleStatusEnum = { + Enabled: { text: '启用', color: '#4caf50', value: 'Enabled' }, + Disabled: { text: '禁用', color: '#f44336', value: 'Disabled' }, +}; + +// AssetItemMaintenanceSourceEnum +export const AssetItemMaintenanceSourceEnum = { + Auto: { text: '自动生成', color: '#2196f3', value: 'Auto' }, + Manual: { text: '手动创建', color: '#ff9800', value: 'Manual' }, +}; + +// AssetItemMaintenanceStatusEnum +export const AssetItemMaintenanceStatusEnum = { + Pending: { text: '待处理', color: '#ff9800', value: 'Pending' }, + Assigned: { text: '待开始', color: '#2196f3', value: 'Assigned' }, + Processing: { text: '处理中', color: '#9c27b0', value: 'Processing' }, + Completed: { text: '已完成', color: '#4caf50', value: 'Completed' }, + Closed: { text: '已关闭', color: '#607d8b', value: 'Closed' }, +}; + +// AssetItemMaintenanceTypeEnum +export const AssetItemMaintenanceTypeEnum = { + Maintenance: { text: '维保', color: '#4caf50', value: 'Maintenance' }, + Repair: { text: '维修', color: '#f44336', value: 'Repair' }, +}; + +// AssetItemMarkingConfirmStatusEnum +export const AssetItemMarkingConfirmStatusEnum = { + Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已通过', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#f44336', value: 'Rejected' }, +}; + +// AssetItemMarkingTypeEnum +export const AssetItemMarkingTypeEnum = { + Damaged: { text: '损毁', color: '#f44336', value: 'Damaged' }, + Lost: { text: '丢失', color: '#9c27b0', value: 'Lost' }, +}; + +// AssetItemReceiveConfirmStatusEnum +export const AssetItemReceiveConfirmStatusEnum = { + Pending: { text: '待确认', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已确认', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已拒绝', color: '#f44336', value: 'Rejected' }, +}; + +// AssetItemReturnConfirmStatusEnum +export const AssetItemReturnConfirmStatusEnum = { + Pending: { text: '待确认', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已确认', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已拒绝', color: '#f44336', value: 'Rejected' }, +}; + +// AssetItemTransferConfirmStatusEnum +export const AssetItemTransferConfirmStatusEnum = { + Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已通过', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#f44336', value: 'Rejected' }, +}; + +// AssetItemsEntryTypeEnum +export const AssetItemsEntryTypeEnum = { + Purchase: { text: '采购入库', color: '#2196f3', value: 'Purchase' }, + Inventory: { text: '盘盈入库', color: '#4caf50', value: 'Inventory' }, + Donation: { text: '捐赠入库', color: '#9c27b0', value: 'Donation' }, + Transfer: { text: '调拨入库', color: '#ff9800', value: 'Transfer' }, +}; + +// AssetItemsManageStatusEnum +export const AssetItemsManageStatusEnum = { + Idle: { text: '闲置', color: '#9e9e9e', value: 'Idle' }, + Storing: { text: '入库中', color: '#2196f3', value: 'Storing' }, + Transferring: { text: '调拨中', color: '#ff9800', value: 'Transferring' }, + StockLoss: { text: '盘亏', color: '#f44336', value: 'StockLoss' }, + Disposing: { text: '处置中', color: '#9c27b0', value: 'Disposing' }, + Disposed: { text: '已处置', color: '#607d8b', value: 'Disposed' }, + Checking: { text: '盘点中', color: '#00bcd4', value: 'Checking' }, + Maintaining: { text: '维护中', color: '#673ab7', value: 'Maintaining' }, + Receiving: { text: '领用中', color: '#4caf50', value: 'Receiving' }, + Received: { text: '已领用', color: '#8bc34a', value: 'Received' }, +}; + +// AssetItemsStatusEnum +export const AssetItemsStatusEnum = { + Good: { text: '良好', color: '#4caf50', value: 'Good' }, + WaitRepair: { text: '待维修', color: '#ff9800', value: 'WaitRepair' }, + Repairing: { text: '维修中', color: '#2196f3', value: 'Repairing' }, + WaitMaintain: { text: '待保养', color: '#9c27b0', value: 'WaitMaintain' }, + Maintaining: { text: '保养中', color: '#673ab7', value: 'Maintaining' }, + Damaged: { text: '损毁', color: '#f44336', value: 'Damaged' }, + Lost: { text: '丢失', color: '#607d8b', value: 'Lost' }, +}; + +// BillPaymentsStatusEnum +export const BillPaymentsStatusEnum = { + Pending: { text: '待审', color: '#faad14', value: 'Pending' }, + Approved: { text: '已审', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '驳回', color: '#f5222d', value: 'Rejected' }, +}; + +// BillPaymentsTypeEnum +export const BillPaymentsTypeEnum = { + DoorCard: { text: '门卡', color: '#2196f3', value: 'DoorCard' }, + ResourceOrder: { text: '资源订单', color: '#4caf50', value: 'ResourceOrder' }, + EmergencyEvent: { + text: '突发事件', + color: '#ef4444', + value: 'EmergencyEvent', + }, + RenovationDeposit: { + text: '装修押金', + color: '#f59e0b', + value: 'RenovationDeposit', + }, +}; + +// BillsFlowTypeEnum +export const BillsFlowTypeEnum = { + Income: { text: '收入', color: '#10b981', value: 'Income' }, + Expense: { text: '支出', color: '#ef4444', value: 'Expense' }, +}; + +// BillsRefundStatusEnum +export const BillsRefundStatusEnum = { + Requested: { text: '已申请', color: '#2196f3', value: 'Requested' }, + Reviewing: { text: '审核中', color: '#ff9800', value: 'Reviewing' }, + Rejected: { text: '已拒绝', color: '#f44336', value: 'Rejected' }, + Processing: { text: '退款中', color: '#9c27b0', value: 'Processing' }, + Refunded: { text: '已退款', color: '#4caf50', value: 'Refunded' }, + Failed: { text: '退款失败', color: '#e91e63', value: 'Failed' }, +}; + +// BillsStatusEnum +export const BillsStatusEnum = { + PendingPayment: { text: '待支付', color: '#facc15', value: 'PendingPayment' }, + Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, + Overdue: { text: '已逾期', color: '#ef4444', value: 'Overdue' }, + Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, +}; + +// CompanySealsTypeEnum +export const CompanySealsTypeEnum = { + OfficialSeal: { text: '公章', color: '#007bff', value: 'OfficialSeal' }, + FinanceSeal: { text: '财务专用章', color: '#28a745', value: 'FinanceSeal' }, + ContractSeal: { text: '合同专用章', color: '#17a2b8', value: 'ContractSeal' }, + LegalRepresentativeSeal: { + text: '法定代表人章', + color: '#ffc107', + value: 'LegalRepresentativeSeal', + }, + InvoiceSeal: { text: '发票专用章', color: '#dc3545', value: 'InvoiceSeal' }, + HRSeal: { text: '人事专用章', color: '#6f42c1', value: 'HRSeal' }, +}; + +// 下载记录状态 +export const DownloadRecordsStatusEnum = { + Pending: { text: '待处理', color: '#909399', value: 'Pending' }, + Processing: { text: '处理中', color: '#409EFF', value: 'Processing' }, + Done: { text: '已完成', color: '#67C23A', value: 'Done' }, + Failed: { text: '失败', color: '#F56C6C', value: 'Failed' }, +}; + +// EmergencyEventBillsCostTypeEnum +export const EmergencyEventBillsCostTypeEnum = { + Income: { text: '收入', color: '#52c41a', value: 'Income' }, + Expense: { text: '支出', color: '#f5222d', value: 'Expense' }, +}; + +// EmergencyEventBillsFeeTypeEnum +export const EmergencyEventBillsFeeTypeEnum = { + Compensation: { text: '赔偿', color: '#ef4444', value: 'Compensation' }, + Penalty: { text: '罚款', color: '#f59e0b', value: 'Penalty' }, +}; + +// EmergencyEventBillsPaymentMethodEnum +export const EmergencyEventBillsPaymentMethodEnum = { + WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, + Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, + BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, + TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, + Prepayment: { text: '预缴支付', color: '#f59e0b', value: 'Prepayment' }, + POS: { text: 'POS机', color: '#8b5cf6', value: 'POS' }, + Cash: { text: '现金', color: '#dc2626', value: 'Cash' }, +}; + +// EmergencyEventBillsPaymentStatusEnum +export const EmergencyEventBillsPaymentStatusEnum = { + Pending: { text: '待支付', color: '#facc15', value: 'Pending' }, + ToBeConfirmed: { text: '待确认', color: '#fb923c', value: 'ToBeConfirmed' }, + Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, + Refunded: { text: '已退款', color: '#60a5fa', value: 'Refunded' }, + Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, + Failed: { text: '支付失败', color: '#ef4444', value: 'Failed' }, +}; + +// EmergencyEventsAuditStatusEnum +export const EmergencyEventsAuditStatusEnum = { + Pending: { text: '待审', color: '#ff9800', value: 'Pending' }, + Approved: { text: '通过', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '驳回', color: '#f44336', value: 'Rejected' }, +}; + +// EmergencyEventsCompensationTypeEnum +export const EmergencyEventsCompensationTypeEnum = { + Ours: { text: '我方', color: '#2196f3', value: 'Ours' }, + Others: { text: '他方', color: '#9c27b0', value: 'Others' }, +}; + +// EmergencyEventsStatusEnum +export const EmergencyEventsStatusEnum = { + PendingFollowUp: { + text: '待跟进', + color: '#f59e0b', + value: 'PendingFollowUp', + }, + InProgress: { text: '跟进中', color: '#3b82f6', value: 'InProgress' }, + PendingReview: { text: '待审核', color: '#a855f7', value: 'PendingReview' }, + Closed: { text: '已关闭', color: '#6b7280', value: 'Closed' }, +}; + +// EmergencyTeamMembersPositionEnum +export const EmergencyTeamMembersPositionEnum = { + Leader: { text: '应急组长', color: '#e74c3c', value: 'Leader' }, + Member: { text: '现场处置员', color: '#3498db', value: 'Member' }, + Liaison: { text: '信息联络员', color: '#f1c40f', value: 'Liaison' }, + Support: { text: '后勤保障员', color: '#2ecc71', value: 'Support' }, + Reserve: { text: '机动预备员', color: '#9b59b6', value: 'Reserve' }, +}; + +// HouseDoorCardLogsTypeEnum +export const HouseDoorCardLogsTypeEnum = { + View: { text: '查看', color: '#2196f3', value: 'View' }, + Update: { text: '修改', color: '#4caf50', value: 'Update' }, + ReportLoss: { text: '挂失', color: '#ff9800', value: 'ReportLoss' }, + Invalidate: { text: '作废', color: '#f44336', value: 'Invalidate' }, +}; + +// PatrolRoutesGenerationMethodEnum +export const PatrolRoutesGenerationMethodEnum = { + Daily: { text: '按天', color: '#007bff', value: 'Daily' }, + Weekly: { text: '按周', color: '#28a745', value: 'Weekly' }, + Monthly: { text: '按月', color: '#ffc107', value: 'Monthly' }, +}; + +// PatrolTaskLocationsStatusEnum +export const PatrolTaskLocationsStatusEnum = { + Incomplete: { text: '未完成', color: '#ff9800', value: 'Incomplete' }, + Completed: { text: '已完成', color: '#4caf50', value: 'Completed' }, +}; + // PatrolTasksCreateTypeEnum export const PatrolTasksCreateTypeEnum = { Auto: { text: '定时生成', color: '#2196f3', value: 'Auto' }, @@ -1162,15 +1810,101 @@ export const PatrolTasksStatusEnum = { Overdue: { text: '已超期', color: '#e91e63', value: 'Overdue' }, }; -// PatrolRoutesGenerationMethodEnum -export const PatrolRoutesGenerationMethodEnum = { - Daily: { text: '按天', color: '#007bff', value: 'Daily' }, - Weekly: { text: '按周', color: '#28a745', value: 'Weekly' }, - Monthly: { text: '按月', color: '#ffc107', value: 'Monthly' }, +// QuestionsTypeEnum +export const QuestionsTypeEnum = { + Score: { text: '评分题', color: '#4caf50', value: 'Score' }, + Fill: { text: '填空题', color: '#2196f3', value: 'Fill' }, }; -// PatrolTaskLocationsStatusEnum -export const PatrolTaskLocationsStatusEnum = { - Incomplete: { text: '未完成', color: '#ff9800', value: 'Incomplete' }, - Completed: { text: '已完成', color: '#4caf50', value: 'Completed' }, +// RenovationAppliesAcceptanceStatusEnum +export const RenovationAppliesAcceptanceStatusEnum = { + PendingAcceptance: { + text: '待验收', + color: '#f1c40f', + value: 'PendingAcceptance', + }, + Accepted: { text: '验收合格', color: '#2ecc71', value: 'Accepted' }, + Rejected: { text: '验收不合格', color: '#e74c3c', value: 'Rejected' }, + Cancelled: { text: '已取消', color: '#95a5a6', value: 'Cancelled' }, +}; + +// RenovationAppliesConstructionStatusEnum +export const RenovationAppliesConstructionStatusEnum = { + PendingConstruction: { + text: '待施工', + color: '#f1c40f', + value: 'PendingConstruction', + }, + NormalConstruction: { + text: '正常施工', + color: '#2ecc71', + value: 'NormalConstruction', + }, + StoppedConstruction: { + text: '已停工', + color: '#e74c3c', + value: 'StoppedConstruction', + }, + CompletedConstruction: { + text: '已竣工', + color: '#3498db', + value: 'CompletedConstruction', + }, +}; + +// RenovationAppliesProcessTypeEnum +export const RenovationAppliesProcessTypeEnum = { + OwnerProcess: { text: '业主办理', color: '#3498db', value: 'OwnerProcess' }, + AgentProcess: { text: '代理人办理', color: '#9b59b6', value: 'AgentProcess' }, +}; + +// RenovationAppliesRenovationContentEnum +export const RenovationAppliesRenovationContentEnum = { + PartialRenovation: { + text: '局部装修', + color: '#f39c12', + value: 'PartialRenovation', + }, + FullHouseRenovation: { + text: '全屋装修', + color: '#2ecc71', + value: 'FullHouseRenovation', + }, + PartialRefurbishment: { + text: '部分翻新', + color: '#3498db', + value: 'PartialRefurbishment', + }, +}; + +// RenovationAppliesStatusEnum +export const RenovationAppliesStatusEnum = { + Draft: { text: '暂存', color: '#f39c12', value: 'Draft' }, + Pending: { text: '审核中', color: '#faad14', value: 'Pending' }, + Approved: { text: '已完成', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '驳回', color: '#f5222d', value: 'Rejected' }, + Cancelled: { text: '作废', color: '#9b59b6', value: 'Cancelled' }, +}; + +// RenovationAppliesTypeEnum +export const RenovationAppliesTypeEnum = { + SelfRenovation: { text: '自装', color: '#1abc9c', value: 'SelfRenovation' }, + RenovationCompany: { + text: '装修公司', + color: '#e67e22', + value: 'RenovationCompany', + }, +}; + +// SurveyReleasesTypeEnum +export const SurveyReleasesTypeEnum = { + Manual: { text: '手动发布', color: '#4caf50', value: 'Manual' }, + Timing: { text: '定时发布', color: '#2196f3', value: 'Timing' }, +}; + +// 通联交易类型 +export const TongLianPayTypeEnum = { + W06: { text: '微信小程序', color: '#07c160', value: 'W06' }, + A01: { text: '支付宝扫码', color: '#1677ff', value: 'A01' }, + A02: { text: '支付宝JSAPI', color: '#1677ff', value: 'A02' }, }; diff --git a/src/pages/company/employees/modals/EmployeeShow.tsx b/src/pages/company/employees/modals/EmployeeShow.tsx new file mode 100644 index 0000000..e0e3ee8 --- /dev/null +++ b/src/pages/company/employees/modals/EmployeeShow.tsx @@ -0,0 +1,92 @@ +import { MyBetaModalFormProps, MyButtons, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { CompanyEmployeesTypeEnum, SexEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function EmployeeShow(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + + } + onOpen={() => { + if (props?.item?.id) { + setLoading(true); + Apis.Company.CompanyEmployees.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .catch((error) => { + console.error('获取员工信息失败:', error); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + {data?.name} + + + {data?.employee_id} + + + {data?.phone} + + + + + + + + + {data?.organizations_name} + + + {data?.positions_name} + + + {data?.sys_roles_name} + + + {data?.remark} + + + {data?.created_at} + + + {data?.updated_at} + + + + + + } + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/borrows/index.tsx b/src/pages/contract/contract_archive_use/borrows/index.tsx new file mode 100644 index 0000000..c68d5cf --- /dev/null +++ b/src/pages/contract/contract_archive_use/borrows/index.tsx @@ -0,0 +1,134 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ContractArchiveBorrowStatusEnum } from '@/gen/Enums'; +import EmployeeShow from '@/pages/company/employees/modals/EmployeeShow'; +import CodeInfo from '@/pages/contract/contract_archives/finished/modals/Show'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Show from './modals/Show'; +import Update from './modals/Update'; + +export default function Index({ title = '合同借用' }) { + return ( + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractArchiveBorrows.List, + ) + } + headerTitle="合同借用列表" + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + MyColumns.EnumTag({ + title: '借用状态', + dataIndex: 'borrow_status', + valueEnum: ContractArchiveBorrowStatusEnum, + }), + // MyColumns.EnumTag({ + // title: '归还状态', + // dataIndex: 'return_status', + // valueEnum: ContractArchiveFileReturnStatusEnum, + // }), + { + title: '档案编号', + dataIndex: ['contract_archive', 'code'], + render: (_, item: any) => ( + + ), + }, + { + title: '借用信息', + search: false, + render: (_, item: any) => { + if (!item?.borrow_files || item.borrow_files.length === 0) { + return '-'; + } + return ( +
+ {item.borrow_files.map((res: any, index: number) => ( +
+ 文件: {res?.file?.name},借用: {res?.borrow_number},遗失:{' '} + {res?.lost_number},损坏: {res?.damaged_number} +
+ ))} +
+ ); + }, + }, + { + title: '借用人', + dataIndex: 'borrower_name', + search: false, + render: (_, item: any) => ( + + ), + }, + + { + title: '借用日期', + dataIndex: 'borrow_date', + search: false, + }, + { + title: '应归还日期', + dataIndex: 'expected_return_date', + search: false, + }, + MyColumns.Boolean({ + title: '需要归还', + dataIndex: 'is_need_return', + search: false, + }), + { + title: '登记人', + dataIndex: ['registrar', 'name'], + search: false, + render: (_, item: any) => ( + + ), + }, + // MyColumns.CreatedAt(), + MyColumns.UpdatedAt(), + MyColumns.Option({ + width: 100, + render: (_, item: any, index, action) => ( + + + + Apis.Contract.ContractArchiveBorrows.Borrow({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx b/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx new file mode 100644 index 0000000..a0d6c76 --- /dev/null +++ b/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx @@ -0,0 +1,503 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import MyModalsContractsArchivedSelectList from '@/components/ModalsContractsArchivedSelectList'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Button, Form, message, Space } from 'antd'; +import { useState } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="800px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => { + console.log(values, 'values'); + + const { node_approvers } = values; + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractArchiveBorrows.Store({ + ...values, + contract_archives_id: values?.contract_archives?.id ?? 0, + is_need_return: values?.is_need_return || false, + files: values?.files?.map((item: any) => ({ + contract_archive_files_id: item.id, + borrow_number: item?.borrow_number, + })), + }) + .then(() => { + props.reload?.(); + message.success('借用成功!'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '借用人', + dataIndex: 'borrower_id', + key: 'borrower_id', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + required: true, + }), + { + key: 'borrow_date', + title: '借用日期', + dataIndex: 'borrow_date', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + colProps: { span: 8 }, + }, + + { + key: 'is_need_return', + title: '是否需要归还', + colProps: { span: 8 }, + valueType: 'switch', + // initialValue: true, + width: '100%', + fieldProps: { + onChange: () => { + form.setFieldValue('expected_return_date', undefined); + }, + }, + }, + { + name: ['is_need_return'], + valueType: 'dependency', + columns: ({ is_need_return }: any) => { + return is_need_return + ? [ + { + key: 'expected_return_date', + title: '设置归还日期', + dataIndex: 'expected_return_date', + formItemProps: { ...rulesHelper.text }, + valueType: 'date', + fieldProps: { + style: { + width: '100%', + }, + }, + colProps: { span: 8 }, + }, + ] + : []; + }, + }, + + { + key: 'borrow_reason', + title: '借用原因', + dataIndex: 'borrow_reason', + // valueType: 'textarea', + colProps: { span: 16 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '借用文件', + }, + }, + { + colProps: { span: 24 }, + title: '选择归档合同', + key: 'contract_archives', + formItemProps: { ...rulesHelper.text }, + renderFormItem: (_, row: any) => { + return ( + + { + if (e && e.length > 0) { + let res = e[0]; + form.setFieldsValue({ + files: res?.contract_archive_files, + contract_archives: { + id: res?.id, + code: res?.code, + }, + }); + } + console.log(e, 'e'); + }} + /> + {row?.value?.code && ( + 已选择归档编号: {row?.value?.code} + )} + + ); + }, + }, + + { + valueType: 'formList', + dataIndex: 'files', + title: '', + formItemProps: { + ...rulesHelper.array, + labelCol: { span: 0 }, + wrapperCol: { span: 24 }, + }, + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + creatorButtonProps: false, + itemRender: ({ listDom, action }: any, { index }: any) => { + return ( + + {listDom} + + ); + }, + }, + + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '文件ID', + key: 'id', + colProps: { span: 4 }, + fieldProps: { + disabled: true, + }, + }, + { + title: '名称', + key: 'name', + colProps: { span: 8 }, + fieldProps: { + disabled: true, + }, + }, + { + title: '文件份数', + key: 'number', + valueType: 'digit', + colProps: { span: 4 }, + fieldProps: { + disabled: true, + style: { + width: '100%', + }, + }, + }, + { + title: '已借份数', + key: 'borrowed_number', + valueType: 'digit', + colProps: { span: 4 }, + fieldProps: { + disabled: true, + style: { + width: '100%', + }, + }, + }, + { + name: ['number', 'borrowed_number'], + valueType: 'dependency', + columns: ({ number, borrowed_number }: any) => { + return [ + { + title: '借用份数', + key: 'borrow_number', + valueType: 'digit', + colProps: { span: 4 }, + fieldProps: { + max: number - borrowed_number, + min: 1, + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.number }, + }, + ]; + }, + }, + ], + }, + ], + }, + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractBorrow.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + // setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/borrows/modals/Show.tsx b/src/pages/contract/contract_archive_use/borrows/modals/Show.tsx new file mode 100644 index 0000000..f443898 --- /dev/null +++ b/src/pages/contract/contract_archive_use/borrows/modals/Show.tsx @@ -0,0 +1,116 @@ +import { MyBetaModalFormProps, MyButtons } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + } + onOpen={() => { + if (props?.item?.id) { + setLoading(true); + Apis.Contract.ContractArchiveBorrows.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .catch((error) => { + console.error('获取借阅信息失败:', error); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + {data?.contract_archive?.code || '-'} + + + {data?.borrower_name} + + + {data?.borrow_date} + + + {data?.expected_return_date} + + + {data?.actual_return_date} + + + {data?.returner_name} + + + {data?.return_status === 'NotReturned' ? '未归还' : '已归还'} + + + {data?.is_need_return ? '是' : '否'} + + + {data?.borrow_reason} + + + {!data?.borrow_files || data.borrow_files.length === 0 ? ( + '-' + ) : ( +
+ {data.borrow_files.map((file: any, index: number) => ( +
+
+ 文件 {index + 1}: {file?.file?.name} +
+
借阅数量: {file?.borrow_number}
+ {/* {file?.return_status && ( +
+ 归还状态:{' '} + {ContractArchiveFileReturnStatusEnum[ + file.return_status + ]?.text || file.return_status} +
+ )} */} + {file?.lost_number > 0 && ( +
遗失数量: {file?.lost_number}
+ )} + {file?.damaged_number > 0 && ( +
损坏数量: {file?.damaged_number}
+ )} + {file?.lost_description && ( +
遗失描述: {file?.lost_description}
+ )} + {file?.damaged_description && ( +
损坏描述: {file?.damaged_description}
+ )} +
+ ))} +
+ )} +
+
+
+
+
+ } + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/borrows/modals/Update.tsx b/src/pages/contract/contract_archive_use/borrows/modals/Update.tsx new file mode 100644 index 0000000..d89084b --- /dev/null +++ b/src/pages/contract/contract_archive_use/borrows/modals/Update.tsx @@ -0,0 +1,215 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ContractArchiveFileReturnStatusEnum } from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`归还${props.title}`} + trigger={ + + } + key={new Date().getTime()} + wrapperCol={{ span: 24 }} + width="850px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + files: props.item?.borrow_files?.map((res: any) => ({ + id: res?.id, + name: res?.file?.name, + borrow_number: res?.borrow_number, + })), + }); + } + }} + onFinish={async (values) => + Apis.Contract.ContractArchiveBorrows.Return({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.Employees({ + title: '归还人', + dataIndex: 'returner_id', + key: 'returner_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + required: true, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '归还文件', + }, + }, + { + valueType: 'formList', + dataIndex: 'files', + title: '', + formItemProps: { + ...rulesHelper.array, + labelCol: { span: 0 }, + wrapperCol: { span: 24 }, + }, + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + itemRender: ({ listDom, action }: any, { index }: any) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: 'ID', + key: 'id', + colProps: { span: 2 }, + fieldProps: { + disabled: true, + }, + }, + { + title: '名称', + key: ['name'], + colProps: { span: 7 }, + fieldProps: { + disabled: true, + }, + }, + { + title: '归还份数', + key: 'borrow_number', + valueType: 'digit', + colProps: { span: 3 }, + fieldProps: { + disabled: true, + style: { + width: '100%', + }, + }, + }, + MyFormItems.EnumSelect({ + key: 'return_status', + title: '归还状态', + colProps: { span: 4 }, + valueEnum: () => { + let enumObj = JSON.parse( + JSON.stringify(ContractArchiveFileReturnStatusEnum), + ); + delete enumObj.NotReturned; + return enumObj; + }, + required: true, + }), + { + name: ['return_status', 'borrow_number'], + valueType: 'dependency', + columns: ({ return_status, borrow_number }: any) => { + return [ + { + title: '遗失数量', + key: 'lost_number', + valueType: 'digit', + colProps: { span: 4 }, + formItemProps: + return_status === 'AllLost' || + return_status === 'PartialLost' + ? { ...rulesHelper.number } + : {}, + fieldProps: { + max: borrow_number, + min: 0, + style: { + width: '100%', + }, + }, + }, + { + title: '损坏数量', + key: 'damaged_number', + valueType: 'digit', + colProps: { span: 4 }, + formItemProps: + return_status === 'PartialDamaged' || + return_status === 'AllDamaged' + ? { ...rulesHelper.number } + : {}, + fieldProps: { + max: borrow_number, + min: 0, + style: { + width: '100%', + }, + }, + }, + ]; + }, + }, + { + title: '遗失描述', + key: 'lost_description', + colProps: { span: 12 }, + }, + { + title: '损坏描述', + key: 'damaged_description', + colProps: { span: 12 }, + }, + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/index.tsx b/src/pages/contract/contract_archive_use/index.tsx new file mode 100644 index 0000000..71c6689 --- /dev/null +++ b/src/pages/contract/contract_archive_use/index.tsx @@ -0,0 +1,49 @@ +import { MyPageContainer } from '@/common'; +import { useSearchParams } from '@umijs/max'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import Borrows from './borrows'; +import Read from './read'; + +export default function Index({ title = '合同档案利用' }) { + const [searchParams] = useSearchParams(); + const [activeKey, setActiveKey] = useState('Borrows'); + + const items: TabsProps['items'] = [ + { + key: 'Borrows', + label: '合同借用', + children: , + }, + { + key: 'Read', + label: '合同借阅', + children: , + }, + ]; + + useEffect(() => { + if (searchParams?.get('key')) { + setActiveKey(searchParams?.get('key') || 'Borrows'); + } + }, []); + + return ( + + { + setActiveKey(key); + }} + /> + + ); +} diff --git a/src/pages/contract/contract_archive_use/read/index.tsx b/src/pages/contract/contract_archive_use/read/index.tsx new file mode 100644 index 0000000..27af2f5 --- /dev/null +++ b/src/pages/contract/contract_archive_use/read/index.tsx @@ -0,0 +1,102 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import EmployeeShow from '@/pages/company/employees/modals/EmployeeShow'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import CodeInfo from '../../contract_archives/finished/modals/Show'; +import Read from './modals/Read'; +import Show from './modals/Show'; + +export default function Index({ title = '合同借阅' }) { + return ( + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractArchiveReads.List, + ) + } + headerTitle="合同借阅列表" + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + + { + title: '归档编号', + dataIndex: ['contract_archive', 'code'], + render: (_, item: any) => ( + + ), + }, + { + title: '借阅信息', + search: false, + render: (_, item: any) => { + if (!item?.read_files || item.read_files.length === 0) { + return '-'; + } + return ( +
+ {item.read_files.map((res: any, index: number) => ( +
+ 文件: {res?.file?.name} +
+ ))} +
+ ); + }, + }, + { + title: '借阅人', + dataIndex: 'reader_name', + render: (_, item: any) => ( + + ), + }, + { + title: '借阅原因', + dataIndex: 'read_reason', + search: false, + }, + { + title: '借阅日期', + dataIndex: 'read_date', + search: false, + }, + { + title: '登记人', + dataIndex: ['registrar', 'name'], + search: false, + render: (_, item: any) => ( + + ), + }, + // MyColumns.CreatedAt(), + // MyColumns.UpdatedAt(), + MyColumns.Option({ + width: 100, + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/read/modals/Read.tsx b/src/pages/contract/contract_archive_use/read/modals/Read.tsx new file mode 100644 index 0000000..26dfdc1 --- /dev/null +++ b/src/pages/contract/contract_archive_use/read/modals/Read.tsx @@ -0,0 +1,176 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import MyModalsContractsArchivedSelectList from '@/components/ModalsContractsArchivedSelectList'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message, Space } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractArchiveReads.Store({ + ...values, + contract_archives_id: values?.contract_archives?.id ?? 0, + is_need_return: values?.is_need_return || false, + files: values?.files?.map((item: any) => ({ + contract_archive_files_id: item.id, + borrow_number: item?.borrow_number, + })), + }) + .then(() => { + props.reload?.(); + message.success('借阅成功!'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '借阅人', + dataIndex: 'borrower_id', + key: 'reader_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + required: true, + }), + { + key: 'read_date', + title: '借阅日期', + dataIndex: 'read_date', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + colProps: { span: 12 }, + }, + + { + key: 'read_reason', + title: '借阅原因', + dataIndex: 'read_reason', + // valueType: 'textarea', + colProps: { span: 24 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '借阅文件', + }, + }, + { + colProps: { span: 24 }, + title: '选择归档合同', + key: 'contract_archives', + formItemProps: { ...rulesHelper.text }, + renderFormItem: (_, row: any) => { + return ( + + { + if (e && e.length > 0) { + let res = e[0]; + form.setFieldsValue({ + files: res?.contract_archive_files, + contract_archives: { + id: res?.id, + code: res?.code, + }, + }); + } + console.log(e, 'e'); + }} + /> + {row?.value?.code && ( + 已选择归档编号: {row?.value?.code} + )} + + ); + }, + }, + + { + valueType: 'formList', + dataIndex: 'files', + title: '', + formItemProps: { + ...rulesHelper.array, + labelCol: { span: 0 }, + wrapperCol: { span: 24 }, + }, + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + creatorButtonProps: false, + itemRender: ({ listDom, action }: any, { index }: any) => { + return ( + + {listDom} + + ); + }, + }, + + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '文件ID', + key: 'id', + colProps: { span: 6 }, + fieldProps: { + disabled: true, + }, + }, + { + title: '名称', + key: 'name', + colProps: { span: 18 }, + fieldProps: { + disabled: true, + }, + }, + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archive_use/read/modals/Show.tsx b/src/pages/contract/contract_archive_use/read/modals/Show.tsx new file mode 100644 index 0000000..d5affb4 --- /dev/null +++ b/src/pages/contract/contract_archive_use/read/modals/Show.tsx @@ -0,0 +1,81 @@ +import { MyBetaModalFormProps, MyButtons } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + } + onOpen={() => { + if (props?.item?.id) { + setLoading(true); + Apis.Contract.ContractArchiveReads.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .catch((error) => { + console.error('获取借阅信息失败:', error); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + {data?.reader_id} + + + {data?.reader_name} + + + {data?.read_date} + + + + {data?.read_reason} + + + {!data?.read_files || data.read_files.length === 0 ? ( + '-' + ) : ( +
+ {data.read_files.map((file: any, index: number) => ( +
+
+ 文件 {index + 1}: {file?.file?.name} +
+
+ ))} +
+ )} +
+
+
+
+
+ } + /> + ); +} diff --git a/src/pages/contract/contract_archives/finished/index.tsx b/src/pages/contract/contract_archives/finished/index.tsx new file mode 100644 index 0000000..0f2d3f4 --- /dev/null +++ b/src/pages/contract/contract_archives/finished/index.tsx @@ -0,0 +1,154 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; + +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +import Save from './modals/Save'; +import Show from './modals/Show'; +import TransfersCreate from './modals/TransfersCreate'; +import Update from './modals/Update'; + +export default function Index() { + // let toolBarRender = (action: any) => { + // return getCurrentPermissions( + // { + // borrow: ( + // + // ), + // }, + // 'Finished', + // ); + // }; + + return ( + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractArchives.List, + ) + } + // toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '归档编号', + dataIndex: 'code', + // render: (_, item: any) => ( + // { + // navigate( + // `/contract/contract_archives/show/${item.contracts_id}`, + // ); + // }} + // > + // {item?.code} + // + // ), + }, + { + title: '合同名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '保密等级', + dataIndex: 'confidentiality_level', + valueEnum: ContractArchivesConfidentialityLevelEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '期限类型', + dataIndex: 'period_type', + valueEnum: ContractArchivesPeriodTypeEnum, + search: false, + }), + + { + title: '保管年限', + dataIndex: 'storage_years', + valueType: 'digit', + search: false, + }, + // { + // title: '案卷编号', + // dataIndex: 'file_number', + // }, + { + title: '文件盒编号', + dataIndex: 'box_number', + }, + { + title: '文件柜编号', + dataIndex: 'cabinet_number', + }, + + // { + // title: '归档年份', + // dataIndex: 'archive_year', + // valueType: 'dateYear', + // search: false, + // }, + { + title: '归档日期', + dataIndex: 'archive_date', + valueType: 'date', + sorter: true, + search: false, + }, + { + title: '保管人', + dataIndex: 'keeper_name', + search: false, + }, + { + title: '文件信息', + render: (_, item: any) => { + return item?.archive_files?.map((res: any, index: number) => { + return ( +
+ 文件:{res?.name},已借:{res?.borrowed_number}份,遗失: + {res?.lost_number}份 +
+ ); + }); + }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + + + Apis.Contract.ContractArchives.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/finished/modals/Save.tsx b/src/pages/contract/contract_archives/finished/modals/Save.tsx new file mode 100644 index 0000000..d2fd49a --- /dev/null +++ b/src/pages/contract/contract_archives/finished/modals/Save.tsx @@ -0,0 +1,91 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Save(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`归档信息${props.title}`} + trigger={ + + } + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values: any) => + Apis.Contract.ContractArchives.Update({ + ...values, + id: props?.item?.id ?? 0, + code: props?.item?.code, + name: props?.item?.name, + period_type: props?.item?.period_type, + confidentiality_level: props?.item?.confidentiality_level, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'is_sealed', + title: '是否封存', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '操作封存', + unCheckedChildren: '取消封存', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('seal_date', undefined); + }, + }, + }, + + { + name: ['is_sealed'], + valueType: 'dependency', + columns: ({ is_sealed }: any) => { + return is_sealed + ? [ + { + key: 'seal_date', + title: '封存日期', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/finished/modals/Show.tsx b/src/pages/contract/contract_archives/finished/modals/Show.tsx new file mode 100644 index 0000000..b45755d --- /dev/null +++ b/src/pages/contract/contract_archives/finished/modals/Show.tsx @@ -0,0 +1,167 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesFileStatusEnum, + ContractArchivesFileTypeEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(false); + const [data, setData] = useState({}); + + const handleOpenModal = () => { + if (props?.item?.id) { + setLoading(true); + Apis.Contract.ContractArchives.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }; + return ( + + + + + {/* 基本信息 */} + + {data?.code} + + + {data?.name} + + + {data?.contracts_id} + + + {/* 保管信息 */} + + + + {data?.period_type === 'FixedTerm' && ( + + {data?.storage_years} 年 + + )} + + + + + {/* 存放信息 */} + {/* + {data?.file_number} + */} + + {data?.box_number} + + + {data?.cabinet_number} + + + + {data?.keeper_name}-{data?.keeper_phone} + + {/* 时间信息 */} + + {data?.archive_date} + + + {data?.archive_year} + + + {data?.is_sealed ? `是 | ${data?.seal_date}` : '否'} + + + {data?.created_at} + + + {data?.updated_at} + + + + + + + {/* 归档文件列表 */} + {(data?.contract_archive_files ?? []).map( + (file: any, index: number) => ( + + + + {file?.name} + + + + + + {file?.number} + + + + + + {file?.remark} + + + {file?.info && file?.info.length > 0 ? ( + + {file?.info.map((item: any, fileIndex: number) => ( + + {item?.name || `文件 ${fileIndex + 1}`} + + ))} + + ) : ( + '-' + )} + + + + ), + )} + + + } + /> + ); +} diff --git a/src/pages/contract/contract_archives/finished/modals/TransfersCreate.tsx b/src/pages/contract/contract_archives/finished/modals/TransfersCreate.tsx new file mode 100644 index 0000000..44c7af6 --- /dev/null +++ b/src/pages/contract/contract_archives/finished/modals/TransfersCreate.tsx @@ -0,0 +1,101 @@ +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={`${props.title}`} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue({ + files: props?.item?.archive_files, + }); + } + }} + trigger={ + + } + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractArchiveTransfers.Store({ + ...values, + contract_archives_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '新保管人', + dataIndex: 'new_keeper_id', + key: 'new_keeper_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + required: true, + }), + // Address.Cascader({ + // key: 'casacader', + // title: '选择地址', + // colProps: { span: 12 }, + // keys: ['province', 'city', 'area', 'street'], + // }), + // { + // key: 'address', + // title: '详细地址', + // dataIndex: 'address', + // colProps: { span: 12 }, + // }, + // { + // key: 'file_number', + // title: '案卷编号', + // dataIndex: 'file_number', + // colProps: { span: 12 }, + // }, + // { + // key: 'box_number', + // title: '文件盒编号', + // dataIndex: 'box_number', + // colProps: { span: 12 }, + // }, + // { + // key: 'cabinet_number', + // title: '文件柜编号', + // dataIndex: 'cabinet_number', + // colProps: { span: 12 }, + // }, + { + key: 'remark', + title: '备注', + dataIndex: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/finished/modals/Update.tsx b/src/pages/contract/contract_archives/finished/modals/Update.tsx new file mode 100644 index 0000000..c73a580 --- /dev/null +++ b/src/pages/contract/contract_archives/finished/modals/Update.tsx @@ -0,0 +1,282 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesFileStatusEnum, + ContractArchivesFileTypeEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import dayjs from 'dayjs'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`归档信息${props.title}`} + trigger={} + layout="horizontal" + labelCol={{ span: 8 }} + wrapperCol={{ span: 16 }} + labelAlign="left" + // 高度固定,高度滚动,宽度限定 + style={{ + padding: '20px', + height: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + width="900px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values: any) => + Apis.Contract.ContractArchives.Update({ + ...values, + id: props?.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'code', + title: '归档编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + fieldProps: { + disabled: true, + }, + }, + { + key: 'name', + title: '归档名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumRadio({ + key: 'period_type', + title: '保管期限', + colProps: { span: 12 }, + valueEnum: ContractArchivesPeriodTypeEnum, + required: true, + }), + { + name: ['period_type'], + valueType: 'dependency', + columns: ({ period_type }: any) => { + return period_type === 'FixedTerm' + ? [ + { + key: 'storage_years', + title: '保管年限', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + colProps: { span: 12 }, + fieldProps: { + suffix: '年', + style: { + width: '100%', + }, + }, + }, + ] + : []; + }, + }, + ], + }, + MyFormItems.EnumRadio({ + key: 'confidentiality_level', + title: '保密等级', + colProps: { span: 24 }, + formItemProps: { + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + required: true, + }, + valueEnum: ContractArchivesConfidentialityLevelEnum, + }), + // { + // key: 'file_number', + // title: '案卷编号', + // formItemProps: { ...rulesHelper.text }, + // colProps: { span: 12 }, + // }, + { + key: 'box_number', + title: '文件盒编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'cabinet_number', + title: '文件柜编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'archive_date', + title: '归档日期', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + minDate: dayjs().subtract(1, 'month'), + maxDate: dayjs(), + style: { + width: '100%', + }, + onChange: (date: any) => { + console.log(date); + form.setFieldValue('archive_year', dayjs(date).format('YYYY')); + }, + }, + colProps: { span: 12 }, + }, + // Address.Cascader({ + // key: 'casacader', + // title: '存放地区', + // colProps: { span: 12 }, + // keys: ['province', 'city', 'area', 'street'], + // }), + // { + // key: 'address', + // title: '详细地址', + // colProps: { span: 12 }, + // }, + + { + key: 'archive_year', + title: '归档年份', + fieldProps: { + disabled: true, + }, + colProps: { span: 12 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '归档文件', + }, + }, + { + valueType: 'formList', + dataIndex: 'contract_archive_files', + title: '', + formItemProps: { + ...rulesHelper.array, + labelCol: { span: 0 }, + wrapperCol: { span: 24 }, + }, + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + itemRender: ({ listDom, action }: any, { index }: any) => { + return ( + + {listDom} + + ); + }, + }, + + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '文件ID', + key: 'id', + colProps: { span: 6 }, + fieldProps: { + disabled: true, + }, + }, + { + title: '名称', + key: 'name', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'type', + title: '类型', + valueEnum: ContractArchivesFileTypeEnum, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '份数', + key: 'number', + valueType: 'digit', + colProps: { span: 6 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.number }, + }, + MyFormItems.EnumSelect({ + key: 'status', + title: '状态', + valueEnum: ContractArchivesFileStatusEnum, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '备注', + key: 'remark', + colProps: { span: 10 }, + }, + MyFormItems.UploadImages({ + key: 'info', + title: '上传扫描件', + uploadType: 'file', + colProps: { span: 12 }, + max: 100, + formItemProps: { ...rulesHelper.array }, + className: 'my_upload_file', + }), + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/index.tsx b/src/pages/contract/contract_archives/index.tsx new file mode 100644 index 0000000..4337a5b --- /dev/null +++ b/src/pages/contract/contract_archives/index.tsx @@ -0,0 +1,55 @@ +import { MyPageContainer } from '@/common'; +import { useSearchParams } from '@umijs/max'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import Finished from './finished'; +import Transfers from './transfers'; +import Unfinished from './unfinished'; + +export default function Index({ title = '合同归档' }) { + const [searchParams] = useSearchParams(); + const [activeKey, setActiveKey] = useState('Unfinished'); + + const items: TabsProps['items'] = [ + { + key: 'Unfinished', + label: '未归档合同', + children: , + }, + { + key: 'Finished', + label: '归档记录', + children: , + }, + { + key: 'Transfers', + label: '转移记录', + children: , + }, + ]; + + useEffect(() => { + if (searchParams?.get('key')) { + setActiveKey(searchParams?.get('key') || 'Unfinished'); + } + }, []); + + return ( + + { + setActiveKey(key); + }} + type="card" + /> + + ); +} diff --git a/src/pages/contract/contract_archives/transfers/index.tsx b/src/pages/contract/contract_archives/transfers/index.tsx new file mode 100644 index 0000000..3605d7b --- /dev/null +++ b/src/pages/contract/contract_archives/transfers/index.tsx @@ -0,0 +1,75 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; + +export default function Index({ title = '合同转交记录' }) { + return ( + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractArchiveTransfers.List, + ) + } + headerTitle="合同转交记录列表" + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '合同ID', + dataIndex: 'contracts_id', + hidden: true, + }, + { + title: '原保管人', + dataIndex: 'old_keeper_name', + hidden: true, + }, + { + title: '新保管人', + dataIndex: 'new_keeper_name', + hidden: true, + }, + { + title: '原保管人', + search: false, + render: (_, item: any) => { + return `${item?.old_keeper_name}:${item?.old_keeper_phone}`; + }, + }, + { + title: '新保管人', + search: false, + render: (_, item: any) => { + return `${item?.new_keeper_name}:${item?.new_keeper_phone}`; + }, + }, + { + title: '新存放位置', + search: false, + render: (_, res: any) => { + return `${res?.contract_archive?.province || ''}${ + res?.contract_archive?.city || '' + }${res?.contract_archive?.area}${ + res?.contract_archive?.street || '' + }${res?.contract_archive?.address || ''}`; + }, + }, + { + title: '文件盒编号', + dataIndex: ['contract_archive', 'box_number'], + search: false, + }, + { + title: '文件柜编号', + dataIndex: ['contract_archive', 'cabinet_number'], + search: false, + }, + MyColumns.CreatedAt(), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/unfinished/index.tsx b/src/pages/contract/contract_archives/unfinished/index.tsx new file mode 100644 index 0000000..bc0b0d6 --- /dev/null +++ b/src/pages/contract/contract_archives/unfinished/index.tsx @@ -0,0 +1,108 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractsContractNatureEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import dayjs from 'dayjs'; +import Archive from './modals/Archive'; +import Orther from './modals/Orther'; + +export default function Index() { + const navigate = useNavigate(); + + return ( + { + return MyProTableProps.request( + { + ...params, + status: ContractsStatusEnum.Signed.value, + }, + sort, + Apis.Contract.Contracts.List, + ); + }} + headerTitle="未归档合同" + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '合同类型', + dataIndex: 'contract_type_name', + search: false, + }, + { + title: '合同名称', + dataIndex: 'name', + }, + { + title: '合同编号', + dataIndex: 'code', + render: (_, item: any) => { + return ( + { + navigate(`/contract/contracts/show/${item.id}`); + }} + > + {item?.name} + + ); + }, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '合同性质', + dataIndex: 'contract_nature', + valueEnum: ContractsContractNatureEnum, + search: false, + }), + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '签订时间', + dataIndex: 'sign_time', + render: (_, item: any) => { + return item.sign_time + ? dayjs(item.sign_time).format('YYYY-MM-DD') + : '-'; + }, + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/unfinished/modals/Archive.tsx b/src/pages/contract/contract_archives/unfinished/modals/Archive.tsx new file mode 100644 index 0000000..c5a1fcb --- /dev/null +++ b/src/pages/contract/contract_archives/unfinished/modals/Archive.tsx @@ -0,0 +1,286 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesFileStatusEnum, + ContractArchivesFileTypeEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import dayjs from 'dayjs'; + +export default function Archives(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`合同${props.title}`} + layout="horizontal" + labelCol={{ span: 8 }} + wrapperCol={{ span: 16 }} + labelAlign="left" + width="800px" + style={{ + padding: '20px', + height: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + code: props?.item?.code, + name: props?.item?.name, + }); + } + }} + trigger={ + + } + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractArchives.Store({ + ...values, + contracts_id: props?.item?.id, + code: props?.item?.code, + name: props?.item?.name, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'code', + title: '归档编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + fieldProps: { + disabled: true, + }, + }, + { + key: 'name', + title: '归档名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumRadio({ + key: 'period_type', + title: '保管期限', + colProps: { span: 12 }, + valueEnum: ContractArchivesPeriodTypeEnum, + required: true, + }), + { + name: ['period_type'], + valueType: 'dependency', + columns: ({ period_type }: any) => { + return period_type === 'FixedTerm' + ? [ + { + key: 'storage_years', + title: '保管年限', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + colProps: { span: 12 }, + fieldProps: { + suffix: '年', + style: { + width: '100%', + }, + }, + }, + ] + : []; + }, + }, + ], + }, + MyFormItems.EnumRadio({ + key: 'confidentiality_level', + title: '保密等级', + colProps: { span: 24 }, + formItemProps: { + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + required: true, + }, + valueEnum: ContractArchivesConfidentialityLevelEnum, + }), + // { + // key: 'file_number', + // title: '案卷编号', + // formItemProps: { ...rulesHelper.text }, + // colProps: { span: 12 }, + // }, + { + key: 'box_number', + title: '文件盒编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'cabinet_number', + title: '文件柜编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'archive_date', + title: '归档日期', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + minDate: dayjs().subtract(1, 'month'), + maxDate: dayjs(), + style: { + width: '100%', + }, + onChange: (date: any) => { + console.log(date); + form.setFieldValue('archive_year', dayjs(date).format('YYYY')); + }, + }, + colProps: { span: 12 }, + }, + // Address.Cascader({ + // key: 'casacader', + // title: '存放地区', + // colProps: { span: 12 }, + // keys: ['province', 'city', 'area', 'street'], + // }), + // { + // key: 'address', + // title: '详细地址', + // colProps: { span: 12 }, + // }, + { + key: 'archive_year', + title: '归档年份', + fieldProps: { + disabled: true, + }, + colProps: { span: 12 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '归档文件', + }, + }, + { + valueType: 'formList', + dataIndex: 'archive_files', + title: '', + formItemProps: { + ...rulesHelper.array, + labelCol: { span: 0 }, + wrapperCol: { span: 24 }, + }, + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + itemRender: ({ listDom, action }: any, { index }: any) => { + return ( + + {listDom} + + ); + }, + }, + + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '文件名称', + key: 'name', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'type', + title: '文件类型', + valueEnum: ContractArchivesFileTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '文件份数', + key: 'number', + valueType: 'digit', + colProps: { span: 12 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.number }, + }, + MyFormItems.EnumSelect({ + key: 'status', + title: '文件状态', + valueEnum: ContractArchivesFileStatusEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '备注', + key: 'remark', + colProps: { span: 12 }, + }, + MyFormItems.UploadImages({ + key: 'info', + title: '上传扫描件', + uploadType: 'file', + colProps: { span: 12 }, + max: 100, + formItemProps: { ...rulesHelper.array }, + className: 'my_upload_file', + }), + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_archives/unfinished/modals/Orther.tsx b/src/pages/contract/contract_archives/unfinished/modals/Orther.tsx new file mode 100644 index 0000000..ca37944 --- /dev/null +++ b/src/pages/contract/contract_archives/unfinished/modals/Orther.tsx @@ -0,0 +1,269 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesFileStatusEnum, + ContractArchivesFileTypeEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import dayjs from 'dayjs'; + +export default function Archives(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}`} + layout="horizontal" + labelCol={{ span: 8 }} + wrapperCol={{ span: 16 }} + labelAlign="left" + width="800px" + style={{ + padding: '20px', + height: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractArchives.Store({ + ...values, + contracts_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'code', + title: '归档编号', + tooltip: '一经确认,不可修改', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'name', + title: '归档名称', + tooltip: '一经确认,不可修改', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumRadio({ + key: 'period_type', + title: '保管期限', + colProps: { span: 12 }, + valueEnum: ContractArchivesPeriodTypeEnum, + required: true, + }), + { + name: ['period_type'], + valueType: 'dependency', + columns: ({ period_type }: any) => { + return period_type === 'FixedTerm' + ? [ + { + key: 'storage_years', + title: '保管年限', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + colProps: { span: 12 }, + fieldProps: { + suffix: '年', + style: { + width: '100%', + }, + }, + }, + ] + : []; + }, + }, + ], + }, + MyFormItems.EnumRadio({ + key: 'confidentiality_level', + title: '保密等级', + colProps: { span: 24 }, + formItemProps: { + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + required: true, + }, + valueEnum: ContractArchivesConfidentialityLevelEnum, + }), + // { + // key: 'file_number', + // title: '案卷编号', + // formItemProps: { ...rulesHelper.text }, + // colProps: { span: 12 }, + // }, + { + key: 'box_number', + title: '文件盒编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'cabinet_number', + title: '文件柜编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'archive_date', + title: '归档日期', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + minDate: dayjs().subtract(1, 'month'), + maxDate: dayjs(), + style: { + width: '100%', + }, + onChange: (date: any) => { + console.log(date); + form.setFieldValue('archive_year', dayjs(date).format('YYYY')); + }, + }, + colProps: { span: 12 }, + }, + // Address.Cascader({ + // key: 'casacader', + // title: '存放地区', + // colProps: { span: 12 }, + // keys: ['province', 'city', 'area', 'street'], + // }), + // { + // key: 'address', + // title: '详细地址', + // colProps: { span: 12 }, + // }, + { + key: 'archive_year', + title: '归档年份', + fieldProps: { + disabled: true, + }, + colProps: { span: 12 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '归档文件', + }, + }, + { + valueType: 'formList', + dataIndex: 'archive_files', + title: '', + formItemProps: { + ...rulesHelper.array, + labelCol: { span: 0 }, + wrapperCol: { span: 24 }, + }, + colProps: { span: 24 }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + itemRender: ({ listDom, action }: any, { index }: any) => { + return ( + + {listDom} + + ); + }, + }, + + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '文件名称', + key: 'name', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'type', + title: '文件类型', + valueEnum: ContractArchivesFileTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '文件份数', + key: 'number', + valueType: 'digit', + colProps: { span: 12 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.number }, + }, + MyFormItems.EnumSelect({ + key: 'status', + title: '文件状态', + valueEnum: ContractArchivesFileStatusEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '备注', + key: 'remark', + colProps: { span: 12 }, + }, + MyFormItems.UploadImages({ + key: 'info', + title: '上传扫描件', + uploadType: 'file', + colProps: { span: 12 }, + // accept: '.docx,.doc,.pdf', + max: 100, + formItemProps: { ...rulesHelper.array }, + className: 'my_upload_file', + }), + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bill_payments/index.tsx b/src/pages/contract/contract_bill_payments/index.tsx new file mode 100644 index 0000000..e75b6df --- /dev/null +++ b/src/pages/contract/contract_bill_payments/index.tsx @@ -0,0 +1,134 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + CompanyReceiptAccountsPayChannelEnum, + ContractBillPaymentsStatusEnum, + ContractBillsCostTypeEnum, + HouseOrdersOrderStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index({ title = '登记审核' }) { + const navigate = useNavigate(); + + return ( + + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractBillPayments.List, + ) + } + params={{ + status: 'Pending', + }} + headerTitle="登记审核" + columns={[ + MyColumns.ID({ search: false }), + // { + // title: '合同ID', + // dataIndex: 'contracts_id', + // }, + { + title: '账单ID', + dataIndex: 'contract_bills_id', + hidden: true, + }, + { + title: '付款方', + dataIndex: 'payer', + }, + { + title: '收款方', + dataIndex: 'payee', + }, + { + title: '支付金额', + search: false, + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + { + title: '年月', + search: false, + render: (_, item: any) => { + return `${item?.contract_bill?.year || 0}-${ + item?.contract_bill?.month < 10 + ? `0${item?.contract_bill?.month}` + : item?.contract_bill?.month + }`; + }, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ContractBillPaymentsStatusEnum, + }), + MyColumns.EnumTag({ + title: '支付状态', + dataIndex: 'payment_status', + valueEnum: HouseOrdersOrderStatusEnum, + }), + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'cost_type', + valueEnum: ContractBillsCostTypeEnum, + }), + + MyColumns.EnumTag({ + title: '支付方式', + dataIndex: 'payment_method', + valueEnum: CompanyReceiptAccountsPayChannelEnum, + }), + // { + // title: '支付单号', + // dataIndex: 'payment_no', + // }, + { + title: '交易账号', + dataIndex: 'accept_account_number', + }, + { + title: '交易流水号', + dataIndex: 'accept_serial_number', + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index) => ( + + { + navigate( + `/contract/contract_bill_payments/pages/review?id=${item.id}`, + ); + }} + title="查看并审核" + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/contract/contract_bill_payments/modals/Create.tsx b/src/pages/contract/contract_bill_payments/modals/Create.tsx new file mode 100644 index 0000000..f4316cb --- /dev/null +++ b/src/pages/contract/contract_bill_payments/modals/Create.tsx @@ -0,0 +1,55 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} 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" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Contract.ContractTypes.Store({ + ...values, + is_enabled: values.is_enabled ? 1 : 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bill_payments/modals/Review.tsx b/src/pages/contract/contract_bill_payments/modals/Review.tsx new file mode 100644 index 0000000..40d64c0 --- /dev/null +++ b/src/pages/contract/contract_bill_payments/modals/Review.tsx @@ -0,0 +1,86 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message } from 'antd'; + +const DormigoryBedAuditFlowsAuditStatusEnum = { + Approved: { text: '通过', value: 'Approved' }, + Rejected: { text: '驳回', value: 'Rejected' }, +}; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + return ( + + {...MyModalFormProps.props} + title="审核" + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Contract.ContractBillPayments.Audit({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('审核成功'); + navigate(-1); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'status', + title: '审核意见', + valueEnum: DormigoryBedAuditFlowsAuditStatusEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['status'], + columns: ({ status }) => { + return status === 'Rejected' + ? [ + { + title: '驳回理由', + valueType: 'textarea', + key: 'rejected_reason', + formItemProps: { ...rulesHelper.text }, + }, + ] + : [ + { + title: '审核意见', + valueType: 'textarea', + key: 'rejected_reason', + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bill_payments/modals/Update.tsx b/src/pages/contract/contract_bill_payments/modals/Update.tsx new file mode 100644 index 0000000..2b065bb --- /dev/null +++ b/src/pages/contract/contract_bill_payments/modals/Update.tsx @@ -0,0 +1,56 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Contract.ContractTypes.Update({ + ...values, + is_enabled: values.is_enabled ? 1 : 0, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bill_payments/pages/review.tsx b/src/pages/contract/contract_bill_payments/pages/review.tsx new file mode 100644 index 0000000..51c9006 --- /dev/null +++ b/src/pages/contract/contract_bill_payments/pages/review.tsx @@ -0,0 +1,207 @@ +import { MyModalFormProps, MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsCostTypeEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, + HouseOrdersPaymentMethodEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, Image, Space } from 'antd'; +import { useEffect, useState } from 'react'; +import Review from '../modals/Review'; + +export default function Index({ title = '交易登记审核' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + + const loadShow = () => { + Apis.Contract.ContractBillPayments.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + }); + }; + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(data?.contract?.total_amount) - + parseFloat(data?.contract?.total_bill_amount) + ).toFixed(2), + ); + }; + useEffect(() => { + loadShow(); + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + submitter={{ + render: () => { + return data?.id ? [] : []; + }, + }} + columns={[ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+ 收支类型: + { + ContractTemplatesIncomeExpenseTypeEnum[ + data?.contract + ?.income_expense_type as keyof typeof ContractTemplatesIncomeExpenseTypeEnum + ]?.text + } +
+
+ 结算模式: + { + ContractsSettlementModeEnum[ + data?.contract + ?.settlement_mode as keyof typeof ContractsSettlementModeEnum + ]?.text + } +
+
合同总金额: ¥{data?.contract?.total_amount}
+
+ 已生成账单: ¥{data?.contract?.total_bill_amount} +
+ {data?.contract?.settlement_mode === + 'LumpSumContract' && ( +
+ 可拆分金额: ¥{totalBillSeparableAmount()} +
+ )} +
+
+ ); + }, + }, + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+ 月份:{data?.contract_bill?.year}年 + {data?.contract_bill?.month}月 +
+
账单金额:¥{data?.contract_bill?.amount}
+
期数:{data?.contract_bill?.period_num}期
+
+ 费用类型: + { + ContractBillsCostTypeEnum[ + data?.contract_bill + ?.cost_type as keyof typeof ContractBillsCostTypeEnum + ]?.text + } +
+
备注:{data?.contract_bill?.remark}
+
+
+ ); + }, + }, + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+ 支付方式: + { + HouseOrdersPaymentMethodEnum[ + data?.payment_method as keyof typeof HouseOrdersPaymentMethodEnum + ]?.text + } +
+
+ 支付金额:¥{data?.amount} +
+ {/*
支付单号:{data?.payment_no}
*/} +
交易流水号:{data?.accept_serial_number}
+
支付时间:{data?.paid_time}
+
收款账号名称:{data?.accept_account_name}
+
收款银行:{data?.accept_bank_name}
+
收款账号:{data?.accept_account_number}
+
备注:{data?.remark}
+
支付凭证:
+
+ + {data?.pay_certificate?.map( + (item: any, index: number) => ( + + ), + )} + +
+
+
+ ); + }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contract_bills/Expense/index.tsx b/src/pages/contract/contract_bills/Expense/index.tsx new file mode 100644 index 0000000..bbe7ae4 --- /dev/null +++ b/src/pages/contract/contract_bills/Expense/index.tsx @@ -0,0 +1,183 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { MyExport } from '@/components/MyExport'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillObjectsAuditStatusEnum, + ContractBillsAuditStatusEnum, + ContractBillsCostTypeEnum, + HouseOrdersOrderStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import { useState } from 'react'; +import PayBills from '../modals/PayBills'; +import CompleteApply from './modals/CompleteApply'; + +export default function Index() { + const navigate = useNavigate(); + const [getParams, setParams] = useState({}); + const getCurrentPermissions = useCurrentPermissions(); + + return ( + { + setParams(params); + return MyProTableProps.request( + { + ...params, + is_valid: 1, + cost_type: ContractBillsCostTypeEnum.Expense.value, + }, + sort, + Apis.Contract.ContractBills.List, + ); + }} + toolBarRender={(action: any) => [ + // { + // navigate('/contract/contract_bills/pages/create'); + // }} + // title="新增合同账单" + // />, + , + ]} + headerTitle="合同应付账单" + columns={[ + MyColumns.ID({ search: false }), + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'cost_type', + valueEnum: ContractBillsCostTypeEnum, + }), + { + title: '合同名称', + dataIndex: ['contract', 'name'], + search: false, + }, + { + title: '合同编号', + dataIndex: 'contracts_id', + render: (_, item: any) => { + return ( + { + navigate(`/contract/contracts/show/${item.contract?.id}`); + }} + > + {item?.contract?.code || ''} + + ); + }, + }, + { + title: '年月', + search: false, + render: (_, item: any) => { + return `${item?.year || 0}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`; + }, + }, + { + title: '期数', + dataIndex: 'period_num', + search: false, + }, + + { + title: '账单金额', + search: false, + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + MyColumns.EnumTag({ + title: '交易状态', + dataIndex: 'payment_status', + valueEnum: HouseOrdersOrderStatusEnum, + }), + MyColumns.EnumTag({ + title: '付款审核', + dataIndex: 'audit_status', + valueEnum: ContractBillsAuditStatusEnum, + }), + { + title: '交易方', + render: (_, item: any) => { + const payeeText = item?.payee?.includes(':') + ? item?.payee?.split(':')?.[1] + : item?.payee || ''; + const payerText = item?.payer?.includes(':') + ? item?.payer?.split(':')?.[1] + : item?.payer || ''; + return ( + +
{payeeText}
|| +
{payerText}
+
+ ); + }, + }, + + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + { + navigate( + `/contract/contract_bills/pages/update?id=${item.id}`, + ); + }} + title="编辑" + /> + + Apis.Contract.ContractBills.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + {/* {tableRender(item, action)} */} + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/Expense/modals/CompleteApply.tsx b/src/pages/contract/contract_bills/Expense/modals/CompleteApply.tsx new file mode 100644 index 0000000..c847f04 --- /dev/null +++ b/src/pages/contract/contract_bills/Expense/modals/CompleteApply.tsx @@ -0,0 +1,473 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, + ContractBillsIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function CompleteApply(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + // 监听费用增减和变更金额的变化,自动计算变更后金额 + const costType = Form.useWatch('cost_type', form); + const costAmount = Form.useWatch('cost_amount', form); + const originalAmount = Form.useWatch('original_amount', form); + + // 当费用增减、变更金额或原始金额变化时,自动计算变更后金额 + useEffect(() => { + if (originalAmount) { + let finalAmount = parseFloat(originalAmount); + if (costType === 'Increase' && costAmount) { + finalAmount += parseFloat(costAmount); + } else if (costType === 'Decrease' && costAmount) { + finalAmount -= parseFloat(costAmount); + } + // 确保金额为正数 + if (finalAmount < 0) { + finalAmount = 0; + } + form.setFieldsValue({ final_amount: finalAmount.toFixed(2) }); + } + }, [costType, costAmount, originalAmount, form]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + // 清空所有字段 + form.resetFields(); // 清空表单数据 + // 从合同详情API获取账单金额和标的要求 + Apis.Contract.ContractBills.Show({ + id: props.item?.id || 0, + }) + .then((res) => { + let contractData = res?.data || {}; + let originalAmount = + props.item?.amount || + contractData?.amount || + contractData?.total_amount || + '0'; + + form.setFieldsValue({ + original_amount: originalAmount, + final_amount: originalAmount, + contract_bill_objects: + contractData?.contract_bill_objects?.[0]?.name || '', + contract_bill_objects_id: + contractData?.contract_bill_objects?.[0]?.id || 0, + }); + }) + .catch((error) => { + console.error('获取合同详情失败:', error); + // 失败时使用默认值 + const originalAmount = props.item?.amount || '0'; + form.setFieldsValue({ + ...props.item, + original_amount: originalAmount, + final_amount: originalAmount, + }); + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractBillObjects.CompleteApply({ + ...values, + id: values?.contract_bill_objects_id || 0, + completed_description: values?.completed_description || '', + cost_amount: values?.cost_amount || 0, + }) + .then(() => { + message.success('提交申请成功!'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '标的ID', + key: 'contract_bill_objects_id', + colProps: { span: 4 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '标的要求', + valueType: 'text', + key: 'contract_bill_objects', + colProps: { span: 14 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '账单金额', + valueType: 'text', + key: 'original_amount', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + title: '标的完成说明', + valueType: 'textarea', + key: 'completed_description', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '账单变更', + colProps: { span: 12 }, + valueEnum: ContractBillsIncomeExpenseTypeEnum, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (e: any) => { + if (e) { + form.setFieldsValue({ + cost_amount: '', + }); + } + }, + }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type !== + ContractBillsIncomeExpenseTypeEnum.Neutral.value + ? [ + { + title: '变更金额', + valueType: 'digit', + key: 'cost_amount', + fieldProps: { + style: { width: '100%' }, + }, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + title: '变更后账单', + valueType: 'digit', + key: 'final_amount', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + disabled: true, + }, + }, + { + title: '完成日期', + valueType: 'date', + key: 'completed_time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + //变更后账单金额 = 变更前账单金额 +/- 变更金额 + + MyFormItems.UploadImages({ + key: 'completed_attachments', + title: '附件', + tooltip: '上限9张', + uploadType: 'file', + max: 9, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractPayment.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/Expense/modals/CreateBill.tsx b/src/pages/contract/contract_bills/Expense/modals/CreateBill.tsx new file mode 100644 index 0000000..a1e41e9 --- /dev/null +++ b/src/pages/contract/contract_bills/Expense/modals/CreateBill.tsx @@ -0,0 +1,472 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, + ContractBillsIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function CompleteApply(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + // 监听费用增减和变更金额的变化,自动计算变更后金额 + const costType = Form.useWatch('cost_type', form); + const costAmount = Form.useWatch('cost_amount', form); + const originalAmount = Form.useWatch('original_amount', form); + + // 当费用增减、变更金额或原始金额变化时,自动计算变更后金额 + useEffect(() => { + if (originalAmount) { + let finalAmount = parseFloat(originalAmount); + if (costType === 'Increase' && costAmount) { + finalAmount += parseFloat(costAmount); + } else if (costType === 'Decrease' && costAmount) { + finalAmount -= parseFloat(costAmount); + } + // 确保金额为正数 + if (finalAmount < 0) { + finalAmount = 0; + } + form.setFieldsValue({ final_amount: finalAmount.toFixed(2) }); + } + }, [costType, costAmount, originalAmount, form]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + // 清空所有字段 + form.resetFields(); // 清空表单数据 + // 从合同详情API获取账单金额和标的要求 + Apis.Contract.ContractBills.Show({ + id: props.item?.id || 0, + }) + .then((res) => { + let contractData = res?.data || {}; + let originalAmount = + props.item?.amount || + contractData?.amount || + contractData?.total_amount || + '0'; + + form.setFieldsValue({ + original_amount: originalAmount, + final_amount: originalAmount, + contract_bill_objects: + contractData?.contract_bill_objects?.[0]?.name || '', + contract_bill_objects_id: + contractData?.contract_bill_objects?.[0]?.id || 0, + }); + }) + .catch((error) => { + console.error('获取合同详情失败:', error); + // 失败时使用默认值 + const originalAmount = props.item?.amount || '0'; + form.setFieldsValue({ + ...props.item, + original_amount: originalAmount, + final_amount: originalAmount, + }); + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractBillObjects.CompleteApply({ + ...values, + id: values?.contract_bill_objects_id || 0, + completed_description: values?.completed_description || '', + cost_amount: values?.cost_amount || 0, + }) + .then(() => { + message.success('完成申请成功'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '标的ID', + key: 'contract_bill_objects_id', + colProps: { span: 4 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '标的要求', + valueType: 'text', + key: 'contract_bill_objects', + colProps: { span: 14 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '账单金额', + valueType: 'text', + key: 'original_amount', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + title: '标的完成说明', + valueType: 'textarea', + key: 'completed_description', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '账单变更', + colProps: { span: 12 }, + valueEnum: ContractBillsIncomeExpenseTypeEnum, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (e: any) => { + if (e) { + form.setFieldsValue({ + cost_amount: '', + }); + } + }, + }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type !== + ContractBillsIncomeExpenseTypeEnum.Neutral.value + ? [ + { + title: '变更金额', + valueType: 'digit', + key: 'cost_amount', + fieldProps: { + style: { width: '100%' }, + }, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + title: '变更后账单', + valueType: 'digit', + key: 'final_amount', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + disabled: true, + }, + }, + { + title: '完成日期', + valueType: 'date', + key: 'completed_time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + //变更后账单金额 = 变更前账单金额 +/- 变更金额 + + MyFormItems.UploadImages({ + key: 'completed_attachments', + title: '附件', + tooltip: '上限9张', + uploadType: 'file', + max: 9, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractPayment.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/Income/index.tsx b/src/pages/contract/contract_bills/Income/index.tsx new file mode 100644 index 0000000..b97903b --- /dev/null +++ b/src/pages/contract/contract_bills/Income/index.tsx @@ -0,0 +1,170 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { MyExport } from '@/components/MyExport'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillObjectsAuditStatusEnum, + ContractBillsAuditStatusEnum, + ContractBillsCostTypeEnum, + HouseOrdersOrderStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import { useState } from 'react'; +import PayBills from '../modals/PayBills'; + +export default function Index() { + const navigate = useNavigate(); + const [getParams, setParams] = useState({}); + + return ( + { + setParams(params); + return MyProTableProps.request( + { + ...params, + is_valid: 1, + cost_type: ContractBillsCostTypeEnum.Income.value, + }, + sort, + Apis.Contract.ContractBills.List, + ); + }} + toolBarRender={(action: any) => [ + // { + // navigate('/contract/contract_bills/pages/create'); + // }} + // title="新增合同账单" + // />, + , + ]} + headerTitle="合同应收账单" + columns={[ + MyColumns.ID({ search: false }), + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'cost_type', + valueEnum: ContractBillsCostTypeEnum, + }), + { + title: '合同名称', + dataIndex: ['contract', 'name'], + search: false, + }, + { + title: '合同编号', + dataIndex: 'contracts_id', + render: (_, item: any) => { + return ( + { + navigate(`/contract/contracts/show/${item.contract?.id}`); + }} + > + {item?.contract?.code || ''} + + ); + }, + }, + { + title: '年月', + search: false, + render: (_, item: any) => { + return `${item?.year || 0}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`; + }, + }, + { + title: '期数', + dataIndex: 'period_num', + search: false, + }, + + { + title: '账单金额', + search: false, + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + MyColumns.EnumTag({ + title: '交易状态', + dataIndex: 'payment_status', + valueEnum: HouseOrdersOrderStatusEnum, + }), + MyColumns.EnumTag({ + title: '付款审核', + dataIndex: 'audit_status', + valueEnum: ContractBillsAuditStatusEnum, + }), + { + title: '交易方', + render: (_, item: any) => { + const payeeText = item?.payee?.includes(':') + ? item?.payee?.split(':')?.[1] + : item?.payee || ''; + const payerText = item?.payer?.includes(':') + ? item?.payer?.split(':')?.[1] + : item?.payer || ''; + return ( + +
{payeeText}
|| +
{payerText}
+
+ ); + }, + }, + + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + { + navigate( + `/contract/contract_bills/pages/update?id=${item.id}`, + ); + }} + title="编辑" + /> + + Apis.Contract.ContractBills.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/Income/modals/CompleteApply.tsx b/src/pages/contract/contract_bills/Income/modals/CompleteApply.tsx new file mode 100644 index 0000000..c847f04 --- /dev/null +++ b/src/pages/contract/contract_bills/Income/modals/CompleteApply.tsx @@ -0,0 +1,473 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, + ContractBillsIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function CompleteApply(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + // 监听费用增减和变更金额的变化,自动计算变更后金额 + const costType = Form.useWatch('cost_type', form); + const costAmount = Form.useWatch('cost_amount', form); + const originalAmount = Form.useWatch('original_amount', form); + + // 当费用增减、变更金额或原始金额变化时,自动计算变更后金额 + useEffect(() => { + if (originalAmount) { + let finalAmount = parseFloat(originalAmount); + if (costType === 'Increase' && costAmount) { + finalAmount += parseFloat(costAmount); + } else if (costType === 'Decrease' && costAmount) { + finalAmount -= parseFloat(costAmount); + } + // 确保金额为正数 + if (finalAmount < 0) { + finalAmount = 0; + } + form.setFieldsValue({ final_amount: finalAmount.toFixed(2) }); + } + }, [costType, costAmount, originalAmount, form]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + // 清空所有字段 + form.resetFields(); // 清空表单数据 + // 从合同详情API获取账单金额和标的要求 + Apis.Contract.ContractBills.Show({ + id: props.item?.id || 0, + }) + .then((res) => { + let contractData = res?.data || {}; + let originalAmount = + props.item?.amount || + contractData?.amount || + contractData?.total_amount || + '0'; + + form.setFieldsValue({ + original_amount: originalAmount, + final_amount: originalAmount, + contract_bill_objects: + contractData?.contract_bill_objects?.[0]?.name || '', + contract_bill_objects_id: + contractData?.contract_bill_objects?.[0]?.id || 0, + }); + }) + .catch((error) => { + console.error('获取合同详情失败:', error); + // 失败时使用默认值 + const originalAmount = props.item?.amount || '0'; + form.setFieldsValue({ + ...props.item, + original_amount: originalAmount, + final_amount: originalAmount, + }); + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractBillObjects.CompleteApply({ + ...values, + id: values?.contract_bill_objects_id || 0, + completed_description: values?.completed_description || '', + cost_amount: values?.cost_amount || 0, + }) + .then(() => { + message.success('提交申请成功!'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '标的ID', + key: 'contract_bill_objects_id', + colProps: { span: 4 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '标的要求', + valueType: 'text', + key: 'contract_bill_objects', + colProps: { span: 14 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '账单金额', + valueType: 'text', + key: 'original_amount', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + title: '标的完成说明', + valueType: 'textarea', + key: 'completed_description', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '账单变更', + colProps: { span: 12 }, + valueEnum: ContractBillsIncomeExpenseTypeEnum, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (e: any) => { + if (e) { + form.setFieldsValue({ + cost_amount: '', + }); + } + }, + }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type !== + ContractBillsIncomeExpenseTypeEnum.Neutral.value + ? [ + { + title: '变更金额', + valueType: 'digit', + key: 'cost_amount', + fieldProps: { + style: { width: '100%' }, + }, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + title: '变更后账单', + valueType: 'digit', + key: 'final_amount', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + disabled: true, + }, + }, + { + title: '完成日期', + valueType: 'date', + key: 'completed_time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + //变更后账单金额 = 变更前账单金额 +/- 变更金额 + + MyFormItems.UploadImages({ + key: 'completed_attachments', + title: '附件', + tooltip: '上限9张', + uploadType: 'file', + max: 9, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractPayment.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/Income/modals/CreateBill.tsx b/src/pages/contract/contract_bills/Income/modals/CreateBill.tsx new file mode 100644 index 0000000..b347f85 --- /dev/null +++ b/src/pages/contract/contract_bills/Income/modals/CreateBill.tsx @@ -0,0 +1,472 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, + ContractBillsIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function CompleteApply(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + // 监听费用增减和变更金额的变化,自动计算变更后金额 + const costType = Form.useWatch('cost_type', form); + const costAmount = Form.useWatch('cost_amount', form); + const originalAmount = Form.useWatch('original_amount', form); + + // 当费用增减、变更金额或原始金额变化时,自动计算变更后金额 + useEffect(() => { + if (originalAmount) { + let finalAmount = parseFloat(originalAmount); + if (costType === 'Increase' && costAmount) { + finalAmount += parseFloat(costAmount); + } else if (costType === 'Decrease' && costAmount) { + finalAmount -= parseFloat(costAmount); + } + // 确保金额为正数 + if (finalAmount < 0) { + finalAmount = 0; + } + form.setFieldsValue({ final_amount: finalAmount.toFixed(2) }); + } + }, [costType, costAmount, originalAmount, form]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + // 清空所有字段 + form.resetFields(); // 清空表单数据 + // 从合同详情API获取账单金额和标的要求 + Apis.Contract.ContractBills.Show({ + id: props.item?.id || 0, + }) + .then((res) => { + let contractData = res?.data || {}; + let originalAmount = + props.item?.amount || + contractData?.amount || + contractData?.total_amount || + '0'; + + form.setFieldsValue({ + original_amount: originalAmount, + final_amount: originalAmount, + contract_bill_objects: + contractData?.contract_bill_objects?.[0]?.name || '', + contract_bill_objects_id: + contractData?.contract_bill_objects?.[0]?.id || 0, + }); + }) + .catch((error) => { + console.error('获取合同详情失败:', error); + // 失败时使用默认值 + const originalAmount = props.item?.amount || '0'; + form.setFieldsValue({ + ...props.item, + original_amount: originalAmount, + final_amount: originalAmount, + }); + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractBillObjects.CompleteApply({ + ...values, + id: values?.contract_bill_objects_id || 0, + completed_description: values?.completed_description || '', + cost_amount: values?.cost_amount || 0, + }) + .then(() => { + message.success('完成申请成功'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '标的ID', + key: 'contract_bill_objects_id', + colProps: { span: 4 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '标的要求', + valueType: 'text', + key: 'contract_bill_objects', + colProps: { span: 14 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '账单金额', + valueType: 'text', + key: 'original_amount', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + title: '标的完成说明', + valueType: 'textarea', + key: 'completed_description', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '账单变更', + colProps: { span: 12 }, + valueEnum: ContractBillsIncomeExpenseTypeEnum, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (e: any) => { + if (e) { + form.setFieldsValue({ + cost_amount: '', + }); + } + }, + }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type !== + ContractBillsIncomeExpenseTypeEnum.Neutral.value + ? [ + { + title: '变更金额', + valueType: 'digit', + key: 'cost_amount', + fieldProps: { + style: { width: '100%' }, + }, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + title: '变更后账单', + valueType: 'digit', + key: 'final_amount', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + disabled: true, + }, + }, + { + title: '完成日期', + valueType: 'date', + key: 'completed_time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + //变更后账单金额 = 变更前账单金额 +/- 变更金额 + + MyFormItems.UploadImages({ + key: 'completed_attachments', + title: '附件', + tooltip: '上限9张', + uploadType: 'file', + max: 9, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractPayment.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/index.tsx b/src/pages/contract/contract_bills/index.tsx new file mode 100644 index 0000000..e53eac9 --- /dev/null +++ b/src/pages/contract/contract_bills/index.tsx @@ -0,0 +1,56 @@ +import { MyPageContainer } from '@/common'; +import { useSearchParams } from '@umijs/max'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import Expense from './Expense'; +import Income from './Income'; + +export default function Index({ title = '合同账单' }) { + const [searchParams] = useSearchParams(); + const [activeKey, setActiveKey] = useState('1'); + + const items: TabsProps['items'] = [ + { + key: 'Expense', + label: '合同支出', + children: , + }, + { + key: 'Income', + label: '合同收入', + children: , + }, + ]; + + useEffect(() => { + if (searchParams?.get('key')) { + setActiveKey(searchParams?.get('key') || '1'); + } + }, []); + + return ( + + navigate('/contract/contracts_bi')} + // > + // 返回合同BI + // + // ), + // }} + /> + + ); +} diff --git a/src/pages/contract/contract_bills/modals/CompleteApply.tsx b/src/pages/contract/contract_bills/modals/CompleteApply.tsx new file mode 100644 index 0000000..c847f04 --- /dev/null +++ b/src/pages/contract/contract_bills/modals/CompleteApply.tsx @@ -0,0 +1,473 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, + ContractBillsIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function CompleteApply(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + // 监听费用增减和变更金额的变化,自动计算变更后金额 + const costType = Form.useWatch('cost_type', form); + const costAmount = Form.useWatch('cost_amount', form); + const originalAmount = Form.useWatch('original_amount', form); + + // 当费用增减、变更金额或原始金额变化时,自动计算变更后金额 + useEffect(() => { + if (originalAmount) { + let finalAmount = parseFloat(originalAmount); + if (costType === 'Increase' && costAmount) { + finalAmount += parseFloat(costAmount); + } else if (costType === 'Decrease' && costAmount) { + finalAmount -= parseFloat(costAmount); + } + // 确保金额为正数 + if (finalAmount < 0) { + finalAmount = 0; + } + form.setFieldsValue({ final_amount: finalAmount.toFixed(2) }); + } + }, [costType, costAmount, originalAmount, form]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + // 清空所有字段 + form.resetFields(); // 清空表单数据 + // 从合同详情API获取账单金额和标的要求 + Apis.Contract.ContractBills.Show({ + id: props.item?.id || 0, + }) + .then((res) => { + let contractData = res?.data || {}; + let originalAmount = + props.item?.amount || + contractData?.amount || + contractData?.total_amount || + '0'; + + form.setFieldsValue({ + original_amount: originalAmount, + final_amount: originalAmount, + contract_bill_objects: + contractData?.contract_bill_objects?.[0]?.name || '', + contract_bill_objects_id: + contractData?.contract_bill_objects?.[0]?.id || 0, + }); + }) + .catch((error) => { + console.error('获取合同详情失败:', error); + // 失败时使用默认值 + const originalAmount = props.item?.amount || '0'; + form.setFieldsValue({ + ...props.item, + original_amount: originalAmount, + final_amount: originalAmount, + }); + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractBillObjects.CompleteApply({ + ...values, + id: values?.contract_bill_objects_id || 0, + completed_description: values?.completed_description || '', + cost_amount: values?.cost_amount || 0, + }) + .then(() => { + message.success('提交申请成功!'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '标的ID', + key: 'contract_bill_objects_id', + colProps: { span: 4 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '标的要求', + valueType: 'text', + key: 'contract_bill_objects', + colProps: { span: 14 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '账单金额', + valueType: 'text', + key: 'original_amount', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + title: '标的完成说明', + valueType: 'textarea', + key: 'completed_description', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '账单变更', + colProps: { span: 12 }, + valueEnum: ContractBillsIncomeExpenseTypeEnum, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (e: any) => { + if (e) { + form.setFieldsValue({ + cost_amount: '', + }); + } + }, + }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type !== + ContractBillsIncomeExpenseTypeEnum.Neutral.value + ? [ + { + title: '变更金额', + valueType: 'digit', + key: 'cost_amount', + fieldProps: { + style: { width: '100%' }, + }, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + title: '变更后账单', + valueType: 'digit', + key: 'final_amount', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + disabled: true, + }, + }, + { + title: '完成日期', + valueType: 'date', + key: 'completed_time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + //变更后账单金额 = 变更前账单金额 +/- 变更金额 + + MyFormItems.UploadImages({ + key: 'completed_attachments', + title: '附件', + tooltip: '上限9张', + uploadType: 'file', + max: 9, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractPayment.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/modals/CreateBill.tsx b/src/pages/contract/contract_bills/modals/CreateBill.tsx new file mode 100644 index 0000000..a1e41e9 --- /dev/null +++ b/src/pages/contract/contract_bills/modals/CreateBill.tsx @@ -0,0 +1,472 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ApprovalTemplateNodesNodeTypeEnum, + ApprovalTemplatesTypeEnum, + ContractBillsIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function CompleteApply(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + // 监听费用增减和变更金额的变化,自动计算变更后金额 + const costType = Form.useWatch('cost_type', form); + const costAmount = Form.useWatch('cost_amount', form); + const originalAmount = Form.useWatch('original_amount', form); + + // 当费用增减、变更金额或原始金额变化时,自动计算变更后金额 + useEffect(() => { + if (originalAmount) { + let finalAmount = parseFloat(originalAmount); + if (costType === 'Increase' && costAmount) { + finalAmount += parseFloat(costAmount); + } else if (costType === 'Decrease' && costAmount) { + finalAmount -= parseFloat(costAmount); + } + // 确保金额为正数 + if (finalAmount < 0) { + finalAmount = 0; + } + form.setFieldsValue({ final_amount: finalAmount.toFixed(2) }); + } + }, [costType, costAmount, originalAmount, form]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + // 清空所有字段 + form.resetFields(); // 清空表单数据 + // 从合同详情API获取账单金额和标的要求 + Apis.Contract.ContractBills.Show({ + id: props.item?.id || 0, + }) + .then((res) => { + let contractData = res?.data || {}; + let originalAmount = + props.item?.amount || + contractData?.amount || + contractData?.total_amount || + '0'; + + form.setFieldsValue({ + original_amount: originalAmount, + final_amount: originalAmount, + contract_bill_objects: + contractData?.contract_bill_objects?.[0]?.name || '', + contract_bill_objects_id: + contractData?.contract_bill_objects?.[0]?.id || 0, + }); + }) + .catch((error) => { + console.error('获取合同详情失败:', error); + // 失败时使用默认值 + const originalAmount = props.item?.amount || '0'; + form.setFieldsValue({ + ...props.item, + original_amount: originalAmount, + final_amount: originalAmount, + }); + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractBillObjects.CompleteApply({ + ...values, + id: values?.contract_bill_objects_id || 0, + completed_description: values?.completed_description || '', + cost_amount: values?.cost_amount || 0, + }) + .then(() => { + message.success('完成申请成功'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '标的ID', + key: 'contract_bill_objects_id', + colProps: { span: 4 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '标的要求', + valueType: 'text', + key: 'contract_bill_objects', + colProps: { span: 14 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + title: '账单金额', + valueType: 'text', + key: 'original_amount', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + title: '标的完成说明', + valueType: 'textarea', + key: 'completed_description', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '账单变更', + colProps: { span: 12 }, + valueEnum: ContractBillsIncomeExpenseTypeEnum, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (e: any) => { + if (e) { + form.setFieldsValue({ + cost_amount: '', + }); + } + }, + }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type !== + ContractBillsIncomeExpenseTypeEnum.Neutral.value + ? [ + { + title: '变更金额', + valueType: 'digit', + key: 'cost_amount', + fieldProps: { + style: { width: '100%' }, + }, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + title: '变更后账单', + valueType: 'digit', + key: 'final_amount', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + disabled: true, + }, + }, + { + title: '完成日期', + valueType: 'date', + key: 'completed_time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + //变更后账单金额 = 变更前账单金额 +/- 变更金额 + + MyFormItems.UploadImages({ + key: 'completed_attachments', + title: '附件', + tooltip: '上限9张', + uploadType: 'file', + max: 9, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.array }, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractPayment.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/modals/PayBills.tsx b/src/pages/contract/contract_bills/modals/PayBills.tsx new file mode 100644 index 0000000..d500954 --- /dev/null +++ b/src/pages/contract/contract_bills/modals/PayBills.tsx @@ -0,0 +1,236 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsCostTypeEnum, + HouseOrdersPaymentMethodEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function PayBills(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={props.title} + trigger={ + + } + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + key={new Date().getTime()} + width="650px" + form={form} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue({ + ...props.item, + remark: '', + paid_time: undefined, + cost_type: props.item?.cost_type, + pay_certificate: [], + accept_account_number: '', + accept_account_name: + props.item?.cost_type === ContractBillsCostTypeEnum.Income.value + ? props.item?.payee + : props.item?.payer, + + accept_serial_number: '', + }); + } + }} + onFinish={async (values) => + Apis.Contract.ContractBillPayments.Store({ + ...values, + contract_bills_id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('提交成功,等待审核!'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'cost_type', + title: '费用类型', + valueEnum: ContractBillsCostTypeEnum, + fieldProps: { + disabled: true, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + name: ['cost_type'], + valueType: 'dependency', + columns: ({ cost_type }) => { + return cost_type === ContractBillsCostTypeEnum.Income.value + ? [ + { + title: '收款金额', + key: 'amount', + colProps: { span: 24 }, + fieldProps: { + suffix: '元', + disabled: true, + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.number }, + }, + MyFormItems.EnumRadio({ + key: 'payment_method', + title: '收款方式', + colProps: { span: 24 }, + valueEnum: () => { + const obj: Record = JSON.parse( + JSON.stringify(HouseOrdersPaymentMethodEnum), + ); + delete obj.WeChat; + delete obj.Alipay; + delete obj.TongLian; + delete obj.Prepayment; + return obj; + }, + required: true, + }), + { + title: '收款日期', + key: 'paid_time', + colProps: { span: 24 }, + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '收款账户', + key: 'accept_account_name', + colProps: { span: 24 }, + }, + { + title: '收款银行', + key: 'accept_bank_name', + colProps: { span: 24 }, + }, + { + title: '收款账号', + key: 'accept_account_number', + colProps: { span: 24 }, + }, + { + title: '收款流水号', + key: 'accept_serial_number', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'pay_certificate', + title: '支付凭证', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + }), + ] + : [ + { + title: '支付金额', + key: 'amount', + colProps: { span: 24 }, + fieldProps: { + suffix: '元', + disabled: true, + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.number }, + }, + MyFormItems.EnumRadio({ + key: 'payment_method', + title: '支付方式', + colProps: { span: 24 }, + valueEnum: () => { + const obj: Record = JSON.parse( + JSON.stringify(HouseOrdersPaymentMethodEnum), + ); + delete obj.WeChat; + delete obj.Alipay; + delete obj.TongLian; + delete obj.Prepayment; + delete obj.POS; + delete obj.Cash; + return obj; + }, + required: true, + }), + { + title: '支付日期', + key: 'paid_time', + colProps: { span: 24 }, + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '付款账户', + key: 'accept_account_name', + colProps: { span: 24 }, + }, + { + title: '付款银行', + key: 'accept_bank_name', + colProps: { span: 24 }, + }, + { + title: '付款账号', + key: 'accept_account_number', + colProps: { span: 24 }, + }, + { + title: '支付流水号', + key: 'accept_serial_number', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'pay_certificate', + title: '支付凭证', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + }), + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_bills/pages/create.tsx b/src/pages/contract/contract_bills/pages/create.tsx new file mode 100644 index 0000000..f1e44e6 --- /dev/null +++ b/src/pages/contract/contract_bills/pages/create.tsx @@ -0,0 +1,400 @@ +import { + MyButtons, + MyModalFormProps, + MyPageContainer, + renderTextHelper, + rulesHelper, +} from '@/common'; +import MyContractsSelectList from '@/components/ModalsContractsSelectList'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsCostTypeEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { + BetaSchemaForm, + ProCard, + ProDescriptions, +} from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Empty, Form, message, Space, Tag } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function Create() { + const [form] = Form.useForm(); + const [searchParams] = useSearchParams(); + const navigate = useNavigate(); + const [data, setShow] = useState({}); + const id = searchParams.get('id') ?? 0; + const getContractsShow = (id: number) => { + Apis.Contract.Contracts.Show({ id: id }).then((res) => { + setShow(res?.data); + }); + }; + + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(data?.total_amount) - parseFloat(data?.total_bill_amount) + ).toFixed(2), + ); + }; + + useEffect(() => { + if (id) { + getContractsShow(Number(id)); + form.setFieldsValue({ + contracts_id: id, + }); + } + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + 新增合同账单 + + } + enableTabs={false} + tabKey="charge-standards-create" + > + +
+ + {...MyModalFormProps.props} + wrapperCol={{ span: 24 }} + width="1200px" + layoutType="Form" + form={form} + onFinish={async (values: any) => { + let year_month_is = false; + let total_bill_amount = totalBillSeparableAmount(); + let taotal_amount = parseFloat(values?.amount) || 0; + if ( + total_bill_amount <= 0 && + data?.settlement_mode === 'LumpSumContract' + ) { + message.warning('没有多余金额可生成账单!'); + return false; + } + if (values?.payee === values?.payer) { + year_month_is = true; + message.warning('收款方和付款方不能相同'); + return false; + } + if ( + data?.settlement_mode === 'LumpSumContract' && + taotal_amount <= 0 + ) { + message.warning('账单金额必须大于0'); + return false; + } + if ( + data?.settlement_mode === 'LumpSumContract' && + taotal_amount !== total_bill_amount + ) { + message.warning(`请把¥${total_bill_amount},拆分完!`); + return false; + } + if (year_month_is) { + return; + } + // 处理年月 + let year_month = values?.year_month; + let k = year_month?.split('-'); + let year = k[0]; + let month = parseInt(k[1]); + // 构建账单数据 + const billData = { + ...values, + year: year, + month: month, + contracts_id: data?.id, + cost_type: data?.income_expense_type, + }; + console.log(billData, 'billData'); + if (data?.settlement_mode === 'OpenContract') { + //开口合同 + return Apis.Contract.ContractBills.Store({ + ...billData, + }) + .then(() => { + navigate('/contract/contract_bills'); + message.success('提交成功'); + return true; + }) + .catch(() => false); + } + if ( + total_bill_amount > 0 && + data?.settlement_mode === 'LumpSumContract' + ) { + if (taotal_amount <= total_bill_amount) { + return Apis.Contract.ContractBills.Store({ + ...billData, + }) + .then(() => { + navigate('/contract/contract_bills'); + message.success('提交成功'); + return true; + }) + .catch(() => false); + } else { + message.warning('可拆分金额不够!'); + } + console.log(taotal_amount, total_bill_amount, 'taotal_amount'); + } + }} + submitter={{ + render: (props) => { + return [ + { + props.submit(); + }} + title="提交" + />, + ]; + }, + }} + columns={[ + { + name: ['contracts_id'], + valueType: 'dependency', + columns: ({ contracts_id }: any) => { + if (!id) { + return [ + { + colProps: { span: 24 }, + title: '选择合同', + key: 'contracts_id', + formItemProps: { ...rulesHelper.number }, + renderFormItem: () => { + return ( + { + let res = e[0]; + getContractsShow(res?.id); + form.setFieldsValue({ + contracts_id: res?.id, + }); + console.log(e, contracts_id, 'e'); + }} + /> + ); + }, + }, + ]; + } else { + return []; + } + }, + }, + { + name: ['contracts_id'], + valueType: 'dependency', + columns: ({ contracts_id }: any) => { + return [ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + {contracts_id ? ( + + + + + + + + + + ¥{data?.total_amount} + + + ¥{data?.total_bill_amount} + + + {data?.settlement_mode === + 'LumpSumContract' && ( + + ¥{totalBillSeparableAmount()} + + )} + + + + ) : ( + + )} + + ); + }, + }, + { + valueType: 'divider', + title: '账单设置', + fieldProps: { + orientation: 'left', + children: '账单设置', + }, + }, + + { + title: '收款方', + valueType: 'select', + dataIndex: 'payee', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: data?.contract_peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (data?.income_expense_type === 'Income') { + return ( + item?.counterparty_type === 'InternalCompany' + ); + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + title: '付款方', + valueType: 'select', + dataIndex: 'payer', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: data?.contract_peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (data?.income_expense_type === 'Expense') { + return ( + item?.counterparty_type === 'InternalCompany' + ); + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + title: '费用类型', + dataIndex: 'cost_type', + colProps: { span: 2 }, + align: 'center', + renderFormItem: () => { + let res = + ContractBillsCostTypeEnum[ + data?.income_expense_type as keyof typeof ContractBillsCostTypeEnum + ]; + return {res?.text}; + }, + }, + { + title: '账单月份', + valueType: 'dateMonth', + dataIndex: 'year_month', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '期数', + valueType: 'digit', + dataIndex: 'period_num', + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '账单金额', + valueType: 'digit', + dataIndex: 'amount', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '合同标地', + formItemProps: { ...rulesHelper.text }, + dataIndex: 'object_name', + colProps: { span: 6 }, + }, + { + title: '备注', + dataIndex: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]; + }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contract_bills/pages/update.tsx b/src/pages/contract/contract_bills/pages/update.tsx new file mode 100644 index 0000000..d87b14b --- /dev/null +++ b/src/pages/contract/contract_bills/pages/update.tsx @@ -0,0 +1,273 @@ +import { MyModalFormProps, MyPageContainer, rulesHelper } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsCostTypeEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space, Tag } from 'antd'; +import { useEffect, useState } from 'react'; +export default function Index({ title = '编辑合同账单' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [dataBill, setBillShow] = useState({}); + const [data, setShow] = useState({}); + + const getContractsShow = (id: number) => { + Apis.Contract.Contracts.Show({ id: id }).then((res) => { + setShow(res?.data); + }); + }; + + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(data?.total_amount) - + parseFloat(data?.total_bill_amount) + + parseFloat(dataBill?.amount) + ).toFixed(2), + ); + }; + + const loadShow = () => { + Apis.Contract.ContractBills.Show({ id: Number(id) }).then((res) => { + res.data.year_month = `${res?.data?.year}-${ + res?.data?.month < 10 ? `0${res?.data?.month}` : res?.data?.month + }`; + setBillShow(res?.data); + form.setFieldsValue({ + ...res?.data, + object_name: res?.data?.contract_bill_objects?.[0]?.name, + }); + getContractsShow(res?.data?.contracts_id); + // form.setFieldsValue(res?.data); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title="编辑" + wrapperCol={{ span: 24 }} + width="1000px" + layoutType="Form" + form={form} + onFinish={async (values: any) => { + let total_bill_amount = totalBillSeparableAmount(); + let k = values?.year_month?.split('-'); + values.year = k[0]; + values.month = parseInt(k[1]); + if (data?.settlement_mode === 'OpenContract') { + //开口合同 + return Apis.Contract.ContractBills.Update({ + ...values, + id: Number(id), + }) + .then(() => { + navigate(-1); + message.success('提交成功'); + return true; + }) + .catch(() => false); + } else { + if (total_bill_amount > 0) { + if ( + values?.amount <= + total_bill_amount + parseFloat(dataBill?.amount) + ) { + return Apis.Contract.ContractBills.Update({ + ...values, + id: Number(id), + }) + .then(() => { + navigate(-1); + message.success('提交成功'); + return true; + }) + .catch(() => false); + } else { + message.warning('可拆分金额不够!'); + } + } else { + message.warning('没有多余金额可生成账单!'); + } + } + }} + columns={[ + { + name: ['contracts_id'], + valueType: 'dependency', + columns: ({ contracts_id }: any) => { + return contracts_id + ? [ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+ 收支类型: + { + ContractTemplatesIncomeExpenseTypeEnum[ + data?.income_expense_type as keyof typeof ContractTemplatesIncomeExpenseTypeEnum + ]?.text + } +
+
+ 结算模式: + { + ContractsSettlementModeEnum[ + data?.settlement_mode as keyof typeof ContractsSettlementModeEnum + ]?.text + } +
+
总金额: ¥{data?.total_amount}
+
+ 已生成账单: ¥{data?.total_bill_amount} +
+ {data?.settlement_mode === + 'LumpSumContract' && ( +
+ 本次编辑可拆分金额: ¥ + {totalBillSeparableAmount()} +
+ )} +
+
+ ); + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + title: '基本信息', + }, + }, + { + title: '收款方', + valueType: 'select', + dataIndex: 'payee', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + disabled: true, + }, + }, + { + title: '付款方', + valueType: 'select', + dataIndex: 'payer', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + disabled: true, + }, + }, + { + title: '费用类型', + dataIndex: 'cost_type', + colProps: { span: 2 }, + align: 'center', + renderFormItem: () => { + let res = + ContractBillsCostTypeEnum[ + data?.income_expense_type as keyof typeof ContractBillsCostTypeEnum + ]; + return {res?.text}; + }, + }, + { + title: '账单月份', + valueType: 'dateMonth', + dataIndex: 'year_month', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '期数', + valueType: 'digit', + dataIndex: 'period_num', + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '账单金额', + valueType: 'digit', + dataIndex: 'amount', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '合同标地', + formItemProps: { ...rulesHelper.text }, + dataIndex: 'object_name', + fieldProps: { + disabled: true, + }, + colProps: { span: 6 }, + }, + { + title: '备注', + dataIndex: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ] + : []; + }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contract_seal_logs/index.tsx b/src/pages/contract/contract_seal_logs/index.tsx new file mode 100644 index 0000000..bbcc345 --- /dev/null +++ b/src/pages/contract/contract_seal_logs/index.tsx @@ -0,0 +1,48 @@ +import { MyPageContainer } from '@/common'; +import { useSearchParams } from '@umijs/max'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import Seals from './seals'; +import UnusedSeal from './unused'; +import UsedSeal from './used'; + +export default function Index({ title = '合同用印' }) { + const [searchParams] = useSearchParams(); + const [activeKey, setActiveKey] = useState('1'); + + const items: TabsProps['items'] = [ + { + key: 'UnusedSeal', + label: '未用印合同', + children: , + }, + { + key: 'UsedSeal', + label: '已用印合同', + children: , + }, + { + key: 'Seals', + label: '印章管理', + children: , + }, + ]; + + useEffect(() => { + if (searchParams?.get('key')) { + setActiveKey(searchParams?.get('key') || '1'); + } + }, []); + + return ( + + + + ); +} diff --git a/src/pages/contract/contract_seal_logs/seals/index.tsx b/src/pages/contract/contract_seal_logs/seals/index.tsx new file mode 100644 index 0000000..3ff3541 --- /dev/null +++ b/src/pages/contract/contract_seal_logs/seals/index.tsx @@ -0,0 +1,100 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanySealsTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Image, Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '印章管理' }) { + return ( + + MyProTableProps.request( + params, + sort, + Apis.CompanySeal.CompanySeals.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '企业名称', + dataIndex: ['company_supplier', 'name'], + search: { transform: (value) => ({ company_supplier_name: value }) }, + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: CompanySealsTypeEnum, + }), + { + title: '印章图片', + search: false, + render: (_, item: any) => { + if (!item?.seal_image || !item.seal_image[0]?.url) { + return '-'; + } + return ; + }, + }, + { + title: '保管人', + search: false, + render: (_, item: any) => { + return `${item.company_employee?.name || ''}_${ + item.company_employee?.phone || '' + }`; + }, + }, + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '是否启用', + search: false, + }), + { + title: '启用日期', + dataIndex: 'use_date', + search: false, + }, + // MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.CompanySeal.CompanySeals.Update({ + id: item.id ?? 0, + is_enabled: item.is_enabled ? 0 : 1, + type: item.type, + company_suppliers_id: item.company_suppliers_id, + }).then(() => action?.reload()) + } + /> + + Apis.CompanySeal.CompanySeals.Delete({ id: item.id }).then( + () => action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/seals/modals/Create.tsx b/src/pages/contract/contract_seal_logs/seals/modals/Create.tsx new file mode 100644 index 0000000..15693bf --- /dev/null +++ b/src/pages/contract/contract_seal_logs/seals/modals/Create.tsx @@ -0,0 +1,93 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { CompanySealsTypeEnum } 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={`添加印章`} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 18 }} + align="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.CompanySeal.CompanySeals.Store({ + ...values, + is_enabled: 1, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects.Supplier({ + key: 'company_suppliers_id', + title: '选择企业', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 24 }, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'type', + title: '印章类型', + valueEnum: CompanySealsTypeEnum, + required: true, + colProps: { span: 24 }, + }), + Selects.Employees({ + key: 'company_employees_id', + title: '保管人', + colProps: { span: 24 }, + required: true, + }), + { + key: 'use_date', + title: '启用日期', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + MyFormItems.UploadImages({ + key: 'seal_image', + title: '印章图片', + colProps: { span: 24 }, + max: 1, + }), + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/seals/modals/Update.tsx b/src/pages/contract/contract_seal_logs/seals/modals/Update.tsx new file mode 100644 index 0000000..f870221 --- /dev/null +++ b/src/pages/contract/contract_seal_logs/seals/modals/Update.tsx @@ -0,0 +1,93 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { CompanySealsTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑印章`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 18 }} + align="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.CompanySeal.CompanySeals.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects.Supplier({ + key: 'company_suppliers_id', + title: '选择企业', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 24 }, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'type', + title: '印章类型', + valueEnum: CompanySealsTypeEnum, + required: true, + colProps: { span: 24 }, + }), + Selects.Employees({ + key: 'company_employees_id', + title: '保管人', + colProps: { span: 24 }, + required: true, + }), + { + key: 'use_date', + title: '启用日期', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { width: '100%' }, + }, + }, + MyFormItems.UploadImages({ + key: 'seal_image', + title: '印章图片', + colProps: { span: 24 }, + max: 1, + }), + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/unused/index.tsx b/src/pages/contract/contract_seal_logs/unused/index.tsx new file mode 100644 index 0000000..b7515cc --- /dev/null +++ b/src/pages/contract/contract_seal_logs/unused/index.tsx @@ -0,0 +1,105 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractsContractNatureEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import dayjs from 'dayjs'; +import UseSeal from './modals/UseSeal'; + +export default function Index() { + const navigate = useNavigate(); + + return ( + { + return MyProTableProps.request( + { + ...params, + status: ContractsStatusEnum.Approved.value, + is_use_seal: false, + }, + sort, + Apis.Contract.Contracts.List, + ); + }} + headerTitle="未用印合同" + columns={[ + MyColumns.ID({ search: false }), + { + title: '合同类型', + dataIndex: 'contract_type_name', + search: false, + }, + { + title: '合同名称', + dataIndex: 'name', + }, + { + title: '合同编号', + dataIndex: 'code', + render: (_, item: any) => { + return ( + { + navigate(`/contract/contracts/show/${item.id}`); + }} + > + {item?.name} + + ); + }, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '合同性质', + dataIndex: 'contract_nature', + valueEnum: ContractsContractNatureEnum, + search: false, + }), + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '签订时间', + dataIndex: 'sign_time', + render: (_, item: any) => { + return item.sign_time + ? dayjs(item.sign_time).format('YYYY-MM-DD') + : '-'; + }, + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/unused/modals/UseSeal.tsx b/src/pages/contract/contract_seal_logs/unused/modals/UseSeal.tsx new file mode 100644 index 0000000..47ff543 --- /dev/null +++ b/src/pages/contract/contract_seal_logs/unused/modals/UseSeal.tsx @@ -0,0 +1,183 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + BetaSchemaForm, + ProCard, + ProDescriptions, +} from '@ant-design/pro-components'; +import { Form, message, Space } from 'antd'; + +export default function UseSeal(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}`} + layout="horizontal" + labelCol={{ span: 6 }} + wrapperCol={{ span: 18 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + seal_ids: props?.item?.seal_info || [], + }); + } + }} + trigger={ + + } + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractSealLogs.Store({ + ...values, + contracts_id: props?.item?.id, + seal_ids: values?.can_seal_ids || [], + is_use_seal: values?.is_use_seal ? 1 : 0, + is_external_seal_usage: values?.is_external_seal_usage ? 1 : 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + // title: '登记信息', + dataIndex: '合同信息', + valueType: 'text', + + renderFormItem: () => ( + + + + + {props?.item?.code} | {props?.item?.name || '-'} + + + + + ), + colProps: { span: 24 }, + formItemProps: { + labelCol: { span: 6 }, + wrapperCol: { span: 18 }, + }, + }, + Selects.ContractSeals({ + key: 'seal_ids', + required: true, + title: '可用印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + Selects?.Employees({ + title: '用印申请人', + key: 'company_employees_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + { + key: 'number_contract_copies', + title: '合同份数', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + title: '用印时间', + key: 'use_seal_time', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + disabledDate: (current: any) => { + // 只能选今天及以后的日期 + const today = new Date(); + today.setHours(0, 0, 0, 0); // 设置为今天的00:00:00 + return current && current > today; + }, + }, + }, + { + title: '交易方用印', + tooltip: '该合同中,非我司主体的交易方,是否已经盖章', + key: 'is_use_seal', + valueType: 'switch', + colProps: { span: 24 }, + fieldProps: { + checkedChildren: '已用印', + unCheckedChildren: '未用印', + }, + }, + // { + // title: '是否外出用印', + // tooltip: '本次用印,是否在非公司办公范围内', + // key: 'is_external_seal_usage', + // valueType: 'switch', + // colProps: { span: 24 }, + // fieldProps: { + // checkedChildren: '是', + // unCheckedChildren: '否', + // }, + // }, + // { + // valueType: 'formList', + // dataIndex: 'seal_ids', + // title: '实际用章', + // formItemProps: { ...rulesHelper.array }, + // fieldProps: { + // copyIconProps: false, + // // deleteIconProps: false, + // }, + // columns: [ + // { + // valueType: 'group', + // colProps: { span: 24 }, + // columns: [ + // Selects?.CompanySeals({ + // title: '', + // key: 'seal_id', + // colProps: { span: 24 }, + // required: true, + // fieldProps: { + // placeholder: '请选择要使用的印章(可搜索)', + // }, + // }), + // ], + // }, + // ], + // }, + { + title: '备注', + key: 'remarks', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/used/index.tsx b/src/pages/contract/contract_seal_logs/used/index.tsx new file mode 100644 index 0000000..df72f75 --- /dev/null +++ b/src/pages/contract/contract_seal_logs/used/index.tsx @@ -0,0 +1,110 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate, useParams } from '@umijs/max'; +import { Space } from 'antd'; +import Show from './modals/Show'; +import Update from './modals/Update'; + +export default function Index({ title = '合同用章' }) { + const navigate = useNavigate(); + + const { id } = useParams<{ id: string }>(); + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractSealLogs.List, + ) + } + headerTitle="已用印合同" + params={{ contracts_id: id }} + // toolBarRender={(action) => [ + // , + // ]} + columns={[ + // MyColumns.ID({ + // search: false, + // }), + + { + title: '合同名称', + dataIndex: ['contract', 'name'], + }, + { + title: '合同编号', + dataIndex: ['contract', 'code'], + render: (_, item: any) => { + return ( + { + navigate(`/contract/contracts/show/${item.contracts_id}`); + }} + > + {item?.contract?.code} + + ); + }, + }, + { + title: '合同编号', + dataIndex: 'code', + hidden: true, + }, + // { + // title: '合同ID', + // dataIndex: 'contracts_id', + // }, + { + title: '印章', + search: false, + render: (_, item: any) => ( + + {item?.seal_info?.map((res: any) => { + return res?.company_name; + })} + + ), + }, + { + title: '申请用印人', + dataIndex: ['company_employee', 'name'], + search: false, + }, + + { + title: '用印合同', + dataIndex: 'number_contract_copies', + search: false, + }, + // MyColumns.Boolean({ + // dataIndex: 'is_external_seal_usage', + // title: '是否外出用印', + // search: false, + // }), + { + title: '操作印章人', + dataIndex: ['operator_employee', 'name'], + search: false, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/used/modals/Show.tsx b/src/pages/contract/contract_seal_logs/used/modals/Show.tsx new file mode 100644 index 0000000..835d774 --- /dev/null +++ b/src/pages/contract/contract_seal_logs/used/modals/Show.tsx @@ -0,0 +1,105 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { CompanySealsTypeEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + const handleOpenModal = () => { + if (props?.item?.id) { + setLoading(true); + Apis.Contract.ContractSealLogs.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }; + return ( + + + + + {/* 基本信息 */} + + {data?.contracts_id} + + + {data?.seal_person || data?.company_employee?.name || '-'} + + + {data?.use_seal_time} + + + {/* 用印详情 */} + + {data?.number_contract_copies} + + + {/* */} + {data?.is_use_seal ? '是' : '否'} + + {/* + + */} + + {/* 印章信息 */} + + {data?.seal_ids?.map((sealId: string, index: number) => ( + + + + )) || '-'} + + + {/* 其他信息 */} + + {data?.remarks || '-'} + + + {/* 时间信息 */} + + {data?.created_at} + + + {data?.updated_at} + + + + + + } + /> + ); +} diff --git a/src/pages/contract/contract_seal_logs/used/modals/Update.tsx b/src/pages/contract/contract_seal_logs/used/modals/Update.tsx new file mode 100644 index 0000000..7d8b6df --- /dev/null +++ b/src/pages/contract/contract_seal_logs/used/modals/Update.tsx @@ -0,0 +1,144 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + layout="horizontal" + labelCol={{ span: 6 }} + wrapperCol={{ span: 18 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + seal_ids: props.item?.seal_info?.map((item: any) => ({ + seal_id: item?.id || item, + })), + }); + } + }} + onFinish={async (values: any) => + Apis.Contract.ContractSealLogs.Update({ + ...values, + contracts_id: props?.item?.id, + is_use_seal: values?.is_use_seal ? 1 : 0, + is_external_seal_usage: values?.is_external_seal_usage ? 1 : 0, + id: props.item?.id ?? 0, + seal_ids: values?.seal_ids?.map((item: any) => item.seal_id), + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.Employees({ + title: '用印申请人', + key: 'company_employees_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + + { + key: 'number_contract_copies', + title: '合同份数', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + title: '用印时间', + key: 'use_seal_time', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + disabledDate: (current: any) => { + // 只能选今天及以后的日期 + const today = new Date(); + today.setHours(0, 0, 0, 0); // 设置为今天的00:00:00 + return current && current > today; + }, + }, + }, + { + title: '交易方用印', + tooltip: '该合同中,非我司主体的交易方,是否已经盖章', + key: 'is_use_seal', + valueType: 'switch', + colProps: { span: 24 }, + fieldProps: { + checkedChildren: '已用印', + unCheckedChildren: '未用印', + }, + }, + // { + // title: '是否外出用印', + // tooltip: '本次用印,是否在非公司办公范围内', + // key: 'is_external_seal_usage', + // valueType: 'switch', + // colProps: { span: 24 }, + // fieldProps: { + // checkedChildren: '是', + // unCheckedChildren: '否', + // }, + // }, + { + valueType: 'formList', + dataIndex: 'seal_ids', + title: '实际用章', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + Selects?.CompanySeals({ + title: '', + key: 'seal_id', + colProps: { span: 24 }, + required: true, + fieldProps: { + placeholder: '请选择要使用的印章(可搜索)', + }, + }), + ], + }, + ], + }, + { + title: '备注', + key: 'remarks', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_templates/index.tsx b/src/pages/contract/contract_templates/index.tsx new file mode 100644 index 0000000..1b75d0a --- /dev/null +++ b/src/pages/contract/contract_templates/index.tsx @@ -0,0 +1,134 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { + ContractTemplatesIncomeExpenseTypeEnum, + ContractTemplatesSourceEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Show from './modals/Show'; +import Update from './modals/Update'; + +export default function Index({ title = '合同模版' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractTemplates.List, + ) + } + headerTitle="合同模版列表" + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + search: false, + }), + SelectContract.ContractTypes({ + title: '合同类型', + key: 'contract_types_id', + colProps: { span: 12 }, + fieldProps: { + placeholder: '请选择合同类型', + }, + hidden: true, + }), + { + title: '合同类型', + dataIndex: ['contract_type', 'name'], + // search: { transform: (value) => ({ type_name: value }) }, + // sorter: true, + search: false, + }, + { + title: '模板名称', + dataIndex: 'name', + sorter: true, + }, + { + title: '模板编号', + dataIndex: 'code', + sorter: true, + }, + { + title: '模板描述', + dataIndex: 'description', + width: 200, + search: false, + }, + MyColumns.EnumTag({ + title: '来源', + dataIndex: 'source', + valueEnum: ContractTemplatesSourceEnum, + }), + MyColumns.Boolean({ + title: '是否启用', + dataIndex: 'is_enabled', + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + {item.is_enabled === 1 && ( + + )} + + + Apis.Contract.ContractTemplates.Update({ + id: item.id ?? 0, + is_enabled: item.is_enabled === 1 ? 0 : 1, + name: item.name, + code: item.code, + source: item.source, + income_expense_type: item.income_expense_type, + contract_types_id: item.contract_types_id, + }).then(() => action?.reload()) + } + /> + + Apis.Contract.ContractTemplates.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/contract/contract_templates/modals/Create.tsx b/src/pages/contract/contract_templates/modals/Create.tsx new file mode 100644 index 0000000..babe2cb --- /dev/null +++ b/src/pages/contract/contract_templates/modals/Create.tsx @@ -0,0 +1,100 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ContractTemplatesIncomeExpenseTypeEnum, + ContractTemplatesSourceEnum, +} 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}`} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Contract.ContractTemplates.Store({ + ...values, + // is_enabled: values.is_enabled ? 1 : 0, + is_enabled: 1, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'income_expense_type', + title: '收支类型', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + required: true, + colProps: { span: 24 }, + }), + Selects.ContractTypes({ + title: '合同类型', + tooltip: '可在【配置:合同类型配置】中设置可选的合同类型', + required: true, + }), + { + key: 'name', + title: '模板名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + key: 'code', + title: '模板编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + MyFormItems.EnumRadio({ + key: 'source', + title: '模板来源', + valueEnum: ContractTemplatesSourceEnum, + required: true, + colProps: { span: 24 }, + }), + { + title: '模板描述', + key: 'description', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachment', + title: '上传附件', + tooltip: '可以上传任意格式的文件', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + max: 9, + required: true, + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_templates/modals/Show.tsx b/src/pages/contract/contract_templates/modals/Show.tsx new file mode 100644 index 0000000..522bb19 --- /dev/null +++ b/src/pages/contract/contract_templates/modals/Show.tsx @@ -0,0 +1,148 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { + ContractTemplatesIncomeExpenseTypeEnum, + ContractTemplatesSourceEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + { + if (props?.item?.id) { + setLoading(true); + Apis.Contract.ContractTemplates.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + {data?.name} + + + {data?.code} + + + + + + {data?.contract_type?.name || '-'} + + + + + + {data?.description || '-'} + + + {data?.created_at} + + + {data?.updated_at} + + + {data?.attachment && data.attachment.length > 0 && ( +
+ +
+ )} + {data?.attachment?.map((file: any, index: number) => { + const fileName = file?.name || `文件${index + 1}`; + + const handleDownload = async (e: React.MouseEvent) => { + e.preventDefault(); + try { + const response = await fetch(file?.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = fileName; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(file?.url, '_blank'); + } + }; + return ( + + ); + }) || '-'} +
+
+
+
+
+ } + /> + ); +} diff --git a/src/pages/contract/contract_templates/modals/Update.tsx b/src/pages/contract/contract_templates/modals/Update.tsx new file mode 100644 index 0000000..1b0a3c3 --- /dev/null +++ b/src/pages/contract/contract_templates/modals/Update.tsx @@ -0,0 +1,100 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ContractTemplatesIncomeExpenseTypeEnum, + ContractTemplatesSourceEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Contract.ContractTemplates.Update({ + ...values, + is_enabled: 1, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'income_expense_type', + title: '收支类型', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + required: true, + colProps: { span: 24 }, + }), + Selects.ContractTypes({ + title: '合同类型', + tooltip: '可在【配置:合同类型配置】中设置可选的合同类型', + required: true, + }), + { + key: 'name', + title: '模板名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + key: 'code', + title: '模板编号', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + MyFormItems.EnumRadio({ + key: 'source', + title: '模板来源', + valueEnum: ContractTemplatesSourceEnum, + required: true, + colProps: { span: 24 }, + }), + { + title: '模板描述', + key: 'description', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachment', + title: '上传附件', + tooltip: '可以上传任意格式的文件', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + max: 9, + required: true, + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contract_types/index.tsx b/src/pages/contract/contract_types/index.tsx new file mode 100644 index 0000000..282d543 --- /dev/null +++ b/src/pages/contract/contract_types/index.tsx @@ -0,0 +1,66 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '合同类型' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Contract.ContractTypes.List, + ) + } + toolBarRender={(action) => [ + , + ]} + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '是否启用', + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Contract.ContractTypes.Delete({ id: item.id }).then( + () => action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/contract/contract_types/modals/Create.tsx b/src/pages/contract/contract_types/modals/Create.tsx new file mode 100644 index 0000000..3d9cbe3 --- /dev/null +++ b/src/pages/contract/contract_types/modals/Create.tsx @@ -0,0 +1,52 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} 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}`} + layout="horizontal" + labelCol={{ span: 6 }} + wrapperCol={{ span: 18 }} + labelAlign="left" + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Contract.ContractTypes.Store({ + ...values, + is_enabled: 1, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '类型名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contract_types/modals/Update.tsx b/src/pages/contract/contract_types/modals/Update.tsx new file mode 100644 index 0000000..949104e --- /dev/null +++ b/src/pages/contract/contract_types/modals/Update.tsx @@ -0,0 +1,59 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + key={new Date().getTime()} + layout="horizontal" + labelCol={{ span: 6 }} + wrapperCol={{ span: 18 }} + labelAlign="left" + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Contract.ContractTypes.Update({ + ...values, + is_enabled: values.is_enabled ? 1 : 0, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '类型名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/index.tsx b/src/pages/contract/contracts/index.tsx new file mode 100644 index 0000000..a458764 --- /dev/null +++ b/src/pages/contract/contracts/index.tsx @@ -0,0 +1,354 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ContractsContractNatureEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Dropdown, Space } from 'antd'; +import dayjs from 'dayjs'; + +import Archives from '../contract_archives/unfinished/modals/Archive'; +import UseSeal from '../contract_seal_logs/unused/modals/UseSeal'; +import Change from './modals/Change'; +import Terminated from './modals/Terminated'; +import Voided from './modals/Voided'; + +export default function Index({ title = '合同拟制' }) { + const navigate = useNavigate(); + const [searchParams, setSearchParams]: any = useSearchParams(); + + let tableRender = (item: any, action: any) => { + console.log(item, 'item'); + let permissions = [ + { + if (item.parent_id) { + navigate( + `/contract/contracts/pages/contract_add_update?id=${item.id}`, + ); + } else { + navigate(`/contract/contracts/pages/contract_update?id=${item.id}`); + } + }} + title="编辑" + />, + ]; + + let permissionsSpace: any = [ + , + { + navigate(`/contract/contracts/show/${item.id}?key=4`); + }} + />, + , + , + { + navigate(`/contract/contracts/pages/contract_add?id=${item.id}`); + }} + title="补充" + />, + , + , + , + { + Apis.Contract.Contracts.ContractCopy({ + id: item?.id ?? 0, + }).then((res) => { + navigate( + `/contract/contracts/pages/contract_update?id=${res?.data?.id}`, + ); + }); + console.log(item); + }} + />, + + Apis.Contract.Contracts.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + />, + ]; + + let Others = ( + + + + ); + return [...permissions, ...[Others]]; + }; + + return ( + + { + setSearchParams(params); + return MyProTableProps.request( + !searchParams?.get('page') + ? { + status: searchParams?.get('status') || null, + ...params, + is_agreement: false, + } + : { ...params, is_agreement: false }, + sort, + Apis.Contract.Contracts.List, + ); + }} + headerTitle="合同列表" + toolBarRender={() => [ + { + navigate('/contract/contracts/pages/contract_create'); + }} + title="新增合同" + />, + ]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '关联项目', + key: 'asset_projects_id', + hidden: true, + }), + // Selects?.OrganizationSearch({ + // title: '签订部门', + // key: 'organizations_id', + // colProps: { span: 24 }, + // fieldProps: { + // showSearch: true, + // }, + // search: { + // transform: (value) => { + // return { + // organization_name: + // value.length > 0 ? value[value.length - 1] : '', + // }; + // }, + // }, + // }), + MyColumns.EnumTag({ + title: '合同状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + fieldProps: { + defaultValue: searchParams?.get('status') || undefined, + }, + }), + { + title: '合同编号', + dataIndex: 'code', + }, + { + title: '合同名称', + dataIndex: 'name', + // render: (_, item: any) => { + // return ( + // { + // navigate(`/contract/contracts/show/${item.id}`); + // }} + // > + // {item?.name} + // + // ); + // }, + }, + { + title: '合同类型', + dataIndex: 'contract_type_name', + search: false, + }, + + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + }), + MyColumns.EnumTag({ + title: '合同性质', + dataIndex: 'contract_nature', + valueEnum: ContractsContractNatureEnum, + search: false, + }), + { + title: '合同总价', + search: false, + render: (_, item: any) => { + return `¥${item.total_amount}`; + }, + }, + { + title: '账单金额', + render: (_, item: any) => { + return `¥${item.total_bill_amount}`; + }, + search: false, + }, + { + title: '履约金额', + render: (_, item: any) => { + return item.income_expense_type === 'Income' + ? `¥${item.total_income_amount}` + : item.income_expense_type === 'Expense' + ? `¥${item.total_expense_amount}` + : '-'; + }, + search: false, + }, + { + title: '履约率', + search: false, + render: (_, item: any) => { + const numerator = parseFloat( + item.income_expense_type === 'Income' + ? item?.total_income_amount || 0 + : item.income_expense_type === 'Expense' + ? item?.total_expense_amount || 0 + : 0, + ); + const denominator = parseFloat(item.total_bill_amount || 0); + const rate = + denominator > 0 ? (numerator / denominator) * 100 : 0; + return `${rate.toFixed(1)}%`; + }, + }, + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + // search: { + // transform: (value) => { + // return { full_name: value }; + // }, + // }, + search: false, + }, + // { + // title: '签订部门', + // dataIndex: 'sign_department', + // search: false, + // }, + + { + title: '合同对接人', + dataIndex: 'contract_liaison', + search: false, + // render: (_, item: any) => ( + // + // {item?.contract_liaison?.name || ''} + // {item?.contract_liaison?.id && ( + // + // )} + // + // ), + }, + { + title: '用印日期', + dataIndex: 'sign_time', + valueType: 'date', + render: (_, item: any) => { + return item.sign_time + ? dayjs(item.sign_time).format('YYYY-MM-DD') + : '-'; + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate(`/contract/contracts/show/${item.id}`); + }} + /> + <>{tableRender(item, action)} + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/contract/contracts/modals/Change.tsx b/src/pages/contract/contracts/modals/Change.tsx new file mode 100644 index 0000000..e02e08d --- /dev/null +++ b/src/pages/contract/contracts/modals/Change.tsx @@ -0,0 +1,118 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { useSearchParams } from '@umijs/max'; +import { Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function UseSeal(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + + const [data, setData] = useState({}); // 修复状态变量命名不一致 + const loadShow = () => { + const currentId = props?.item?.id || Number(id); + if (currentId) { + Apis.Contract.Contracts.Show({ id: Number(currentId) }).then((res) => { + setData(res?.data); + form.setFieldsValue({ + ...res?.data, + peoples: res?.data?.contract_peoples, + }); // 编辑赋值 + }); + } + }; + + useEffect(() => { + loadShow(); + }, [id]); + return ( + + {...MyModalFormProps.props} + title={`简易变更`} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + form.setFieldValue('organization', [props.item?.sign_department]); + } + }} + trigger={ + + } + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.Contracts.Update({ + ...values, + id: props?.item?.id, + code: props?.item?.code, + sign_department: + values.organization?.[values.organization?.length - 1], + income_expense_type: props?.item?.income_expense_type, + contract_nature: props?.item?.contract_nature, + contract_types_id: props?.item?.contract_types_id, + start_time: props?.item?.start_time, + end_time: props?.item?.end_time, + settlement_mode: props?.item?.settlement_mode, + sign_subject: props?.item?.sign_subject, + attachments: props?.item?.attachments || [], + peoples: data?.contract_peoples, // 使用从show接口获取的数据 + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'name', + title: '合同名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + SelectContract.EmployeeName({ + key: 'contract_liaison', + title: '合同对接人', + colProps: { span: 24 }, + required: true, + }), + { + title: '合同份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/modals/SignSubjectSelectList.tsx b/src/pages/contract/contracts/modals/SignSubjectSelectList.tsx new file mode 100644 index 0000000..19f0d00 --- /dev/null +++ b/src/pages/contract/contracts/modals/SignSubjectSelectList.tsx @@ -0,0 +1,107 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { message, type TableProps } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +export default function SurveysSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + // const [selectedDataRow, setSelectedDataRow] = useState({}); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: TableProps['rowSelection'] = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows[0], 'selectedRows[0]'); + setSelectedRow(selectedRows[0]); + }, + defaultSelectedRowKeys: props?.item?.id ? [props?.item?.id] : [], + }; + + return ( + { + setSelectedRow(props?.item); + console.log(props?.item, 'props?.item?.id'); + }} + node={ + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanySuppliers.List, + ) + } + rowSelection={{ type: 'radio', ...rowSelection }} + options={false} + tableAlertOptionRender={() => { + return ( + { + let res: any = getSelectedRow; + if (!res?.legal_person) { + message.error('当前主体没有设置法人信息!'); + return; + } + props?.onChange?.(res); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '供应商名称', + dataIndex: 'name', + }, + { + title: '公司名称', + dataIndex: 'company_name', + search: false, + }, + { + title: '法人', + dataIndex: 'legal_person', + }, + { + title: '纳税人号', + dataIndex: 'tax_number', + }, + { + title: '注册地址', + search: false, + render: (_, item: any) => { + return `${item.province}${item.city}${item.area}${item.street}${item.address}`; + }, + }, + ]} + /> + } + > + ); +} diff --git a/src/pages/contract/contracts/modals/SubmitApproval.tsx b/src/pages/contract/contracts/modals/SubmitApproval.tsx new file mode 100644 index 0000000..1e4b578 --- /dev/null +++ b/src/pages/contract/contracts/modals/SubmitApproval.tsx @@ -0,0 +1,308 @@ +import { + MyBetaModalFormProps, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +export default function SubmitApproval( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + onCancel?: () => void; + }, +) { + const modalRef = useRef(); + + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + { + // setSelectedRow(props?.item); + }} + onCancel={() => { + props?.onCancel?.(); + }} + node={ + + {...MyModalFormProps.props} + title={props?.title} + width="800px" + layoutType="form" + wrapperCol={{ span: 24 }} + form={form} + onFinish={async (values: any) => { + console.log(values, 'values222'); + + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + Apis.Contract.Contracts.SubmitApproval({ + ...values, + id: props.item?.contracts_id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('提交成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + params: { + type: props?.item?.type, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum + .Approver.value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + console.log(res, '222'); + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + } + > + ); +} diff --git a/src/pages/contract/contracts/modals/Terminated.tsx b/src/pages/contract/contracts/modals/Terminated.tsx new file mode 100644 index 0000000..68aee47 --- /dev/null +++ b/src/pages/contract/contracts/modals/Terminated.tsx @@ -0,0 +1,305 @@ +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 { Button, Form, message } from 'antd'; +import { useState } from 'react'; + +export default function Terminated(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.Contracts.Terminated({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('合同解除申请成功'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '合同解除原因', + valueType: 'textarea', + key: 'terminated_reason', + formItemProps: { ...rulesHelper.text }, + }, + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractTermination.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/modals/Voided.tsx b/src/pages/contract/contracts/modals/Voided.tsx new file mode 100644 index 0000000..fdd9840 --- /dev/null +++ b/src/pages/contract/contracts/modals/Voided.tsx @@ -0,0 +1,58 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Voided(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Contract.Contracts.Voided({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('撤销成功'); + props.reload?.(); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '撤销原因', + valueType: 'textarea', + key: 'voided_reason', + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/pages/contract_add.tsx b/src/pages/contract/contracts/pages/contract_add.tsx new file mode 100644 index 0000000..7058318 --- /dev/null +++ b/src/pages/contract/contracts/pages/contract_add.tsx @@ -0,0 +1,433 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; + +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import dayjs from 'dayjs'; +import { useEffect, useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +// import SubmitReview from '../modals/SubmitReview'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, +} from '@/gen/Enums'; +import ContractsInfoAdd from '../show/components/ContractsInfoAdd'; +import { IsDepositEnum } from './reducer'; +export default function Index({ title = '新增补充协议' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const [contractId, setContractId] = useState(0); + + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [selectedRow, setSelectedRow] = useState({}); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setSelectedRow(res?.data?.resource); + form.setFieldsValue({ + // ...res?.data, + name: `${res?.data?.name}-补充协议` || '', + total_amount: res?.data?.total_amount || 0, + is_deposit: res?.data?.is_deposit ? 'yes' : 'no', + peoples: res?.data?.contract_peoples, + contract_time: [res?.data?.start_time, res?.data?.end_time], + asset_projects_id: res?.data?.asset_projects_id, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + // const onSave = (formData: any, subType: number) => { + // formData?.peoples?.forEach((res: any) => { + // res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + // }); + // console.log(formData, 'formData'); + // Apis.Contract.Contracts.Store({ + // ...formData, + // parent_id: data?.id ?? 0, + // is_deposit: + // IsDepositEnum[formData.is_deposit as keyof typeof IsDepositEnum].value, + // start_time: dayjs(formData?.contract_time?.[0]).format('YYYY-MM-DD'), + // end_time: dayjs(formData?.contract_time?.[1]).format('YYYY-MM-DD'), + // asset_projects_id: data?.asset_projects_id || 0, + // income_expense_type: data?.income_expense_type || 0, + // contract_nature: data?.contract_nature || 0, + // sign_subject: data?.sign_subject || '', + // }) + // .then(() => { + // if (subType) { + // message.success('保存成功'); + // } else { + // message.success('暂存成功'); + // } + // }) + // .catch(() => false); + // }; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + footer={[ + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + Apis.Contract.Contracts.Store({ + ...values, + parent_id: data?.id ?? 0, + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : 'no', + start_time: dayjs(values.contract_time?.[0]).format( + 'YYYY-MM-DD', + ), + end_time: dayjs(values.contract_time?.[1]).format('YYYY-MM-DD'), + asset_projects_id: data?.asset_projects_id || 0, + income_expense_type: data?.income_expense_type || 0, + contract_nature: data?.contract_nature || 0, + sign_subject: data?.sign_subject || '', + contract_liaison: data?.contract_liaison || '', + seal_info: data?.seal_info || '', + contract_types_id: data?.contract_types_id || 0, + }) + .then((res) => { + const newContractId = res?.data?.id; + setContractId(newContractId); + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + />, + ]} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + width="800px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + form={form} + submitter={{ + render: () => { + return []; + }, + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '新增补充协议', + }, + }, + { + key: 'name', + title: '协议名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '补充协议份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + * + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + }, + }), + MyFormItems.EnumSelect({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '是否变更原合同信息', + }, + }, + { + key: 'contract_time', + title: '原合同合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + transform: (value: any) => { + return { + start_time: value?.[0], + end_time: value?.[1], + }; + }, + }, + { + title: '原合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]} + /> +
+
+ +
+ { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+ ); +} diff --git a/src/pages/contract/contracts/pages/contract_add_update.tsx b/src/pages/contract/contracts/pages/contract_add_update.tsx new file mode 100644 index 0000000..c4f08e5 --- /dev/null +++ b/src/pages/contract/contracts/pages/contract_add_update.tsx @@ -0,0 +1,407 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; + +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import dayjs from 'dayjs'; +import { useEffect, useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +// import SubmitReview from '../modals/SubmitReview'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, +} from '@/gen/Enums'; +import ContractsInfoAdd from '../show/components/ContractsInfoAdd'; +import { IsDepositEnum } from './reducer'; +export default function Index({ title = '修改补充协议' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const [contractId, setContractId] = useState(0); + + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [selectedRow, setSelectedRow] = useState({}); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setSelectedRow(res?.data?.resource); + form.setFieldsValue({ + // ...res?.data, + name: `${res?.data?.name}-补充协议` || '', + total_amount: res?.data?.total_amount || 0, + is_deposit: res?.data?.is_deposit ? 'yes' : 'no', + peoples: res?.data?.contract_peoples, + contract_time: [res?.data?.start_time, res?.data?.end_time], + asset_projects_id: res?.data?.asset_projects_id, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + footer={[ + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + Apis.Contract.Contracts.Update({ + ...values, + id: data?.id ?? 0, + parent_id: data?.parent_id ?? 0, + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : 'no', + start_time: dayjs(values.contract_time?.[0]).format( + 'YYYY-MM-DD', + ), + end_time: dayjs(values.contract_time?.[1]).format('YYYY-MM-DD'), + asset_projects_id: data?.asset_projects_id || 0, + income_expense_type: data?.income_expense_type || 0, + contract_nature: data?.contract_nature || 0, + sign_subject: data?.sign_subject || '', + contract_liaison: data?.contract_liaison || '', + seal_info: data?.seal_info || '', + contract_types_id: data?.contract_types_id || 0, + }) + .then((res) => { + const newContractId = res?.data?.id; + setContractId(newContractId); + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + />, + ]} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + width="800px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + form={form} + submitter={{ + render: () => { + return []; + }, + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '新增补充协议', + }, + }, + { + key: 'name', + title: '协议名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '补充协议份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + * + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + }, + }), + MyFormItems.EnumSelect({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '是否变更原合同信息', + }, + }, + { + key: 'contract_time', + title: '原合同合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + transform: (value: any) => { + return { + start_time: value?.[0], + end_time: value?.[1], + }; + }, + }, + { + title: '原合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]} + /> +
+
+ +
+ { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+ ); +} diff --git a/src/pages/contract/contracts/pages/contract_create.tsx b/src/pages/contract/contracts/pages/contract_create.tsx new file mode 100644 index 0000000..1238e9e --- /dev/null +++ b/src/pages/contract/contracts/pages/contract_create.tsx @@ -0,0 +1,1018 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import ModalsResourceSelectList from '@/components/ModalsResourceSelectList'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, + ResourceTypesCategoryEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space, Steps } from 'antd'; +import dayjs from 'dayjs'; +import { useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +// import SubmitReview from '../modals/SubmitReview'; +import { IsDepositEnum } from './reducer'; + +export default function Index({ title = '新增合同' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [selectedRow, setSelectedRow] = useState({}); + const [contractId, setContractId] = useState(0); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + const [currentStep, setCurrentStep] = useState(0); + const [contractData, setContractData] = useState({}); + const [billsLength, setBillsLength] = useState(2); + + const onSave = (data: any) => { + const contractDataToSave = { + ...data, + // sign_department: data.organization?.[data.organization?.length - 1] || '', + is_deposit: data.is_deposit + ? IsDepositEnum[data.is_deposit as keyof typeof IsDepositEnum].value + : 'false', + start_time: dayjs(data.contract_time?.[0]).format('YYYY-MM-DD'), + end_time: dayjs(data.contract_time?.[1]).format('YYYY-MM-DD'), + code: data?.code || '', + }; + Apis.Contract.Contracts.Store(contractDataToSave) + .then((res: any) => { + const contractId = res?.data?.id; + if (contractId) { + setContractId(contractId); + setContractData({ + ...contractDataToSave, + id: contractId, + name: data?.name, + code: data?.code || '', + }); + setCurrentStep(1); + message.success('保存成功'); + } + }) + .catch(() => false); + }; + + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(contractData?.total_amount) - + parseFloat(contractData?.total_bill_amount || 0) + ).toFixed(2), + ); + }; + + const handleBillsSubmit = async (values: any) => { + return new Promise((resolve) => { + let year_month = ''; + let year_month_is = false; + let total_bill_amount = totalBillSeparableAmount(); + let taotal_amount = 0; + let period_nums = new Set(); + let has_duplicate_period = false; + if ( + total_bill_amount <= 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + message.warning('没有多余金额可生成账单!'); + resolve(false); + return; + } + values?.bills?.forEach((res: any) => { + if (values?.payee === values?.payer) { + year_month_is = true; + message.warning('收款方和付款方不能相同'); + resolve(false); + return false; + } + res.payee = values?.payee; + res.payer = values?.payer; + if (year_month_is || has_duplicate_period) return; + if (res?.year_month === year_month) { + year_month_is = true; + message.warning('不能选择相同年月'); + resolve(false); + return false; + } + year_month = res?.year_month; + + // 验证期数是否重复 + if (period_nums.has(res?.period_num)) { + has_duplicate_period = true; + message.warning('不能有相同的期数'); + resolve(false); + return false; + } + period_nums.add(res?.period_num); + // 处理不同类型的year_month值 + let year, month; + if (res?.year_month) { + if (typeof res.year_month === 'string') { + const k = res.year_month.split('-'); + year = k[0]; + month = k[1] ? parseInt(k[1]) : 0; + } else if (typeof res.year_month.format === 'function') { + // 处理dayjs/moment对象 + year = res.year_month.format('YYYY'); + month = parseInt(res.year_month.format('MM')); + } else if (res.year_month.getFullYear) { + // 处理Date对象 + year = res.year_month.getFullYear().toString(); + month = res.year_month.getMonth() + 1; + } else { + year = ''; + month = 0; + } + } else { + year = ''; + month = 0; + } + res.year = year; + res.month = month; + if (contractData?.settlement_mode === 'LumpSumContract') { + taotal_amount += parseFloat(res?.amount); + } + }); + if ( + contractData?.settlement_mode === 'LumpSumContract' && + taotal_amount !== total_bill_amount + ) { + message.warning(`账单¥${total_bill_amount},拆分错误!`); + resolve(false); + return; + } + if (year_month_is || has_duplicate_period) { + resolve(false); + return; + } + if (contractData?.settlement_mode === 'OpenContract') { + //开口合同 + Apis.Contract.ContractBills.BatchStore({ + ...values, + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else if ( + total_bill_amount > 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + if (taotal_amount <= total_bill_amount) { + Apis.Contract.ContractBills.BatchStore({ + ...values, + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else { + message.warning('可拆分金额不够!'); + resolve(false); + } + } else { + resolve(false); + } + }); + }; + + return ( + { + navigate(-1); + }} + > + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + + {/* 第一步:合同信息填写 */} + {currentStep === 0 && ( + + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="form" + width="800px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + form={form} + submitter={{ + render: () => { + const values = form.getFieldsValue(); + const incomeExpenseType = values?.income_expense_type; + return [ + incomeExpenseType !== 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + form?.validateFields().then(() => { + onSave(values); + }); + }} + title="下一步" + /> + ), + incomeExpenseType === 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = + res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + // 调用保存合同的API + Apis.Contract.Contracts.Store({ + ...values, + sign_department: + values.organization?.[ + values.organization?.length - 1 + ], + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : false, + start_time: dayjs( + values.contract_time?.[0], + ).format('YYYY-MM-DD'), + end_time: dayjs(values.contract_time?.[1]).format( + 'YYYY-MM-DD', + ), + asset_projects_id: values.asset_projects_id, + }) + .then((res: any) => { + const id = res.data.id; + setContractId(id); + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + /> + ), + ]; + }, + }} + onFinish={async (values: any) => { + onSave(values); + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '基本信息', + }, + }, + MyFormItems.EnumRadio({ + key: 'income_expense_type', + title: '收支类型', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + buttonStyle: 'solid', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('settlement_mode', undefined); + form.setFieldValue('total_amount', undefined); + }, + }, + }), + { + key: 'name', + title: '合同名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'contract_time', + title: '合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'contract_nature', + title: '合同性质', + valueEnum: ContractsContractNatureEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + SelectContract.ContractTypes({ + title: '合同类型', + key: 'contract_types_id', + required: true, + colProps: { span: 12 }, + fieldProps: { + placeholder: '请选择合同类型', + }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['income_expense_type'], + columns: ({ income_expense_type }) => { + return income_expense_type === 'None' + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'settlement_mode', + title: '结算模式', + valueEnum: ContractsSettlementModeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + title: '合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]; + }, + }, + + SelectContract.SupplierName({ + key: 'sign_subject', + title: '选择签约主体', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 24 }, + required: true, + }), + SelectContract.AssetProjects({ + key: 'asset_projects_id', + title: '选择关联项目', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + // mode: 'multiple', + }, + }), + SelectContract.EmployeeName({ + key: 'contract_liaison', + title: '合同对接人', + colProps: { span: 24 }, + required: true, + }), + { + title: '合同份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'dependency', + name: ['contract_time'], + columns: ({ contract_time }) => { + return contract_time?.length + ? [ + { + colProps: { span: 24 }, + title: '关联资源', + key: 'resources_id', + renderFormItem: () => { + return ( + + + { + setSelectedRow(e); + form.setFieldsValue({ + resources_id: e?.id, + }); + }} + /> + {selectedRow?.name ? ( +
+ 已选择 + { + ResourceTypesCategoryEnum[ + selectedRow?.category as keyof typeof ResourceTypesCategoryEnum + ]?.text + } + 资源:{selectedRow?.name} +
+ ) : ( + '' + )} +
+
+ ); + }, + }, + ] + : []; + }, + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + + * + + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumRadio({ + key: 'sign_party', + // title: `交易方`, + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + buttonStyle: 'solid', + }, + }), + MyFormItems.EnumRadio({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 7 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 10 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择供应商', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 10 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择内部公司', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 10 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '合同附件', + }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '印章申请', + }, + }, + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + ]} + /> + )} + + {/* 第二步:账单设置 */} + {currentStep === 1 && ( + + {...MyModalFormProps.props} + wrapperCol={{ span: 24 }} + width="1200px" + layoutType="Form" + onFinish={async (values: any) => { + handleBillsSubmit(values); + }} + submitter={{ + render: (props) => { + return [ + { + setCurrentStep(0); + }} + title="上一步" + />, + // { + // props.submit(); + // }} + // title="提交" + // />, + { + // 先提交账单,然后显示提审弹窗 + const formInstance = props?.form; + formInstance?.validateFields().then(() => { + const values = formInstance.getFieldsValue(); + handleBillsSubmit(values).then((success) => { + if (success) { + setSubmitModalVisible(true); + } + }); + }); + }} + title="提交并审核" + />, + ]; + }, + }} + columns={[ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+
+ 收支类型: + {contractData?.income_expense_type === 'Income' + ? '收入' + : '支出'} +
+
+ 结算模式: + {contractData?.settlement_mode === + 'LumpSumContract' + ? '总价合同' + : '开口合同'} +
+
+ 总金额:¥ + {contractData?.total_amount} +
+
+ 剩余可生成账单金额: + {contractData?.settlement_mode === + 'LumpSumContract' && ( + + ¥{totalBillSeparableAmount()} + + )} +
+
+
+
+ ); + }, + }, + { + valueType: 'divider', + title: '账单设置', + fieldProps: { + orientation: 'left', + children: '账单设置', + }, + }, + + { + title: '收款方', + valueType: 'select', + dataIndex: 'payee', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: contractData?.peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (contractData?.income_expense_type === 'Income') { + return item?.counterparty_type === 'InternalCompany'; + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + title: '付款方', + valueType: 'select', + dataIndex: 'payer', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: contractData?.peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (contractData?.income_expense_type === 'Expense') { + return item?.counterparty_type === 'InternalCompany'; + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + valueType: 'formList', + dataIndex: 'bills', + // title: '账单设置', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + creatorButtonProps: { + creatorButtonText: '添加合同账单', + style: { + color: '#1890FF', + }, + }, + creatorRecord: () => { + const nextPeriodNum = billsLength + 1; + setBillsLength(nextPeriodNum); + return { + cost_type: contractData?.income_expense_type, + period_num: nextPeriodNum, + }; + }, + onChange: (values: any) => { + setBillsLength(values.length); + }, + }, + initialValue: [ + { + cost_type: contractData?.income_expense_type, + period_num: 1, + }, + { + cost_type: contractData?.income_expense_type, + period_num: 2, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '类型', + dataIndex: 'cost_type', + colProps: { span: 2 }, + align: 'center', + renderFormItem: () => { + let res = { + text: + contractData?.income_expense_type === 'Income' + ? '收入' + : '支出', + color: + contractData?.income_expense_type === 'Income' + ? 'green' + : 'blue', + }; + return contractData?.income_expense_type ? ( + + {res?.text} + + ) : ( + '-' + ); + }, + }, + { + title: '期数', + valueType: 'digit', + dataIndex: 'period_num', + colProps: { span: 2 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + maxLength: 2, + }, + }, + }, + { + title: '账单年月', + valueType: 'dateMonth', + dataIndex: 'year_month', + colProps: { span: 3 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + + { + title: '账单金额', + valueType: 'digit', + dataIndex: 'amount', + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + addonAfter: '元', + }, + }, + { + title: '关联标地', + formItemProps: { ...rulesHelper.text }, + dataIndex: 'object_name', + colProps: { span: 8 }, + }, + { + title: '备注', + dataIndex: 'remark', + colProps: { span: 5 }, + }, + ], + }, + ], + }, + ]} + /> + )} + + {/* 提审弹窗 */} + { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contracts/pages/contract_update.tsx b/src/pages/contract/contracts/pages/contract_update.tsx new file mode 100644 index 0000000..9e978d9 --- /dev/null +++ b/src/pages/contract/contracts/pages/contract_update.tsx @@ -0,0 +1,1063 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import ModalsResourceSelectList from '@/components/ModalsResourceSelectList'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, + ResourceTypesCategoryEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space, Steps } from 'antd'; +import dayjs from 'dayjs'; +import { useEffect, useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +import { IsDepositEnum } from './reducer'; + +export default function Index({ title = '编辑合同' }) { + const [form] = Form.useForm(); + const [form2] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [selectedRow, setSelectedRow] = useState({}); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + const [currentStep, setCurrentStep] = useState(0); + const [contractData, setContractData] = useState({}); + // const [billsData, setBillsData] = useState([]); + + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + const contractData = res?.data; + setShow(contractData); + setContractData(contractData); + setSelectedRow(res?.data?.resource); + // 提取账单数据 + // const bills = contractData?.contract_bills || []; + // setBillsData(bills); + form2.setFieldsValue({ + ...contractData, + payee: res?.data?.contract_bills?.[0]?.payee, + payer: res?.data?.contract_bills?.[0]?.payer, + bills: res?.data?.contract_bills?.map((item: any) => ({ + ...item, + object_name: res?.data?.contract_bill_objects?.find( + (i: any) => i?.contract_bills_id === item?.id, + )?.name, + year_month: `${item?.year}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`, + })), + }); + form.setFieldsValue({ + ...contractData, + is_deposit: contractData?.is_deposit ? 'yes' : 'no', + peoples: contractData?.contract_peoples, + contract_time: [contractData?.start_time, contractData?.end_time], + asset_projects_id: contractData?.asset_projects_id, + seal_info: contractData?.seal_info, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + const onSave = (formData: any, subType: number = 1) => { + // formData?.peoples?.forEach((res: any) => { + // res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + // }); + const contractDataToSave = { + ...formData, + is_deposit: + IsDepositEnum[formData.is_deposit as keyof typeof IsDepositEnum].value, + id: data?.id ?? 0, + start_time: dayjs(formData?.contract_time?.[0]).format('YYYY-MM-DD'), + end_time: dayjs(formData?.contract_time?.[1]).format('YYYY-MM-DD'), + }; + Apis.Contract.Contracts.Update(contractDataToSave) + .then(() => { + // 更新contractData,以便在第二步编辑账单时使用 + setContractData({ + ...contractDataToSave, + id: data?.id, + name: formData?.name, + code: formData?.code, + }); + if (subType) { + // 如果是保存并进入下一步 + setCurrentStep(1); + message.success('保存成功'); + } else { + message.success('暂存成功'); + } + }) + .catch(() => false); + }; + + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(contractData?.total_amount) - + parseFloat(contractData?.total_bill_amount || 0) + ).toFixed(2), + ); + }; + + const handleBillsSubmit = async (values: any) => { + return new Promise((resolve) => { + let year_month = ''; + let year_month_is = false; + let total_bill_amount = totalBillSeparableAmount(); + let taotal_amount = 0; + let period_nums = new Set(); + let has_duplicate_period = false; + if ( + total_bill_amount <= 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + message.warning('没有多余金额可生成账单!'); + resolve(false); + return; + } + values?.bills?.forEach((res: any) => { + if (values?.payee === values?.payer) { + year_month_is = true; + message.warning('收款方和付款方不能相同'); + resolve(false); + return false; + } + res.payee = values?.payee; + res.payer = values?.payer; + if (year_month_is || has_duplicate_period) return; + if (res?.year_month === year_month) { + year_month_is = true; + message.warning('不能选择相同年月'); + resolve(false); + return false; + } + year_month = res?.year_month; + + // 验证期数是否重复 + if (period_nums.has(res?.period_num)) { + has_duplicate_period = true; + message.warning('不能有相同的期数'); + resolve(false); + return false; + } + period_nums.add(res?.period_num); + // 处理不同类型的year_month值 + let year, month; + if (res?.year_month) { + if (typeof res.year_month === 'string') { + const k = res.year_month.split('-'); + year = k[0]; + month = k[1] ? parseInt(k[1]) : 0; + } else if (typeof res.year_month.format === 'function') { + // 处理dayjs/moment对象 + year = res.year_month.format('YYYY'); + month = parseInt(res.year_month.format('MM')); + } else if (res.year_month.getFullYear) { + // 处理Date对象 + year = res.year_month.getFullYear().toString(); + month = res.year_month.getMonth() + 1; + } else { + year = ''; + month = 0; + } + } else { + year = ''; + month = 0; + } + res.year = year; + res.month = month; + if (contractData?.settlement_mode === 'LumpSumContract') { + taotal_amount += parseFloat(res?.amount); + } + }); + if ( + contractData?.settlement_mode === 'LumpSumContract' && + taotal_amount !== total_bill_amount + ) { + message.warning(`账单¥${total_bill_amount},拆分错误!`); + resolve(false); + return; + } + if (year_month_is || has_duplicate_period) { + resolve(false); + return; + } + if (contractData?.settlement_mode === 'OpenContract') { + //开口合同 + console.log(data, '是你'); + Apis.Contract.ContractBills.BatchUpdate({ + ...values, + bills: values?.bills?.map((item: any, index: number) => { + let row = data?.contract_bills[index]; + let res = { + ...row, + ...item, + object_name: item?.object_name, + object_id: data?.contract_bill_objects?.find( + (i: any) => i?.contract_bills_id === row?.id, + )?.id, + }; + return res; + }), + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else if ( + total_bill_amount > 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + if (taotal_amount <= total_bill_amount) { + Apis.Contract.ContractBills.BatchUpdate({ + ...values, + bills: values?.bills?.map((item: any, index: number) => { + let row = data?.contract_bills[index]; + let res = { + ...row, + ...item, + object_name: item?.object_name, + object_id: data?.contract_bill_objects?.find( + (i: any) => i?.contract_bills_id === row?.id, + )?.id, + }; + return res; + }), + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else { + message.warning('可拆分金额不够!'); + resolve(false); + } + } else { + resolve(false); + } + }); + }; + + return ( + { + navigate(-1); + }} + > + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + + {/* 第一步:合同信息填写 */} + {currentStep === 0 && ( + { + const values = form.getFieldsValue(); + const incomeExpenseType = values?.income_expense_type; + return [ + incomeExpenseType !== 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + form?.validateFields().then(() => { + onSave(values, 1); + }); + }} + title="下一步" + /> + ), + incomeExpenseType === 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + // values?.peoples?.forEach((res: any) => { + // res.company_suppliers_id = + // res?.counterparty?.split(':')?.[0]; + // }); + form?.validateFields().then(() => { + Apis.Contract.Contracts.Update({ + ...values, + id: data?.id ?? 0, + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : 'no', + start_time: dayjs( + values.contract_time?.[0], + ).format('YYYY-MM-DD'), + end_time: dayjs(values.contract_time?.[1]).format( + 'YYYY-MM-DD', + ), + asset_projects_id: values.asset_projects_id, + }) + .then(() => { + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + /> + ), + ]; + }, + }} + onFinish={(values) => { + onSave(values, 1); + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '基本信息', + }, + }, + MyFormItems.EnumRadio({ + key: 'income_expense_type', + title: '收支类型', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + buttonStyle: 'solid', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('settlement_mode', undefined); + form.setFieldValue('total_amount', undefined); + }, + }, + }), + { + key: 'name', + title: '合同名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'contract_time', + title: '合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'contract_nature', + title: '合同性质', + valueEnum: ContractsContractNatureEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + SelectContract.ContractTypes({ + title: '合同类型', + key: 'contract_types_id', + required: true, + colProps: { span: 12 }, + fieldProps: { + placeholder: '请选择合同类型', + }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['income_expense_type'], + columns: ({ income_expense_type }) => { + return income_expense_type === 'None' + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'settlement_mode', + title: '结算模式', + valueEnum: ContractsSettlementModeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + title: '合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]; + }, + }, + + SelectContract.SupplierName({ + key: 'sign_subject', + title: '选择签约主体', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 24 }, + required: true, + }), + SelectContract.AssetProjects({ + key: 'asset_projects_id', + title: '选择关联项目', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + }, + }), + SelectContract.EmployeeName({ + key: 'contract_liaison', + title: '合同对接人', + colProps: { span: 24 }, + required: true, + }), + { + title: '合同份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'dependency', + name: ['contract_time'], + columns: ({ contract_time }) => { + console.log(contract_time, 'contract_time'); + return contract_time?.length || data?.start_time + ? [ + { + colProps: { span: 24 }, + title: '关联资源', + key: 'resources_id', + renderFormItem: () => { + return ( + + + { + setSelectedRow(e); + form.setFieldsValue({ + resources_id: e?.id, + }); + }} + /> + {selectedRow?.name ? ( +
+ 已选择 + { + ResourceTypesCategoryEnum[ + selectedRow?.category as keyof typeof ResourceTypesCategoryEnum + ]?.text + } + 资源:{selectedRow?.name} +
+ ) : ( + '' + )} +
+
+ ); + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + + * + + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumRadio({ + key: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + buttonStyle: 'solid', + }, + }), + MyFormItems.EnumRadio({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 7 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + // fieldProps: { + // buttonStyle: 'solid', + // onChange: () => { + // // 切换计量单位时清空计费模式 + // form.setFieldValue('counterparty', undefined); + // }, + // }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 10 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择供应商', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 10 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择内部公司', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 10 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '合同附件', + }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + required: true, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '印章申请', + }, + }, + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + ]} + /> + )} + + {/* 第二步:账单设置 */} + {currentStep === 1 && ( + + {...MyModalFormProps.props} + wrapperCol={{ span: 24 }} + width="1200px" + form={form2} + layoutType="Form" + onFinish={async (values: any) => { + handleBillsSubmit(values); + }} + submitter={{ + render: (props) => { + return [ + { + setCurrentStep(0); + }} + title="上一步" + />, + // { + // props.submit(); + // }} + // title="提交" + // />, + { + // 先提交账单,然后显示提审弹窗 + const formInstance = props?.form; + formInstance?.validateFields().then(() => { + const values = formInstance.getFieldsValue(); + handleBillsSubmit(values).then((success) => { + if (success) { + setSubmitModalVisible(true); + } + }); + }); + }} + title="提交并审核" + />, + ]; + }, + }} + columns={[ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+
+ 收支类型: + {contractData?.income_expense_type === 'Income' + ? '收入' + : '支出'} +
+
+ 结算模式: + {contractData?.settlement_mode === + 'LumpSumContract' + ? '总价合同' + : '开口合同'} +
+
+ 总金额:¥ + {contractData?.total_amount} +
+
+ 剩余可生成账单金额: + {contractData?.settlement_mode === + 'LumpSumContract' && ( + + ¥{totalBillSeparableAmount()} + + )} +
+
+
+
+ ); + }, + }, + { + valueType: 'divider', + title: '账单设置', + fieldProps: { + orientation: 'left', + children: '账单设置', + }, + }, + + { + title: '收款方', + valueType: 'select', + dataIndex: 'payee', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: contractData?.peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (contractData?.income_expense_type === 'Income') { + return item?.counterparty_type === 'InternalCompany'; + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + title: '付款方', + valueType: 'select', + dataIndex: 'payer', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: contractData?.peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (contractData?.income_expense_type === 'Expense') { + return item?.counterparty_type === 'InternalCompany'; + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + valueType: 'formList', + dataIndex: 'bills', + // title: '账单设置', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + creatorRecord: { + cost_type: contractData?.income_expense_type, + }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '类型', + dataIndex: 'cost_type', + colProps: { span: 2 }, + align: 'center', + renderFormItem: () => { + let res = { + text: + contractData?.income_expense_type === 'Income' + ? '收入' + : '支出', + color: + contractData?.income_expense_type === 'Income' + ? 'green' + : 'blue', + }; + return contractData?.income_expense_type ? ( + + {res?.text} + + ) : ( + '-' + ); + }, + }, + { + title: '账单年月', + valueType: 'dateMonth', + dataIndex: 'year_month', + colProps: { span: 3 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '期数', + valueType: 'digit', + dataIndex: 'period_num', + colProps: { span: 2 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + maxLength: 2, + }, + }, + }, + { + title: '账单金额', + valueType: 'digit', + dataIndex: 'amount', + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + addonAfter: '元', + }, + }, + { + title: '关联标地', + formItemProps: { ...rulesHelper.text }, + dataIndex: 'object_name', + colProps: { span: 8 }, + }, + { + title: '备注', + dataIndex: 'remark', + colProps: { span: 5 }, + }, + ], + }, + ], + }, + ]} + /> + )} + + { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contracts/pages/reducer.ts b/src/pages/contract/contracts/pages/reducer.ts new file mode 100644 index 0000000..4a45af0 --- /dev/null +++ b/src/pages/contract/contracts/pages/reducer.ts @@ -0,0 +1,4 @@ +export const IsDepositEnum = { + yes: { text: '是', key: 'yes', value: true }, + no: { text: '否', key: 'no', value: false }, +}; diff --git a/src/pages/contract/contracts/show/$id.tsx b/src/pages/contract/contracts/show/$id.tsx new file mode 100644 index 0000000..f4a15bd --- /dev/null +++ b/src/pages/contract/contracts/show/$id.tsx @@ -0,0 +1,90 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; + +import { useNavigate, useParams, useSearchParams } from '@umijs/max'; +import { Space, Tabs, TabsProps } from 'antd'; +import { useEffect, useState } from 'react'; +import MyArchivingLogs from './components/ArchivingLogs'; +import MyContractBillObjects from './components/ContractBillObjects'; +import MyContractBills from './components/ContractBills'; +import ContractDisputeRecords from './components/ContractDisputeRecords'; +import ContractsAdd from './components/ContractsAdd'; +import MyContractsInfo from './components/ContractsInfo'; +import MyUsedLogs from './components/UsedLogs'; + +export default function Index({ title = '合同详情' }) { + const navigate = useNavigate(); + const { id } = useParams<{ id: string }>(); + const [showData, setDataShow] = useState({}); + const [searchParams] = useSearchParams(); + const activeKey = searchParams?.get('key') || '1'; + + const items: TabsProps['items'] = [ + { + key: '1', + label: '基本信息', + children: , + }, + { + key: '2', + label: '用印记录', + children: , + }, + { + key: '4', + label: '合同账单', + children: , + }, + { + key: '3', + label: '合同标地', + children: , + }, + { + key: '5', + label: '归档记录', + children: , + }, + { + key: '6', + label: '争议处理记录', + children: , + }, + { + key: '7', + label: '补充协议', + children: , + }, + ]; + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + setDataShow(res?.data); + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + + + + + ); +} diff --git a/src/pages/contract/contracts/show/components/ArchivingLogs.tsx b/src/pages/contract/contracts/show/components/ArchivingLogs.tsx new file mode 100644 index 0000000..1b727a4 --- /dev/null +++ b/src/pages/contract/contracts/show/components/ArchivingLogs.tsx @@ -0,0 +1,124 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +import Show from '../../../contract_archives/finished/modals/Show'; + +export default function Index(props: MyBetaModalFormProps) { + const navigate = useNavigate(); + return ( + + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractArchives.List, + ) + } + headerTitle="归档记录" + search={false} + // toolBarRender={(action) => [ + // , + // ]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '归档编号', + dataIndex: 'code', + render: (_, item: any) => ( + { + navigate( + `/contract/contract_archives/show/${item.contracts_id}`, + ); + }} + > + {item?.code} + + ), + }, + { + title: '归档名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '保密等级', + dataIndex: 'confidentiality_level', + valueEnum: ContractArchivesConfidentialityLevelEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '期限类型', + dataIndex: 'period_type', + valueEnum: ContractArchivesPeriodTypeEnum, + search: false, + }), + { + title: '保管年限', + dataIndex: 'storage_years', + valueType: 'digit', + search: false, + }, + // { + // title: '案卷编号', + // dataIndex: 'file_number', + // }, + { + title: '文件盒编号', + dataIndex: 'box_number', + }, + { + title: '文件柜编号', + dataIndex: 'cabinet_number', + }, + { + title: '归档年份', + dataIndex: 'archive_year', + valueType: 'dateYear', + search: false, + }, + { + title: '归档日期', + dataIndex: 'archive_date', + valueType: 'date', + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + {/* + + Apis.Contract.ContractArchives.Delete({ id: item.id }).then( + () => action?.reload(), + ) + } + /> */} + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/components/ContractBillObjects.tsx b/src/pages/contract/contracts/show/components/ContractBillObjects.tsx new file mode 100644 index 0000000..b384b73 --- /dev/null +++ b/src/pages/contract/contracts/show/components/ContractBillObjects.tsx @@ -0,0 +1,59 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ContractBillObjectsStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import MyCompleteApply from '../../../contract_bills/modals/CompleteApply'; +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractBillObjects.List, + ) + } + headerTitle="合同标地" + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + + { + title: '标的名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ContractBillObjectsStatusEnum, + }), + { + title: '标的金额', + dataIndex: 'amount', + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/components/ContractBills.tsx b/src/pages/contract/contracts/show/components/ContractBills.tsx new file mode 100644 index 0000000..8e31670 --- /dev/null +++ b/src/pages/contract/contracts/show/components/ContractBills.tsx @@ -0,0 +1,131 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsAuditStatusEnum, + ContractBillsCostTypeEnum, + HouseOrdersOrderStatusEnum, +} from '@/gen/Enums'; +import CompleteApply from '@/pages/contract/contract_bills/modals/CompleteApply'; +import PayBills from '@/pages/contract/contract_bills/modals/PayBills'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index(props: MyBetaModalFormProps) { + const navigate = useNavigate(); + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractBills.List, + ) + } + headerTitle="账单列表" + toolBarRender={(action) => [ + { + navigate( + `/contract/contract_bills/pages/create?id=${props?.item?.id}`, + ); + }} + disabled={ + props?.item?.status === 'TemporaryStorage' || + props?.item?.status === 'UnderApproval' || + props?.item?.status === 'Rejected' || + props?.item?.status === 'Terminating' || + props?.item?.status === 'Terminated' || + props?.item?.status === 'Voided' || + props?.item?.status === 'Canceled' + } + title="添加账单" + />, + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '账单月', + search: false, + render: (_, item: any) => { + return `${item?.year || 0}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`; + }, + }, + { + title: '期数', + dataIndex: 'period_num', + search: false, + }, + + MyColumns.EnumTag({ + title: '支付状态', + dataIndex: 'payment_status', + valueEnum: HouseOrdersOrderStatusEnum, + }), + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'cost_type', + valueEnum: ContractBillsCostTypeEnum, + }), + { + title: '账单金额', + search: false, + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + MyColumns.EnumTag({ + title: '付款审核', + dataIndex: 'audit_status', + valueEnum: ContractBillsAuditStatusEnum, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + { + navigate( + `/contract/contract_bills/pages/update?id=${item.id}`, + ); + }} + title="编辑" + /> + + Apis.Contract.ContractBills.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/components/ContractDisputeRecords.tsx b/src/pages/contract/contracts/show/components/ContractDisputeRecords.tsx new file mode 100644 index 0000000..503c668 --- /dev/null +++ b/src/pages/contract/contracts/show/components/ContractDisputeRecords.tsx @@ -0,0 +1,82 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from '../modals/Create'; +import Update from '../modals/Update'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractDisputeRecords.List, + ) + } + toolBarRender={(action) => [ + , + ]} + headerTitle="争议记录列表" + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '争议原因', + dataIndex: 'reason', + }, + { + title: '处理内容', + dataIndex: 'content', + search: false, + }, + { + title: '附件', + search: false, + render: (_, item: any) => { + return ( + + {item?.attachments?.map((res: any, index: number) => { + return ( + + {res?.name} + + ); + })} + + ); + }, + }, + + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Contract.ContractDisputeRecords.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/components/ContractsAdd.tsx b/src/pages/contract/contracts/show/components/ContractsAdd.tsx new file mode 100644 index 0000000..8a4631b --- /dev/null +++ b/src/pages/contract/contracts/show/components/ContractsAdd.tsx @@ -0,0 +1,69 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ContractsStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import dayjs from 'dayjs'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { + params, + is_agreement: true, + parent_id: props?.item?.id, + }, + sort, + Apis.Contract.Contracts.List, + ) + } + headerTitle="补充协议" + search={false} + columns={[ + MyColumns.ID({ search: false }), + MyColumns.EnumTag({ + title: '合同状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + }), + { + title: '合同编号', + dataIndex: 'code', + }, + { + title: '合同名称', + dataIndex: 'name', + }, + + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + + search: false, + }, + { + title: '合同对接人', + dataIndex: 'contract_liaison', + search: false, + }, + { + title: '用印日期', + dataIndex: 'sign_time', + valueType: 'date', + }, + MyColumns.CreatedAt(), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/components/ContractsInfo.tsx b/src/pages/contract/contracts/show/components/ContractsInfo.tsx new file mode 100644 index 0000000..972c571 --- /dev/null +++ b/src/pages/contract/contracts/show/components/ContractsInfo.tsx @@ -0,0 +1,135 @@ +import { + MyBetaModalFormProps, + MyColumns, + MyProTableProps, + renderTextHelper, +} from '@/common'; +import { showTime } from '@/common/utils/day'; +import MyShowAttachments from '@/components/ShowAttachments'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions, ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function ContractsInfo(props: MyBetaModalFormProps) { + return ( + + + + + + + + {props?.item?.name} + + + {props?.item?.code} + + + + + + {props?.item?.contract_type_name} + + + + + + + + + ¥{props?.item?.total_amount} + + + + + {showTime(props?.item?.start_time, 10)}至 + {showTime(props?.item?.end_time, 10)} + + + + + ¥{props?.item?.total_bill_amount} + + + ¥{props?.item?.total_income_amount} + + + ¥{props?.item?.total_expense_amount} + + + {props?.item?.is_deposit ? '是' : '否'} + + + ¥{props?.item?.deposit_amount || '-'} + + + {props?.item?.sign_subject} + + + {props?.item?.project_name || '-'} + + {/* + {props?.item?.sign_department || '-'} + */} + + {props?.item?.contract_liaison || '-'} + + + {props?.item?.number_contract_copies || '-'}份 + + + + + > + {...MyProTableProps.props} + headerTitle="交易双方" + search={false} + options={false} + pagination={false} + dataSource={props?.item?.contract_peoples || []} + columns={[ + { + title: '签约方', + dataIndex: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + }, + { + title: '名称', + dataIndex: 'counterparty', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'counterparty_type', + valueEnum: CompanySuppliersCounterpartyEnum, + }), + ]} + /> + + + ); +} diff --git a/src/pages/contract/contracts/show/components/ContractsInfoAdd.tsx b/src/pages/contract/contracts/show/components/ContractsInfoAdd.tsx new file mode 100644 index 0000000..521b6b4 --- /dev/null +++ b/src/pages/contract/contracts/show/components/ContractsInfoAdd.tsx @@ -0,0 +1,105 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { showTime } from '@/common/utils/day'; +import { + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function ContractsInfo(props: MyBetaModalFormProps) { + return ( + + + + + + + + {props?.item?.name} + + + {props?.item?.code} + + + + + + {props?.item?.contract_type_name} + + + + + + + + + ¥{props?.item?.total_amount} + + + + {showTime(props?.item?.start_time, 10)}至 + {showTime(props?.item?.end_time, 10)} + + + + ¥{props?.item?.total_bill_amount} + + + ¥{props?.item?.total_income_amount} + + + ¥{props?.item?.total_expense_amount} + + + {props?.item?.is_deposit ? '是' : '否'} + + + ¥{props?.item?.deposit_amount || '-'} + + + {props?.item?.sign_subject} + + + {props?.item?.project_name || '-'} + + {/* + {props?.item?.sign_department || '-'} + */} + + {props?.item?.contract_liaison || '-'} + + + {props?.item?.number_contract_copies || '-'}份 + + + + {props?.item?.contract_peoples?.map((item: any, index: number) => ( +
{item.counterparty}
+ )) || '-'} +
+
+
+
+ ); +} diff --git a/src/pages/contract/contracts/show/components/UsedLogs.tsx b/src/pages/contract/contracts/show/components/UsedLogs.tsx new file mode 100644 index 0000000..ef7a769 --- /dev/null +++ b/src/pages/contract/contracts/show/components/UsedLogs.tsx @@ -0,0 +1,85 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useParams } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index(props: MyBetaModalFormProps) { + const { id } = useParams<{ id: string }>(); + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractSealLogs.List, + ) + } + headerTitle="用印列表" + params={{ contracts_id: id }} + // toolBarRender={(action) => [ + // , + // ]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '合同名称', + dataIndex: ['contract', 'name'], + }, + { + title: '合同编号', + dataIndex: ['contract', 'code'], + }, + { + title: '合同编号', + dataIndex: 'code', + hidden: true, + }, + { + title: '合同ID', + dataIndex: 'contracts_id', + }, + { + title: '印章', + search: false, + render: (_, item: any) => ( + + {item?.seal_info?.map((res: any) => { + return res?.company_name; + })} + + ), + }, + { + title: '申请用印人', + dataIndex: ['company_employee', 'name'], + search: false, + }, + { + title: '用印合同', + dataIndex: 'number_contract_copies', + search: false, + }, + // MyColumns.Boolean({ + // dataIndex: 'is_external_seal_usage', + // title: '是否外出用印', + // search: false, + // }), + { + title: '操作印章人', + dataIndex: ['operator_employee', 'name'], + search: false, + }, + MyColumns.CreatedAt(), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/modals/Create.tsx b/src/pages/contract/contracts/show/modals/Create.tsx new file mode 100644 index 0000000..16d5105 --- /dev/null +++ b/src/pages/contract/contracts/show/modals/Create.tsx @@ -0,0 +1,67 @@ +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 Archives(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}`} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractDisputeRecords.Store({ + ...values, + contracts_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '争议原因', + key: 'reason', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + title: '处理内容', + key: 'content', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '附件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + className: 'my_upload_file', + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts/show/modals/Update.tsx b/src/pages/contract/contracts/show/modals/Update.tsx new file mode 100644 index 0000000..68f5a4b --- /dev/null +++ b/src/pages/contract/contracts/show/modals/Update.tsx @@ -0,0 +1,66 @@ +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 Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`归档信息${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values: any) => + Apis.Contract.ContractDisputeRecords.Update({ + ...values, + id: props?.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功!'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '争议原因', + key: 'reason', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + title: '处理内容', + key: 'content', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '附件', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + className: 'my_upload_file', + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/index.tsx b/src/pages/contract/contracts_add/index.tsx new file mode 100644 index 0000000..7153396 --- /dev/null +++ b/src/pages/contract/contracts_add/index.tsx @@ -0,0 +1,234 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + ContractsContractNatureEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Dropdown, Space } from 'antd'; +import dayjs from 'dayjs'; + +import Archives from '../contract_archives/unfinished/modals/Archive'; +import UseSeal from '../contract_seal_logs/unused/modals/UseSeal'; +import Terminated from './modals/Terminated'; +import Voided from './modals/Voided'; + +export default function Index({ title = '补充协议' }) { + const navigate = useNavigate(); + const [searchParams, setSearchParams]: any = useSearchParams(); + const getCurrentPermissions = useCurrentPermissions(); + + let tableRender = (item: any, action: any) => { + console.log(item, 'item'); + let permissions = getCurrentPermissions({ + update: ( + { + navigate( + `/contract/contracts/pages/contract_add_update?id=${item.id}`, + ); + }} + title="编辑" + /> + ), + }); + + let permissionsSpace = getCurrentPermissions({ + useseal: { + key: '1', + label: ( + + ), + }, + + archives: { + key: '3', + label: ( + + ), + }, + + terminated: { + key: '5', + label: , + }, + voided: { + key: '6', + label: , + }, + delete: { + key: '8', + label: ( + + Apis.Contract.Contracts.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + }); + + let Others = ( + + + + ); + return [...permissions, ...[Others]]; + }; + + return ( + + { + setSearchParams(params); + return MyProTableProps.request( + { + params, + is_agreement: true, + }, + sort, + Apis.Contract.Contracts.List, + ); + }} + headerTitle="补充协议" + // toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '关联项目', + key: 'asset_projects_id', + hidden: true, + }), + + MyColumns.EnumTag({ + title: '合同状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + fieldProps: { + defaultValue: searchParams?.get('status') || undefined, + }, + }), + { + title: '合同编号', + dataIndex: 'code', + }, + { + title: '合同名称', + dataIndex: 'name', + // render: (_, item: any) => { + // return ( + // { + // navigate(`/contract/contracts/show/${item.id}`); + // }} + // > + // {item?.name} + // + // ); + // }, + }, + { + title: '合同类型', + dataIndex: 'contract_type_name', + search: false, + }, + + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + }), + MyColumns.EnumTag({ + title: '合同性质', + dataIndex: 'contract_nature', + valueEnum: ContractsContractNatureEnum, + search: false, + }), + + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + + search: false, + }, + { + title: '合同对接人', + dataIndex: 'contract_liaison', + search: false, + }, + { + title: '用印日期', + dataIndex: 'sign_time', + valueType: 'date', + render: (_, item: any) => { + return item.sign_time + ? dayjs(item.sign_time).format('YYYY-MM-DD') + : '-'; + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate(`/contract/contracts/show/${item.parent_id}`); + }} + /> + <>{tableRender(item, action)} + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/contract/contracts_add/modals/Change.tsx b/src/pages/contract/contracts_add/modals/Change.tsx new file mode 100644 index 0000000..e02e08d --- /dev/null +++ b/src/pages/contract/contracts_add/modals/Change.tsx @@ -0,0 +1,118 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { useSearchParams } from '@umijs/max'; +import { Form, message } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function UseSeal(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + + const [data, setData] = useState({}); // 修复状态变量命名不一致 + const loadShow = () => { + const currentId = props?.item?.id || Number(id); + if (currentId) { + Apis.Contract.Contracts.Show({ id: Number(currentId) }).then((res) => { + setData(res?.data); + form.setFieldsValue({ + ...res?.data, + peoples: res?.data?.contract_peoples, + }); // 编辑赋值 + }); + } + }; + + useEffect(() => { + loadShow(); + }, [id]); + return ( + + {...MyModalFormProps.props} + title={`简易变更`} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + form.setFieldValue('organization', [props.item?.sign_department]); + } + }} + trigger={ + + } + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.Contracts.Update({ + ...values, + id: props?.item?.id, + code: props?.item?.code, + sign_department: + values.organization?.[values.organization?.length - 1], + income_expense_type: props?.item?.income_expense_type, + contract_nature: props?.item?.contract_nature, + contract_types_id: props?.item?.contract_types_id, + start_time: props?.item?.start_time, + end_time: props?.item?.end_time, + settlement_mode: props?.item?.settlement_mode, + sign_subject: props?.item?.sign_subject, + attachments: props?.item?.attachments || [], + peoples: data?.contract_peoples, // 使用从show接口获取的数据 + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'name', + title: '合同名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + SelectContract.EmployeeName({ + key: 'contract_liaison', + title: '合同对接人', + colProps: { span: 24 }, + required: true, + }), + { + title: '合同份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/modals/SignSubjectSelectList.tsx b/src/pages/contract/contracts_add/modals/SignSubjectSelectList.tsx new file mode 100644 index 0000000..19f0d00 --- /dev/null +++ b/src/pages/contract/contracts_add/modals/SignSubjectSelectList.tsx @@ -0,0 +1,107 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { message, type TableProps } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +export default function SurveysSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + // const [selectedDataRow, setSelectedDataRow] = useState({}); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: TableProps['rowSelection'] = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows[0], 'selectedRows[0]'); + setSelectedRow(selectedRows[0]); + }, + defaultSelectedRowKeys: props?.item?.id ? [props?.item?.id] : [], + }; + + return ( + { + setSelectedRow(props?.item); + console.log(props?.item, 'props?.item?.id'); + }} + node={ + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanySuppliers.List, + ) + } + rowSelection={{ type: 'radio', ...rowSelection }} + options={false} + tableAlertOptionRender={() => { + return ( + { + let res: any = getSelectedRow; + if (!res?.legal_person) { + message.error('当前主体没有设置法人信息!'); + return; + } + props?.onChange?.(res); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '供应商名称', + dataIndex: 'name', + }, + { + title: '公司名称', + dataIndex: 'company_name', + search: false, + }, + { + title: '法人', + dataIndex: 'legal_person', + }, + { + title: '纳税人号', + dataIndex: 'tax_number', + }, + { + title: '注册地址', + search: false, + render: (_, item: any) => { + return `${item.province}${item.city}${item.area}${item.street}${item.address}`; + }, + }, + ]} + /> + } + > + ); +} diff --git a/src/pages/contract/contracts_add/modals/SubmitApproval.tsx b/src/pages/contract/contracts_add/modals/SubmitApproval.tsx new file mode 100644 index 0000000..b93ab8e --- /dev/null +++ b/src/pages/contract/contracts_add/modals/SubmitApproval.tsx @@ -0,0 +1,308 @@ +import { + MyBetaModalFormProps, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +export default function SubmitApproval( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + onCancel?: () => void; + }, +) { + const modalRef = useRef(); + + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + { + // setSelectedRow(props?.item); + }} + onCancel={() => { + props?.onCancel?.(); + }} + node={ + + {...MyModalFormProps.props} + title={props?.title} + width="800px" + layoutType="form" + wrapperCol={{ span: 24 }} + form={form} + onFinish={async (values: any) => { + console.log(values, 'values222'); + + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + Apis.Contract.Contracts.SubmitApproval({ + ...values, + id: props.item?.contracts_id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('提交成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + params: { + type: props?.item?.type, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum + .Approver.value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + console.log(res, '222'); + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + } + > + ); +} diff --git a/src/pages/contract/contracts_add/modals/Terminated.tsx b/src/pages/contract/contracts_add/modals/Terminated.tsx new file mode 100644 index 0000000..0ffbc92 --- /dev/null +++ b/src/pages/contract/contracts_add/modals/Terminated.tsx @@ -0,0 +1,305 @@ +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 { Button, Form, message } from 'antd'; +import { useState } from 'react'; + +export default function Terminated(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getDate()} + width="680px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values:any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.Contracts.Terminated({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('合同解除申请成功'); + props.reload?.(); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '合同解除原因', + valueType: 'textarea', + key: 'terminated_reason', + formItemProps: { ...rulesHelper.text }, + }, + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + // 选择审批模版 + params: { + type: ApprovalTemplatesTypeEnum.ContractTermination.value, + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/modals/Voided.tsx b/src/pages/contract/contracts_add/modals/Voided.tsx new file mode 100644 index 0000000..fdd9840 --- /dev/null +++ b/src/pages/contract/contracts_add/modals/Voided.tsx @@ -0,0 +1,58 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Voided(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={props?.title} + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Contract.Contracts.Voided({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('撤销成功'); + props.reload?.(); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '撤销原因', + valueType: 'textarea', + key: 'voided_reason', + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/pages/contract_add.tsx b/src/pages/contract/contracts_add/pages/contract_add.tsx new file mode 100644 index 0000000..7058318 --- /dev/null +++ b/src/pages/contract/contracts_add/pages/contract_add.tsx @@ -0,0 +1,433 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; + +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import dayjs from 'dayjs'; +import { useEffect, useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +// import SubmitReview from '../modals/SubmitReview'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, +} from '@/gen/Enums'; +import ContractsInfoAdd from '../show/components/ContractsInfoAdd'; +import { IsDepositEnum } from './reducer'; +export default function Index({ title = '新增补充协议' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const [contractId, setContractId] = useState(0); + + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [selectedRow, setSelectedRow] = useState({}); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setSelectedRow(res?.data?.resource); + form.setFieldsValue({ + // ...res?.data, + name: `${res?.data?.name}-补充协议` || '', + total_amount: res?.data?.total_amount || 0, + is_deposit: res?.data?.is_deposit ? 'yes' : 'no', + peoples: res?.data?.contract_peoples, + contract_time: [res?.data?.start_time, res?.data?.end_time], + asset_projects_id: res?.data?.asset_projects_id, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + // const onSave = (formData: any, subType: number) => { + // formData?.peoples?.forEach((res: any) => { + // res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + // }); + // console.log(formData, 'formData'); + // Apis.Contract.Contracts.Store({ + // ...formData, + // parent_id: data?.id ?? 0, + // is_deposit: + // IsDepositEnum[formData.is_deposit as keyof typeof IsDepositEnum].value, + // start_time: dayjs(formData?.contract_time?.[0]).format('YYYY-MM-DD'), + // end_time: dayjs(formData?.contract_time?.[1]).format('YYYY-MM-DD'), + // asset_projects_id: data?.asset_projects_id || 0, + // income_expense_type: data?.income_expense_type || 0, + // contract_nature: data?.contract_nature || 0, + // sign_subject: data?.sign_subject || '', + // }) + // .then(() => { + // if (subType) { + // message.success('保存成功'); + // } else { + // message.success('暂存成功'); + // } + // }) + // .catch(() => false); + // }; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + footer={[ + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + Apis.Contract.Contracts.Store({ + ...values, + parent_id: data?.id ?? 0, + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : 'no', + start_time: dayjs(values.contract_time?.[0]).format( + 'YYYY-MM-DD', + ), + end_time: dayjs(values.contract_time?.[1]).format('YYYY-MM-DD'), + asset_projects_id: data?.asset_projects_id || 0, + income_expense_type: data?.income_expense_type || 0, + contract_nature: data?.contract_nature || 0, + sign_subject: data?.sign_subject || '', + contract_liaison: data?.contract_liaison || '', + seal_info: data?.seal_info || '', + contract_types_id: data?.contract_types_id || 0, + }) + .then((res) => { + const newContractId = res?.data?.id; + setContractId(newContractId); + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + />, + ]} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + width="800px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + form={form} + submitter={{ + render: () => { + return []; + }, + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '新增补充协议', + }, + }, + { + key: 'name', + title: '协议名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '补充协议份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + * + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + }, + }), + MyFormItems.EnumSelect({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '是否变更原合同信息', + }, + }, + { + key: 'contract_time', + title: '原合同合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + transform: (value: any) => { + return { + start_time: value?.[0], + end_time: value?.[1], + }; + }, + }, + { + title: '原合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]} + /> +
+
+ +
+ { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+ ); +} diff --git a/src/pages/contract/contracts_add/pages/contract_add_update.tsx b/src/pages/contract/contracts_add/pages/contract_add_update.tsx new file mode 100644 index 0000000..c4f08e5 --- /dev/null +++ b/src/pages/contract/contracts_add/pages/contract_add_update.tsx @@ -0,0 +1,407 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; + +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import dayjs from 'dayjs'; +import { useEffect, useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +// import SubmitReview from '../modals/SubmitReview'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, +} from '@/gen/Enums'; +import ContractsInfoAdd from '../show/components/ContractsInfoAdd'; +import { IsDepositEnum } from './reducer'; +export default function Index({ title = '修改补充协议' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const [contractId, setContractId] = useState(0); + + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [selectedRow, setSelectedRow] = useState({}); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setSelectedRow(res?.data?.resource); + form.setFieldsValue({ + // ...res?.data, + name: `${res?.data?.name}-补充协议` || '', + total_amount: res?.data?.total_amount || 0, + is_deposit: res?.data?.is_deposit ? 'yes' : 'no', + peoples: res?.data?.contract_peoples, + contract_time: [res?.data?.start_time, res?.data?.end_time], + asset_projects_id: res?.data?.asset_projects_id, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + footer={[ + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + Apis.Contract.Contracts.Update({ + ...values, + id: data?.id ?? 0, + parent_id: data?.parent_id ?? 0, + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : 'no', + start_time: dayjs(values.contract_time?.[0]).format( + 'YYYY-MM-DD', + ), + end_time: dayjs(values.contract_time?.[1]).format('YYYY-MM-DD'), + asset_projects_id: data?.asset_projects_id || 0, + income_expense_type: data?.income_expense_type || 0, + contract_nature: data?.contract_nature || 0, + sign_subject: data?.sign_subject || '', + contract_liaison: data?.contract_liaison || '', + seal_info: data?.seal_info || '', + contract_types_id: data?.contract_types_id || 0, + }) + .then((res) => { + const newContractId = res?.data?.id; + setContractId(newContractId); + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + />, + ]} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + width="800px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + form={form} + submitter={{ + render: () => { + return []; + }, + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '新增补充协议', + }, + }, + { + key: 'name', + title: '协议名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '补充协议份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + * + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + }, + }), + MyFormItems.EnumSelect({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '是否变更原合同信息', + }, + }, + { + key: 'contract_time', + title: '原合同合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + transform: (value: any) => { + return { + start_time: value?.[0], + end_time: value?.[1], + }; + }, + }, + { + title: '原合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 4 }, + wrapperCol: { span: 20 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]} + /> +
+
+ +
+ { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+ ); +} diff --git a/src/pages/contract/contracts_add/pages/contract_create.tsx b/src/pages/contract/contracts_add/pages/contract_create.tsx new file mode 100644 index 0000000..122a9e5 --- /dev/null +++ b/src/pages/contract/contracts_add/pages/contract_create.tsx @@ -0,0 +1,980 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import ModalsResourceSelectList from '@/components/ModalsResourceSelectList'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, + ResourceTypesCategoryEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space, Steps } from 'antd'; +import dayjs from 'dayjs'; +import { useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +// import SubmitReview from '../modals/SubmitReview'; +import { IsDepositEnum } from './reducer'; + +export default function Index({ title = '新增合同' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [selectedRow, setSelectedRow] = useState({}); + const [contractId, setContractId] = useState(0); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + const [currentStep, setCurrentStep] = useState(0); + const [contractData, setContractData] = useState({}); + + const onSave = (data: any) => { + const contractDataToSave = { + ...data, + // sign_department: data.organization?.[data.organization?.length - 1] || '', + is_deposit: data.is_deposit + ? IsDepositEnum[data.is_deposit as keyof typeof IsDepositEnum].value + : 'false', + start_time: dayjs(data.contract_time?.[0]).format('YYYY-MM-DD'), + end_time: dayjs(data.contract_time?.[1]).format('YYYY-MM-DD'), + code: data?.code || '', + }; + Apis.Contract.Contracts.Store(contractDataToSave) + .then((res: any) => { + const contractId = res?.data?.id; + if (contractId) { + setContractId(contractId); + setContractData({ + ...contractDataToSave, + id: contractId, + name: data?.name, + code: data?.code || '', + }); + setCurrentStep(1); + message.success('保存成功'); + } + }) + .catch(() => false); + }; + + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(contractData?.total_amount) - + parseFloat(contractData?.total_bill_amount || 0) + ).toFixed(2), + ); + }; + + const handleBillsSubmit = async (values: any) => { + return new Promise((resolve) => { + let year_month = ''; + let year_month_is = false; + let total_bill_amount = totalBillSeparableAmount(); + let taotal_amount = 0; + if ( + total_bill_amount <= 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + message.warning('没有多余金额可生成账单!'); + resolve(false); + return; + } + values?.bills?.forEach((res: any) => { + if (values?.payee === values?.payer) { + year_month_is = true; + message.warning('收款方和付款方不能相同'); + resolve(false); + return false; + } + res.payee = values?.payee; + res.payer = values?.payer; + if (year_month_is) return; + if (res?.year_month === year_month) { + year_month_is = true; + message.warning('不能选择相同年月'); + resolve(false); + return false; + } + year_month = res?.year_month; + // 处理不同类型的year_month值 + let year, month; + if (res?.year_month) { + if (typeof res.year_month === 'string') { + const k = res.year_month.split('-'); + year = k[0]; + month = k[1] ? parseInt(k[1]) : 0; + } else if (typeof res.year_month.format === 'function') { + // 处理dayjs/moment对象 + year = res.year_month.format('YYYY'); + month = parseInt(res.year_month.format('MM')); + } else if (res.year_month.getFullYear) { + // 处理Date对象 + year = res.year_month.getFullYear().toString(); + month = res.year_month.getMonth() + 1; + } else { + year = ''; + month = 0; + } + } else { + year = ''; + month = 0; + } + res.year = year; + res.month = month; + if (contractData?.settlement_mode === 'LumpSumContract') { + taotal_amount += parseFloat(res?.amount); + } + }); + if ( + contractData?.settlement_mode === 'LumpSumContract' && + taotal_amount !== total_bill_amount + ) { + message.warning(`账单¥${total_bill_amount},拆分错误!`); + resolve(false); + return; + } + if (year_month_is) { + resolve(false); + return; + } + if (contractData?.settlement_mode === 'OpenContract') { + //开口合同 + Apis.Contract.ContractBills.BatchStore({ + ...values, + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else if ( + total_bill_amount > 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + if (taotal_amount <= total_bill_amount) { + Apis.Contract.ContractBills.BatchStore({ + ...values, + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else { + message.warning('可拆分金额不够!'); + resolve(false); + } + } else { + resolve(false); + } + }); + }; + + return ( + { + navigate(-1); + }} + > + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + + {/* 第一步:合同信息填写 */} + {currentStep === 0 && ( + + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="form" + width="800px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + form={form} + submitter={{ + render: () => { + const values = form.getFieldsValue(); + const incomeExpenseType = values?.income_expense_type; + return [ + incomeExpenseType !== 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + form?.validateFields().then(() => { + onSave(values); + }); + }} + title="下一步" + /> + ), + incomeExpenseType === 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = + res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + // 调用保存合同的API + Apis.Contract.Contracts.Store({ + ...values, + sign_department: + values.organization?.[ + values.organization?.length - 1 + ], + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : false, + start_time: dayjs( + values.contract_time?.[0], + ).format('YYYY-MM-DD'), + end_time: dayjs(values.contract_time?.[1]).format( + 'YYYY-MM-DD', + ), + asset_projects_id: values.asset_projects_id, + }) + .then((res: any) => { + const id = res.data.id; + setContractId(id); + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + /> + ), + ]; + }, + }} + onFinish={async (values: any) => { + onSave(values); + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '基本信息', + }, + }, + MyFormItems.EnumRadio({ + key: 'income_expense_type', + title: '收支类型', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + buttonStyle: 'solid', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('settlement_mode', undefined); + form.setFieldValue('total_amount', undefined); + }, + }, + }), + { + key: 'name', + title: '合同名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'contract_time', + title: '合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'contract_nature', + title: '合同性质', + valueEnum: ContractsContractNatureEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + SelectContract.ContractTypes({ + title: '合同类型', + key: 'contract_types_id', + required: true, + colProps: { span: 12 }, + fieldProps: { + placeholder: '请选择合同类型', + }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['income_expense_type'], + columns: ({ income_expense_type }) => { + return income_expense_type === 'None' + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'settlement_mode', + title: '结算模式', + valueEnum: ContractsSettlementModeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + title: '合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]; + }, + }, + + SelectContract.SupplierName({ + key: 'sign_subject', + title: '选择签约主体', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 24 }, + required: true, + }), + SelectContract.AssetProjects({ + key: 'asset_projects_id', + title: '选择关联项目', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + // mode: 'multiple', + }, + }), + SelectContract.EmployeeName({ + key: 'contract_liaison', + title: '合同对接人', + colProps: { span: 24 }, + required: true, + }), + { + title: '合同份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'dependency', + name: ['contract_time'], + columns: ({ contract_time }) => { + return contract_time?.length + ? [ + { + colProps: { span: 24 }, + title: '关联资源', + key: 'resources_id', + renderFormItem: () => { + return ( + + + { + setSelectedRow(e); + form.setFieldsValue({ + resources_id: e?.id, + }); + }} + /> + {selectedRow?.name ? ( +
+ 已选择 + { + ResourceTypesCategoryEnum[ + selectedRow?.category as keyof typeof ResourceTypesCategoryEnum + ]?.text + } + 资源:{selectedRow?.name} +
+ ) : ( + '' + )} +
+
+ ); + }, + }, + ] + : []; + }, + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + + * + + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'sign_party', + // title: `交易方`, + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + }, + }), + MyFormItems.EnumSelect({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '合同附件', + }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '印章申请', + }, + }, + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + ]} + /> + )} + + {/* 第二步:账单设置 */} + {currentStep === 1 && ( + + {...MyModalFormProps.props} + wrapperCol={{ span: 24 }} + width="1200px" + layoutType="Form" + onFinish={async (values: any) => { + handleBillsSubmit(values); + }} + submitter={{ + render: (props) => { + return [ + { + setCurrentStep(0); + }} + title="上一步" + />, + // { + // props.submit(); + // }} + // title="提交" + // />, + { + // 先提交账单,然后显示提审弹窗 + const formInstance = props?.form; + formInstance?.validateFields().then(() => { + const values = formInstance.getFieldsValue(); + handleBillsSubmit(values).then((success) => { + if (success) { + setSubmitModalVisible(true); + } + }); + }); + }} + title="提交并审核" + />, + ]; + }, + }} + columns={[ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+
+ 收支类型: + {contractData?.income_expense_type === 'Income' + ? '收入' + : '支出'} +
+
+ 结算模式: + {contractData?.settlement_mode === + 'LumpSumContract' + ? '总价合同' + : '开口合同'} +
+
+ 总金额:¥ + {contractData?.total_amount} +
+
+ 剩余可生成账单金额: + {contractData?.settlement_mode === + 'LumpSumContract' && ( + + ¥{totalBillSeparableAmount()} + + )} +
+
+
+
+ ); + }, + }, + { + valueType: 'divider', + title: '账单设置', + fieldProps: { + orientation: 'left', + children: '账单设置', + }, + }, + + { + title: '收款方', + valueType: 'select', + dataIndex: 'payee', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: contractData?.peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (contractData?.income_expense_type === 'Income') { + return item?.counterparty_type === 'InternalCompany'; + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + title: '付款方', + valueType: 'select', + dataIndex: 'payer', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + options: contractData?.peoples + ?.filter((item: any) => { + // 当收入类型为Income时,只显示内部公司 + if (contractData?.income_expense_type === 'Expense') { + return item?.counterparty_type === 'InternalCompany'; + } + // 其他情况显示所有 + return item?.counterparty_type === 'Supplier'; + }) + .map((item: any) => ({ + label: item?.counterparty, + value: item?.counterparty, + })), + }, + }, + { + valueType: 'formList', + dataIndex: 'bills', + // title: '账单设置', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + creatorRecord: { + cost_type: contractData?.income_expense_type, + }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '类型', + dataIndex: 'cost_type', + colProps: { span: 2 }, + align: 'center', + renderFormItem: () => { + let res = { + text: + contractData?.income_expense_type === 'Income' + ? '收入' + : '支出', + color: + contractData?.income_expense_type === 'Income' + ? 'green' + : 'blue', + }; + return contractData?.income_expense_type ? ( + + {res?.text} + + ) : ( + '-' + ); + }, + }, + { + title: '账单年月', + valueType: 'dateMonth', + dataIndex: 'year_month', + colProps: { span: 3 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '期数', + valueType: 'digit', + dataIndex: 'period_num', + colProps: { span: 2 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + maxLength: 2, + }, + }, + }, + { + title: '账单金额', + valueType: 'digit', + dataIndex: 'amount', + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + addonAfter: '元', + }, + }, + { + title: '关联标地', + formItemProps: { ...rulesHelper.text }, + dataIndex: 'object_name', + colProps: { span: 8 }, + }, + { + title: '备注', + dataIndex: 'remark', + colProps: { span: 5 }, + }, + ], + }, + ], + }, + ]} + /> + )} + + {/* 提审弹窗 */} + { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contracts_add/pages/contract_update.tsx b/src/pages/contract/contracts_add/pages/contract_update.tsx new file mode 100644 index 0000000..2e780cb --- /dev/null +++ b/src/pages/contract/contracts_add/pages/contract_update.tsx @@ -0,0 +1,1010 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import ModalsResourceSelectList from '@/components/ModalsResourceSelectList'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractTemplatesIncomeExpenseTypeEnum, + ResourceTypesCategoryEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space, Steps } from 'antd'; +import dayjs from 'dayjs'; +import { useEffect, useState } from 'react'; +import MySubmitApproval from '../modals/SubmitApproval'; +import { IsDepositEnum } from './reducer'; + +export default function Index({ title = '编辑合同' }) { + const [form] = Form.useForm(); + const [form2] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [selectedRow, setSelectedRow] = useState({}); + const [submitModalVisible, setSubmitModalVisible] = useState(false); + const [currentStep, setCurrentStep] = useState(0); + const [contractData, setContractData] = useState({}); + const [billsData, setBillsData] = useState([]); + + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + const contractData = res?.data; + setShow(contractData); + setContractData(contractData); + setSelectedRow(res?.data?.resource); + // 提取账单数据 + const bills = contractData?.contract_bills || []; + setBillsData(bills); + form2.setFieldsValue({ + ...contractData, + payee: res?.data?.contract_bills?.[0]?.payee, + payer: res?.data?.contract_bills?.[0]?.payer, + bills: res?.data?.contract_bills?.map((item: any) => ({ + ...item, + object_name: res?.data?.contract_bill_objects?.find( + (i: any) => i?.contract_bills_id === item?.id, + )?.name, + year_month: `${item?.year}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`, + })), + }); + form.setFieldsValue({ + ...contractData, + is_deposit: contractData?.is_deposit ? 'yes' : 'no', + peoples: contractData?.contract_peoples, + contract_time: [contractData?.start_time, contractData?.end_time], + asset_projects_id: contractData?.asset_projects_id, + seal_info: contractData?.seal_info, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + const onSave = (formData: any, subType: number = 1) => { + formData?.peoples?.forEach((res: any) => { + res.company_suppliers_id = res?.counterparty?.split(':')?.[0]; + }); + const contractDataToSave = { + ...formData, + is_deposit: + IsDepositEnum[formData.is_deposit as keyof typeof IsDepositEnum].value, + id: data?.id ?? 0, + start_time: dayjs(formData?.contract_time?.[0]).format('YYYY-MM-DD'), + end_time: dayjs(formData?.contract_time?.[1]).format('YYYY-MM-DD'), + }; + Apis.Contract.Contracts.Update(contractDataToSave) + .then(() => { + // 更新contractData,以便在第二步编辑账单时使用 + setContractData({ + ...contractDataToSave, + id: data?.id, + name: formData?.name, + code: formData?.code, + }); + if (subType) { + // 如果是保存并进入下一步 + setCurrentStep(1); + message.success('保存成功'); + } else { + message.success('暂存成功'); + } + }) + .catch(() => false); + }; + + const totalBillSeparableAmount = () => { + return parseFloat( + ( + parseFloat(contractData?.total_amount) - + parseFloat(contractData?.total_bill_amount || 0) + ).toFixed(2), + ); + }; + + const handleBillsSubmit = async (values: any) => { + return new Promise((resolve) => { + let year_month = ''; + let year_month_is = false; + let total_bill_amount = totalBillSeparableAmount(); + let taotal_amount = 0; + if ( + total_bill_amount <= 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + message.warning('没有多余金额可生成账单!'); + resolve(false); + return; + } + values?.bills?.forEach((res: any) => { + if (values?.payee === values?.payer) { + year_month_is = true; + message.warning('收款方和付款方不能相同'); + resolve(false); + return false; + } + res.payee = values?.payee; + res.payer = values?.payer; + if (year_month_is) return; + if (res?.year_month === year_month) { + year_month_is = true; + message.warning('不能选择相同年月'); + resolve(false); + return false; + } + year_month = res?.year_month; + // 处理不同类型的year_month值 + let year, month; + if (res?.year_month) { + if (typeof res.year_month === 'string') { + const k = res.year_month.split('-'); + year = k[0]; + month = k[1] ? parseInt(k[1]) : 0; + } else if (typeof res.year_month.format === 'function') { + // 处理dayjs/moment对象 + year = res.year_month.format('YYYY'); + month = parseInt(res.year_month.format('MM')); + } else if (res.year_month.getFullYear) { + // 处理Date对象 + year = res.year_month.getFullYear().toString(); + month = res.year_month.getMonth() + 1; + } else { + year = ''; + month = 0; + } + } else { + year = ''; + month = 0; + } + res.year = year; + res.month = month; + if (contractData?.settlement_mode === 'LumpSumContract') { + taotal_amount += parseFloat(res?.amount); + } + }); + if ( + contractData?.settlement_mode === 'LumpSumContract' && + taotal_amount !== total_bill_amount + ) { + message.warning(`账单¥${total_bill_amount},拆分错误!`); + resolve(false); + return; + } + if (year_month_is) { + resolve(false); + return; + } + if (contractData?.settlement_mode === 'OpenContract') { + //开口合同 + console.log(data, '2是你'); + Apis.Contract.ContractBills.BatchUpdate({ + ...values, + bills: values?.bills?.map((item: any, index: number) => { + let row = data?.contract_bills[index]; + let res = { + ...row, + ...item, + object_name: item?.object_name, + object_id: data?.contract_bill_objects?.find( + (i: any) => i?.contract_bills_id === row?.id, + )?.id, + }; + return res; + }), + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else if ( + total_bill_amount > 0 && + contractData?.settlement_mode === 'LumpSumContract' + ) { + if (taotal_amount <= total_bill_amount) { + Apis.Contract.ContractBills.BatchUpdate({ + ...values, + bills: values?.bills?.map((item: any, index: number) => { + let row = data?.contract_bills[index]; + let res = { + ...row, + ...item, + object_name: item?.object_name, + object_id: data?.contract_bill_objects?.find( + (i: any) => i?.contract_bills_id === row?.id, + )?.id, + }; + return res; + }), + contracts_id: contractData?.id, + }) + .then(() => { + message.success('提交成功'); + resolve(true); + }) + .catch(() => { + resolve(false); + }); + } else { + message.warning('可拆分金额不够!'); + resolve(false); + } + } else { + resolve(false); + } + }); + }; + + return ( + { + navigate(-1); + }} + > + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + + {/* 第一步:合同信息填写 */} + {currentStep === 0 && ( + { + const values = form.getFieldsValue(); + const incomeExpenseType = values?.income_expense_type; + return [ + incomeExpenseType !== 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + form?.validateFields().then(() => { + onSave(values, 1); + }); + }} + title="下一步" + /> + ), + incomeExpenseType === 'None' && ( + { + // 先保存合同,然后显示提审弹窗 + const values = form.getFieldsValue(); + values?.peoples?.forEach((res: any) => { + res.company_suppliers_id = + res?.counterparty?.split(':')?.[0]; + }); + form?.validateFields().then(() => { + Apis.Contract.Contracts.Update({ + ...values, + id: data?.id ?? 0, + is_deposit: values.is_deposit + ? IsDepositEnum[ + values.is_deposit as keyof typeof IsDepositEnum + ].value + : 'no', + start_time: dayjs( + values.contract_time?.[0], + ).format('YYYY-MM-DD'), + end_time: dayjs(values.contract_time?.[1]).format( + 'YYYY-MM-DD', + ), + asset_projects_id: values.asset_projects_id, + }) + .then(() => { + setSubmitModalVisible(true); + }) + .catch((error) => { + if (error !== '未获取到合同ID') { + message.error('操作失败,请重试'); + } + }); + }); + }} + title="保存并提审" + /> + ), + ]; + }, + }} + onFinish={(values) => { + onSave(values, 1); + }} + columns={[ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '基本信息', + }, + }, + MyFormItems.EnumRadio({ + key: 'income_expense_type', + title: '收支类型', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + buttonStyle: 'solid', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('settlement_mode', undefined); + form.setFieldValue('total_amount', undefined); + }, + }, + }), + { + key: 'name', + title: '合同名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'contract_time', + title: '合同有效期', + valueType: 'dateRange', + colProps: { span: 24 }, + fieldProps: { + style: { width: '50%' }, + format: 'YYYY-MM-DD', + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'contract_nature', + title: '合同性质', + valueEnum: ContractsContractNatureEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + SelectContract.ContractTypes({ + title: '合同类型', + key: 'contract_types_id', + required: true, + colProps: { span: 12 }, + fieldProps: { + placeholder: '请选择合同类型', + }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['income_expense_type'], + columns: ({ income_expense_type }) => { + return income_expense_type === 'None' + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'settlement_mode', + title: '结算模式', + valueEnum: ContractsSettlementModeEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + title: '合同总金额', + key: 'total_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + }, + MyFormItems.EnumRadio({ + key: 'is_deposit', + title: '是否有保证金', + valueEnum: IsDepositEnum, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + }, + }), + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit === 'yes' + ? [ + { + title: '请输入保证金', + key: 'deposit_amount', + valueType: 'digit', + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.number, + labelCol: { span: 12 }, + wrapperCol: { span: 12 }, + }, + fieldProps: { + style: { width: '100%' }, + suffix: '元', + }, + }, + ] + : []; + }, + }, + ]; + }, + }, + + SelectContract.SupplierName({ + key: 'sign_subject', + title: '选择签约主体', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 24 }, + required: true, + }), + SelectContract.AssetProjects({ + key: 'asset_projects_id', + title: '选择关联项目', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + }, + }), + SelectContract.EmployeeName({ + key: 'contract_liaison', + title: '合同对接人', + colProps: { span: 24 }, + required: true, + }), + { + title: '合同份数', + key: 'number_contract_copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + { + valueType: 'dependency', + name: ['contract_time'], + columns: ({ contract_time }) => { + console.log(contract_time, 'contract_time'); + return contract_time?.length || data?.start_time + ? [ + { + colProps: { span: 24 }, + title: '关联资源', + key: 'resources_id', + renderFormItem: () => { + return ( + + + { + setSelectedRow(e); + form.setFieldsValue({ + resources_id: e?.id, + }); + }} + /> + {selectedRow?.name ? ( +
+ 已选择 + { + ResourceTypesCategoryEnum[ + selectedRow?.category as keyof typeof ResourceTypesCategoryEnum + ]?.text + } + 资源:{selectedRow?.name} +
+ ) : ( + '' + )} +
+
+ ); + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: ( + <> + + * + + 交易方信息 + + ), + }, + }, + { + valueType: 'formList', + dataIndex: 'peoples', + title: '', + fieldProps: { + copyIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + fieldProps: { + placeholder: '请选择签约方', + }, + }), + MyFormItems.EnumSelect({ + key: 'counterparty_type', + title: '', + valueEnum: CompanySuppliersCounterpartyEnum, + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + }), + { + valueType: 'dependency', + name: ['counterparty_type'], + columns: ({ counterparty_type }) => { + return counterparty_type === 'Supplier' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'Supplier', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : counterparty_type === 'InternalCompany' + ? [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + }, + }), + ] + : [ + SelectContract.SupplierName({ + key: 'counterparty', + title: '', + params: { + counterparty: 'InternalCompany', + }, + colProps: { span: 12 }, + formItemProps: { + ...rulesHelper.text, + wrapperCol: { span: 24 }, + }, + required: true, + fieldProps: { + placeholder: '请选择签约主体', + disabled: true, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '合同附件', + }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + required: true, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '印章申请', + }, + }, + SelectContract.ContractSeals({ + key: 'seal_info', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + ]} + /> + )} + + {/* 第二步:账单设置 */} + {currentStep === 1 && ( + + {...MyModalFormProps.props} + wrapperCol={{ span: 24 }} + width="1200px" + form={form2} + layoutType="Form" + onFinish={async (values: any) => { + handleBillsSubmit(values); + }} + submitter={{ + render: (props) => { + return [ + { + setCurrentStep(0); + }} + title="上一步" + />, + // { + // props.submit(); + // }} + // title="提交" + // />, + { + // 先提交账单,然后显示提审弹窗 + const formInstance = props?.form; + formInstance?.validateFields().then(() => { + const values = formInstance.getFieldsValue(); + handleBillsSubmit(values).then((success) => { + if (success) { + setSubmitModalVisible(true); + } + }); + }); + }} + title="提交并审核" + />, + ]; + }, + }} + columns={[ + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + +
+
+ 收支类型: + {contractData?.income_expense_type === 'Income' + ? '收入' + : '支出'} +
+
+ 结算模式: + {contractData?.settlement_mode === + 'LumpSumContract' + ? '总价合同' + : '开口合同'} +
+
+ 总金额:¥ + {contractData?.total_amount} +
+
+ 剩余可生成账单金额: + {contractData?.settlement_mode === + 'LumpSumContract' && ( + + ¥{totalBillSeparableAmount()} + + )} +
+
+
+
+ ); + }, + }, + { + valueType: 'divider', + title: '账单设置', + fieldProps: { + orientation: 'left', + children: '账单设置', + }, + }, + + { + title: '收款方', + dataIndex: 'payee', + colProps: { span: 12 }, + }, + { + title: '付款方', + dataIndex: 'payer', + colProps: { span: 12 }, + }, + { + valueType: 'formList', + dataIndex: 'bills', + // title: '账单设置', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + creatorRecord: { + cost_type: contractData?.income_expense_type, + }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '类型', + dataIndex: 'cost_type', + colProps: { span: 2 }, + align: 'center', + renderFormItem: () => { + let res = { + text: + contractData?.income_expense_type === 'Income' + ? '收入' + : '支出', + color: + contractData?.income_expense_type === 'Income' + ? 'green' + : 'blue', + }; + return contractData?.income_expense_type ? ( + + {res?.text} + + ) : ( + '-' + ); + }, + }, + { + title: '账单年月', + valueType: 'dateMonth', + dataIndex: 'year_month', + colProps: { span: 3 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + { + title: '期数', + valueType: 'digit', + dataIndex: 'period_num', + colProps: { span: 2 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + maxLength: 2, + }, + }, + }, + { + title: '账单金额', + valueType: 'digit', + dataIndex: 'amount', + colProps: { span: 4 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + addonAfter: '元', + }, + }, + { + title: '关联标地', + formItemProps: { ...rulesHelper.text }, + dataIndex: 'object_name', + colProps: { span: 8 }, + }, + { + title: '备注', + dataIndex: 'remark', + colProps: { span: 5 }, + }, + ], + }, + ], + }, + ]} + /> + )} + + { + setSubmitModalVisible(false); + }} + reload={() => { + setSubmitModalVisible(false); + navigate('/contract/contracts'); + }} + /> +
+
+
+ ); +} diff --git a/src/pages/contract/contracts_add/pages/reducer.ts b/src/pages/contract/contracts_add/pages/reducer.ts new file mode 100644 index 0000000..4a45af0 --- /dev/null +++ b/src/pages/contract/contracts_add/pages/reducer.ts @@ -0,0 +1,4 @@ +export const IsDepositEnum = { + yes: { text: '是', key: 'yes', value: true }, + no: { text: '否', key: 'no', value: false }, +}; diff --git a/src/pages/contract/contracts_add/show/$id.tsx b/src/pages/contract/contracts_add/show/$id.tsx new file mode 100644 index 0000000..b103412 --- /dev/null +++ b/src/pages/contract/contracts_add/show/$id.tsx @@ -0,0 +1,82 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; + +import { useNavigate, useParams } from '@umijs/max'; +import { Space, Tabs, TabsProps } from 'antd'; +import { useEffect, useState } from 'react'; +import MyArchivingLogs from './components/ArchivingLogs'; +import MyContractBillObjects from './components/ContractBillObjects'; +import MyContractBills from './components/ContractBills'; +import ContractDisputeRecords from './components/ContractDisputeRecords'; +import MyContractsInfo from './components/ContractsInfo'; +import MyUsedLogs from './components/UsedLogs'; + +export default function Index({ title = '合同详情' }) { + const navigate = useNavigate(); + const { id } = useParams<{ id: string }>(); + const [showData, setDataShow] = useState({}); + + const items: TabsProps['items'] = [ + { + key: '1', + label: '基本信息', + children: , + }, + { + key: '2', + label: '用印记录', + children: , + }, + { + key: '3', + label: '合同标地', + children: , + }, + { + key: '4', + label: '合同账单', + children: , + }, + { + key: '5', + label: '归档记录', + children: , + }, + { + key: '6', + label: '争议处理记录', + children: , + }, + ]; + const loadShow = () => { + Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => { + setDataShow(res?.data); + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + + + + + ); +} diff --git a/src/pages/contract/contracts_add/show/components/ArchivingLogs.tsx b/src/pages/contract/contracts_add/show/components/ArchivingLogs.tsx new file mode 100644 index 0000000..2f2af75 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/ArchivingLogs.tsx @@ -0,0 +1,130 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractArchivesConfidentialityLevelEnum, + ContractArchivesPeriodTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +import Archives from '@/pages/contract/contract_archives/unfinished/modals/Archive'; +import Show from '../../../contract_archives/finished/modals/Show'; +import Update from '../../../contract_archives/finished/modals/Update'; + +export default function Index(props: MyBetaModalFormProps) { + const navigate = useNavigate(); + return ( + + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractArchives.List, + ) + } + headerTitle="归档记录" + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '归档编号', + dataIndex: 'code', + render: (_, item: any) => ( + { + navigate( + `/contract/contract_archives/show/${item.contracts_id}`, + ); + }} + > + {item?.code} + + ), + }, + { + title: '归档名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '保密等级', + dataIndex: 'confidentiality_level', + valueEnum: ContractArchivesConfidentialityLevelEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '期限类型', + dataIndex: 'period_type', + valueEnum: ContractArchivesPeriodTypeEnum, + search: false, + }), + { + title: '保管年限', + dataIndex: 'storage_years', + valueType: 'digit', + search: false, + }, + // { + // title: '案卷编号', + // dataIndex: 'file_number', + // }, + { + title: '文件盒编号', + dataIndex: 'box_number', + }, + { + title: '文件柜编号', + dataIndex: 'cabinet_number', + }, + { + title: '归档年份', + dataIndex: 'archive_year', + valueType: 'dateYear', + search: false, + }, + { + title: '归档日期', + dataIndex: 'archive_date', + valueType: 'date', + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Contract.ContractArchives.Delete({ id: item.id }).then( + () => action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/show/components/ContractBillObjects.tsx b/src/pages/contract/contracts_add/show/components/ContractBillObjects.tsx new file mode 100644 index 0000000..dfbc833 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/ContractBillObjects.tsx @@ -0,0 +1,59 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ContractBillObjectsStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import MyCompleteApply from '../../../contract_bills/modals/CompleteApply'; +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractBillObjects.List, + ) + } + headerTitle="合同标地" + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + + { + title: '名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: ContractBillObjectsStatusEnum, + }), + { + title: '金额', + dataIndex: 'amount', + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/show/components/ContractBills.tsx b/src/pages/contract/contracts_add/show/components/ContractBills.tsx new file mode 100644 index 0000000..fbc3a91 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/ContractBills.tsx @@ -0,0 +1,109 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsCostTypeEnum, + HouseOrdersOrderStatusEnum, +} from '@/gen/Enums'; +import PayBills from '@/pages/contract/contract_bills/modals/PayBills'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index(props: MyBetaModalFormProps) { + const navigate = useNavigate(); + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractBills.List, + ) + } + headerTitle="账单列表" + toolBarRender={() => [ + { + navigate( + `/contract/contract_bills/pages/create?id=${props?.item?.id}`, + ); + }} + title="添加账单" + />, + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '合同', + dataIndex: ['contract', 'name'], + search: false, + }, + { + title: '合同ID', + dataIndex: 'contracts_id', + }, + { + title: '年月', + search: false, + render: (_, item: any) => { + return `${item?.year || 0}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`; + }, + }, + MyColumns.EnumTag({ + title: '支付状态', + dataIndex: 'payment_status', + valueEnum: HouseOrdersOrderStatusEnum, + }), + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'cost_type', + valueEnum: ContractBillsCostTypeEnum, + }), + { + title: '账单金额', + search: false, + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + { + navigate( + `/contract/contract_bills/pages/update?id=${item.id}`, + ); + }} + title="编辑" + /> + + Apis.Contract.ContractBills.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/show/components/ContractDisputeRecords.tsx b/src/pages/contract/contracts_add/show/components/ContractDisputeRecords.tsx new file mode 100644 index 0000000..503c668 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/ContractDisputeRecords.tsx @@ -0,0 +1,82 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from '../modals/Create'; +import Update from '../modals/Update'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractDisputeRecords.List, + ) + } + toolBarRender={(action) => [ + , + ]} + headerTitle="争议记录列表" + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '争议原因', + dataIndex: 'reason', + }, + { + title: '处理内容', + dataIndex: 'content', + search: false, + }, + { + title: '附件', + search: false, + render: (_, item: any) => { + return ( + + {item?.attachments?.map((res: any, index: number) => { + return ( + + {res?.name} + + ); + })} + + ); + }, + }, + + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Contract.ContractDisputeRecords.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/show/components/ContractsInfo.tsx b/src/pages/contract/contracts_add/show/components/ContractsInfo.tsx new file mode 100644 index 0000000..972c571 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/ContractsInfo.tsx @@ -0,0 +1,135 @@ +import { + MyBetaModalFormProps, + MyColumns, + MyProTableProps, + renderTextHelper, +} from '@/common'; +import { showTime } from '@/common/utils/day'; +import MyShowAttachments from '@/components/ShowAttachments'; +import { + CompanySuppliersCounterpartyEnum, + ContractPeoplesSignPartyEnum, + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions, ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function ContractsInfo(props: MyBetaModalFormProps) { + return ( + + + + + + + + {props?.item?.name} + + + {props?.item?.code} + + + + + + {props?.item?.contract_type_name} + + + + + + + + + ¥{props?.item?.total_amount} + + + + + {showTime(props?.item?.start_time, 10)}至 + {showTime(props?.item?.end_time, 10)} + + + + + ¥{props?.item?.total_bill_amount} + + + ¥{props?.item?.total_income_amount} + + + ¥{props?.item?.total_expense_amount} + + + {props?.item?.is_deposit ? '是' : '否'} + + + ¥{props?.item?.deposit_amount || '-'} + + + {props?.item?.sign_subject} + + + {props?.item?.project_name || '-'} + + {/* + {props?.item?.sign_department || '-'} + */} + + {props?.item?.contract_liaison || '-'} + + + {props?.item?.number_contract_copies || '-'}份 + + + + + > + {...MyProTableProps.props} + headerTitle="交易双方" + search={false} + options={false} + pagination={false} + dataSource={props?.item?.contract_peoples || []} + columns={[ + { + title: '签约方', + dataIndex: 'sign_party', + valueEnum: ContractPeoplesSignPartyEnum, + }, + { + title: '名称', + dataIndex: 'counterparty', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'counterparty_type', + valueEnum: CompanySuppliersCounterpartyEnum, + }), + ]} + /> + + + ); +} diff --git a/src/pages/contract/contracts_add/show/components/ContractsInfoAdd.tsx b/src/pages/contract/contracts_add/show/components/ContractsInfoAdd.tsx new file mode 100644 index 0000000..521b6b4 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/ContractsInfoAdd.tsx @@ -0,0 +1,105 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { showTime } from '@/common/utils/day'; +import { + ContractsContractNatureEnum, + ContractsSettlementModeEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function ContractsInfo(props: MyBetaModalFormProps) { + return ( + + + + + + + + {props?.item?.name} + + + {props?.item?.code} + + + + + + {props?.item?.contract_type_name} + + + + + + + + + ¥{props?.item?.total_amount} + + + + {showTime(props?.item?.start_time, 10)}至 + {showTime(props?.item?.end_time, 10)} + + + + ¥{props?.item?.total_bill_amount} + + + ¥{props?.item?.total_income_amount} + + + ¥{props?.item?.total_expense_amount} + + + {props?.item?.is_deposit ? '是' : '否'} + + + ¥{props?.item?.deposit_amount || '-'} + + + {props?.item?.sign_subject} + + + {props?.item?.project_name || '-'} + + {/* + {props?.item?.sign_department || '-'} + */} + + {props?.item?.contract_liaison || '-'} + + + {props?.item?.number_contract_copies || '-'}份 + + + + {props?.item?.contract_peoples?.map((item: any, index: number) => ( +
{item.counterparty}
+ )) || '-'} +
+
+
+
+ ); +} diff --git a/src/pages/contract/contracts_add/show/components/UsedLogs.tsx b/src/pages/contract/contracts_add/show/components/UsedLogs.tsx new file mode 100644 index 0000000..0c7dd42 --- /dev/null +++ b/src/pages/contract/contracts_add/show/components/UsedLogs.tsx @@ -0,0 +1,86 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import UseSeal from '@/pages/contract/contract_seal_logs/unused/modals/UseSeal'; +import { ProTable } from '@ant-design/pro-components'; +import { useParams } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index(props: MyBetaModalFormProps) { + const { id } = useParams<{ id: string }>(); + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { ...params, contracts_id: props?.item?.id }, + sort, + Apis.Contract.ContractSealLogs.List, + ) + } + headerTitle="用印列表" + params={{ contracts_id: id }} + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '合同名称', + dataIndex: ['contract', 'name'], + }, + { + title: '合同编号', + dataIndex: ['contract', 'code'], + }, + { + title: '合同编号', + dataIndex: 'code', + hidden: true, + }, + { + title: '合同ID', + dataIndex: 'contracts_id', + }, + { + title: '印章', + search: false, + render: (_, item: any) => ( + + {item?.seal_info?.map((res: any) => { + return res?.company_name; + })} + + ), + }, + { + title: '申请用印人', + dataIndex: ['company_employee', 'name'], + search: false, + }, + { + title: '用印合同', + dataIndex: 'number_contract_copies', + search: false, + }, + // MyColumns.Boolean({ + // dataIndex: 'is_external_seal_usage', + // title: '是否外出用印', + // search: false, + // }), + { + title: '操作印章人', + dataIndex: ['operator_employee', 'name'], + search: false, + }, + MyColumns.CreatedAt(), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/show/modals/Create.tsx b/src/pages/contract/contracts_add/show/modals/Create.tsx new file mode 100644 index 0000000..16d5105 --- /dev/null +++ b/src/pages/contract/contracts_add/show/modals/Create.tsx @@ -0,0 +1,67 @@ +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 Archives(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}`} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => { + console.log(values, 'values'); + return Apis.Contract.ContractDisputeRecords.Store({ + ...values, + contracts_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '争议原因', + key: 'reason', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + title: '处理内容', + key: 'content', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '附件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + className: 'my_upload_file', + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_add/show/modals/Update.tsx b/src/pages/contract/contracts_add/show/modals/Update.tsx new file mode 100644 index 0000000..68f5a4b --- /dev/null +++ b/src/pages/contract/contracts_add/show/modals/Update.tsx @@ -0,0 +1,66 @@ +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 Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`归档信息${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values: any) => + Apis.Contract.ContractDisputeRecords.Update({ + ...values, + id: props?.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功!'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '争议原因', + key: 'reason', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + title: '处理内容', + key: 'content', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '附件', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + className: 'my_upload_file', + }), + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_bi/images/30_60_icon.svg b/src/pages/contract/contracts_bi/images/30_60_icon.svg new file mode 100644 index 0000000..b0848d6 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/30_60_icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/ClosedIcon.svg b/src/pages/contract/contracts_bi/images/ClosedIcon.svg new file mode 100644 index 0000000..e8c3646 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/ClosedIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/InPerformanceIcon.svg b/src/pages/contract/contracts_bi/images/InPerformanceIcon.svg new file mode 100644 index 0000000..8fee536 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/InPerformanceIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/NotClosedIcon.svg b/src/pages/contract/contracts_bi/images/NotClosedIcon.svg new file mode 100644 index 0000000..76a0895 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/NotClosedIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/NotFiledIcon.svg b/src/pages/contract/contracts_bi/images/NotFiledIcon.svg new file mode 100644 index 0000000..cbfb41a --- /dev/null +++ b/src/pages/contract/contracts_bi/images/NotFiledIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/NotStampedIcon.svg b/src/pages/contract/contracts_bi/images/NotStampedIcon.svg new file mode 100644 index 0000000..05a3f16 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/NotStampedIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/PendingApplicationIcon.svg b/src/pages/contract/contracts_bi/images/PendingApplicationIcon.svg new file mode 100644 index 0000000..db6900d --- /dev/null +++ b/src/pages/contract/contracts_bi/images/PendingApplicationIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/TerminatedIcon.svg b/src/pages/contract/contracts_bi/images/TerminatedIcon.svg new file mode 100644 index 0000000..8c05107 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/TerminatedIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/images/UnreviewedIcon.svg b/src/pages/contract/contracts_bi/images/UnreviewedIcon.svg new file mode 100644 index 0000000..ef945b9 --- /dev/null +++ b/src/pages/contract/contracts_bi/images/UnreviewedIcon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/contract/contracts_bi/index.tsx b/src/pages/contract/contracts_bi/index.tsx new file mode 100644 index 0000000..75108c5 --- /dev/null +++ b/src/pages/contract/contracts_bi/index.tsx @@ -0,0 +1,328 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProCard } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { FloatButton, Space } from 'antd'; +import { useEffect, useState } from 'react'; +import Icon3060 from './images/30_60_icon.svg'; +import ClosedIcon from './images/ClosedIcon.svg'; +import InPerformanceIcon from './images/InPerformanceIcon.svg'; +import NotFiledIcon from './images/NotFiledIcon.svg'; +import NotStampedIcon from './images/NotStampedIcon.svg'; +import PendingApplicationIcon from './images/PendingApplicationIcon.svg'; +import TerminatedIcon from './images/TerminatedIcon.svg'; +import IconUnreviewed from './images/UnreviewedIcon.svg'; +import './styleBi.scss'; + +export default function Index({ title = '合同Bi' }) { + const navigate = useNavigate(); + const [getArchiveUsageInfo, setArchiveUsage] = useState({}); + const [getContractsCount, setContractsCount] = useState({}); + const getStatusOverview = async () => { + const res = await Apis.Statistics.ContractsCount.StatusOverview(); + setContractsCount(res?.data); + console.log(res, 'res'); + }; + + const getArchiveUsage = async () => { + const res = await Apis.Statistics.ContractsCount.ArchiveUsage(); + setArchiveUsage(res?.data); + }; + + useEffect(() => { + getStatusOverview(); + getArchiveUsage(); + }, []); + + return ( + + + + +
+
+ +
审核中
+
+
+
+ {getContractsCount?.pending?.under_approval?.count || 0}份 +
+
{ + navigate('/contract/contracts'); + }} + > + 去查看 +
+
+
+
+
+ +
未用印章
+
+
+
+ {getContractsCount?.pending?.not_sealed?.count || 0}份 +
+
{ + navigate('/contract/contract_seal_logs'); + }} + > + 去处理 +
+
+
+
+
+ +
未归档
+
+
+
+ {getContractsCount?.pending?.not_archived?.count || 0}份 +
+
{ + navigate('/contract/contract_archives'); + }} + > + 去处理 +
+
+
+
+
+ + + {/*
+
+ +
未关闭
+
+
+
+ {getContractsCount?.reminder?.not_closed?.count || 0}份 +
+
{ + navigate('/contract/contracts'); + }} + > + 去处理 +
+
+
*/} +
+
+ +
30天内到期
+
+
+
+ {getContractsCount?.reminder?.expire_30_days?.count || 0}份 +
+
{ + navigate('/contract/contracts'); + }} + > + 去查看 +
+
+
+
+
+ +
60天内到期
+
+
+
+ {getContractsCount?.reminder?.expire_60_days?.count || 0}份 +
+
{ + navigate('/contract/contracts'); + }} + > + 去查看 +
+
+
+
+
+ + +
+
+ +
待申请
+
+
+
+ {getContractsCount?.other?.temporary_storage?.count || 0}份 +
+
{ + navigate(`/contract/contracts?status=TemporaryStorage`); + }} + > + 去查看 +
+
+
+
+
+ +
履约中
+
+
+
+ {getContractsCount?.other?.in_progress?.count || 0}份 +
+
{ + navigate('/contract/contracts'); + }} + > + 去查看 +
+
+
+
+
+ +
已终止
+
+
+
+ {getContractsCount?.other?.closed?.count || 0}份 +
+
{ + navigate(`/contract/contracts?status=Closed`); + }} + > + 去查看 +
+
+
+
+
+ +
已解除
+
+
+
+ {getContractsCount?.other?.terminated?.count || 0}份 +
+
{ + navigate(`/contract/contracts?status=Terminated`); + }} + > + 去处理 +
+
+
+
+
+ + +
+
+ +
归档合同
+
+
+
+ {getArchiveUsageInfo?.archived_count?.count || 0}份 +
+
{ + navigate(`/contract/contract_archives?key=Finished`); + }} + > + 去查看 +
+
+
+
+
+ +
借用中
+
+
+
+ {getArchiveUsageInfo?.borrowing_count?.count || 0}份 +
+
{ + navigate('/contract/contract_archive_use'); + }} + > + 去查看 +
+
+
+ +
+
+ +
借阅数
+
+
+
+ {getArchiveUsageInfo?.read_count?.count || 0}份 +
+
{ + navigate(`/contract/contract_archive_use?key=Read`); + }} + > + 去查看 +
+
+
+
+
+ } + description="刷新" + onClick={() => { + Apis.Statistics.ContractsCount.ClearCache().then(() => { + // message.success('刷新成功'); + window.location.reload(); + }); + }} + /> +
+
+ ); +} diff --git a/src/pages/contract/contracts_bi/styleBi.scss b/src/pages/contract/contracts_bi/styleBi.scss new file mode 100644 index 0000000..777411e --- /dev/null +++ b/src/pages/contract/contracts_bi/styleBi.scss @@ -0,0 +1,248 @@ +.processed_card { + background: linear-gradient(135deg, #fffcf8 0%, #ffffff 100%); + border: 1px solid #e8e8e8; + width: 18vw; + min-width: 280px; + max-width: 320px; + padding: 20px 24px; + border-radius: 12px; + color: #f77a3a; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); + cursor: pointer; + position: relative; + overflow: hidden; + + &::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient( + 135deg, + rgba(247, 122, 58, 0.05) 0%, + transparent 100% + ); + opacity: 0; + transition: opacity 0.3s ease; + pointer-events: none; + } + + &:hover { + box-shadow: 0 8px 24px rgba(247, 122, 58, 0.15); + transform: translateY(-4px); + border-color: #f77a3a; + + &::before { + opacity: 1; + } + } + + &:active { + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(247, 122, 58, 0.12); + } + + &_header { + display: flex; + align-items: center; + margin-bottom: 16px; + position: relative; + z-index: 1; + + img { + width: 56px; + height: 56px; + transition: transform 0.3s ease; + filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1)); + } + } + + &:hover &_header img { + transform: scale(1.1) rotate(3deg); + filter: drop-shadow(0 4px 8px rgba(247, 122, 58, 0.2)); + } + + &_label { + color: #2c2c2c; + font-size: 20px; + font-weight: 600; + padding-left: 12px; + letter-spacing: 0.5px; + position: relative; + z-index: 1; + transition: color 0.3s ease; + } + + &:hover &_label { + color: #f77a3a; + } + + &_footer { + width: 100%; + display: flex; + padding-top: 12px; + align-items: center; + justify-content: space-between; + font-weight: 600; + border-top: 1px solid rgba(0, 0, 0, 0.06); + position: relative; + z-index: 1; + + &_count { + font-size: 28px; + color: #f77a3a; + font-weight: 700; + letter-spacing: -0.5px; + transition: transform 0.3s ease; + } + + &:hover &_count { + transform: scale(1.05); + } + + .unreviewed_btn { + color: #f77a3a; + background: linear-gradient(135deg, #fff4ee 0%, #ffe8d6 100%); + padding: 8px 20px; + font-size: 15px; + font-weight: 600; + border-radius: 8px; + cursor: pointer; + transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); + border: 1px solid transparent; + box-shadow: 0 2px 4px rgba(247, 122, 58, 0.1); + position: relative; + overflow: hidden; + + &::after { + content: ''; + position: absolute; + top: 50%; + left: 50%; + width: 0; + height: 0; + border-radius: 50%; + background: rgba(247, 122, 58, 0.3); + transform: translate(-50%, -50%); + transition: width 0.6s ease, height 0.6s ease; + } + + &:hover { + background: linear-gradient(135deg, #ffe8d6 0%, #ffd6b8 100%); + box-shadow: 0 4px 12px rgba(247, 122, 58, 0.2); + transform: scale(1.05); + + &::after { + width: 200px; + height: 200px; + } + } + + &:active { + transform: scale(0.98); + } + } + } +} + +.others_card { + background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 100%); + color: #2a7efb; + border-color: #e8f0ff; + + &::before { + background: linear-gradient( + 135deg, + rgba(42, 126, 251, 0.05) 0%, + transparent 100% + ); + } + + &:hover { + box-shadow: 0 8px 24px rgba(42, 126, 251, 0.15); + border-color: #2a7efb; + + &_label { + color: #2a7efb; + } + } + + &:active { + box-shadow: 0 4px 12px rgba(42, 126, 251, 0.12); + } + + &:hover &_header img { + filter: drop-shadow(0 4px 8px rgba(42, 126, 251, 0.2)); + } + + .processed_card_footer { + border-top-color: rgba(42, 126, 251, 0.1); + + &_count { + color: #2a7efb; + } + + .unreviewed_btn { + color: #2a7efb; + background: linear-gradient(135deg, #f3f8fb 0%, #e6f0ff 100%); + box-shadow: 0 2px 4px rgba(42, 126, 251, 0.1); + + &::after { + background: rgba(42, 126, 251, 0.3); + } + + &:hover { + background: linear-gradient(135deg, #e6f0ff 0%, #cce0ff 100%); + box-shadow: 0 4px 12px rgba(42, 126, 251, 0.2); + } + } + } +} + +@media (max-width: 1400px) { + .processed_card { + width: 20vw; + min-width: 260px; + max-width: 300px; + } +} + +@media (max-width: 1200px) { + .processed_card { + width: 22vw; + min-width: 240px; + max-width: 280px; + padding: 16px 20px; + + &_header img { + width: 48px; + height: 48px; + } + + &_label { + font-size: 18px; + } + + &_footer { + &_count { + font-size: 24px; + } + + .unreviewed_btn { + padding: 6px 16px; + font-size: 14px; + } + } + } +} + +@media (max-width: 768px) { + .processed_card { + width: 100%; + min-width: unset; + max-width: unset; + } +} diff --git a/src/pages/contract/contracts_other/index.tsx b/src/pages/contract/contracts_other/index.tsx new file mode 100644 index 0000000..0f5b33d --- /dev/null +++ b/src/pages/contract/contracts_other/index.tsx @@ -0,0 +1,135 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ApprovalInstancesStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useSearchParams } from '@umijs/max'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Show from './modals/Show'; +import Update from './modals/Update'; + +export default function Index({ title = '其他用印' }) { + const [searchParams, setSearchParams]: any = useSearchParams(); + + return ( + + { + setSearchParams(params); + return MyProTableProps.request( + !searchParams?.get('page') + ? { + ...params, + } + : params, + sort, + Apis.Contract.ContractOthers.List, + ); + }} + headerTitle="其他用印列表" + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '关联项目', + key: 'asset_projects_id', + hidden: true, + }), + MyColumns.EnumTag({ + title: '审核状态', + dataIndex: 'status', + valueEnum: ApprovalInstancesStatusEnum, + }), + { + title: '用印事宜', + dataIndex: 'title', + search: false, + }, + { + title: '申请说明', + dataIndex: 'reason', + search: false, + }, + // MyColumns.EnumTag({ + // title: '合同性质', + // dataIndex: 'contract_nature', + // valueEnum: ContractsContractNatureEnum, + // search: false, + // }), + + // { + // title: '关联项目', + // dataIndex: ['asset_project', 'name'], + // search: false, + // }, + MyColumns.Boolean({ + title: '是否用印', + dataIndex: 'is_sealed', + }), + { + title: '用印日期', + dataIndex: 'use_sealed_date', + valueType: 'date', + search: false, + }, + //company_employee + { + title: '申请人', + dataIndex: 'company_employee', + render: (_, item: any) => { + return `${item.company_employee?.name || '-'}${ + item.company_employee?.phone || '' + }`; + }, + search: false, + }, + { + title: '用印人', + dataIndex: 'use_sealed_by_name', + render: (_, item: any) => { + return `${item.use_sealed_by_name || '-'}${ + item.use_sealed_by_phone || '' + }`; + }, + search: false, + }, + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Contract.ContractOthers.Seal({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/contract/contracts_other/modals/Create.tsx b/src/pages/contract/contracts_other/modals/Create.tsx new file mode 100644 index 0000000..ad68d4d --- /dev/null +++ b/src/pages/contract/contracts_other/modals/Create.tsx @@ -0,0 +1,344 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useState } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + + {...MyModalFormProps.props} + title={`其他用印申请`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + form={form} + key={new Date().getDate()} + onOpenChange={(open: any) => { + if (open && props.item) { + form.resetFields(); + form.setFieldsValue({ + ...props.item, + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractOthers.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'title', + title: '申请标题', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'reason', + title: '申请原因', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + SelectContract.AssetProjects({ + key: 'asset_projects_id', + title: '关联项目', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + // mode: 'multiple', + }, + }), + { + title: '合同份数', + key: 'copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + SelectContract.ContractSeals({ + key: 'seals', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + MyFormItems.UploadImages({ + key: 'files', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + params: { + type: 'OtherContractSeal', + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes || []); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/contract/contracts_other/modals/Show.tsx b/src/pages/contract/contracts_other/modals/Show.tsx new file mode 100644 index 0000000..3b63a66 --- /dev/null +++ b/src/pages/contract/contracts_other/modals/Show.tsx @@ -0,0 +1,163 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { CompanySealsTypeEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + const handleOpenModal = () => { + if (props?.item?.id) { + setLoading(true); + Apis.Contract.ContractOthers.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }; + return ( + + + + + {/* 基本信息 */} + + {data?.title || '-'} + + + {data?.asset_project?.name || '-'} + + + {data?.company_employee?.name || '-'} + {data?.company_employee?.phone || '-'} + + + {/* 用印详情 */} + + {data?.copies || data?.number_contract_copies || '-'} + + + {data?.is_sealed ? '是' : '否'} + + + + {data?.use_sealed_date || '-'} + + + {/* 印章信息 */} + + {(data?.seals || data?.seals)?.map( + (sealId: string, index: number) => ( + + {data?.seals?.[index]?.company_supplier?.name || '-'} + + + ), + ) || '-'} + + + {/* 申请信息 */} + + {data?.reason || '-'} + + + {/* 时间信息 */} + + {data?.updated_at || '-'} + + + {data?.files && data.files.length > 0 && ( +
+ +
+ )} + {data?.files?.map((file: any, index: number) => { + const fileName = file?.name || `文件${index + 1}`; + + const handleDownload = async (e: React.MouseEvent) => { + e.preventDefault(); + try { + const response = await fetch(file?.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = fileName; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(file?.url, '_blank'); + } + }; + return ( + + ); + }) || '-'} +
+
+
+
+ + } + /> + ); +} diff --git a/src/pages/contract/contracts_other/modals/Update.tsx b/src/pages/contract/contracts_other/modals/Update.tsx new file mode 100644 index 0000000..ce00ae7 --- /dev/null +++ b/src/pages/contract/contracts_other/modals/Update.tsx @@ -0,0 +1,345 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { SelectContract } from '@/components/SelectContract'; +import { Apis } from '@/gen/Apis'; +import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Button, Form, message } from 'antd'; +import { useState } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [ApprovalTemplates, setApprovalTemplates] = useState([]); + + return ( + + {...MyModalFormProps.props} + title={`其他用印申请`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open && props.item) { + form.resetFields(); + form.setFieldsValue({ + ...props.item, + }); + } + }} + onFinish={async (values: any) => { + const { node_approvers } = values; + + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { + // 遍历模板节点,通过名称找到对应的提交节点进行校验 + for (const templateNode of ApprovalTemplates) { + // 通过名称找到对应的提交节点 + const submittedNode = node_approvers.find( + (node: any) => node?.name === templateNode?.name, + ); + + // 如果模板节点在提交数据中不存在,说明被删除了,报错 + if (!submittedNode) { + message.error(`节点"${templateNode?.name}"不能删除`); + return false; + } + + // 校验审批人 + if ( + templateNode?.node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver.value + ) { + const originalMembers = + templateNode?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ); + + if (originalMembers?.length > 0) { + const submittedMembers = submittedNode?.members || []; + + const isMatch = + originalMembers.length === submittedMembers.length && + originalMembers.every((memberId: number) => + submittedMembers.includes(memberId), + ); + + if (!isMatch) { + message.error( + `节点"${templateNode?.name}"的审批人必须与审批模板设置保持一致`, + ); + return false; + } + } + } + } + } + + return Apis.Contract.ContractOthers.Update({ + ...values, + id: props.item?.id ?? '', + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'title', + title: '申请标题', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'reason', + title: '申请原因', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + SelectContract.AssetProjects({ + key: 'asset_projects_id', + title: '关联项目', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + // mode: 'multiple', + }, + }), + { + title: '合同份数', + key: 'copies', + valueType: 'digit', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { width: '100%' }, + }, + }, + SelectContract.ContractSeals({ + key: 'seals', + required: true, + title: '选择印章', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + mode: 'multiple', + }, + }), + MyFormItems.UploadImages({ + key: 'files', + title: '上传附件', + tooltip: '支持上传任意格式的文件', + uploadType: 'file', + colProps: { span: 24 }, + // accept: '.docx,.doc,.pdf', + max: 100, + required: true, + }), + + Selects?.ApprovalTemplates({ + key: 'approval_templates_id', + title: '审批模版', + params: { + type: 'OtherContractSeal', + is_enabled: '1', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + onChange: (e: any) => { + // 确保e是有效值,并且使用正确的value字段 + if (e) { + const templateId = typeof e === 'object' ? e.value : e; + Apis.Approval.ApprovalTemplates.Show({ + id: templateId, + }).then((res) => { + setApprovalTemplates(res?.data?.approval_template_nodes || []); + form.setFieldsValue({ + approval_templates_id: templateId, + node_approvers: res?.data?.approval_template_nodes?.map( + (item: any) => ({ + ...item, + members: item?.approval_template_node_members?.map( + (member: any) => member?.company_employees_id, + ), + }), + ), + }); + }); + } + // 不返回任何值,防止默认行为 + }, + }, + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + return approval_templates_id + ? [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + 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, + }, + fieldProps: { + disabled: true, + }, + }), + { + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + fieldProps: { + disabled: true, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item + ?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee + ?.name || '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/customer/archive/modals/Delivery.tsx b/src/pages/customer/archive/modals/Delivery.tsx index fa9ab2a..6293082 100644 --- a/src/pages/customer/archive/modals/Delivery.tsx +++ b/src/pages/customer/archive/modals/Delivery.tsx @@ -17,14 +17,6 @@ import { Form, message } from 'antd'; export default function Delivery(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - const GetOwners = () => { - let owner = - props.item?.house_occupants?.filter( - (res: any) => res?.house_relation === 'Owner', - ) || []; - return owner?.length > 0; - }; - return ( {...MyModalFormProps.props} @@ -35,7 +27,6 @@ export default function Delivery(props: MyBetaModalFormProps) { } diff --git a/src/pages/quality/asset_items_maintenances/index.tsx b/src/pages/quality/asset_items_maintenances/index.tsx new file mode 100644 index 0000000..311b38e --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/index.tsx @@ -0,0 +1,33 @@ +import { MyPageContainer } from '@/common'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import MyList from './list'; +import MyMaintenanceRules from './maintenance_rules'; + +export default function Index({ title = '维保管理' }) { + // const getCurrentPermissions = useCurrentPermissions(); + + const items: TabsProps['items'] = [ + { + key: '1', + label: '维保工单', + children: , + }, + { + key: '2', + label: '维保规则', + children: , + }, + ]; + + return ( + + + + ); +} diff --git a/src/pages/quality/asset_items_maintenances/list/index.tsx b/src/pages/quality/asset_items_maintenances/list/index.tsx new file mode 100644 index 0000000..2983362 --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/list/index.tsx @@ -0,0 +1,101 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseChargeTasksTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Assign from './modals/Assign'; +import CreateMaintenances from './modals/CreateMaintenances'; +import MyShow from './modals/Show'; + +export default function Index({ title = '维保工单' }) { + return ( + + MyProTableProps.request( + params, + sort, + Apis.Asset.AssetItemMaintenances.List, + ) + } + headerTitle={title} + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + // MyColumns.EnumTag({ + // title: '状态', + // dataIndex: 'status', + // valueEnum: AssetItemMaintenanceStatusEnum, + // }), + // MyColumns.EnumTag({ + // title: '类型', + // dataIndex: 'type', + // search: false, + // valueEnum: AssetItemMaintenanceTypeEnum, + // }), + MyColumns.EnumTag({ + title: '创建方式', + dataIndex: 'source', + valueEnum: HouseChargeTasksTypeEnum, + }), + { + title: '资产名称', + dataIndex: 'name', + }, + { + title: '资产型号', + dataIndex: 'specification', + search: false, + }, + { + title: '资产分类', + render: (_, item: any) => { + return `${item?.asset_item_category_level1_name}-${item?.asset_item_category_level2_name}-${item?.asset_item_category_level3_name}`; + }, + search: false, + }, + { + title: '完成时间', + dataIndex: 'deadline', + search: false, + }, + { + title: '维保人', + dataIndex: ['assigned_employee', 'name'], + search: false, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Asset.AssetItemMaintenances.Close({ id: item.id }).then( + () => action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/asset_items_maintenances/list/modals/Assign.tsx b/src/pages/quality/asset_items_maintenances/list/modals/Assign.tsx new file mode 100644 index 0000000..91d57d6 --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/list/modals/Assign.tsx @@ -0,0 +1,57 @@ +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 Assign(props: MyBetaModalFormProps & { item: any }) { + 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) => { + Apis.Asset.AssetItemMaintenances.Assign({ + ...values, + id: props.item.id, + }) + .then(() => { + props.reload?.(); + message.success('指派成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '选择员工', + key: 'assigned_employee_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/asset_items_maintenances/list/modals/CreateMaintenances.tsx b/src/pages/quality/asset_items_maintenances/list/modals/CreateMaintenances.tsx new file mode 100644 index 0000000..94ee0d9 --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/list/modals/CreateMaintenances.tsx @@ -0,0 +1,110 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +// import ModalsAssetItemsSelectList from '@/components/ModalsAssetItemsSelectList'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +// import { AssetItemMaintenanceTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message, Space } from 'antd'; +export default function Index(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`${props.title}工单`} + trigger={ + + } + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); + } + }} + onFinish={async (values: any) => { + return Apis.Asset.AssetItemMaintenances.Store({ + ...values, + asset_items_id: values?.asset_items?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + // MyFormItems.EnumRadio({ + // key: 'type', + // title: '维护类型', + // formItemProps: { ...rulesHelper.text }, + // valueEnum: AssetItemMaintenanceTypeEnum, + // colProps: { span: 24 }, + // }), + { + formItemProps: { ...rulesHelper.text }, + title: '请选择资产', + key: 'asset_items', + renderFormItem: (schema, config) => { + return ( + + + {/* { + form.setFieldValue('asset_items', e?.[0]); + }} + /> */} + {config?.value?.name + ? `你已选择资产:${config?.value?.name}` + : ''} + + + ); + }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.number }, + }), + { + title: '完成时间', + key: 'deadline', + colProps: { span: 12 }, + fieldProps: { + style: { + width: '100%', + }, + }, + valueType: 'date', + }, + { + title: '维护内容', + key: 'description', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '仅支持docx,doc,pdf格式', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/asset_items_maintenances/list/modals/Show.tsx b/src/pages/quality/asset_items_maintenances/list/modals/Show.tsx new file mode 100644 index 0000000..3559f02 --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/list/modals/Show.tsx @@ -0,0 +1,116 @@ +import { MyBetaModalFormProps } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +// import { +// AssetItemMaintenanceStatusEnum, +// AssetItemMaintenanceTypeEnum, +// } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Flex, Space, Steps } from 'antd'; +import { useState } from 'react'; + +export default function Index(props: MyBetaModalFormProps) { + const [showData, setShow] = useState({}); + + const getShow = () => { + if (props?.item?.id) { + Apis.Asset.AssetItemMaintenances.Show({ + id: props?.item?.id, + }).then((res: any) => { + setShow(res?.data); + }); + } + }; + + return ( + getShow()} + node={ + + + + {/* */} + + + {/* */} + + + {showData?.name || '-'}-{showData?.specification} + + + {showData?.assigned_employee?.name || '-'}- + {showData?.assigned_employee?.phone || '-'} + + + {showData?.asset_item_category_level1_name || '-'}/ + {showData?.asset_item_category_level2_name || '-'}/ + {showData?.asset_item_category_level3_name || '-'} + + + {showData?.deadline || '-'} + + + {showData?.description || '-'} + + + + { + return { + title: res?.content, + description: ( + + {/* + */} + {res?.created_at} + + ), + }; + }, + )} + /> + + + + + {showData?.attachments?.map((res: any, index: number) => { + return ( + + ); + })} + + + + + } + /> + ); +} diff --git a/src/pages/quality/asset_items_maintenances/maintenance_rules/index.tsx b/src/pages/quality/asset_items_maintenances/maintenance_rules/index.tsx new file mode 100644 index 0000000..cff28ae --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/maintenance_rules/index.tsx @@ -0,0 +1,88 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +// import { AssetItemMaintenanceRuleStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import RulesCreate from './modals/RulesCreate'; +import RulesUpdate from './modals/RulesUpdate'; + +export default function Index({ title = '维保规则' }) { + return ( + + MyProTableProps.request( + params, + sort, + Apis.Asset.AssetItemMaintenanceRules.List, + ) + } + headerTitle={title} + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + // MyColumns.EnumTag({ + // title: '状态', + // dataIndex: 'status', + // valueEnum: AssetItemMaintenanceRuleStatusEnum, + // }), + { + title: '维保项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + { + title: '维保资产数量', + dataIndex: 'asset_item_maintenance_rule_items_count', + search: false, + }, + { + title: '维保时间间隔(天)', + dataIndex: 'cycle_days', + search: false, + }, + { + title: '提前生成天数', + dataIndex: 'advance_days', + search: false, + }, + { + title: '完成期限天数', + dataIndex: 'deadline_days', + search: false, + }, + // MyColumns.ToggleEnabled({ + // onToggleEnabled: Apis.Asset.AssetItemMaintenanceRules.Toggle, + // search: false, + // }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Asset.AssetItemMaintenanceRules.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesCreate.tsx b/src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesCreate.tsx new file mode 100644 index 0000000..5b90a2c --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesCreate.tsx @@ -0,0 +1,138 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyModalFormProps, + MyProTableProps, + rulesHelper, +} from '@/common'; +// import ModalsAssetItemsSelectList from '@/components/ModalsAssetItemsSelectList'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard, ProTable } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加维保规则`} + wrapperCol={{ span: 24 }} + width="800px" + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); + } + }} + key={new Date().getTime()} + form={form} + onFinish={async (values: any) => { + return Apis.Asset.AssetItemMaintenanceRules.Store({ + ...values, + asset_item_ids: values.asset_items.map((item: any) => item.id), + }) + .then(() => { + props.reload?.(); + message.success('添加成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '维保规则名称', + key: 'name', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '维保时间间隔(天)', + key: 'cycle_days', + colProps: { span: 12 }, + fieldProps: { min: 1, style: { width: '100%' }, suffix: '天' }, + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + }, + { + title: '提前生成天数', + key: 'advance_days', + colProps: { span: 12 }, + fieldProps: { min: 1, style: { width: '100%' }, suffix: '天' }, + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + }, + { + title: '完成期限天数', + key: 'deadline_days', + colProps: { span: 12 }, + fieldProps: { min: 1, style: { width: '100%' }, suffix: '天' }, + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '选择资产', + key: 'asset_items', + formItemProps: { ...rulesHelper.array }, + renderFormItem: (schema, config) => { + console.log(config, '2222'); + return ( + + { + // form.setFieldValue('asset_items', e); + // }} + // /> + // } + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + MyColumns.Option({ + render: (_, item: any) => ( + { + let data = JSON.parse( + JSON.stringify(form.getFieldValue('asset_items')), + ); + form.setFieldValue( + 'asset_items', + data.filter((res: any) => res?.id !== item?.id), + ); + }} + /> + ), + }), + ]} + /> + + ); + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesUpdate.tsx b/src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesUpdate.tsx new file mode 100644 index 0000000..497e546 --- /dev/null +++ b/src/pages/quality/asset_items_maintenances/maintenance_rules/modals/RulesUpdate.tsx @@ -0,0 +1,151 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyModalFormProps, + MyProTableProps, + rulesHelper, +} from '@/common'; +// import ModalsAssetItemsSelectList from '@/components/ModalsAssetItemsSelectList'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard, ProTable } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps & { item: any }) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={props.title} + wrapperCol={{ span: 24 }} + width="800px" + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + Apis.Asset.AssetItemMaintenanceRules.Show({ + id: props?.item?.id, + }).then((res) => { + form.setFieldsValue({ + ...res?.data, + asset_items: res?.data?.asset_item_maintenance_rule_items.map( + (item: any) => ({ + id: item?.asset_items_id, + name: item?.asset_item?.name, + }), + ), + }); + }); + } + }} + key={new Date().getTime()} + form={form} + onFinish={async (values: any) => { + return Apis.Asset.AssetItemMaintenanceRules.Update({ + ...values, + asset_item_ids: values.asset_items.map((item: any) => item.id), + id: props?.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(`${props.title}成功`); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '维保规则名称', + key: 'name', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '维保时间间隔(天)', + key: 'cycle_days', + colProps: { span: 12 }, + fieldProps: { min: 1, style: { width: '100%' }, suffix: '天' }, + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + }, + { + title: '提前生成天数', + key: 'advance_days', + colProps: { span: 12 }, + fieldProps: { min: 1, style: { width: '100%' }, suffix: '天' }, + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + }, + { + title: '完成期限天数', + key: 'deadline_days', + colProps: { span: 12 }, + fieldProps: { min: 1, style: { width: '100%' }, suffix: '天' }, + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '选择资产', + key: 'asset_items', + formItemProps: { ...rulesHelper.array }, + renderFormItem: (schema, config) => { + console.log(config, '2222'); + return ( + + { + // form.setFieldValue('asset_items', e); + // }} + // /> + // } + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + MyColumns.Option({ + render: (_, item: any) => ( + { + let data = JSON.parse( + JSON.stringify(form.getFieldValue('asset_items')), + ); + form.setFieldValue( + 'asset_items', + data.filter((res: any) => res?.id !== item?.id), + ); + }} + /> + ), + }), + ]} + /> + + ); + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/categories/index.tsx b/src/pages/quality/emergency/categories/index.tsx new file mode 100644 index 0000000..df1dddd --- /dev/null +++ b/src/pages/quality/emergency/categories/index.tsx @@ -0,0 +1,81 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '分类' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + create: , + }, + 'MyCategories', + ); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Emergency.EmergencyEventCategories.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyCategories', + ); + }; + + return ( + + MyProTableProps.request( + params, + sort, + Apis.Emergency.EmergencyEventCategories.TreeList, + ) + } + headerTitle="突发事件分类" + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + { + title: '分类描述', + dataIndex: 'description', + search: false, + }, + MyColumns.Boolean({ + title: '是否启用', + dataIndex: 'is_enabled', + search: false, + }), + MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/categories/modals/Create.tsx b/src/pages/quality/emergency/categories/modals/Create.tsx new file mode 100644 index 0000000..732db15 --- /dev/null +++ b/src/pages/quality/emergency/categories/modals/Create.tsx @@ -0,0 +1,50 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { TreeSelects } from '@/components/TreeSelect'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="500px" + key={new Date().getTime()} + trigger={} + onFinish={async (values) => + Apis.Emergency.EmergencyEventCategories.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + TreeSelects.TreeSelectEventCategories(), + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'description', + title: '分类描述', + valueType: 'textarea', + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/categories/modals/Update.tsx b/src/pages/quality/emergency/categories/modals/Update.tsx new file mode 100644 index 0000000..6b54c92 --- /dev/null +++ b/src/pages/quality/emergency/categories/modals/Update.tsx @@ -0,0 +1,59 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { TreeSelects } from '@/components/TreeSelect'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Emergency.EmergencyEventCategories.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + TreeSelects.TreeSelectEventCategories(), + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'description', + title: '分类描述', + valueType: 'textarea', + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/events/index.tsx b/src/pages/quality/emergency/events/index.tsx new file mode 100644 index 0000000..f23641f --- /dev/null +++ b/src/pages/quality/emergency/events/index.tsx @@ -0,0 +1,126 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + EmergencyEventsCompensationTypeEnum, + EmergencyEventsStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Assign from './modals/ApplyClose'; +import Create from './modals/Create'; +import Review from './modals/Review'; +import Update from './modals/Update'; + +export default function Index({ title = '突发事件' }) { + const getCurrentPermissions = useCurrentPermissions(); + + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + create: , + }, + 'MyEvents', + ); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + show: ( + + ), + assign: , + update: , + review: , + delete: ( + + Apis.Emergency.EmergencyEvents.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyEvents', + ); + }; + return ( + + MyProTableProps.request( + params, + sort, + Apis.Emergency.EmergencyEvents.List, + ) + } + headerTitle={`${title}列表`} + toolBarRender={(action: any) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + { + title: '所属项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: EmergencyEventsStatusEnum, + }), + MyColumns.EnumTag({ + title: '赔偿方', + dataIndex: 'compensation_type', + valueEnum: EmergencyEventsCompensationTypeEnum, + }), + { + title: '赔偿事项', + search: false, + render: (_, item: any) => { + return ( +
+
赔偿比例:{item?.compensation_rate}%
+
赔偿金额:{item?.compensation_amount}元
+
已支付赔偿金额:{item?.compensation_paid_amount}元
+
+ ); + }, + }, + { + title: '分类', + search: false, + render: (_, item: any) => { + return `${item?.one_emergency_categories_name} / ${item?.two_emergency_categories_name}`; + }, + }, + { + title: '等级', + dataIndex: 'emergency_event_levels_name', + search: false, + }, + MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/events/modals/ApplyClose.tsx b/src/pages/quality/emergency/events/modals/ApplyClose.tsx new file mode 100644 index 0000000..3e0ff17 --- /dev/null +++ b/src/pages/quality/emergency/events/modals/ApplyClose.tsx @@ -0,0 +1,53 @@ +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 ApplyClose( + props: MyBetaModalFormProps & { item: any }, +) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`申请关闭`} + wrapperCol={{ span: 24 }} + width="600px" + labelAlign="left" + trigger={ + + } + key={new Date().getTime()} + form={form} + onFinish={async (values: any) => { + return Apis.Emergency.EmergencyEvents.ApplyClose({ + ...values, + id: props.item.id, + }) + .then(() => { + props.reload?.(); + message.success('提交成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '处理结果', + colProps: { span: 24 }, + dataIndex: 'handled_result', + valueType: 'textarea', + }, + { + title: '反思与总结', + colProps: { span: 24 }, + dataIndex: 'introspection', + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/events/modals/Create.tsx b/src/pages/quality/emergency/events/modals/Create.tsx new file mode 100644 index 0000000..f6dcfe3 --- /dev/null +++ b/src/pages/quality/emergency/events/modals/Create.tsx @@ -0,0 +1,179 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="800px" + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + trigger={} + onFinish={async (values: any) => + Apis.Emergency.EmergencyEvents.Store({ + ...values, + two_emergency_categories_id: values?.two_emergency_categories_id?.[1], + emergency_event_organizations_id: + values?.emergency_event_organizations_id?.[0], + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + // MyFormItems.EnumSelect({ + // key: 'status', + // title: '状态', + // valueEnum: EmergencyEventsStatusEnum, + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), + Selects.EmergencyEventLevels({ + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects.EmergencyCategories({ + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects.OrganizationSearch({ + title: '突发事件提报组织', + key: 'emergency_event_organizations_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'name', + value: 'id', + children: 'children', + }, + }, + }), + { + key: 'emergency_time', + title: '突发事件时间', + colProps: { span: 12 }, + valueType: 'date', + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'emergency_location', + title: '突发事件发生地点', + valueType: 'textarea', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'emergency_description', + title: '突发事件描述', + valueType: 'textarea', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'emergency_cause', + title: '突发事件原因', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 12 }, + }, + { + key: 'cause_result', + title: '突发事件造成结果', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 12 }, + }, + { + key: 'supplement', + title: '突发事件补充信息', + valueType: 'textarea', + colProps: { span: 12 }, + }, + { + key: 'related_person', + title: '突发事件关联人物', + valueType: 'textarea', + colProps: { span: 12 }, + }, + // MyFormItems.EnumRadio({ + // key: 'compensation_type', + // title: '赔偿方', + // valueEnum: EmergencyEventsCompensationTypeEnum, + // colProps: { span: 6 }, + // }), + // { + // key: 'compensation_rate', + // title: '突发事件赔偿比例', + // colProps: { span: 6 }, + // valueType: 'digit', + // fieldProps: { + // style: { width: '100%' }, + // suffix: '%', + // }, + // }, + // { + // key: 'compensation_amount', + // title: '突发事件赔偿金额', + // colProps: { span: 6 }, + // valueType: 'digit', + // fieldProps: { + // style: { width: '100%' }, + // prefix: '¥', + // }, + // }, + // { + // key: 'compensation_paid_amount', + // title: '突发事件已支付赔偿金额', + // colProps: { span: 6 }, + // valueType: 'digit', + // fieldProps: { + // style: { width: '100%' }, + // prefix: '¥', + // }, + // }, + MyFormItems.UploadImages({ + key: 'emergency_images', + title: '突发事件图片', + max: 100, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/events/modals/Review.tsx b/src/pages/quality/emergency/events/modals/Review.tsx new file mode 100644 index 0000000..f120fde --- /dev/null +++ b/src/pages/quality/emergency/events/modals/Review.tsx @@ -0,0 +1,83 @@ +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'; + +const DormigoryBedAuditFlowsAuditStatusEnum = { + Approved: { text: '通过', value: 'Approved' }, + Rejected: { text: '驳回', value: 'Rejected' }, +}; +export default function Review(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title="审核" + trigger={ + + } + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Emergency.EmergencyEvents.Audit({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('审核成功'); + props.reload?.(); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'audit_status', + title: '审核意见', + valueEnum: DormigoryBedAuditFlowsAuditStatusEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['audit_status'], + columns: ({ audit_status }) => { + return audit_status === 'Rejected' + ? [ + { + title: '驳回理由', + valueType: 'textarea', + key: 'audit_remark', + formItemProps: { ...rulesHelper.text }, + }, + ] + : [ + { + title: '审核意见', + valueType: 'textarea', + key: 'audit_remark', + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/events/modals/Update.tsx b/src/pages/quality/emergency/events/modals/Update.tsx new file mode 100644 index 0000000..9de970a --- /dev/null +++ b/src/pages/quality/emergency/events/modals/Update.tsx @@ -0,0 +1,190 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="800px" + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open && props.item) { + Apis.Emergency.EmergencyEvents.Show({ + id: props.item?.id ?? 0, + }).then((res) => { + form.setFieldsValue({ + ...res?.data, + two_emergency_categories_id: [ + res?.data?.one_emergency_categories_id, + res?.data?.two_emergency_categories_id, + ], + }); + }); + } + }} + onFinish={async (values: any) => + Apis.Emergency.EmergencyEvents.Update({ + ...values, + two_emergency_categories_id: values?.two_emergency_categories_id?.[1], + emergency_event_organizations_id: + values?.emergency_event_organizations_id?.[0], + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + // MyFormItems.EnumSelect({ + // key: 'status', + // title: '状态', + // valueEnum: EmergencyEventsStatusEnum, + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), + Selects.EmergencyEventLevels({ + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects.EmergencyCategories({ + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects.OrganizationSearch({ + title: '突发事件提报组织', + key: 'emergency_event_organizations_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'name', + value: 'id', + children: 'children', + }, + }, + }), + { + key: 'emergency_time', + title: '突发事件时间', + colProps: { span: 12 }, + valueType: 'date', + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'emergency_location', + title: '突发事件发生地点', + valueType: 'textarea', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'emergency_description', + title: '突发事件描述', + valueType: 'textarea', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'emergency_cause', + title: '突发事件原因', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 12 }, + }, + { + key: 'cause_result', + title: '突发事件造成结果', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 12 }, + }, + { + key: 'supplement', + title: '突发事件补充信息', + valueType: 'textarea', + colProps: { span: 12 }, + }, + { + key: 'related_person', + title: '突发事件关联人物', + valueType: 'textarea', + colProps: { span: 12 }, + }, + // MyFormItems.EnumRadio({ + // key: 'compensation_type', + // title: '突发事件赔偿类型', + // valueEnum: EmergencyEventsCompensationTypeEnum, + // colProps: { span: 6 }, + // }), + // { + // key: 'compensation_rate', + // title: '突发事件赔偿比例', + // colProps: { span: 6 }, + // valueType: 'digit', + // fieldProps: { + // style: { width: '100%' }, + // suffix: '%', + // }, + // }, + // { + // key: 'compensation_amount', + // title: '突发事件赔偿金额', + // colProps: { span: 6 }, + // valueType: 'digit', + // fieldProps: { + // style: { width: '100%' }, + // prefix: '¥', + // }, + // }, + // { + // key: 'compensation_paid_amount', + // title: '突发事件已支付赔偿金额', + // colProps: { span: 6 }, + // valueType: 'digit', + // fieldProps: { + // style: { width: '100%' }, + // prefix: '¥', + // }, + // }, + MyFormItems.UploadImages({ + key: 'emergency_images', + title: '突发事件图片', + max: 100, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/events/show/$id.tsx b/src/pages/quality/emergency/events/show/$id.tsx new file mode 100644 index 0000000..2c7e519 --- /dev/null +++ b/src/pages/quality/emergency/events/show/$id.tsx @@ -0,0 +1,48 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { useParams } from '@umijs/max'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import MyFollows from '../../follows'; +import Info from './components/Info'; + +export default function Show({ title = '详情' }: { title?: string } = {}) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.Emergency.EmergencyEvents.Show(paramsId).then((res) => { + setShow(res?.data); + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + const items = [ + { + label: '事件详情', + key: 'emergency_events_show_info', + children: , + }, + { + label: '事件跟进记录', + key: 'emergency_events_show_follows', + children: , + }, + ]; + + return ( + data?.id && ( + + + + ) + ); +} diff --git a/src/pages/quality/emergency/events/show/components/Info.tsx b/src/pages/quality/emergency/events/show/components/Info.tsx new file mode 100644 index 0000000..533486b --- /dev/null +++ b/src/pages/quality/emergency/events/show/components/Info.tsx @@ -0,0 +1,87 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { showTime } from '@/common/utils/day'; +import MyShowAttachments from '@/components/ShowAttachments'; +import { EmergencyEventsStatusEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + const { item } = props; + + return ( + + + + + {item?.name} + + + {item?.asset_project?.name} + + + + + + {item?.emergency_event_levels_name} + + + + {item?.one_emergency_categories_name}/ + {item?.two_emergency_categories_name} + + + + {showTime(item?.emergency_time, 10)} + + + + {item?.emergency_event_organization?.name} + + + {item?.emergency_location} + + + {item?.emergency_description} + + + {item?.emergency_cause} + + + {item?.cause_result} + + + {item?.supplement} + + + {item?.related_person} + + + + {/* + + + + + + {item?.compensation_rate}% + + + {item?.compensation_amount}元 + + + {item?.compensation_paid_amount}元 + + + */} + + + ); +} diff --git a/src/pages/quality/emergency/follows/index.tsx b/src/pages/quality/emergency/follows/index.tsx new file mode 100644 index 0000000..4c1dd37 --- /dev/null +++ b/src/pages/quality/emergency/follows/index.tsx @@ -0,0 +1,103 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Image, Space } from 'antd'; +import Create from './modals/Create'; +import Show from './modals/Show'; + +export default function Index(props: MyBetaModalFormProps) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + Create: ( + + ), + }, + 'MyFollows', + ); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Emergency.EmergencyEventFollows.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyFollows', + ); + }; + return ( + + MyProTableProps.request( + { + ...params, + emergency_events_id: props?.item?.id, + }, + sort, + Apis.Emergency.EmergencyEventFollows.List, + ) + } + search={false} + headerTitle="跟进记录" + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '操作', + dataIndex: 'node_name', + }, + { + title: '内容', + dataIndex: 'content', + }, + { + title: '附件', + render: (_, item: any) => { + return ( + + {item?.attachments?.map((i: any, index: number) => ( + + ))} + + ); + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/follows/modals/Create.tsx b/src/pages/quality/emergency/follows/modals/Create.tsx new file mode 100644 index 0000000..932b422 --- /dev/null +++ b/src/pages/quality/emergency/follows/modals/Create.tsx @@ -0,0 +1,52 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + trigger={} + onFinish={async (values) => + Apis.Emergency.EmergencyEventFollows.Store({ + ...values, + emergency_events_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'content', + title: '内容', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'attachments', + title: '上传附件', + tooltip: '仅支持docx,doc,pdf格式', + uploadType: 'file', + colProps: { span: 24 }, + max: 100, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/follows/modals/Show.tsx b/src/pages/quality/emergency/follows/modals/Show.tsx new file mode 100644 index 0000000..2a61a45 --- /dev/null +++ b/src/pages/quality/emergency/follows/modals/Show.tsx @@ -0,0 +1,58 @@ +import { MyBetaModalFormProps, MyButtons, MyModalFormProps } from '@/common'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, Image } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`查看`} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + columns={[ + { + title: '操作', + key: 'node_name', + renderFormItem: () => { + return props?.item?.node_name; + }, + }, + { + key: 'content', + title: '内容', + renderFormItem: () => { + return props?.item?.content; + }, + }, + { + title: '附件', + renderFormItem: () => { + return props?.item?.attachments?.length ? ( + + {props?.item?.attachments?.map((i: any, index: number) => ( + + ))} + + ) : ( + 无附件 + ); + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/index.tsx b/src/pages/quality/emergency/index.tsx new file mode 100644 index 0000000..4eed4a4 --- /dev/null +++ b/src/pages/quality/emergency/index.tsx @@ -0,0 +1,42 @@ +import { MyPageContainer } from '@/common'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import MyCategories from './categories'; +import MyEvents from './events'; +import MyLevels from './levels'; +import MyTeams from './teams'; + +export default function Index({ title = '突发事件' }) { + const items: TabsProps['items'] = [ + { + key: 'MyEvents', + label: '突发事件', + children: , + }, + { + key: 'MyTeams', + label: '应急小组', + children: , + }, + { + key: 'MyCategories', + label: '事件分类', + children: , + }, + { + key: 'MyLevels', + label: '事件级别', + children: , + }, + ]; + return ( + + + + ); +} diff --git a/src/pages/quality/emergency/levels/index.tsx b/src/pages/quality/emergency/levels/index.tsx new file mode 100644 index 0000000..98b5704 --- /dev/null +++ b/src/pages/quality/emergency/levels/index.tsx @@ -0,0 +1,76 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '等级' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + Create: , + }, + 'MyLevels', + ); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Emergency.EmergencyEventLevels.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyLevels', + ); + }; + return ( + + MyProTableProps.request( + params, + sort, + Apis.Emergency.EmergencyEventLevels.List, + ) + } + headerTitle="突发事件等级" + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + MyColumns.Boolean({ + title: '是否启用', + dataIndex: 'is_enabled', + search: false, + }), + MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/levels/modals/Create.tsx b/src/pages/quality/emergency/levels/modals/Create.tsx new file mode 100644 index 0000000..e0bef68 --- /dev/null +++ b/src/pages/quality/emergency/levels/modals/Create.tsx @@ -0,0 +1,43 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="500px" + key={new Date().getTime()} + trigger={} + onFinish={async (values) => + Apis.Emergency.EmergencyEventLevels.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/levels/modals/Update.tsx b/src/pages/quality/emergency/levels/modals/Update.tsx new file mode 100644 index 0000000..88045fa --- /dev/null +++ b/src/pages/quality/emergency/levels/modals/Update.tsx @@ -0,0 +1,53 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="500px" + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Emergency.EmergencyEventLevels.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/teams/index.tsx b/src/pages/quality/emergency/teams/index.tsx new file mode 100644 index 0000000..90f6513 --- /dev/null +++ b/src/pages/quality/emergency/teams/index.tsx @@ -0,0 +1,105 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '应急小组' }) { + const getCurrentPermissions = useCurrentPermissions(); + + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + Create: ( + + ), + }, + 'MyLevels', + ); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Emergency.EmergencyEventCategories.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyLevels', + ); + }; + return ( + + MyProTableProps.request( + params, + sort, + Apis.Emergency.EmergencyEventTeams.List, + ) + } + headerTitle="应急小组" + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + { + title: '名称', + dataIndex: 'name', + }, + { + title: '队长', + dataIndex: ['company_employee', 'name'], + search: false, + }, + MyColumns.Boolean({ + title: '是否启用', + dataIndex: 'is_enabled', + search: false, + }), + { + title: '成员', + search: false, + render: (_, item: any) => { + return ( + + {item?.emergency_team_members?.map( + (res: any, index: number) => { + return ( +
{res?.employee_name}
+ ); + }, + )} +
+ ); + }, + }, + MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/teams/modals/Create.tsx b/src/pages/quality/emergency/teams/modals/Create.tsx new file mode 100644 index 0000000..2c27f0d --- /dev/null +++ b/src/pages/quality/emergency/teams/modals/Create.tsx @@ -0,0 +1,97 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { EmergencyTeamMembersPositionEnum } 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}`} + width="800px" + wrapperCol={{ span: 24 }} + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Emergency.EmergencyEventTeams.Store(values) + .then(() => { + props.reload?.(); + message.success('添加成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '名称', + key: 'name', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects?.Employees({ + key: 'company_employees_id', + title: '组长', + colProps: { span: 12 }, + required: true, + }), + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + }, + { + valueType: 'formList', + dataIndex: 'members', + title: '团队成员', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + Selects?.Employees({ + key: 'company_employees_id', + title: '成员', + colProps: { span: 12 }, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'position', + title: '身份', + valueEnum: EmergencyTeamMembersPositionEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/quality/emergency/teams/modals/Update.tsx b/src/pages/quality/emergency/teams/modals/Update.tsx new file mode 100644 index 0000000..f23c17a --- /dev/null +++ b/src/pages/quality/emergency/teams/modals/Update.tsx @@ -0,0 +1,108 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { EmergencyTeamMembersPositionEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + width="800px" + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + members: props.item?.emergency_team_members?.map( + (item: { company_employees_id: number; position: string }) => ({ + company_employees_id: item.company_employees_id, + position: item.position, + }), + ), + }); + } + }} + onFinish={async (values) => + Apis.Emergency.EmergencyEventTeams.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '名称', + key: 'name', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects?.Employees({ + key: 'company_employees_id', + title: '组长', + colProps: { span: 12 }, + required: true, + }), + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + }, + { + valueType: 'formList', + dataIndex: 'members', + title: '团队成员', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + Selects?.Employees({ + key: 'company_employees_id', + title: '成员', + colProps: { span: 12 }, + required: true, + }), + MyFormItems.EnumSelect({ + key: 'position', + title: '身份', + valueEnum: EmergencyTeamMembersPositionEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/quality/index/index.tsx b/src/pages/quality/index/index.tsx new file mode 100644 index 0000000..cb32b76 --- /dev/null +++ b/src/pages/quality/index/index.tsx @@ -0,0 +1,151 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseWorkOrdersAssignStatusEnum, + HouseWorkOrdersStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space, Tag } from 'antd'; +import WorkOrderShow from '../../work_order/list/modals/WorkOrderShow'; +import Create from './modals/Create'; +import Show from './modals/Show'; +import Update from './modals/Update'; + +export default function Index({ title = '品质核查' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions({ + create: , + }); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions({ + show: , + update: , + delete: ( + + Apis.QualityCheck.QualityChecks.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }); + }; + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.QualityCheck.QualityChecks.List, + ) + } + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: '核查对象', + dataIndex: 'check_object', + // search: false, + }, + { + title: '核查日期', + dataIndex: 'check_date', + search: false, + }, + { + title: '核查日期', + dataIndex: 'check_date', + valueType: 'dateRange', + hidden: true, + }, + { + title: '核查得分', + dataIndex: 'check_score', + search: false, + render: (value: any) => `${value?.slice(0, 2) || 0} 分`, + }, + { + title: '下发整改', + dataIndex: 'is_rectification', + search: false, + render: (value) => ( + {value ? '是' : '否'} + ), + }, + { + title: '整改工单', + dataIndex: 'house_work_orders_id', + search: false, + render: (value: any) => ( + + ), + }, + MyColumns.EnumTag({ + title: '分配状态', + dataIndex: ['house_work_order', 'assign_status'], + valueEnum: HouseWorkOrdersAssignStatusEnum, + }), + MyColumns.EnumTag({ + title: '处理进度', + dataIndex: ['house_work_order', 'status'], + valueEnum: HouseWorkOrdersStatusEnum, + search: false, + }), + { + title: '核查人', + dataIndex: 'employee_name', + render: (_, record) => { + return `${record?.employee_name || ''}-${ + record?.employee_phone || '' + }`; + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + <>{tableRender(item, action)} + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/quality/index/modals/Create.tsx b/src/pages/quality/index/modals/Create.tsx new file mode 100644 index 0000000..06b0e3e --- /dev/null +++ b/src/pages/quality/index/modals/Create.tsx @@ -0,0 +1,153 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加核查记录`} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.QualityCheck.QualityChecks.Store(values) + .then(() => { + props.reload?.(); + message.success('添加核查记录成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'check_date', + title: '核查日期', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + disabledDate: (current: any) => { + // 禁用未来的日期 + return current && current > new Date(); + }, + style: { + width: '100%', + }, + }, + }, + { + key: 'check_object', + title: '核查对象', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入对象信息', + }, + }, + { + key: 'check_score', + title: '核查得分', + valueType: 'digit', + fieldProps: { + addonAfter: '分', + max: 100, + min: 0, + }, + formItemProps: { required: true }, + colProps: { span: 24 }, + }, + { + key: 'check_description', + title: '核查说明', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'check_images', + title: '核查文件', + tooltip: '最多上传5张图片', + uploadType: 'file', + max: 5, + colProps: { span: 24 }, + formItemProps: { required: false }, + }), + { + key: 'is_rectification', + title: '下发整改', + colProps: { span: 24 }, + valueType: 'switch', + formItemProps: { required: true }, + fieldProps: { + checkedChildren: '是', + unCheckedChildren: '否', + }, + }, + + { + valueType: 'dependency', + name: ['is_rectification'], + columns: ({ is_rectification }) => { + return is_rectification + ? [ + { + key: 'rectification_description', + title: '整改要求', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'rectification_date', + title: '整改限期', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + disabledDate: (current: any) => { + // 只能选未来的日期 + return current && current < new Date(); + }, + addonAfter: '前', + }, + }, + MyFormItems.UploadImages({ + key: 'rectification_images', + max: 9, + title: '关联图片', + colProps: { span: 24 }, + formItemProps: { required: false }, + }), + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/index/modals/Show.tsx b/src/pages/quality/index/modals/Show.tsx new file mode 100644 index 0000000..e044126 --- /dev/null +++ b/src/pages/quality/index/modals/Show.tsx @@ -0,0 +1,123 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { HouseWorkOrdersStatusEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin, Tag } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [show, setShow] = useState({}); + const [loading, setLoading] = useState(false); + const [hasLoaded, setHasLoaded] = useState(false); + + const getShow = () => { + if (props?.item?.id && !loading && !hasLoaded) { + setLoading(true); + setHasLoaded(true); + Apis.QualityCheck.QualityChecks.Show({ + id: props?.item?.id, + }) + .then((res: any) => { + setShow(res?.data); + }) + .catch(() => { + setHasLoaded(false); // 如果请求失败,允许重试 + }) + .finally(() => { + setLoading(false); + }); + } + }; + + return ( + getShow()} + node={ + + + + + {show?.asset_project?.name || '-'} + + + {show?.check_object || '-'} + + + {show?.check_date || '-'} + + + {show?.check_score || '-'} + + + {show?.check_description || '-'} + + + + {show?.check_images?.map((item: any, index: number) => { + return ( + + ); + })} + + + + {show?.employee_name || '-'}-{show?.employee_phone || '-'} + + + {show?.created_at || '-'} + + + {show?.updated_at || '-'} + + + + {show?.is_rectification ? '是' : '否'} + + + + + {show?.house_work_orders_id || '-'} + + + + + {show?.rectification_date || '-'} + + + {show?.rectification_description || '-'} + + + {show?.rectification_images?.[0]?.url ? ( + {show?.title + ) : ( + '-' + )} + + + + + } + /> + ); +} diff --git a/src/pages/quality/index/modals/Update.tsx b/src/pages/quality/index/modals/Update.tsx new file mode 100644 index 0000000..a9d7219 --- /dev/null +++ b/src/pages/quality/index/modals/Update.tsx @@ -0,0 +1,159 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`修改核查记录`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + const formValues = { + ...props.item, + }; + form.setFieldsValue(formValues); + } + }} + onFinish={async (values) => + Apis.QualityCheck.QualityChecks.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'check_date', + title: '核查日期', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + disabledDate: (current: any) => { + // 禁用未来的日期 + return current && current > new Date(); + }, + style: { + width: '100%', + }, + }, + }, + { + key: 'check_object', + title: '核查对象', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入对象信息', + }, + }, + { + key: 'check_score', + title: '核查得分', + valueType: 'digit', + fieldProps: { + addonAfter: '分', + max: 100, + min: 0, + }, + formItemProps: { required: true }, + colProps: { span: 24 }, + }, + { + key: 'check_description', + title: '核查说明', + valueType: 'textarea', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'check_images', + title: '核查文件', + tooltip: '最多上传5张图片', + uploadType: 'file', + max: 5, + colProps: { span: 24 }, + formItemProps: { required: false }, + }), + { + key: 'is_rectification', + title: '下发整改', + colProps: { span: 24 }, + valueType: 'switch', + formItemProps: { required: true }, + fieldProps: { + checkedChildren: '是', + unCheckedChildren: '否', + }, + }, + + { + valueType: 'dependency', + name: ['is_rectification'], + columns: ({ is_rectification }) => { + return is_rectification + ? [ + { + key: 'rectification_description', + title: '整改要求', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'rectification_date', + title: '整改限期', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + disabledDate: (current: any) => { + // 只能选未来的日期 + return current && current < new Date(); + }, + addonAfter: '前', + }, + }, + MyFormItems.UploadImages({ + key: 'rectification_images', + max: 9, + title: '关联图片', + colProps: { span: 24 }, + formItemProps: { required: false }, + }), + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/ad/index.tsx b/src/pages/quality/marketing/ad/index.tsx new file mode 100644 index 0000000..279c49c --- /dev/null +++ b/src/pages/quality/marketing/ad/index.tsx @@ -0,0 +1,103 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannersRedirectTypeEnum, BannersTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import BannerCreate from './modals/BannerCreate'; +import BannerShow from './modals/BannerShow'; +import BannerUpdate from './modals/BannerUpdate'; + +export default function Index({ title = 'Banner投放' }) { + return ( + + + MyProTableProps.request(params, sort, Apis.Banner.Banners.List) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: 'Banner名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: BannersTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '跳转类型', + dataIndex: 'redirect_type', + valueEnum: BannersRedirectTypeEnum, + search: false, + }), + { + title: '开始时间', + dataIndex: 'start_time', + valueType: 'dateTime', + search: false, + }, + { + title: '结束时间', + dataIndex: 'end_time', + valueType: 'dateTime', + search: false, + }, + { + title: '广告位', + dataIndex: ['banner_space', 'name'], + search: false, + render: (_, record) => { + return record?.banner_space?.name; + }, + }, + { + //创建日期 + title: '创建日期', + dataIndex: 'created_at', + valueType: 'dateTime', + search: false, + render: (_, record) => { + return record?.created_at?.substring(0, 10); + }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Banner.Banners.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/quality/marketing/ad/modals/BannerCreate.tsx b/src/pages/quality/marketing/ad/modals/BannerCreate.tsx new file mode 100644 index 0000000..3eb7fc2 --- /dev/null +++ b/src/pages/quality/marketing/ad/modals/BannerCreate.tsx @@ -0,0 +1,171 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BannersRedirectTypeEnum, BannersTypeEnum } 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={`添加Banner`} + wrapperCol={{ span: 19 }} + width="600px" + layout="horizontal" + labelCol={{ span: 5 }} + labelAlign="left" + key={new Date().getTime()} + trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + banner_spaces_id: props.item?.banner_spaces_id, + }); + } + }} + onFinish={async (values) => + Apis.Banner.Banners.Store(values) + .then(() => { + props.reload?.(); + message.success('添加广告内容成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.GetBannerSpace({ + key: 'banner_spaces_id', + title: '投放位置', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + optionFilterProp: 'label', + }, + }), + { + key: 'name', + title: 'Banner名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'type', + title: '展示类型', + colProps: { span: 24 }, + valueEnum: BannersTypeEnum, + required: true, + }), + { + name: ['type'], + valueType: 'dependency', + columns: ({ type }: any) => { + return type === 'Text' + ? [ + { + title: '文本内容', + key: ['source', 0, 'text'], + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : type === 'Image' + ? [ + MyFormItems.UploadImages({ + key: 'source', + title: '广告图片', + uploadType: 'file', + max: 1, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : type === 'Video' + ? [ + MyFormItems.UploadImages({ + key: 'source', + title: '广告视频', + uploadType: 'file', + max: 1, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : []; + }, + }, + ], + }, + MyFormItems.EnumRadio({ + key: 'redirect_type', + title: '跳转类型', + colProps: { span: 24 }, + valueEnum: BannersRedirectTypeEnum, + required: false, + }), + { + key: 'redirect_path', + title: '跳转链接', + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入跳转链接', + }, + }, + { + name: ['redirect_type'], + valueType: 'dependency', + columns: ({ redirect_type }: any) => { + return redirect_type === 'AnotherMiniProgram' + ? [ + { + title: '小程序AppID', + dataIndex: 'app_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + + { + key: 'start_time', + title: '开始时间', + valueType: 'dateTime', + colProps: { span: 24 }, + }, + { + key: 'end_time', + title: '结束时间', + valueType: 'dateTime', + colProps: { span: 24 }, + }, + { + key: 'sort', + title: '排序', + valueType: 'digit', + colProps: { span: 24 }, + fieldProps: { + placeholder: '数值越大越靠前', + min: 0, + style: { width: '100%' }, + }, + initialValue: 0, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/ad/modals/BannerShow.tsx b/src/pages/quality/marketing/ad/modals/BannerShow.tsx new file mode 100644 index 0000000..862397e --- /dev/null +++ b/src/pages/quality/marketing/ad/modals/BannerShow.tsx @@ -0,0 +1,150 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { BannersRedirectTypeEnum, BannersTypeEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Image, Space, Typography } from 'antd'; + +const { Text } = Typography; + +export default function info(props: MyBetaModalFormProps) { + // 根据类型渲染内容 + const renderContent = () => { + const { type, source } = props?.item || {}; + if (!source || !Array.isArray(source) || source.length === 0) { + return 暂无内容; + } + + switch (type) { + case 'Text': + return ( +
+ {source?.[0]?.text} +
+ ); + + case 'Image': + return ( + + {source.map((res: any, index: number) => ( + + + + ))} + + ); + + case 'Video': + return ( +
+ {source.map((res: any, index: number) => ( + + ))} +
+ ); + default: + return 未知内容类型; + } + }; + + return ( + + + + + {props?.item?.name || '-'} + + + + + + + {props?.item?.start_time || '-'} + + + {props?.item?.end_time || '-'} + + + {props?.item?.sort || '-'} + + + {props?.item?.create_at || '-'} + + + {props?.item?.updated_at || '-'} + + + + + + + + + + {props?.item?.redirect_type === 'AnotherMiniProgram' && ( + + {props?.item?.app_id || '-'} + + )} + + {props?.item?.redirect_path || '-'} + + + + + +
{renderContent()}
+
+ + } + /> + ); +} diff --git a/src/pages/quality/marketing/ad/modals/BannerUpdate.tsx b/src/pages/quality/marketing/ad/modals/BannerUpdate.tsx new file mode 100644 index 0000000..e45c5b4 --- /dev/null +++ b/src/pages/quality/marketing/ad/modals/BannerUpdate.tsx @@ -0,0 +1,164 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BannersRedirectTypeEnum, BannersTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑广告内容`} + trigger={} + width="600px" + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Banner.Banners.Update({ ...values, id: props.item?.id ?? 0 }) + .then(() => { + props.reload?.(); + message.success('编辑广告内容成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.GetBannerSpace({ + key: 'banner_spaces_id', + title: '选择广告位', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'name', + title: '内容名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'type', + title: '展示类型', + colProps: { span: 24 }, + valueEnum: BannersTypeEnum, + required: true, + }), + { + name: ['type'], + valueType: 'dependency', + columns: ({ type }: any) => { + return type === 'Text' + ? [ + { + key: ['source', 0, 'text'], + title: '文本内容', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : type === 'Image' + ? [ + MyFormItems.UploadImages({ + key: 'source', + title: '广告图片', + uploadType: 'file', + max: 1, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : type === 'Video' + ? [ + MyFormItems.UploadImages({ + key: 'source', + title: '广告视频', + uploadType: 'file', + max: 1, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : []; + }, + }, + ], + }, + MyFormItems.EnumRadio({ + key: 'redirect_type', + title: '跳转类型', + colProps: { span: 24 }, + valueEnum: BannersRedirectTypeEnum, + required: false, + }), + { + key: 'redirect_path', + title: '跳转链接', + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入跳转链接', + }, + }, + { + name: ['redirect_type'], + valueType: 'dependency', + columns: ({ redirect_type }: any) => { + return redirect_type === 'AnotherMiniProgram' + ? [ + { + title: '小程序AppID', + dataIndex: 'app_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + + { + key: 'start_time', + title: '开始时间', + valueType: 'dateTime', + colProps: { span: 24 }, + }, + { + key: 'end_time', + title: '结束时间', + valueType: 'dateTime', + colProps: { span: 24 }, + }, + { + key: 'sort', + title: '排序', + valueType: 'digit', + colProps: { span: 24 }, + fieldProps: { + placeholder: '数值越大越靠前', + min: 0, + style: { width: '100%' }, + }, + initialValue: 0, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/ad_location/$id.tsx b/src/pages/quality/marketing/ad_location/$id.tsx new file mode 100644 index 0000000..dd5c623 --- /dev/null +++ b/src/pages/quality/marketing/ad_location/$id.tsx @@ -0,0 +1,52 @@ +import { MyPageContainer, usePageTabs } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProCard } from '@ant-design/pro-components'; +import { useParams } from '@umijs/max'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import BannerList from './components/BannerList'; +import BannerSpaceInfo from './components/BannerSpaceInfo'; + +export default function Show({ title }: { title?: string } = {}) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + // 注册当前页面为标签页 + const { addTab } = usePageTabs({ + tabKey: `banner-space-${id}`, + tabLabel: data?.name || title || '广告位详情', + }); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.Banner.BannerSpaces.Show(paramsId).then((res) => { + setShow(res?.data); + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '广告投放', + key: '1', + closable: false, + children: ( + loadShow()} + /> + ), + }, + ]; + return ( + + + + + + + ); +} diff --git a/src/pages/quality/marketing/ad_location/components/BannerList.tsx b/src/pages/quality/marketing/ad_location/components/BannerList.tsx new file mode 100644 index 0000000..a34ebe8 --- /dev/null +++ b/src/pages/quality/marketing/ad_location/components/BannerList.tsx @@ -0,0 +1,88 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannersRedirectTypeEnum, BannersTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import { useEffect, useRef } from 'react'; +import BannerCreate from '../../ad/modals/BannerCreate'; +import BannerShow from '../../ad/modals/BannerShow'; +import BannerUpdate from '../../ad/modals/BannerUpdate'; + +export default function Index({ ...rest }) { + const actionLooks = useRef(); + useEffect(() => { + actionLooks?.current.reloadAndRest(); + }, [rest.loadmore]); + + return ( + <> + > + {...MyProTableProps.props} + actionRef={actionLooks} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + banner_spaces_id: rest.item?.banner_spaces_id, + }, + sort, + Apis.Banner.Banners.List, + ) + } + toolBarRender={(action) => [ + , + ]} + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '广告名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: BannersTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '跳转类型', + dataIndex: 'redirect_type', + valueEnum: BannersRedirectTypeEnum, + search: false, + }), + { + title: '开始时间', + dataIndex: 'start_time', + valueType: 'dateTime', + search: false, + }, + { + title: '结束时间', + dataIndex: 'end_time', + valueType: 'dateTime', + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/quality/marketing/ad_location/components/BannerSpaceInfo.tsx b/src/pages/quality/marketing/ad_location/components/BannerSpaceInfo.tsx new file mode 100644 index 0000000..2d9297e --- /dev/null +++ b/src/pages/quality/marketing/ad_location/components/BannerSpaceInfo.tsx @@ -0,0 +1,31 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { BannerSpacesTypeEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + const { item } = props; + + return ( + + + + + {item?.name} + + + + + + + {item?.remark} + + + + + ); +} diff --git a/src/pages/quality/marketing/ad_location/index.tsx b/src/pages/quality/marketing/ad_location/index.tsx new file mode 100644 index 0000000..98f21d2 --- /dev/null +++ b/src/pages/quality/marketing/ad_location/index.tsx @@ -0,0 +1,85 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannerSpacesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import BannerSpaceCreate from './modals/BannerSpaceCreate'; +import BannerSpaceUpdate from './modals/BannerSpaceUpdate'; + +export default function Index({ title = '广告位' }) { + const navigate = useNavigate(); + + return ( + + + MyProTableProps.request(params, sort, Apis.Banner.BannerSpaces.List) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '广告位名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: BannerSpacesTypeEnum, + search: false, + }), + { + title: '备注', + dataIndex: 'remark', + search: false, + ellipsis: true, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + { + navigate(`/marketing/ad_location/${item.id}`); + }} + /> + + Apis.Banner.BannerSpaces.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/quality/marketing/ad_location/modals/BannerSpaceCreate.tsx b/src/pages/quality/marketing/ad_location/modals/BannerSpaceCreate.tsx new file mode 100644 index 0000000..c3117de --- /dev/null +++ b/src/pages/quality/marketing/ad_location/modals/BannerSpaceCreate.tsx @@ -0,0 +1,59 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannerSpacesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + return ( + + {...MyModalFormProps.props} + title={`添加广告位`} + wrapperCol={{ span: 24 }} + width="500px" + trigger={} + key={new Date().getTime()} + onFinish={async (values) => + Apis.Banner.BannerSpaces.Store(values) + .then(() => { + props.reload?.(); + message.success('添加广告位成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '广告位名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: BannerSpacesTypeEnum, + required: true, + }), + { + key: 'remark', + title: '备注', + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/ad_location/modals/BannerSpaceUpdate.tsx b/src/pages/quality/marketing/ad_location/modals/BannerSpaceUpdate.tsx new file mode 100644 index 0000000..22fc147 --- /dev/null +++ b/src/pages/quality/marketing/ad_location/modals/BannerSpaceUpdate.tsx @@ -0,0 +1,66 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BannerSpacesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑广告位`} + trigger={} + wrapperCol={{ span: 24 }} + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Banner.BannerSpaces.Update({ ...values, id: props.item?.id ?? 0 }) + .then(() => { + props.reload?.(); + message.success('编辑广告位成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '广告位名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: BannerSpacesTypeEnum, + required: true, + }), + { + key: 'remark', + title: '备注', + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/components/QuestionCategoriesList.tsx b/src/pages/quality/marketing/survey/components/QuestionCategoriesList.tsx new file mode 100644 index 0000000..3c0b56b --- /dev/null +++ b/src/pages/quality/marketing/survey/components/QuestionCategoriesList.tsx @@ -0,0 +1,73 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from '../modals/QuestionCategoriesCreate'; +import Update from '../modals/QuestionCategoriesUpdate'; + +export default function QuestionCategoriesList({ title = '题目分类' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + add: , + }, + 'MyQuestionCategoriesList', + ); + }; + + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Survey.QuestionCategories.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + ), + }, + 'MyQuestionCategoriesList', + ); + }; + return ( + + MyProTableProps.request( + params, + sort, + Apis.Survey.QuestionCategories.List, + ) + } + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { dataIndex: 'name', title: '名称' }, + { dataIndex: 'description', title: '描述' }, + MyColumns.Boolean({ dataIndex: 'is_enabled', title: '是否启用' }), + MyColumns.Option({ + width: 120, + + render: (_, item: any, index, action) => ( + + <>{tableRender(item, action)} + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/components/QuestionsList.tsx b/src/pages/quality/marketing/survey/components/QuestionsList.tsx new file mode 100644 index 0000000..e53a72b --- /dev/null +++ b/src/pages/quality/marketing/survey/components/QuestionsList.tsx @@ -0,0 +1,80 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from '../modals/QuestionsCreate'; +import Update from '../modals/QuestionsUpdate'; + +export default function QuestionsList({ title = '题目' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + add: , + }, + 'MyQuestionsList', + ); + }; + + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Survey.Questions.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + ), + }, + 'MyQuestionsList', + ); + }; + return ( + + MyProTableProps.request(params, sort, Apis.Survey.Questions.List) + } + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { dataIndex: 'title', title: '题目' }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: QuestionsTypeEnum, + }), + { dataIndex: 'placeholder', title: '提示', search: false }, + MyColumns.Boolean({ + dataIndex: 'required', + title: '是否必答', + search: false, + }), + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '是否启用', + search: false, + }), + MyColumns.Option({ + width: 120, + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/components/SurveyReleasesList.tsx b/src/pages/quality/marketing/survey/components/SurveyReleasesList.tsx new file mode 100644 index 0000000..97b5aae --- /dev/null +++ b/src/pages/quality/marketing/survey/components/SurveyReleasesList.tsx @@ -0,0 +1,113 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { isInTimeRange } from '@/common/utils/day'; +import { Apis } from '@/gen/Apis'; +import { SurveyReleasesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from '../modals/SurveyReleasesCreate'; +import Update from '../modals/SurveyReleasesUpdate'; + +export default function SurveyReleasesList({ title = '问卷发布列表' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + add: , + }, + 'MySurveyReleasesList', + ); + }; + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + publish: ( + + Apis.Survey.SurveyReleases.Publish({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + ), + cancel: ( + + Apis.Survey.SurveyReleases.Cancel({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + ), + update: , + delete: ( + + Apis.Survey.SurveyReleases.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + ), + }, + 'MySurveyReleasesList', + ); + }; + return ( + + MyProTableProps.request(params, sort, Apis.Survey.SurveyReleases.List) + } + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '问卷ID', + hidden: true, + dataIndex: 'surveys_id', + // search: { + // transform: (value) => { + // return { surveys_id: value }; + // }, + // }, + }, + MyColumns.EnumTag({ + title: '方式', + dataIndex: 'release_type', + valueEnum: SurveyReleasesTypeEnum, + }), + MyColumns.Boolean({ + title: '是否发布', + dataIndex: 'status', + }), + { dataIndex: ['survey', 'name'], title: '发布的问卷', search: false }, + { dataIndex: 'start_date', title: '开始时间', search: false }, + { dataIndex: 'end_date', title: '结束时间', search: false }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/components/SurveyResponsesList.tsx b/src/pages/quality/marketing/survey/components/SurveyResponsesList.tsx new file mode 100644 index 0000000..adbce07 --- /dev/null +++ b/src/pages/quality/marketing/survey/components/SurveyResponsesList.tsx @@ -0,0 +1,39 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import MyShow from '../modals/SurveyResponsesShow'; +export default function SurveyResponsesList({ title = '问卷回收' }) { + return ( + + MyProTableProps.request(params, sort, Apis.Survey.SurveyResponses.List) + } + columns={[ + // MyColumns.ID({ + // search: false, + // }), + { dataIndex: ['survey', 'name'], title: '问卷', search: false }, + { dataIndex: 'survey_id', title: '问卷ID', hidden: true }, + { dataIndex: 'release_id', title: '发布ID', hidden: true }, + { dataIndex: 'customers_id', title: '客户ID', hidden: true }, + { dataIndex: 'customer_phone', title: '客户手机号', hidden: true }, + { + dataIndex: 'customer', + title: '回答客户', + search: false, + render: (_, item: any) => { + return `${item?.customer?.phone}_${item?.customer?.name}`; + }, + }, + { dataIndex: 'total_score', title: '总得分', search: false }, + MyColumns.CreatedAt(), + MyColumns.Option({ + width: 120, + render: (_, item: any) => , + }), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/components/SurveysList.tsx b/src/pages/quality/marketing/survey/components/SurveysList.tsx new file mode 100644 index 0000000..11fcbbe --- /dev/null +++ b/src/pages/quality/marketing/survey/components/SurveysList.tsx @@ -0,0 +1,109 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { PlusOutlined } from '@ant-design/icons'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import SurveysListShow from '../modals/SurveysListShow'; + +export default function SurveysList({ title = '问卷设置' }) { + const navigate = useNavigate(); + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = () => { + return getCurrentPermissions( + { + add: ( + } + onClick={() => { + navigate('/marketing/survey/pages/create_surveys'); + }} + title="新增问卷" + /> + ), + }, + 'MySurveysList', + ); + }; + + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + show: ( + + ), + update: ( + { + navigate(`/marketing/survey/pages/update_surveys?id=${item.id}`); + }} + title="编辑" + /> + ), + delete: ( + + Apis.Survey.Surveys.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + ), + }, + 'MySurveysList', + ); + }; + + return ( + + MyProTableProps.request(params, sort, Apis.Survey.Surveys.List) + } + toolBarRender={() => [toolBarRender()]} + columns={[ + MyColumns.ID({ + search: false, + }), + { dataIndex: 'name', title: '问卷' }, + { + title: '问题数', + dataIndex: 'questions', + render: (_, item: any) => { + const questions = item?.questions || []; + const questionCount = questions.length; + return
{questionCount}
; + }, + }, + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '是否启用', + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + width: 120, + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/index.tsx b/src/pages/quality/marketing/survey/index.tsx new file mode 100644 index 0000000..7ddd4ae --- /dev/null +++ b/src/pages/quality/marketing/survey/index.tsx @@ -0,0 +1,47 @@ +import { MyPageContainer } from '@/common'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import MyQuestionCategoriesList from './components/QuestionCategoriesList'; +import MyQuestionsList from './components/QuestionsList'; +import MySurveyReleasesList from './components/SurveyReleasesList'; +import MySurveyResponsesList from './components/SurveyResponsesList'; +import MySurveysList from './components/SurveysList'; +export default function Index({ title = '问卷调查' }) { + const items: TabsProps['items'] = [ + { + key: 'MySurveyReleasesList', + label: '问卷发布', + children: , + }, + { + key: 'MySurveyResponsesList', + label: '问卷回收', + children: , + }, + { + key: 'MySurveysList', + label: '问卷设置', + children: , + }, + { + key: 'MyQuestionsList', + label: '题库设置', + children: , + }, + { + key: 'MyQuestionCategoriesList', + label: '题目分类', + children: , + }, + ]; + return ( + + + + ); +} diff --git a/src/pages/quality/marketing/survey/modals/QuestionCategoriesCreate.tsx b/src/pages/quality/marketing/survey/modals/QuestionCategoriesCreate.tsx new file mode 100644 index 0000000..64e5b81 --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/QuestionCategoriesCreate.tsx @@ -0,0 +1,56 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function QuestionCategoriesCreate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Survey.QuestionCategories.Store({ + ...values, + is_enabled: true, + }) + .then(() => { + props.reload?.(); + message.success(`添加${props.title}成功`); + return true; + }) + .catch(() => false) + } + columns={[ + { key: 'name', title: '名称', formItemProps: { ...rulesHelper.text } }, + { + key: 'description', + title: '描述', + valueType: 'textarea', + }, + // { + // key: 'is_enabled', + // title: '是否启用', + // valueType: 'switch', + // }, + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/QuestionCategoriesUpdate.tsx b/src/pages/quality/marketing/survey/modals/QuestionCategoriesUpdate.tsx new file mode 100644 index 0000000..0d1c7dc --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/QuestionCategoriesUpdate.tsx @@ -0,0 +1,57 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function QuestionCategoriesUpdate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`编辑${props.title}`} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + trigger={} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Survey.QuestionCategories.Update({ + ...values, + is_enabled: values?.is_enabled ? true : false, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { key: 'name', title: '名称', formItemProps: { ...rulesHelper.text } }, + { + key: 'description', + title: '描述', + valueType: 'textarea', + }, + { + key: 'is_enabled', + title: '是否启用', + valueType: 'switch', + }, + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/QuestionsCreate.tsx b/src/pages/quality/marketing/survey/modals/QuestionsCreate.tsx new file mode 100644 index 0000000..918002d --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/QuestionsCreate.tsx @@ -0,0 +1,111 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function QuestionsCreate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`添加${props.title}`} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + key={new Date().getTime()} + width="600px" + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => { + console.log(values); + return Apis.Survey.Questions.Store({ + ...values, + is_enabled: true, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.QuestionCategories({ + colProps: { span: 24 }, + required: true, + }), + { + key: 'title', + title: '题目', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + valueEnum: QuestionsTypeEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === QuestionsTypeEnum.Fill.value + ? [ + { + key: 'max_length', + title: '答题字数', + valueType: 'digit', + colProps: { span: 24 }, + fieldProps: { + addonAfter: '个字内', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : []; + }, + }, + { + key: 'placeholder', + title: '答题提示', + colProps: { span: 24 }, + }, + { + key: 'required', + title: '是否必答', + valueType: 'switch', + colProps: { span: 24 }, + fieldProps: { + style: { width: '100%' }, + checkedChildren: '是', + unCheckedChildren: '否', + }, + }, + // { + // key: 'is_enabled', + // title: '是否启用', + // valueType: 'switch', + // colProps: { span: 24 }, + // }, + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/QuestionsUpdate.tsx b/src/pages/quality/marketing/survey/modals/QuestionsUpdate.tsx new file mode 100644 index 0000000..fb8296e --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/QuestionsUpdate.tsx @@ -0,0 +1,107 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function QuestionsUpdate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`编辑${props.title}`} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + key={new Date().getTime()} + width="500px" + trigger={} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Survey.Questions.Update({ + ...values, + is_enabled: values?.is_enabled ? true : false, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.QuestionCategories({ + colProps: { span: 12 }, + required: true, + }), + + { + key: 'title', + title: '题目', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + valueEnum: QuestionsTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === QuestionsTypeEnum.Fill.value + ? [ + { + key: 'max_length', + title: '答题字数', + valueType: 'digit', + colProps: { span: 24 }, + fieldProps: { + addonAfter: '个字内', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : []; + }, + }, + { + key: 'placeholder', + title: '提示', + colProps: { span: 12 }, + }, + { + key: 'required', + title: '是否必答', + valueType: 'switch', + colProps: { span: 12 }, + }, + { + key: 'is_enabled', + title: '是否启用', + valueType: 'switch', + colProps: { span: 12 }, + }, + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/SurveyReleasesCreate.tsx b/src/pages/quality/marketing/survey/modals/SurveyReleasesCreate.tsx new file mode 100644 index 0000000..d916285 --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/SurveyReleasesCreate.tsx @@ -0,0 +1,78 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { SurveyReleasesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function SurveyReleasesCreate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="600px" + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => { + console.log(values); + return Apis.Survey.SurveyReleases.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Surveys({ + colProps: { span: 24 }, + required: true, + }), + MyFormItems.EnumRadio({ + key: 'release_type', + title: '发布方式', + valueEnum: SurveyReleasesTypeEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'start_date', + title: '有效日期开始', + valueType: 'dateTime', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'end_date', + title: '有效日期结束', + colProps: { span: 12 }, + valueType: 'dateTime', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'cover_image', + title: '封面图', + colProps: { span: 24 }, + max: 1, + }), + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/SurveyReleasesUpdate.tsx b/src/pages/quality/marketing/survey/modals/SurveyReleasesUpdate.tsx new file mode 100644 index 0000000..2c7eb04 --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/SurveyReleasesUpdate.tsx @@ -0,0 +1,79 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { SurveyReleasesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function SurveyReleasesCreate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="600px" + trigger={} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => { + console.log(values); + return Apis.Survey.SurveyReleases.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Surveys({ + colProps: { span: 24 }, + required: true, + }), + MyFormItems.EnumRadio({ + key: 'release_type', + title: '发布方式', + valueEnum: SurveyReleasesTypeEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'start_date', + title: '有效日期开始', + valueType: 'dateTime', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'end_date', + title: '有效日期结束', + colProps: { span: 12 }, + valueType: 'dateTime', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'cover_image', + title: '封面图', + colProps: { span: 24 }, + max: 1, + }), + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/SurveyResponsesShow.tsx b/src/pages/quality/marketing/survey/modals/SurveyResponsesShow.tsx new file mode 100644 index 0000000..0b55c13 --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/SurveyResponsesShow.tsx @@ -0,0 +1,67 @@ +import { MyBetaModalFormProps } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { List } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +const scoreInfo = { + '1': '非常不满意', + '2': '比较不满意', + '3': '满意', + '4': '比较满意', + '5': '非常满意', +}; + +export default function SurveyResponsesShow( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + const [data, setShow] = useState({}); + const loadShow = () => { + Apis.Survey.SurveyResponses.Show({ id: props?.item?.id }).then((res) => { + setShow(res?.data); + }); + }; + + return ( + { + loadShow(); + console.log(props?.item?.list); + }} + node={ + <> + ( + + + + )} + /> + + } + > + ); +} diff --git a/src/pages/quality/marketing/survey/modals/SurveysListShow.tsx b/src/pages/quality/marketing/survey/modals/SurveysListShow.tsx new file mode 100644 index 0000000..43f4826 --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/SurveysListShow.tsx @@ -0,0 +1,108 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function SurveysListShow(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + { + if (props?.item?.id) { + setLoading(true); + Apis.Survey.Surveys.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + +
{data?.name}
+
+
+ + {data?.description || '-'} + + + + {data?.questions_with_order?.length > 0 + ? data?.questions_with_order?.map( + (item: any, index: number) => ( + + + + + {''} + + 题目{item?.category_id}:{item?.title || '-'} + + {''} + + {item?.required ? '[必答]' : '[非必答]'} + + + {item?.placeholder ? ( +
+ 提示: + {item?.placeholder || '-'} +
+ ) : null} +
+
+ ), + ) + : '-'} +
+
+ + {data?.created_at || '-'} + + + {data?.updated_at || '-'} + + + {data?.is_enabled ? '是' : '否'} + +
+
+
+
+ } + /> + ); +} diff --git a/src/pages/quality/marketing/survey/modals/SurveysSelectList.tsx b/src/pages/quality/marketing/survey/modals/SurveysSelectList.tsx new file mode 100644 index 0000000..c4671b5 --- /dev/null +++ b/src/pages/quality/marketing/survey/modals/SurveysSelectList.tsx @@ -0,0 +1,99 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { type TableProps } from 'antd'; +import { useRef, useState } from 'react'; +interface DataType { + key: React.Key; + id: React.Key; + is_enabled: boolean; +} +export default function SurveysSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + }, +) { + const modalRef = useRef(); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: TableProps['rowSelection'] = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + setSelectedRow(selectedRows); + }, + getCheckboxProps: (record: DataType) => ({ + disabled: !record.is_enabled, // Column configuration not to be checked + checked: props?.item?.list?.some((item: any) => { + console.log(item, record); + return item?.id === record?.id; + }), + }), + defaultSelectedRowKeys: + props?.item?.list?.map((item: any) => item?.id) || [], + }; + return ( + { + setSelectedRow(props?.item?.list); + console.log(props?.item?.list); + }} + node={ + + MyProTableProps.request(params, sort, Apis.Survey.Questions.List) + } + rowSelection={{ type: 'checkbox', ...rowSelection }} + options={false} + tableAlertOptionRender={() => { + return ( + { + getSelectedRow?.forEach((item: any) => { + item.question_id = item?.id; + }); + props?.onChange?.(getSelectedRow); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + MyColumns.ID({ + search: false, + }), + { dataIndex: 'title', title: '题目' }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: QuestionsTypeEnum, + }), + { dataIndex: 'placeholder', title: '提示', search: false }, + MyColumns.Boolean({ + dataIndex: 'required', + title: '是否必答', + search: false, + }), + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '是否启用', + }), + ]} + /> + } + > + ); +} diff --git a/src/pages/quality/marketing/survey/pages/create_surveys.tsx b/src/pages/quality/marketing/survey/pages/create_surveys.tsx new file mode 100644 index 0000000..a3a12c6 --- /dev/null +++ b/src/pages/quality/marketing/survey/pages/create_surveys.tsx @@ -0,0 +1,165 @@ +import { + MyButtons, + MyColumns, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import type { ProColumns } from '@ant-design/pro-components'; +import { + BetaSchemaForm, + DragSortTable, + ProCard, +} from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import { useState } from 'react'; +import MySurveysSelectList from '../modals/SurveysSelectList'; +export default function Index({ title = '新增问卷' }) { + const [dataSource, setDataSource] = useState( + [], + ); + const [form] = Form.useForm(); + const navigate = useNavigate(); + + const columns: ProColumns[] = [ + { + title: '排序', + dataIndex: 'sort', + width: 60, + className: 'drag-visible', + }, + { + title: '题目', + dataIndex: 'title', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: QuestionsTypeEnum, + }), + MyColumns.Boolean({ + dataIndex: 'required', + title: '是否必答', + search: false, + }), + MyColumns.Option({ + render: (_, item: any, index) => ( + + { + setDataSource( + dataSource.filter((res: any) => res?.id !== item?.id), + ); + }} + /> + + ), + }), + ]; + + const handleDragSortEnd = ( + beforeIndex: number, + afterIndex: number, + newDataSource: any, + ) => { + console.log(newDataSource, 'newDataSource'); + setDataSource(newDataSource); + }; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 4 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + onFinish={async (values: any) => + Apis.Survey.Surveys.Store({ + ...values, + questions: dataSource, + is_enabled: true, + }) + .then(() => { + navigate(-1); + message.success('新增成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '问卷名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + + { + key: 'description', + title: '问卷描述', + valueType: 'textarea', + colProps: { span: 24 }, + }, + + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + [ + { + setDataSource(e); + }} + />, + ]} + bordered + options={false} + columns={columns} + rowKey="id" + search={false} + pagination={false} + dataSource={dataSource || []} + dragSortKey="sort" + onDragSortEnd={handleDragSortEnd} + /> + + ); + }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/quality/marketing/survey/pages/update_surveys.tsx b/src/pages/quality/marketing/survey/pages/update_surveys.tsx new file mode 100644 index 0000000..3c262ee --- /dev/null +++ b/src/pages/quality/marketing/survey/pages/update_surveys.tsx @@ -0,0 +1,189 @@ +import { + MyButtons, + MyColumns, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { QuestionsTypeEnum } from '@/gen/Enums'; +import type { ProColumns } from '@ant-design/pro-components'; +import { + BetaSchemaForm, + DragSortTable, + ProCard, +} from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import { useEffect, useState } from 'react'; +import MySurveysSelectList from '../modals/SurveysSelectList'; +export default function Index({ title = '新增问卷' }) { + const [data, setShow] = useState({}); + const [dataSource, setDataSource] = useState( + [], + ); + const [form] = Form.useForm(); + const navigate = useNavigate(); + + const columns: ProColumns[] = [ + { + title: '排序', + dataIndex: 'sort', + width: 60, + className: 'drag-visible', + }, + { + title: '题目', + dataIndex: 'title', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: QuestionsTypeEnum, + }), + MyColumns.Boolean({ + dataIndex: 'required', + title: '是否必答', + search: false, + }), + MyColumns.Option({ + render: (_, item: any, index) => ( + + { + setDataSource( + dataSource.filter((res: any) => res?.id !== item?.id), + ); + }} + /> + + ), + }), + ]; + + const handleDragSortEnd = ( + beforeIndex: number, + afterIndex: number, + newDataSource: any, + ) => { + console.log(newDataSource, 'newDataSource'); + setDataSource(newDataSource); + }; + + const [searchParams] = useSearchParams(); + + const loadShow = () => { + let paramsId: any = { id: searchParams.get('id') ?? 0 }; + Apis.Survey.Surveys.Show(paramsId).then((res) => { + res?.data?.questions_with_order?.forEach((k: any) => { + k.question_id = k?.id; + }); + setDataSource(res?.data?.questions_with_order || []); + setShow(res?.data); + form.setFieldsValue(res?.data); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [searchParams.get('id')]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 4 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + onFinish={async (values: any) => + Apis.Survey.Surveys.Update({ + ...values, + questions: dataSource, + id: data?.id, + }) + .then(() => { + navigate(-1); + message.success('编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '问卷名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + + { + key: 'description', + title: '问卷描述', + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + colProps: { span: 24 }, + renderFormItem: () => { + return ( + + [ + { + setDataSource(e); + }} + />, + ]} + bordered + options={false} + columns={columns} + rowKey="id" + search={false} + pagination={false} + dataSource={dataSource || []} + dragSortKey="sort" + onDragSortEnd={handleDragSortEnd} + /> + + ); + }, + }, + { + key: 'is_enabled', + title: '是否启用', + valueType: 'switch', + colProps: { span: 24 }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/quality/renovation/application/components/Deposit.tsx b/src/pages/quality/renovation/application/components/Deposit.tsx new file mode 100644 index 0000000..200906a --- /dev/null +++ b/src/pages/quality/renovation/application/components/Deposit.tsx @@ -0,0 +1,85 @@ +import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + BillPaymentsTypeEnum, + BillsStatusEnum, + ContractBillsCostTypeEnum, + HouseOrdersPaymentMethodEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { + ...params, + id: props?.item?.id, + }, + sort, + Apis.Renovation.RenovationApplies.Bills, + ) + } + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '付款人', + dataIndex: 'payer', + }, + { + title: '付款人电话', + dataIndex: 'phone', + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: BillsStatusEnum, + }), + MyColumns.EnumTag({ + title: '支付方式', + dataIndex: 'payment_method', + valueEnum: HouseOrdersPaymentMethodEnum, + }), + MyColumns.EnumTag({ + title: '费用项目', + dataIndex: 'type', + valueEnum: BillPaymentsTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'flow_type', + valueEnum: ContractBillsCostTypeEnum, + search: false, + }), + { + title: '支付金额', + dataIndex: 'amount', + render: (_, item) => `${item?.amount}元`, + search: false, + }, + { + title: '支付时间', + dataIndex: 'paid_time', + search: false, + }, + { + title: '退款金额', + render: (_, item) => `${item?.refund_amount}元`, + search: false, + }, + { + title: '退款时间', + dataIndex: 'refund_time', + search: false, + }, + MyColumns.UpdatedAt(), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/application/components/WorkerTable.tsx b/src/pages/quality/renovation/application/components/WorkerTable.tsx new file mode 100644 index 0000000..946b81f --- /dev/null +++ b/src/pages/quality/renovation/application/components/WorkerTable.tsx @@ -0,0 +1,108 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOccupantsCardTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Image, Space } from 'antd'; +import MyWorkerCreate from '../../modals/WorkerCreate'; +import MyWorkerUpdate from '../../modals/WorkerUpdate'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + + MyProTableProps.request( + { + ...params, + renovation_applies_id: props?.item?.id, + }, + sort, + Apis.Renovation.RenovationWorkers.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '姓名', + dataIndex: 'worker_name', + }, + { + title: '电话', + dataIndex: 'worker_phone', + search: false, + }, + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${item?.valid_from} 至 ${item?.valid_to}`; + }, + }, + MyColumns.EnumTag({ + title: '证件类型', + dataIndex: 'card_type', + valueEnum: HouseOccupantsCardTypeEnum, + search: false, + }), + { + title: '证件正面照', + search: false, + render: (_, item: any) => { + return ; + }, + }, + { + title: '证件反面照', + search: false, + render: (_, item: any) => { + return ; + }, + }, + { + title: '工人照片', + search: false, + render: (_, item: any) => { + return ; + }, + }, + // MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Renovation.RenovationWorkers.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/application/components/info.tsx b/src/pages/quality/renovation/application/components/info.tsx new file mode 100644 index 0000000..65980ac --- /dev/null +++ b/src/pages/quality/renovation/application/components/info.tsx @@ -0,0 +1,200 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { + HouseOccupantsCardTypeEnum, + RenovationAppliesProcessTypeEnum, + RenovationAppliesRenovationContentEnum, + RenovationAppliesTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Spin } from 'antd'; + +export default function Info(props: MyBetaModalFormProps) { + return ( +
+ + + + + {props?.item?.asset_house?.full_name || '-'} + + + + + + + + + {props?.item?.is_deposit ? '是' : '否'} + + {props?.item?.is_deposit && ( + + {props?.item?.deposit_amount} + + )} + + + + + {props?.item?.construction_start_date || '-'} + + + {props?.item?.construction_end_date || '-'} + + + + + + + + {props?.item?.owner_name || '-'} + + + {props?.item?.owner_phone || '-'} + + + + + + {props?.item?.owner_id_card || '-'} + + + {props?.item?.id_card_front ? '已上传' : '-'} + + + {props?.item?.id_card_back ? '已上传' : '-'} + + + {props?.item?.property_certificate ? '已上传' : '-'} + + + + + {props?.item?.process_type === 'AgentProcess' && ( + + + + {props?.item?.agent_name || '-'} + + + {props?.item?.agent_phone || '-'} + + + + + + {props?.item?.agent_id_card || '-'} + + + {props?.item?.agent_id_card_front ? '已上传' : '-'} + + + {props?.item?.agent_id_card_back ? '已上传' : '-'} + + + {props?.item?.power_attorney ? '已上传' : '-'} + + + + )} + + + + + {props?.item?.construction_principal_name || '-'} + + + {props?.item?.construction_principal_phone || '-'} + + + + + + {props?.item?.construction_principal_id_card || '-'} + + + {props?.item?.construction_principal_id_card_front + ? '已上传' + : '-'} + + + {props?.item?.construction_principal_id_card_back + ? '已上传' + : '-'} + + + + + {props?.item?.type === 'RenovationCompany' && ( + <> + + + + {props?.item?.company_name || '-'} + + + {props?.item?.company_principal_name || '-'} + + + {props?.item?.company_principal_phone || '-'} + + + {props?.item?.company_business_license_num || '-'} + + + {props?.item?.company_business_license ? '已上传' : '-'} + + + {props?.item?.company_asset_certificate ? '已上传' : '-'} + + + {props?.item?.company_power_attorney ? '已上传' : '-'} + + + + + )} + + + + + {props?.item?.construction_draw ? '已上传' : '-'} + + + {props?.item?.construction_commitment_letter ? '已上传' : '-'} + + + {props?.item?.other_attachments ? '已上传' : '-'} + + + {props?.item?.renovation_remark || '-'} + + + + +
+ ); +} diff --git a/src/pages/quality/renovation/application/index.tsx b/src/pages/quality/renovation/application/index.tsx new file mode 100644 index 0000000..6167f89 --- /dev/null +++ b/src/pages/quality/renovation/application/index.tsx @@ -0,0 +1,219 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + RenovationAppliesConstructionStatusEnum, + RenovationAppliesStatusEnum, +} from '@/gen/Enums'; +import { PlusOutlined } from '@ant-design/icons'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import MyWorkerCreate from '../modals/WorkerCreate'; + +export default function Index() { + const getCurrentPermissions = useCurrentPermissions(); + const navigate = useNavigate(); + let toolBarRender = () => { + return getCurrentPermissions( + { + add: ( + } + onClick={() => { + navigate('/renovation/application/pages/create'); + }} + title="装修申请" + /> + ), + }, + 'MyRenovationApplies', + ); + }; + + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + show: ( + { + navigate(`/renovation/application/pages/show?id=${item.id}`); + }} + title="查看" + /> + ), + worker_add: ( + + ), + update: ( + { + navigate(`/renovation/application/pages/update?id=${item.id}`); + }} + title="编辑" + /> + ), + delete: ( + + Apis.Renovation.RenovationApplies.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyRenovationApplies', + ); + }; + + return ( + + MyProTableProps.request( + params, + sort, + Apis.Renovation.RenovationApplies.List, + ) + } + headerTitle="装修申请列表" + toolBarRender={() => [toolBarRender()]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'id', + hidden: true, + }), + MyColumns.EnumTag({ + title: '登记状态', + dataIndex: 'status', + valueEnum: RenovationAppliesStatusEnum, + search: false, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + // search: { + // transform: (value) => { + // return { project_name: value }; + // }, + // }, + }, + // MyColumns.EnumTag({ + // title: '状态', + // dataIndex: 'status', + // valueEnum: () => { + // let obj: any = JSON.parse( + // JSON.stringify(RenovationAppliesStatusEnum), + // ); + // delete obj?.Pending; + // return obj; + // }, + // hidden: true, + // }), + { + title: '房屋', + dataIndex: ['asset_house', 'full_name'], + search: { + transform: (value) => { + return { full_name: value }; + }, + }, + }, + { + title: '装修人', + dataIndex: 'owner_name', + }, + // { + // title: '代理人', + // dataIndex: 'agent_name', + // }, + { + title: '装修公司', + dataIndex: 'company_name', + search: false, + // render: (_, item: any) => { + // return ( + // + //
{item?.company_name || '-'}
+ //
+ // {item?.company_principal_name || ''} + //
+ //
+ // ); + // }, + }, + + { + title: '施工负责人', + dataIndex: 'construction_principal_name', + search: false, + // render: (_, item: any) => { + // return
{item?.construction_principal_name || ''}
; + // }, + }, + MyColumns.EnumTag({ + title: '施工状态', + dataIndex: 'construction_status', + valueEnum: RenovationAppliesConstructionStatusEnum, + search: false, + }), + + { + title: '保证金', + dataIndex: 'deposit_amount', + search: false, + }, + { + title: '施工时间', + search: false, + render: (_, item: any) => { + return ( +
+ {item?.construction_start_date || ''} 至 + {item?.construction_end_date || ''} +
+ ); + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/application/pages/create.tsx b/src/pages/quality/renovation/application/pages/create.tsx new file mode 100644 index 0000000..caacab7 --- /dev/null +++ b/src/pages/quality/renovation/application/pages/create.tsx @@ -0,0 +1,589 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import MyModalsHouseSelectList from '@/components/ModalsHouseSelectList'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + RenovationAppliesProcessTypeEnum, + RenovationAppliesRenovationContentEnum, + RenovationAppliesTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import { useState } from 'react'; + +export default function Index({ title = '新装修申请' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [getSelectHouse, setSelectHouse] = useState({}); + const onSave = (data: any, subType: string) => { + Apis.Renovation.RenovationApplies.Store({ + ...data, + status: subType, + is_deposit: data.is_deposit ? 1 : 0, + }) + .then(() => { + if (subType === 'Draft') { + navigate(-1); + message.success('暂存成功'); + } else { + navigate(-1); + message.success('提交成功'); + } + }) + .catch(() => false); + }; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + submitter={{ + render: (props) => { + return [ + { + onSave(form.getFieldsValue(), 'Draft'); + }} + title="暂存" + />, + { + props.submit(); + }} + title="提交审核" + />, + ]; + }, + }} + onFinish={async (values: any) => { + onSave(values, 'Pending'); + }} + columns={[ + { + colProps: { span: 24 }, + title: '选择房屋', + key: 'asset_houses_id', + formItemProps: { ...rulesHelper.text }, + renderFormItem: () => { + return ( + + + { + setSelectHouse(e); + form.setFieldsValue({ + asset_houses_id: e?.id, + }); + }} + /> + {getSelectHouse?.full_name ? ( +
已选择房屋:{getSelectHouse?.full_name}
+ ) : ( + '' + )} +
+
+ ); + }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '装修类型', + valueEnum: RenovationAppliesTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.EnumRadio({ + key: 'process_type', + title: '办理类型', + valueEnum: RenovationAppliesProcessTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '是否有保证金', + colProps: { span: 6 }, + key: 'is_deposit', + valueType: 'switch', + }, + + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit + ? [ + { + title: '保证金金额', + colProps: { span: 6 }, + key: 'deposit_amount', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '业主信息', + }, + }, + { + title: '业主姓名', + key: 'owner_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '业主手机', + key: 'owner_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号码', + key: 'owner_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'id_card_front', + title: '证件正面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'id_card_back', + title: '证件反面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'property_certificate', + title: '房产证明', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.array }, + }), + { + valueType: 'dependency', + name: ['process_type'], + columns: ({ process_type }) => { + return process_type === 'AgentProcess' + ? [ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '代理人信息', + }, + }, + { + title: '代理人名称', + key: 'agent_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '代理人手机', + key: 'agent_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'agent_card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号码', + key: 'agent_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'agent_id_card_front', + title: '证件正面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'agent_id_card_back', + title: '证件反面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'power_attorney', + title: '代理人授权书', + max: 1, + colProps: { span: 6 }, + }), + ] + : []; + }, + }, + + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '装修公司信息', + }, + }, + { + title: '公司名称', + key: 'company_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + + { + title: '营业执照号', + key: 'company_business_license_num', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + { + title: '公司负责人姓名', + key: 'company_principal_name', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + }, + { + title: '公司负责人手机', + key: 'company_principal_phone', + formItemProps: { ...rulesHelper.phone }, + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + MyFormItems.UploadImages({ + key: 'company_business_license', + title: '装修公司营业执照', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_asset_certificate', + title: '装修公司资质证明', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_power_attorney', + title: '装修公司装修授权书', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + ] + : []; + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '施工信息', + }, + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + { + title: '施工负责人名称', + key: 'construction_principal_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '施工负责人手机', + key: 'construction_principal_phone', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.phone }, + fieldProps: { + maxLength: 11, + }, + }, + MyFormItems.EnumSelect({ + key: 'construction_principal_card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '施工负责人证件号', + key: 'construction_principal_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'construction_principal_id_card_front', + title: '施工负责人身份证正面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'construction_principal_id_card_back', + title: '施工负责人身份证反面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : []; + }, + }, + + { + valueType: 'group', + columns: [ + { + title: '施工开始时间', + valueType: 'date', + key: 'construction_start_date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + format: 'YYYY-MM-DD', + onChange: (value: string, dateString: string) => { + form.setFieldValue( + 'construction_start_date', + dateString, + ); + console.log('construction_start_date', value); + }, + style: { + width: '100%', + }, + }, + }, + { + title: '施工结束时间', + valueType: 'date', + key: 'construction_end_date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + format: 'YYYY-MM-DD', + onChange: (value: string, dateString: string) => { + form.setFieldValue('construction_end_date', dateString); + console.log('construction_end_date', value); + }, + style: { + width: '100%', + }, + }, + }, + MyFormItems.EnumRadio({ + key: 'renovation_content', + title: '装修内容', + valueEnum: RenovationAppliesRenovationContentEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '其他附件', + }, + }, + MyFormItems.UploadImages({ + key: 'construction_draw', + title: '施工图', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'construction_commitment_letter', + title: '施工承诺书', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'other_attachments', + title: '其他补充附件', + max: 100, + uploadType: 'file', + colProps: { span: 6 }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '重大施工项目', + }, + }, + { + valueType: 'formList', + dataIndex: 'major_construction', + // title: '重大施工项目', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + title: '', + colProps: { span: 24 }, + columns: [ + { + title: '重大施工内容', + key: 'name', + colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'draw', + title: '施工图纸', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'certificate', + title: '执业证件', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + ], + }, + ], + }, + { + title: '备注', + key: 'renovation_remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/quality/renovation/application/pages/show.tsx b/src/pages/quality/renovation/application/pages/show.tsx new file mode 100644 index 0000000..e79b916 --- /dev/null +++ b/src/pages/quality/renovation/application/pages/show.tsx @@ -0,0 +1,91 @@ +import { MyPageContainer } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Space, Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import MyDepositTable from '../components/Deposit'; +import MyInfo from '../components/info'; +import MyWorkerTable from '../components/WorkerTable'; + +export default function Index({ title = '装修申请详情' }) { + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setData] = useState({}); + const [loading, setLoading] = useState(true); + + const loadData = () => { + setLoading(true); + Apis.Renovation.RenovationApplies.Show({ id: Number(id) }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + }; + + useEffect(() => { + loadData(); + }, [id]); + + const items = [ + { + key: 'MyInfo', + label: '装修申请详情', + children: ( + + ), + }, + { + key: 'MyWorkerTable', + label: '装修工人', + children: ( + + ), + }, + { + key: 'MyDepositTable', + label: '装修押金', + children: ( + + ), + }, + ]; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="renovation-application-detail" + tabLabel={title} + > + + + ); +} diff --git a/src/pages/quality/renovation/application/pages/update.tsx b/src/pages/quality/renovation/application/pages/update.tsx new file mode 100644 index 0000000..e8fa6ae --- /dev/null +++ b/src/pages/quality/renovation/application/pages/update.tsx @@ -0,0 +1,631 @@ +import { + MyButtons, + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import MyModalsHouseSelectList from '@/components/ModalsHouseSelectList'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + RenovationAppliesProcessTypeEnum, + RenovationAppliesRenovationContentEnum, + RenovationAppliesTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import { useEffect, useState } from 'react'; +export default function Index({ title = '编辑新装修申请' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [getSelectHouse, setSelectHouse] = useState({}); + + const loadShow = () => { + Apis.Renovation.RenovationApplies.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setSelectHouse(res?.data?.asset_house); + form.setFieldsValue(res?.data); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + const onSave = (formData: any, subType: string) => { + Apis.Renovation.RenovationApplies.Update({ + ...formData, + status: subType, + id: data?.id ?? 0, + is_deposit: data.is_deposit ? 1 : 0, + }) + .then(() => { + if (subType === 'Draft') { + navigate(-1); + message.success('暂存成功'); + } else { + navigate(-1); + message.success('提交成功'); + } + }) + .catch(() => false); + }; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + submitter={{ + render: (props) => { + return [ + { + onSave(form.getFieldsValue(), 'Draft'); + }} + title="暂存" + />, + { + props.submit(); + }} + title="提交审核" + />, + ]; + }, + }} + onFinish={async (values: any) => { + onSave(values, 'Pending'); + }} + columns={[ + { + colProps: { span: 24 }, + title: '选择房屋', + key: 'asset_houses_id', + formItemProps: { ...rulesHelper.text }, + renderFormItem: () => { + return ( + + + { + setSelectHouse(e); + form.setFieldsValue({ + asset_houses_id: e?.id, + }); + }} + /> + {getSelectHouse?.full_name ? ( +
已选择房屋:{getSelectHouse?.full_name}
+ ) : ( + '' + )} +
+
+ ); + }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '装修类型', + valueEnum: RenovationAppliesTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.EnumRadio({ + key: 'process_type', + title: '办理类型', + valueEnum: RenovationAppliesProcessTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '是否有保证金', + colProps: { span: 6 }, + key: 'is_deposit', + valueType: 'switch', + }, + + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit + ? [ + { + title: '保证金金额', + colProps: { span: 6 }, + key: 'deposit_amount', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '业主信息', + }, + }, + { + title: '业主姓名', + key: 'owner_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '业主手机', + key: 'owner_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号码', + key: 'owner_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'id_card_front', + title: '证件正面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'id_card_back', + title: '证件反面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'property_certificate', + title: '房产证明', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.array }, + }), + { + valueType: 'dependency', + name: ['process_type'], + columns: ({ process_type }) => { + return process_type === 'AgentProcess' + ? [ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '代理人信息', + }, + }, + { + title: '代理人名称', + key: 'agent_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '代理人手机', + key: 'agent_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'agent_card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号码', + key: 'agent_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'agent_id_card_front', + title: '证件正面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'agent_id_card_back', + title: '证件反面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'power_attorney', + title: '代理人授权书', + max: 1, + colProps: { span: 6 }, + }), + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '施工信息', + }, + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + { + title: '施工负责人名称', + key: 'construction_principal_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '施工负责人手机', + key: 'construction_principal_phone', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.phone }, + fieldProps: { + maxLength: 11, + }, + }, + MyFormItems.EnumSelect({ + key: 'construction_principal_card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '施工负责人证件号', + key: 'construction_principal_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'construction_principal_id_card_front', + title: '施工负责人身份证正面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'construction_principal_id_card_back', + title: '施工负责人身份证反面', + max: 1, + colProps: { span: 6 }, + }), + ] + : []; + }, + }, + + { + valueType: 'group', + columns: [ + { + title: '施工开始时间', + valueType: 'date', + key: 'construction_start_date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + format: 'YYYY-MM-DD', + onChange: (value: string, dateString: string) => { + form.setFieldValue( + 'construction_start_date', + dateString, + ); + console.log('construction_start_date', value); + }, + style: { + width: '100%', + }, + }, + }, + { + title: '施工结束时间', + valueType: 'date', + key: 'construction_end_date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + format: 'YYYY-MM-DD', + onChange: (value: string, dateString: string) => { + form.setFieldValue('construction_end_date', dateString); + console.log('construction_end_date', value); + }, + style: { + width: '100%', + }, + }, + }, + MyFormItems.EnumRadio({ + key: 'renovation_content', + title: '装修内容', + valueEnum: RenovationAppliesRenovationContentEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '装修公司信息', + }, + }, + { + title: '公司名称', + key: 'company_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '营业执照号', + key: 'company_business_license_num', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + { + title: '公司负责人姓名', + key: 'company_principal_name', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + }, + { + title: '公司负责人手机', + key: 'company_principal_phone', + formItemProps: { ...rulesHelper.phone }, + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + MyFormItems.UploadImages({ + key: 'company_business_license', + title: '装修公司营业执照', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_asset_certificate', + title: '装修公司资质证明', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_power_attorney', + title: '装修公司装修授权书', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + ] + : []; + }, + }, + ] + : []; + }, + }, + ], + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + MyFormItems.UploadImages({ + key: 'company_business_license', + title: '装修公司营业执照', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_asset_certificate', + title: '装修公司资质证明', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_power_attorney', + title: '装修公司装修授权书', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '其他附件', + }, + }, + MyFormItems.UploadImages({ + key: 'construction_draw', + title: '施工图', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'construction_commitment_letter', + title: '施工承诺书', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'other_attachments', + title: '其他补充附件', + max: 100, + uploadType: 'file', + colProps: { span: 6 }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '重大施工项目', + }, + }, + { + valueType: 'formList', + dataIndex: 'major_construction', + // title: '重大施工项目', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + title: '', + colProps: { span: 24 }, + columns: [ + { + title: '重大施工内容', + key: 'name', + colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'draw', + title: '施工图纸', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'certificate', + title: '执业证件', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + ], + }, + ], + }, + { + title: '备注', + key: 'renovation_remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/quality/renovation/audit/index.tsx b/src/pages/quality/renovation/audit/index.tsx new file mode 100644 index 0000000..a3c1c5b --- /dev/null +++ b/src/pages/quality/renovation/audit/index.tsx @@ -0,0 +1,107 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { RenovationAppliesStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index() { + const getCurrentPermissions = useCurrentPermissions(); + const navigate = useNavigate(); + let tableRender = (item: any) => { + return getCurrentPermissions( + { + audit: ( + { + navigate(`/renovation/audit/pages/review?id=${item.id}`); + }} + title="查看并审核" + /> + ), + }, + 'MyRenovationAppliesAudit', + ); + }; + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + params, + sort, + Apis.Renovation.RenovationApplies.List, + ) + } + params={{ + status: 'Pending', + }} + headerTitle="装修审核列表" + columns={[ + MyColumns.ID({ + search: false, + }), + MyColumns.EnumTag({ + title: '登记状态', + dataIndex: 'status', + valueEnum: RenovationAppliesStatusEnum, + search: false, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + { + title: '房屋', + dataIndex: ['asset_house', 'full_name'], + search: { + transform: (value) => { + return { full_name: value }; + }, + }, + }, + { + title: '装修人', + dataIndex: 'owner_name', + }, + { + title: '装修公司', + dataIndex: 'company_name', + search: false, + }, + { + title: '施工负责人', + dataIndex: 'construction_principal_name', + search: false, + }, + { + title: '施工时间', + search: false, + render: (_, item: any) => { + return ( +
+ {item?.construction_start_date || ''} 至 + {item?.construction_end_date || ''} +
+ ); + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index) => ( + {tableRender(item)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/audit/modals/Review.tsx b/src/pages/quality/renovation/audit/modals/Review.tsx new file mode 100644 index 0000000..04e8f6e --- /dev/null +++ b/src/pages/quality/renovation/audit/modals/Review.tsx @@ -0,0 +1,125 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message } from 'antd'; + +const DormigoryBedAuditFlowsAuditStatusEnum = { + Approved: { text: '通过', value: 'Approved' }, + Rejected: { text: '驳回', value: 'Rejected' }, +}; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + return ( + + {...MyModalFormProps.props} + title="审核" + trigger={} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="600px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Renovation.RenovationApplies.Audit({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + message.success('审核成功'); + navigate(-1); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'status', + title: '审核意见', + valueEnum: DormigoryBedAuditFlowsAuditStatusEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['status'], + columns: ({ audit_status }) => { + return audit_status === 'Rejected' + ? [ + { + title: '驳回理由', + valueType: 'textarea', + key: 'reason', + formItemProps: { ...rulesHelper.text }, + }, + ] + : [ + { + title: '设置保证金', + colProps: { span: 6 }, + key: 'is_deposit', + valueType: 'switch', + }, + + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit + ? [ + { + title: '保证金金额', + colProps: { span: 6 }, + key: 'deposit_amount', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + min: 1, + }, + }, + Selects?.ProjectReceiptAccountsSelect({ + key: 'receipt_accounts_id', + title: '选择收款账户', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + showSearch: true, + }, + }), + ] + : []; + }, + }, + Selects.RenovationInspectionRules({ + key: 'renovation_inspection_rules_id', + title: '巡检规则', + required: true, + colProps: { span: 24 }, + }), + { + title: '审核意见', + valueType: 'textarea', + key: 'reason', + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/audit/pages/review.tsx b/src/pages/quality/renovation/audit/pages/review.tsx new file mode 100644 index 0000000..420ed9d --- /dev/null +++ b/src/pages/quality/renovation/audit/pages/review.tsx @@ -0,0 +1,539 @@ +import { + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + RenovationAppliesProcessTypeEnum, + RenovationAppliesRenovationContentEnum, + RenovationAppliesTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, Space } from 'antd'; +import { useEffect, useState } from 'react'; +import Review from '../modals/Review'; +export default function Index({ title = '装修申请审核' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [getSelectHouse, setSelectHouse] = useState({}); + + const loadShow = () => { + Apis.Renovation.RenovationApplies.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setSelectHouse(res?.data?.asset_house); + form.setFieldsValue(res?.data); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="renovation_applies-review" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + submitter={{ + render: () => { + return []; + }, + }} + columns={[ + { + colProps: { span: 24 }, + key: 'asset_houses_id', + formItemProps: { ...rulesHelper.text }, + renderFormItem: () => { + return ( + +
{getSelectHouse?.full_name}
+
+ ); + }, + }, + MyFormItems.EnumRadio({ + key: 'type', + title: '装修类型', + valueEnum: RenovationAppliesTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.EnumRadio({ + key: 'process_type', + title: '办理类型', + valueEnum: RenovationAppliesProcessTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '是否有保证金', + colProps: { span: 6 }, + key: 'is_deposit', + valueType: 'switch', + }, + + { + valueType: 'dependency', + name: ['is_deposit'], + columns: ({ is_deposit }) => { + return is_deposit + ? [ + { + title: '保证金金额', + colProps: { span: 6 }, + key: 'deposit_amount', + valueType: 'digit', + formItemProps: { ...rulesHelper.number }, + fieldProps: { + style: { + width: '100%', + }, + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '业主信息', + }, + }, + { + title: '业主姓名', + key: 'owner_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '业主手机', + key: 'owner_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号码', + key: 'owner_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'id_card_front', + title: '证件正面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'id_card_back', + title: '证件反面', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'property_certificate', + title: '房产证明', + max: 1, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.array }, + }), + { + valueType: 'dependency', + name: ['process_type'], + columns: ({ process_type }) => { + return process_type === 'AgentProcess' + ? [ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '代理人信息', + }, + }, + { + title: '代理人名称', + key: 'agent_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '代理人手机', + key: 'agent_phone', + colProps: { span: 6 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'agent_card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号码', + key: 'agent_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'agent_id_card_front', + title: '证件正面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'agent_id_card_back', + title: '证件反面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'power_attorney', + title: '代理人授权书', + max: 1, + colProps: { span: 6 }, + }), + ] + : []; + }, + }, + + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '装修公司信息', + }, + }, + { + title: '公司名称', + key: 'company_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '营业执照号', + key: 'company_business_license_num', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + { + title: '公司负责人手机', + key: 'company_principal_phone', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + }, + { + title: '负责人手机号', + key: 'company_principal_phone', + formItemProps: { ...rulesHelper.phone }, + colProps: { span: 6 }, + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + MyFormItems.UploadImages({ + key: 'company_business_license', + title: '装修公司营业执照', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_asset_certificate', + title: '装修公司资质证明', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'company_power_attorney', + title: '装修公司装修授权书', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.array }, + }), + ] + : []; + }, + }, + ] + : []; + }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '施工信息', + }, + }, + { + valueType: 'dependency', + name: ['type'], + columns: ({ type }) => { + return type === 'RenovationCompany' + ? [ + { + title: '施工负责人名称', + key: 'construction_principal_name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '施工负责人手机', + key: 'construction_principal_phone', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumSelect({ + key: 'construction_principal_card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '施工负责人证件号', + key: 'construction_principal_id_card', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'construction_principal_id_card_front', + title: '施工负责人身份证正面', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'construction_principal_id_card_back', + title: '施工负责人身份证反面', + max: 1, + colProps: { span: 6 }, + }), + ] + : []; + }, + }, + + { + valueType: 'group', + columns: [ + { + title: '施工开始时间', + valueType: 'date', + key: 'construction_start_date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + format: 'YYYY-MM-DD', + onChange: (value: string, dateString: string) => { + form.setFieldValue( + 'construction_start_date', + dateString, + ); + console.log('construction_start_date', value); + }, + style: { + width: '100%', + }, + }, + }, + { + title: '施工结束时间', + valueType: 'date', + key: 'construction_end_date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + fieldProps: { + format: 'YYYY-MM-DD', + onChange: (value: string, dateString: string) => { + form.setFieldValue('construction_end_date', dateString); + console.log('construction_end_date', value); + }, + style: { + width: '100%', + }, + }, + }, + MyFormItems.EnumRadio({ + key: 'renovation_content', + title: '装修内容', + valueEnum: RenovationAppliesRenovationContentEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + ], + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '其他附件', + }, + }, + MyFormItems.UploadImages({ + key: 'construction_draw', + title: '施工图', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'construction_commitment_letter', + title: '施工承诺书', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'other_attachments', + title: '其他补充附件', + max: 100, + uploadType: 'file', + colProps: { span: 6 }, + }), + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '重大施工项目', + }, + }, + { + valueType: 'formList', + dataIndex: 'major_construction', + // title: '重大施工项目', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + initialValue: [ + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + { + sign_party: null, + counterparty_type: null, + counterparty: null, + }, + ], + columns: [ + { + valueType: 'group', + title: '', + colProps: { span: 24 }, + columns: [ + { + title: '重大施工内容', + key: 'name', + colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'draw', + title: '施工图纸', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'certificate', + title: '执业证件', + uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + ], + }, + ], + }, + { + title: '备注', + key: 'renovation_remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/quality/renovation/config/$id.tsx b/src/pages/quality/renovation/config/$id.tsx new file mode 100644 index 0000000..92eca7f --- /dev/null +++ b/src/pages/quality/renovation/config/$id.tsx @@ -0,0 +1,50 @@ +import { MyPageContainer, usePageTabs } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { useParams } from '@umijs/max'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import MyRenovationWorkers from '../renovation_workers'; + +export default function Config({ title }: { title?: string } = {}) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + // 注册当前页面为标签页 + const { addTab } = usePageTabs({ + tabKey: `charge-standard-${id}`, + tabLabel: data?.name || title || '装修配置详情', + autoAdd: false, + }); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.Renovation.RenovationApplies.Show(paramsId).then((res) => { + setShow(res?.data); + // if (res?.data?.asset_house?.full_name) { + // addTab({ + // key: `renovation_applies_config_${id}`, + // label: `${res?.data?.asset_house?.full_name}_装修配置_${id}`, + // path: `/renovation/show/${id}`, + // }); + // } + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '装修工人', + key: '1', + closable: false, + children: , + }, + ]; + return ( + + + + ); +} diff --git a/src/pages/quality/renovation/deposit/index.tsx b/src/pages/quality/renovation/deposit/index.tsx new file mode 100644 index 0000000..646098d --- /dev/null +++ b/src/pages/quality/renovation/deposit/index.tsx @@ -0,0 +1,110 @@ +import { MyColumns, MyProTableProps, useCurrentPermissions } from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BillPaymentsTypeEnum, BillsStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import PayCreate from './modals/PayCreate'; + +export default function Index() { + const getCurrentPermissions = useCurrentPermissions(); + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + pay: , + }, + 'MyRenovationApply', + ); + }; + return ( + + MyProTableProps.request( + { ...params, type: 'RenovationDeposit' }, + sort, + Apis.Bill.Bills.List, + ) + } + columns={[ + MyColumns.ID({}), + Selects?.AssetProjects({ + title: '选择项目', + key: 'id', + hidden: true, + }), + // MyColumns.EnumTag({ + // title: '费用类型', + // dataIndex: 'flow_type', + // valueEnum: ContractBillsCostTypeEnum, + // search: false, + // }), + MyColumns.EnumTag({ + title: '费用项目', + dataIndex: 'type', + valueEnum: BillPaymentsTypeEnum, + search: false, + }), + { + title: '收款金额', + dataIndex: 'amount', + render: (_, item) => `${item?.amount}元`, + search: false, + }, + // { + // title: '收款账号', + // dataIndex: 'receipt_account', + // render: (_, record) => { + // return `${record.receipt_account?.company_name} + // ${record.receipt_account.company_account?.slice(0, 4)} + // **** + // ${record.receipt_account.company_account?.slice(-4)}`; + // }, + // search: false, + // }, + { + title: '付款人', + dataIndex: 'payer', + }, + { + title: '付款人电话', + dataIndex: 'phone', + }, + MyColumns.EnumTag({ + title: '状态', + dataIndex: 'status', + valueEnum: BillsStatusEnum, + }), + // MyColumns.EnumTag({ + // title: '支付方式', + // dataIndex: 'payment_method', + // valueEnum: HouseOrdersPaymentMethodEnum, + // search: false, + // }), + + { + title: '支付时间', + dataIndex: 'paid_time', + search: false, + }, + { + title: '退款金额', + render: (_, item) => `${item?.refund_amount}元`, + search: false, + }, + { + title: '退款时间', + dataIndex: 'refund_time', + search: false, + }, + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + {tableRender(item, action)} + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/deposit/modals/PayCreate.tsx b/src/pages/quality/renovation/deposit/modals/PayCreate.tsx new file mode 100644 index 0000000..755fb3f --- /dev/null +++ b/src/pages/quality/renovation/deposit/modals/PayCreate.tsx @@ -0,0 +1,103 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOrdersPaymentMethodEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function PayCreate(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`收取装修押金`} + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + width="600px" + layout="horizontal" + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + key={new Date().getTime()} + form={form} + onFinish={async (values) => + Apis.Bill.BillPayments.Store({ + ...values, + bills_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success('收款信息提交成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'total_paid_amount', + title: '收款金额', + valueType: 'digit', + colProps: { span: 24 }, + initialValue: props?.item?.payable_amount, + fieldProps: { + style: { width: '100%' }, + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + MyFormItems.EnumRadio({ + key: 'payment_method', + title: '收款方式', + colProps: { span: 24 }, + valueEnum: () => { + const obj: Record = JSON.parse( + JSON.stringify(HouseOrdersPaymentMethodEnum), + ); + delete obj.WeChat; + delete obj.Alipay; + delete obj.TongLian; + delete obj.Prepayment; + return obj; + }, + required: true, + }), + + { + key: 'paid_time', + title: '收款日期', + valueType: 'date', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + key: 'remark', + title: '收款备注', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + placeholder: '请详细描述工单内容', + rows: 4, + }, + }, + MyFormItems.UploadImages({ + key: 'pay_certificate', + title: '收款凭证', + tooltip: '最多上传5张图片', + // uploadType: 'file', + max: 5, + colProps: { span: 24 }, + formItemProps: { required: false }, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/index.tsx b/src/pages/quality/renovation/index.tsx new file mode 100644 index 0000000..5dee3c4 --- /dev/null +++ b/src/pages/quality/renovation/index.tsx @@ -0,0 +1,43 @@ +import { MyPageContainer } from '@/common'; +// import MyDecorationWorkorder from '@/pages/work_order/renovation'; +import type { TabsProps } from 'antd'; +import { Tabs } from 'antd'; +import MyRenovationApplies from './application'; +import MyRenovationAppliesAudit from './audit'; +import MyRenovationApply from './deposit'; +import MyRenovationInspectionRules from './renovation_inspection_rules'; + +export default function Index({ title = '装修管理' }) { + const items: TabsProps['items'] = [ + { + key: 'MyRenovationApplies', + label: '装修申请', + children: , + }, + { + key: 'MyRenovationAppliesAudit', + label: '资料审核', + children: , + }, + { + key: 'MyRenovationInspectionRules', + label: '巡检规则配置', + children: , + }, + { + key: 'MyRenovationApply', + label: '装修押金', + children: , + }, + ]; + return ( + + + + ); +} diff --git a/src/pages/quality/renovation/modals/WorkerCreate.tsx b/src/pages/quality/renovation/modals/WorkerCreate.tsx new file mode 100644 index 0000000..f5cc2dc --- /dev/null +++ b/src/pages/quality/renovation/modals/WorkerCreate.tsx @@ -0,0 +1,117 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOccupantsCardTypeEnum } from '@/gen/Enums'; +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={`添加${props.title}`} + width="700px" + wrapperCol={{ span: 24 }} + labelAlign="left" + trigger={ + + } + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Renovation.RenovationWorkers.Store({ + ...values, + worker_phone: values.worker_phone?.toString(), + renovation_applies_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success('添加成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '姓名', + colProps: { span: 12 }, + key: 'worker_name', + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + colProps: { span: 12 }, + valueType: 'digit', + key: 'worker_phone', + fieldProps: { maxLength: 11, style: { width: '100%' } }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号', + colProps: { span: 12 }, + key: 'id_card', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'card_front', + title: '证件正面', + max: 1, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'card_back', + title: '证件反面', + max: 1, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.array }, + }), + { + title: '证件有效期-开始', + colProps: { span: 12 }, + valueType: 'date', + key: 'valid_from', + fieldProps: { style: { width: '100%' } }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '证件有效期-结束', + colProps: { span: 12 }, + valueType: 'date', + key: 'valid_to', + fieldProps: { style: { width: '100%' } }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'worker_photo', + title: '工人照片', + max: 1, + formItemProps: { ...rulesHelper.array }, + colProps: { span: 24 }, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/modals/WorkerUpdate.tsx b/src/pages/quality/renovation/modals/WorkerUpdate.tsx new file mode 100644 index 0000000..725f2b1 --- /dev/null +++ b/src/pages/quality/renovation/modals/WorkerUpdate.tsx @@ -0,0 +1,111 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOccupantsCardTypeEnum } from '@/gen/Enums'; +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="编辑工人" + width="700px" + wrapperCol={{ span: 24 }} + labelAlign="left" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Renovation.RenovationWorkers.Update({ + ...values, + worker_phone: values.worker_phone?.toString(), + id: props?.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('更新成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '姓名', + colProps: { span: 12 }, + key: 'worker_name', + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + colProps: { span: 12 }, + valueType: 'digit', + key: 'worker_phone', + fieldProps: { maxLength: 11, style: { width: '100%' } }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号', + colProps: { span: 12 }, + key: 'id_card', + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'card_front', + title: '证件正面', + max: 1, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.array }, + }), + MyFormItems.UploadImages({ + key: 'card_back', + title: '证件反面', + max: 1, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.array }, + }), + { + title: '证件有效期-开始', + colProps: { span: 12 }, + valueType: 'date', + key: 'valid_from', + fieldProps: { style: { width: '100%' } }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '证件有效期-结束', + colProps: { span: 12 }, + valueType: 'date', + key: 'valid_to', + fieldProps: { style: { width: '100%' } }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'worker_photo', + title: '工人照片', + max: 1, + formItemProps: { ...rulesHelper.array }, + colProps: { span: 24 }, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/renovation_inspection_rules/index.tsx b/src/pages/quality/renovation/renovation_inspection_rules/index.tsx new file mode 100644 index 0000000..d2c9007 --- /dev/null +++ b/src/pages/quality/renovation/renovation_inspection_rules/index.tsx @@ -0,0 +1,94 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '巡检规则' }) { + const getCurrentPermissions = useCurrentPermissions(); + let toolBarRender = (action: any) => { + return getCurrentPermissions( + { + add: , + }, + 'MyRenovationInspectionRules', + ); + }; + + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + update: , + delete: ( + + Apis.Renovation.RenovationInspectionRules.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyRenovationInspectionRules', + ); + }; + return ( + + MyProTableProps.request( + params, + sort, + Apis.Renovation.RenovationInspectionRules.List, + ) + } + toolBarRender={(action) => [toolBarRender(action)]} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '名称', + dataIndex: 'name', + }, + + { + title: '巡逻时段', + search: false, + render: (_, item: any) => { + return ( + + {item?.rule?.map((res: any, index: number) => { + return ( +
+ 【{index + 1}】{res.start_time}-{res.end_time} +
+ ); + })} +
+ ); + }, + }, + { + title: '巡逻说明', + dataIndex: 'description', + search: false, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + <>{tableRender(item, action)} + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/renovation_inspection_rules/modals/Create.tsx b/src/pages/quality/renovation/renovation_inspection_rules/modals/Create.tsx new file mode 100644 index 0000000..57bad94 --- /dev/null +++ b/src/pages/quality/renovation/renovation_inspection_rules/modals/Create.tsx @@ -0,0 +1,97 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} 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" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Renovation.RenovationInspectionRules.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + valueType: 'formList', + dataIndex: 'rule', + title: '巡逻时段(添加多行,代表一天巡逻多次)', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '开始时间', + key: 'start_time', + valueType: 'time', + colProps: { span: 12 }, + fieldProps: { + format: 'HH:mm', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '结束时间', + key: 'end_time', + valueType: 'time', + colProps: { span: 12 }, + fieldProps: { + format: 'HH:mm', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + { + title: '巡逻说明', + key: 'description', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/renovation_inspection_rules/modals/Update.tsx b/src/pages/quality/renovation/renovation_inspection_rules/modals/Update.tsx new file mode 100644 index 0000000..449d139 --- /dev/null +++ b/src/pages/quality/renovation/renovation_inspection_rules/modals/Update.tsx @@ -0,0 +1,100 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Renovation.RenovationInspectionRules.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + }, + { + valueType: 'formList', + dataIndex: 'rule', + title: '巡逻时段(添加多行,代表一天巡逻多次)', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + title: '开始时间', + key: 'start_time', + valueType: 'time', + colProps: { span: 12 }, + fieldProps: { + format: 'HH:mm', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '结束时间', + key: 'end_time', + valueType: 'time', + colProps: { span: 12 }, + fieldProps: { + format: 'HH:mm', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + { + title: '巡逻说明', + key: 'description', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/renovation_workers/index.tsx b/src/pages/quality/renovation/renovation_workers/index.tsx new file mode 100644 index 0000000..9e47f10 --- /dev/null +++ b/src/pages/quality/renovation/renovation_workers/index.tsx @@ -0,0 +1,109 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOccupantsCardTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Image, Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index(props: MyBetaModalFormProps) { + return ( + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { ...params, renovation_applies_id: props?.item?.id }, + sort, + Apis.Renovation.RenovationWorkers.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '工人姓名', + dataIndex: 'worker_name', + }, + { + title: '工人电话', + dataIndex: 'worker_phone', + }, + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${item?.valid_from} - ${item?.valid_to}`; + }, + }, + MyColumns.EnumTag({ + title: '证件类型', + dataIndex: 'card_type', + search: false, + valueEnum: HouseOccupantsCardTypeEnum, + }), + { + title: '证件号', + search: false, + dataIndex: 'id_card', + }, + { + title: '证件正面', + search: false, + render: (_, item: any) => { + return item?.card_front?.map((res: any, index: number) => { + return ( + + ); + }); + }, + }, + { + title: '证件反面', + search: false, + render: (_, item: any) => { + return item?.card_back?.map((res: any, index: number) => { + return ( + + ); + }); + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Renovation.RenovationWorkers.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/renovation_workers/modals/Create.tsx b/src/pages/quality/renovation/renovation_workers/modals/Create.tsx new file mode 100644 index 0000000..de37974 --- /dev/null +++ b/src/pages/quality/renovation/renovation_workers/modals/Create.tsx @@ -0,0 +1,105 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOccupantsCardTypeEnum } 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="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Renovation.RenovationWorkers.Store({ + ...values, + renovation_applies_id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success('添加成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'worker_name', + title: '工人姓名', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + title: '工人电话', + key: 'worker_phone', + colProps: { span: 12 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号', + key: 'id_card', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'card_front', + title: '证件正面', + max: 1, + colProps: { span: 12 }, + }), + MyFormItems.UploadImages({ + key: 'card_back', + title: '证件反面', + max: 1, + colProps: { span: 12 }, + }), + { + title: '证件有效期开始', + key: 'valid_from', + valueType: 'dateTime', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '证件有效期结束', + key: 'valid_to', + valueType: 'dateTime', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'worker_photo', + title: '工人照片', + max: 1, + colProps: { span: 24 }, + }), + ]} + /> + ); +} diff --git a/src/pages/quality/renovation/renovation_workers/modals/Update.tsx b/src/pages/quality/renovation/renovation_workers/modals/Update.tsx new file mode 100644 index 0000000..b34477d --- /dev/null +++ b/src/pages/quality/renovation/renovation_workers/modals/Update.tsx @@ -0,0 +1,105 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseOccupantsCardTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Renovation.RenovationWorkers.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'worker_name', + title: '工人姓名', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + title: '工人电话', + key: 'worker_phone', + colProps: { span: 12 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + valueEnum: HouseOccupantsCardTypeEnum, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '证件号', + key: 'id_card', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'card_front', + title: '证件正面', + max: 1, + colProps: { span: 12 }, + }), + MyFormItems.UploadImages({ + key: 'card_back', + title: '证件反面', + max: 1, + colProps: { span: 12 }, + }), + { + title: '证件有效期开始', + key: 'valid_from', + valueType: 'dateTime', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '证件有效期结束', + key: 'valid_to', + valueType: 'dateTime', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'worker_photo', + title: '工人照片', + max: 1, + colProps: { span: 24 }, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/internal/index.tsx b/src/pages/supplier/internal/index.tsx new file mode 100644 index 0000000..98ae850 --- /dev/null +++ b/src/pages/supplier/internal/index.tsx @@ -0,0 +1,79 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanySuppliersCounterpartyEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '企业信息' }) { + return ( + + + MyProTableProps.request( + { + ...params, + counterparty: + CompanySuppliersCounterpartyEnum.InternalCompany.value, + }, + sort, + Apis.CompanySupplier.CompanySuppliers.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '企业名称', + dataIndex: 'name', + }, + { + title: '营业执照', + dataIndex: 'tax_number', + }, + { + title: '所在城市', + search: false, + render: (_, item: any) => { + return `${item.province} ${item.city || ''} `; + }, + // render: (_, item: any) => { + // return `${item.province} ${item.city || ''} ${item.area || ''} ${ + // item.street || '' + // }${item.address || ''}`; + // }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.CompanySupplier.CompanySuppliers.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/supplier/internal/modals/Create.tsx b/src/pages/supplier/internal/modals/Create.tsx new file mode 100644 index 0000000..5afdfb8 --- /dev/null +++ b/src/pages/supplier/internal/modals/Create.tsx @@ -0,0 +1,158 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Address } from '@/components/Address'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCertificateTypeEnum, + CompanySuppliersCounterpartyEnum, + CompanySuppliersSupplierTypeEnum, +} 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="820px" + style={{ + padding: '20px', + maxHeight: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.CompanySupplier.CompanySuppliers.Store({ + ...values, + is_general_taxpayer: values.is_general_taxpayer ? 1 : 0, + counterparty: CompanySuppliersCounterpartyEnum.InternalCompany.value, + supplier_type: CompanySuppliersSupplierTypeEnum.Enterprise.value, + certificate_type: + CompanySuppliersCertificateTypeEnum.BusinessLicense.value, + company_name: values.name, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '企业名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'tax_number', + title: '纳税人识别号', + colProps: { span: 12 }, + }, + { + valueType: 'group', + columns: [ + Address.Cascader({ + key: 'casacader', + title: '选择地址', + // required: true, + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + }), + { + key: 'address', + title: '详细地址', + required: true, + colProps: { span: 12 }, + }, + ], + }, + { + key: 'tax_address', + title: '开票地址', + colProps: { span: 12 }, + }, + { + key: 'tax_phone', + title: '开票电话', + colProps: { span: 12 }, + }, + { + key: 'tax_bank_name', + title: '开户行', + colProps: { span: 12 }, + }, + { + key: 'tax_bank_account', + title: '银行账号', + colProps: { span: 6 }, + }, + { + key: 'is_general_taxpayer', + title: '是否一般纳税人', + valueType: 'switch', + colProps: { span: 6 }, + }, + // { + // key: 'legal_person', + // title: '法定代表人', + // colProps: { span: 6 }, + // }, + // { + // valueType: 'divider', + // fieldProps: { + // orientation: 'left', + // children: '收款账号', + // }, + // }, + // { + // valueType: 'formList', + // dataIndex: 'bank_accounts', + // fieldProps: { + // copyIconProps: false, + // // deleteIconProps: false, + // }, + // columns: [ + // { + // valueType: 'group', + // colProps: { span: 24 }, + // columns: [ + // { + // key: 'company_name', + // title: '开户名称', + // colProps: { span: 8 }, + // }, + // { + // key: 'tax_bank_name', + // title: '开户银行', + // colProps: { span: 8 }, + // }, + // { + // key: 'tax_bank_account', + // title: '银行账号', + // colProps: { span: 8 }, + // }, + // ], + // }, + // ], + // }, + ]} + /> + ); +} diff --git a/src/pages/supplier/internal/modals/Update.tsx b/src/pages/supplier/internal/modals/Update.tsx new file mode 100644 index 0000000..82c0cc9 --- /dev/null +++ b/src/pages/supplier/internal/modals/Update.tsx @@ -0,0 +1,168 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Address } from '@/components/Address'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCertificateTypeEnum, + CompanySuppliersCounterpartyEnum, + CompanySuppliersSupplierTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="820px" + style={{ + padding: '20px', + maxHeight: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + casacader: [ + props.item?.province || '', + props.item?.city || '', + props.item?.area || '', + props.item?.street || '', + ], + }); + } + }} + onFinish={async (values) => + Apis.CompanySupplier.CompanySuppliers.Update({ + ...values, + is_general_taxpayer: values.is_general_taxpayer ? 1 : 0, + id: props.item?.id ?? 0, + counterparty: CompanySuppliersCounterpartyEnum.InternalCompany.value, + supplier_type: CompanySuppliersSupplierTypeEnum.Enterprise.value, + certificate_type: + CompanySuppliersCertificateTypeEnum.BusinessLicense.value, + company_name: values.name, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '企业名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + key: 'tax_number', + title: '纳税人识别号', + colProps: { span: 12 }, + }, + { + valueType: 'group', + columns: [ + Address.Cascader({ + key: 'casacader', + title: '选择地址', + // required: true, + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + }), + { + key: 'address', + title: '详细地址', + required: true, + colProps: { span: 12 }, + }, + ], + }, + { + key: 'tax_address', + title: '开票地址', + colProps: { span: 12 }, + }, + { + key: 'tax_phone', + title: '开票电话', + colProps: { span: 12 }, + }, + { + key: 'tax_bank_name', + title: '开户行', + colProps: { span: 12 }, + }, + { + key: 'tax_bank_account', + title: '银行账号', + colProps: { span: 6 }, + }, + { + key: 'is_general_taxpayer', + title: '是否一般纳税人', + valueType: 'switch', + colProps: { span: 6 }, + }, + // { + // key: 'legal_person', + // title: '法定代表人', + // colProps: { span: 6 }, + // }, + + // { + // valueType: 'divider', + // fieldProps: { + // orientation: 'left', + // children: '收款账号', + // }, + // }, + // { + // valueType: 'formList', + // dataIndex: 'bank_accounts', + // fieldProps: { + // copyIconProps: false, + // // deleteIconProps: false, + // }, + // columns: [ + // { + // valueType: 'group', + // colProps: { span: 24 }, + // columns: [ + // { + // key: 'company_name', + // title: '开户名称', + // colProps: { span: 8 }, + // }, + // { + // key: 'tax_bank_name', + // title: '开户银行', + // colProps: { span: 8 }, + // }, + // { + // key: 'tax_bank_account', + // title: '银行账号', + // colProps: { span: 8 }, + // }, + // ], + // }, + // ], + // }, + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/components/ContractBill.tsx b/src/pages/supplier/outside/components/ContractBill.tsx new file mode 100644 index 0000000..1b22b15 --- /dev/null +++ b/src/pages/supplier/outside/components/ContractBill.tsx @@ -0,0 +1,105 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractBillsCostTypeEnum, + HouseOrdersOrderStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index({ ...rest }) { + const navigate = useNavigate(); + return ( + <> + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + company_suppliers_id: rest.item?.company_suppliers_id, + }, + sort, + Apis.Contract.ContractBills.List, + ) + } + search={false} + columns={[ + { + title: '合同', + dataIndex: ['contract', 'name'], + render: (_, item: any) => ( + { + navigate(`/contract/contracts/show/${item.contracts_id}`); + }} + > + {item?.contract?.name || ''} + + ), + search: false, + }, + // { + // title: '合同ID', + // dataIndex: 'contracts_id', + // render: (_, item: any) => ( + // { + // navigate(`/contract/contracts/show/${item.contracts_id}`); + // }} + // > + // {item?.contracts_id} + // + // ), + // }, + MyColumns.EnumTag({ + title: '费用类型', + dataIndex: 'cost_type', + valueEnum: ContractBillsCostTypeEnum, + }), + { + title: '年月', + search: false, + render: (_, item: any) => { + return `${item?.year || 0}-${ + item?.month < 10 ? `0${item?.month}` : item?.month + }`; + }, + }, + MyColumns.EnumTag({ + title: '支付状态', + dataIndex: 'payment_status', + valueEnum: HouseOrdersOrderStatusEnum, + }), + + { + title: '账单金额', + search: false, + render: (_, item: any) => { + return `¥${item?.amount || 0}`; + }, + }, + { + title: '交易方', + render: (_, item: any) => { + const payeeText = item?.payee?.includes(':') + ? item?.payee?.split(':')?.[1] + : item?.payee || ''; + const payerText = item?.payer?.includes(':') + ? item?.payer?.split(':')?.[1] + : item?.payer || ''; + return ( + +
{payeeText}
|| +
{payerText}
+
+ ); + }, + }, + MyColumns.CreatedAt(), + ]} + /> + + ); +} diff --git a/src/pages/supplier/outside/components/Credit.tsx b/src/pages/supplier/outside/components/Credit.tsx new file mode 100644 index 0000000..28e8f90 --- /dev/null +++ b/src/pages/supplier/outside/components/Credit.tsx @@ -0,0 +1,176 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CreditRatingEnum, RatingOutlookEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space, Tag } from 'antd'; +import AddCredit from '../modals/AddCredit'; +import CreditShow from './modals/CreditShow'; +import CreditUpdate from './modals/CreditUpdate'; + +export default function Credit({ ...rest }) { + return ( + <> + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + supplier_id: rest.item?.company_suppliers_id, + }, + sort, + Apis.CompanySupplier.SupplierCreditReports.List, + ) + } + search={false} + toolBarRender={(action) => [ + , + ]} + columns={[ + { + title: '调查机构', + dataIndex: 'investigation_agency', + search: false, + }, + MyColumns.EnumTag({ + title: '信用评级', + dataIndex: 'credit_rating', + valueEnum: CreditRatingEnum, + search: false, + }), + + MyColumns.EnumTag({ + title: '评级展望', + dataIndex: 'rating_outlook', + valueEnum: RatingOutlookEnum, + search: false, + }), + + { + title: '失信记录', + dataIndex: 'has_execution_info', + search: false, + render: (_, item: any) => ( + + {item?.has_execution_info ? '有' : '无'} + + ), + }, + { + title: '诉讼记录', + dataIndex: 'has_lawsuit_record', + search: false, + render: (_, item: any) => ( + + {item?.has_lawsuit_record ? '有' : '无'} + + ), + }, + { + title: '行政处罚', + dataIndex: 'has_admin_penalty', + search: false, + render: (_, item: any) => ( + + {item?.has_admin_penalty ? '有' : '无'} + + ), + }, + { + title: '出具日期', + dataIndex: 'issue_date', + search: false, + valueType: 'date', + }, + { + title: '报告有效期', + dataIndex: 'expiry_date', + search: false, + valueType: 'date', + }, + { + title: '调查文件', + search: false, + render: (_, item) => { + // 文件名缩写函数 + const truncateFileName = ( + fileName: string, + maxLength: number = 16, + ) => { + if (!fileName || fileName.length <= maxLength) { + return fileName; + } + const extensionIndex = fileName.lastIndexOf('.'); + if ( + extensionIndex > -1 && + extensionIndex < fileName.length - 1 + ) { + // 有扩展名的情况 + const extension = fileName.substring(extensionIndex); + const nameWithoutExt = fileName.substring(0, extensionIndex); + const availableLength = maxLength - extension.length; + if (availableLength <= 5) { + // 如果剩余长度太少,直接截断并保留扩展名 + return ( + fileName.substring(0, maxLength - 3) + '...' + extension + ); + } + return ( + nameWithoutExt.substring(0, availableLength - 3) + + '...' + + extension + ); + } + // 没有扩展名的情况 + return fileName.substring(0, maxLength - 3) + '...'; + }; + + return ( +
+ {item?.files?.length > 0 + ? item.files.map((file: any, index: number) => { + const fileName = file?.name || `文件${index + 1}`; + const truncatedName = truncateFileName(fileName); + return ( + + ); + }) + : '-'} +
+ ); + }, + width: 200, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/supplier/outside/components/GradeList.tsx b/src/pages/supplier/outside/components/GradeList.tsx new file mode 100644 index 0000000..6fba6d9 --- /dev/null +++ b/src/pages/supplier/outside/components/GradeList.tsx @@ -0,0 +1,127 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanySuppliersGradeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import dayjs from 'dayjs'; +import AddGrade from '../modals/AddGrade'; + +export default function Index({ ...rest }) { + return ( + <> + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + company_suppliers_id: rest.item?.company_suppliers_id, + }, + sort, + Apis.CompanySupplier.CompanySupplierGrades.List, + ) + } + toolBarRender={(action) => [ + , + ]} + search={false} + columns={[ + { + title: '评级日期', + dataIndex: 'created_at', + render(_, record) { + if (!record.created_at) return ''; + return dayjs(record.created_at).format('YYYY-MM-DD'); + }, + }, + MyColumns.EnumTag({ + title: '评定等级', + dataIndex: 'grade', + valueEnum: CompanySuppliersGradeEnum, + search: false, + }), + { + title: '评级说明', + dataIndex: 'grade_remark', + }, + { + title: '评定人', + dataIndex: 'rater', + render(_, record) { + return `${record.rater || ''}-${record.rater_phone || ''}`; + }, + }, + + { + title: '评级文件', + search: false, + render: (_, item) => { + // 文件名缩写函数 + const truncateFileName = ( + fileName: string, + maxLength: number = 16, + ) => { + if (!fileName || fileName.length <= maxLength) { + return fileName; + } + const extensionIndex = fileName.lastIndexOf('.'); + if ( + extensionIndex > -1 && + extensionIndex < fileName.length - 1 + ) { + // 有扩展名的情况 + const extension = fileName.substring(extensionIndex); + const nameWithoutExt = fileName.substring(0, extensionIndex); + const availableLength = maxLength - extension.length; + if (availableLength <= 5) { + // 如果剩余长度太少,直接截断并保留扩展名 + return ( + fileName.substring(0, maxLength - 3) + '...' + extension + ); + } + return ( + nameWithoutExt.substring(0, availableLength - 3) + + '...' + + extension + ); + } + // 没有扩展名的情况 + return fileName.substring(0, maxLength - 3) + '...'; + }; + + return ( +
+ {item?.grade_files?.length > 0 + ? item.grade_files.map((file: any, index: number) => { + const fileName = file?.name || `文件${index + 1}`; + const truncatedName = truncateFileName(fileName); + return ( + + ); + }) + : '-'} +
+ ); + }, + width: 200, + }, + MyColumns.UpdatedAt(), + ]} + /> + + ); +} diff --git a/src/pages/supplier/outside/components/Info.tsx b/src/pages/supplier/outside/components/Info.tsx new file mode 100644 index 0000000..bf669f5 --- /dev/null +++ b/src/pages/supplier/outside/components/Info.tsx @@ -0,0 +1,180 @@ +import { + MyBetaModalFormProps, + MyProTableProps, + renderTextHelper, +} from '@/common'; +import { + CompanySuppliersGradeEnum, + CompanySuppliersSupplierTypeEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions, ProTable } from '@ant-design/pro-components'; +import { Image, Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + const { item } = props; + + return ( + + {/* 企业供应商 */} + {item?.supplier_type === + CompanySuppliersSupplierTypeEnum.Enterprise.value && ( + + + + {item?.name} + + + + + + + {item?.legal_person} + + + {item?.supplier_type === + CompanySuppliersSupplierTypeEnum.Enterprise.value && ( + + {item?.registered_capital}万 + + )} + + {item.province} {item.city || ''} {item.area || ''} + {item.street || ''} + {item.address || ''} + + + {item?.business_scope} + + + + + + {item?.grade_time?.substring(0, 10)} + + + {item?.is_blacklisted ? '是' : '否'} + + + + )} + {/* 企业供应商 */} + {item?.supplier_type === + CompanySuppliersSupplierTypeEnum.Enterprise.value && ( + + + + {item?.company_name} + + + {item?.is_general_taxpayer ? '是' : '否'} + + + {item?.tax_number} + + + {item?.tax_phone} + + + {item?.tax_bank_account} + + + {item?.tax_bank_name} + + + {item?.tax_address} + + + + )} + {/* 企业供应商 */} + {item?.supplier_type === + CompanySuppliersSupplierTypeEnum.Enterprise.value && ( + + + + {item?.contact_name || '-'} + {item?.contact_phone || '-'} + + + {item?.contact_email || '-'} + + + {item?.contact_remark || '-'} + + + + )} + {/* 个人供应商 */} + {item?.supplier_type === + CompanySuppliersSupplierTypeEnum.Individual.value && ( + + + + + + + {item?.contact_name || '-'} + {item?.contact_phone || '-'} + + + {item?.tax_number} + + + + )} + + + record?.bank_accounts || index} + size="small" + columns={[ + { + title: '开户名称', + dataIndex: 'company_name', + }, + { + title: '开户银行', + dataIndex: 'tax_bank_name', + }, + { + title: '银行账号', + dataIndex: 'tax_bank_account', + }, + ]} + /> + + + + + + {props?.item?.certificates?.map((res: any, index: number) => ( + + ))} + + + + + ); +} diff --git a/src/pages/supplier/outside/components/RelatedPartyContract.tsx b/src/pages/supplier/outside/components/RelatedPartyContract.tsx new file mode 100644 index 0000000..dc11c1b --- /dev/null +++ b/src/pages/supplier/outside/components/RelatedPartyContract.tsx @@ -0,0 +1,143 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + ContractsContractNatureEnum, + ContractsStatusEnum, + ContractTemplatesIncomeExpenseTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import dayjs from 'dayjs'; + +export default function Index({ ...rest }) { + const navigate = useNavigate(); + return ( + <> + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + company_suppliers_id: rest.item?.company_suppliers_id, + }, + sort, + Apis.Contract.Contracts.List, + ) + } + search={false} + columns={[ + MyColumns.ID({ search: false }), + MyColumns.EnumTag({ + title: '合同状态', + dataIndex: 'status', + valueEnum: ContractsStatusEnum, + }), + { + title: '合同编号', + dataIndex: 'code', + render: (_, item: any) => ( + { + navigate(`/contract/contracts/show/${item.id}`); + }} + > + {item?.code || ''} + + ), + }, + { + title: '合同名称', + dataIndex: 'name', + }, + { + title: '合同类型', + dataIndex: 'contract_type_name', + }, + + MyColumns.EnumTag({ + title: '收支类型', + dataIndex: 'income_expense_type', + valueEnum: ContractTemplatesIncomeExpenseTypeEnum, + }), + MyColumns.EnumTag({ + title: '合同性质', + dataIndex: 'contract_nature', + valueEnum: ContractsContractNatureEnum, + }), + { + title: '合同总价', + search: false, + render: (_, item: any) => { + return `¥${item.total_amount}`; + }, + }, + { + title: '账单金额', + render: (_, item: any) => { + return `¥${item.total_bill_amount}`; + }, + }, + { + title: '交易金额', + render: (_, item: any) => { + return item.income_expense_type === 'Income' + ? `¥${item.total_income_amount}` + : item.income_expense_type === 'Expense' + ? `¥${item.total_expense_amount}` + : '-'; + }, + search: false, + }, + { + title: '有效期', + search: false, + render: (_, item: any) => { + return `${dayjs(item.start_time).format('YYYY-MM-DD')}至${dayjs( + item.end_time, + ).format('YYYY-MM-DD')}`; + }, + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { full_name: value }; + }, + }, + }, + { + title: '签订部门', + dataIndex: 'sign_department', + search: false, + }, + { + title: '用印日期', + dataIndex: 'sign_time', + valueType: 'date', + render: (_, item: any) => { + return item.sign_time + ? dayjs(item.sign_time).format('YYYY-MM-DD') + : '-'; + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index) => ( + + { + navigate(`/contract/contracts/show/${item.id}`); + }} + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/supplier/outside/components/Survey.tsx b/src/pages/supplier/outside/components/Survey.tsx new file mode 100644 index 0000000..5138fbe --- /dev/null +++ b/src/pages/supplier/outside/components/Survey.tsx @@ -0,0 +1,106 @@ +import { MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + CooperationSuggestionEnum, + InfoVerificationEnum, + QualificationEvaluationEnum, + RiskLevelEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import AddSurvey from '../modals/AddSurvey'; +import SurveyShow from './modals/SurveyShow'; +import SurveyUpdate from './modals/SurveyUpdate'; + +export default function Survey({ ...rest }) { + return ( + <> + > + {...MyProTableProps.props} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + supplier_id: rest.item?.company_suppliers_id, + }, + sort, + Apis.CompanySupplier.SupplierFieldReports.List, + ) + } + search={false} + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.EnumTag({ + title: '信息核实', + dataIndex: 'info_verification', + valueEnum: InfoVerificationEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '资质评价', + dataIndex: 'qualification_evaluation', + valueEnum: QualificationEvaluationEnum, + search: false, + }), + + MyColumns.EnumTag({ + title: '风险等级', + dataIndex: 'risk_level', + valueEnum: RiskLevelEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '合作建议', + dataIndex: 'cooperation_suggestion', + valueEnum: CooperationSuggestionEnum, + search: false, + }), + + { + title: '调查开始日期', + dataIndex: 'investigation_start_date', + search: false, + valueType: 'date', + }, + { + title: '调查结束日期', + dataIndex: 'investigation_end_date', + search: false, + valueType: 'date', + }, + { + title: '出具日期', + dataIndex: 'issue_date', + search: false, + valueType: 'date', + }, + { + title: '调查人', + dataIndex: 'investigator', + search: false, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/supplier/outside/components/modals/CreditShow.tsx b/src/pages/supplier/outside/components/modals/CreditShow.tsx new file mode 100644 index 0000000..196966c --- /dev/null +++ b/src/pages/supplier/outside/components/modals/CreditShow.tsx @@ -0,0 +1,178 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { CreditRatingEnum, RatingOutlookEnum } from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin, Tag } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + { + if (props?.item?.id) { + setLoading(true); + Apis.Company.SupplierCreditReports.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + {data?.investigation_agency || '-'} + + + {data?.issue_date || '-'} + + + {data?.expiry_date || '-'} + + + + + + + + + + {data?.has_execution_info ? ( + + + {data?.execution_info || '-'} + + ) : ( + + )} + + + {data?.has_lawsuit_record ? ( + + + {data?.lawsuit_info || '-'} + + ) : ( + + )} + + + {data?.has_admin_penalty ? ( + + + {data?.admin_penalty_info || '-'} + + ) : ( + + )} + + + + {data?.performance_evaluation || '-'} + + + + {data?.files && data.files.length > 0 && ( +
+ +
+ )} + {data?.files?.map((file: any, index: number) => { + const fileName = file?.name || `文件${index + 1}`; + + const handleDownload = async (e: React.MouseEvent) => { + e.preventDefault(); + try { + const response = await fetch(file?.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = fileName; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(file?.url, '_blank'); + } + }; + return ( + + ); + }) || '-'} +
+ + {data?.creator_name || '-'} + {data?.creator_phone || '-'} + + + {data?.created_at || '-'} + + + {data?.updated_at || '-'} + +
+
+
+
+ } + /> + ); +} diff --git a/src/pages/supplier/outside/components/modals/CreditUpdate.tsx b/src/pages/supplier/outside/components/modals/CreditUpdate.tsx new file mode 100644 index 0000000..e276134 --- /dev/null +++ b/src/pages/supplier/outside/components/modals/CreditUpdate.tsx @@ -0,0 +1,214 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CreditRatingEnum, RatingOutlookEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑供应商信用报告`} + trigger={} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + form.setFieldValue( + 'has_execution_info', + props.item?.has_execution_info, + ); + } + }} + onFinish={async (values) => + Apis.Company.SupplierCreditReports.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'issue_date', + title: '出具日期', + valueType: 'date', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'expiry_date', + title: '有效期', + valueType: 'date', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + placeholder: '请选择报告有效性的截止日期', + }, + }, + { + key: 'investigation_agency', + title: '调查机构', + valueType: 'text', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'credit_rating', + title: '信用评级', + valueEnum: CreditRatingEnum, + required: true, + colProps: { span: 24 }, + }), + MyFormItems.EnumRadio({ + key: 'rating_outlook', + title: '评级展望', + valueEnum: RatingOutlookEnum, + required: true, + colProps: { span: 24 }, + }), + + { + key: 'has_execution_info', + title: '失信执行', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '有失信被执行信息', + unCheckedChildren: '无失信被执行信息', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('execution_info', undefined); + }, + }, + }, + { + valueType: 'dependency', + name: ['has_execution_info'], + columns: ({ has_execution_info }) => { + return Boolean(has_execution_info) + ? [ + { + key: 'execution_info', + title: '执行信息', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + }, + ] + : []; + }, + }, + { + key: 'has_lawsuit_record', + title: '法律诉讼', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '有法律诉讼记录', + unCheckedChildren: '无法律诉讼记录', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('lawsuit_info', undefined); + }, + }, + }, + { + valueType: 'dependency', + name: ['has_lawsuit_record'], + columns: ({ has_lawsuit_record }) => { + return Boolean(has_lawsuit_record) + ? [ + { + key: 'lawsuit_info', + title: '诉讼信息', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + + { + key: 'has_admin_penalty', + title: '行政处罚', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '有行政处罚记录', + unCheckedChildren: '无行政处罚记录', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('admin_penalty_info', undefined); + }, + }, + }, + { + valueType: 'dependency', + name: ['has_admin_penalty'], + columns: ({ has_admin_penalty }) => { + return Boolean(has_admin_penalty) + ? [ + { + key: 'admin_penalty_info', + title: '处罚信息', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + { + key: 'performance_evaluation', + title: '履约能力评价', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + }, + + MyFormItems.UploadImages({ + key: 'files', + title: '上传附件', + tooltip: '可以上传任意格式的文件', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + max: 9, + formItemProps: { ...rulesHelper.array }, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/components/modals/SurveyShow.tsx b/src/pages/supplier/outside/components/modals/SurveyShow.tsx new file mode 100644 index 0000000..56f58ef --- /dev/null +++ b/src/pages/supplier/outside/components/modals/SurveyShow.tsx @@ -0,0 +1,174 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { + CooperationSuggestionEnum, + InfoVerificationEnum, + QualificationEvaluationEnum, + RiskLevelEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space, Spin } from 'antd'; +import { useState } from 'react'; + +export default function Show(props: MyBetaModalFormProps) { + const [loading, setLoading] = useState(true); + const [data, setData] = useState({}); + + return ( + { + if (props?.item?.id) { + setLoading(true); + Apis.Company.SupplierFieldReports.Show({ id: props.item.id }) + .then((res) => { + setData(res?.data || {}); + }) + .finally(() => { + setLoading(false); + }); + } + }} + node={ + + + + + + {data?.investigator || '-'} + + + {data?.location || '-'} + + + {data?.investigation_start_date || '-'} + + + {data?.investigation_end_date || '-'} + + + {data?.issue_date || '-'} + + + {data?.creator_name || '-'} + + + {data?.creator_phone || '-'} + + + + + + + + + + + + + + + {data?.discrepancy_note || '-'} + + + + {data?.comprehensive_explanation || '-'} + + + {data?.files && data.files.length > 0 && ( +
+ +
+ )} + {data?.files?.map((file: any, index: number) => { + const fileName = file?.name || `文件${index + 1}`; + + const handleDownload = async (e: React.MouseEvent) => { + e.preventDefault(); + try { + const response = await fetch(file?.url); + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = fileName; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + document.body.removeChild(a); + } catch (error) { + console.error('下载失败:', error); + // 如果下载失败,则在新窗口打开 + window.open(file?.url, '_blank'); + } + }; + return ( + + ); + }) || '-'} +
+ + {data?.created_at || '-'} + + + {data?.updated_at || '-'} + +
+
+
+
+ } + /> + ); +} diff --git a/src/pages/supplier/outside/components/modals/SurveyUpdate.tsx b/src/pages/supplier/outside/components/modals/SurveyUpdate.tsx new file mode 100644 index 0000000..7562cb8 --- /dev/null +++ b/src/pages/supplier/outside/components/modals/SurveyUpdate.tsx @@ -0,0 +1,178 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + CooperationSuggestionEnum, + InfoVerificationEnum, + QualificationEvaluationEnum, + RiskLevelEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑实地调查报告`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + form.setFieldValue('investigation_date_range', [ + props.item?.investigation_start_date, + props.item?.investigation_end_date, + ]); + } + }} + onFinish={async (values) => + Apis.Company.SupplierCreditReports.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'investigation_date_range', + title: '调查日期', + valueType: 'dateRange', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'location', + title: '调查地点', + valueType: 'text', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.Employees({ + key: 'investigator', + title: '调查人', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + labelRender: (res: any) => { + console.log(res, '222'); + if (res?.label) { + return res?.label; + } else { + return props?.item?.company_employee?.name; + } + }, + }, + }), + { + key: 'issue_date', + title: '出具日期', + valueType: 'date', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'info_verification', + title: '信息核实', + valueEnum: InfoVerificationEnum, + required: true, + colProps: { span: 24 }, + fieldProps: { + buttonStyle: 'solid', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('discrepancy_note', undefined); + }, + }, + }), + { + valueType: 'dependency', + name: ['info_verification'], + columns: ({ info_verification }) => { + return info_verification === + InfoVerificationEnum.Discrepancy.value || + info_verification === InfoVerificationEnum.Fake.value + ? [ + { + key: 'discrepancy_note', + title: '差异说明', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : info_verification === InfoVerificationEnum.Authentic.value + ? [] + : []; + }, + }, + MyFormItems.EnumRadio({ + key: 'qualification_evaluation', + title: '资质评价', + valueEnum: QualificationEvaluationEnum, + required: true, + colProps: { span: 24 }, + }), + MyFormItems.EnumRadio({ + key: 'risk_level', + title: '风险等级', + valueEnum: RiskLevelEnum, + required: true, + colProps: { span: 24 }, + }), + MyFormItems.EnumRadio({ + key: 'cooperation_suggestion', + title: '合作建议', + valueEnum: CooperationSuggestionEnum, + required: true, + colProps: { span: 24 }, + }), + + { + key: 'comprehensive_explanation', + title: '综合说明', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'files', + title: '上传附件', + tooltip: '可以上传任意格式的文件', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + max: 9, + formItemProps: { ...rulesHelper.array }, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/index.tsx b/src/pages/supplier/outside/index.tsx new file mode 100644 index 0000000..f989bc5 --- /dev/null +++ b/src/pages/supplier/outside/index.tsx @@ -0,0 +1,141 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCounterpartyEnum, + CompanySuppliersGradeEnum, + CompanySuppliersSupplierTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import dayjs from 'dayjs'; +import AddBlack from './modals/AddBlack'; +import AddGrade from './modals/AddGrade'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '供应商' }) { + const navigate = useNavigate(); + + return ( + + + MyProTableProps.request( + { + ...params, + counterparty: CompanySuppliersCounterpartyEnum.Supplier.value, + }, + sort, + Apis.CompanySupplier.CompanySuppliers.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + // MyColumns.ID({ search: false }), + { + title: '供应商名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'supplier_type', + valueEnum: CompanySuppliersSupplierTypeEnum, + }), + // MyColumns.EnumTag({ + // title: '证件类型', + // dataIndex: 'certificate_type', + // valueEnum: CompanySuppliersCertificateTypeEnum, + // search: false, + // }), + { + title: '所在城市', + search: false, + render: (_, item: any) => { + return `${item.city || ''} `; + }, + // render: (_, item: any) => { + // return `${item.province} ${item.city || ''} ${item.area || ''} ${ + // item.street || '' + // }${item.address || ''}`; + // }, + }, + MyColumns.EnumTag({ + title: '等级', + dataIndex: 'grade', + valueEnum: CompanySuppliersGradeEnum, + }), + { + title: '上一次评级', + dataIndex: 'grade_time', + render: (_, item: any) => { + if (!item.grade_time) return ''; + return dayjs(item.grade_time).format('YYYY-MM-DD'); + }, + search: false, + }, + //是否黑名单 + MyColumns.Boolean({ + dataIndex: 'is_blacklisted', + title: '是否拉黑', + }), + + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate(`/supplier/outside/show/${item.id}`); + }} + /> + + + {!item.is_blacklisted && ( + + )} + {item.is_blacklisted === 1 && ( + + Apis.CompanySupplier.CompanySuppliers.Update({ + id: item.id ?? 0, + is_blacklisted: false, + counterparty: item.counterparty ?? 0, + supplier_type: item.supplier_type ?? 0, + name: item.name ?? '', + reason: '', + }).then(() => action?.reload()) + } + /> + )} + + Apis.CompanySupplier.CompanySuppliers.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/supplier/outside/modals/AddBlack.tsx b/src/pages/supplier/outside/modals/AddBlack.tsx new file mode 100644 index 0000000..25bce0e --- /dev/null +++ b/src/pages/supplier/outside/modals/AddBlack.tsx @@ -0,0 +1,68 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`黑名单`} + trigger={} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + const formValues = { + ...props.item, + }; + form.setFieldsValue(formValues); + } + }} + onFinish={async (values: any) => + Apis.CompanySupplier.CompanySuppliers.Update({ + ...values, + is_blacklisted: values.is_blacklisted ? 1 : 0, + id: props.item?.id ?? 0, + counterparty: props.item?.counterparty ?? 0, + supplier_type: props.item?.supplier_type ?? 0, + name: props.item?.name ?? '', + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'is_blacklisted', + title: '是否拉黑', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + }, + { + key: 'reason', + title: '拉入原因', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/modals/AddCredit.tsx b/src/pages/supplier/outside/modals/AddCredit.tsx new file mode 100644 index 0000000..cd62cb6 --- /dev/null +++ b/src/pages/supplier/outside/modals/AddCredit.tsx @@ -0,0 +1,219 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CreditRatingEnum, RatingOutlookEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function AddCredit(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加第三方资信调查报告`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + const formValues = { + ...props.item, + }; + form.setFieldsValue(formValues); + } + }} + onFinish={async (values: any) => + Apis.CompanySupplier.SupplierCreditReports.Store({ + ...values, + supplier_id: props.item?.company_suppliers_id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('添加第三方资信调查报告成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'issue_date', + title: '出具日期', + valueType: 'date', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'expiry_date', + title: '有效期', + valueType: 'date', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + placeholder: '请选择报告有效性的截止日期', + }, + }, + { + key: 'investigation_agency', + title: '调查机构', + valueType: 'text', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'credit_rating', + title: '信用评级', + valueEnum: CreditRatingEnum, + required: true, + colProps: { span: 24 }, + }), + MyFormItems.EnumRadio({ + key: 'rating_outlook', + title: '评级展望', + valueEnum: RatingOutlookEnum, + required: true, + colProps: { span: 24 }, + }), + + { + key: 'has_execution_info', + title: '失信执行', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '有失信被执行信息', + unCheckedChildren: '无失信被执行信息', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('execution_info', undefined); + }, + }, + }, + { + valueType: 'dependency', + name: ['has_execution_info'], + columns: ({ has_execution_info }) => { + return has_execution_info === true + ? [ + { + key: 'execution_info', + title: '执行信息', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + }, + ] + : has_execution_info === false + ? [] + : []; + }, + }, + { + key: 'has_lawsuit_record', + title: '法律诉讼', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '有法律诉讼记录', + unCheckedChildren: '无法律诉讼记录', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('lawsuit_info', undefined); + }, + }, + }, + { + valueType: 'dependency', + name: ['has_lawsuit_record'], + columns: ({ has_lawsuit_record }) => { + return has_lawsuit_record === true + ? [ + { + key: 'lawsuit_info', + title: '诉讼信息', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : has_lawsuit_record === false + ? [] + : []; + }, + }, + + { + key: 'has_admin_penalty', + title: '行政处罚', + valueType: 'switch', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.boolean }, + fieldProps: { + checkedChildren: '有行政处罚记录', + unCheckedChildren: '无行政处罚记录', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('admin_penalty_info', undefined); + }, + }, + }, + { + valueType: 'dependency', + name: ['has_admin_penalty'], + columns: ({ has_admin_penalty }) => { + return has_admin_penalty === true + ? [ + { + key: 'admin_penalty_info', + title: '处罚信息', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : has_admin_penalty === false + ? [] + : []; + }, + }, + { + key: 'performance_evaluation', + title: '履约能力评价', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + }, + + MyFormItems.UploadImages({ + key: 'files', + title: '上传附件', + tooltip: '可以上传任意格式的文件', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + max: 9, + formItemProps: { ...rulesHelper.array }, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/modals/AddGrade.tsx b/src/pages/supplier/outside/modals/AddGrade.tsx new file mode 100644 index 0000000..d9ca337 --- /dev/null +++ b/src/pages/supplier/outside/modals/AddGrade.tsx @@ -0,0 +1,82 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanySuppliersGradeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`供应商评级`} + trigger={ + + } + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.resetFields(); // 清空表单数据 + const formValues = { + ...props.item, + }; + form.setFieldsValue(formValues); + } + }} + onFinish={async (values: any) => + Apis.CompanySupplier.CompanySupplierGrades.Store({ + ...values, + company_suppliers_id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'grade', + title: '等级评定', + valueEnum: CompanySuppliersGradeEnum, + required: true, + colProps: { span: 24 }, + }), + { + key: 'grade_remark', + title: '评级说明', + valueType: 'textarea', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.UploadImages({ + key: 'grade_files', + title: '评级文件', + // tooltip: '限传 1 份,仅支持docx,doc,pdf格式', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + // max: 1, + formItemProps: { ...rulesHelper.array }, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/modals/AddSurvey.tsx b/src/pages/supplier/outside/modals/AddSurvey.tsx new file mode 100644 index 0000000..11c6559 --- /dev/null +++ b/src/pages/supplier/outside/modals/AddSurvey.tsx @@ -0,0 +1,176 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + CooperationSuggestionEnum, + InfoVerificationEnum, + QualificationEvaluationEnum, + RiskLevelEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function AddSurvey(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加实地调查报告`} + trigger={} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => + Apis.CompanySupplier.SupplierFieldReports.Store({ + ...values, + supplier_id: props.item?.company_suppliers_id ?? 0, + investigation_start_date: values.investigation_date_range?.[0], + investigation_end_date: values.investigation_date_range?.[1], + }) + .then(() => { + props.reload?.(); + message.success('添加实地调查报告成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'investigation_date_range', + title: '调查日期', + valueType: 'dateRange', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'location', + title: '调查地点', + valueType: 'text', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.Employees({ + key: 'investigator', + title: '调查人', + colProps: { span: 24 }, + required: true, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + labelRender: (res: any) => { + console.log(res, '222'); + if (res?.label) { + return res?.label; + } else { + return props?.item?.company_employee?.name; + } + }, + }, + }), + { + key: 'issue_date', + title: '出具日期', + valueType: 'date', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'info_verification', + title: '信息核实', + valueEnum: InfoVerificationEnum, + required: true, + colProps: { span: 24 }, + fieldProps: { + buttonStyle: 'solid', + onChange: () => { + // 切换计量单位时清空计费模式 + form.setFieldValue('discrepancy_note', undefined); + }, + }, + }), + { + valueType: 'dependency', + name: ['info_verification'], + columns: ({ info_verification }) => { + return info_verification === + InfoVerificationEnum.Discrepancy.value || + info_verification === InfoVerificationEnum.Fake.value + ? [ + { + key: 'discrepancy_note', + title: '差异说明', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : info_verification === InfoVerificationEnum.Authentic.value + ? [] + : []; + }, + }, + MyFormItems.EnumRadio({ + key: 'qualification_evaluation', + title: '资质评价', + valueEnum: QualificationEvaluationEnum, + required: true, + colProps: { span: 24 }, + }), + MyFormItems.EnumRadio({ + key: 'risk_level', + title: '风险等级', + valueEnum: RiskLevelEnum, + required: true, + colProps: { span: 24 }, + }), + MyFormItems.EnumRadio({ + key: 'cooperation_suggestion', + title: '合作建议', + valueEnum: CooperationSuggestionEnum, + required: true, + colProps: { span: 24 }, + }), + + { + key: 'comprehensive_explanation', + title: '综合说明', + valueType: 'textarea', + width: '100%', + colProps: { span: 24 }, + }, + MyFormItems.UploadImages({ + key: 'files', + title: '上传附件', + tooltip: '可以上传任意格式的文件', + uploadType: 'file', + // accept: '.docx,.doc,.pdf', + colProps: { span: 24 }, + max: 9, + formItemProps: { ...rulesHelper.array }, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/modals/Create.tsx b/src/pages/supplier/outside/modals/Create.tsx new file mode 100644 index 0000000..fdfc690 --- /dev/null +++ b/src/pages/supplier/outside/modals/Create.tsx @@ -0,0 +1,283 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Address } from '@/components/Address'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCertificateTypeEnum, + CompanySuppliersCounterpartyEnum, + CompanySuppliersSupplierTypeEnum, +} 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="820px" + style={{ + padding: '20px', + maxHeight: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.CompanySupplier.CompanySuppliers.Store({ + ...values, + is_general_taxpayer: values.is_general_taxpayer ? 1 : 0, + counterparty: CompanySuppliersCounterpartyEnum.Supplier.value, + certificate_type: + values.supplier_type === + CompanySuppliersSupplierTypeEnum.Individual.value + ? CompanySuppliersCertificateTypeEnum.IdCard.value + : CompanySuppliersCertificateTypeEnum.BusinessLicense.value, + company_name: values.company_name || values.name, + contact_name: values.contact_name || values.name, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'supplier_type', + title: '供应商类型', + valueEnum: CompanySuppliersSupplierTypeEnum, + required: true, + colProps: { span: 6 }, + }), + { + key: 'name', + title: '供应商名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + }, + + { + name: ['supplier_type'], + valueType: 'dependency', + columns: ({ supplier_type }: any) => { + return supplier_type === + CompanySuppliersSupplierTypeEnum.Enterprise.value + ? [ + { + key: 'legal_person', + title: '法定代表人', + colProps: { span: 6 }, + }, + { + key: 'registered_capital', + title: '注册资本', + valueType: 'number', + colProps: { span: 6 }, + fieldProps: { + addonAfter: '万', + }, + }, + { + valueType: 'group', + columns: [ + Address.Cascader({ + key: 'casacader', + title: '选择地址', + // required: true, + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + }), + { + key: 'address', + title: '详细地址', + required: true, + colProps: { span: 12 }, + }, + ], + }, + { + key: 'business_scope', + title: '经营范围', + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '开票信息', + }, + }, + { + key: 'tax_number', + title: '纳税人识别号', + colProps: { span: 8 }, + }, + { + key: 'tax_address', + title: '开票地址', + colProps: { span: 8 }, + }, + { + key: 'tax_phone', + title: '开票电话', + colProps: { span: 8 }, + }, + + { + key: 'tax_bank_name', + title: '开户行', + colProps: { span: 8 }, + }, + { + key: 'tax_bank_account', + title: '银行账号', + colProps: { span: 8 }, + }, + { + key: 'is_general_taxpayer', + title: '是否一般纳税人', + valueType: 'switch', + colProps: { span: 6 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '联系人信息', + }, + }, + { + key: 'contact_name', + title: '联系人姓名', + colProps: { span: 6 }, + }, + { + key: 'contact_phone', + title: '联系人电话', + colProps: { span: 6 }, + }, + { + key: 'contact_email', + title: '联系人邮箱', + colProps: { span: 6 }, + }, + { + key: 'contact_remark', + title: '备注', + colProps: { span: 6 }, + }, + ] + : supplier_type === + CompanySuppliersSupplierTypeEnum.Individual.value + ? [ + { + key: 'contact_phone', + title: '联系电话', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.phone }, + }, + { + key: 'tax_number', + title: '个人证件号码', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + placeholder: '请输入个人身份证号码', + maxLength: 18, + }, + }, + { + valueType: 'group', + columns: [ + Address.Cascader({ + key: 'casacader', + title: '选择地址', + required: true, + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + }), + { + key: 'address', + title: '详细地址', + required: true, + colProps: { span: 12 }, + }, + ], + }, + ] + : []; + }, + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '收款账号', + }, + }, + { + valueType: 'formList', + dataIndex: 'bank_accounts', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'company_name', + title: '开户名称', + colProps: { span: 8 }, + }, + { + key: 'tax_bank_name', + title: '开户银行', + colProps: { span: 8 }, + }, + { + key: 'tax_bank_account', + title: '银行账号', + colProps: { span: 8 }, + }, + ], + }, + ], + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '证件资料', + }, + }, + MyFormItems.UploadImages({ + key: 'certificates', + colProps: { span: 24 }, + uploadType: 'file', + max: 10, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/modals/Update.tsx b/src/pages/supplier/outside/modals/Update.tsx new file mode 100644 index 0000000..a9358bd --- /dev/null +++ b/src/pages/supplier/outside/modals/Update.tsx @@ -0,0 +1,295 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Address } from '@/components/Address'; +import { Apis } from '@/gen/Apis'; +import { + CompanySuppliersCertificateTypeEnum, + CompanySuppliersCounterpartyEnum, + CompanySuppliersSupplierTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="820px" + style={{ + padding: '20px', + maxHeight: '680px', + overflowY: 'auto', + overflowX: 'hidden', + }} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + casacader: [ + props.item?.province || '', + props.item?.city || '', + props.item?.area || '', + props.item?.street || '', + ], + }); + } + }} + onFinish={async (values) => + Apis.CompanySupplier.CompanySuppliers.Update({ + ...values, + is_general_taxpayer: values.is_general_taxpayer ? 1 : 0, + id: props.item?.id ?? 0, + counterparty: CompanySuppliersCounterpartyEnum.Supplier.value, + certificate_type: + values.supplier_type === + CompanySuppliersSupplierTypeEnum.Individual.value + ? CompanySuppliersCertificateTypeEnum.IdCard.value + : CompanySuppliersCertificateTypeEnum.BusinessLicense.value, + company_name: values.company_name || values.name, + contact_name: values.contact_name || values.name, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'supplier_type', + title: '供应商类型', + valueEnum: CompanySuppliersSupplierTypeEnum, + required: true, + colProps: { span: 6 }, + }), + { + key: 'name', + title: '供应商名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 6 }, + }, + + { + name: ['supplier_type'], + valueType: 'dependency', + columns: ({ supplier_type }: any) => { + return supplier_type === + CompanySuppliersSupplierTypeEnum.Enterprise.value + ? [ + { + key: 'legal_person', + title: '法定代表人', + colProps: { span: 6 }, + }, + { + key: 'registered_capital', + title: '注册资本', + valueType: 'number', + colProps: { span: 6 }, + fieldProps: { + addonAfter: '万', + }, + }, + { + valueType: 'group', + columns: [ + Address.Cascader({ + key: 'casacader', + title: '选择地址', + // required: true, + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + }), + { + key: 'address', + title: '详细地址', + required: true, + colProps: { span: 12 }, + }, + ], + }, + { + key: 'business_scope', + title: '经营范围', + valueType: 'textarea', + colProps: { span: 24 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '开票信息', + }, + }, + { + key: 'tax_number', + title: '纳税人识别号', + colProps: { span: 8 }, + fieldProps: { + placeholder: '请输入纳税人识别号', + maxLength: 18, + }, + }, + { + key: 'tax_address', + title: '开票地址', + colProps: { span: 8 }, + }, + { + key: 'tax_phone', + title: '开票电话', + colProps: { span: 8 }, + }, + + { + key: 'tax_bank_name', + title: '开户行', + colProps: { span: 8 }, + }, + { + key: 'tax_bank_account', + title: '银行账号', + colProps: { span: 8 }, + }, + { + key: 'is_general_taxpayer', + title: '是否一般纳税人', + valueType: 'switch', + colProps: { span: 6 }, + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '联系人信息', + }, + }, + { + key: 'contact_name', + title: '联系人姓名', + colProps: { span: 6 }, + }, + { + key: 'contact_phone', + title: '联系人电话', + colProps: { span: 6 }, + }, + { + key: 'contact_email', + title: '联系人邮箱', + colProps: { span: 6 }, + }, + { + key: 'contact_remark', + title: '备注', + colProps: { span: 6 }, + }, + ] + : supplier_type === + CompanySuppliersSupplierTypeEnum.Individual.value + ? [ + { + key: 'contact_phone', + title: '联系电话', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.phone }, + }, + { + key: 'tax_number', + title: '个人证件号码', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + placeholder: '请输入个人身份证号码', + maxLength: 18, + }, + }, + { + valueType: 'group', + columns: [ + Address.Cascader({ + key: 'casacader', + title: '选择地址', + required: true, + colProps: { span: 12 }, + keys: ['province', 'city', 'area', 'street'], + }), + { + key: 'address', + title: '详细地址', + required: true, + colProps: { span: 12 }, + }, + ], + }, + ] + : []; + }, + }, + + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '收款账号', + }, + }, + { + valueType: 'formList', + dataIndex: 'bank_accounts', + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'company_name', + title: '开户名称', + colProps: { span: 8 }, + }, + { + key: 'tax_bank_name', + title: '开户银行', + colProps: { span: 8 }, + }, + { + key: 'tax_bank_account', + title: '银行账号', + colProps: { span: 8 }, + }, + ], + }, + ], + }, + { + valueType: 'divider', + fieldProps: { + orientation: 'left', + children: '证件资料', + }, + }, + MyFormItems.UploadImages({ + key: 'certificates', + colProps: { span: 24 }, + max: 10, + }), + ]} + /> + ); +} diff --git a/src/pages/supplier/outside/show/$id.tsx b/src/pages/supplier/outside/show/$id.tsx new file mode 100644 index 0000000..1d46cc4 --- /dev/null +++ b/src/pages/supplier/outside/show/$id.tsx @@ -0,0 +1,98 @@ +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 ContractBill from '../components/ContractBill'; +import Credit from '../components/Credit'; +import GradeList from '../components/GradeList'; +import Info from '../components/Info'; +import RelatedPartyContract from '../components/RelatedPartyContract'; +import Survey from '../components/Survey'; + +export default function Show({ title = '供应商' }) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.CompanySupplier.CompanySuppliers.Show(paramsId).then((res) => { + setShow(res?.data); + // 更新标签页标题 + // if (res?.data?.full_name) { + // addTab({ + // key: `supplier-outside-detail-${id}`, + // label: title, + // path: `/supplier/outside/show/${id}`, + // }); + // } + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '基本信息', + key: 'info', + closable: false, + children: loadShow()} />, + }, + { + label: '评级记录', + key: 'grade', + closable: false, + children: ( + { + loadShow(); + }} + /> + ), + }, + { + label: '关联合同', + key: 'contract', + closable: false, + children: ( + + ), + }, + { + label: '关联账单', + key: 'bill', + closable: false, + children: , + }, + { + label: '实地调查', + key: 'survey', + closable: false, + children: , + }, + { + label: '资信调查', + key: 'credit', + closable: false, + children: , + }, + ]; + + return ( + + {/* */} + + + + + ); +} -- 2.47.2 From 4d3b6b3b19466d17b7d0d13c1fc3475f55567abd Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 15 Apr 2026 15:17:03 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix=EF=BC=9A=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Select.tsx | 1 - .../contract_archive_use/borrows/index.tsx | 22 +- .../borrows/modals/Create.tsx | 466 ++++++++++++------ .../contract_archive_use/read/index.tsx | 17 +- src/pages/contract/contracts_add/index.tsx | 121 ++--- src/pages/contract/contracts_other/index.tsx | 16 - .../contracts_other/modals/Create.tsx | 105 ++-- .../contracts_other/modals/Update.tsx | 48 +- 8 files changed, 472 insertions(+), 324 deletions(-) diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 00eb18f..4731c3b 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -247,7 +247,6 @@ export const Selects = { keywords: params?.keyWords === undefined ? params?.name : params?.keyWords, }; - console.log(params, 'Employees'); return ( await Apis.Company.CompanyEmployees.Select({ ...params, diff --git a/src/pages/contract/contract_archive_use/borrows/index.tsx b/src/pages/contract/contract_archive_use/borrows/index.tsx index c68d5cf..dbcaeba 100644 --- a/src/pages/contract/contract_archive_use/borrows/index.tsx +++ b/src/pages/contract/contract_archive_use/borrows/index.tsx @@ -52,17 +52,25 @@ export default function Index({ title = '合同借用' }) { title: '借用信息', search: false, render: (_, item: any) => { - if (!item?.borrow_files || item.borrow_files.length === 0) { + if (!item?.contract_archive_borrow_files) { return '-'; } return (
- {item.borrow_files.map((res: any, index: number) => ( -
- 文件: {res?.file?.name},借用: {res?.borrow_number},遗失:{' '} - {res?.lost_number},损坏: {res?.damaged_number} -
- ))} + {item.contract_archive_borrow_files.map( + (res: any, index: number) => ( +
+ 文件: {res?.contract_archive_file?.name},借用: + {res?.contract_archive_file?.borrow_number},遗失: + {res?.contract_archive_file?.lost_number},损坏: + { + res?.contract_archive_file?.contract_archive_file + ?.lost_number + } + ,损坏: {res?.contract_archive_file?.damaged_number} +
+ ), + )}
); }, diff --git a/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx b/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx index a0d6c76..4b149a5 100644 --- a/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx +++ b/src/pages/contract/contract_archive_use/borrows/modals/Create.tsx @@ -14,12 +14,12 @@ import { } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; import { Button, Form, message, Space } from 'antd'; -import { useState } from 'react'; export default function Create(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - const [ApprovalTemplates, setApprovalTemplates] = useState([]); - + // const [ApprovalTemplates, setApprovalTemplates] = useState([]); + let approval_templates_id_store = 0; + let ApprovalTemplates: any = []; return ( {...MyModalFormProps.props} @@ -35,9 +35,8 @@ export default function Create(props: MyBetaModalFormProps) { }} trigger={} onFinish={async (values: any) => { - console.log(values, 'values'); - const { node_approvers } = values; + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { // 遍历模板节点,通过名称找到对应的提交节点进行校验 for (const templateNode of ApprovalTemplates) { @@ -317,17 +316,20 @@ export default function Create(props: MyBetaModalFormProps) { }, colProps: { span: 24 }, formItemProps: { ...rulesHelper.number }, - fieldProps: { - onChange: (e: any) => { - // 确保e是有效值,并且使用正确的value字段 - if (e) { - const templateId = typeof e === 'object' ? e.value : e; + }), + { + valueType: 'dependency', + name: ['approval_templates_id'], + columns: ({ approval_templates_id }) => { + if (approval_templates_id) { + if (approval_templates_id_store !== approval_templates_id) { + approval_templates_id_store = approval_templates_id; Apis.Approval.ApprovalTemplates.Show({ - id: templateId, + id: approval_templates_id, }).then((res) => { // setApprovalTemplates(res?.data?.approval_template_nodes); + ApprovalTemplates = res?.data?.approval_template_nodes; form.setFieldsValue({ - approval_templates_id: templateId, node_approvers: res?.data?.approval_template_nodes?.map( (item: any) => ({ ...item, @@ -339,164 +341,304 @@ export default function Create(props: MyBetaModalFormProps) { }); }); } - // 不返回任何值,防止默认行为 - }, - }, - }), - { - valueType: 'dependency', - name: ['approval_templates_id'], - columns: ({ approval_templates_id }) => { - return approval_templates_id - ? [ + } + return [ + { + valueType: 'formList', + dataIndex: 'node_approvers', + // title: '审批节点', + fieldProps: { + copyIconProps: false, + deleteIconProps: false, + creatorButtonProps: false, + actionRender: (field: any, action: any) => [ + , + , + ], + }, + formItemProps: { + ...rulesHelper.array, + wrapperCol: { span: 24 }, + }, + columns: [ { - valueType: 'formList', - dataIndex: 'node_approvers', - // title: '审批节点', - fieldProps: { - copyIconProps: false, - deleteIconProps: false, - creatorButtonProps: false, - actionRender: (field: any, action: any) => [ - , - , - ], - }, - formItemProps: { - ...rulesHelper.array, - wrapperCol: { span: 24 }, - }, + valueType: 'group', + colProps: { span: 24 }, columns: [ + MyFormItems.EnumSelect({ + key: 'node_type', + // title: `类型`, + valueEnum: ApprovalTemplateNodesNodeTypeEnum, + colProps: { span: 5 }, + formItemProps: { + ...rulesHelper.text, + }, + }), { - valueType: 'group', - colProps: { span: 24 }, - columns: [ - MyFormItems.EnumSelect({ - key: 'node_type', - // title: `类型`, - valueEnum: ApprovalTemplateNodesNodeTypeEnum, - colProps: { span: 5 }, - formItemProps: { - ...rulesHelper.text, - }, - fieldProps: { - disabled: true, - }, - }), - { - // title: '节点名称', - key: 'name', - colProps: { span: 6 }, - formItemProps: { - ...rulesHelper.text, - }, - fieldProps: { - disabled: true, - }, - }, - { - valueType: 'dependency', - name: ['node_type'], - columns: ({ node_type }) => { - return [ - Selects.Employees({ - key: 'members', - title: ``, - colProps: { span: 13 }, - formItemProps: { - ...rulesHelper.array, - }, - fieldProps: { - mode: 'multiple', - showSearch: true, - maxCount: - node_type === - ApprovalTemplateNodesNodeTypeEnum.Approver - .value - ? 1 - : 9, - maxTagTextLength: 3, - labelRender: (res: any) => { - if (res?.label) { - return res?.label; - } else { - return ApprovalTemplates?.map( - (item: any) => { - if ( - item?.node_type === node_type && - item - ?.approval_template_node_members - ?.length - ) { - return item?.approval_template_node_members?.map( - (i: any) => { - if ( - i?.company_employees_id === - res?.value - ) { - return ( - i?.company_employee - ?.name || '' - ); - } - }, - ); - } - }, - ); - } - }, - }, - }), - ]; - }, - }, - ], + // title: '节点名称', + key: 'name', + colProps: { span: 6 }, + formItemProps: { + ...rulesHelper.text, + }, + }, + { + valueType: 'dependency', + name: ['node_type'], + columns: ({ node_type }) => { + return [ + Selects.Employees({ + key: 'members', + title: ``, + colProps: { span: 13 }, + formItemProps: { + ...rulesHelper.array, + }, + fieldProps: { + mode: 'multiple', + showSearch: true, + maxCount: + node_type === + ApprovalTemplateNodesNodeTypeEnum.Approver + .value + ? 1 + : 9, + maxTagTextLength: 3, + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return ApprovalTemplates?.map( + (item: any) => { + if ( + item?.node_type === node_type && + item?.approval_template_node_members + ?.length + ) { + return item?.approval_template_node_members?.map( + (i: any) => { + if ( + i?.company_employees_id === + res?.value + ) { + return ( + i?.company_employee?.name || + '' + ); + } + }, + ); + } + }, + ); + } + }, + }, + }), + ]; + }, }, ], }, - ] - : []; + ], + }, + ]; }, }, + + // { + // valueType: 'dependency', + // name: ['approval_templates_id'], + // columns: ({ approval_templates_id }) => { + // return approval_templates_id + // ? [ + // { + // valueType: 'formList', + // dataIndex: 'node_approvers', + // // title: '审批节点', + // fieldProps: { + // copyIconProps: false, + // deleteIconProps: false, + // creatorButtonProps: false, + // actionRender: (field: any, action: any) => [ + // , + // , + // ], + // }, + // 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, + // }, + // fieldProps: { + // disabled: true, + // }, + // }), + // { + // // title: '节点名称', + // key: 'name', + // colProps: { span: 6 }, + // formItemProps: { + // ...rulesHelper.text, + // }, + // fieldProps: { + // disabled: true, + // }, + // }, + // { + // valueType: 'dependency', + // name: ['node_type'], + // columns: ({ node_type }) => { + // return [ + // Selects.Employees({ + // key: 'members', + // title: ``, + // colProps: { span: 13 }, + // formItemProps: { + // ...rulesHelper.array, + // }, + // fieldProps: { + // mode: 'multiple', + // showSearch: true, + // maxCount: + // node_type === + // ApprovalTemplateNodesNodeTypeEnum.Approver + // .value + // ? 1 + // : 9, + // maxTagTextLength: 3, + // labelRender: (res: any) => { + // if (res?.label) { + // return res?.label; + // } else { + // return ApprovalTemplates?.map( + // (item: any) => { + // if ( + // item?.node_type === node_type && + // item + // ?.approval_template_node_members + // ?.length + // ) { + // return item?.approval_template_node_members?.map( + // (i: any) => { + // if ( + // i?.company_employees_id === + // res?.value + // ) { + // return ( + // i?.company_employee + // ?.name || '' + // ); + // } + // }, + // ); + // } + // }, + // ); + // } + // }, + // }, + // }), + // ]; + // }, + // }, + // ], + // }, + // ], + // }, + // ] + // : []; + // }, + // }, ]} /> ); diff --git a/src/pages/contract/contract_archive_use/read/index.tsx b/src/pages/contract/contract_archive_use/read/index.tsx index 27af2f5..3ea7ded 100644 --- a/src/pages/contract/contract_archive_use/read/index.tsx +++ b/src/pages/contract/contract_archive_use/read/index.tsx @@ -41,16 +41,21 @@ export default function Index({ title = '合同借阅' }) { title: '借阅信息', search: false, render: (_, item: any) => { - if (!item?.read_files || item.read_files.length === 0) { + if ( + !item?.contract_archive_read_files || + item.contract_archive_read_files.length === 0 + ) { return '-'; } return (
- {item.read_files.map((res: any, index: number) => ( -
- 文件: {res?.file?.name} -
- ))} + {item.contract_archive_read_files.map( + (res: any, index: number) => ( +
+ 文件: {res?.contract_archive_file?.name} +
+ ), + )}
); }, diff --git a/src/pages/contract/contracts_add/index.tsx b/src/pages/contract/contracts_add/index.tsx index 7153396..6eee0d6 100644 --- a/src/pages/contract/contracts_add/index.tsx +++ b/src/pages/contract/contracts_add/index.tsx @@ -3,7 +3,6 @@ import { MyColumns, MyPageContainer, MyProTableProps, - useCurrentPermissions, } from '@/common'; import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; @@ -25,79 +24,61 @@ import Voided from './modals/Voided'; export default function Index({ title = '补充协议' }) { const navigate = useNavigate(); const [searchParams, setSearchParams]: any = useSearchParams(); - const getCurrentPermissions = useCurrentPermissions(); let tableRender = (item: any, action: any) => { console.log(item, 'item'); - let permissions = getCurrentPermissions({ - update: ( - { - navigate( - `/contract/contracts/pages/contract_add_update?id=${item.id}`, - ); - }} - title="编辑" - /> - ), - }); + let permissions = [ + { + navigate( + `/contract/contracts/pages/contract_add_update?id=${item.id}`, + ); + }} + title="编辑" + />, + ]; - let permissionsSpace = getCurrentPermissions({ - useseal: { - key: '1', - label: ( - - ), - }, - - archives: { - key: '3', - label: ( - - ), - }, - - terminated: { - key: '5', - label: , - }, - voided: { - key: '6', - label: , - }, - delete: { - key: '8', - label: ( - - Apis.Contract.Contracts.SoftDelete({ - id: item.id, - }).then(() => action?.reload()) - } - /> - ), - }, - }); + let permissionsSpace = [ + , + , + , + , + + Apis.Contract.Contracts.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + />, + ]; let Others = ( diff --git a/src/pages/contract/contracts_other/index.tsx b/src/pages/contract/contracts_other/index.tsx index 0f5b33d..7b7cc54 100644 --- a/src/pages/contract/contracts_other/index.tsx +++ b/src/pages/contract/contracts_other/index.tsx @@ -80,12 +80,6 @@ export default function Index({ title = '其他用印' }) { title: '是否用印', dataIndex: 'is_sealed', }), - { - title: '用印日期', - dataIndex: 'use_sealed_date', - valueType: 'date', - search: false, - }, //company_employee { title: '申请人', @@ -97,16 +91,6 @@ export default function Index({ title = '其他用印' }) { }, search: false, }, - { - title: '用印人', - dataIndex: 'use_sealed_by_name', - render: (_, item: any) => { - return `${item.use_sealed_by_name || '-'}${ - item.use_sealed_by_phone || '' - }`; - }, - search: false, - }, MyColumns.UpdatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( diff --git a/src/pages/contract/contracts_other/modals/Create.tsx b/src/pages/contract/contracts_other/modals/Create.tsx index ad68d4d..4d238c5 100644 --- a/src/pages/contract/contracts_other/modals/Create.tsx +++ b/src/pages/contract/contracts_other/modals/Create.tsx @@ -10,13 +10,12 @@ import { SelectContract } from '@/components/SelectContract'; import { Apis } from '@/gen/Apis'; import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; -import { Button, Form, message } from 'antd'; -import { useState } from 'react'; +import { Button, Form, message, Space } from 'antd'; export default function Create(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - const [ApprovalTemplates, setApprovalTemplates] = useState([]); - + // const [ApprovalTemplates, setApprovalTemplates] = useState([]); + let ApprovalTemplates: any = []; return ( {...MyModalFormProps.props} @@ -26,9 +25,9 @@ export default function Create(props: MyBetaModalFormProps) { labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} labelAlign="left" - width="600px" + width="680px" form={form} - key={new Date().getDate()} + key={new Date().getTime()} onOpenChange={(open: any) => { if (open && props.item) { form.resetFields(); @@ -39,7 +38,6 @@ export default function Create(props: MyBetaModalFormProps) { }} onFinish={async (values: any) => { const { node_approvers } = values; - if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { // 遍历模板节点,通过名称找到对应的提交节点进行校验 for (const templateNode of ApprovalTemplates) { @@ -83,7 +81,7 @@ export default function Create(props: MyBetaModalFormProps) { } } } - + return Apis.Contract.ContractOthers.Store({ ...values, }) @@ -166,7 +164,10 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Approval.ApprovalTemplates.Show({ id: templateId, }).then((res) => { - setApprovalTemplates(res?.data?.approval_template_nodes || []); + ApprovalTemplates = res?.data?.approval_template_nodes || []; + // setApprovalTemplates( + // res?.data?.approval_template_nodes || [], + // ); form.setFieldsValue({ approval_templates_id: templateId, node_approvers: res?.data?.approval_template_nodes?.map( @@ -199,46 +200,48 @@ export default function Create(props: MyBetaModalFormProps) { deleteIconProps: false, creatorButtonProps: false, actionRender: (field: any, action: any) => [ - , - , + + + + , ], }, formItemProps: { @@ -254,7 +257,7 @@ export default function Create(props: MyBetaModalFormProps) { key: 'node_type', // title: `类型`, valueEnum: ApprovalTemplateNodesNodeTypeEnum, - colProps: { span: 5 }, + colProps: { span: 6 }, formItemProps: { ...rulesHelper.text, }, @@ -281,7 +284,7 @@ export default function Create(props: MyBetaModalFormProps) { Selects.Employees({ key: 'members', title: ``, - colProps: { span: 13 }, + colProps: { span: 12 }, formItemProps: { ...rulesHelper.array, }, diff --git a/src/pages/contract/contracts_other/modals/Update.tsx b/src/pages/contract/contracts_other/modals/Update.tsx index ce00ae7..6e94e67 100644 --- a/src/pages/contract/contracts_other/modals/Update.tsx +++ b/src/pages/contract/contracts_other/modals/Update.tsx @@ -8,25 +8,34 @@ import { import { Selects } from '@/components/Select'; import { SelectContract } from '@/components/SelectContract'; import { Apis } from '@/gen/Apis'; -import { ApprovalTemplateNodesNodeTypeEnum } from '@/gen/Enums'; +import { + ApprovalTemplateNodesNodeTypeEnum, + CompanySealsTypeEnum, +} from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; import { Button, Form, message } from 'antd'; -import { useState } from 'react'; export default function Create(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - const [ApprovalTemplates, setApprovalTemplates] = useState([]); - + let ApprovalTemplates: any[] = []; return ( {...MyModalFormProps.props} title={`其他用印申请`} - trigger={} + trigger={ + + } layout="horizontal" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} labelAlign="left" - width="600px" + width="680px" form={form} key={new Date().getTime()} onOpenChange={(open: any) => { @@ -34,12 +43,13 @@ export default function Create(props: MyBetaModalFormProps) { form.resetFields(); form.setFieldsValue({ ...props.item, + seals: props.item?.seals?.map((i: any) => i?.id) || [], }); } }} onFinish={async (values: any) => { const { node_approvers } = values; - + if (ApprovalTemplates?.length > 0 && node_approvers?.length > 0) { // 遍历模板节点,通过名称找到对应的提交节点进行校验 for (const templateNode of ApprovalTemplates) { @@ -83,7 +93,7 @@ export default function Create(props: MyBetaModalFormProps) { } } } - + return Apis.Contract.ContractOthers.Update({ ...values, id: props.item?.id ?? '', @@ -137,6 +147,22 @@ export default function Create(props: MyBetaModalFormProps) { fieldProps: { showSearch: true, mode: 'multiple', + labelRender: (res: any) => { + console.log(res, props?.item); + if (res?.label) { + return res?.label; + } else { + return props?.item?.seals?.map((i: any) => { + if (i?.id === res?.value) { + return `${i?.company_supplier?.name} (${ + CompanySealsTypeEnum[ + i?.type as keyof typeof CompanySealsTypeEnum + ].text + })`; + } + }); + } + }, }, }), MyFormItems.UploadImages({ @@ -167,7 +193,7 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Approval.ApprovalTemplates.Show({ id: templateId, }).then((res) => { - setApprovalTemplates(res?.data?.approval_template_nodes || []); + ApprovalTemplates = res?.data?.approval_template_nodes || []; form.setFieldsValue({ approval_templates_id: templateId, node_approvers: res?.data?.approval_template_nodes?.map( @@ -255,7 +281,7 @@ export default function Create(props: MyBetaModalFormProps) { key: 'node_type', // title: `类型`, valueEnum: ApprovalTemplateNodesNodeTypeEnum, - colProps: { span: 5 }, + colProps: { span: 6 }, formItemProps: { ...rulesHelper.text, }, @@ -282,7 +308,7 @@ export default function Create(props: MyBetaModalFormProps) { Selects.Employees({ key: 'members', title: ``, - colProps: { span: 13 }, + colProps: { span: 12 }, formItemProps: { ...rulesHelper.array, }, -- 2.47.2 From 7c7379178782e3609646c9cc116a40e4c4c96ab3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 15 Apr 2026 15:52:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=E6=9B=B4=E6=96=B0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=A4=96=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.ts | 4 +- src/components/Select.tsx | 50 +++++++++++++++++++--- src/pages/contract/contracts_add/index.tsx | 2 +- src/pages/quality/index/index.tsx | 10 ++--- src/pages/quality/index/modals/Create.tsx | 2 +- 5 files changed, 51 insertions(+), 17 deletions(-) diff --git a/.umirc.ts b/.umirc.ts index 437b3a3..832ce32 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -17,8 +17,8 @@ export default defineConfig({ }, proxy: { '/api/': { - target: 'http://10.39.13.78:8002/', - // target: 'https://test-company.linyikj.com.cn/', + // target: 'http://10.39.13.78:8002/', + target: 'http://test-company.linyikj.com.cn/', // target: 'https://company.linyikj.com.cn/', changeOrigin: true, pathRewrite: { '^': '' }, diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 4731c3b..e2a0c10 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -319,13 +319,13 @@ export const Selects = { valueType: 'select', hideInTable: hideInTable, formItemProps: { ...(required ? rulesHelper.number : {}) }, - request: async (params) => { - let res = await Apis.Asset.AssetProjects.Select({ - keywords: params?.keyWords, - ...params, - }); - return res?.data; - }, + request: async (params) => + ( + await Apis.Asset.AssetProjects.Select({ + keywords: params?.keyWords, + ...params, + }) + ).data, ...rest, fieldProps: { showSearch: true, @@ -961,4 +961,40 @@ export const Selects = { }, }; }, + + //获取班次 + AttendanceShiftsSelect(props?: PropsType): ReturnType { + const { + title = '选择班次', + key = 'attendance_shifts_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + dataIndex: key, + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => { + let res = await Apis.Attendance.AttendanceShifts.Select({ + ...params, + name: params?.keyWords || undefined, + }); + return res?.data; + }, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'name', + value: 'id', + }, + ...rest?.fieldProps, + }, + }; + }, }; diff --git a/src/pages/contract/contracts_add/index.tsx b/src/pages/contract/contracts_add/index.tsx index 6eee0d6..77d7ce8 100644 --- a/src/pages/contract/contracts_add/index.tsx +++ b/src/pages/contract/contracts_add/index.tsx @@ -44,7 +44,7 @@ export default function Index({ title = '补充协议' }) { />, ]; - let permissionsSpace = [ + let permissionsSpace: any = [ { - return getCurrentPermissions({ - create: , - }); - }; + let tableRender = (item: any, action: any) => { return getCurrentPermissions({ show: , @@ -58,7 +54,9 @@ export default function Index({ title = '品质核查' }) { Apis.QualityCheck.QualityChecks.List, ) } - toolBarRender={(action) => [toolBarRender(action)]} + toolBarRender={(action) => [ + action?.reload()} title={title} />, + ]} columns={[ MyColumns.ID({ search: false }), Selects?.AssetProjects({ diff --git a/src/pages/quality/index/modals/Create.tsx b/src/pages/quality/index/modals/Create.tsx index 06b0e3e..4d0666d 100644 --- a/src/pages/quality/index/modals/Create.tsx +++ b/src/pages/quality/index/modals/Create.tsx @@ -26,7 +26,7 @@ export default function Create(props: MyBetaModalFormProps) { form={form} onOpenChange={(open: any) => { if (open) { - form.resetFields(); // 清空表单数据 + // form.resetFields(); // 清空表单数据 } }} onFinish={async (values) => -- 2.47.2