Merge remote-tracking branch 'origin/dkr-denzel' into dkr
This commit is contained in:
commit
3b71e3c25e
31 files changed
+1876
-939
No files matched your search
@@ -1,181 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>Результаты тестов:</h2>
|
||||
|
||||
<!-- Общее состояние тестов -->
|
||||
<div v-if="results.success" class="success">✅ Все тесты успешно пройдены!</div>
|
||||
<div v-else-if="results.numFailedTestSuites > 0" class="error">
|
||||
❌ Ошибки в тестах: {{ results.numFailedTestSuites }} из {{ results.numTotalTestSuites }}
|
||||
</div>
|
||||
|
||||
<!-- Сводная информация -->
|
||||
<div v-if="results.testResults" class="summary">
|
||||
<h3>Сводка по тестам:</h3>
|
||||
<ul>
|
||||
<li><strong>Общее количество тестов:</strong> {{ results.numTotalTests }}</li>
|
||||
<li>
|
||||
<strong>Пройдено:</strong> {{ results.numPassedTests }} ({{
|
||||
getPercentage(results.numPassedTests, results.numTotalTests)
|
||||
}}%)
|
||||
</li>
|
||||
<li>
|
||||
<strong>Неудачных:</strong> {{ results.numFailedTests }} ({{
|
||||
getPercentage(results.numFailedTests, results.numTotalTests)
|
||||
}}%)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Список успешных тестов -->
|
||||
<div v-if="passedTests.length">
|
||||
<h3>Успешные тесты:</h3>
|
||||
<ul>
|
||||
<li v-for="test in passedTests" :key="test.fullName">
|
||||
<strong>{{ test.fullName }}</strong> ✅ ({{ test.duration }} мс)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Список неудачных тестов -->
|
||||
<div v-if="failedTests.length">
|
||||
<h3>Неудачные тесты:</h3>
|
||||
<ul>
|
||||
<li v-for="(test, index) in failedTests" :key="test.fullName">
|
||||
<strong>{{ test.fullName }}</strong> ❌ ({{ test.duration }} мс)
|
||||
<pre v-if="test.failureMessages.length" class="error-log">
|
||||
<button @click="toggleError(index)" class="error-toggle-btn">
|
||||
{{ isErrorVisible(index) ? 'Скрыть ошибки' : 'Показать ошибки' }}
|
||||
</button>
|
||||
<div v-if="isErrorVisible(index)">
|
||||
<strong>Ожидалось:</strong> {{ extractTestValue(test.failureMessages, 'Expected') }}
|
||||
<strong>Получено:</strong> {{ extractTestValue(test.failureMessages, 'Received') }}
|
||||
</div>
|
||||
</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
|
||||
const results = ref({});
|
||||
const errorMessage = ref('');
|
||||
const errorVisibility = ref({});
|
||||
|
||||
const toggleError = (index) => {
|
||||
errorVisibility.value[index] = !errorVisibility.value[index];
|
||||
};
|
||||
|
||||
const isErrorVisible = (index) => {
|
||||
return !!errorVisibility.value[index];
|
||||
};
|
||||
|
||||
const getPercentage = (num, total) => {
|
||||
return ((num / total) * 100).toFixed(2);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const response = await fetch('/test-results.json');
|
||||
const data = await response.json();
|
||||
results.value = data;
|
||||
|
||||
if (!data.success) {
|
||||
errorMessage.value = data.testResults
|
||||
.map((t) => (t.failureMessages ? t.failureMessages.join('\n') : ''))
|
||||
.join('\n\n');
|
||||
}
|
||||
} catch (error) {
|
||||
errorMessage.value = error;
|
||||
}
|
||||
});
|
||||
|
||||
const passedTests = computed(() => {
|
||||
return (
|
||||
results.value?.testResults?.flatMap((testSuite) =>
|
||||
testSuite.assertionResults
|
||||
?.filter((test) => test.status === 'passed')
|
||||
.map((test) => ({
|
||||
...test,
|
||||
failureMessages: test.failureMessages || [],
|
||||
})),
|
||||
) || []
|
||||
);
|
||||
});
|
||||
|
||||
const failedTests = computed(() => {
|
||||
return (
|
||||
results.value?.testResults?.flatMap((testSuite) =>
|
||||
testSuite.assertionResults
|
||||
?.filter((test) => test.status === 'failed')
|
||||
.map((test) => ({
|
||||
...test,
|
||||
failureMessages: test.failureMessages || [],
|
||||
})),
|
||||
) || []
|
||||
);
|
||||
});
|
||||
|
||||
// Очистка от лишних данных и ANSI кодов
|
||||
/* eslint-disable no-control-regex */
|
||||
const cleanTestMessage = (message) => {
|
||||
return message.replace(/[\x1b][[0-?9;]*[mG]/g, '').trim();
|
||||
};
|
||||
/* eslint-enable no-control-regex */
|
||||
|
||||
// Универсальная функция для извлечения данных из сообщений
|
||||
const extractTestValue = (messages, type) => {
|
||||
const failureMessage = messages.find((msg) => msg.includes(type + ':'));
|
||||
if (failureMessage) {
|
||||
const match = failureMessage.match(new RegExp(`${type}: (.*)`));
|
||||
if (match) {
|
||||
return cleanTestMessage(match[1]);
|
||||
}
|
||||
}
|
||||
return 'Не указано';
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.success {
|
||||
color: green;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.warning {
|
||||
color: orange;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.error-log {
|
||||
background: rgba(255, 221, 221, 0.1);
|
||||
border-left: 4px solid red;
|
||||
padding: 5px;
|
||||
white-space: pre-wrap;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.summary {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.error-toggle-btn {
|
||||
background-color: #ff6347;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.error-toggle-btn:hover {
|
||||
background-color: #ff4500;
|
||||
}
|
||||
</style>
|
||||
@@ -1,19 +0,0 @@
|
||||
import DefaultTheme from 'vitepress/theme';
|
||||
import { withMermaid } from 'vitepress-plugin-mermaid';
|
||||
import TestRunner from './components/TestRunner.vue';
|
||||
|
||||
export default withMermaid({
|
||||
...DefaultTheme,
|
||||
themeConfig: {
|
||||
search: {
|
||||
provider: 'local',
|
||||
},
|
||||
},
|
||||
mermaid: {},
|
||||
mermaidPlugin: {
|
||||
class: 'mermaid my-class',
|
||||
},
|
||||
enhanceApp({ app }) {
|
||||
app.component('TestRunner', TestRunner);
|
||||
},
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
# Документация
|
||||
|
||||
⚠️ Оригинальный README.md не найден.
|
||||
@@ -1,27 +0,0 @@
|
||||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "Портал"
|
||||
text: "Документация по порталу"
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Документация
|
||||
link: /README
|
||||
|
||||
features:
|
||||
- title: Инструкция
|
||||
details: Подробная инструкция по установке
|
||||
link: /guides/install
|
||||
- title: Инструкция по ведению и заполнению
|
||||
details: Подробная инструкция по ведению и заполнению
|
||||
link: /guides/usage
|
||||
- title: Правила коммитов
|
||||
details: Подробная инструкция по наименованию коммитов
|
||||
link: /guides/commits
|
||||
- title: Тестирование проекта
|
||||
details: Запуск автотестов
|
||||
link: /tests
|
||||
---
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# CountDown
|
||||
|
||||
Описание отсутствует.
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import CountDown from '@/components/components/CountDown';
|
||||
```
|
||||
|
||||
```vue
|
||||
<CountDown />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,75 +0,0 @@
|
||||
# line-chart
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `dataLineChart` | `Object` | `() => {` | нет комментария |
|
||||
| `period` | `Object` | `() => {` | нет комментария |
|
||||
| `filter` | `String` | `'d'` | нет комментария |
|
||||
## Описание переменных
|
||||
|
||||
| Переменная | Значение | Описание |
|
||||
|------------|----------|----------|
|
||||
| `baseunic` | <pre>unicperson(fullper.value.filter(e<br>=> new Date(e.visitdate)<br>>moment(new<br>Date(date)).subtract(between.value*2,<br>'d') && new Date(e.visitdate)<br><= moment(new<br>Date(date)).subtract(between.value,<br>'d')))<br>
|
||||
let crrunic =<br>unicperson(fullper.value.filter(e<br>=> new Date(e.visitdate)<br>>moment(new<br>Date(date)).subtract(between.value,<br>'d') && new Date(e.visitdate)<br><= new Date(date)))<br>
|
||||
let bothuser = new<br>Set([...baseunic].filter(element<br>=> crrunic.has(element)))<br>
|
||||
<br>
|
||||
if (date<br>==formatDash(filterStore.date_period.enddate))<br>{<br>
|
||||
<br>editCRR(bothuser.size*100/baseunic.size)<br>
|
||||
}<br>
|
||||
<br>
|
||||
return baseunic.size<br>==0?0:bothuser.size*100/baseunic.size<br>
|
||||
} <br>
|
||||
|
||||
const editCRR = (val) =><br>{<br>
|
||||
<br>
|
||||
emit('getCRR', val)<br>
|
||||
}<br>
|
||||
<br>
|
||||
const unicperson = (arr)<br>=> {<br>
|
||||
<br>
|
||||
let arrnew =[]<br>
|
||||
arr.forEach(e =><br>arrnew.push(...e.user) )<br>
|
||||
return new Set(arrnew)<br>
|
||||
}<br>
|
||||
|
||||
const data=computed({get()<br>{<br>
|
||||
<br>
|
||||
return<br>JSON.parse(JSON.stringify(dataf.value))<br>
|
||||
}<br>
|
||||
})<br>
|
||||
const linear=ref(null)<br>
|
||||
|
||||
|
||||
|
||||
const options = {<br>
|
||||
|
||||
plugins: { <br>
|
||||
<br>
|
||||
datalabels: {<br>
|
||||
color: 'grey',<br>
|
||||
align: 'top',<br>
|
||||
display:<br>'auto'<br>
|
||||
},<br>
|
||||
legend: {<br>
|
||||
onHover:<br>(event, chartElement) => {<br>
|
||||
<br>event.native.target.style.cursor<br>='pointer'<br></pre> | <pre>Расчет значения crr, и передача в<br>родительский компонент значения, на<br>последнюю дату в периоде для<br>компонента card-total<br>
|
||||
@constructor<br>
|
||||
@param {object} date - по<br>каждому дню, в указанном периоде<br>(пример - 2024-03-22)<br>
|
||||
@description Для расчетного<br>периода с 04<br></pre> |
|
||||
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import line-chart from '@/components/components/UI/aboutportal/line-chart';
|
||||
```
|
||||
|
||||
```vue
|
||||
<line-chart />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,22 +0,0 @@
|
||||
# infoUserCard
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `opendialog` | `Boolean` | `false` | нет комментария |
|
||||
| `author` | `Object` | `{` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import infoUserCard from '@/components/components\UI\fiousercard\infoUserCard';
|
||||
```
|
||||
|
||||
```vue
|
||||
<infoUserCard />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,25 +0,0 @@
|
||||
# timeSelect
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `dateEvent` | `String` | `""` | нет комментария |
|
||||
| `limitation` | `String` | `""` | нет комментария |
|
||||
| `order` | `Array` | `[0` | нет комментария |
|
||||
| `chek` | `Boolean` | `false` | нет комментария |
|
||||
| `rule` | `Number` | `-1` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import timeSelect from '@/components/components/calendar_of_events/UI_calendar/timeSelect';
|
||||
```
|
||||
|
||||
```vue
|
||||
<timeSelect />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,18 +0,0 @@
|
||||
# carousel-list
|
||||
|
||||
### currentslide=currentslide<carous.length-1?currentslide+1:0
|
||||
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import carousel-list from '@/components/components/carousel-list';
|
||||
```
|
||||
|
||||
```vue
|
||||
<carousel-list />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,28 +0,0 @@
|
||||
# carousel-numbers
|
||||
|
||||
### <v-img
|
||||
height="100"
|
||||
:src="`${burl}${n.img}`"
|
||||
cover
|
||||
class="text-white"
|
||||
>
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `digitalData` | `Object` | `{` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import carousel-numbers from '@/components/components/carousel-numbers';
|
||||
```
|
||||
|
||||
```vue
|
||||
<carousel-numbers />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,25 +0,0 @@
|
||||
# VoteAdmin
|
||||
|
||||
### <v-card-title>Голосование</v-card-title>
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `usersvotedbest` | `Array` | `()=>[]` | нет комментария |
|
||||
| `uservotedthanks` | `Array` | `()=>[]` | нет комментария |
|
||||
| `all_cod` | `Array` | `()=>[]` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import VoteAdmin from '@/components/components\vote\VoteAdmin';
|
||||
```
|
||||
|
||||
```vue
|
||||
<VoteAdmin />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,22 +0,0 @@
|
||||
# VoteCard
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `isFinished` | `Boolean` | `false` | нет комментария |
|
||||
| `voteCard` | `Object` | `() => {` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import VoteCard from '@/components/components\vote\VoteCard';
|
||||
```
|
||||
|
||||
```vue
|
||||
<VoteCard />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,25 +0,0 @@
|
||||
# VoteForm
|
||||
|
||||
### Форма голосования
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `type_fetch` | `String` | `'best'` | нет комментария |
|
||||
| `persons` | `Array` | `() => []` | нет комментария |
|
||||
| `myrealdep` | `Object` | `() => {` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import VoteForm from '@/components/components\vote\VoteForm';
|
||||
```
|
||||
|
||||
```vue
|
||||
<VoteForm />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
# Тестирование
|
||||
|
||||
<ClientOnly>
|
||||
<TestRunner />
|
||||
</ClientOnly>
|
||||
|
||||
@@ -0,0 +1,746 @@
|
||||
import { withMermaid } from 'vitepress-plugin-mermaid';
|
||||
|
||||
export default withMermaid({
|
||||
themeConfig: {
|
||||
search: {
|
||||
provider: 'local'
|
||||
},
|
||||
sidebar: [
|
||||
{
|
||||
text: 'Структура',
|
||||
collapsed: false,
|
||||
items: [
|
||||
{
|
||||
"text": "App",
|
||||
"link": "/src/App"
|
||||
},
|
||||
{
|
||||
"text": "components",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "CountDown",
|
||||
"link": "/src/components/CountDown"
|
||||
},
|
||||
{
|
||||
"text": "UI",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "Auth-form",
|
||||
"link": "/src/components/UI/Auth-form"
|
||||
},
|
||||
{
|
||||
"text": "NewsCard",
|
||||
"link": "/src/components/UI/NewsCard"
|
||||
},
|
||||
{
|
||||
"text": "PatternTabs",
|
||||
"link": "/src/components/UI/PatternTabs"
|
||||
},
|
||||
{
|
||||
"text": "SearcEmployess",
|
||||
"link": "/src/components/UI/SearcEmployess"
|
||||
},
|
||||
{
|
||||
"text": "Timer",
|
||||
"link": "/src/components/UI/Timer"
|
||||
},
|
||||
{
|
||||
"text": "aboutportal",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "card-feedback",
|
||||
"link": "/src/components/UI/aboutportal/card-feedback"
|
||||
},
|
||||
{
|
||||
"text": "card-top-comment",
|
||||
"link": "/src/components/UI/aboutportal/card-top-comment"
|
||||
},
|
||||
{
|
||||
"text": "card-total",
|
||||
"link": "/src/components/UI/aboutportal/card-total"
|
||||
},
|
||||
{
|
||||
"text": "card_top_comment",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "card-comment",
|
||||
"link": "/src/components/UI/aboutportal/card_top_comment/card-comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "feedmodul",
|
||||
"link": "/src/components/UI/aboutportal/feedmodul"
|
||||
},
|
||||
{
|
||||
"text": "line-chart",
|
||||
"link": "/src/components/UI/aboutportal/line-chart"
|
||||
},
|
||||
{
|
||||
"text": "pattern-card-feed",
|
||||
"link": "/src/components/UI/aboutportal/pattern-card-feed"
|
||||
},
|
||||
{
|
||||
"text": "pattern-card",
|
||||
"link": "/src/components/UI/aboutportal/pattern-card"
|
||||
},
|
||||
{
|
||||
"text": "portal-traffic",
|
||||
"link": "/src/components/UI/aboutportal/portal-traffic"
|
||||
},
|
||||
{
|
||||
"text": "rating-page",
|
||||
"link": "/src/components/UI/aboutportal/rating-page"
|
||||
},
|
||||
{
|
||||
"text": "toolbar-filter",
|
||||
"link": "/src/components/UI/aboutportal/toolbar-filter"
|
||||
},
|
||||
{
|
||||
"text": "tooltip-ico",
|
||||
"link": "/src/components/UI/aboutportal/tooltip-ico"
|
||||
},
|
||||
{
|
||||
"text": "tooltip-user",
|
||||
"link": "/src/components/UI/aboutportal/tooltip-user"
|
||||
},
|
||||
{
|
||||
"text": "top-user",
|
||||
"link": "/src/components/UI/aboutportal/top-user"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "date-select",
|
||||
"link": "/src/components/UI/date-select"
|
||||
},
|
||||
{
|
||||
"text": "defaultportal",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "page-counter",
|
||||
"link": "/src/components/UI/defaultportal/page-counter"
|
||||
},
|
||||
{
|
||||
"text": "uploading-file",
|
||||
"link": "/src/components/UI/defaultportal/uploading-file"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "feedback",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "feedstar-like",
|
||||
"link": "/src/components/UI/feedback/feedstar-like"
|
||||
},
|
||||
{
|
||||
"text": "statistik-like",
|
||||
"link": "/src/components/UI/feedback/statistik-like"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "fiousercard",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "icoUser",
|
||||
"link": "/src/components/UI/fiousercard/icoUser"
|
||||
},
|
||||
{
|
||||
"text": "infoUserCard",
|
||||
"link": "/src/components/UI/fiousercard/infoUserCard"
|
||||
},
|
||||
{
|
||||
"text": "listUser",
|
||||
"link": "/src/components/UI/fiousercard/listUser"
|
||||
},
|
||||
{
|
||||
"text": "onlineUsers",
|
||||
"link": "/src/components/UI/fiousercard/onlineUsers"
|
||||
},
|
||||
{
|
||||
"text": "vcardUser",
|
||||
"link": "/src/components/UI/fiousercard/vcardUser"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "index",
|
||||
"link": "/src/components/UI/index"
|
||||
},
|
||||
{
|
||||
"text": "my-helper",
|
||||
"link": "/src/components/UI/my-helper"
|
||||
},
|
||||
{
|
||||
"text": "tooltip-number",
|
||||
"link": "/src/components/UI/tooltip-number"
|
||||
},
|
||||
{
|
||||
"text": "tooltip-text",
|
||||
"link": "/src/components/UI/tooltip-text"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "about_inspection",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "contacts",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "ContactInfo",
|
||||
"link": "/src/components/about_inspection/contacts/ContactInfo"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "general_information",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "GeneralInformation",
|
||||
"link": "/src/components/about_inspection/general_information/GeneralInformation"
|
||||
},
|
||||
{
|
||||
"text": "GeneralInformationSize",
|
||||
"link": "/src/components/about_inspection/general_information/GeneralInformationSize"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "open_vacancies",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "OpenVacancies",
|
||||
"link": "/src/components/about_inspection/open_vacancies/OpenVacancies"
|
||||
},
|
||||
{
|
||||
"text": "ResponseVacancies",
|
||||
"link": "/src/components/about_inspection/open_vacancies/ResponseVacancies"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "structure",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "StructureInspection",
|
||||
"link": "/src/components/about_inspection/structure/StructureInspection"
|
||||
},
|
||||
{
|
||||
"text": "StructureInspectionRow",
|
||||
"link": "/src/components/about_inspection/structure/StructureInspectionRow"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "calendar_of_events",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "BigCalendar",
|
||||
"link": "/src/components/calendar_of_events/BigCalendar"
|
||||
},
|
||||
{
|
||||
"text": "UI_calendar",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "calendarFull",
|
||||
"link": "/src/components/calendar_of_events/UI_calendar/calendarFull"
|
||||
},
|
||||
{
|
||||
"text": "dialogCreate",
|
||||
"link": "/src/components/calendar_of_events/UI_calendar/dialogCreate"
|
||||
},
|
||||
{
|
||||
"text": "periodEvents",
|
||||
"link": "/src/components/calendar_of_events/UI_calendar/periodEvents"
|
||||
},
|
||||
{
|
||||
"text": "reminderEvent",
|
||||
"link": "/src/components/calendar_of_events/UI_calendar/reminderEvent"
|
||||
},
|
||||
{
|
||||
"text": "timeSelect",
|
||||
"link": "/src/components/calendar_of_events/UI_calendar/timeSelect"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "calendar-create-select",
|
||||
"link": "/src/components/calendar_of_events/calendar-create-select"
|
||||
},
|
||||
{
|
||||
"text": "calendar-create",
|
||||
"link": "/src/components/calendar_of_events/calendar-create"
|
||||
},
|
||||
{
|
||||
"text": "calendar-my",
|
||||
"link": "/src/components/calendar_of_events/calendar-my"
|
||||
},
|
||||
{
|
||||
"text": "event-calendar",
|
||||
"link": "/src/components/calendar_of_events/event-calendar"
|
||||
},
|
||||
{
|
||||
"text": "event-create",
|
||||
"link": "/src/components/calendar_of_events/event-create"
|
||||
},
|
||||
{
|
||||
"text": "event-dialog-edit-participant",
|
||||
"link": "/src/components/calendar_of_events/event-dialog-edit-participant"
|
||||
},
|
||||
{
|
||||
"text": "event-dialog-edit",
|
||||
"link": "/src/components/calendar_of_events/event-dialog-edit"
|
||||
},
|
||||
{
|
||||
"text": "event-dialog-info",
|
||||
"link": "/src/components/calendar_of_events/event-dialog-info"
|
||||
},
|
||||
{
|
||||
"text": "event-dialog",
|
||||
"link": "/src/components/calendar_of_events/event-dialog"
|
||||
},
|
||||
{
|
||||
"text": "load-ical",
|
||||
"link": "/src/components/calendar_of_events/load-ical"
|
||||
},
|
||||
{
|
||||
"text": "load-ical1",
|
||||
"link": "/src/components/calendar_of_events/load-ical1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "cardLike",
|
||||
"link": "/src/components/cardLike"
|
||||
},
|
||||
{
|
||||
"text": "carousel-list",
|
||||
"link": "/src/components/carousel-list"
|
||||
},
|
||||
{
|
||||
"text": "carousel-numbers",
|
||||
"link": "/src/components/carousel-numbers"
|
||||
},
|
||||
{
|
||||
"text": "dialog-search",
|
||||
"link": "/src/components/dialog-search"
|
||||
},
|
||||
{
|
||||
"text": "digital-letna",
|
||||
"link": "/src/components/digital-letna"
|
||||
},
|
||||
{
|
||||
"text": "graph",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "chartConfig",
|
||||
"link": "/src/components/graph/chartConfig"
|
||||
},
|
||||
{
|
||||
"text": "line-graph",
|
||||
"link": "/src/components/graph/line-graph"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "load-round",
|
||||
"link": "/src/components/load-round"
|
||||
},
|
||||
{
|
||||
"text": "news-crossroad",
|
||||
"link": "/src/components/news-crossroad"
|
||||
},
|
||||
{
|
||||
"text": "news-full",
|
||||
"link": "/src/components/news-full"
|
||||
},
|
||||
{
|
||||
"text": "news-home",
|
||||
"link": "/src/components/news-home"
|
||||
},
|
||||
{
|
||||
"text": "secret",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "SmallTimer",
|
||||
"link": "/src/components/secret/SmallTimer"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "testing",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "BodyDetailTesting",
|
||||
"link": "/src/components/testing/BodyDetailTesting"
|
||||
},
|
||||
{
|
||||
"text": "CatalogTest",
|
||||
"link": "/src/components/testing/CatalogTest"
|
||||
},
|
||||
{
|
||||
"text": "DetailCardTest",
|
||||
"link": "/src/components/testing/DetailCardTest"
|
||||
},
|
||||
{
|
||||
"text": "HeaderDetailTesting",
|
||||
"link": "/src/components/testing/HeaderDetailTesting"
|
||||
},
|
||||
{
|
||||
"text": "QuestionBlock",
|
||||
"link": "/src/components/testing/QuestionBlock"
|
||||
},
|
||||
{
|
||||
"text": "TestResults",
|
||||
"link": "/src/components/testing/TestResults"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "vote",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "ConstructorVote",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "AnswerList",
|
||||
"link": "/src/components/vote/ConstructorVote/AnswerList"
|
||||
},
|
||||
{
|
||||
"text": "CreatedVote",
|
||||
"link": "/src/components/vote/ConstructorVote/CreatedVote"
|
||||
},
|
||||
{
|
||||
"text": "MainInfo",
|
||||
"link": "/src/components/vote/ConstructorVote/MainInfo"
|
||||
},
|
||||
{
|
||||
"text": "NewQuestion",
|
||||
"link": "/src/components/vote/ConstructorVote/NewQuestion"
|
||||
},
|
||||
{
|
||||
"text": "QuestionHeader",
|
||||
"link": "/src/components/vote/ConstructorVote/QuestionHeader"
|
||||
},
|
||||
{
|
||||
"text": "QuestionItem",
|
||||
"link": "/src/components/vote/ConstructorVote/QuestionItem"
|
||||
},
|
||||
{
|
||||
"text": "QuestionSettings",
|
||||
"link": "/src/components/vote/ConstructorVote/QuestionSettings"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "CurrentVote",
|
||||
"link": "/src/components/vote/CurrentVote"
|
||||
},
|
||||
{
|
||||
"text": "NonVoteHappy",
|
||||
"link": "/src/components/vote/NonVoteHappy"
|
||||
},
|
||||
{
|
||||
"text": "NonVoteSad",
|
||||
"link": "/src/components/vote/NonVoteSad"
|
||||
},
|
||||
{
|
||||
"text": "NoneVote",
|
||||
"link": "/src/components/vote/NoneVote"
|
||||
},
|
||||
{
|
||||
"text": "VoteAdmin",
|
||||
"link": "/src/components/vote/VoteAdmin"
|
||||
},
|
||||
{
|
||||
"text": "VoteAnimation",
|
||||
"link": "/src/components/vote/VoteAnimation"
|
||||
},
|
||||
{
|
||||
"text": "VoteCard",
|
||||
"link": "/src/components/vote/VoteCard"
|
||||
},
|
||||
{
|
||||
"text": "VoteConstructor",
|
||||
"link": "/src/components/vote/VoteConstructor"
|
||||
},
|
||||
{
|
||||
"text": "VoteForm",
|
||||
"link": "/src/components/vote/VoteForm"
|
||||
},
|
||||
{
|
||||
"text": "VoteResult",
|
||||
"link": "/src/components/vote/VoteResult"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "layouts",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "default",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "AdminMenu",
|
||||
"link": "/src/layouts/default/AdminMenu"
|
||||
},
|
||||
{
|
||||
"text": "DefaultPortal",
|
||||
"link": "/src/layouts/default/DefaultPortal"
|
||||
},
|
||||
{
|
||||
"text": "alertDefault",
|
||||
"link": "/src/layouts/default/alertDefault"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "main",
|
||||
"link": "/src/main"
|
||||
},
|
||||
{
|
||||
"text": "plugins",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "index",
|
||||
"link": "/src/plugins/index"
|
||||
},
|
||||
{
|
||||
"text": "vuetify",
|
||||
"link": "/src/plugins/vuetify"
|
||||
},
|
||||
{
|
||||
"text": "webfontloader",
|
||||
"link": "/src/plugins/webfontloader"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "router",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "index",
|
||||
"link": "/src/router/index"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "store",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "AboutPortalFilter",
|
||||
"link": "/src/store/AboutPortalFilter"
|
||||
},
|
||||
{
|
||||
"text": "AccountStore",
|
||||
"link": "/src/store/AccountStore"
|
||||
},
|
||||
{
|
||||
"text": "MainmenuStore",
|
||||
"link": "/src/store/MainmenuStore"
|
||||
},
|
||||
{
|
||||
"text": "WeekendsStore",
|
||||
"link": "/src/store/WeekendsStore"
|
||||
},
|
||||
{
|
||||
"text": "app",
|
||||
"link": "/src/store/app"
|
||||
},
|
||||
{
|
||||
"text": "index",
|
||||
"link": "/src/store/index"
|
||||
},
|
||||
{
|
||||
"text": "useAlertStore",
|
||||
"link": "/src/store/useAlertStore"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "tests",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "App.test",
|
||||
"link": "/src/tests/App.test"
|
||||
},
|
||||
{
|
||||
"text": "CarouselList.test",
|
||||
"link": "/src/tests/CarouselList.test"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "utils",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "axios-api",
|
||||
"link": "/src/utils/axios-api"
|
||||
},
|
||||
{
|
||||
"text": "universal_functions",
|
||||
"link": "/src/utils/universal_functions"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "views",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "AboutInspectionPage",
|
||||
"link": "/src/views/AboutInspectionPage"
|
||||
},
|
||||
{
|
||||
"text": "AboutPortalPage",
|
||||
"link": "/src/views/AboutPortalPage"
|
||||
},
|
||||
{
|
||||
"text": "FAQPage",
|
||||
"link": "/src/views/FAQPage"
|
||||
},
|
||||
{
|
||||
"text": "FeedbackPage",
|
||||
"link": "/src/views/FeedbackPage"
|
||||
},
|
||||
{
|
||||
"text": "FnsHol",
|
||||
"link": "/src/views/FnsHol"
|
||||
},
|
||||
{
|
||||
"text": "HomePage",
|
||||
"link": "/src/views/HomePage"
|
||||
},
|
||||
{
|
||||
"text": "LaborProtection",
|
||||
"link": "/src/views/LaborProtection"
|
||||
},
|
||||
{
|
||||
"text": "NewsPage",
|
||||
"link": "/src/views/NewsPage"
|
||||
},
|
||||
{
|
||||
"text": "ProvidingActivitiesPage",
|
||||
"link": "/src/views/ProvidingActivitiesPage"
|
||||
},
|
||||
{
|
||||
"text": "SecurityPage",
|
||||
"link": "/src/views/SecurityPage"
|
||||
},
|
||||
{
|
||||
"text": "StructurePage",
|
||||
"link": "/src/views/StructurePage"
|
||||
},
|
||||
{
|
||||
"text": "TestHomePage",
|
||||
"link": "/src/views/TestHomePage"
|
||||
},
|
||||
{
|
||||
"text": "Vote",
|
||||
"link": "/src/views/Vote"
|
||||
},
|
||||
{
|
||||
"text": "VoteHomePage",
|
||||
"link": "/src/views/VoteHomePage"
|
||||
},
|
||||
{
|
||||
"text": "nested_view",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "o_OKiB",
|
||||
"link": "/src/views/nested_view/o_OKiB"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "safety",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "ChaptersSafety",
|
||||
"link": "/src/views/safety/ChaptersSafety"
|
||||
},
|
||||
{
|
||||
"text": "DocumentationSafety",
|
||||
"link": "/src/views/safety/DocumentationSafety"
|
||||
},
|
||||
{
|
||||
"text": "MainInfoSafety",
|
||||
"link": "/src/views/safety/MainInfoSafety"
|
||||
},
|
||||
{
|
||||
"text": "TestSafety",
|
||||
"link": "/src/views/safety/TestSafety"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "secret",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"text": "SecretPage",
|
||||
"link": "/src/views/secret/SecretPage"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Гайды',
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: 'Как установить', link: '/guides/install' },
|
||||
{ text: 'Как использовать', link: '/guides/usage' },
|
||||
{ text: 'Правила комитов', link: '/guides/commits' }
|
||||
,
|
||||
{ text: 'Тесты', link: '/tests' },
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
mermaid: {
|
||||
// refer https://mermaid.js.org/config/setup/modules/mermaidAPI.html#mermaidapi-configuration-defaults for options
|
||||
},
|
||||
// optionally set additional config for plugin itself with MermaidPluginConfig
|
||||
mermaidPlugin: {
|
||||
class: 'mermaid my-class', // set additional css classes for parent container
|
||||
},});
|
||||
@@ -0,0 +1,25 @@
|
||||
# CatalogTest
|
||||
|
||||
### Карточка где буду отрисовываться тесты в цикле
|
||||
|
||||
## Описание пропсов
|
||||
|
||||
| Пропс | Тип | Значение по умолчанию | Комментарий |
|
||||
|-------|-----|-----------------------|-------------|
|
||||
| `title` | `String` | `'Не забыть передать тайтл сюда!'` | нет комментария |
|
||||
| `activeTab` | `Number` | `0` | нет комментария |
|
||||
| `testingCard` | `Array` | `() => []` | нет комментария |
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import CatalogTest from '@/components/components/testing/CatalogTest';
|
||||
```
|
||||
|
||||
```vue
|
||||
<CatalogTest />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -0,0 +1,18 @@
|
||||
# VoteConstructor
|
||||
|
||||
### Основная информация
|
||||
|
||||
|
||||
|
||||
## Пример использования
|
||||
|
||||
```vue
|
||||
import VoteConstructor from '@/components/components/vote/VoteConstructor';
|
||||
```
|
||||
|
||||
```vue
|
||||
<VoteConstructor />
|
||||
```
|
||||
|
||||
---
|
||||
> Документация сгенерирована автоматически.
|
||||
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
// rootDir: '../',
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
roots: ['/app/src/front/src'],
|
||||
setupFilesAfterEnv: ['/app/documentation/jest.setup.js'],
|
||||
transform: {
|
||||
'^.+\\.vue$': '@vue/vue3-jest',
|
||||
'^.+\\.mjs$': 'babel-jest',
|
||||
'^.+\\.js$': 'babel-jest',
|
||||
'\\.(png|jpe?g|gif|svg)$': 'jest-transform-stub',
|
||||
},
|
||||
moduleFileExtensions: ['js', 'json', 'vue', 'mjs'],
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '/app/src/front/src/$1',
|
||||
},
|
||||
transformIgnorePatterns: ['/node_modules/(?!(vuetify|quasar)/)'],
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['/app/src/front/src/**/*.{js,vue}'],
|
||||
coveragePathIgnorePatterns: ['/documentation/'],
|
||||
coverageReporters: ['json', 'html'],
|
||||
coverageDirectory: '/app/documentation/docs/public/test-coverage',
|
||||
};
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<v-autocomplete
|
||||
v-model="selectedEmployees"
|
||||
:items="allEmployeesgroupedbydep"
|
||||
class="text-no-wrap ml-4"
|
||||
density="compact"
|
||||
item-title="fio"
|
||||
item-value="id"
|
||||
label="Выберите сотрудников"
|
||||
multiple
|
||||
variant="outlined"
|
||||
>
|
||||
<template #prepend-item>
|
||||
<v-checkbox
|
||||
:model-value="(selectedEmployees?.length || 0) === allEmployees.length"
|
||||
class="pa-0"
|
||||
label="Все"
|
||||
@click="handleSelectAll"
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<template #selection="{ item }">
|
||||
<v-chip :prepend-avatar="checkremote(`${spravURL}${item.raw.login}.jpg`)">
|
||||
{{ item.raw.familyname }}
|
||||
</v-chip>
|
||||
</template>
|
||||
<template #item="data">
|
||||
<template v-if="typeof data.item.raw !== 'object'">
|
||||
<v-divider />
|
||||
<v-list-group class="pa-4 text-overline text-grey" v-text="data.item.raw"></v-list-group>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-list-item
|
||||
:append-avatar="checkremote(`${spravURL}${data.item.raw.login}.jpg`)
|
||||
" density="compact" slim @click="onEmployeesChange(data.item.raw.id)"
|
||||
>
|
||||
<template #prepend>
|
||||
<v-checkbox
|
||||
:model-value="selectedEmployees.includes(data.item.raw.id)"
|
||||
density="compact"
|
||||
hide-details
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<v-list-item-title class="text-third" v-text="data.item.raw.fio"></v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref } from 'vue';
|
||||
import { getEmployees, spravURL } from '@/utils/axios-api';
|
||||
import { checkremote } from '@/utils/universal_functions.js';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
modelValue: Array,
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
setup(props, { emit }) {
|
||||
const selectedEmployees = ref(props.modelValue || []);
|
||||
const groupedEmployees = ref([]);
|
||||
const allEmployees = computed(() => [...groupedEmployees.value]);
|
||||
|
||||
getEmployees().then((r) => (groupedEmployees.value = r));
|
||||
|
||||
const allEmployeesgroupedbydep = computed(() => {
|
||||
let groupped = [];
|
||||
for (let x of allEmployees.value.sort(
|
||||
(a, b) => a.id_dict_department - b.id_dict_department,
|
||||
)) {
|
||||
if (!groupped.includes(x.department)) groupped.push(x.department);
|
||||
groupped.push(x);
|
||||
}
|
||||
return groupped;
|
||||
});
|
||||
|
||||
const onEmployeesChange = (employeeId) => {
|
||||
const index = selectedEmployees.value.indexOf(employeeId);
|
||||
if (index !== -1) {
|
||||
selectedEmployees.value.splice(index, 1);
|
||||
} else {
|
||||
selectedEmployees.value.push(employeeId);
|
||||
}
|
||||
emit('update:modelValue', selectedEmployees.value);
|
||||
};
|
||||
|
||||
const handleSelectAll = () => {
|
||||
if (selectedEmployees.value.length === allEmployees.value.length) {
|
||||
selectedEmployees.value = [];
|
||||
} else {
|
||||
selectedEmployees.value = allEmployees.value.map(emp => emp.id);
|
||||
}
|
||||
emit('update:modelValue', selectedEmployees.value);
|
||||
};
|
||||
|
||||
return {
|
||||
selectedEmployees,
|
||||
allEmployeesgroupedbydep,
|
||||
onEmployeesChange,
|
||||
handleSelectAll,
|
||||
checkremote,
|
||||
spravURL,
|
||||
allEmployees
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -66,30 +66,7 @@ export default {
|
||||
},
|
||||
testingCard: {
|
||||
type: Array,
|
||||
default: () => [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
|
||||
type: 'test',
|
||||
description: 'Краткое описание тестирования',
|
||||
file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
dateend: new Date(),
|
||||
question_count: 20,
|
||||
time: 20,
|
||||
attemps_number: 3,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Удобство раздела тестирования',
|
||||
type: 'test',
|
||||
description: 'Опрос среди сотрудников ЦОД МФ',
|
||||
file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
||||
dateend: new Date(),
|
||||
question_count: 28,
|
||||
time: 15,
|
||||
attemps_number: 1,
|
||||
},
|
||||
],
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div v-if="question.settings.choice === 'free'">
|
||||
<transition-group name="list" tag="div">
|
||||
<div
|
||||
v-for="(answer, aIndex) in question.answers"
|
||||
:key="aIndex"
|
||||
class="d-flex align-start mb-4"
|
||||
>
|
||||
<!-- Показываем иконку для переключения статуса только если роут содержит "test" -->
|
||||
<v-btn
|
||||
v-if="isTestRoute"
|
||||
class="ml-2"
|
||||
icon
|
||||
size="small"
|
||||
@click="toggleCorrect(answer)"
|
||||
>
|
||||
<v-icon color="green" v-if="answer.correct" large>mdi-check</v-icon>
|
||||
<v-icon color="red" v-else large>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
|
||||
<v-text-field
|
||||
v-model="answer.text"
|
||||
:label="'Ответ ' + (aIndex + 1)"
|
||||
:rules="[rules.required]"
|
||||
class="mr-4"
|
||||
density="compact"
|
||||
variant="outlined"
|
||||
></v-text-field>
|
||||
|
||||
<v-file-input
|
||||
v-model="answer.image"
|
||||
accept="image/*"
|
||||
dense
|
||||
density="compact"
|
||||
hide-details
|
||||
label="Картинка"
|
||||
variant="outlined"
|
||||
></v-file-input>
|
||||
|
||||
<v-btn
|
||||
class="ms-1"
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="removeAnswer(aIndex)"
|
||||
></v-btn>
|
||||
</div>
|
||||
</transition-group>
|
||||
<div class="d-flex justify-start">
|
||||
<v-btn color="teal-darken-4" size="small" @click="addAnswer">
|
||||
Добавить ответ
|
||||
</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
export default {
|
||||
name: 'AnswerList',
|
||||
props: {
|
||||
question: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
rules: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
addAnswer: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
removeAnswer: {
|
||||
type: Function,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const route = useRoute();
|
||||
|
||||
const isTestRoute = computed(() => {
|
||||
return route.path && String(route.path).includes('test');
|
||||
});
|
||||
|
||||
const toggleCorrect = (answer) => {
|
||||
answer.correct = !answer.correct;
|
||||
};
|
||||
|
||||
return {
|
||||
isTestRoute,
|
||||
toggleCorrect,
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<v-card class="d-flex flex-column flex-grow-1 flex-shrink-0 text-center pa-8" flat>
|
||||
<v-spacer></v-spacer>
|
||||
<div class>
|
||||
<v-icon color="success" size="48">mdi-check-circle</v-icon>
|
||||
<h2 class="mt-4">Голосование создано!</h2>
|
||||
<slot></slot>
|
||||
</div>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
</script>
|
||||
@@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<v-card class="fill-height d-flex flex-column" flat>
|
||||
<v-card-title>Основная информация</v-card-title>
|
||||
<v-card-text class="d-flex flex-column overflow-auto">
|
||||
<v-text-field
|
||||
v-model="localForm.title"
|
||||
:rules="[rules.required]"
|
||||
class="flex-grow-0 flex-shrink-1"
|
||||
label="Название"
|
||||
variant="underlined"
|
||||
></v-text-field>
|
||||
<div class="flex-grow-1 flex-shrink-0">
|
||||
<v-textarea
|
||||
v-model="localForm.description"
|
||||
:rules="[rules.required]"
|
||||
label="Описание"
|
||||
variant="outlined"
|
||||
></v-textarea>
|
||||
</div>
|
||||
<v-divider></v-divider>
|
||||
<div class="flex-grow-0 flex-shrink-1">
|
||||
<div class="pt-2 d-flex align-center">
|
||||
<span class="text-overline text-grey text-center">Публикация новости: </span>
|
||||
<v-switch
|
||||
v-model="localForm.createnews"
|
||||
class="px-2"
|
||||
density="comfortable"
|
||||
hide-details
|
||||
color="primary"
|
||||
:label="localForm.createnews ? 'да' : 'нет'"
|
||||
></v-switch>
|
||||
</div>
|
||||
<div class="pt-2 d-flex align-center" v-if="isTestRoute">
|
||||
<span class="text-overline text-grey text-center">Назначить: </span>
|
||||
<v-switch
|
||||
v-model="localForm.appoint"
|
||||
class="px-2"
|
||||
density="comfortable"
|
||||
hide-details
|
||||
color="primary"
|
||||
:label="localForm.appoint ? 'да' : 'нет'"
|
||||
></v-switch>
|
||||
<SearcEmployess v-if="localForm.appoint" />
|
||||
</div>
|
||||
<div class="pt-2 text-overline text-grey">Дата и время:</div>
|
||||
<div class="d-flex justify-space-around">
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">начало:</h6>
|
||||
<date-select :datedefault="form.startDate" @returndate="returnstart" />
|
||||
<v-select
|
||||
v-model="selectedTimeStart"
|
||||
:items="timeOptions"
|
||||
density="compact"
|
||||
hide-details
|
||||
variant="plain"
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon color="red" icon="mdi-timer" size="xsmall"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">окончание:</h6>
|
||||
<date-select :datedefault="form.endDate" @returndate="returnend" />
|
||||
<v-select
|
||||
v-model="selectedTimeEnd"
|
||||
:items="timeOptions"
|
||||
density="compact"
|
||||
hide-details
|
||||
outlined
|
||||
variant="plain"
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon color="red" icon="mdi-timer" size="xsmall"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<slot></slot>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DateSelect from '@/components/UI/date-select.vue';
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { checkremote } from '@/utils/universal_functions.js';
|
||||
import { spravURL } from '@/utils/axios-api.js';
|
||||
import { useRoute } from 'vue-router';
|
||||
import SearcEmployess from '@/components/UI/SearcEmployess.vue';
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
spravURL() {
|
||||
return spravURL
|
||||
}, checkremote },
|
||||
components: { SearcEmployess, DateSelect },
|
||||
props: {
|
||||
form: Object,
|
||||
rules: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
required: (value) => !!value || 'Это поле обязательно для заполнения',
|
||||
}),
|
||||
},
|
||||
},
|
||||
emits: ['update:form'],
|
||||
setup(props, { emit }) {
|
||||
const route = useRoute();
|
||||
const isTestRoute = computed(() => {
|
||||
return route.path && String(route.path).includes('test');
|
||||
});
|
||||
// Если form не передан, создаём объект с дефолтными значениями
|
||||
const localForm = ref(
|
||||
props.form
|
||||
? { ...props.form }
|
||||
: {
|
||||
title: '',
|
||||
description: '',
|
||||
createnews: false,
|
||||
appoint: false,
|
||||
startDate: new Date(),
|
||||
endDate: new Date(),
|
||||
}
|
||||
);
|
||||
|
||||
// Отправляем изменения в родителя
|
||||
watch(
|
||||
localForm,
|
||||
(newForm) => {
|
||||
emit('update:form', newForm);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const returnstart = (date) => {
|
||||
localForm.value.startDate =
|
||||
date instanceof Date ? date : new Date(date);
|
||||
};
|
||||
|
||||
const returnend = (date) => {
|
||||
localForm.value.endDate =
|
||||
date instanceof Date ? date : new Date(date);
|
||||
};
|
||||
|
||||
const formatTime = (date) =>
|
||||
date instanceof Date ? date.toTimeString().slice(0, 5) : '00:00';
|
||||
|
||||
const selectedTimeStart = computed({
|
||||
get: () => formatTime(localForm.value.startDate),
|
||||
set: (newTime) => {
|
||||
const [hours, minutes] = newTime.split(':').map(Number);
|
||||
const oldDate =
|
||||
localForm.value.startDate instanceof Date
|
||||
? localForm.value.startDate
|
||||
: new Date();
|
||||
const newDate = new Date(oldDate); // создаём новый объект с копией даты
|
||||
newDate.setHours(hours, minutes, 0, 0);
|
||||
localForm.value.startDate = newDate;
|
||||
},
|
||||
});
|
||||
|
||||
const selectedTimeEnd = computed({
|
||||
get: () => formatTime(localForm.value.endDate),
|
||||
set: (newTime) => {
|
||||
const [hours, minutes] = newTime.split(':').map(Number);
|
||||
const oldDate =
|
||||
localForm.value.endDate instanceof Date ? localForm.value.endDate : new Date();
|
||||
const newDate = new Date(oldDate);
|
||||
newDate.setHours(hours, minutes, 0, 0);
|
||||
localForm.value.endDate = newDate;
|
||||
},
|
||||
});
|
||||
|
||||
const timeOptions = Array.from({ length: 48 }, (_, i) => {
|
||||
const hours = String(Math.floor(i / 2)).padStart(2, '0');
|
||||
const minutes = i % 2 === 0 ? '00' : '30';
|
||||
return `${hours}:${minutes}`;
|
||||
});
|
||||
|
||||
return {
|
||||
localForm,
|
||||
returnstart,
|
||||
returnend,
|
||||
selectedTimeStart,
|
||||
selectedTimeEnd,
|
||||
timeOptions,
|
||||
isTestRoute
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<transition-group name="list" tag="div">
|
||||
<QuestionItem
|
||||
v-for="(question, index) in form.questions"
|
||||
:key="index"
|
||||
:allEmployees="allEmployees"
|
||||
:allEmployeesgroupedbydep="allEmployeesgroupedbydep"
|
||||
:checkremote="checkremote"
|
||||
:findEmployeeById="findEmployeeById"
|
||||
:handleSelectAll="handleSelectAll"
|
||||
:index="index"
|
||||
:onEmployeesChange="onEmployeesChange"
|
||||
:onlyDepdict="onlyDepdict"
|
||||
:question="question"
|
||||
:questionTypes="questionTypes"
|
||||
:removeQuestion="removeQuestion"
|
||||
:rules="rules"
|
||||
:spravURL="spravURL"
|
||||
@update:question="form.questions[index] = $event"
|
||||
/>
|
||||
</transition-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
import { checkremote } from '@/utils/universal_functions';
|
||||
import { spravURL } from '@/utils/axios-api';
|
||||
import QuestionItem from '@/components/vote/ConstructorVote/QuestionItem.vue';
|
||||
|
||||
export default {
|
||||
components: { QuestionItem },
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
rules: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
required: (value) => !!value || 'Это поле обязательно для заполнения',
|
||||
}),
|
||||
},
|
||||
quests: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
allEmployees: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
allEmployeesgroupedbydep: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
handleSelectAll: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
onEmployeesChange: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
findEmployeeById: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
onlyDepdict: {
|
||||
type: Array,
|
||||
},
|
||||
},
|
||||
emits: ['update:form'],
|
||||
setup(props, { emit }) {
|
||||
const localForm = computed({
|
||||
get() {
|
||||
return props.form;
|
||||
},
|
||||
set(newForm) {
|
||||
emit('update:form', newForm);
|
||||
},
|
||||
});
|
||||
|
||||
const questionTypes = [
|
||||
{ name: 'Ввести вручную', choice: 'free' },
|
||||
{ name: 'Выбрать сотрудника', choice: 'employee' },
|
||||
];
|
||||
|
||||
const updateQuest = (index) => {
|
||||
const updatedQuests = [...props.quests];
|
||||
updatedQuests[index] = localForm.value.questions[index].text.trim().length > 0;
|
||||
emit('update:quests', updatedQuests);
|
||||
};
|
||||
|
||||
const removeQuestion = (index) => {
|
||||
localForm.value.questions.splice(index, 1);
|
||||
};
|
||||
|
||||
const addAnswer = (index) => {
|
||||
const updatedQuestions = [...localForm.value.questions];
|
||||
updatedQuestions[index] = {
|
||||
...updatedQuestions[index],
|
||||
answers: [...updatedQuestions[index].answers, { text: '', image: null }],
|
||||
};
|
||||
localForm.value = { ...localForm.value, questions: updatedQuestions };
|
||||
};
|
||||
|
||||
const removeAnswer = (qIndex, aIndex) => {
|
||||
const updatedQuestions = [...localForm.value.questions];
|
||||
updatedQuestions[qIndex] = {
|
||||
...updatedQuestions[qIndex],
|
||||
answers: updatedQuestions[qIndex].answers.filter((_, i) => i !== aIndex),
|
||||
};
|
||||
localForm.value = { ...localForm.value, questions: updatedQuestions };
|
||||
};
|
||||
|
||||
return {
|
||||
localForm,
|
||||
questionTypes,
|
||||
updateQuest,
|
||||
removeQuestion,
|
||||
addAnswer,
|
||||
removeAnswer,
|
||||
checkremote,
|
||||
spravURL,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="d-flex">
|
||||
<v-text-field
|
||||
v-model="localQuestion.text"
|
||||
:label="'Вопрос ' + (index + 1)"
|
||||
:rules="[rules.required]"
|
||||
density="comfortable"
|
||||
variant="underlined"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<v-btn
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="removeQuestion(index)"
|
||||
/>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
question: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
rules: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
removeQuestion: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const localQuestion = computed({
|
||||
get() {
|
||||
return props.question;
|
||||
},
|
||||
set(newValue) {
|
||||
emit('update:question', newValue);
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
localQuestion,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<div class="question-item mb-4">
|
||||
<!-- Заголовок вопроса: текстовое поле с кнопкой удаления -->
|
||||
<QuestionHeader :question="question" :rules="rules" :index="index" :removeQuestion="removeQuestion" />
|
||||
|
||||
<!-- Загрузка изображения для вопроса -->
|
||||
<v-file-input
|
||||
v-model="question.image"
|
||||
accept="image/*"
|
||||
density="comfortable"
|
||||
label="Картинка для вопроса"
|
||||
variant="outlined"
|
||||
></v-file-input>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<!-- Настройки вопроса -->
|
||||
<QuestionSettings :question="question" :rules="rules" :question-types="questionTypes" :resetAnswers="resetAnswers" v-if="!isTestRoute" />
|
||||
|
||||
<!-- Ответы или выбор сотрудников в зависимости от типа ответа -->
|
||||
<v-card-text class="px-0">
|
||||
<!-- Для типа "free" – ручной ввод ответов -->
|
||||
<AnswerList v-if="question.settings.choice === 'free'" :rules="rules" :question="question" :remove-answer="removeAnswer" :add-answer="addAnswer" />
|
||||
|
||||
<!-- Для типа "employee" – выбор сотрудников -->
|
||||
<div v-else>
|
||||
<div class="v-row">
|
||||
<v-radio-group
|
||||
v-model="question.settings.onlyDep"
|
||||
class="text-caption"
|
||||
inline
|
||||
>
|
||||
<template v-slot:label>
|
||||
<div class="text-body-2 font-weight-bold">
|
||||
Голосование по отделам:
|
||||
</div>
|
||||
</template>
|
||||
<v-radio
|
||||
v-for="x in onlyDepdict"
|
||||
:key="x.name"
|
||||
:value="x.value"
|
||||
>
|
||||
<template v-slot:label>
|
||||
<div class="text-caption">{{ x.name }}</div>
|
||||
</template>
|
||||
</v-radio>
|
||||
</v-radio-group>
|
||||
</div>
|
||||
<v-autocomplete
|
||||
v-model="question.selectedEmployees"
|
||||
:items="allEmployeesgroupedbydep"
|
||||
class="text-no-wrap"
|
||||
density="compact"
|
||||
item-title="fio"
|
||||
item-value="id"
|
||||
label="Выберите сотрудников"
|
||||
multiple
|
||||
variant="outlined"
|
||||
@update:model-value="onEmployeeUpdate"
|
||||
>
|
||||
<template #prepend-item>
|
||||
<v-checkbox
|
||||
:model-value="(question.selectedEmployees?.length || 0) === allEmployees.length"
|
||||
class="pa-0"
|
||||
label="Все"
|
||||
@update:model-value="toggleSelectAll"
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<template #selection="{ item }">
|
||||
<v-chip
|
||||
:prepend-avatar="checkremote(`${spravURL}${item.raw.login}.jpg`)"
|
||||
>
|
||||
{{ item.raw.familyname }}
|
||||
</v-chip>
|
||||
</template>
|
||||
<template #item="data">
|
||||
<template v-if="typeof data.item.raw !== 'object'">
|
||||
<v-divider />
|
||||
<v-list-group
|
||||
class="pa-4 text-overline text-grey"
|
||||
v-text="data.item.raw"
|
||||
></v-list-group>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-list-item
|
||||
:append-avatar="checkremote(`${spravURL}${data.item.raw.login}.jpg`)"
|
||||
density="compact"
|
||||
slim
|
||||
@click="onEmployeesChange(data.item.raw.id)"
|
||||
>
|
||||
<template #prepend>
|
||||
<v-checkbox
|
||||
:model-value="question.selectedEmployees.includes(data.item.raw.id)"
|
||||
density="compact"
|
||||
hide-details
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<v-list-item-title
|
||||
class="text-third"
|
||||
v-text="data.item.raw.fio"
|
||||
></v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<transition-group name="list" tag="div">
|
||||
<div
|
||||
v-for="(person, pIndex) in question.answers"
|
||||
:key="person"
|
||||
class="v-row align-center mb-4"
|
||||
>
|
||||
<v-col class="py-0" cols="7">
|
||||
<v-chip
|
||||
:prepend-avatar="checkremote(`${spravURL}${findEmployeeById(person.text)?.login}.jpg`)"
|
||||
>
|
||||
{{ findEmployeeById(person.text)?.fio }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
<v-col class="py-0 d-flex" cols="5">
|
||||
<v-file-input
|
||||
v-model="person.image"
|
||||
accept="image/*"
|
||||
dense
|
||||
density="compact"
|
||||
hide-details
|
||||
label="Картинка"
|
||||
variant="outlined"
|
||||
></v-file-input>
|
||||
<v-btn
|
||||
class="ms-1"
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="removeEmployeeAnswer(pIndex)"
|
||||
></v-btn>
|
||||
</v-col>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QuestionHeader from '@/components/vote/ConstructorVote/QuestionHeader.vue';
|
||||
import QuestionSettings from '@/components/vote/ConstructorVote/QuestionSettings.vue';
|
||||
import AnswerList from '@/components/vote/ConstructorVote/AnswerList.vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
export default {
|
||||
name: 'QuestionItem',
|
||||
components: { AnswerList, QuestionSettings, QuestionHeader },
|
||||
props: {
|
||||
question: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
rules: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
questionTypes: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
onlyDepdict: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
allEmployees: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
allEmployeesgroupedbydep: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
handleSelectAll: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
onEmployeesChange: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
findEmployeeById: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
checkremote: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
spravURL: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
removeQuestion: {
|
||||
type: Function,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
emits: ['update:question'],
|
||||
setup(props, { emit }) {
|
||||
const route = useRoute();
|
||||
|
||||
const resetAnswers = () => {
|
||||
props.question.answers = [];
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const addAnswer = () => {
|
||||
props.question.answers.push({ text: '', image: null });
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const removeAnswer = (aIndex) => {
|
||||
props.question.answers.splice(aIndex, 1);
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const onEmployeeUpdate = (selected) => {
|
||||
props.question.answers = props.question.answers.filter((e) =>
|
||||
selected.includes(e.text)
|
||||
);
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const toggleSelectAll = (value) => {
|
||||
props.handleSelectAll(value, props.index);
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const removeEmployeeAnswer = (pIndex) => {
|
||||
props.question.selectedEmployees.splice(pIndex, 1);
|
||||
props.question.answers.splice(pIndex, 1);
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const onEmployeesChange = (employeeId) => {
|
||||
props.onEmployeesChange(employeeId, props.index);
|
||||
emit('update:question', props.question);
|
||||
};
|
||||
|
||||
const isTestRoute = computed(() => {
|
||||
return route.path && String(route.path).includes('test');
|
||||
});
|
||||
|
||||
return {
|
||||
resetAnswers,
|
||||
addAnswer,
|
||||
removeAnswer,
|
||||
onEmployeeUpdate,
|
||||
toggleSelectAll,
|
||||
removeEmployeeAnswer,
|
||||
onEmployeesChange,
|
||||
isTestRoute
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<div class="py-2 text-overline text-grey">Настройки вопроса</div>
|
||||
<div class="v-row">
|
||||
<v-col class="align-self-center font-weight-bold py-0" cols="auto">
|
||||
Тип ответа
|
||||
</v-col>
|
||||
<v-col class="py-0 align-self-center" cols="3">
|
||||
<v-select
|
||||
v-model="question.settings.choice"
|
||||
:items="questionTypes"
|
||||
:list-props="{ density: 'compact' }"
|
||||
density="compact"
|
||||
hide-details
|
||||
item-title="name"
|
||||
item-value="choice"
|
||||
label=""
|
||||
variant="outlined"
|
||||
@update:model-value="resetAnswers"
|
||||
></v-select>
|
||||
</v-col>
|
||||
<v-spacer />
|
||||
<v-col class="align-self-center font-weight-bold" cols="auto" >
|
||||
Число возможных ответов
|
||||
</v-col>
|
||||
<v-col cols="1" >
|
||||
<v-text-field
|
||||
v-model="question.settings.multiChoice"
|
||||
:rules="[rules.required && question.settings.multiChoice > 0]"
|
||||
density="compact"
|
||||
hide-details
|
||||
min="1"
|
||||
type="number"
|
||||
variant="outlined"
|
||||
></v-text-field>
|
||||
</v-col>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
question: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
rules: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
questionTypes: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
resetAnswers:{
|
||||
type: Function,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,21 +1,13 @@
|
||||
<template>
|
||||
<v-row class="pt-2 mx-1 flex-column fill-height flex-grow-0">
|
||||
<template v-if="isVoteCreated">
|
||||
<v-card class="d-flex flex-column flex-grow-1 flex-shrink-0 text-center pa-8" flat>
|
||||
<v-spacer></v-spacer>
|
||||
<div class>
|
||||
<v-icon color="success" size="48">mdi-check-circle</v-icon>
|
||||
<h2 class="mt-4">Голосование создано!</h2>
|
||||
<v-btn class="mt-4" color="teal-darken-4" @click="resetForm">Создать ещё</v-btn>
|
||||
</div>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card>
|
||||
</template>
|
||||
<CreatedVote v-if="isVoteCreated">
|
||||
<v-btn class="mt-4" color="teal-darken-4" @click="resetForm">Создать ещё</v-btn>
|
||||
</CreatedVote>
|
||||
<template v-else>
|
||||
<div class="v-col flex-grow-1 flex-shrink-0">
|
||||
<v-stepper v-model="step" class="d-flex flex-column fill-height" editable>
|
||||
<v-stepper-header class="flex-grow-0 flex-shrink-1">
|
||||
<v-stepper-item :complete="step > 0" step="1">Основная информация </v-stepper-item>
|
||||
<v-stepper-item :complete="step > 0" step="1">Основная информация</v-stepper-item>
|
||||
<v-divider></v-divider>
|
||||
<v-stepper-item :complete="step > 1" step="2">Создание опроса</v-stepper-item>
|
||||
<v-divider></v-divider>
|
||||
@@ -25,78 +17,11 @@
|
||||
<v-stepper-window class="fill-height">
|
||||
<!-- Основная информация -->
|
||||
<v-stepper-window-item class="fill-height" step="1">
|
||||
<v-card class="fill-height d-flex flex-column" flat>
|
||||
<v-card-title>Основная информация</v-card-title>
|
||||
<v-card-text class="d-flex flex-column overflow-auto">
|
||||
<v-text-field
|
||||
v-model="form.title"
|
||||
:rules="[rules.required]"
|
||||
class="flex-grow-0 flex-shrink-1"
|
||||
label="Название голосования"
|
||||
variant="underlined"
|
||||
></v-text-field>
|
||||
<div class="flex-grow-1 flex-shrink-0">
|
||||
<v-textarea
|
||||
v-model="form.description"
|
||||
:rules="[rules.required]"
|
||||
label="Описание"
|
||||
variant="outlined"
|
||||
></v-textarea>
|
||||
</div>
|
||||
<v-divider></v-divider>
|
||||
<div class="flex-grow-0 flex-shrink-1">
|
||||
<div class="pt-2 d-flex align-center">
|
||||
<span class="text-overline text-grey text-center">Публикация новости: </span>
|
||||
<v-switch
|
||||
v-model="form.createnews"
|
||||
class="px-2"
|
||||
density="comfortable"
|
||||
hide-details
|
||||
color="primary"
|
||||
:label="form.createnews ? 'да' : 'нет'"
|
||||
></v-switch>
|
||||
</div>
|
||||
<div class="pt-2 text-overline text-grey">Дата и время:</div>
|
||||
<div class="d-flex justify-space-around">
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">начало:</h6>
|
||||
<date-select :datedefault="form.startDate" @returndate="returnstart" />
|
||||
<v-select
|
||||
v-model="selectedTimeStart"
|
||||
:items="timeOptions"
|
||||
density="compact"
|
||||
hide-details
|
||||
variant="plain"
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon color="red" icon="mdi-timer" size="xsmall"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
<div class="d-flex ga-3 align-center">
|
||||
<h6 class="text-subtitle-1 pt-2">окончание:</h6>
|
||||
<date-select :datedefault="form.endDate" @returndate="returnend" />
|
||||
<v-select
|
||||
v-model="selectedTimeEnd"
|
||||
:items="timeOptions"
|
||||
density="compact"
|
||||
hide-details
|
||||
outlined
|
||||
variant="plain"
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon color="red" icon="mdi-timer" size="xsmall"></v-icon>
|
||||
</template>
|
||||
</v-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
<MainInfo v-model:form="form" :rules="rules">
|
||||
<v-card-actions>
|
||||
<v-btn color="teal-darken-4" size="medium" @click="step = 1">Далее</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</MainInfo>
|
||||
</v-stepper-window-item>
|
||||
|
||||
<!-- Создание опроса -->
|
||||
@@ -104,261 +29,23 @@
|
||||
<v-card class="fill-height d-flex flex-column" flat>
|
||||
<v-card-title>Создание опроса:</v-card-title>
|
||||
<v-card-text style="max-height: 62vh; overflow-y: auto">
|
||||
<transition-group name="list" tag="div">
|
||||
<div v-for="(question, index) in form.questions" :key="index" class="mb-4">
|
||||
<div class="d-flex">
|
||||
<!-- <v-text-field v-model="question.text" :label="'Вопрос ' + (index + 1)" :rules="[rules.required]"-->
|
||||
<!-- density="comfortable" variant="underlined">-->
|
||||
<v-text-field
|
||||
v-model="question.text"
|
||||
:label="'Вопрос ' + (index + 1)"
|
||||
density="comfortable"
|
||||
variant="underlined"
|
||||
:rules="[rules.required]"
|
||||
@input="updateQuest(index)"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<v-btn
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="removeQuestion(index)"
|
||||
/>
|
||||
</template>
|
||||
</v-text-field>
|
||||
</div>
|
||||
<v-file-input
|
||||
v-model="question.image"
|
||||
accept="image/*"
|
||||
density="comfortable"
|
||||
label="Картинка для вопроса"
|
||||
variant="outlined"
|
||||
></v-file-input>
|
||||
<v-divider></v-divider>
|
||||
<div class="py-2 text-overline text-grey">Настройки вопроса</div>
|
||||
<div class="v-row">
|
||||
<v-col class="align-self-center font-weight-bold py-0" cols="auto">
|
||||
Тип ответа
|
||||
</v-col>
|
||||
<v-col class="py-0 align-self-center" cols="3">
|
||||
<v-select
|
||||
v-model="question.settings.choice"
|
||||
:items="questionTypes"
|
||||
:list-props="{ density: 'compact' }"
|
||||
density="compact"
|
||||
hide-details
|
||||
item-title="name"
|
||||
item-value="choice"
|
||||
label=""
|
||||
variant="outlined"
|
||||
@update:model-value="question.answers = []"
|
||||
></v-select>
|
||||
<!-- choice -->
|
||||
</v-col>
|
||||
<v-spacer />
|
||||
<v-col class="align-self-center font-weight-bold" cols="auto">
|
||||
Число возможных ответов
|
||||
</v-col>
|
||||
<v-col class="" cols="1">
|
||||
<v-text-field
|
||||
v-model="question.settings.multiChoice"
|
||||
:rules="[rules.required && question.settings.multiChoice > 0]"
|
||||
density="compact"
|
||||
hide-details
|
||||
min="1"
|
||||
type="number"
|
||||
variant="outlined"
|
||||
>
|
||||
<template v-slot:prepend> </template>
|
||||
</v-text-field>
|
||||
</v-col>
|
||||
</div>
|
||||
<div class="v-row"></div>
|
||||
|
||||
<v-card-text class="px-0">
|
||||
<div v-if="question.settings.choice === 'free'">
|
||||
<transition-group name="list" tag="div">
|
||||
<div
|
||||
v-for="(answer, ind) in question.answers"
|
||||
:key="ind"
|
||||
class="d-flex align-start mb-4"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="answer.text"
|
||||
:label="'Ответ ' + (ind + 1)"
|
||||
:rules="[rules.required]"
|
||||
class="mr-4"
|
||||
density="compact"
|
||||
variant="outlined"
|
||||
>
|
||||
</v-text-field>
|
||||
<v-file-input
|
||||
v-model="answer.image"
|
||||
accept="image/*"
|
||||
dense
|
||||
density="compact"
|
||||
hide-details
|
||||
label="Картинка"
|
||||
variant="outlined"
|
||||
>
|
||||
</v-file-input>
|
||||
<v-btn
|
||||
class="ms-1"
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="removeAnswer(index, ind)"
|
||||
>
|
||||
</v-btn>
|
||||
</div>
|
||||
</transition-group>
|
||||
<div class="d-flex justify-start">
|
||||
<v-btn color="teal-darken-4" size="small" @click="addAnswer(index)"
|
||||
>Добавить ответ</v-btn
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="v-row">
|
||||
<v-radio-group
|
||||
v-model="question.settings.onlyDep"
|
||||
class="text-caption"
|
||||
inline
|
||||
>
|
||||
<template v-slot:label>
|
||||
<div class="text-body-2 font-weight-bold">
|
||||
Голосование по отделам:
|
||||
</div>
|
||||
</template>
|
||||
<v-radio v-for="x in onlyDepdict" :key="x.name" :value="x.value">
|
||||
<template v-slot:label>
|
||||
<div class="text-caption">{{ x.name }}</div>
|
||||
</template>
|
||||
</v-radio>
|
||||
</v-radio-group>
|
||||
</div>
|
||||
<v-autocomplete
|
||||
v-model="question.selectedEmployees"
|
||||
:items="allEmployeesgroupedbydep"
|
||||
class="text-no-wrap"
|
||||
density="compact"
|
||||
item-title="fio"
|
||||
item-value="id"
|
||||
label="Выберите сотрудников"
|
||||
multiple
|
||||
variant="outlined"
|
||||
@update:model-value="
|
||||
(selected) =>
|
||||
(question.answers = question.answers.filter((e) =>
|
||||
selected.includes(e.text),
|
||||
))
|
||||
"
|
||||
>
|
||||
<template #prepend-item>
|
||||
<v-checkbox
|
||||
:model-value="
|
||||
question.selectedEmployees.length === allEmployees.length
|
||||
"
|
||||
class="pa-0"
|
||||
label="Все"
|
||||
@update:model-value="
|
||||
handleSelectAll(
|
||||
question.selectedEmployees.length === allEmployees.length,
|
||||
index,
|
||||
)
|
||||
"
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<template #selection="{ item }">
|
||||
<v-chip
|
||||
:prepend-avatar="checkremote(`${spravURL}${item.raw.login}.jpg`)"
|
||||
>
|
||||
{{ item.raw.familyname }}
|
||||
</v-chip>
|
||||
</template>
|
||||
<template #item="data">
|
||||
<template v-if="typeof data.item.raw !== 'object'">
|
||||
<v-divider />
|
||||
<v-list-group
|
||||
class="pa-4 text-overline text-grey"
|
||||
v-text="data.item.raw"
|
||||
></v-list-group>
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-list-item
|
||||
:append-avatar="
|
||||
checkremote(`${spravURL}${data.item.raw.login}.jpg`)
|
||||
"
|
||||
density="compact"
|
||||
slim
|
||||
@click="onEmployeesChange(data.item.raw.id, index)"
|
||||
>
|
||||
<template #prepend>
|
||||
<v-checkbox
|
||||
:model-value="
|
||||
question.selectedEmployees.includes(data.item.raw.id)
|
||||
"
|
||||
density="compact"
|
||||
hide-details
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<v-list-item-title
|
||||
class="text-third"
|
||||
v-text="data.item.raw.fio"
|
||||
></v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<transition-group name="list" tag="div">
|
||||
<div
|
||||
v-for="(person, ind) in question.answers"
|
||||
:key="person"
|
||||
class="v-row align-center mb-4"
|
||||
>
|
||||
<v-col class="py-0" cols="7">
|
||||
<v-chip
|
||||
:prepend-avatar="
|
||||
checkremote(
|
||||
`${spravURL}${findEmployeeById(person.text)?.login}.jpg`,
|
||||
)
|
||||
"
|
||||
:text="findEmployeeById(person.text)?.fio"
|
||||
>
|
||||
</v-chip>
|
||||
</v-col>
|
||||
<v-col class="py-0 d-flex" cols="5">
|
||||
<v-file-input
|
||||
v-model="person.image"
|
||||
accept="image/*"
|
||||
dense
|
||||
density="compact"
|
||||
hide-details
|
||||
label="Картинка"
|
||||
variant="outlined"
|
||||
></v-file-input>
|
||||
<v-btn
|
||||
class="ms-1"
|
||||
color="error"
|
||||
icon="mdi-delete"
|
||||
size="small"
|
||||
@click="
|
||||
question.selectedEmployees.splice(ind, 1);
|
||||
removeAnswer(index, ind);
|
||||
"
|
||||
>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</transition-group>
|
||||
<NewQuestion
|
||||
:form="form"
|
||||
:rules="rules"
|
||||
:quests="quests"
|
||||
@update:form="val => form.value = val"
|
||||
:allEmployees="allEmployees"
|
||||
:allEmployeesgroupedbydep="allEmployeesgroupedbydep"
|
||||
:handleSelectAll="handleSelectAll"
|
||||
:onEmployeesChange="onEmployeesChange"
|
||||
:findEmployeeById="findEmployeeById"
|
||||
:onlyDepdict="onlyDepdict"
|
||||
/>
|
||||
<v-divider class="ma-2 pa-1"></v-divider>
|
||||
<div class="d-flex justify-center">
|
||||
<v-btn color="orange-darken-4" size="small" @click="addQuestion"
|
||||
>Добавить вопрос</v-btn
|
||||
>Добавить вопрос
|
||||
</v-btn
|
||||
>
|
||||
</div>
|
||||
</v-card-text>
|
||||
@@ -377,7 +64,6 @@
|
||||
<v-alert v-if="errorMessage" class="mb-4" type="error">
|
||||
{{ errorMessage }}
|
||||
</v-alert>
|
||||
|
||||
<p>
|
||||
<v-icon
|
||||
:class="form.title === null || form.title.length === 0 ? '' : 'opacity-0'"
|
||||
@@ -454,7 +140,7 @@
|
||||
<v-card-actions>
|
||||
<v-btn color="teal-darken-4" size="medium" @click="step -= 1">Назад</v-btn>
|
||||
<v-btn
|
||||
:disabled="errorMessage != ''"
|
||||
:disabled="errorMessage !== ''"
|
||||
color="teal-darken-4"
|
||||
size="medium"
|
||||
@click="saveVoting"
|
||||
@@ -473,12 +159,14 @@
|
||||
|
||||
<script>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { createVote, getEmployees, spravURL } from '@/utils/axios-api';
|
||||
import { createVote, getEmployees } from '@/utils/axios-api';
|
||||
import DateSelect from '@/components/UI/date-select.vue';
|
||||
import { checkremote } from '@/utils/universal_functions';
|
||||
import MainInfo from '@/components/vote/ConstructorVote/MainInfo.vue';
|
||||
import CreatedVote from '@/components/vote/ConstructorVote/CreatedVote.vue';
|
||||
import NewQuestion from '@/components/vote/ConstructorVote/NewQuestion.vue';
|
||||
|
||||
export default {
|
||||
components: { DateSelect },
|
||||
components: { NewQuestion, CreatedVote, MainInfo, DateSelect },
|
||||
emits: ['updating'],
|
||||
setup(props, { emit }) {
|
||||
const step = ref(0);
|
||||
@@ -490,6 +178,7 @@ export default {
|
||||
endDate: new Date(new Date().setDate(new Date().getDate() + 14)),
|
||||
questions: [],
|
||||
createnews: false,
|
||||
appoint: false
|
||||
});
|
||||
|
||||
const rules = {
|
||||
@@ -497,10 +186,6 @@ export default {
|
||||
};
|
||||
|
||||
const currentQuestionIndex = ref(0);
|
||||
const questionTypes = [
|
||||
{ name: 'Ввести вручную', choice: 'free' },
|
||||
{ name: 'Выбрать сотрудника', choice: 'employee' },
|
||||
];
|
||||
|
||||
const groupedEmployees = ref([]);
|
||||
const allEmployees = computed(() => [...groupedEmployees.value]);
|
||||
@@ -560,10 +245,6 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
const updateQuest = (index) => {
|
||||
quests[index] = form.value.questions[index].text.length > 0;
|
||||
};
|
||||
|
||||
const addAnswer = (index) => {
|
||||
if (currentQuestion.value) {
|
||||
form.value.questions[index].answers.push({ text: '', image: null });
|
||||
@@ -601,12 +282,11 @@ export default {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await createVote(form.value);
|
||||
console.log('Голосование успешно создано:', response);
|
||||
await createVote(form.value);
|
||||
isVoteCreated.value = true;
|
||||
emit('updating', 'active');
|
||||
} catch (error) {
|
||||
console.error('Ошибка при создании голосования:', error);
|
||||
return new Error(error)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -622,20 +302,6 @@ export default {
|
||||
isVoteCreated.value = false;
|
||||
};
|
||||
|
||||
const timeOptions = Array.from({ length: 48 }, (_, i) => {
|
||||
const hours = String(Math.floor(i / 2)).padStart(2, '0');
|
||||
const minutes = i % 2 === 0 ? '00' : '30';
|
||||
return `${hours}:${minutes}`;
|
||||
});
|
||||
|
||||
const selectedTimeStart = ref(
|
||||
`${(form.value.startDate.getHours() + 1).toString().padStart(2, '0')}:00`,
|
||||
);
|
||||
|
||||
const selectedTimeEnd = ref(
|
||||
`${(form.value.endDate.getHours() + 1).toString().padStart(2, '0')}:00`,
|
||||
);
|
||||
|
||||
watch(
|
||||
form.value,
|
||||
() => {
|
||||
@@ -651,7 +317,6 @@ export default {
|
||||
watch(
|
||||
() => form.value.questions,
|
||||
(newQuestions) => {
|
||||
// Обновляем quests
|
||||
quests.value = newQuestions.map((q) => !!q.text.trim());
|
||||
|
||||
// Проверяем, есть ли пустые вопросы или невалидные ответы
|
||||
@@ -666,28 +331,6 @@ export default {
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
watch([selectedTimeStart, selectedTimeEnd], ([newStart, newEnd]) => {
|
||||
updateStartDate();
|
||||
updateEndDate();
|
||||
});
|
||||
|
||||
const updateStartDate = () => {
|
||||
const [hours, minutes] = selectedTimeStart.value.split(':').map(Number);
|
||||
form.value.startDate.setHours(hours, minutes);
|
||||
};
|
||||
const updateEndDate = () => {
|
||||
const [hours, minutes] = selectedTimeEnd.value.split(':').map(Number);
|
||||
form.value.endDate.setHours(hours, minutes);
|
||||
};
|
||||
|
||||
const returnstart = (dates) => {
|
||||
form.value.startDate = dates;
|
||||
};
|
||||
|
||||
const returnend = (dates) => {
|
||||
form.value.endDate = dates;
|
||||
};
|
||||
|
||||
const onEmployeesChange = (selected, index) => {
|
||||
let ind = form.value.questions[index].selectedEmployees.findIndex((e) => e === selected);
|
||||
if (ind > -1) {
|
||||
@@ -713,15 +356,11 @@ export default {
|
||||
|
||||
return {
|
||||
quests,
|
||||
updateQuest,
|
||||
onlyDepdict,
|
||||
allEmployeesgroupedbydep,
|
||||
onEmployeesChange,
|
||||
returnend,
|
||||
returnstart,
|
||||
step,
|
||||
form,
|
||||
questionTypes,
|
||||
addQuestion,
|
||||
removeQuestion,
|
||||
addAnswer,
|
||||
@@ -732,14 +371,9 @@ export default {
|
||||
resetForm,
|
||||
rules,
|
||||
errorMessage,
|
||||
timeOptions,
|
||||
selectedTimeStart,
|
||||
selectedTimeEnd,
|
||||
allEmployees,
|
||||
handleSelectAll,
|
||||
isAllSelected,
|
||||
checkremote,
|
||||
spravURL,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import StructureInspection from '@/components/about_inspection/structure/StructureInspection.vue';
|
||||
import ContactInfo from '@/components/about_inspection/contacts/ContactInfo.vue';
|
||||
import { pagecounter } from '@/utils/universal_functions';
|
||||
import PatternTabs from '@/components/UI/PatternTabs.vue';
|
||||
import GeneralInformation from '@/components/about_inspection/general_information/GeneralInformation.vue';
|
||||
import OpenVacancies from '@/components/about_inspection/open_vacancies/OpenVacancies.vue';
|
||||
import StructureInspection from "@/components/about_inspection/structure/StructureInspection.vue";
|
||||
import ContactInfo from "@/components/about_inspection/contacts/ContactInfo.vue";
|
||||
import { pagecounter } from "@/utils/universal_functions";
|
||||
import PatternTabs from "@/components/UI/PatternTabs.vue";
|
||||
import GeneralInformation from "@/components/about_inspection/general_information/GeneralInformation.vue";
|
||||
import OpenVacancies from "@/components/about_inspection/open_vacancies/OpenVacancies.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -38,10 +38,10 @@ export default {
|
||||
pagecounter();
|
||||
return {
|
||||
tabs_items: [
|
||||
{ title: 'Общая информация', value: 'mainInfo' },
|
||||
{ title: 'Структура инспекции', value: 'structureInspection' },
|
||||
{ title: 'Открытые вакансии', value: 'openVacancies' },
|
||||
{ title: 'Контактная информация', value: 'contactInfo' },
|
||||
{ title: "Общая информация", value: "mainInfo" },
|
||||
{ title: "Структура инспекции", value: "structureInspection" },
|
||||
{ title: "Открытые вакансии", value: "openVacancies" },
|
||||
{ title: "Контактная информация", value: "contactInfo" },
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
@@ -3,36 +3,53 @@
|
||||
<v-tabs v-model="activeTab" class="mx-2">
|
||||
<v-tab v-for="tab in tabs" :key="tab.value" :value="tab.value"> {{ tab.title }}</v-tab>
|
||||
</v-tabs>
|
||||
<v-tabs-window v-model="activeTab">
|
||||
<v-window v-model="activeTab">
|
||||
<!-- Вкладка назначенные -->
|
||||
<v-tabs-window-item class="my-2 w-75 mx-auto h-100">
|
||||
<v-window-item class="my-2 w-75 mx-auto h-100">
|
||||
<CatalogTest :activeTab="activeTab" :testingCard="getAllTests" title="Назначенные">
|
||||
<template #buttons>
|
||||
<v-btn class="mr-2 text-teal-darken-1" color="#00897B1F" elevation="0">
|
||||
Тренироваться
|
||||
|
||||
|
||||
</v-btn>
|
||||
<v-btn color="teal-darken-1" elevation="0"> Пройти</v-btn>
|
||||
</template>
|
||||
</CatalogTest>
|
||||
</v-tabs-window-item>
|
||||
</v-window-item>
|
||||
|
||||
<!-- Вкладка завершенных -->
|
||||
<v-tabs-window-item class="w-75 mx-auto">
|
||||
<v-window-item class="w-75 mx-auto">
|
||||
<CatalogTest :activeTab="activeTab" :testingCard="getAllTests" title="Завершенные">
|
||||
<!-- Здесь отобразить результат теста после того как будет готов БЭК и УМТ -->
|
||||
<template #results></template>
|
||||
<template #buttons>
|
||||
<v-btn class="mr-2 text-teal-darken-1" color="#00897B1F" elevation="0">
|
||||
Результаты
|
||||
</v-btn>
|
||||
</template>
|
||||
</CatalogTest>
|
||||
</v-tabs-window-item>
|
||||
</v-window-item>
|
||||
|
||||
<!-- Вкладка каталога -->
|
||||
<v-tabs-window-item class="w-75 mx-auto h-100">
|
||||
<CatalogTest :activeTab="activeTab" :testingCard="getAllTests" title="Каталог">
|
||||
<v-window-item class="w-75 mx-auto h-100">
|
||||
<CatalogTest :activeTab="activeTab" :testingCard="getAllTests" class="position-relative" title="Каталог">
|
||||
<template #buttons="{ cardValue }">
|
||||
<div v-if="accountStore.user.is_staff" class="d-flex position-absolute top-0 right-0">
|
||||
<v-btn
|
||||
class="mr-2 text-teal-darken-1"
|
||||
color="orange-darken-2"
|
||||
elevation="0"
|
||||
icon="mdi-account-plus"
|
||||
variant="text"
|
||||
@click="openAddDialog(cardValue.id)"
|
||||
/>
|
||||
<v-btn
|
||||
class="mr-2 indigo"
|
||||
color="red-darken-4"
|
||||
elevation="0"
|
||||
icon="mdi-delete"
|
||||
variant="text"
|
||||
@click="openDeleteDialog(cardValue.id)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<v-btn
|
||||
class="mr-2 text-teal-darken-1"
|
||||
color="#00897B1F"
|
||||
@@ -43,28 +60,73 @@
|
||||
</v-btn>
|
||||
</template>
|
||||
</CatalogTest>
|
||||
</v-tabs-window-item>
|
||||
</v-tabs-window>
|
||||
</v-window-item>
|
||||
|
||||
<!-- Конструктор -->
|
||||
<v-window-item>
|
||||
<VoteConstructor />
|
||||
</v-window-item>
|
||||
</v-window>
|
||||
|
||||
<!-- Модальное окно подтверждения удаления -->
|
||||
<v-dialog v-model="deleteDialog" max-width="400">
|
||||
<v-card>
|
||||
<v-card-title>Удалить тест?</v-card-title>
|
||||
<v-card-text>Вы уверены, что хотите удалить этот тест?</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn color="grey" @click="deleteDialog = false">Отмена</v-btn>
|
||||
<v-btn color="red-darken-4" >Удалить</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- Модальное окно добавления пользователя -->
|
||||
<v-dialog v-model="addDialog" max-width="800">
|
||||
<v-card>
|
||||
<v-card-title>Назначить сотруднику</v-card-title>
|
||||
<SearcEmployess />
|
||||
<v-card-actions>
|
||||
<v-spacer />
|
||||
<v-btn color="grey" @click="addDialog = false">Отмена</v-btn>
|
||||
<v-btn color="orange-darken-2" >Добавить</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CatalogTest from '@/components/testing/CatalogTest.vue';
|
||||
import { axiosApiInstance } from '@/utils/axios-api';
|
||||
|
||||
import { axiosApiInstance, getEmployees, spravURL } from '@/utils/axios-api';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VoteConstructor from '@/components/vote/VoteConstructor.vue';
|
||||
import { useAccountStore } from '@/store/AccountStore.js';
|
||||
import { checkremote } from '@/utils/universal_functions.js';
|
||||
import SearcEmployess from '@/components/UI/SearcEmployess.vue';
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
checkremote,
|
||||
spravURL() {
|
||||
return spravURL
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SearcEmployess,
|
||||
VoteConstructor,
|
||||
CatalogTest,
|
||||
},
|
||||
setup() {
|
||||
const accountStore = useAccountStore();
|
||||
const router = useRouter();
|
||||
const activeTab = ref(0);
|
||||
const currentTest = ref('');
|
||||
console.log('tag', 'dsd')
|
||||
const getAllTests = ref([]);
|
||||
const deleteDialog = ref(false);
|
||||
const addDialog = ref(false);
|
||||
const selectedTestId = ref(null);
|
||||
|
||||
const getTestById = () => {
|
||||
let status =
|
||||
@@ -92,15 +154,31 @@ export default {
|
||||
{ value: 0, title: `Назначенные (${currentTest.value})` },
|
||||
{ value: 1, title: 'Завершенные' },
|
||||
{ value: 2, title: 'Каталог' },
|
||||
{ value: 3, title: 'Создать новый тест' },
|
||||
]);
|
||||
|
||||
const goToTest = (id) => router.push(`/test/testdetail/${id}`);
|
||||
|
||||
const openDeleteDialog = (id) => {
|
||||
selectedTestId.value = id;
|
||||
deleteDialog.value = true;
|
||||
};
|
||||
|
||||
const openAddDialog = (id) => {
|
||||
selectedTestId.value = id;
|
||||
addDialog.value = true;
|
||||
};
|
||||
|
||||
return {
|
||||
activeTab,
|
||||
tabs,
|
||||
getAllTests,
|
||||
goToTest,
|
||||
accountStore,
|
||||
deleteDialog,
|
||||
addDialog,
|
||||
openDeleteDialog,
|
||||
openAddDialog,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -64,7 +64,6 @@ import NoneVote from '@/components/vote/NoneVote.vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import VoteResult from '@/components/vote/VoteResult.vue';
|
||||
import { deleteVote, getVoteDetail, getVoteResult, getVotes } from '@/utils/axios-api';
|
||||
// import {formatDate} from "@vueuse/shared";
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import { pagecounter } from '@/utils/universal_functions';
|
||||
|
||||
|
||||
Reference in new issue
Block a user