uprava API metody update aby bolo mozne aktualizovat len to co je potrebne,

pridany page pre Report,
zobrazenie info o reporte s dynamickou editaciou nadpisu a popisu
This commit is contained in:
2025-05-04 23:31:13 +02:00
parent 58a7444da2
commit 745f6495d1
9 changed files with 145 additions and 29 deletions

View File

@ -17,7 +17,8 @@
dragging: isDragable(element),
}"
>
<Report
<ReportBox
:report_id="element.report_id"
:title="element.report_title"
:description="element.report_description"
:date="element.created_dt"
@ -43,7 +44,8 @@
dragging: isDragable(element),
}"
>
<Report
<ReportBox
:report_id="element.report_id"
:title="element.report_title"
:description="element.report_description"
:date="element.created_dt"
@ -69,7 +71,8 @@
dragging: isDragable(element),
}"
>
<Report
<ReportBox
:report_id="element.report_id"
:title="element.report_title"
:description="element.report_description"
:date="element.created_dt"
@ -95,7 +98,8 @@
dragging: isDragable(element),
}"
>
<Report
<ReportBox
:report_id="element.report_id"
:title="element.report_title"
:description="element.report_description"
:date="element.created_dt"
@ -125,13 +129,13 @@ function isDragable(element) {
</script>
<script>
import Report from "../components/Report.vue";
import ReportBox from "../components/ReportBox.vue";
import draggable from "vuedraggable";
import { backend } from "../backend";
export default {
components: {
Report,
ReportBox,
draggable,
},
data() {

View File

@ -0,0 +1,72 @@
<template>
<div id="report">
<div class="report-header">
<div>
<span>Report</span>
<strong>{{ report_id }}</strong>
</div>
<div>
<span>Vytvorene</span>
<strong>{{ report.created_dt }}</strong>
</div>
<div>
<span>Stav</span>
<strong>{{ report.report_status }}</strong>
</div>
<div>
<span>Priorita</span>
<strong>{{ report.report_priority }}</strong>
</div>
<div>
<span>Skupina</span>
<strong>{{ report.report_group }}</strong>
</div>
</div>
<h1 contenteditable="true" @blur="onTitleChange" ref="reportTitle">
{{ report.report_title }}
</h1>
<p class="description" contenteditable="true" @blur="onDescriptionChange" ref="reportDescription">{{ report.report_description }}</p>
</div>
</template>
<script>
import { backend } from "../backend";
export default {
name: "Report",
data() {
return {
report_id: this.$route.params.id,
report: {
report_id: 0,
report_title: "Nacitavam report",
report_description: "...",
report_status: 0,
report_group: "--",
report_priority: 1,
created_dt: "--",
ordnum: 0,
},
};
},
mounted() {
console.log(this.report_id);
this.loadReportData();
},
methods: {
loadReportData() {
backend.get(this.report_id).then((report) => {
this.report = report;
console.log(this.report);
});
},
onTitleChange(event) {
backend.update(this.report_id, { report_title: event.target.innerText });
},
onDescriptionChange(event) {
backend.update(this.report_id, { report_description: event.target.innerText });
},
},
components: {},
watch: {},
};
</script>