feat 添加可订购的筛选
All checks were successful
Build image / build (push) Successful in 25s

This commit is contained in:
timerzz 2024-05-16 12:10:39 +08:00
parent cc0167b120
commit eb76595bb9
2 changed files with 27 additions and 1 deletions

View File

@ -2,8 +2,16 @@ import {mande} from "mande";
const product = mande('/api/v1/products')
const queryRemoveZero = (query)=>{
let q = {}
Object.keys(query).forEach(key => {
query[key] === 'undefined' || query[key] === null || query[key] === '' || (q[key] = query[key])
})
return q
}
export const ListProducts = (query) => {
return product.get({query:query})
const q = queryRemoveZero(query)
return product.get({query:q})
}
export const UpdateProduct=(p)=>{

View File

@ -132,8 +132,11 @@ const query = reactive({
size:6,
rate_sort: null,
disc_sort: null,
orderable: null,
keyword: '',
})
const loading = ref(false)
const data = ref({
@ -212,6 +215,18 @@ const columns = computed(()=>[
title: '可购买',
dataIndex: 'orderable',
key: 'orderable',
filteredValue: query.orderable,
filterMultiple:false,
filters:[
{
text: '可购买',
value: 'true',
},
{
text: '不可购买',
value: 'false',
},
]
},
{
title: '抓取时间',
@ -277,6 +292,9 @@ const tableChange = (pagination, filters, sorter, { action, currentDataSource })
}else if (sorter.columnKey === 'discPercent'){
query.disc_sort = sorter.order
}
query.orderable = filters.orderable
list()
}