file id filter fix
This commit is contained in:
parent
db276f2bec
commit
ac2040eee9
|
@ -266,7 +266,7 @@ class TgBot:
|
||||||
tmc = await CustomTable.objects.aget(id=tmc_element.tmc_id)
|
tmc = await CustomTable.objects.aget(id=tmc_element.tmc_id)
|
||||||
|
|
||||||
fields = []
|
fields = []
|
||||||
async for e in tmc_element.field.filter(text=None):
|
async for e in tmc_element.field.filter(text=None, file_id=None):
|
||||||
f = await BaseCustomField.objects.aget(id=e.field_id)
|
f = await BaseCustomField.objects.aget(id=e.field_id)
|
||||||
fields.append({"name": f.name, "id": e.id})
|
fields.append({"name": f.name, "id": e.id})
|
||||||
keys = chunk(1, fields)
|
keys = chunk(1, fields)
|
||||||
|
@ -336,7 +336,7 @@ class TgBot:
|
||||||
|
|
||||||
await element.asave()
|
await element.asave()
|
||||||
|
|
||||||
empty_fields = await tmc_element.field.filter(text=None).acount()
|
empty_fields = await tmc_element.field.filter(text=None, file_id=None).acount()
|
||||||
if empty_fields > 0:
|
if empty_fields > 0:
|
||||||
context.chat_data["step"] = "add_tmc"
|
context.chat_data["step"] = "add_tmc"
|
||||||
await self.inv(update, context)
|
await self.inv(update, context)
|
||||||
|
|
|
@ -16,11 +16,6 @@ const columns = [
|
||||||
key: 'name',
|
key: 'name',
|
||||||
label: 'Название'
|
label: 'Название'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
|
||||||
key: 'date',
|
|
||||||
label: 'Дата'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
|
|
||||||
key: 'tmc',
|
key: 'tmc',
|
||||||
|
@ -37,21 +32,30 @@ const columns = [
|
||||||
<h1>Проведенные инвентаризации</h1>
|
<h1>Проведенные инвентаризации</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-12">
|
<div class="col-span-12">
|
||||||
<UTable :rows="items" :columns="columns" :ui="{ td: { base: 'whitespace-normal max-w-sm' } }">
|
<UTable :rows="items" :columns="columns" :ui="{ td: { base: 'whitespace-normal max-w-sm align-top' } }">
|
||||||
<template #date-data="{ row }">
|
<template #name-data="{ row }">
|
||||||
|
<h3>{{ row.name }}</h3>
|
||||||
Создано: {{ new Date(row.created_at).toLocaleString('ru-RU') }}<br />
|
Создано: {{ new Date(row.created_at).toLocaleString('ru-RU') }}<br />
|
||||||
Обновлено: {{ new Date(row.updated_at).toLocaleString('ru-RU') }}
|
Обновлено: {{ new Date(row.updated_at).toLocaleString('ru-RU') }}
|
||||||
</template>
|
</template>
|
||||||
<template #tmc-data="{ row }">
|
<template #tmc-data="{ row }">
|
||||||
<template v-for="item in row.tmc">
|
<div class="inv_item" v-for="item in row.tmc">
|
||||||
<strong>{{ item.tmc.name }}</strong>
|
<strong>{{ item.tmc.name }}</strong>
|
||||||
<ul>
|
<ul class="inv_list">
|
||||||
<li v-for="el in item.field">
|
<li v-for="el in item.field" class="inv_item">
|
||||||
{{ el.field.name }}
|
<span class="inv_item_name">
|
||||||
<GetImage :file_id="el.id" />
|
{{ el.field.name }}:
|
||||||
|
</span>
|
||||||
|
<span :class="['inv_item_text', { 'inv_item__error': !el.text }]">
|
||||||
|
{{ el.text || 'Нет расшифровки' }}
|
||||||
|
</span>
|
||||||
|
<span :class="['inv_item_image', { 'inv_item__error': !el.file_id }]">
|
||||||
|
<GetImage :file_id="el.file_id" v-if="el.file_id" />
|
||||||
|
<span v-else>Нет изображения</span>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #user_id-data="{ row }">
|
<template #user_id-data="{ row }">
|
||||||
<GetAuthor :user_id="row.user_id" />
|
<GetAuthor :user_id="row.user_id" />
|
||||||
|
@ -61,8 +65,29 @@ const columns = [
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped lang="scss">
|
||||||
table {
|
table {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
.inv_item {
|
||||||
|
@apply mb-2;
|
||||||
|
}
|
||||||
|
.inv_list {
|
||||||
|
// @apply flex flex-col gap-2;
|
||||||
|
}
|
||||||
|
.inv_item {
|
||||||
|
@apply break-all;
|
||||||
|
>*{
|
||||||
|
@apply mr-2;
|
||||||
|
}
|
||||||
|
&_name {}
|
||||||
|
|
||||||
|
&_text {}
|
||||||
|
|
||||||
|
&_image {}
|
||||||
|
|
||||||
|
&__error {
|
||||||
|
@apply text-red-400 dark:text-red-800;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue