refs #5673 feat(formModel): global qselect filter
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6b3a09887f
commit
92e914adad
|
@ -99,9 +99,9 @@ function reset() {
|
|||
function filter(value, update, filterOptions) {
|
||||
update(
|
||||
() => {
|
||||
const { options, filterFn } = filterOptions;
|
||||
const { options, filterFn, field } = filterOptions;
|
||||
|
||||
options.value = filterFn(options, value);
|
||||
options.value = filterFn(options, value, field);
|
||||
},
|
||||
(ref) => {
|
||||
ref.setOptionIndex(-1);
|
||||
|
|
|
@ -102,10 +102,34 @@ const columns = computed(() => [
|
|||
// });
|
||||
// }
|
||||
|
||||
const basicFilter = (options) => {
|
||||
// const basicFilter = () => {
|
||||
// return {
|
||||
// options: claimReasons,
|
||||
// filterFn: (options, value) => {
|
||||
// console.log('ENTRY', value);
|
||||
// const search = value.toLowerCase();
|
||||
// if (value === '') return claimReasons.value;
|
||||
|
||||
// const arr = options.value.filter((row) => {
|
||||
// const id = row.id;
|
||||
// const name = row.description.toLowerCase();
|
||||
// console.log('SEARCH', search, id);
|
||||
// const idMatches = id == search;
|
||||
// const nameMatches = name.indexOf(search) > -1;
|
||||
// return idMatches || nameMatches;
|
||||
// });
|
||||
// console.log(arr);
|
||||
// return arr;
|
||||
// },
|
||||
// };
|
||||
// };
|
||||
|
||||
const basicFilter = (options, field) => {
|
||||
console.log(options, field);
|
||||
return {
|
||||
options,
|
||||
filterFn: (options, value) => {
|
||||
field,
|
||||
filterFn: (options, value, field) => {
|
||||
const search = value.toLowerCase();
|
||||
|
||||
if (value === '') return options;
|
||||
|
@ -113,7 +137,7 @@ const basicFilter = (options) => {
|
|||
return options.value.filter((row) => {
|
||||
console.log(row);
|
||||
const id = row.id;
|
||||
const name = row.name.toLowerCase();
|
||||
const name = row[field ?? 'name'].toLowerCase();
|
||||
|
||||
const idMatches = id == search;
|
||||
const nameMatches = name.indexOf(search) > -1;
|
||||
|
@ -192,7 +216,7 @@ const basicFilter = (options) => {
|
|||
filter(
|
||||
value,
|
||||
update,
|
||||
basicFilter(col.options)
|
||||
basicFilter(col.options, col.optionLabel)
|
||||
)
|
||||
"
|
||||
/>
|
||||
|
@ -223,7 +247,10 @@ const basicFilter = (options) => {
|
|||
filter(
|
||||
value,
|
||||
update,
|
||||
basicFilter(col.options)
|
||||
basicFilter(
|
||||
col.options,
|
||||
col.optionLabel
|
||||
)
|
||||
)
|
||||
"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue