From 5d2cfe98bb9bc47ae163f60fa1a5f1a84715f8c0 Mon Sep 17 00:00:00 2001 From: Denzel Date: Wed, 22 Jan 2025 11:33:40 +0300 Subject: [PATCH 1/5] =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/vote/VoteCard.vue | 8 ++-- src/front/src/views/VoteHomePage.vue | 45 +++++++++++----------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/front/src/components/vote/VoteCard.vue b/src/front/src/components/vote/VoteCard.vue index 9d93c9a2f..b44da5956 100644 --- a/src/front/src/components/vote/VoteCard.vue +++ b/src/front/src/components/vote/VoteCard.vue @@ -11,10 +11,10 @@ {{ voteCard.name }} - - mdi-pencil - + + + + diff --git a/src/front/src/views/VoteHomePage.vue b/src/front/src/views/VoteHomePage.vue index 11fb2a05d..298eab38c 100644 --- a/src/front/src/views/VoteHomePage.vue +++ b/src/front/src/views/VoteHomePage.vue @@ -24,7 +24,6 @@ :isFinished="currentTab==='active'" :voteCard="voting" @deleteVoting="deleteVoting" - @openEditVoteModal="(voting) => openModal('edit', voting)" @openResultModal="(voting) => openModal('results', voting)" @openVoteModal="(voting) => openModal('vote', voting)" /> @@ -53,18 +52,18 @@ - - - Редактировать голосование: {{ selectedVoting?.title }} - - - - - Сохранить - Закрыть - - - + + + + + + + + + + + + @@ -115,7 +114,7 @@ export default { updating("active"); const voteModal = ref(false); - const editVoteModal = ref(false); + // const editVoteModal = ref(false); const resultsModal = ref(false); const selectedVoting = ref(null); @@ -145,7 +144,7 @@ export default { const closeModal = () => { voteModal.value = false; - editVoteModal.value = false; + // editVoteModal.value = false; resultsModal.value = false; selectedVoting.value = null; router.push({name: "VoteHomePage"}); @@ -157,10 +156,12 @@ export default { await loadVoteDetails(voting.id); voteModal.value = true; router.push({name: "Voting", params: {id: voting.id}}); - } else if (type === "edit") { - editVoteModal.value = true; - router.push({name: "EditVote", params: {id: voting.id}}); - } else if (type === "results") { + } + // else if (type === "edit") { + // editVoteModal.value = true; + // router.push({name: "EditVote", params: {id: voting.id}}); + // } + else if (type === "results") { await loadVoteResult(voting.id); resultsModal.value = true; router.push({name: "VoteResults", params: {id: voting.id}}); @@ -181,13 +182,13 @@ export default { watch( () => route, async () => { - if (!voteModal.value && !editVoteModal.value && !resultsModal.value) { + if (!voteModal.value && !resultsModal.value) { const voting = votes.value.find((v) => v.id === route.params.id); if (route.name === "Voting") { await loadVoteDetails(route.params.id); voteModal.value = true; } - if (route.name === "EditVote") editVoteModal.value = true; + // if (route.name === "EditVote") editVoteModal.value = true; if (route.name === "VoteResults") { await loadVoteResult(route.params.id) resultsModal.value = true; @@ -205,7 +206,7 @@ export default { votes, sortedVotes, voteModal, - editVoteModal, + // editVoteModal, resultsModal, selectedVoting, openModal, From b1b50a19b93922f6420ff3402b9a8d7ebdc4b04f Mon Sep 17 00:00:00 2001 From: Denzel Date: Wed, 22 Jan 2025 11:34:14 +0300 Subject: [PATCH 2/5] =?UTF-8?q?=D0=B7=D0=B0=D0=BA=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/router/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/front/src/router/index.js b/src/front/src/router/index.js index afaf7e1aa..2c07a418d 100644 --- a/src/front/src/router/index.js +++ b/src/front/src/router/index.js @@ -166,12 +166,6 @@ const routes = [ ico: "mdi-account", }, }, - { - path: "/vote/edit-vote/:id", - name: "EditVote", - component: () => - import("@/views/VoteHomePage.vue") - }, { path: "/vote/vote-results/:id", name: "VoteResults", From 08fc5fdf4eca4c39bba66a10ea9e71b42a6da376 Mon Sep 17 00:00:00 2001 From: Denzel Date: Wed, 22 Jan 2025 11:45:16 +0300 Subject: [PATCH 3/5] ref --- src/front/src/components/vote/VoteResult.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/front/src/components/vote/VoteResult.vue b/src/front/src/components/vote/VoteResult.vue index 7d6b5742b..b71ba64ad 100644 --- a/src/front/src/components/vote/VoteResult.vue +++ b/src/front/src/components/vote/VoteResult.vue @@ -67,10 +67,15 @@ + > + + From 502f860a8de9eb26a43bc97c954a0f714a221503 Mon Sep 17 00:00:00 2001 From: Denzel Date: Wed, 22 Jan 2025 13:59:09 +0300 Subject: [PATCH 4/5] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B8=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0,=20=D0=BA=D0=BD=D0=BE=D0=BF?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B7=D0=B0=D0=BA=D1=80=D1=8B=D1=82=D1=8C=20?= =?UTF-8?q?=D0=B2=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D1=85=20=D0=B8=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=20=D1=81?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=87=D0=B5=D1=80=20=D0=B8=D0=B7=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/vote/CurrentVote.vue | 101 ++++-- .../src/components/vote/VoteConstructor.vue | 289 +++++++++--------- src/front/src/components/vote/VoteResult.vue | 30 +- src/front/src/views/VoteHomePage.vue | 7 +- 4 files changed, 240 insertions(+), 187 deletions(-) diff --git a/src/front/src/components/vote/CurrentVote.vue b/src/front/src/components/vote/CurrentVote.vue index 52e9b18d8..be2299224 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -31,37 +31,54 @@ - +
-

{{ question.name }} (вариантов ответа: {{question.settings.multiChoice}})

+

+ {{ question.name }} + (вариантов ответа: {{ question.settings.multiChoice }}) +

- +
- - {{ answer.employee?.fio || answer.name }} - - - +
@@ -181,8 +198,6 @@ export default { }; const submitVote = () => { - console.log(props.data); - console.log("Отправляем данные голосования:", result.value); let voteData = [] for (let val of Object.values(result.value)) { val.forEach(e => voteData.push({answer: e, comment: null, user: accountStore.user.id})) @@ -198,6 +213,7 @@ export default { ).finally(() => isVoteSubmitted.value = true) }; + const activepick = ref(null) const dialog = ref(false) const opendialog = (val) => { @@ -205,7 +221,38 @@ export default { activepick.value = val } + const groupedAnswers = (question) => { + const filtered = question.answers.filter(answer => answer.employee?.id !== accountStore.user.is_idEmployee); + + if (question.settings.onlyDep === null) { + return groupByDepartment(filtered); + } else if (question.settings.onlyDep) { + const byDepartment = filtered.filter( + (answer) => answer.employee?.department === accountStore.user.department + ); + return groupByDepartment(byDepartment); + } else { + const notByDepartment = filtered.filter( + (answer) => answer.employee?.department !== accountStore.user.department + ); + return groupByDepartment(notByDepartment); + } + }; + + const groupByDepartment = (answers) => { + return answers.reduce((groups, answer) => { + const department = answer.employee?.department || ""; + if (!groups[department]) { + groups[department] = []; + } + groups[department].push(answer); + return groups; + }, {}); + }; + + return { + groupedAnswers, activepick, opendialog, dialog, diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 9a3e14516..43d3a2256 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -1,6 +1,6 @@