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)
|
||||
|
||||
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)
|
||||
fields.append({"name": f.name, "id": e.id})
|
||||
keys = chunk(1, fields)
|
||||
|
@ -336,7 +336,7 @@ class TgBot:
|
|||
|
||||
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:
|
||||
context.chat_data["step"] = "add_tmc"
|
||||
await self.inv(update, context)
|
||||
|
|
|
@ -16,11 +16,6 @@ const columns = [
|
|||
key: 'name',
|
||||
label: 'Название'
|
||||
},
|
||||
{
|
||||
|
||||
key: 'date',
|
||||
label: 'Дата'
|
||||
},
|
||||
{
|
||||
|
||||
key: 'tmc',
|
||||
|
@ -37,21 +32,30 @@ const columns = [
|
|||
<h1>Проведенные инвентаризации</h1>
|
||||
</div>
|
||||
<div class="col-span-12">
|
||||
<UTable :rows="items" :columns="columns" :ui="{ td: { base: 'whitespace-normal max-w-sm' } }">
|
||||
<template #date-data="{ row }">
|
||||
<UTable :rows="items" :columns="columns" :ui="{ td: { base: 'whitespace-normal max-w-sm align-top' } }">
|
||||
<template #name-data="{ row }">
|
||||
<h3>{{ row.name }}</h3>
|
||||
Создано: {{ new Date(row.created_at).toLocaleString('ru-RU') }}<br />
|
||||
Обновлено: {{ new Date(row.updated_at).toLocaleString('ru-RU') }}
|
||||
</template>
|
||||
<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>
|
||||
<ul>
|
||||
<li v-for="el in item.field">
|
||||
{{ el.field.name }}
|
||||
<GetImage :file_id="el.id" />
|
||||
<ul class="inv_list">
|
||||
<li v-for="el in item.field" class="inv_item">
|
||||
<span class="inv_item_name">
|
||||
{{ 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>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<template #user_id-data="{ row }">
|
||||
<GetAuthor :user_id="row.user_id" />
|
||||
|
@ -61,8 +65,29 @@ const columns = [
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
<style scoped lang="scss">
|
||||
table {
|
||||
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>
|
Loading…
Reference in New Issue