#19, added tags, and tags filtering

This commit is contained in:
2026-02-13 22:02:31 +02:00
parent 5c934e0ad2
commit b11e763fd9
11 changed files with 90 additions and 23 deletions
+19 -11
View File
@@ -16,8 +16,17 @@
<v-textarea :label="l.description" v-model="object.description"></v-textarea>
<v-select :label="l.objectType" v-model="object.type" :items="$p.objectTypes.map(ot=>({title:l[ot.value], value:ot.value}))" tit :rules="[rules.required]">
</v-select>
<v-file-input :label="l.objectFile" v-model="object.file" :rules="[rules.requiredFile]"></v-file-input>
<div v-if="object.asset">{{ object.asset.name }} | {{ object.asset.ofn }}</div>
<v-file-input :label="l.objectFile" v-model="file" :rules="[rules.requiredFile]"></v-file-input>
<v-combobox clearable chips multiple :label="l.tags" v-model="object.tags" :items="tagList">
<template v-slot:chip="{ props, item }">
<v-chip v-bind="props" label>
<template v-slot:close>
<v-icon icon="$close" size="14"></v-icon>
</template>
</v-chip>
</template>
</v-combobox>
<div v-if="object.asset" closable-chips deletable-chips :delimiters="[',']">{{ object.asset.name }} | {{ object.asset.ofn }}</div>
</v-form>
<v-card-actions>
<v-btn @click="save" :loading="loading" prepend-icon="mdi-content-save" color="success"
@@ -54,6 +63,8 @@ export default {
return {
panel: this.$route.query?.tab || 'edit',
object: {},
tagList: [],
file: null,
valid: false,
rules: {
required: v => v ? true : this.l.fieldRequired,
@@ -66,11 +77,9 @@ export default {
if (this.id && this.id != 'add') {
this.object = (await this.$api.gameObject.load(this.id)).data;
}
this.tagList = (await this.$api.gameObject.getTags()).data;
},
computed: {
fileToUpload() {
return this.object?.file instanceof File
},
id() {
return this.$route.params?.id;
},
@@ -83,17 +92,16 @@ export default {
this.loading = true;
try {
let fd = new FormData();
let keys = ['name', 'type'];
if (this.fileToUpload) keys.push('file');
if (this.id != 'add') keys.push('id');
if (this.object.thumb) keys.push('thumb');
keys.forEach(e => fd.append(e, this.object[e]))
if (this.file) {
fd.append('file', this.file)
}
fd.append('object', JSON.stringify(this.object));
let result = await this.$api.gameObject.save(fd);
Object.assign(this.object, result.data.object);
if (this.id == 'add') {
this.$router.replace({ params: { id: this.object.id }, query:{ tab:'preview' } });
}
this.debug(this.object)
// await this.$nextTick();
// this.panel = 'preview';
// if (!params?.thumbOnly) await this.$refs.assetPreview.loadAsset();