mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:27:09 +00:00
Improve sequence list search
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
item-key="sequence"
|
||||
:server-items-length="num_rows"
|
||||
:search="filter"
|
||||
:custom-filter="customFilter"
|
||||
:loading="loading"
|
||||
:fixed-header="true"
|
||||
show-expand
|
||||
@@ -352,6 +353,39 @@ export default {
|
||||
return basename(path, ext);
|
||||
},
|
||||
|
||||
customFilter (value, search, item) {
|
||||
if (!search) return true;
|
||||
|
||||
const number = Number(search);
|
||||
|
||||
if (!isNaN(number)) {
|
||||
if (item.sequence == number) return true;
|
||||
|
||||
if (search.length > 3) {
|
||||
const searchShots = [ "fsp", "lsp", "fsp_final", "lsp_final" ].some( k =>
|
||||
item[k] == number
|
||||
);
|
||||
if (searchShots) return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (search.length > 2) {
|
||||
const searchDates = [ "ts0", "ts1" ].some(k => {
|
||||
const i = item[k].indexOf(search);
|
||||
return i >= 0 && i < 10;
|
||||
});
|
||||
if (searchDates) return true;
|
||||
}
|
||||
|
||||
if ((item.remarks||"").indexOf(search) != -1) return true;
|
||||
|
||||
if ((item.remarks_final||"").indexOf(search) != -1) return true;
|
||||
|
||||
if (item.status.indexOf(search.toLowerCase()) == 0) return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
...mapActions(["api"])
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user