feat: improve notiz column UI and fix memory exhaustion

Notiz column now has max 5 lines with expand/collapse animation and auto-resizing edit textarea. Moved raw SQL query to WorkorderModel::getPreorderIdsByCampaigns() to fix OOM in archiveWorkorders().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 15:35:17 +01:00
co-authored by Claude Opus 4.6
parent a53ff3912c
commit 6593e921ee
5 changed files with 116 additions and 21 deletions
@@ -35,18 +35,20 @@ Vue.component('workorder-company', {
</template>
<template v-slot:additionalinfo="{ row }">
<div v-if="editingAdditionalInfoId === row.id">
<tt-textarea v-model="tempAdditionalInfo" @keydown.esc.native="cancelEdit" rows="3" no-form-group sm ref="editTextarea"/>
<div v-if="editingAdditionalInfoId === row.id" class="wo-notiz-edit">
<tt-textarea v-model="tempAdditionalInfo" @keydown.esc.native="cancelEdit" :rows="editTextareaRows" no-form-group sm ref="editTextarea"/>
<div class="mt-2 d-flex justify-content-end">
<tt-button text="Abbrechen" @click="cancelEdit" sm additional-class="btn-secondary mr-2"/>
<tt-button text="Speichern" @click="updateAdditionalInfo(row)" sm additional-class="btn-success"/>
</div>
</div>
<div v-else class="d-flex align-items-start">
<span style="white-space: pre-wrap; max-width: 250px; display: inline-block;">{{ row.additionalInfo || '-' }}</span>
<tt-button v-if="!['completed', 'cancelled', 'documented'].includes(row.status)"
icon="fas fa-edit" @click="startAdditionalInfoEdit(row)"
additional-class="btn-link btn-sm p-0 ml-2" title="Zusatz-Info bearbeiten"/>
<div v-else>
<div :class="['wo-notiz-text', expandedNotes.includes(row.id) ? 'wo-notiz-expanded' : '']">{{ row.additionalInfo || '-' }}</div>
<div class="wo-notiz-actions">
<button v-if="isNoteLong(row.additionalInfo)" class="wo-notiz-toggle" @click="toggleNoteExpand(row.id)">{{ expandedNotes.includes(row.id) ? '▴ weniger' : '▾ mehr' }}</button>
<a v-if="!['completed', 'cancelled', 'documented'].includes(row.status)"
class="wo-notiz-edit-btn" @click="startAdditionalInfoEdit(row)" title="Zusatz-Info bearbeiten"><i class="fas fa-edit"></i></a>
</div>
</div>
</template>
@@ -104,6 +106,7 @@ Vue.component('workorder-company', {
rescheduleModalData: null,
editingAdditionalInfoId: null,
tempAdditionalInfo: '',
expandedNotes: [],
crudConfig: {
...window.TT_CONFIG.CRUD_CONFIG,
expandable: true,
@@ -121,6 +124,12 @@ Vue.component('workorder-company', {
}
}
},
computed: {
editTextareaRows() {
const lines = (this.tempAdditionalInfo || '').split('\n').length;
return String(Math.max(4, lines + 1));
},
},
methods: {
getStatusColumn(status) {
const column = this.crudConfig.columns.find(c => c.key === 'status');
@@ -222,6 +231,15 @@ Vue.component('workorder-company', {
this.$refs.table.$refs.table.refreshTable();
} else window.notify('error', data.message || 'Ein Fehler ist aufgetreten.');
},
isNoteLong(text) {
if (!text) return false;
return text.split('\n').length > 4 || text.length > 180;
},
toggleNoteExpand(rowId) {
const idx = this.expandedNotes.indexOf(rowId);
if (idx === -1) this.expandedNotes.push(rowId);
else this.expandedNotes.splice(idx, 1);
},
startAdditionalInfoEdit(row) {
this.editingAdditionalInfoId = row.id;
this.tempAdditionalInfo = row.additionalInfo || '';