hl-core 0.0.9-beta.50 → 0.0.9-beta.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/base.api.ts +121 -3
- package/components/Form/ManagerAttachment.vue +1 -1
- package/components/Input/Datepicker.vue +5 -0
- package/components/Input/FormInput.vue +5 -0
- package/components/Input/RoundedSelect.vue +5 -0
- package/components/Pages/Auth.vue +9 -3
- package/components/Pages/Documents.vue +141 -52
- package/components/Pages/MemberForm.vue +247 -22
- package/components/Pages/ProductConditions.vue +210 -13
- package/components/Panel/PanelHandler.vue +220 -31
- package/composables/classes.ts +31 -3
- package/composables/constants.ts +11 -2
- package/composables/index.ts +44 -15
- package/locales/ru.json +84 -6
- package/package.json +4 -3
- package/store/data.store.ts +315 -35
- package/store/rules.ts +13 -0
- package/types/enum.ts +18 -0
- package/types/index.ts +6 -3
package/store/data.store.ts
CHANGED
|
@@ -3,22 +3,13 @@ import { rules } from './rules';
|
|
|
3
3
|
import { i18n } from '../configs/i18n';
|
|
4
4
|
import { Toast, Types, Positions, ToastOptions } from './toast';
|
|
5
5
|
import { isValidGUID, yearEnding, jwtDecode, ErrorHandler, getKeyWithPattern, getNumber, getAgeByBirthDate } from '../composables';
|
|
6
|
-
import {
|
|
7
|
-
DataStoreClass,
|
|
8
|
-
Contragent,
|
|
9
|
-
DocumentItem,
|
|
10
|
-
Member,
|
|
11
|
-
Value,
|
|
12
|
-
CountryValue,
|
|
13
|
-
PolicyholderActivity,
|
|
14
|
-
BeneficialOwner,
|
|
15
|
-
GroupMember,
|
|
16
|
-
PolicyholderClass,
|
|
17
|
-
} from '../composables/classes';
|
|
6
|
+
import { DataStoreClass, DocumentItem, Member, Value, CountryValue, PolicyholderActivity, BeneficialOwner, PolicyholderClass } from '../composables/classes';
|
|
18
7
|
import { ApiClass } from '../api';
|
|
19
8
|
import { useFormStore } from './form.store';
|
|
20
9
|
import { AxiosError } from 'axios';
|
|
21
10
|
import { PostActions, StoreMembers, Roles, Statuses, MemberCodes, MemberAppCodes } from '../types/enum';
|
|
11
|
+
//@ts-ignore
|
|
12
|
+
import { NCALayerClient } from 'ncalayer-js-client';
|
|
22
13
|
|
|
23
14
|
export const useDataStore = defineStore('data', {
|
|
24
15
|
state: () => ({
|
|
@@ -66,6 +57,7 @@ export const useDataStore = defineStore('data', {
|
|
|
66
57
|
isCalculator: state => state.product === 'calculator',
|
|
67
58
|
isCheckContract: state => state.product === 'checkcontract',
|
|
68
59
|
isCheckContragent: state => state.product === 'checkcontragent',
|
|
60
|
+
isPrePension: state => state.product === 'prepensionannuity',
|
|
69
61
|
isDSO: state => state.product === 'dso',
|
|
70
62
|
isUU: state => state.product === 'uu',
|
|
71
63
|
isEveryFormDisabled: state => Object.values(state.formStore.isDisabled).every(i => i === true),
|
|
@@ -198,6 +190,9 @@ export const useDataStore = defineStore('data', {
|
|
|
198
190
|
isAdmin() {
|
|
199
191
|
return this.isRole(constants.roles.Admin);
|
|
200
192
|
},
|
|
193
|
+
isJurist() {
|
|
194
|
+
return this.isRole(constants.roles.Jurist);
|
|
195
|
+
},
|
|
201
196
|
isAgent() {
|
|
202
197
|
return this.isRole(constants.roles.Agent);
|
|
203
198
|
},
|
|
@@ -210,6 +205,9 @@ export const useDataStore = defineStore('data', {
|
|
|
210
205
|
isUnderwriter() {
|
|
211
206
|
return this.isRole(constants.roles.Underwriter);
|
|
212
207
|
},
|
|
208
|
+
isActuary() {
|
|
209
|
+
return this.isRole(constants.roles.Actuary);
|
|
210
|
+
},
|
|
213
211
|
isAgentMycar() {
|
|
214
212
|
return this.isRole(constants.roles.AgentMycar);
|
|
215
213
|
},
|
|
@@ -222,6 +220,15 @@ export const useDataStore = defineStore('data', {
|
|
|
222
220
|
isUpk() {
|
|
223
221
|
return this.isRole(constants.roles.UPK);
|
|
224
222
|
},
|
|
223
|
+
isUrp() {
|
|
224
|
+
return this.isRole(constants.roles.URP);
|
|
225
|
+
},
|
|
226
|
+
isUsns() {
|
|
227
|
+
return this.isRole(constants.roles.USNS);
|
|
228
|
+
},
|
|
229
|
+
isAccountant() {
|
|
230
|
+
return this.isRole(constants.roles.Accountant);
|
|
231
|
+
},
|
|
225
232
|
isDrn() {
|
|
226
233
|
return this.isRole(constants.roles.DRNSJ);
|
|
227
234
|
},
|
|
@@ -240,6 +247,15 @@ export const useDataStore = defineStore('data', {
|
|
|
240
247
|
isBranchDirector() {
|
|
241
248
|
return this.isRole(constants.roles.BranchDirector);
|
|
242
249
|
},
|
|
250
|
+
isUSNSACCINS() {
|
|
251
|
+
return this.isRole(constants.roles.USNSACCINS);
|
|
252
|
+
},
|
|
253
|
+
isDsuio() {
|
|
254
|
+
return this.isRole(constants.roles.Dsuio);
|
|
255
|
+
},
|
|
256
|
+
isAdjuster() {
|
|
257
|
+
return this.isRole(constants.roles.Adjuster);
|
|
258
|
+
},
|
|
243
259
|
isProcessEditable(statusCode?: keyof typeof Statuses) {
|
|
244
260
|
const getEditibleStatuses = () => {
|
|
245
261
|
const defaultStatuses = constants.editableStatuses;
|
|
@@ -261,6 +277,13 @@ export const useDataStore = defineStore('data', {
|
|
|
261
277
|
};
|
|
262
278
|
return !!getCanceleStatuses().find(status => status === statusCode);
|
|
263
279
|
},
|
|
280
|
+
isProcessReject(statusCode?: keyof typeof Statuses) {
|
|
281
|
+
const getRejectStatuses = () => {
|
|
282
|
+
const defaultStatuses = constants.rejectApplicationStatuses;
|
|
283
|
+
return defaultStatuses;
|
|
284
|
+
};
|
|
285
|
+
return !!getRejectStatuses().find(status => status === statusCode);
|
|
286
|
+
},
|
|
264
287
|
isTask() {
|
|
265
288
|
return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
|
|
266
289
|
},
|
|
@@ -951,7 +974,7 @@ export const useDataStore = defineStore('data', {
|
|
|
951
974
|
data.isNotary = member.isNotary;
|
|
952
975
|
}
|
|
953
976
|
if (whichMember === 'Insured') {
|
|
954
|
-
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length) {
|
|
977
|
+
if (this.formStore.applicationData && this.formStore.applicationData.insuredApp && this.formStore.applicationData.insuredApp.length && !this.isPension) {
|
|
955
978
|
if (this.members.insuredApp.has) {
|
|
956
979
|
await this.deleteInsuredLogic();
|
|
957
980
|
}
|
|
@@ -960,7 +983,7 @@ export const useDataStore = defineStore('data', {
|
|
|
960
983
|
delete data.id;
|
|
961
984
|
}
|
|
962
985
|
}
|
|
963
|
-
data.isDisability = this.formStore.isPolicyholderInsured ? false : member.isDisability
|
|
986
|
+
data.isDisability = this.formStore.isPolicyholderInsured && !this.isPension ? false : !!member.isDisability;
|
|
964
987
|
data.disabilityGroupId = data.isDisability && member.disabilityGroup ? member.disabilityGroup.id : null;
|
|
965
988
|
data.profession = member.job;
|
|
966
989
|
data.position = member.jobPosition;
|
|
@@ -1012,6 +1035,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1012
1035
|
}
|
|
1013
1036
|
}
|
|
1014
1037
|
},
|
|
1038
|
+
async setApplication(applicationData: object, calculate: boolean = false) {
|
|
1039
|
+
try {
|
|
1040
|
+
this.isLoading = true;
|
|
1041
|
+
this.isButtonsLoading = true;
|
|
1042
|
+
await this.api.setApplication(applicationData);
|
|
1043
|
+
if (calculate) {
|
|
1044
|
+
await this.api.calculatePension(String(this.formStore.applicationData.processInstanceId));
|
|
1045
|
+
this.showToaster('success', this.t('toaster.successSaved'), 2000);
|
|
1046
|
+
}
|
|
1047
|
+
this.isLoading = false;
|
|
1048
|
+
this.isButtonsLoading = false;
|
|
1049
|
+
return true;
|
|
1050
|
+
} catch (err) {
|
|
1051
|
+
this.isLoading = false;
|
|
1052
|
+
this.isButtonsLoading = false;
|
|
1053
|
+
return ErrorHandler(err);
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
1015
1056
|
getConditionsData() {
|
|
1016
1057
|
const conditionsData: {
|
|
1017
1058
|
policyAppDto: PolicyAppDto;
|
|
@@ -1084,7 +1125,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1084
1125
|
},
|
|
1085
1126
|
async deleteInsuredLogic() {
|
|
1086
1127
|
// TODO Просмотреть
|
|
1087
|
-
if (this.isLifetrip) return;
|
|
1128
|
+
if (this.isLifetrip || this.isPension) return;
|
|
1088
1129
|
const applicationData = this.getConditionsData();
|
|
1089
1130
|
const clearCovers = [{ code: 10, value: 'excluded' }];
|
|
1090
1131
|
await Promise.allSettled(
|
|
@@ -1381,16 +1422,22 @@ export const useDataStore = defineStore('data', {
|
|
|
1381
1422
|
return await this.getFromApi('economySectorCode', 'getSectorCode');
|
|
1382
1423
|
},
|
|
1383
1424
|
async getEconomicActivityType() {
|
|
1384
|
-
if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1425
|
+
if (this.isLifeBusiness || this.isGns || this.isDas || this.isUU || this.isPrePension) return await this.getFromApi('economicActivityType', 'getEconomicActivityType');
|
|
1385
1426
|
},
|
|
1386
1427
|
async getFamilyStatuses() {
|
|
1387
1428
|
return await this.getFromApi('familyStatuses', 'getFamilyStatuses');
|
|
1388
1429
|
},
|
|
1430
|
+
async getDisabilityGroups() {
|
|
1431
|
+
return await this.getFromApi('disabilityGroups', 'getArmDicts', 'DicDisabilityGroup');
|
|
1432
|
+
},
|
|
1389
1433
|
async getRelationTypes() {
|
|
1390
1434
|
return await this.getFromApi('relations', 'getRelationTypes');
|
|
1391
1435
|
},
|
|
1392
1436
|
async getBanks() {
|
|
1393
|
-
if (this.isLifeBusiness || this.isGns || this.
|
|
1437
|
+
if (this.isLifeBusiness || this.isDas || this.isUU || this.isPension || this.isGns || this.isPrePension || this.isDSO) return await this.getFromApi('banks', 'getBanks');
|
|
1438
|
+
},
|
|
1439
|
+
async getInsuranceCompanies() {
|
|
1440
|
+
if (this.isPension) return await this.getFromApi('transferContractCompanies', 'getInsuranceCompanies');
|
|
1394
1441
|
},
|
|
1395
1442
|
async getProcessIndexRate() {
|
|
1396
1443
|
if (this.processCode) {
|
|
@@ -1441,7 +1488,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1441
1488
|
return this.gender;
|
|
1442
1489
|
},
|
|
1443
1490
|
async getAuthorityBasis() {
|
|
1444
|
-
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1491
|
+
if (this.isDas || this.isLifeBusiness || this.isGns || this.isUU || this.isPrePension) return await this.getFromApi('authorityBasis', 'getArmDicts', 'DicAuthorityBasis');
|
|
1445
1492
|
},
|
|
1446
1493
|
async getAllFormsData() {
|
|
1447
1494
|
await Promise.allSettled([
|
|
@@ -1476,8 +1523,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1476
1523
|
this.getCurrencies(),
|
|
1477
1524
|
this.getProcessGfot(),
|
|
1478
1525
|
this.getBanks(),
|
|
1526
|
+
this.getInsuranceCompanies(),
|
|
1479
1527
|
this.getEconomicActivityType(),
|
|
1480
1528
|
this.getAuthorityBasis(),
|
|
1529
|
+
this.getDisabilityGroups(),
|
|
1481
1530
|
]);
|
|
1482
1531
|
},
|
|
1483
1532
|
async getQuestionList(
|
|
@@ -1569,6 +1618,10 @@ export const useDataStore = defineStore('data', {
|
|
|
1569
1618
|
delete query.processCodes;
|
|
1570
1619
|
query.processCode = byOneProcess;
|
|
1571
1620
|
}
|
|
1621
|
+
if (byOneProcess === 1) {
|
|
1622
|
+
query.processCodes = [1, 2, 4];
|
|
1623
|
+
delete query.processCode;
|
|
1624
|
+
}
|
|
1572
1625
|
const taskList = await this.api.getTaskList(
|
|
1573
1626
|
processInstanceId === null
|
|
1574
1627
|
? query
|
|
@@ -1665,9 +1718,9 @@ export const useDataStore = defineStore('data', {
|
|
|
1665
1718
|
const found = this[from].find((i: Value) => i[key] == searchKey);
|
|
1666
1719
|
return found || new Value();
|
|
1667
1720
|
},
|
|
1668
|
-
async searchAgentByName(name: string) {
|
|
1721
|
+
async searchAgentByName(name: string, branchCode?: string) {
|
|
1669
1722
|
try {
|
|
1670
|
-
this.AgentData = await this.api.searchAgentByName(name);
|
|
1723
|
+
this.AgentData = await this.api.searchAgentByName(name, branchCode);
|
|
1671
1724
|
if (!this.AgentData.length) {
|
|
1672
1725
|
this.showToaster('error', this.t('toaster.notFound'), 1500);
|
|
1673
1726
|
}
|
|
@@ -1852,7 +1905,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1852
1905
|
this.isLoading = true;
|
|
1853
1906
|
try {
|
|
1854
1907
|
const id = this.formStore.applicationData.processInstanceId;
|
|
1855
|
-
await this.api.setApplication(this.getConditionsData());
|
|
1908
|
+
if (!this.isPension) await this.api.setApplication(this.getConditionsData());
|
|
1856
1909
|
const result = ref();
|
|
1857
1910
|
result.value = await this.api.getCalculation(String(id));
|
|
1858
1911
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
@@ -1896,6 +1949,24 @@ export const useDataStore = defineStore('data', {
|
|
|
1896
1949
|
}
|
|
1897
1950
|
this.isLoading = false;
|
|
1898
1951
|
},
|
|
1952
|
+
async calculatePremium(data: any) {
|
|
1953
|
+
this.isLoading = true;
|
|
1954
|
+
try {
|
|
1955
|
+
const response = await this.api.calculatePremium(data);
|
|
1956
|
+
// @ts-ignore
|
|
1957
|
+
if (response && response.errMsg) {
|
|
1958
|
+
// @ts-ignore
|
|
1959
|
+
this.showToaster('error', response.errMsg, 1000);
|
|
1960
|
+
} else {
|
|
1961
|
+
this.showToaster('success', this.t('toaster.calculated'), 1000);
|
|
1962
|
+
}
|
|
1963
|
+
this.isLoading = false;
|
|
1964
|
+
return response;
|
|
1965
|
+
} catch (err) {
|
|
1966
|
+
ErrorHandler(err);
|
|
1967
|
+
}
|
|
1968
|
+
this.isLoading = false;
|
|
1969
|
+
},
|
|
1899
1970
|
async calculatePrice(taskId?: string) {
|
|
1900
1971
|
this.isLoading = true;
|
|
1901
1972
|
try {
|
|
@@ -1942,14 +2013,14 @@ export const useDataStore = defineStore('data', {
|
|
|
1942
2013
|
}
|
|
1943
2014
|
this.isLoading = false;
|
|
1944
2015
|
},
|
|
1945
|
-
async startApplication(member: Member) {
|
|
2016
|
+
async startApplication(member: Member, processCode?: number) {
|
|
1946
2017
|
if (!member.iin) return false;
|
|
1947
2018
|
try {
|
|
1948
2019
|
const data: StartApplicationType = {
|
|
1949
2020
|
clientId: member.id,
|
|
1950
2021
|
iin: member.iin.replace(/-/g, ''),
|
|
1951
2022
|
longName: member.longName ?? '',
|
|
1952
|
-
processCode: Number(this.processCode),
|
|
2023
|
+
processCode: processCode ?? Number(this.processCode),
|
|
1953
2024
|
policyId: 0,
|
|
1954
2025
|
};
|
|
1955
2026
|
const response = await this.api.startApplication(data);
|
|
@@ -1963,7 +2034,7 @@ export const useDataStore = defineStore('data', {
|
|
|
1963
2034
|
this.isLoading = onlyGet;
|
|
1964
2035
|
try {
|
|
1965
2036
|
const applicationData = await this.api.getApplicationData(taskId);
|
|
1966
|
-
if (this.processCode !== applicationData.processCode) {
|
|
2037
|
+
if (this.processCode !== applicationData.processCode && !this.isPension) {
|
|
1967
2038
|
this.isLoading = false;
|
|
1968
2039
|
this.sendToParent(constants.postActions.toHomePage, this.t('toaster.noSuchProduct'));
|
|
1969
2040
|
return;
|
|
@@ -2061,6 +2132,10 @@ export const useDataStore = defineStore('data', {
|
|
|
2061
2132
|
});
|
|
2062
2133
|
}
|
|
2063
2134
|
|
|
2135
|
+
if (applicationData.slave) {
|
|
2136
|
+
insuredData.push(applicationData.slave.insuredApp[0]);
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2064
2139
|
if (insuredData && insuredData.length) {
|
|
2065
2140
|
insuredData.forEach((member, index) => {
|
|
2066
2141
|
const inStore = this.formStore.insuredForm.find(each => each.id == member.insisId);
|
|
@@ -2100,7 +2175,6 @@ export const useDataStore = defineStore('data', {
|
|
|
2100
2175
|
}
|
|
2101
2176
|
});
|
|
2102
2177
|
}
|
|
2103
|
-
|
|
2104
2178
|
await Promise.allSettled(
|
|
2105
2179
|
allMembers.map(async member => {
|
|
2106
2180
|
await this.getContragentById(member.insisId, member.key, false, member.index);
|
|
@@ -2213,6 +2287,9 @@ export const useDataStore = defineStore('data', {
|
|
|
2213
2287
|
});
|
|
2214
2288
|
this.formStore.productConditionsForm.riskGroup = riskGroup ? riskGroup : this.riskGroup.find(item => item.id == 1) ?? new Value();
|
|
2215
2289
|
}
|
|
2290
|
+
if (this.isPension && this.formStore.policyholderForm.bankInfo && this.formStore.policyholderForm.bankInfo.bik) {
|
|
2291
|
+
this.formStore.insuredForm[0].bankInfo = this.formStore.policyholderForm.bankInfo;
|
|
2292
|
+
}
|
|
2216
2293
|
} catch (err) {
|
|
2217
2294
|
ErrorHandler(err);
|
|
2218
2295
|
if (err instanceof AxiosError) {
|
|
@@ -2276,6 +2353,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2276
2353
|
break;
|
|
2277
2354
|
}
|
|
2278
2355
|
case constants.actions.reject:
|
|
2356
|
+
case constants.actions.cancel:
|
|
2279
2357
|
case constants.actions.return:
|
|
2280
2358
|
case constants.actions.signed:
|
|
2281
2359
|
case constants.actions.rejectclient:
|
|
@@ -2361,6 +2439,21 @@ export const useDataStore = defineStore('data', {
|
|
|
2361
2439
|
if (!!this.formStore.applicationData[whichMember].profession) this.formStore[whichForm].job = this.formStore.applicationData[whichMember].profession;
|
|
2362
2440
|
if (!!this.formStore.applicationData[whichMember].position) this.formStore[whichForm].jobPosition = this.formStore.applicationData[whichMember].position;
|
|
2363
2441
|
if (!!this.formStore.applicationData[whichMember].jobName) this.formStore[whichForm].jobPlace = this.formStore.applicationData[whichMember].jobName;
|
|
2442
|
+
if (typeof this.formStore.applicationData[whichMember].isDisability === 'boolean')
|
|
2443
|
+
this.formStore[whichForm].isDisability = this.formStore.applicationData[whichMember].isDisability;
|
|
2444
|
+
if (!!this.formStore.applicationData[whichMember].disabilityGroupId) {
|
|
2445
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember].disabilityGroupId);
|
|
2446
|
+
this.formStore[whichForm].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2447
|
+
}
|
|
2448
|
+
if (whichForm === this.formStore.policyholderFormKey && this.isPension && 'pensionApp' in this.formStore.applicationData && !!this.formStore.applicationData.pensionApp) {
|
|
2449
|
+
this.formStore[whichForm].bankInfo.iik = this.formStore.applicationData.pensionApp.account;
|
|
2450
|
+
this.formStore[whichForm].bankInfo.bik = this.formStore.applicationData.pensionApp.bankBik;
|
|
2451
|
+
const bank = this.banks.find(i => i.ids === this.formStore.applicationData.pensionApp.bankBin);
|
|
2452
|
+
const transferCompany = this.transferContractCompanies.find(i => i.nameRu === this.formStore.applicationData.pensionApp.transferContractCompany);
|
|
2453
|
+
this.formStore[whichForm].bankInfo.bankName = bank ? bank : new Value();
|
|
2454
|
+
this.formStore[whichForm].bankInfo.bin = bank ? String(bank.ids) : '';
|
|
2455
|
+
this.formStore.applicationData.pensionApp.transferContractCompany = transferCompany ? transferCompany : new Value();
|
|
2456
|
+
}
|
|
2364
2457
|
},
|
|
2365
2458
|
setMembersFieldIndex(whichForm: MultipleMember, whichMember: keyof typeof MemberAppCodes, index: number) {
|
|
2366
2459
|
if ('familyStatus' in this.formStore[whichForm][index]) {
|
|
@@ -2382,6 +2475,13 @@ export const useDataStore = defineStore('data', {
|
|
|
2382
2475
|
if ('jobPlace' in this.formStore[whichForm][index] && !!this.formStore.applicationData[whichMember][index].jobName) {
|
|
2383
2476
|
this.formStore[whichForm][index].jobPlace = this.formStore.applicationData[whichMember][index].jobName;
|
|
2384
2477
|
}
|
|
2478
|
+
if (typeof this.formStore.applicationData[whichMember][index].isDisability === 'boolean') {
|
|
2479
|
+
this.formStore[whichForm][index].isDisability = this.formStore.applicationData[whichMember][index].isDisability;
|
|
2480
|
+
}
|
|
2481
|
+
if (!!this.formStore.applicationData[whichMember][index].disabilityGroupId) {
|
|
2482
|
+
const disabilityGroup = this.disabilityGroups.find(i => i.id === this.formStore.applicationData[whichMember][index].disabilityGroupId);
|
|
2483
|
+
this.formStore[whichForm][index].disabilityGroup = disabilityGroup ? disabilityGroup : new Value();
|
|
2484
|
+
}
|
|
2385
2485
|
},
|
|
2386
2486
|
async signDocument(type: string = 'electronic') {
|
|
2387
2487
|
try {
|
|
@@ -2398,13 +2498,39 @@ export const useDataStore = defineStore('data', {
|
|
|
2398
2498
|
format: 'pdf',
|
|
2399
2499
|
},
|
|
2400
2500
|
];
|
|
2401
|
-
|
|
2501
|
+
case 'AttachAppContractForm':
|
|
2502
|
+
if (type === 'qrXml') {
|
|
2503
|
+
return [
|
|
2504
|
+
{
|
|
2505
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2506
|
+
name: 'PAEnpf_Agreement',
|
|
2507
|
+
format: 'xml',
|
|
2508
|
+
},
|
|
2509
|
+
];
|
|
2510
|
+
} else {
|
|
2511
|
+
return [
|
|
2512
|
+
{
|
|
2513
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2514
|
+
name: this.processCode == 1 ? 'PA_Statement' : 'PA_RefundStatement',
|
|
2515
|
+
format: 'pdf',
|
|
2516
|
+
},
|
|
2517
|
+
{
|
|
2518
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2519
|
+
name: 'Agreement',
|
|
2520
|
+
format: 'pdf',
|
|
2521
|
+
},
|
|
2522
|
+
];
|
|
2523
|
+
}
|
|
2524
|
+
case 'ContractSignedByAuthorizedPerson':
|
|
2402
2525
|
return [
|
|
2403
2526
|
{
|
|
2404
2527
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2405
|
-
name: '
|
|
2528
|
+
name: 'PA_Contract',
|
|
2406
2529
|
format: 'pdf',
|
|
2407
2530
|
},
|
|
2531
|
+
];
|
|
2532
|
+
default:
|
|
2533
|
+
return [
|
|
2408
2534
|
{
|
|
2409
2535
|
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2410
2536
|
name: 'Statement',
|
|
@@ -2417,9 +2543,78 @@ export const useDataStore = defineStore('data', {
|
|
|
2417
2543
|
if (type === 'qr') {
|
|
2418
2544
|
const groupId = await this.api.signQR(data);
|
|
2419
2545
|
return groupId;
|
|
2546
|
+
} else if (type === 'qrXml') {
|
|
2547
|
+
const signData = await this.api.signXml(data);
|
|
2548
|
+
return signData;
|
|
2549
|
+
} else if (type === 'signature') {
|
|
2550
|
+
const ncaLayerClient = new NCALayerClient();
|
|
2551
|
+
let activeTokens;
|
|
2552
|
+
try {
|
|
2553
|
+
await ncaLayerClient.connect();
|
|
2554
|
+
activeTokens = await ncaLayerClient.getActiveTokens();
|
|
2555
|
+
const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
|
|
2556
|
+
if (this.formStore.applicationData.statusCode === 'ContractSignedByAuthorizedPerson') {
|
|
2557
|
+
const document = await this.generatePDFDocument('PAEnpf_Agreement', '40', 'pdf');
|
|
2558
|
+
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2559
|
+
const formData = new FormData();
|
|
2560
|
+
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2561
|
+
formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2562
|
+
formData.append('name', 'PAEnpf_Agreement');
|
|
2563
|
+
formData.append('format', 'pdf');
|
|
2564
|
+
try {
|
|
2565
|
+
await this.api.uploadDigitalCertifijcate(formData);
|
|
2566
|
+
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2567
|
+
} catch (e) {
|
|
2568
|
+
this.showToaster('error', String(e));
|
|
2569
|
+
return;
|
|
2570
|
+
}
|
|
2571
|
+
} else if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
|
|
2572
|
+
const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
|
|
2573
|
+
const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
|
|
2574
|
+
const formData = new FormData();
|
|
2575
|
+
formData.append('base64EncodedSignature', base64EncodedSignature);
|
|
2576
|
+
formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2577
|
+
formData.append('name', 'PA_Contract');
|
|
2578
|
+
formData.append('format', 'pdf');
|
|
2579
|
+
try {
|
|
2580
|
+
await this.api.uploadDigitalCertifijcate(formData);
|
|
2581
|
+
await this.handleTask('accept', String(this.formStore.applicationTaskId));
|
|
2582
|
+
} catch (e) {
|
|
2583
|
+
this.showToaster('error', String(e));
|
|
2584
|
+
return;
|
|
2585
|
+
}
|
|
2586
|
+
} else {
|
|
2587
|
+
const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
|
|
2588
|
+
const wnd = window.open('about:blank', '', '_blank');
|
|
2589
|
+
wnd?.document.write(agreementXml as any);
|
|
2590
|
+
const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
|
|
2591
|
+
const document = {
|
|
2592
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2593
|
+
name: 'PAEnpf_Agreement',
|
|
2594
|
+
format: 'xml',
|
|
2595
|
+
};
|
|
2596
|
+
const signData = await this.api.signXml([document]);
|
|
2597
|
+
const data = new FormData();
|
|
2598
|
+
data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
|
|
2599
|
+
data.append('xmlData', signedAgreement);
|
|
2600
|
+
data.append('name', 'PAEnpf_Agreement');
|
|
2601
|
+
data.append('format', 'xml');
|
|
2602
|
+
data.append('EdsXmlId', signData.data);
|
|
2603
|
+
await this.api.uploadXml(data);
|
|
2604
|
+
await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
|
|
2605
|
+
}
|
|
2606
|
+
} catch (error) {
|
|
2607
|
+
this.showToaster('error', String(error));
|
|
2608
|
+
return;
|
|
2609
|
+
}
|
|
2420
2610
|
} else {
|
|
2421
|
-
|
|
2422
|
-
|
|
2611
|
+
if (this.processCode === 1 || this.processCode === 2 || this.processCode === 3) {
|
|
2612
|
+
const result = await this.api.signBts(data);
|
|
2613
|
+
if (result.code === 0) this.formStore.signUrls = result.data;
|
|
2614
|
+
} else {
|
|
2615
|
+
const result = await this.api.signDocument(data);
|
|
2616
|
+
this.formStore.signUrls = result;
|
|
2617
|
+
}
|
|
2423
2618
|
return this.formStore.signUrls;
|
|
2424
2619
|
}
|
|
2425
2620
|
} catch (err) {
|
|
@@ -2453,7 +2648,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2453
2648
|
link.setAttribute('download', 'Анкета Застрахованного.docx');
|
|
2454
2649
|
break;
|
|
2455
2650
|
case constants.documentTypes.invoicePayment:
|
|
2456
|
-
link.setAttribute('download', 'Счет на
|
|
2651
|
+
link.setAttribute('download', 'Счет на оплату');
|
|
2457
2652
|
break;
|
|
2458
2653
|
}
|
|
2459
2654
|
document.body.appendChild(link);
|
|
@@ -2508,6 +2703,35 @@ export const useDataStore = defineStore('data', {
|
|
|
2508
2703
|
}
|
|
2509
2704
|
this.isButtonsLoading = false;
|
|
2510
2705
|
},
|
|
2706
|
+
async generatePDFDocument(name: string, code: string, format: 'pdf' | 'doc' = 'pdf', open: boolean = false) {
|
|
2707
|
+
try {
|
|
2708
|
+
this.isButtonsLoading = true;
|
|
2709
|
+
this.formStore.needToScanSignedContract = true;
|
|
2710
|
+
const data: any = {
|
|
2711
|
+
processInstanceId: String(this.formStore.applicationData.processInstanceId),
|
|
2712
|
+
name: name,
|
|
2713
|
+
format: format,
|
|
2714
|
+
};
|
|
2715
|
+
const response: any = await this.api.generatePdfDocument(data);
|
|
2716
|
+
const blob = new Blob([response], {
|
|
2717
|
+
type: format === 'pdf' ? `application/pdf` : `application/vnd.openxmlformats-officedocument.wordprocessingml.document`,
|
|
2718
|
+
});
|
|
2719
|
+
const url = window.URL.createObjectURL(blob);
|
|
2720
|
+
const link = document.createElement('a');
|
|
2721
|
+
link.href = url;
|
|
2722
|
+
link.setAttribute('download', this.formStore.regNumber + ` ${this.dicFileTypeList.find((i: Value) => i.code == code)?.nameRu}`);
|
|
2723
|
+
document.body.appendChild(link);
|
|
2724
|
+
link.click();
|
|
2725
|
+
if (open) {
|
|
2726
|
+
window.open(url, '_blank', `right=100`);
|
|
2727
|
+
}
|
|
2728
|
+
return response;
|
|
2729
|
+
} catch (err) {
|
|
2730
|
+
ErrorHandler(err);
|
|
2731
|
+
} finally {
|
|
2732
|
+
this.isButtonsLoading = false;
|
|
2733
|
+
}
|
|
2734
|
+
},
|
|
2511
2735
|
async registerNumber() {
|
|
2512
2736
|
try {
|
|
2513
2737
|
if (!this.formStore.finCenterData.date) return;
|
|
@@ -2770,7 +2994,7 @@ export const useDataStore = defineStore('data', {
|
|
|
2770
2994
|
this.isLoading = true;
|
|
2771
2995
|
const areMembersValid = await this.validateAllMembers(taskId);
|
|
2772
2996
|
if (areMembersValid) {
|
|
2773
|
-
if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
|
|
2997
|
+
if ((!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) || this.isPension) {
|
|
2774
2998
|
if (this.controls.hasAnketa) {
|
|
2775
2999
|
const hasCritical =
|
|
2776
3000
|
this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName.match(new RegExp('Критическое заболевание Застрахованного', 'i'))) ?? null;
|
|
@@ -3483,6 +3707,18 @@ export const useDataStore = defineStore('data', {
|
|
|
3483
3707
|
|
|
3484
3708
|
return true;
|
|
3485
3709
|
},
|
|
3710
|
+
async getVariableData(processCode: number) {
|
|
3711
|
+
try {
|
|
3712
|
+
const response = await this.api.getVariableData(0, processCode);
|
|
3713
|
+
if (response) {
|
|
3714
|
+
return response.data.slice(0, 10);
|
|
3715
|
+
}
|
|
3716
|
+
return null;
|
|
3717
|
+
} catch (err) {
|
|
3718
|
+
ErrorHandler(err);
|
|
3719
|
+
return null;
|
|
3720
|
+
}
|
|
3721
|
+
},
|
|
3486
3722
|
async checkIIN(iin: string) {
|
|
3487
3723
|
try {
|
|
3488
3724
|
const response = await this.api.checkIIN(iin);
|
|
@@ -3508,6 +3744,14 @@ export const useDataStore = defineStore('data', {
|
|
|
3508
3744
|
return ErrorHandler(err);
|
|
3509
3745
|
}
|
|
3510
3746
|
},
|
|
3747
|
+
async getDocument(id: string) {
|
|
3748
|
+
try {
|
|
3749
|
+
const response = await this.api.getDocument(id);
|
|
3750
|
+
return response;
|
|
3751
|
+
} catch (err) {
|
|
3752
|
+
return ErrorHandler(err);
|
|
3753
|
+
}
|
|
3754
|
+
},
|
|
3511
3755
|
async generateShortLink(url: string) {
|
|
3512
3756
|
try {
|
|
3513
3757
|
const response = await this.api.generateShortLink({
|
|
@@ -3520,7 +3764,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3520
3764
|
}
|
|
3521
3765
|
},
|
|
3522
3766
|
hasJobSection(whichForm: keyof typeof StoreMembers) {
|
|
3523
|
-
if (this.isLifetrip) return false;
|
|
3767
|
+
if (this.isLifetrip || this.isPension) return false;
|
|
3524
3768
|
switch (whichForm) {
|
|
3525
3769
|
case this.formStore.beneficiaryFormKey:
|
|
3526
3770
|
case this.formStore.beneficialOwnerFormKey:
|
|
@@ -3531,7 +3775,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3531
3775
|
}
|
|
3532
3776
|
},
|
|
3533
3777
|
hasBirthSection(whichForm: keyof typeof StoreMembers) {
|
|
3534
|
-
if (this.isGons) return false;
|
|
3778
|
+
if (this.isGons || this.isPension) return false;
|
|
3535
3779
|
switch (whichForm) {
|
|
3536
3780
|
case this.formStore.beneficiaryFormKey:
|
|
3537
3781
|
return false;
|
|
@@ -3552,12 +3796,41 @@ export const useDataStore = defineStore('data', {
|
|
|
3552
3796
|
}
|
|
3553
3797
|
},
|
|
3554
3798
|
hasContactSection(whichForm: keyof typeof StoreMembers) {
|
|
3555
|
-
if (this.isGons) return false;
|
|
3799
|
+
if (this.isGons || this.isPension) return false;
|
|
3556
3800
|
switch (whichForm) {
|
|
3557
3801
|
default:
|
|
3558
3802
|
return true;
|
|
3559
3803
|
}
|
|
3560
3804
|
},
|
|
3805
|
+
hasBankSection(whichForm: keyof typeof StoreMembers) {
|
|
3806
|
+
if (!this.isPension) return false;
|
|
3807
|
+
switch (whichForm) {
|
|
3808
|
+
case 'beneficiaryForm':
|
|
3809
|
+
return false;
|
|
3810
|
+
default:
|
|
3811
|
+
return true;
|
|
3812
|
+
}
|
|
3813
|
+
},
|
|
3814
|
+
hasAdditionalDocumentsSection(whichForm: keyof typeof StoreMembers) {
|
|
3815
|
+
if (!this.isPension) return false;
|
|
3816
|
+
switch (whichForm) {
|
|
3817
|
+
case 'beneficiaryForm':
|
|
3818
|
+
return false;
|
|
3819
|
+
default:
|
|
3820
|
+
return true;
|
|
3821
|
+
}
|
|
3822
|
+
},
|
|
3823
|
+
hasFamilyTiesSection(whichForm: keyof typeof StoreMembers) {
|
|
3824
|
+
if (!this.isPension) return false;
|
|
3825
|
+
switch (whichForm) {
|
|
3826
|
+
case 'policyholderForm':
|
|
3827
|
+
return false;
|
|
3828
|
+
case 'beneficiaryForm':
|
|
3829
|
+
return true;
|
|
3830
|
+
default:
|
|
3831
|
+
return false;
|
|
3832
|
+
}
|
|
3833
|
+
},
|
|
3561
3834
|
hasPercentageOfPayoutAmount() {
|
|
3562
3835
|
return true;
|
|
3563
3836
|
},
|
|
@@ -3575,6 +3848,7 @@ export const useDataStore = defineStore('data', {
|
|
|
3575
3848
|
this.isHeadManager() ||
|
|
3576
3849
|
this.isServiceManager() ||
|
|
3577
3850
|
this.isUnderwriter() ||
|
|
3851
|
+
this.isActuary() ||
|
|
3578
3852
|
this.isAdmin() ||
|
|
3579
3853
|
this.isCompliance() ||
|
|
3580
3854
|
this.isAnalyst() ||
|
|
@@ -3583,7 +3857,13 @@ export const useDataStore = defineStore('data', {
|
|
|
3583
3857
|
this.isSupervisor() ||
|
|
3584
3858
|
this.isSupport() ||
|
|
3585
3859
|
this.isDrn() ||
|
|
3586
|
-
this.
|
|
3860
|
+
this.isUrp() ||
|
|
3861
|
+
this.isUsns() ||
|
|
3862
|
+
this.isAccountant() ||
|
|
3863
|
+
this.isBranchDirector() ||
|
|
3864
|
+
this.isUSNSACCINS() ||
|
|
3865
|
+
this.isDsuio() ||
|
|
3866
|
+
this.isAdjuster(),
|
|
3587
3867
|
};
|
|
3588
3868
|
},
|
|
3589
3869
|
},
|
package/store/rules.ts
CHANGED
|
@@ -8,6 +8,7 @@ export const rules = {
|
|
|
8
8
|
recalculationMultiplyBetween: [(v: any) => (v !== null && v !== '' && v >= 100 && v <= 200) || t('toaster.recalculationMultiplyBetween', { floor: '100', ceil: '200' })],
|
|
9
9
|
recalculationAdditive: [(v: any) => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
|
|
10
10
|
required: [(v: any) => !!v || t('rules.required')],
|
|
11
|
+
notZero: [(v: any) => Number(v) !== 0 || 'Не может быть равно нулю'],
|
|
11
12
|
iik: [(v: any) => v.length === 20 || t('rules.iik')],
|
|
12
13
|
agentCommission: [(v: any) => v <= 50 || t('rules.agentCommission')],
|
|
13
14
|
objectRequired: [
|
|
@@ -236,6 +237,18 @@ export const rules = {
|
|
|
236
237
|
}
|
|
237
238
|
},
|
|
238
239
|
],
|
|
240
|
+
checkDate: [
|
|
241
|
+
(v: any) => {
|
|
242
|
+
const today = new Date();
|
|
243
|
+
const yourDate = new Date(formatDate(v)!);
|
|
244
|
+
if (yourDate.toDateString() === today.toDateString()) {
|
|
245
|
+
return true;
|
|
246
|
+
} else {
|
|
247
|
+
return t('rules.checkDate');
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
fileRequired: [(v: any) => !!v || t('rules.fileRequired'), (v: any) => (v && v.length > 0) || t('rules.fileRequired')],
|
|
239
252
|
guaranteedPeriodLimit(v: any, termAnnuityPayments: any) {
|
|
240
253
|
if (Number(v) > Number(termAnnuityPayments)) {
|
|
241
254
|
return t('rules.guaranteedPeriodLimit');
|