diff --git a/src/api/product.js b/src/api/product.js index 3948034..4fa4c31 100644 --- a/src/api/product.js +++ b/src/api/product.js @@ -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)=>{ diff --git a/src/views/Product/index.vue b/src/views/Product/index.vue index 599da36..aec8c16 100644 --- a/src/views/Product/index.vue +++ b/src/views/Product/index.vue @@ -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() }