hl-core 0.0.7 → 0.0.8

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.
Files changed (62) hide show
  1. package/.prettierrc +2 -1
  2. package/api/index.ts +580 -0
  3. package/api/interceptors.ts +38 -0
  4. package/components/Button/Btn.vue +57 -0
  5. package/components/Button/BtnIcon.vue +47 -0
  6. package/components/Button/ScrollButtons.vue +6 -0
  7. package/components/Button/SortArrow.vue +21 -0
  8. package/components/Complex/Content.vue +5 -0
  9. package/components/Complex/ContentBlock.vue +5 -0
  10. package/components/Complex/Page.vue +43 -0
  11. package/components/Dialog/Dialog.vue +76 -0
  12. package/components/Dialog/FamilyDialog.vue +39 -0
  13. package/components/Form/FormBlock.vue +114 -0
  14. package/components/Form/FormSection.vue +18 -0
  15. package/components/Form/FormTextSection.vue +20 -0
  16. package/components/Form/FormToggle.vue +52 -0
  17. package/components/Form/ProductConditionsBlock.vue +68 -0
  18. package/components/Input/EmptyFormField.vue +5 -0
  19. package/components/Input/FileInput.vue +71 -0
  20. package/components/Input/FormInput.vue +171 -0
  21. package/components/Input/PanelInput.vue +133 -0
  22. package/components/Input/RoundedInput.vue +143 -0
  23. package/components/Layout/Drawer.vue +44 -0
  24. package/components/Layout/Header.vue +48 -0
  25. package/components/Layout/Loader.vue +35 -0
  26. package/components/Layout/SettingsPanel.vue +48 -0
  27. package/components/List/ListEmpty.vue +22 -0
  28. package/components/Menu/MenuNav.vue +108 -0
  29. package/components/Menu/MenuNavItem.vue +37 -0
  30. package/components/Pages/Anketa.vue +333 -0
  31. package/components/Pages/Auth.vue +91 -0
  32. package/components/Pages/Documents.vue +108 -0
  33. package/components/Pages/MemberForm.vue +1138 -0
  34. package/components/Pages/ProductAgreement.vue +18 -0
  35. package/components/Pages/ProductConditions.vue +349 -0
  36. package/components/Panel/PanelItem.vue +5 -0
  37. package/components/Panel/PanelSelectItem.vue +20 -0
  38. package/components/Transitions/FadeTransition.vue +5 -0
  39. package/composables/axios.ts +11 -0
  40. package/composables/classes.ts +1129 -0
  41. package/composables/constants.ts +65 -0
  42. package/composables/index.ts +168 -2
  43. package/composables/styles.ts +41 -8
  44. package/layouts/clear.vue +3 -0
  45. package/layouts/default.vue +75 -0
  46. package/layouts/full.vue +6 -0
  47. package/nuxt.config.ts +27 -5
  48. package/package.json +23 -11
  49. package/pages/500.vue +85 -0
  50. package/plugins/helperFunctionsPlugins.ts +14 -2
  51. package/plugins/storePlugin.ts +6 -7
  52. package/plugins/vuetifyPlugin.ts +10 -0
  53. package/store/data.store.js +2460 -6
  54. package/store/form.store.ts +8 -0
  55. package/store/member.store.ts +291 -0
  56. package/store/messages.ts +156 -37
  57. package/store/rules.js +26 -28
  58. package/tailwind.config.js +10 -0
  59. package/types/index.ts +250 -0
  60. package/app.vue +0 -3
  61. package/components/Button/GreenBtn.vue +0 -33
  62. package/store/app.store.js +0 -12
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <aside class="w-full lg:w-1/4 bg-white flex flex-col border-r-2 relative">
3
+ <base-header
4
+ class="justify-center"
5
+ :title="title"
6
+ :has-back="hasBack"
7
+ :back-icon="backIcon"
8
+ :has-more="hasMore"
9
+ :hide-more-on-lg="hideMoreOnLg"
10
+ :more-icon="moreIcon"
11
+ @onBack="$emit('onBack')"
12
+ @onMore="$emit('onMore')"
13
+ ></base-header>
14
+ <slot key="slot-content" name="content"></slot>
15
+ <section key="main" :class="[$libStyles.flexColNav]">
16
+ <slot name="start"></slot>
17
+ <base-fade-transition>
18
+ <div v-if="$dataStore.menuItems && $dataStore.menuItems.length" class="flex flex-col gap-[10px]">
19
+ <div v-for="(item, index) of $dataStore.menuItems.filter(i => (typeof i.show === 'boolean' ? i.show : true))" :key="index">
20
+ <base-menu-nav-item
21
+ :menu-item="item"
22
+ :selected="!!selected.title && !!item.title && selected.title === item.title"
23
+ :disabled="typeof item.disabled === 'boolean' ? item.disabled : false"
24
+ @click.left="pickItem(item)"
25
+ @click.middle="openTab(item)"
26
+ >
27
+ </base-menu-nav-item>
28
+ <hr v-if="item.hasLine" class="mt-[10px]" />
29
+ </div>
30
+ </div>
31
+ </base-fade-transition>
32
+ <slot name="end"></slot>
33
+ <slot name="actions"></slot>
34
+ <base-fade-transition>
35
+ <div v-if="$dataStore.buttons && $dataStore.buttons.length" class="flex flex-col gap-[10px] justify-self-end absolute bottom-5 lg:bottom-[30%] w-full pr-4">
36
+ <div v-for="(item, index) of $dataStore.buttons" :key="index">
37
+ <transition enter-active-class="animate__animated animate__fadeIn animate__faster" leave-active-class="animate__animated animate__fadeOut animate__faster">
38
+ <base-btn v-if="'show' in item ? item.show : true" :text="item.title!" :btn="item.color" :disabled="item.disabled" @click="item.action"> </base-btn>
39
+ </transition>
40
+ </div></div
41
+ ></base-fade-transition>
42
+ </section>
43
+ </aside>
44
+ </template>
45
+
46
+ <script lang="ts">
47
+ import { MenuItem } from '@/composables/classes';
48
+ import { RouteLocationNormalized } from 'vue-router';
49
+
50
+ export default defineComponent({
51
+ props: {
52
+ title: {
53
+ type: String,
54
+ default: 'Заголовок',
55
+ },
56
+ selected: {
57
+ type: Object as PropType<MenuItem>,
58
+ default: new MenuItem(),
59
+ },
60
+ hasBack: {
61
+ type: Boolean,
62
+ default: false,
63
+ },
64
+ backIcon: {
65
+ type: String,
66
+ default: 'mdi-arrow-left',
67
+ },
68
+ hasMore: {
69
+ type: Boolean,
70
+ default: false,
71
+ },
72
+ hideMoreOnLg: {
73
+ type: Boolean,
74
+ default: false,
75
+ },
76
+ moreIcon: {
77
+ type: String,
78
+ default: 'mdi-cog-outline',
79
+ },
80
+ },
81
+ emits: ['onLink', 'onBack', 'onMore', 'clicked'],
82
+ setup(props, { emit }) {
83
+ const dataStore = useDataStore();
84
+ const router = useRouter();
85
+
86
+ const pickItem = async (item: MenuItem) => {
87
+ if (item.title !== dataStore.menu.selectedItem.title && (typeof item.disabled === 'boolean' ? !item.disabled : true)) {
88
+ if (typeof item.link === 'object') {
89
+ if (item.link && 'name' in item.link) {
90
+ await router.push(item.link as RouteLocationNormalized);
91
+ } else {
92
+ dataStore.showToaster('warning', 'Отсутствует ссылка для перехода');
93
+ }
94
+ } else {
95
+ emit('onLink', item);
96
+ }
97
+ }
98
+ };
99
+ const openTab = (item: MenuItem) => {
100
+ if (item.url) {
101
+ window.open(item.url, '_blank', 'noreferrer');
102
+ }
103
+ };
104
+
105
+ return { pickItem, openTab };
106
+ },
107
+ });
108
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ selected ? $libStyles.blueBg : $libStyles.blueBgLight,
5
+ selected ? $libStyles.whiteText : $libStyles.blackText,
6
+ $libStyles.rounded,
7
+ $libStyles.textSimple,
8
+ disabled ? 'cursor-not-allowed opacity-50' : '',
9
+ ]"
10
+ class="h-[60px] flex items-center justify-between hover:bg-[#A0B3D8] hover:!text-white pl-4 cursor-pointer transition-all"
11
+ >
12
+ <span>{{ menuItem.title }}</span>
13
+ <i v-if="menuItem.icon" class="mdi text-xl pr-4" :class="[menuItem.icon]"></i>
14
+ <v-tooltip v-if="menuItem.description" activator="parent" location="bottom">{{ menuItem.description }}</v-tooltip>
15
+ </div>
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ import { MenuItem } from '@/composables/classes';
20
+
21
+ export default defineComponent({
22
+ props: {
23
+ menuItem: {
24
+ type: Object as PropType<MenuItem>,
25
+ default: new MenuItem(),
26
+ },
27
+ selected: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ disabled: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ },
36
+ });
37
+ </script>
@@ -0,0 +1,333 @@
1
+ <template>
2
+ <base-fade-transition>
3
+ <section v-if="firstQuestionList && firstQuestionList.length && !firstPanel && !secondPanel" class="flex flex-col">
4
+ <section :class="[$libStyles.blueBgLight, $libStyles.rounded]" class="mx-[10px] my-[14px] p-4 flex flex-col gap-4">
5
+ <base-form-toggle v-model="answerToAll" :title="$t('questionnaireType.answerAllNo')" :disabled="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()" :has-border="false" @clicked="handleToggler"></base-form-toggle>
6
+ </section>
7
+ <v-form ref="vForm" class="max-h-[70vh] overflow-y-scroll" @submit="submitForm">
8
+ <section
9
+ v-if="firstQuestionList.filter(i => i.first.definedAnswers === 'N').length"
10
+ :class="[$libStyles.blueBgLight, $libStyles.rounded]"
11
+ class="mx-[10px] p-4 flex flex-col gap-4"
12
+ >
13
+ <base-form-input
14
+ v-for="(question, index) in firstQuestionList.filter(i => i.first.definedAnswers === 'N')"
15
+ :key="index"
16
+ v-model="question.first.answerText"
17
+ :label="question.first.name"
18
+ :maska="$maska.threeDigit"
19
+ :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
20
+ :rules="$rules.required"
21
+ ></base-form-input>
22
+ </section>
23
+ <section
24
+ v-if="firstQuestionList.filter(i => i.first.definedAnswers === 'Y').length"
25
+ :class="[$libStyles.blueBgLight, $libStyles.rounded]"
26
+ class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4"
27
+ >
28
+ <base-form-text-section v-for="(question, index) in firstQuestionList.filter(i => i.first.definedAnswers === 'Y')" :key="index">
29
+ <base-fade-transition>
30
+ <div
31
+ v-if="question.first.answerName === 'Да' && secondQuestionList"
32
+ :class="[$libStyles.greenBg, $libStyles.whiteText, $libStyles.textSimple]"
33
+ class="rounded-t-lg pl-6 py-1 cursor-pointer"
34
+ @click="openFirstPanel(question)"
35
+ >
36
+ {{ $t('questionnaireType.pleaseAnswer').replace('{text}', `${secondQuestionList.length}`) }}
37
+ </div>
38
+ </base-fade-transition>
39
+ <span :class="[$libStyles.textTitle]" class="border-b-[1px] border-b-[#F3F6FC] p-6 flex items-center justify-between">
40
+ {{ question.first.name }}
41
+ <base-fade-transition>
42
+ <i v-if="question.first.answerName === 'Да' && secondQuestionList" class="mdi mdi-chevron-right text-2xl cursor-pointer" @click="openFirstPanel(question)"></i>
43
+ </base-fade-transition>
44
+ </span>
45
+ <div class="flex items-center justify-start gap-5 px-4 pt-4" :class="[$libStyles.textSimple]">
46
+ <v-radio-group
47
+ v-model="question.first.answerName"
48
+ class="anketa-radio"
49
+ :true-icon="`mdi-radiobox-marked ${$libStyles.greenText}`"
50
+ false-icon="mdi-radiobox-blank text-[#636363]"
51
+ :rules="$rules.required"
52
+ :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
53
+ inline
54
+ >
55
+ <v-radio label="Да" value="Да"></v-radio>
56
+ <v-radio label="Нет" value="Нет"></v-radio>
57
+ </v-radio-group>
58
+ </div>
59
+ </base-form-text-section>
60
+ </section>
61
+ </v-form>
62
+ <base-btn class="my-[14px] self-center" :loading="isButtonLoading" :disabled="formStore.isDisabled[whichSurvey]" @click="submitForm" :text="$t('buttons.save')"></base-btn>
63
+ </section>
64
+ <section
65
+ ref="firstPanelSection"
66
+ v-if="secondQuestionList && secondQuestionList.length && firstPanel"
67
+ class="flex flex-col px-[10px] py-[14px]"
68
+ :class="[$libStyles.scrollPage]"
69
+ >
70
+ <v-btn
71
+ icon="mdi mdi-close"
72
+ variant="text"
73
+ size="large"
74
+ @click="
75
+ firstPanel = false;
76
+ secondPanel = false;
77
+ "
78
+ ></v-btn>
79
+ <section v-if="currentQuestion" :class="[$libStyles.blueBgLight, $libStyles.rounded]" class="mx-[10px] my-[14px] p-4 flex flex-col gap-4">
80
+ <base-form-text-section v-for="question in currentQuestion.second" :title="question.name" :key="question.name">
81
+ <base-form-input
82
+ v-if="question.definedAnswers === 'N'"
83
+ v-model="question.answerText"
84
+ class="border-t-[1px] border-t-[#F3F6FC]"
85
+ placeholder="Введите текст"
86
+ ></base-form-input>
87
+ <span v-else class="flex items-center justify-between p-4 cursor-pointer" :class="[$libStyles.textTitle, $libStyles.greenText]" @click="openSecondPanel(question)">
88
+ {{ question.answerName ? question.answerName : 'Выбрать вариант ответа' }}
89
+ <i class="mdi mdi-chevron-right text-[28px]"></i>
90
+ </span>
91
+ </base-form-text-section>
92
+ </section>
93
+ </section>
94
+ </base-fade-transition>
95
+ <Teleport v-if="secondPanel" to="#panel-actions">
96
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
97
+ <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
98
+ <div v-if="$dataStore.questionRefs && $dataStore.questionRefs.length && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
99
+ <base-panel-select-item
100
+ v-for="(item, index) of $dataStore.questionRefs.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
101
+ :key="index"
102
+ :text="`${item.nameRu}`"
103
+ :selected="currentSecond!.answerId === item.ids"
104
+ @click="closeSecondPanel(item)"
105
+ ></base-panel-select-item>
106
+ </div>
107
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
108
+ </div>
109
+ </Teleport>
110
+ <base-scroll-buttons @up="scrollForm('up')" @down="scrollForm('down')" />
111
+ </template>
112
+
113
+ <script lang="ts">
114
+ import { Value } from '@/composables/classes';
115
+
116
+ export default defineComponent({
117
+ setup() {
118
+ const route = useRoute();
119
+ const router = useRouter();
120
+ const formStore = useFormStore();
121
+ const dataStore = useDataStore();
122
+ const vForm = ref<any>();
123
+ const firstPanelSection = ref<any>();
124
+ const isButtonLoading = ref<boolean>(false);
125
+ const answerToAll = ref<boolean>(false);
126
+ const firstPanel = ref<boolean>(false);
127
+ const secondPanel = ref<boolean>(false);
128
+ const surveyType = ref<'health' | 'critical'>('tab' in route.query && route.query.tab === 'criticalBase' ? 'critical' : 'health');
129
+ const whichSurvey = computed(() => (surveyType.value === 'health' ? 'surveyByHealthBase' : 'surveyByCriticalBase'));
130
+ const firstQuestionList = ref<AnketaBody[]>();
131
+ const secondQuestionList = ref<AnketaSecond[]>([]);
132
+ const currentQuestion = ref<AnketaBody>();
133
+ const currentSecond = ref<AnketaSecond>();
134
+ const isPanelLoading = ref<boolean>(false);
135
+ const searchQuery = ref<string>('');
136
+
137
+ const scrollForm = (direction: 'up' | 'down') => {
138
+ const scrollObject = { top: direction === 'up' ? 0 : screen.height * 10, behavior: 'smooth' };
139
+ if (firstPanel.value) {
140
+ firstPanelSection.value.scrollTo(scrollObject);
141
+ } else {
142
+ vForm.value.scrollTo(scrollObject);
143
+ }
144
+ };
145
+
146
+ const submitForm = async () => {
147
+ await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
148
+ if (v.valid) {
149
+ isButtonLoading.value = true;
150
+ formStore[whichSurvey.value]!.body.forEach((survey: AnketaBody) => {
151
+ if (survey.first.answerText === 'Нет') {
152
+ survey.second = [];
153
+ }
154
+ });
155
+ formStore[whichSurvey.value]!.type = surveyType.value;
156
+ const anketaToken = await dataStore.setSurvey(formStore[whichSurvey.value]);
157
+ formStore[whichSurvey.value]!.id = anketaToken;
158
+ isButtonLoading.value = false;
159
+ } else {
160
+ const errors = document.querySelector('.v-input--error');
161
+ if (errors) {
162
+ const errorText = errors.querySelector('.v-label.v-field-label');
163
+ if (errorText) {
164
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
165
+ } else {
166
+ const errorFieldText = errors.parentElement?.parentElement?.children[0].innerHTML;
167
+ if (errorFieldText) {
168
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText));
169
+ }
170
+ }
171
+ errors.scrollIntoView({
172
+ behavior: 'smooth',
173
+ block: 'center',
174
+ inline: 'nearest',
175
+ });
176
+ }
177
+ }
178
+ });
179
+ };
180
+
181
+ const openFirstPanel = async (question: AnketaBody) => {
182
+ currentQuestion.value = question;
183
+ formStore[whichSurvey.value]!.body.forEach((question_object: AnketaBody) => {
184
+ if ((question_object.first.id === question.first.id && question_object.second && !question_object.second.length) || question_object.second == null) {
185
+ question_object.second = JSON.parse(JSON.stringify(formStore[surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond']));
186
+ }
187
+ });
188
+ firstPanel.value = true;
189
+ secondPanel.value = false;
190
+ };
191
+
192
+ const openSecondPanel = async (question: AnketaSecond) => {
193
+ dataStore.questionRefs = [];
194
+ currentSecond.value = question;
195
+ isPanelLoading.value = true;
196
+ await dataStore.getQuestionRefs(question.id);
197
+ secondPanel.value = true;
198
+ dataStore.panelAction = null;
199
+ dataStore.panel.open = true;
200
+ dataStore.panel.title = question.name;
201
+ isPanelLoading.value = false;
202
+ };
203
+
204
+ const closeSecondPanel = (selectedAnswer: Value) => {
205
+ if (selectedAnswer.ids && currentSecond.value) {
206
+ currentSecond.value.answerId = selectedAnswer.ids as string;
207
+ currentSecond.value.answerName = selectedAnswer.nameRu as string;
208
+ }
209
+ secondPanel.value = false;
210
+ dataStore.panelAction = null;
211
+ dataStore.panel.open = false;
212
+ dataStore.questionRefs = [];
213
+ };
214
+
215
+ const getDefinedAnswerId = async (id: string, value: any, index: number) => {
216
+ // @ts-ignore
217
+ await dataStore.definedAnswers(id, whichSurvey.value, value, index);
218
+ };
219
+
220
+ const handleToggler = async () => {
221
+ if (firstQuestionList.value) {
222
+ if (answerToAll.value) {
223
+ firstQuestionList.value.forEach((question: AnketaBody, index: number) => {
224
+ if (question.first.answerType === 'T') {
225
+ firstQuestionList.value![index].first.answerName = 'Нет' as AnswerName;
226
+ }
227
+ });
228
+ for (const question of firstQuestionList.value) {
229
+ const index = firstQuestionList.value.indexOf(question);
230
+ await getDefinedAnswerId(question.first.id, 'Нет', index);
231
+ }
232
+ } else {
233
+ firstQuestionList.value.forEach((question: AnketaBody, index: number) => {
234
+ if (question.first.answerType === 'T') {
235
+ firstQuestionList.value![index].first.answerName = null;
236
+ }
237
+ });
238
+ }
239
+ }
240
+ };
241
+
242
+ const onInit = async () => {
243
+ if (route.params.taskId === '0' || formStore.applicationData.processInstanceId === 0) {
244
+ await router.push({ name: 'taskId', params: route.params });
245
+ return;
246
+ }
247
+ await dataStore.getQuestionList(
248
+ surveyType.value,
249
+ formStore.applicationData.processInstanceId,
250
+ formStore.applicationData.insuredApp[0].id,
251
+ whichSurvey.value,
252
+ surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond',
253
+ );
254
+ firstQuestionList.value = formStore[whichSurvey.value]!.body;
255
+ secondQuestionList.value = formStore[surveyType.value === 'health' ? 'surveyByHealthSecond' : 'surveyByCriticalSecond']!;
256
+ formStore[whichSurvey.value]!.type = surveyType.value;
257
+ const negativeAnswer = firstQuestionList.value.every(i => i.first.answerName === 'Нет');
258
+ if (negativeAnswer) {
259
+ answerToAll.value = true;
260
+ }
261
+ await Promise.allSettled(
262
+ firstQuestionList.value.map(async (question: any) => {
263
+ await dataStore.definedAnswers(question.first.id, whichSurvey.value);
264
+ }),
265
+ );
266
+ if (formStore.isDisabled.surveyByHealthBase) {
267
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
268
+ }
269
+ };
270
+
271
+ onMounted(async () => {
272
+ await onInit();
273
+ });
274
+
275
+ watch(
276
+ () => dataStore.panel.open,
277
+ () => {
278
+ if (dataStore.panel.open === false) {
279
+ secondPanel.value = false;
280
+ dataStore.panelAction = null;
281
+ }
282
+ },
283
+ { immediate: true },
284
+ );
285
+
286
+ watch(
287
+ () => firstQuestionList.value,
288
+ value => {
289
+ if (value) {
290
+ const hasPositiveAnswer = value.some(i => i.first.definedAnswers === 'Y' && i.first.answerName !== 'Нет');
291
+ answerToAll.value = !hasPositiveAnswer;
292
+ }
293
+ },
294
+ {
295
+ deep: true,
296
+ },
297
+ );
298
+
299
+ return {
300
+ // State
301
+ vForm,
302
+ formStore,
303
+ answerToAll,
304
+ firstQuestionList,
305
+ secondQuestionList,
306
+ whichSurvey,
307
+ isButtonLoading,
308
+ firstPanel,
309
+ secondPanel,
310
+ currentQuestion,
311
+ currentSecond,
312
+ isPanelLoading,
313
+ searchQuery,
314
+ firstPanelSection,
315
+
316
+ // Functions
317
+ submitForm,
318
+ getDefinedAnswerId,
319
+ scrollForm,
320
+ handleToggler,
321
+ openFirstPanel,
322
+ openSecondPanel,
323
+ closeSecondPanel,
324
+ };
325
+ },
326
+ });
327
+ </script>
328
+
329
+ <style>
330
+ .anketa-radio .v-selection-control-group {
331
+ gap: 40px;
332
+ }
333
+ </style>
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <section class="flex flex-col justify-evenly">
3
+ <img draggable="false" class="w-2/3 lg:w-[25vw] self-center" src="~/assets/auth-logo.svg" />
4
+ <v-form ref="vForm" class="w-2/3 lg:w-[35vw] self-center">
5
+ <base-rounded-input
6
+ class="mb-1"
7
+ v-model="login"
8
+ :rules="$dataStore.rules.required"
9
+ :loading="authLoading"
10
+ :placeholder="$t('buttons.userLogin')"
11
+ type="text"
12
+ @submitted="submitAuthForm"
13
+ ></base-rounded-input>
14
+ <base-rounded-input
15
+ class="mb-1"
16
+ v-model="password"
17
+ :rules="$dataStore.rules.required"
18
+ :loading="authLoading"
19
+ :placeholder="$t('buttons.password')"
20
+ type="password"
21
+ @submitted="submitAuthForm"
22
+ ></base-rounded-input>
23
+ <base-btn :text="$t('buttons.login')" :disabled="authLoading" :btn="$libStyles.greenBtn" @click="submitAuthForm"></base-btn>
24
+ </v-form>
25
+ </section>
26
+ </template>
27
+
28
+ <script lang="ts">
29
+ export default defineComponent({
30
+ setup() {
31
+ const route = useRoute();
32
+ const router = useRouter();
33
+ const dataStore = useDataStore();
34
+
35
+ const vForm = ref<any>(null);
36
+
37
+ const credentials = {
38
+ production: { login: '', password: '' },
39
+ test: { login: '', password: '' },
40
+ development: { login: 'manager', password: 'asdqwe123' },
41
+ vercel: { login: '', password: 'asdqwe123' },
42
+ };
43
+
44
+ const useEnv = {
45
+ envMode: import.meta.env.VITE_MODE,
46
+ isDev: import.meta.env.VITE_MODE === 'development',
47
+ isTest: import.meta.env.VITE_MODE === 'test',
48
+ isVercel: import.meta.env.VITE_MODE === 'vercel',
49
+ isProduction: import.meta.env.VITE_MODE === 'production',
50
+ };
51
+
52
+ const login = ref<string>(credentials[useEnv.envMode as keyof typeof credentials].login);
53
+ const password = ref<string>(credentials[useEnv.envMode as keyof typeof credentials].password);
54
+
55
+ const numAttempts = ref(0);
56
+
57
+ const authLoading = ref(false);
58
+
59
+ onMounted(() => {
60
+ if (route.query && route.query.error) {
61
+ const authError = route.query.error;
62
+ if (authError === '401') {
63
+ dataStore.showToaster('error', dataStore.t('toaster.tokenExpire'), 3000);
64
+ }
65
+ }
66
+ });
67
+
68
+ const submitAuthForm = async () => {
69
+ await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
70
+ if (v.valid) {
71
+ authLoading.value = true;
72
+ await dataStore.loginUser(login.value, password.value, numAttempts.value);
73
+ numAttempts.value++;
74
+ authLoading.value = false;
75
+ if (!!dataStore.user.id) {
76
+ router.push({ name: 'index' });
77
+ }
78
+ }
79
+ });
80
+ };
81
+
82
+ return {
83
+ login,
84
+ password,
85
+ vForm,
86
+ authLoading,
87
+ submitAuthForm,
88
+ };
89
+ },
90
+ });
91
+ </script>
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <section class="w-full px-[10px] pt-[14px] flex flex-col gap-2" :class="[$libStyles.scrollPage]" v-if="formStore.signedDocumentList && formStore.signedDocumentList.length">
3
+ <base-content-block v-for="document of formStore.signedDocumentList as DocumentItem[]" :key="document.id" :class="[$libStyles.textSimple]">
4
+ <h5 class="text-center font-medium mb-4">
5
+ {{ document.fileTypeName }}
6
+ </h5>
7
+ <div :class="[$libStyles.whiteBg, $libStyles.rounded]" class="p-2 h-12 flex items-center relative">
8
+ <span class="ml-2">{{ document.fileName }}</span>
9
+ <i
10
+ class="transition-all cursor-pointer mdi mdi-dots-vertical pl-2 mr-3 border-l-[1px] text-xl absolute right-0"
11
+ :class="[$libStyles.greenTextHover]"
12
+ @click="openPanel(document)"
13
+ ></i>
14
+ </div>
15
+ </base-content-block>
16
+ </section>
17
+ <base-list-empty v-else></base-list-empty>
18
+ <Teleport v-if="$dataStore.panelAction === null" to="#panel-actions">
19
+ <base-fade-transition>
20
+ <div :class="[$libStyles.flexColNav]">
21
+ <base-btn :disabled="documentLoading" :loading="documentLoading" text="Открыть" @click="getFile('view')"></base-btn>
22
+ <base-btn :disabled="documentLoading" :loading="documentLoading" text="Скачать" @click="getFile('download')"></base-btn>
23
+ </div>
24
+ </base-fade-transition>
25
+ </Teleport>
26
+ </template>
27
+
28
+ <script lang="ts">
29
+ import { DocumentItem } from '@/composables/classes';
30
+
31
+ export default defineComponent({
32
+ setup() {
33
+ const dataStore = useDataStore();
34
+ const formStore = useFormStore();
35
+ const currentDocument = ref<DocumentItem>(new DocumentItem());
36
+ const documentLoading = ref<boolean>(false);
37
+
38
+ const currentState = reactive<{ action: string; text: string }>({
39
+ action: '',
40
+ text: '',
41
+ });
42
+ const object_list = computed(() => Object.values(formStore.signedDocumentList));
43
+ const unSignedList = computed(() => document_list.value.filter(doc => doc.signed === false || doc.signed === null));
44
+ const document_list = computed(() =>
45
+ object_list.value.filter(obj => {
46
+ if (obj.fileTypeCode === '19' || obj.fileTypeCode === '5') {
47
+ return obj;
48
+ }
49
+ }),
50
+ );
51
+
52
+ const openPanel = async (document: DocumentItem) => {
53
+ dataStore.panelAction = null;
54
+ dataStore.panel.title = document.fileTypeName!;
55
+ currentDocument.value = document;
56
+ dataStore.panel.open = true;
57
+ };
58
+
59
+ watch(
60
+ () => document_list.value,
61
+ () => {
62
+ if (document_list.value.length > 1 && unSignedList.value.length) {
63
+ currentState.action = 'submit';
64
+ currentState.text = 'Все документы подписаны';
65
+ } else {
66
+ currentState.action = 'upload';
67
+ currentState.text = 'Сохранить';
68
+ }
69
+ },
70
+ {
71
+ immediate: true,
72
+ },
73
+ );
74
+
75
+ const getFile = async (type: FileActions) => {
76
+ if (currentDocument.value) {
77
+ documentLoading.value = true;
78
+ const fileExtension = currentDocument.value.fileName!.match(/\.([0-9a-z]+)(?:[\?#]|$)/i)![1];
79
+ await dataStore.getFile(currentDocument.value, type, fileExtension);
80
+ documentLoading.value = false;
81
+ }
82
+ };
83
+
84
+ const onInit = async () => {
85
+ await dataStore.getDicFileTypeList();
86
+ await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
87
+ };
88
+
89
+ onInit();
90
+
91
+ onUnmounted(() => {
92
+ dataStore.panel.open = false;
93
+ dataStore.panelAction = null;
94
+ });
95
+
96
+ return {
97
+ // State
98
+ formStore,
99
+ documentLoading,
100
+ DocumentItem,
101
+
102
+ // Functions
103
+ openPanel,
104
+ getFile,
105
+ };
106
+ },
107
+ });
108
+ </script>