Skip to content

Commit

Permalink
Fix the syntax error in the import module, change the response object…
Browse files Browse the repository at this point in the history
… returned from message to notification
  • Loading branch information
Jzow committed Aug 1, 2024
1 parent 0dae5aa commit d058885
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 26 deletions.
2 changes: 1 addition & 1 deletion web/src/api/product/product.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defHttp} from '/@/utils/http/axios';
import {defHttp} from '@/utils/http/axios';
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {
AddProductReq,
Expand Down
8 changes: 4 additions & 4 deletions web/src/api/purchase/order.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defHttp} from '/@/utils/http/axios';
import {defHttp} from '@/utils/http/axios';
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {
QueryPurchaseOrderReq,
Expand Down Expand Up @@ -27,7 +27,7 @@ export function getPurchaseOrderPageList(params: QueryPurchaseOrderReq) {
);
}

export function addOrUpdatePurchaseOrder(params: AddOrUpdateReceiptReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function addOrUpdatePurchaseOrder(params: AddOrUpdateReceiptReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: API.AddOrUpdate,
Expand Down Expand Up @@ -55,7 +55,7 @@ export function getLinkOrderDetail(receiptNumber: string) {
);
}

export function updatePurchaseOrderStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function updatePurchaseOrderStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.put<BaseResp>(
{
url: `${API.UpdateStatus}/${ids}/${status}`,
Expand All @@ -66,7 +66,7 @@ export function updatePurchaseOrderStatus(ids: number[], status: number, success
);
}

export function deletePurchaseOrder(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function deletePurchaseOrder(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.put<BaseResp>(
{
url: `${API.Delete}/${ids}`,
Expand Down
8 changes: 4 additions & 4 deletions web/src/api/purchase/refund.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defHttp} from '/@/utils/http/axios';
import {defHttp} from '@/utils/http/axios';
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {
QueryPurchaseRefundReq,
Expand Down Expand Up @@ -27,7 +27,7 @@ export function getPurchaseRefundPageList(params: QueryPurchaseRefundReq) {
);
}

export function addOrUpdatePurchaseRefund(params: AddOrUpdatePurchaseRefundReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function addOrUpdatePurchaseRefund(params: AddOrUpdatePurchaseRefundReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: API.AddOrUpdate,
Expand All @@ -47,7 +47,7 @@ export function getPurchaseRefundDetail(id: string) {
);
}

export function updatePurchaseRefundStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function updatePurchaseRefundStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.put<BaseResp>(
{
url: `${API.UpdateStatus}/${ids}/${status}`,
Expand All @@ -58,7 +58,7 @@ export function updatePurchaseRefundStatus(ids: number[], status: number, succes
);
}

export function deletePurchaseRefund(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function deletePurchaseRefund(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.put<BaseResp>(
{
url: `${API.Delete}/${ids}`,
Expand Down
8 changes: 4 additions & 4 deletions web/src/api/purchase/storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {defHttp} from '/@/utils/http/axios';
import {defHttp} from '@/utils/http/axios';
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {
QueryPurchaseStorageReq,
Expand Down Expand Up @@ -27,7 +27,7 @@ export function getPurchaseStoragePageList(params: QueryPurchaseStorageReq) {
);
}

export function addOrUpdatePurchaseStorage(params: AddOrUpdatePurchaseStorageReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function addOrUpdatePurchaseStorage(params: AddOrUpdatePurchaseStorageReq, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.post<BaseResp>(
{
url: API.AddOrUpdate,
Expand All @@ -47,7 +47,7 @@ export function getPurchaseStorageDetail(id: string) {
);
}

export function updatePurchaseStorageStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function updatePurchaseStorageStatus(ids: number[], status: number, successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.put<BaseResp>(
{
url: `${API.UpdateStatus}/${ids}/${status}`,
Expand All @@ -58,7 +58,7 @@ export function updatePurchaseStorageStatus(ids: number[], status: number, succe
);
}

export function deletePurchaseStorage(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'message') {
export function deletePurchaseStorage(ids: number[], successMode: SuccessMessageMode = 'notice', errorMode: ErrorMessageMode = 'notice') {
return defHttp.put<BaseResp>(
{
url: `${API.Delete}/${ids}`,
Expand Down
6 changes: 3 additions & 3 deletions web/src/utils/http/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ const transform: AxiosTransform = {
'S0016', 'S0017', 'S0018', 'S0013', 'S0014', 'S0015', 'S0010', 'S0011', 'S0012', 'A0020', 'A0021', 'A0022', 'D0001', 'D0002',
'D0003', 'F0000', 'F0002', 'F0003', 'F0004', 'F0005', 'F0006', 'F0007', 'I0001', 'I0002', 'I0003', 'I0004', 'I0005', 'I0006',
'E0004', 'E0005', 'E0006', 'T0001', 'T0002', 'T0003', 'C0001', 'C0003', 'C0004', 'P0024', 'P0025', 'P0026', 'P0001', 'P0000',
'P0002', 'P0003', 'P0004', 'P0005', 'P0006', 'P0007', 'P0008', 'P0009', 'P0010', 'P0011', 'P 0012', 'P0013', 'P0014', 'U0001',
'P0002', 'P0003', 'P0004', 'P0005', 'P0006', 'P0007', 'P0008', 'P0009', 'P0010', 'P0011', 'P0012', 'P0013', 'P0014', 'U0001',
'U0002', 'U0003', 'U0004', 'M0001', 'M0002', 'M0003', 'M0004', 'W0001', 'W0002', 'W0003', 'W0004', 'O0001', 'O0002', 'O0003',
'O0004', 'A0012', 'A0016', 'A0100', 'A0101', 'A0017', 'A0300', 'A0301', 'A0304','A0307']; // 定义包含可能值的数组

const warningCodes = ['A0404', 'A0113', 'A0502', 'B0010', 'B0020'];
const infoCodes = ['A0404', 'A0113', 'A0502', 'B0010', 'B0020', 'P0517', 'P0511'];

if (validCodes.includes(res.data.code) || res.data.code === undefined) {
if (options.successMessageMode === 'message') {
Expand All @@ -83,7 +83,7 @@ const transform: AxiosTransform = {
}
return res.data;
// add info here to handle warning codes
} else if (warningCodes.includes(res.data.code)) {
} else if (infoCodes.includes(res.data.code)) {
if (options.errorMessageMode === 'message') {
createMessage.info(res.data.msg);
} else if (options.errorMessageMode === 'modal') {
Expand Down
8 changes: 4 additions & 4 deletions web/src/views/product/info/components/ProductInfoModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ import {
UploadChangeParam,
} from "ant-design-vue";
import {cloneDeep} from 'lodash-es';
import {getUnitList} from "/@/api/product/productUnit";
import {getCategoryList} from "/@/api/product/productCategory";
import {ProductUnitQueryReq} from "/@/api/product/model/productUnitModel";
import {getUnitList} from "@/api/product/productUnit";
import {getCategoryList} from "@/api/product/productCategory";
import {ProductUnitQueryReq} from "@/api/product/model/productUnitModel";
import {DefaultOptionType} from "ant-design-vue/es/vc-tree-select/TreeSelect";
import {getProductInfoDetail, addOrUpdateProduct} from "@/api/product/product";
import {getAttributeById, getAttributeList} from "@/api/product/productAttribute";
Expand All @@ -385,7 +385,7 @@ import UnitModal from "@/views/product/units/components/UnitModal.vue";
import {useModal} from "@/components/Modal";
import {AddProductImageReq, AddProductReq} from "@/api/product/model/productModel";
import {ProductCategoryResp} from '/@/api/product/model/productCategoryModel';
import {ProductCategoryResp} from '@/api/product/model/productCategoryModel';
import {ProductAttributeListReq} from "@/api/product/model/productAttributeModel";
import {ProductAttributeModel, ProductStockModel, Unit} from "@/views/product/info/model/productInfoModel";
import {meTable, stock, productInfo, formState} from "@/views/product/info/info.data";
Expand Down
3 changes: 0 additions & 3 deletions web/src/views/purchase/refund/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export default defineComponent({
}
const result = await deletePurchaseRefund(data.map((item) => item.id));
if (result.code === 'P0023') {
createMessage.success('删除成功');
await reload();
}
}
Expand All @@ -134,7 +133,6 @@ export default defineComponent({
async function handleDelete(record: Recordable) {
const result = await deletePurchaseRefund([record.id]);
if (result.code === 'P0023') {
createMessage.success('删除成功');
await reload();
}
}
Expand Down Expand Up @@ -178,7 +176,6 @@ export default defineComponent({
const ids = data.map((item) => item.id);
const {code} = await updatePurchaseRefundStatus(ids, newStatus);
if (code === 'P0022') {
createMessage.success('修改状态成功');
await reload();
}
}
Expand Down
3 changes: 0 additions & 3 deletions web/src/views/purchase/storage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export default defineComponent({
}
const result = await deletePurchaseStorage(data.map((item) => item.id));
if (result.code === 'P0020') {
createMessage.success('删除成功');
await reload();
}
}
Expand All @@ -133,7 +132,6 @@ export default defineComponent({
async function handleDelete(record: Recordable) {
const result = await deletePurchaseStorage([record.id]);
if (result.code === 'P0020') {
createMessage.success('删除成功');
await reload();
}
}
Expand Down Expand Up @@ -180,7 +178,6 @@ export default defineComponent({
const ids = data.map((item) => item.id);
const {code} = await updatePurchaseStorageStatus(ids, newStatus);
if (code === 'P0019') {
createMessage.success('修改状态成功');
await reload();
}
}
Expand Down

0 comments on commit d058885

Please sign in to comment.