hl-core 0.0.7-beta.9 → 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.
- package/.prettierrc +2 -1
- package/api/index.ts +66 -47
- package/api/interceptors.ts +4 -4
- package/components/Button/Btn.vue +7 -2
- package/components/Button/ScrollButtons.vue +6 -0
- package/components/Complex/ContentBlock.vue +5 -0
- package/components/{Layout → Dialog}/Dialog.vue +3 -27
- package/components/Dialog/FamilyDialog.vue +39 -0
- package/components/Form/FormBlock.vue +114 -0
- package/components/Form/FormSection.vue +18 -0
- package/components/Form/FormTextSection.vue +20 -0
- package/components/Form/FormToggle.vue +52 -0
- package/components/Form/ProductConditionsBlock.vue +68 -0
- package/components/Input/EmptyFormField.vue +5 -0
- package/components/Input/FileInput.vue +71 -0
- package/components/Input/FormInput.vue +171 -0
- package/components/Input/PanelInput.vue +133 -0
- package/components/Input/RoundedInput.vue +35 -36
- package/components/Layout/Drawer.vue +18 -16
- package/components/Layout/Header.vue +4 -18
- package/components/Layout/Loader.vue +1 -7
- package/components/Layout/SettingsPanel.vue +17 -37
- package/components/List/ListEmpty.vue +22 -0
- package/components/Menu/MenuNav.vue +22 -20
- package/components/Menu/MenuNavItem.vue +6 -6
- package/components/Pages/Anketa.vue +333 -0
- package/components/Pages/Auth.vue +91 -0
- package/components/Pages/Documents.vue +108 -0
- package/components/Pages/MemberForm.vue +1138 -0
- package/components/Pages/ProductAgreement.vue +18 -0
- package/components/Pages/ProductConditions.vue +349 -0
- package/components/Panel/PanelItem.vue +2 -4
- package/components/Panel/PanelSelectItem.vue +20 -0
- package/components/Transitions/FadeTransition.vue +5 -0
- package/composables/classes.ts +299 -253
- package/composables/constants.ts +14 -7
- package/composables/index.ts +55 -60
- package/composables/styles.ts +31 -7
- package/layouts/default.vue +46 -26
- package/layouts/full.vue +2 -12
- package/nuxt.config.ts +3 -0
- package/package.json +13 -10
- package/pages/500.vue +40 -12
- package/plugins/helperFunctionsPlugins.ts +6 -2
- package/plugins/storePlugin.ts +6 -5
- package/store/data.store.js +781 -1880
- package/store/member.store.ts +291 -0
- package/store/messages.ts +66 -51
- package/store/rules.js +26 -28
- package/types/index.ts +250 -0
- package/composables/models.ts +0 -43
- /package/store/{form.store.js → form.store.ts} +0 -0
|
@@ -1,59 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<base-drawer :panel-title="$dataStore.menu.title" which-panel="settings">
|
|
3
3
|
<base-panel-item>
|
|
4
|
-
<v-btn
|
|
5
|
-
size="x-small"
|
|
6
|
-
icon="mdi-minus"
|
|
7
|
-
color="#A0B3D8"
|
|
8
|
-
class="text-white"
|
|
9
|
-
variant="flat"
|
|
10
|
-
></v-btn>
|
|
4
|
+
<v-btn size="x-small" icon="mdi-minus" color="#A0B3D8" class="text-white" variant="flat" @click="handleFontSize('decrease')"></v-btn>
|
|
11
5
|
Шрифт
|
|
12
|
-
<v-btn
|
|
13
|
-
size="x-small"
|
|
14
|
-
icon="mdi-plus"
|
|
15
|
-
color="#A0B3D8"
|
|
16
|
-
class="text-white"
|
|
17
|
-
variant="flat"
|
|
18
|
-
></v-btn>
|
|
6
|
+
<v-btn size="x-small" icon="mdi-plus" color="#A0B3D8" class="text-white" variant="flat" @click="handleFontSize('increase')"></v-btn>
|
|
19
7
|
</base-panel-item>
|
|
20
8
|
<base-panel-item>
|
|
21
|
-
<v-text-field
|
|
22
|
-
v-model="$dataStore.user.fullName"
|
|
23
|
-
:readonly="true"
|
|
24
|
-
hide-details
|
|
25
|
-
variant="plain"
|
|
26
|
-
:label="$dataStore.user.roles?.join(', ')"
|
|
27
|
-
></v-text-field>
|
|
9
|
+
<v-text-field v-model="$dataStore.user.fullName" :readonly="true" hide-details variant="plain" :label="$dataStore.user.roles?.join(', ')"></v-text-field>
|
|
28
10
|
<i class="mdi mdi-account-outline text-2xl text-[#A0B3D8]"></i
|
|
29
11
|
></base-panel-item>
|
|
30
12
|
<base-panel-item
|
|
31
|
-
v-for="panelItem of dataStore.settings.items"
|
|
32
|
-
:key="panelItem.title"
|
|
13
|
+
v-for="panelItem of dataStore.settings.items.filter(i => (typeof i.show === 'boolean' ? i.show : true))"
|
|
14
|
+
:key="panelItem.title!"
|
|
33
15
|
class="cursor-pointer"
|
|
34
16
|
@click="panelItem.action ? panelItem.action() : null"
|
|
35
17
|
>
|
|
36
18
|
{{ panelItem.title }}
|
|
37
|
-
<i
|
|
38
|
-
v-if="panelItem.icon"
|
|
39
|
-
class="mdi text-xl text-[#A0B3D8]"
|
|
40
|
-
:class="[panelItem.icon]"
|
|
41
|
-
></i>
|
|
19
|
+
<i v-if="panelItem.icon" class="mdi text-xl text-[#A0B3D8]" :class="[panelItem.icon]"></i>
|
|
42
20
|
</base-panel-item>
|
|
43
21
|
<base-panel-item @click="dialog = true" class="cursor-pointer">
|
|
44
22
|
Выход
|
|
45
23
|
<i class="mdi mdi-logout text-xl text-[#A0B3D8]"></i>
|
|
46
24
|
</base-panel-item>
|
|
47
25
|
|
|
48
|
-
<base-dialog
|
|
49
|
-
v-model="dialog"
|
|
50
|
-
:title="$t('dialog.exit')"
|
|
51
|
-
:subtitle="$t('dialog.dataWillClear')"
|
|
52
|
-
actions="default"
|
|
53
|
-
@yes="logoutUser"
|
|
54
|
-
@no="dialog = false"
|
|
55
|
-
>
|
|
56
|
-
</base-dialog
|
|
26
|
+
<base-dialog v-model="dialog" :title="$t('dialog.exit')" :subtitle="$t('dialog.dataWillClear')" actions="default" @yes="logoutUser" @no="dialog = false"> </base-dialog
|
|
57
27
|
></base-drawer>
|
|
58
28
|
</template>
|
|
59
29
|
|
|
@@ -61,6 +31,16 @@
|
|
|
61
31
|
const dialog = ref(false);
|
|
62
32
|
const dataStore = useDataStore();
|
|
63
33
|
|
|
34
|
+
const handleFontSize = (action: 'increase' | 'decrease') => {
|
|
35
|
+
if (action === 'increase' && dataStore.fontSize < 24) dataStore.fontSize += 2;
|
|
36
|
+
if (action === 'decrease' && dataStore.fontSize > 14) dataStore.fontSize -= 2;
|
|
37
|
+
if (dataStore.isEFO) {
|
|
38
|
+
dataStore.sendToChild(constants.postActions.font, dataStore.fontSize);
|
|
39
|
+
} else {
|
|
40
|
+
dataStore.sendToParent(constants.postActions.font, dataStore.fontSize);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
64
44
|
const logoutUser = async () => {
|
|
65
45
|
dialog.value = false;
|
|
66
46
|
await dataStore.logoutUser();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="border-[1px] rounded-lg h-[80px] mx-[10px] mt-[14px] flex place-content-center" :class="[$libStyles.blueBgLight, $libStyles.textTitle]">
|
|
3
|
+
<div class="flex justify-center items-center font-medium gap-2 opacity-40">
|
|
4
|
+
{{ text }}
|
|
5
|
+
<i class="text-2xl mdi" :class="[icon ? icon : 'mdi-database-off-outline']"></i>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
props: {
|
|
13
|
+
text: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'Отсутствуют данные',
|
|
16
|
+
},
|
|
17
|
+
icon: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<aside class="w-full lg:w-1/4 bg-white flex flex-col border-r-2">
|
|
2
|
+
<aside class="w-full lg:w-1/4 bg-white flex flex-col border-r-2 relative">
|
|
3
3
|
<base-header
|
|
4
4
|
class="justify-center"
|
|
5
5
|
:title="title"
|
|
@@ -12,21 +12,15 @@
|
|
|
12
12
|
@onMore="$emit('onMore')"
|
|
13
13
|
></base-header>
|
|
14
14
|
<slot key="slot-content" name="content"></slot>
|
|
15
|
-
<section key="main" class="
|
|
15
|
+
<section key="main" :class="[$libStyles.flexColNav]">
|
|
16
16
|
<slot name="start"></slot>
|
|
17
|
-
<
|
|
18
|
-
<div
|
|
19
|
-
v-
|
|
20
|
-
class="flex flex-col gap-[10px]"
|
|
21
|
-
>
|
|
22
|
-
<div v-for="(item, index) of $dataStore.menuItems" :key="index">
|
|
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">
|
|
23
20
|
<base-menu-nav-item
|
|
24
21
|
:menu-item="item"
|
|
25
|
-
:selected="
|
|
26
|
-
|
|
27
|
-
!!item.title &&
|
|
28
|
-
selected.title === item.title
|
|
29
|
-
"
|
|
22
|
+
:selected="!!selected.title && !!item.title && selected.title === item.title"
|
|
23
|
+
:disabled="typeof item.disabled === 'boolean' ? item.disabled : false"
|
|
30
24
|
@click.left="pickItem(item)"
|
|
31
25
|
@click.middle="openTab(item)"
|
|
32
26
|
>
|
|
@@ -34,8 +28,17 @@
|
|
|
34
28
|
<hr v-if="item.hasLine" class="mt-[10px]" />
|
|
35
29
|
</div>
|
|
36
30
|
</div>
|
|
37
|
-
</transition>
|
|
31
|
+
</base-fade-transition>
|
|
38
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>
|
|
39
42
|
</section>
|
|
40
43
|
</aside>
|
|
41
44
|
</template>
|
|
@@ -75,22 +78,21 @@ export default defineComponent({
|
|
|
75
78
|
default: 'mdi-cog-outline',
|
|
76
79
|
},
|
|
77
80
|
},
|
|
78
|
-
emits: ['
|
|
81
|
+
emits: ['onLink', 'onBack', 'onMore', 'clicked'],
|
|
79
82
|
setup(props, { emit }) {
|
|
80
83
|
const dataStore = useDataStore();
|
|
81
84
|
const router = useRouter();
|
|
82
85
|
|
|
83
|
-
const pickItem = (item: MenuItem) => {
|
|
84
|
-
if (item.title !== dataStore.menu.selectedItem.title) {
|
|
85
|
-
emit('update:modelValue', item);
|
|
86
|
+
const pickItem = async (item: MenuItem) => {
|
|
87
|
+
if (item.title !== dataStore.menu.selectedItem.title && (typeof item.disabled === 'boolean' ? !item.disabled : true)) {
|
|
86
88
|
if (typeof item.link === 'object') {
|
|
87
89
|
if (item.link && 'name' in item.link) {
|
|
88
|
-
router.push(item.link as RouteLocationNormalized);
|
|
90
|
+
await router.push(item.link as RouteLocationNormalized);
|
|
89
91
|
} else {
|
|
90
92
|
dataStore.showToaster('warning', 'Отсутствует ссылка для перехода');
|
|
91
93
|
}
|
|
92
94
|
} else {
|
|
93
|
-
|
|
95
|
+
emit('onLink', item);
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
};
|
|
@@ -5,17 +5,13 @@
|
|
|
5
5
|
selected ? $libStyles.whiteText : $libStyles.blackText,
|
|
6
6
|
$libStyles.rounded,
|
|
7
7
|
$libStyles.textSimple,
|
|
8
|
+
disabled ? 'cursor-not-allowed opacity-50' : '',
|
|
8
9
|
]"
|
|
9
10
|
class="h-[60px] flex items-center justify-between hover:bg-[#A0B3D8] hover:!text-white pl-4 cursor-pointer transition-all"
|
|
10
11
|
>
|
|
11
12
|
<span>{{ menuItem.title }}</span>
|
|
12
13
|
<i v-if="menuItem.icon" class="mdi text-xl pr-4" :class="[menuItem.icon]"></i>
|
|
13
|
-
<v-tooltip
|
|
14
|
-
v-if="menuItem.description"
|
|
15
|
-
activator="parent"
|
|
16
|
-
location="bottom"
|
|
17
|
-
>{{ menuItem.description }}</v-tooltip
|
|
18
|
-
>
|
|
14
|
+
<v-tooltip v-if="menuItem.description" activator="parent" location="bottom">{{ menuItem.description }}</v-tooltip>
|
|
19
15
|
</div>
|
|
20
16
|
</template>
|
|
21
17
|
|
|
@@ -32,6 +28,10 @@ export default defineComponent({
|
|
|
32
28
|
type: Boolean,
|
|
33
29
|
default: false,
|
|
34
30
|
},
|
|
31
|
+
disabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
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>
|