From c9132c20ebe84af7f5fa7452f37fa97a09955537 Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Sat, 20 May 2023 19:23:43 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=A04=20=D1=81=D0=B4=D0=B0=D0=BD=D0=BE,?= =?UTF-8?q?=20=D0=BD=D0=BE=20=D0=BF=D0=BB=D0=BE=D1=85=D0=BE=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/CatalogFilms.vue | 20 ++- .../src/components/ReportGenre.vue | 126 ++++++++++++++++++ Frontend/vue-project/src/components/Table.vue | 1 + Frontend/vue-project/src/main.js | 4 +- data.mv.db | Bin 57344 -> 65536 bytes 5 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 Frontend/vue-project/src/components/ReportGenre.vue diff --git a/Frontend/vue-project/src/components/CatalogFilms.vue b/Frontend/vue-project/src/components/CatalogFilms.vue index 7050903..9c03735 100644 --- a/Frontend/vue-project/src/components/CatalogFilms.vue +++ b/Frontend/vue-project/src/components/CatalogFilms.vue @@ -19,7 +19,9 @@ ], selectedGenres: [], genreUrl: 'genre/', - genres: [] + genres: [], + open: [], + len: undefined } }, created() { @@ -44,6 +46,22 @@ for(var j=0; j +import axios from 'axios'; +import CatalogMixins from '../mixins/CatalogMixins.js'; +import Film from "../models/Film"; +import Genre from "../models/Genre"; +import DataService from '../services/DataService'; + +export default { +mixins: [ +CatalogMixins +], +data() { +return { +getAllUrl: 'film/', +dataUrl: 'film', +transformer: (data) => new Film(data), +headers: [ +{ name: 'name', label: 'Название' } +], +headersGenres: [ +{ name: 'name', label: 'Жанр' } +], +selectedItemsGenres: [], +genreUrl: 'genre/', +genres: [], +dataFilterUrl: 'genre/film/' +} +}, +created() { +DataService.readAll(this.genreUrl, (data) => new Genre(data)) +.then(data => { +this.genres = data; +}); +}, +methods: { +addGenre(filmId) { +let genreId = document.getElementById('genres').value; +let response = axios.post(`http://localhost:8080/film/add_genre/${filmId}?genre_id=${genreId}`); +console.log(response); +}, +delGenre(filmId) { +let genreId = document.getElementById('genres').value; +let response = axios.delete(`http://localhost:8080/film/del_genre/${filmId}?genre_id=${genreId}`); +console.log(response); +}, +itemsGenres(genreIds) { +let result = []; +if (typeof genreIds === 'undefined') { +return; +} +this.genres.forEach(genre => { +for (let i = 0; i < genreIds.length; i++) { +if (genre.id === genreIds[i]) { +result.push(genre); +} +} +}); +return result; +}, + filter() { + let genreId = document.getElementById('genreFilterSelect').value; + DataService.readAll(this.dataFilterUrl + this.genreId, (data) => new Genre(data)) + .then(data => { + this.items = data; + }); + }, +clearFilters() { +this.loadItems(); +this.id = null; +this.name = null; +this.genreId = null; +} +} +} + + + \ No newline at end of file diff --git a/Frontend/vue-project/src/components/Table.vue b/Frontend/vue-project/src/components/Table.vue index 732105b..40f8348 100644 --- a/Frontend/vue-project/src/components/Table.vue +++ b/Frontend/vue-project/src/components/Table.vue @@ -1,5 +1,6 @@