From 14e9cc36ad667796c0061dce92cf220a161986c7 Mon Sep 17 00:00:00 2001 From: "adel.ka" Date: Tue, 30 Sep 2025 12:37:53 +0300 Subject: [PATCH] =?UTF-8?q?SUPPORT-9447:=20=D0=BF=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=8F=D0=BB=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D1=83=20=D0=B2=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=80=D1=82=D0=B5=20=D0=BF=D1=80=D0=BE=D1=86?= =?UTF-8?q?=D0=B5=D1=81=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/button/UserManagementService.ts | 245 +++++++++--------- .../Обработка заявки на добавление пользователя.page | 156 ++++++++--- .../Обработка заявки на изменение пользователя.page | 143 +++++++--- 3 files changed, 340 insertions(+), 204 deletions(-) diff --git a/frontend/src/ts/account_applications/component/button/UserManagementService.ts b/frontend/src/ts/account_applications/component/button/UserManagementService.ts index a7b063af..9a73cd6e 100644 --- a/frontend/src/ts/account_applications/component/button/UserManagementService.ts +++ b/frontend/src/ts/account_applications/component/button/UserManagementService.ts @@ -1,9 +1,9 @@ import { AnalyticalScope, Behavior, + Form, NotNull, ObjectRef, - SaveButton, TextField, Visible } from "@webbpm/base-package"; @@ -32,7 +32,7 @@ import {ErvuPermission} from "../../../modules/app/enum/ErvuPermission"; import {BlockingData} from "./dto/blocking/BlockingData"; import {UnblockingData} from "./dto/blocking/UnblockingData"; -@AnalyticalScope(SaveButton) +@AnalyticalScope(Form) export class UserManagementService extends Behavior { private static PROCESS_START_PATH = '/service/wf/service/start'; @@ -41,9 +41,8 @@ export class UserManagementService extends Behavior { @ObjectRef() public applicationKind: TextField; - private button: SaveButton; + private form: Form; private httpClient: HttpClient; - private onClickFunction: Function; private sendToErvu: boolean = false; private rpc: UserApplicationListRpcService; private authService: AuthorizationService; @@ -51,124 +50,126 @@ export class UserManagementService extends Behavior { initialize() { super.initialize(); - this.button = this.getScript(SaveButton); + this.form = this.getScript(Form); this.httpClient = this.injector.get(HttpClient); this.rpc = this.getScript(UserApplicationListRpcService); this.authService = this.injector.get(AuthorizationService); this.statusUpdateService = this.injector.get(StatusUpdateService); - this.onClickFunction = () => { - if (!this.authService.hasPermission(ErvuPermission.APPROVER) || !this.sendToErvu) { - return; - } - const kind = this.applicationKind.getValue(); - const formJson = this.collectData(); - const appNumber = formJson['appNumber']; - const accountId = formJson['accountId']; - const personId = formJson['idPerson']; - let request; + } - switch (kind) { - case ApplicationKind.CREATE_USER: - let createData = new CreateAccountData(); - createData.account = this.populateDto(new Account(), formJson); - createData.person = this.populateDto(new Person(), formJson); - let roles = new Roles(); - roles.add = formJson['rolesList'].map(id => { - let role = new Role(); - role.id = id; - return role; - }); - createData.roles = roles; - request = new ProcessRequest(); - request.data = createData; - request.processKey = ProcessKey.CREATE; - this.doRequest(request, appNumber); - break; - case ApplicationKind.EDIT_USER_MAIN: - let editPersonData = new EditPersonData(); - editPersonData.accountId = accountId; - editPersonData.personId = personId; - editPersonData.organizationId = formJson['idDomain']; - editPersonData.personData = this.populateDto(new Person(), formJson); - request = new ProcessRequest(); - request.data = editPersonData; - request.processKey = ProcessKey.EDIT_PERSON; - this.doRequest(request, appNumber); - break; - case ApplicationKind.EDIT_USER_ACCOUNT: - let editAccountData = new EditAccountData(); - let account = this.populateDto(new Account(), formJson); - editAccountData.account = account; - editAccountData.accountId = accountId; - request = new ProcessRequest(); - request.data = editAccountData; - request.processKey = ProcessKey.EDIT_ACCOUNT; - this.doRequest(request, appNumber); - break; - case ApplicationKind.EDIT_USER_ROLES: - let editRolesAccount = new EditRolesAccount(); - let rolesList = formJson['rolesList']; - editRolesAccount.accountId = accountId; - let roles2 = new Roles(); - roles2.add = rolesList.map(id => { - let role = new Role(); - role.id = id; - return role; - }); - this.rpc.getRemovedRoleIds(accountId, rolesList) - .then(list => { - roles2.remove = list; - editRolesAccount.roles = roles2; - let editRolesData = new EditRolesData(); - editRolesData.data = editRolesAccount; - request = new ProcessRequest(); - request.data = editRolesData; - request.processKey = ProcessKey.EDIT_ROLES; - this.doRequest(request, appNumber); - }); - break; - case ApplicationKind.BLOCK_USER: - let blockingData = new BlockingData(); - blockingData.accountIdList = [accountId]; - request = new ProcessRequest(); - request.data = blockingData; - request.processKey = ProcessKey.BLOCK; - this.doRequest(request, appNumber); - break; - case ApplicationKind.UNBLOCK_USER: - let unblockingData = new UnblockingData(); - let blockedRegion = formJson['blockedRegion']; + @Visible() + public processDeclaration(): void { + if (!this.authService.hasPermission(ErvuPermission.APPROVER) || !this.sendToErvu) { + return; + } + const kind = this.applicationKind.getValue(); + const formJson = this.collectData(); + const appNumber = formJson['appNumber']; + const accountId = formJson['accountId']; + const personId = formJson['idPerson']; + let request; - switch (blockedRegion) { - case BlockedRegion.ACCOUNT: - unblockingData.accountIdList = [accountId]; - break; - case BlockedRegion.PERSON: - unblockingData.personIdList = [personId]; - break; - case BlockedRegion.BOTH: - unblockingData.accountIdList = [accountId]; - unblockingData.personIdList = [personId]; - break; - } - request = new ProcessRequest(); - request.data = unblockingData; - request.processKey = ProcessKey.UNBLOCK; - this.doRequest(request, appNumber); - break; - case ApplicationKind.RESET_PASSWORD: - let resetPasswordAccount = new ResetPasswordAccount(); - resetPasswordAccount.id = accountId; - let resetPasswordData = new ResetPasswordData(); - resetPasswordData.account = resetPasswordAccount; - request = new ProcessRequest(); - request.data = resetPasswordData; - request.processKey = ProcessKey.RESET_PASSWORD; - this.doRequest(request, appNumber); - break; - default: break; - } - }; + switch (kind) { + case ApplicationKind.CREATE_USER: + let createData = new CreateAccountData(); + createData.account = this.populateDto(new Account(), formJson); + createData.person = this.populateDto(new Person(), formJson); + let roles = new Roles(); + roles.add = formJson['rolesList'].map(id => { + let role = new Role(); + role.id = id; + return role; + }); + createData.roles = roles; + request = new ProcessRequest(); + request.data = createData; + request.processKey = ProcessKey.CREATE; + this.doRequest(request, appNumber); + break; + case ApplicationKind.EDIT_USER_MAIN: + let editPersonData = new EditPersonData(); + editPersonData.accountId = accountId; + editPersonData.personId = personId; + editPersonData.organizationId = formJson['idDomain']; + editPersonData.personData = this.populateDto(new Person(), formJson); + request = new ProcessRequest(); + request.data = editPersonData; + request.processKey = ProcessKey.EDIT_PERSON; + this.doRequest(request, appNumber); + break; + case ApplicationKind.EDIT_USER_ACCOUNT: + let editAccountData = new EditAccountData(); + let account = this.populateDto(new Account(), formJson); + editAccountData.account = account; + editAccountData.accountId = accountId; + request = new ProcessRequest(); + request.data = editAccountData; + request.processKey = ProcessKey.EDIT_ACCOUNT; + this.doRequest(request, appNumber); + break; + case ApplicationKind.EDIT_USER_ROLES: + let editRolesAccount = new EditRolesAccount(); + let rolesList = formJson['rolesList']; + editRolesAccount.accountId = accountId; + let roles2 = new Roles(); + roles2.add = rolesList.map(id => { + let role = new Role(); + role.id = id; + return role; + }); + this.rpc.getRemovedRoleIds(accountId, rolesList) + .then(list => { + roles2.remove = list; + editRolesAccount.roles = roles2; + let editRolesData = new EditRolesData(); + editRolesData.data = editRolesAccount; + request = new ProcessRequest(); + request.data = editRolesData; + request.processKey = ProcessKey.EDIT_ROLES; + this.doRequest(request, appNumber); + }); + break; + case ApplicationKind.BLOCK_USER: + let blockingData = new BlockingData(); + blockingData.accountIdList = [accountId]; + request = new ProcessRequest(); + request.data = blockingData; + request.processKey = ProcessKey.BLOCK; + this.doRequest(request, appNumber); + break; + case ApplicationKind.UNBLOCK_USER: + let unblockingData = new UnblockingData(); + let blockedRegion = formJson['blockedRegion']; + + switch (blockedRegion) { + case BlockedRegion.ACCOUNT: + unblockingData.accountIdList = [accountId]; + break; + case BlockedRegion.PERSON: + unblockingData.personIdList = [personId]; + break; + case BlockedRegion.BOTH: + unblockingData.accountIdList = [accountId]; + unblockingData.personIdList = [personId]; + break; + } + request = new ProcessRequest(); + request.data = unblockingData; + request.processKey = ProcessKey.UNBLOCK; + this.doRequest(request, appNumber); + break; + case ApplicationKind.RESET_PASSWORD: + let resetPasswordAccount = new ResetPasswordAccount(); + resetPasswordAccount.id = accountId; + let resetPasswordData = new ResetPasswordData(); + resetPasswordData.account = resetPasswordAccount; + request = new ProcessRequest(); + request.data = resetPasswordData; + request.processKey = ProcessKey.RESET_PASSWORD; + this.doRequest(request, appNumber); + break; + default: break; + } } @Visible() @@ -178,7 +179,7 @@ export class UserManagementService extends Behavior { private collectData(): any { let jsonObj = {}; - let fields: FormField[] = this.button.form.getScriptsInChildren(FormField); + let fields: FormField[] = this.form.getScriptsInChildren(FormField); for (let field of fields) { jsonObj[`${field.name}`] = field.getValue(); @@ -220,14 +221,4 @@ export class UserManagementService extends Behavior { .then(() => this.statusUpdateService.publishStatus(appNumber, false)) .catch(err => console.log('failed to update application status', err)); } - - bindEvents() { - super.bindEvents(); - this.button.addClickListener(this.onClickFunction); - } - - unbindEvents() { - super.unbindEvents(); - this.button.removeClickListener(this.onClickFunction); - } } diff --git a/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на добавление пользователя.page b/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на добавление пользователя.page index d72b48b3..cf3d3ea5 100644 --- a/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на добавление пользователя.page +++ b/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на добавление пользователя.page @@ -1975,6 +1975,30 @@ + + + UserManagementService + account_applications.component.button + + true + true + + + applicationKind + + {"objectId":"9e772048-b43f-42f1-a370-2519dd4f6ad7","packageName":"component.field","className":"TextField","type":"TS"} + + + + + + + UserApplicationListRpcService + ru.micord.ervu.account_applications.component.rpc + + true + true + ba24d307-0b91-4299-ba82-9d0b52384ff2 81bc8720-c32a-481c-bc05-35bbb81b0a14 @@ -4481,7 +4505,6 @@ 2ee6f91b-c4a2-461d-8428-c3a6a13c9244 hidden true - false false @@ -4835,6 +4858,88 @@ + + 98594cec-0a9b-4cef-af09-e1b71cb2ad9e + a39cddde-ab9e-4e2b-8587-32ec4f6df5bc + Обработка успешного сохранения + false + false + + + + eventRefs + + + + + + behavior + + {"objectId":"80f94647-9cb4-4aaf-8c6b-a842e486e98c","packageName":"component.container","className":"Form","type":"TS"} + + + + propertyName + + "saveSucceededEvent" + + + + + + + + + ifCondition + + + + conditions + + + + + + logicalOperation + + null + + + + + + + thenActions + + + + + + behavior + + {"objectId":"80f94647-9cb4-4aaf-8c6b-a842e486e98c","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"} + + + + method + + "processDeclaration" + + + + value + + null + + + + + + + + + + 3057d447-6d17-48a8-b096-b14ea88d17e8 @@ -7868,6 +7973,13 @@ + + 98594cec-0a9b-4cef-af09-e1b71cb2ad9e + a39cddde-ab9e-4e2b-8587-32ec4f6df5bc + Обработка событий + false + true + 312c9663-86b4-4672-97bd-67d313585c00 b838c4d9-b8f2-4142-96fe-240540a4802e @@ -8101,30 +8213,6 @@ - - - UserManagementService - account_applications.component.button - - true - true - - - applicationKind - - {"objectId":"9e772048-b43f-42f1-a370-2519dd4f6ad7","packageName":"component.field","className":"TextField","type":"TS"} - - - - - - - UserApplicationListRpcService - ru.micord.ervu.account_applications.component.rpc - - true - true - c8dfe691-a84a-48da-b79e-6298d90db71d @@ -8363,13 +8451,13 @@ - + behavior - {"objectId":"dd6db966-9599-4483-9eae-12718b7f081b","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"} + {"objectId":"80f94647-9cb4-4aaf-8c6b-a842e486e98c","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"} @@ -8381,23 +8469,13 @@ value - - - staticValue - - -boolean - - - true - - - + null + diff --git a/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на изменение пользователя.page b/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на изменение пользователя.page index 5af344ec..7f3f8a7a 100644 --- a/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на изменение пользователя.page +++ b/resources/src/main/resources/business-model/Список заявок на пользователя/Обработка заявки на изменение пользователя.page @@ -912,6 +912,30 @@ + + + UserManagementService + account_applications.component.button + + true + true + + + applicationKind + + {"objectId":"9e772048-b43f-42f1-a370-2519dd4f6ad7","packageName":"component.field","className":"TextField","type":"TS"} + + + + + + + UserApplicationListRpcService + ru.micord.ervu.account_applications.component.rpc + + true + true + 56d5ae60-a4b3-4f98-947b-6654cb4d400b d4485ba1-6ebe-4745-b661-8685332cfc22 @@ -7769,6 +7793,83 @@ true + + 98594cec-0a9b-4cef-af09-e1b71cb2ad9e + 7cfa9569-0aa7-4705-a1a3-743cd28095a9 + Обработка успешного сохранения + false + false + + + + eventRefs + + + + + + behavior + + {"objectId":"80f94647-9cb4-4aaf-8c6b-a842e486e98c","packageName":"component.container","className":"Form","type":"TS"} + + + + propertyName + + "saveSucceededEvent" + + + + + + + + + ifCondition + + + + logicalOperation + + null + + + + + + + thenActions + + + + + + behavior + + {"objectId":"80f94647-9cb4-4aaf-8c6b-a842e486e98c","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"} + + + + method + + "processDeclaration" + + + + value + + null + + + + + + + + + + + c4b63ae3-f093-4b74-891b-d16e2a35644e 69863dbf-ee75-4dcd-8878-7f8b5f299995 @@ -8023,30 +8124,6 @@ - - - UserManagementService - account_applications.component.button - - true - true - - - applicationKind - - {"objectId":"9e772048-b43f-42f1-a370-2519dd4f6ad7","packageName":"component.field","className":"TextField","type":"TS"} - - - - - - - UserApplicationListRpcService - ru.micord.ervu.account_applications.component.rpc - - true - true - c8dfe691-a84a-48da-b79e-6298d90db71d @@ -8298,13 +8375,13 @@ - + behavior - {"objectId":"dd6db966-9599-4483-9eae-12718b7f081b","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"} + {"objectId":"80f94647-9cb4-4aaf-8c6b-a842e486e98c","packageName":"account_applications.component.button","className":"UserManagementService","type":"TS"} @@ -8316,23 +8393,13 @@ value - - - staticValue - - -boolean - - - true - - - + null +