feat: change query

This commit is contained in:
caturbgs 2021-12-16 23:29:00 +07:00
parent b8c407bf11
commit 72595b3779
2 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ export class Product {
async getData() { async getData() {
try { try {
const response = await http.get(`/product/all?supplier=${this.filterSupplier}&categories=${this.filterCategory}&categories=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`); const response = await http.get(`/product/all?supplier=${this.filterSupplier}&category=${this.filterCategory}&subCategory=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`);
this.data = response.body.data.map((item, idx) => { this.data = response.body.data.map((item, idx) => {
item.key = idx; item.key = idx;
return item return item
@ -44,7 +44,7 @@ export class Product {
async getDataSubCategories() { async getDataSubCategories() {
try { try {
const response = await http.get(`/product/sub-categories?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`); const response = await http.get(`/product/subCategory?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
this.dataSubCategories = response.body.data.map((item, idx) => { this.dataSubCategories = response.body.data.map((item, idx) => {
item.key = idx; item.key = idx;
return item return item
@ -57,7 +57,7 @@ export class Product {
async getDataCategories() { async getDataCategories() {
try { try {
const response = await http.get(`/product/categories?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`); const response = await http.get(`/product/category?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`);
this.dataCategories = response.body.data.map((item, idx) => { this.dataCategories = response.body.data.map((item, idx) => {
item.key = idx; item.key = idx;
return item return item

View File

@ -32,7 +32,7 @@ export class Transaction {
async getData() { async getData() {
try { try {
const response = await http.get(`/product/by-categories-all?subCategories=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`); const response = await http.get(`/product/by-categories-all?subCategory=${this.filterSubCategory}&page=${this.page}&pageSize=${this.pageSize}`);
this.data = response.body.data ?? [] this.data = response.body.data ?? []
this.total_data = response.body.total_data ?? 0 this.total_data = response.body.total_data ?? 0
} catch (e) { } catch (e) {
@ -42,7 +42,7 @@ export class Transaction {
async getDataSubCategories() { async getDataSubCategories() {
try { try {
const response = await http.get(`/product/sub-categories?categories=${this.filterCategory}&page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`); const response = await http.get(`/product/sub-categories?category=${this.filterCategory}&page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
this.dataSubCategories = response.body.data ?? [] this.dataSubCategories = response.body.data ?? []
this.total_dataSubCategories = response.body.count ?? 0 this.total_dataSubCategories = response.body.count ?? 0
} catch (e) { } catch (e) {