Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Add addProduct and getProductInfo function / update columns filed dat…
Browse files Browse the repository at this point in the history
…aIndex
  • Loading branch information
Jzow committed Oct 22, 2023
1 parent e144a46 commit 3439952
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 44 deletions.
39 changes: 33 additions & 6 deletions src/api/product/product.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {defHttp} from '/@/utils/http/axios';
import {BaseDataResp} from "@/api/model/baseModel";
import {ProductStockResp} from "@/api/product/model/productModel";
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {AddProductReq, ProductInfoDetailResp, QueryProductReq} from "@/api/product/model/productModel";
import {ErrorMessageMode} from "#/axios";

enum Api {
getBarCode = '/product/getBarCode',
getStock = '/product/getStock',
addProduct = '/product/addProduct',
getProductInfo = '/product/getProductInfo',
getProductInfoDetail = '/product/getProductInfoDetail',
}

export function getBarCode() {
Expand All @@ -15,10 +18,34 @@ export function getBarCode() {
);
}

export function getStock() {
return defHttp.get<BaseDataResp<ProductStockResp>>(
export function addProduct(params: AddProductReq, mode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: Api.getStock,
url: Api.addProduct,
params
},
{
errorMessageMode: mode,
},
);
}

export function getProductInfo(params: QueryProductReq, mode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: Api.getProductInfo,
params
},
{
errorMessageMode: mode,
},
);
}

export function getProductInfoDetail(productId: number) {
return defHttp.get<BaseDataResp<ProductInfoDetailResp>>(
{
url: `${Api.getProductInfoDetail}/${productId}`,
}
);
}
58 changes: 20 additions & 38 deletions src/views/product/info/info.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,62 @@ const { t } = useI18n();
export const columns: BasicColumn[] = [
{
title: '条码',
dataIndex: 'name',
dataIndex: 'productBarcode',
width: 80,
},
{
title: '名称',
dataIndex: 'type',
dataIndex: 'productName',
width: 100,
},
{
title: '规格',
dataIndex: 'type',
dataIndex: 'productStandard',
width: 80,
},
{
title: '型号',
dataIndex: 'type',
dataIndex: 'productModel',
width: 100,
},
{
title: '颜色',
dataIndex: 'type',
dataIndex: 'productColor',
width: 60,
},
{
title: '类别',
dataIndex: 'type',
dataIndex: 'productCategoryName',
width: 80,
},
{
title: '单位',
dataIndex: 'type',
dataIndex: 'productUnit',
width: 80,
},
{
title: '库存',
dataIndex: 'type',
dataIndex: 'productStock',
width: 60,
},
{
title: '采购价',
dataIndex: 'type',
dataIndex: 'purchasePrice',
width: 60,
},
{
title: '零售价',
dataIndex: 'type',
dataIndex: 'retailPrice',
width: 60,
},
{
title: '销售价',
dataIndex: 'type',
dataIndex: 'salePrice',
width: 60,
},
{
title: '最低售价',
dataIndex: 'type',
dataIndex: 'lowPrice',
width: 60,
},
{
Expand Down Expand Up @@ -111,7 +111,7 @@ export const columns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [
{
label: '类别',
field: 'type',
field: 'productCategoryId',
component: 'Select',
colProps: {
xl: 8,
Expand All @@ -120,7 +120,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '关键词',
field: 'name',
field: 'keywords',
component: 'Input',
colProps: {
xl: 8,
Expand All @@ -129,7 +129,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '颜色',
field: 'name',
field: 'productColor',
component: 'Input',
colProps: {
xl: 8,
Expand All @@ -138,7 +138,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '状态',
field: 'name',
field: 'status',
component: 'Input',
colProps: {
xl: 12,
Expand All @@ -147,7 +147,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '序列号',
field: 'name',
field: 'enableSerialNumber',
component: 'Input',
colProps: {
xl: 12,
Expand All @@ -156,7 +156,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '批次号',
field: 'name',
field: 'enableBatchNumber',
component: 'Input',
colProps: {
xl: 12,
Expand All @@ -165,7 +165,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '仓位货架',
field: 'name',
field: 'warehouseShelves',
component: 'Input',
colProps: {
xl: 12,
Expand All @@ -174,25 +174,7 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '扩展信息',
field: 'name',
component: 'Input',
colProps: {
xl: 12,
xxl: 8,
},
},
{
label: '基础重量',
field: 'name',
component: 'Input',
colProps: {
xl: 12,
xxl: 8,
},
},
{
label: '保质期',
field: 'name',
field: 'extendInfo',
component: 'Input',
colProps: {
xl: 12,
Expand Down

0 comments on commit 3439952

Please sign in to comment.