fixed warehousearticlepacket editing
This commit is contained in:
@@ -17,6 +17,15 @@ Vue.component('tt-resolver', {
|
||||
<span v-else>{{ text }}</span>
|
||||
`,
|
||||
async created() {
|
||||
const cacheKey = `${this.reference}_${this.value}_${this.autocomplete}`;
|
||||
const cached = JSON.parse(localStorage.getItem(cacheKey) || 'null');
|
||||
|
||||
if (cached && Date.now() - cached.timestamp < 1800000) {
|
||||
this.text = cached.text;
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const endpoint = this.autocomplete
|
||||
? `${window.TT_CONFIG["BASE_PATH"]}${this.reference}?searchedID=${this.value}`
|
||||
: `${window.TT_CONFIG["BASE_PATH"]}/${this.reference}/getById?id=${this.value}`;
|
||||
@@ -25,6 +34,8 @@ Vue.component('tt-resolver', {
|
||||
|
||||
if (this.reference === 'WarehouseArticle') this.text = `${data.articleNumber} | ${data.title}`;
|
||||
else this.text = this.autocomplete ? data[0]?.text : data.name ?? data.title ?? data.text ?? '[E] Key not found';
|
||||
|
||||
localStorage.setItem(cacheKey, JSON.stringify({ text: this.text, timestamp: Date.now() }));
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user