Добавлен поиск по типу файла
This commit is contained in:
@@ -450,6 +450,13 @@ export default class BaseList {
|
|||||||
librateFound = searchLibrate.has(book.librate);
|
librateFound = searchLibrate.has(book.librate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ext
|
||||||
|
let extFound = !s.ext;
|
||||||
|
if (!extFound) {
|
||||||
|
const searchExt = new Set(s.ext.split('|'));
|
||||||
|
extFound = searchExt.has(book.ext.toLowerCase() || emptyFieldValue);
|
||||||
|
}
|
||||||
|
|
||||||
return (this.showDeleted || !book.del)
|
return (this.showDeleted || !book.del)
|
||||||
&& authorFound
|
&& authorFound
|
||||||
&& filterBySearch(book.series, s.series)
|
&& filterBySearch(book.series, s.series)
|
||||||
@@ -458,6 +465,7 @@ export default class BaseList {
|
|||||||
&& langFound
|
&& langFound
|
||||||
&& dateFound
|
&& dateFound
|
||||||
&& librateFound
|
&& librateFound
|
||||||
|
&& extFound
|
||||||
;
|
;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -725,6 +725,7 @@ class Search {
|
|||||||
result.push(s.genre ? 'Жанр' : '');
|
result.push(s.genre ? 'Жанр' : '');
|
||||||
result.push(s.date ? 'Дата поступления' : '');
|
result.push(s.date ? 'Дата поступления' : '');
|
||||||
result.push(s.librate ? 'Оценка' : '');
|
result.push(s.librate ? 'Оценка' : '');
|
||||||
|
result.push(s.ext ? 'Тип файла' : '');
|
||||||
|
|
||||||
return result.filter(s => s).join(', ');
|
return result.filter(s => s).join(', ');
|
||||||
}
|
}
|
||||||
@@ -1104,6 +1105,7 @@ class Search {
|
|||||||
lang: (typeof(query.lang) == 'string' ? query.lang : this.langDefault),
|
lang: (typeof(query.lang) == 'string' ? query.lang : this.langDefault),
|
||||||
date: query.date,
|
date: query.date,
|
||||||
librate: query.librate,
|
librate: query.librate,
|
||||||
|
ext: query.ext,
|
||||||
|
|
||||||
page: parseInt(query.page, 10),
|
page: parseInt(query.page, 10),
|
||||||
limit: parseInt(query.limit, 10) || this.search.limit,
|
limit: parseInt(query.limit, 10) || this.search.limit,
|
||||||
|
|||||||
@@ -16,7 +16,13 @@
|
|||||||
:options="optionsPre"
|
:options="optionsPre"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
inline
|
inline
|
||||||
/>
|
>
|
||||||
|
<template #label="opt">
|
||||||
|
<div class="row items-center" style="width: 35px">
|
||||||
|
<span>{{ opt.label }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-option-group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-checkbox v-model="tickAll" label="Выбрать/снять все" toggle-order="ft" @update:model-value="makeTickAll" />
|
<q-checkbox v-model="tickAll" label="Выбрать/снять все" toggle-order="ft" @update:model-value="makeTickAll" />
|
||||||
@@ -57,12 +63,12 @@ const componentOptions = {
|
|||||||
dialogVisible(newValue) {
|
dialogVisible(newValue) {
|
||||||
this.$emit('update:modelValue', newValue);
|
this.$emit('update:modelValue', newValue);
|
||||||
},
|
},
|
||||||
lang() {
|
ext() {
|
||||||
this.updateTicked();
|
this.updateTicked();
|
||||||
},
|
},
|
||||||
ticked() {
|
ticked() {
|
||||||
this.checkAllTicked();
|
this.checkAllTicked();
|
||||||
this.updateLang();
|
this.updateExt();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -95,7 +101,13 @@ class SelectExtDialog {
|
|||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
for (const ext of this.extList) {
|
for (const ext of this.extList) {
|
||||||
result.push({label: ext, value: ext});
|
if (ext.length <= 4)
|
||||||
|
result.push({label: ext, value: ext});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const ext of this.extList) {
|
||||||
|
if (ext.length > 4)
|
||||||
|
result.push({label: ext, value: ext});
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -104,7 +116,7 @@ class SelectExtDialog {
|
|||||||
get optionsPre() {
|
get optionsPre() {
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
for (const ext of ['fb2', 'pdf']) {
|
for (const ext of ['fb2', 'epub', 'mobi', 'pdf', 'djvu', 'doc', 'docx', 'rtf', 'xml', 'html', 'txt', 'zip']) {
|
||||||
if (this.extList.includes(ext)) {
|
if (this.extList.includes(ext)) {
|
||||||
result.push({label: ext, value: ext});
|
result.push({label: ext, value: ext});
|
||||||
}
|
}
|
||||||
@@ -145,11 +157,11 @@ class SelectExtDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTicked() {
|
updateTicked() {
|
||||||
this.ticked = this.ext.split(',').filter(s => s);
|
this.ticked = this.ext.split('|').filter(s => s);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLang() {
|
updateExt() {
|
||||||
this.$emit('update:ext', this.ticked.join(','));
|
this.$emit('update:ext', this.ticked.join('|'));
|
||||||
}
|
}
|
||||||
|
|
||||||
okClick() {
|
okClick() {
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ class DbSearcher {
|
|||||||
table: 'ext',
|
table: 'ext',
|
||||||
rawResult: true,
|
rawResult: true,
|
||||||
where: `
|
where: `
|
||||||
const exts = ${db.esc(query.ext.split(','))};
|
const exts = ${db.esc(query.ext.split('|'))};
|
||||||
|
|
||||||
const ids = new Set();
|
const ids = new Set();
|
||||||
for (const l of exts) {
|
for (const l of exts) {
|
||||||
|
|||||||
Reference in New Issue
Block a user