feat:【ele】【erp】finance/payment 的迁移(50%)
This commit is contained in:
@@ -23,6 +23,8 @@ export namespace ErpPurchaseInApi {
|
||||
taxPrice?: number; // 合计税额
|
||||
items?: PurchaseInItem[]; // 采购入库明细
|
||||
}
|
||||
|
||||
/** 采购项信息 */
|
||||
export interface PurchaseInItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
@@ -42,21 +44,10 @@ export namespace ErpPurchaseInApi {
|
||||
warehouseId?: number;
|
||||
inCount?: number;
|
||||
}
|
||||
|
||||
/** 采购入库分页查询参数 */
|
||||
export interface PurchaseInPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购入库分页
|
||||
*/
|
||||
export function getPurchaseInPage(
|
||||
params: ErpPurchaseInApi.PurchaseInPageParams,
|
||||
) {
|
||||
/** 查询采购入库分页 */
|
||||
export function getPurchaseInPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpPurchaseInApi.PurchaseIn>>(
|
||||
'/erp/purchase-in/page',
|
||||
{
|
||||
@@ -65,32 +56,24 @@ export function getPurchaseInPage(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购入库详情
|
||||
*/
|
||||
/** 查询采购入库详情 */
|
||||
export function getPurchaseIn(id: number) {
|
||||
return requestClient.get<ErpPurchaseInApi.PurchaseIn>(
|
||||
`/erp/purchase-in/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购入库
|
||||
*/
|
||||
/** 新增采购入库 */
|
||||
export function createPurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
|
||||
return requestClient.post('/erp/purchase-in/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购入库
|
||||
*/
|
||||
/** 修改采购入库 */
|
||||
export function updatePurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
|
||||
return requestClient.put('/erp/purchase-in/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新采购入库的状态
|
||||
*/
|
||||
/** 更新采购入库的状态 */
|
||||
export function updatePurchaseInStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-in/update-status', null, {
|
||||
params: {
|
||||
@@ -100,9 +83,7 @@ export function updatePurchaseInStatus(id: number, status: number) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购入库
|
||||
*/
|
||||
/** 删除采购入库 */
|
||||
export function deletePurchaseIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-in/delete', {
|
||||
params: {
|
||||
@@ -111,12 +92,8 @@ export function deletePurchaseIn(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购入库 Excel
|
||||
*/
|
||||
export function exportPurchaseIn(
|
||||
params: ErpPurchaseInApi.PurchaseInPageParams,
|
||||
) {
|
||||
/** 导出采购入库 Excel */
|
||||
export function exportPurchaseIn(params: any) {
|
||||
return requestClient.download('/erp/purchase-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -3,27 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseOrderApi {
|
||||
/** ERP 采购订单项信息 */
|
||||
export interface PurchaseOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
totalProductPrice?: number; // 产品总价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
|
||||
/** ERP 采购订单信息 */
|
||||
/** 采购订单信息 */
|
||||
export interface PurchaseOrder {
|
||||
id?: number; // 订单工单编号
|
||||
no?: string; // 采购订单号
|
||||
@@ -51,24 +31,29 @@ export namespace ErpPurchaseOrderApi {
|
||||
items?: PurchaseOrderItem[]; // 订单项列表
|
||||
}
|
||||
|
||||
/** 采购订单分页查询参数 */
|
||||
export interface PurchaseOrderPageParam extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
productId?: number;
|
||||
orderTime?: string[];
|
||||
status?: number;
|
||||
remark?: string;
|
||||
creator?: string;
|
||||
inStatus?: number;
|
||||
returnStatus?: number;
|
||||
/** 采购订单项信息 */
|
||||
export interface PurchaseOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
totalProductPrice?: number; // 产品总价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询采购订单分页 */
|
||||
export function getPurchaseOrderPage(
|
||||
params: ErpPurchaseOrderApi.PurchaseOrderPageParam,
|
||||
) {
|
||||
export function getPurchaseOrderPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpPurchaseOrderApi.PurchaseOrder>>(
|
||||
'/erp/purchase-order/page',
|
||||
{ params },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
@@ -19,6 +19,8 @@ export namespace ErpPurchaseReturnApi {
|
||||
otherPrice?: number; // 其他费用
|
||||
items?: PurchaseReturnItem[];
|
||||
}
|
||||
|
||||
/** 采购退货项 */
|
||||
export interface PurchaseReturnItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
@@ -37,27 +39,10 @@ export namespace ErpPurchaseReturnApi {
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
}
|
||||
|
||||
/** 采购退货分页查询参数 */
|
||||
export interface PurchaseReturnPageParams extends PageParam {
|
||||
no?: string;
|
||||
supplierId?: number;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 采购退货状态更新参数 */
|
||||
export interface PurchaseReturnStatusParams {
|
||||
id: number;
|
||||
status: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购退货分页
|
||||
*/
|
||||
export function getPurchaseReturnPage(
|
||||
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
|
||||
) {
|
||||
/** 查询采购退货分页 */
|
||||
export function getPurchaseReturnPage(params: any) {
|
||||
return requestClient.get<PageResult<ErpPurchaseReturnApi.PurchaseReturn>>(
|
||||
'/erp/purchase-return/page',
|
||||
{
|
||||
@@ -66,45 +51,35 @@ export function getPurchaseReturnPage(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购退货详情
|
||||
*/
|
||||
/** 查询采购退货详情 */
|
||||
export function getPurchaseReturn(id: number) {
|
||||
return requestClient.get<ErpPurchaseReturnApi.PurchaseReturn>(
|
||||
`/erp/purchase-return/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购退货
|
||||
*/
|
||||
/** 新增采购退货 */
|
||||
export function createPurchaseReturn(
|
||||
data: ErpPurchaseReturnApi.PurchaseReturn,
|
||||
) {
|
||||
return requestClient.post('/erp/purchase-return/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购退货
|
||||
*/
|
||||
/** 修改采购退货 */
|
||||
export function updatePurchaseReturn(
|
||||
data: ErpPurchaseReturnApi.PurchaseReturn,
|
||||
) {
|
||||
return requestClient.put('/erp/purchase-return/update', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新采购退货的状态
|
||||
*/
|
||||
/** 更新采购退货的状态 */
|
||||
export function updatePurchaseReturnStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-return/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购退货
|
||||
*/
|
||||
/** 删除采购退货 */
|
||||
export function deletePurchaseReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-return/delete', {
|
||||
params: {
|
||||
@@ -113,12 +88,8 @@ export function deletePurchaseReturn(ids: number[]) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购退货 Excel
|
||||
*/
|
||||
export function exportPurchaseReturn(
|
||||
params: ErpPurchaseReturnApi.PurchaseReturnPageParams,
|
||||
) {
|
||||
/** 导出采购退货 Excel */
|
||||
export function exportPurchaseReturn(params: any) {
|
||||
return requestClient.download('/erp/purchase-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PageParam, PageResult } from '@vben/request';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSupplierApi {
|
||||
/** ERP 供应商信息 */
|
||||
/** 供应商信息 */
|
||||
export interface Supplier {
|
||||
id?: number; // 供应商编号
|
||||
name: string; // 供应商名称
|
||||
@@ -21,17 +21,10 @@ export namespace ErpSupplierApi {
|
||||
bankAccount: string; // 开户账号
|
||||
bankAddress: string; // 开户地址
|
||||
}
|
||||
|
||||
/** 供应商分页查询参数 */
|
||||
export interface SupplierPageParam extends PageParam {
|
||||
name?: string;
|
||||
mobile?: string;
|
||||
status?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询供应商分页 */
|
||||
export function getSupplierPage(params: ErpSupplierApi.SupplierPageParam) {
|
||||
export function getSupplierPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpSupplierApi.Supplier>>(
|
||||
'/erp/supplier/page',
|
||||
{ params },
|
||||
|
||||
100
apps/web-ele/src/api/erp/purchase/in/index.ts
Normal file
100
apps/web-ele/src/api/erp/purchase/in/index.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseInApi {
|
||||
/** 采购入库信息 */
|
||||
export interface PurchaseIn {
|
||||
id?: number; // 入库工单编号
|
||||
no?: string; // 采购入库号
|
||||
supplierId?: number; // 供应商编号
|
||||
inTime?: Date; // 入库时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice?: number; // 合计金额,单位:元
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
outCount?: number; // 采购出库数量
|
||||
returnCount?: number; // 采购退货数量
|
||||
discountPercent?: number; // 折扣百分比
|
||||
discountPrice?: number; // 折扣金额
|
||||
paymentPrice?: number; // 实际支付金额
|
||||
otherPrice?: number; // 其他费用
|
||||
totalProductPrice?: number; // 合计商品金额
|
||||
taxPrice?: number; // 合计税额
|
||||
items?: PurchaseInItem[]; // 采购入库明细
|
||||
}
|
||||
|
||||
/** 采购项信息 */
|
||||
export interface PurchaseInItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
orderItemId?: number;
|
||||
productBarCode?: string;
|
||||
productId?: number;
|
||||
productName: string;
|
||||
productPrice: number;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
totalProductPrice?: number;
|
||||
remark: string;
|
||||
stockCount?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
inCount?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询采购入库分页 */
|
||||
export function getPurchaseInPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpPurchaseInApi.PurchaseIn>>(
|
||||
'/erp/purchase-in/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询采购入库详情 */
|
||||
export function getPurchaseIn(id: number) {
|
||||
return requestClient.get<ErpPurchaseInApi.PurchaseIn>(
|
||||
`/erp/purchase-in/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增采购入库 */
|
||||
export function createPurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
|
||||
return requestClient.post('/erp/purchase-in/create', data);
|
||||
}
|
||||
|
||||
/** 修改采购入库 */
|
||||
export function updatePurchaseIn(data: ErpPurchaseInApi.PurchaseIn) {
|
||||
return requestClient.put('/erp/purchase-in/update', data);
|
||||
}
|
||||
|
||||
/** 更新采购入库的状态 */
|
||||
export function updatePurchaseInStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-in/update-status', null, {
|
||||
params: {
|
||||
id,
|
||||
status,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除采购入库 */
|
||||
export function deletePurchaseIn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-in/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出采购入库 Excel */
|
||||
export function exportPurchaseIn(params: any) {
|
||||
return requestClient.download('/erp/purchase-in/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
97
apps/web-ele/src/api/erp/purchase/order/index.ts
Normal file
97
apps/web-ele/src/api/erp/purchase/order/index.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseOrderApi {
|
||||
/** 采购订单信息 */
|
||||
export interface PurchaseOrder {
|
||||
id?: number; // 订单工单编号
|
||||
no?: string; // 采购订单号
|
||||
supplierId?: number; // 供应商编号
|
||||
supplierName?: string; // 供应商名称
|
||||
orderTime?: Date | string; // 订单时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice?: number; // 合计金额,单位:元
|
||||
totalProductPrice?: number; // 产品金额,单位:元
|
||||
discountPercent?: number; // 优惠率,百分比
|
||||
discountPrice?: number; // 优惠金额,单位:元
|
||||
depositPrice?: number; // 定金金额,单位:元
|
||||
accountId?: number; // 结算账户编号
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
fileUrl?: string; // 附件地址
|
||||
inCount?: number; // 采购入库数量
|
||||
count?: number; // 数量
|
||||
returnCount?: number; // 采购退货数量
|
||||
inStatus?: number; // 入库状态
|
||||
returnStatus?: number; // 退货状态
|
||||
productNames?: string; // 产品名称列表
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime?: Date; // 创建时间
|
||||
items?: PurchaseOrderItem[]; // 订单项列表
|
||||
}
|
||||
|
||||
/** 采购订单项信息 */
|
||||
export interface PurchaseOrderItem {
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
totalProductPrice?: number; // 产品总价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询采购订单分页 */
|
||||
export function getPurchaseOrderPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpPurchaseOrderApi.PurchaseOrder>>(
|
||||
'/erp/purchase-order/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询采购订单详情 */
|
||||
export function getPurchaseOrder(id: number) {
|
||||
return requestClient.get<ErpPurchaseOrderApi.PurchaseOrder>(
|
||||
`/erp/purchase-order/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增采购订单 */
|
||||
export function createPurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
return requestClient.post('/erp/purchase-order/create', data);
|
||||
}
|
||||
|
||||
/** 修改采购订单 */
|
||||
export function updatePurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
return requestClient.put('/erp/purchase-order/update', data);
|
||||
}
|
||||
|
||||
/** 更新采购订单的状态 */
|
||||
export function updatePurchaseOrderStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-order/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除采购订单 */
|
||||
export function deletePurchaseOrder(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-order/delete', {
|
||||
params: { ids: ids.join(',') },
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出采购订单 Excel */
|
||||
export function exportPurchaseOrder(params: any) {
|
||||
return requestClient.download('/erp/purchase-order/export-excel', { params });
|
||||
}
|
||||
96
apps/web-ele/src/api/erp/purchase/return/index.ts
Normal file
96
apps/web-ele/src/api/erp/purchase/return/index.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import type { PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpPurchaseReturnApi {
|
||||
/** 采购退货信息 */
|
||||
export interface PurchaseReturn {
|
||||
id?: number; // 采购退货编号
|
||||
no?: string; // 采购退货号
|
||||
supplierId?: number; // 供应商编号
|
||||
returnTime?: Date; // 退货时间
|
||||
totalCount?: number; // 合计数量
|
||||
totalPrice: number; // 合计金额,单位:元
|
||||
discountPercent?: number; // 折扣百分比
|
||||
discountPrice?: number; // 折扣金额
|
||||
status?: number; // 状态
|
||||
remark?: string; // 备注
|
||||
totalTaxPrice?: number; // 合计税额
|
||||
otherPrice?: number; // 其他费用
|
||||
items?: PurchaseReturnItem[];
|
||||
}
|
||||
|
||||
/** 采购退货项 */
|
||||
export interface PurchaseReturnItem {
|
||||
count?: number;
|
||||
id?: number;
|
||||
orderItemId?: number;
|
||||
productBarCode?: string;
|
||||
productId?: number;
|
||||
productName: string;
|
||||
productPrice: number;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
totalProductPrice?: number;
|
||||
remark: string;
|
||||
stockCount?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
totalPrice?: number;
|
||||
warehouseId?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询采购退货分页 */
|
||||
export function getPurchaseReturnPage(params: any) {
|
||||
return requestClient.get<PageResult<ErpPurchaseReturnApi.PurchaseReturn>>(
|
||||
'/erp/purchase-return/page',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询采购退货详情 */
|
||||
export function getPurchaseReturn(id: number) {
|
||||
return requestClient.get<ErpPurchaseReturnApi.PurchaseReturn>(
|
||||
`/erp/purchase-return/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增采购退货 */
|
||||
export function createPurchaseReturn(
|
||||
data: ErpPurchaseReturnApi.PurchaseReturn,
|
||||
) {
|
||||
return requestClient.post('/erp/purchase-return/create', data);
|
||||
}
|
||||
|
||||
/** 修改采购退货 */
|
||||
export function updatePurchaseReturn(
|
||||
data: ErpPurchaseReturnApi.PurchaseReturn,
|
||||
) {
|
||||
return requestClient.put('/erp/purchase-return/update', data);
|
||||
}
|
||||
|
||||
/** 更新采购退货的状态 */
|
||||
export function updatePurchaseReturnStatus(id: number, status: number) {
|
||||
return requestClient.put('/erp/purchase-return/update-status', null, {
|
||||
params: { id, status },
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除采购退货 */
|
||||
export function deletePurchaseReturn(ids: number[]) {
|
||||
return requestClient.delete('/erp/purchase-return/delete', {
|
||||
params: {
|
||||
ids: ids.join(','),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出采购退货 Excel */
|
||||
export function exportPurchaseReturn(params: any) {
|
||||
return requestClient.download('/erp/purchase-return/export-excel', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
66
apps/web-ele/src/api/erp/purchase/supplier/index.ts
Normal file
66
apps/web-ele/src/api/erp/purchase/supplier/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { PageParam, PageResult } from '@vben/request';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace ErpSupplierApi {
|
||||
/** 供应商信息 */
|
||||
export interface Supplier {
|
||||
id?: number; // 供应商编号
|
||||
name: string; // 供应商名称
|
||||
contact: string; // 联系人
|
||||
mobile: string; // 手机号码
|
||||
telephone: string; // 联系电话
|
||||
email: string; // 电子邮箱
|
||||
fax: string; // 传真
|
||||
remark: string; // 备注
|
||||
status: number; // 开启状态
|
||||
sort: number; // 排序
|
||||
taxNo: string; // 纳税人识别号
|
||||
taxPercent: number; // 税率
|
||||
bankName: string; // 开户行
|
||||
bankAccount: string; // 开户账号
|
||||
bankAddress: string; // 开户地址
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询供应商分页 */
|
||||
export function getSupplierPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<ErpSupplierApi.Supplier>>(
|
||||
'/erp/supplier/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 获得供应商精简列表 */
|
||||
export function getSupplierSimpleList() {
|
||||
return requestClient.get<ErpSupplierApi.Supplier[]>(
|
||||
'/erp/supplier/simple-list',
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询供应商详情 */
|
||||
export function getSupplier(id: number) {
|
||||
return requestClient.get<ErpSupplierApi.Supplier>(
|
||||
`/erp/supplier/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增供应商 */
|
||||
export function createSupplier(data: ErpSupplierApi.Supplier) {
|
||||
return requestClient.post('/erp/supplier/create', data);
|
||||
}
|
||||
|
||||
/** 修改供应商 */
|
||||
export function updateSupplier(data: ErpSupplierApi.Supplier) {
|
||||
return requestClient.put('/erp/supplier/update', data);
|
||||
}
|
||||
|
||||
/** 删除供应商 */
|
||||
export function deleteSupplier(id: number) {
|
||||
return requestClient.delete(`/erp/supplier/delete?id=${id}`);
|
||||
}
|
||||
|
||||
/** 导出供应商 Excel */
|
||||
export function exportSupplier(params: any) {
|
||||
return requestClient.download('/erp/supplier/export-excel', { params });
|
||||
}
|
||||
589
apps/web-ele/src/views/erp/finance/payment/data.ts
Normal file
589
apps/web-ele/src/views/erp/finance/payment/data.ts
Normal file
@@ -0,0 +1,589 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
import { erpPriceInputFormatter } from '@vben/utils';
|
||||
|
||||
import { getAccountSimpleList } from '#/api/erp/finance/account';
|
||||
import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
/** 表单的配置项 */
|
||||
export function useFormSchema(formType: string): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '付款单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '系统自动生成',
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paymentTime',
|
||||
label: '付款时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
placeholder: '选择付款时间',
|
||||
type: 'datetime',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
placeholder: '请选择供应商',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getSupplierSimpleList,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'financeUserId',
|
||||
label: '财务人员',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择财务人员',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
autosize: { minRows: 1, maxRows: 1 },
|
||||
disabled: formType === 'detail',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
{
|
||||
fieldName: 'fileUrl',
|
||||
label: '附件',
|
||||
component: 'FileUpload',
|
||||
componentProps: {
|
||||
maxNumber: 1,
|
||||
maxSize: 10,
|
||||
accept: [
|
||||
'pdf',
|
||||
'doc',
|
||||
'docx',
|
||||
'xls',
|
||||
'xlsx',
|
||||
'txt',
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
],
|
||||
showDescription: formType !== 'detail',
|
||||
disabled: formType === 'detail',
|
||||
},
|
||||
formItemClass: 'col-span-3',
|
||||
},
|
||||
{
|
||||
fieldName: 'items',
|
||||
label: '采购入库、退货单',
|
||||
component: 'Input',
|
||||
formItemClass: 'col-span-3',
|
||||
},
|
||||
{
|
||||
fieldName: 'accountId',
|
||||
label: '付款账户',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择付款账户',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getAccountSimpleList,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'totalPrice',
|
||||
label: '合计付款',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '合计付款',
|
||||
precision: 2,
|
||||
formatter: erpPriceInputFormatter,
|
||||
disabled: true,
|
||||
controlsPosition: 'right',
|
||||
class: '!w-full',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'discountPrice',
|
||||
label: '优惠金额',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
disabled: formType === 'detail',
|
||||
placeholder: '请输入优惠金额',
|
||||
precision: 2,
|
||||
formatter: erpPriceInputFormatter,
|
||||
controlsPosition: 'right',
|
||||
class: '!w-full',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paymentPrice',
|
||||
label: '实际付款',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '实际付款',
|
||||
precision: 2,
|
||||
formatter: erpPriceInputFormatter,
|
||||
disabled: true,
|
||||
controlsPosition: 'right',
|
||||
class: '!w-full',
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['totalPrice', 'discountPrice'],
|
||||
componentProps: (values) => {
|
||||
const totalPrice = values.totalPrice || 0;
|
||||
const discountPrice = values.discountPrice || 0;
|
||||
values.paymentPrice = totalPrice - discountPrice;
|
||||
return {};
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 表单的明细表格列 */
|
||||
export function useFormItemColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{ type: 'seq', title: '序号', minWidth: 50, fixed: 'left' },
|
||||
{
|
||||
field: 'bizNo',
|
||||
title: '采购单据编号',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '应付金额',
|
||||
minWidth: 100,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
field: 'paidPrice',
|
||||
title: '已付金额',
|
||||
minWidth: 100,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
field: 'paymentPrice',
|
||||
title: '本次付款',
|
||||
minWidth: 115,
|
||||
fixed: 'right',
|
||||
slots: { default: 'paymentPrice' },
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
minWidth: 150,
|
||||
slots: { default: 'remark' },
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 50,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '付款单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入付款单号',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paymentTime',
|
||||
label: '付款时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择供应商',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getSupplierSimpleList,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'creator',
|
||||
label: '创建人',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择创建人',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'financeUserId',
|
||||
label: '财务人员',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择财务人员',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'accountId',
|
||||
label: '付款账户',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
placeholder: '请选择付款账户',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
api: getAccountSimpleList,
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'),
|
||||
placeholder: '请选择状态',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'bizNo',
|
||||
label: '采购单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入采购单号',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: 50,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '付款单号',
|
||||
width: 180,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'supplierName',
|
||||
title: '供应商',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paymentTime',
|
||||
title: '付款时间',
|
||||
width: 160,
|
||||
formatter: 'formatDate',
|
||||
},
|
||||
{
|
||||
field: 'creatorName',
|
||||
title: '创建人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'financeUserName',
|
||||
title: '财务人员',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'accountName',
|
||||
title: '付款账户',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '合计付款',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'discountPrice',
|
||||
title: '优惠金额',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paymentPrice',
|
||||
title: '实际付款',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 90,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.ERP_AUDIT_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 220,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 采购入库单选择表单的配置项 */
|
||||
export function usePurchaseInGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '入库单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入入库单号',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
disabled: true,
|
||||
placeholder: '已自动选择供应商',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'paymentStatus',
|
||||
label: '付款状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '未付款', value: 0 },
|
||||
{ label: '部分付款', value: 1 },
|
||||
{ label: '全部付款', value: 2 },
|
||||
],
|
||||
placeholder: '请选择付款状态',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 采购入库单选择列表的字段 */
|
||||
export function usePurchaseInGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: 50,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '入库单号',
|
||||
width: 200,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'supplierName',
|
||||
title: '供应商',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'inTime',
|
||||
title: '入库时间',
|
||||
width: 160,
|
||||
formatter: 'formatDate',
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '应付金额',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'paymentPrice',
|
||||
title: '已付金额',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'unPaymentPrice',
|
||||
title: '未付金额',
|
||||
formatter: ({ row }) => {
|
||||
return erpPriceInputFormatter(row.totalPrice - row.paymentPrice || 0);
|
||||
},
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.ERP_AUDIT_STATUS },
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 采购退货单选择表单的配置项 */
|
||||
export function useSaleReturnGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'no',
|
||||
label: '退货单号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入退货单号',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
disabled: true,
|
||||
placeholder: '已自动选择供应商',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'refundStatus',
|
||||
label: '退款状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '未退款', value: 0 },
|
||||
{ label: '部分退款', value: 1 },
|
||||
{ label: '全部退款', value: 2 },
|
||||
],
|
||||
placeholder: '请选择退款状态',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 采购退货单选择列表的字段 */
|
||||
export function useSaleReturnGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: 50,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '退货单号',
|
||||
width: 200,
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
field: 'supplierName',
|
||||
title: '供应商',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'returnTime',
|
||||
title: '退货时间',
|
||||
width: 160,
|
||||
formatter: 'formatDate',
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '应退金额',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'refundPrice',
|
||||
title: '已退金额',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'unRefundPrice',
|
||||
title: '未退金额',
|
||||
formatter: ({ row }) => {
|
||||
return erpPriceInputFormatter(row.totalPrice - row.refundPrice || 0);
|
||||
},
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.ERP_AUDIT_STATUS },
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
225
apps/web-ele/src/views/erp/finance/payment/index.vue
Normal file
225
apps/web-ele/src/views/erp/finance/payment/index.vue
Normal file
@@ -0,0 +1,225 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
|
||||
|
||||
import { ElLoading, ElMessage } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteFinancePayment,
|
||||
exportFinancePayment,
|
||||
getFinancePaymentPage,
|
||||
updateFinancePaymentStatus,
|
||||
} from '#/api/erp/finance/payment';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
/** ERP 付款单列表 */
|
||||
defineOptions({ name: 'ErpFinancePayment' });
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportFinancePayment(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '付款单.xls', source: data });
|
||||
}
|
||||
|
||||
/** 新增付款单 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ type: 'create' }).open();
|
||||
}
|
||||
|
||||
/** 编辑付款单 */
|
||||
function handleEdit(row: ErpFinancePaymentApi.FinancePayment) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除付款单 */
|
||||
async function handleDelete(ids: number[]) {
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: $t('ui.actionMessage.deleting'),
|
||||
});
|
||||
try {
|
||||
await deleteFinancePayment(ids);
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess'));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
loadingInstance.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** 审批/反审批操作 */
|
||||
async function handleUpdateStatus(
|
||||
row: ErpFinancePaymentApi.FinancePayment,
|
||||
status: number,
|
||||
) {
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: `确定${status === 20 ? '审批' : '反审批'}该付款单吗?`,
|
||||
});
|
||||
try {
|
||||
await updateFinancePaymentStatus(row.id!, status);
|
||||
ElMessage.success(`${status === 20 ? '审批' : '反审批'}成功`);
|
||||
handleRefresh();
|
||||
} finally {
|
||||
loadingInstance.close();
|
||||
}
|
||||
}
|
||||
|
||||
const checkedIds = ref<number[]>([]);
|
||||
function handleRowCheckboxChange({
|
||||
records,
|
||||
}: {
|
||||
records: ErpFinancePaymentApi.FinancePayment[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id!);
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
function handleDetail(row: ErpFinancePaymentApi.FinancePayment) {
|
||||
formModalApi.setData({ type: 'detail', id: row.id }).open();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getFinancePaymentPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpFinancePaymentApi.FinancePayment>,
|
||||
gridEvents: {
|
||||
checkboxAll: handleRowCheckboxChange,
|
||||
checkboxChange: handleRowCheckboxChange,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【财务】采购付款、销售收款"
|
||||
url="https://doc.iocoder.cn/sale/finance-payment-receipt/"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="付款单列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['付款单']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['erp:finance-payment:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['erp:finance-payment:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
{
|
||||
label: '批量删除',
|
||||
type: 'danger',
|
||||
disabled: isEmpty(checkedIds),
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['erp:finance-payment:delete'],
|
||||
popConfirm: {
|
||||
title: `是否删除所选中数据?`,
|
||||
confirm: handleDelete.bind(null, checkedIds),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.detail'),
|
||||
type: 'primary',
|
||||
link: true,
|
||||
icon: ACTION_ICON.VIEW,
|
||||
auth: ['erp:finance-payment:query'],
|
||||
onClick: handleDetail.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'primary',
|
||||
link: true,
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['erp:finance-payment:update'],
|
||||
ifShow: () => row.status !== 20,
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: row.status === 10 ? '审批' : '反审批',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
auth: ['erp:finance-payment:update-status'],
|
||||
popConfirm: {
|
||||
title: `确认${row.status === 10 ? '审批' : '反审批'}${row.no}吗?`,
|
||||
confirm: handleUpdateStatus.bind(
|
||||
null,
|
||||
row,
|
||||
row.status === 10 ? 20 : 10,
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'danger',
|
||||
link: true,
|
||||
color: 'error',
|
||||
auth: ['erp:finance-payment:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
|
||||
confirm: handleDelete.bind(null, [row.id!]),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
194
apps/web-ele/src/views/erp/finance/payment/modules/form.vue
Normal file
194
apps/web-ele/src/views/erp/finance/payment/modules/form.vue
Normal file
@@ -0,0 +1,194 @@
|
||||
<script lang="ts" setup>
|
||||
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { getAccountSimpleList } from '#/api/erp/finance/account';
|
||||
import {
|
||||
createFinancePayment,
|
||||
getFinancePayment,
|
||||
updateFinancePayment,
|
||||
} from '#/api/erp/finance/payment';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
import ItemForm from './item-form.vue';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<
|
||||
ErpFinancePaymentApi.FinancePayment & {
|
||||
fileUrl?: string;
|
||||
}
|
||||
>({
|
||||
id: undefined,
|
||||
no: '',
|
||||
supplierId: undefined,
|
||||
accountId: undefined,
|
||||
financeUserId: undefined,
|
||||
paymentTime: undefined,
|
||||
remark: '',
|
||||
fileUrl: undefined,
|
||||
totalPrice: 0,
|
||||
discountPrice: 0,
|
||||
paymentPrice: 0,
|
||||
items: [],
|
||||
status: 0,
|
||||
});
|
||||
|
||||
const formType = ref(''); // 表单类型:'create' | 'edit' | 'detail'
|
||||
const itemFormRef = ref<InstanceType<typeof ItemForm>>();
|
||||
|
||||
const getTitle = computed(() => {
|
||||
if (formType.value === 'create') {
|
||||
return $t('ui.actionTitle.create', ['付款单']);
|
||||
} else if (formType.value === 'edit') {
|
||||
return $t('ui.actionTitle.edit', ['付款单']);
|
||||
} else {
|
||||
return '付款单详情';
|
||||
}
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
labelWidth: 120,
|
||||
},
|
||||
wrapperClass: 'grid-cols-3',
|
||||
layout: 'vertical',
|
||||
schema: useFormSchema(formType.value),
|
||||
showDefaultActions: false,
|
||||
handleValuesChange: (values, changedFields) => {
|
||||
if (formData.value) {
|
||||
if (changedFields.includes('supplierId')) {
|
||||
formData.value.supplierId = values.supplierId;
|
||||
}
|
||||
// 目的:同步到 item-form 组件,触发整体的价格计算
|
||||
if (changedFields.includes('discountPrice')) {
|
||||
formData.value.discountPrice = values.discountPrice;
|
||||
formData.value.paymentPrice =
|
||||
formData.value.totalPrice - values.discountPrice;
|
||||
formApi.setValues({
|
||||
paymentPrice: formData.value.paymentPrice,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/** 更新付款项 */
|
||||
function handleUpdateItems(items: ErpFinancePaymentApi.FinancePaymentItem[]) {
|
||||
formData.value.items = items;
|
||||
formApi.setValues({
|
||||
items,
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新总金额 */
|
||||
function handleUpdateTotalPrice(totalPrice: number) {
|
||||
formData.value.totalPrice = totalPrice;
|
||||
formApi.setValues({
|
||||
totalPrice: formData.value.totalPrice,
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新付款金额 */
|
||||
function handleUpdatePaymentPrice(paymentPrice: number) {
|
||||
formData.value.paymentPrice = paymentPrice;
|
||||
formApi.setValues({
|
||||
paymentPrice: formData.value.paymentPrice,
|
||||
});
|
||||
}
|
||||
|
||||
/** 创建或更新付款单 */
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const itemFormInstance = Array.isArray(itemFormRef.value)
|
||||
? itemFormRef.value[0]
|
||||
: itemFormRef.value;
|
||||
try {
|
||||
itemFormInstance.validate();
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message || '子表单验证失败');
|
||||
return;
|
||||
}
|
||||
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as ErpFinancePaymentApi.FinancePayment;
|
||||
try {
|
||||
await (formType.value === 'create'
|
||||
? createFinancePayment(data)
|
||||
: updateFinancePayment(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = {} as ErpFinancePaymentApi.FinancePayment;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ id?: number; type: string }>();
|
||||
formType.value = data.type;
|
||||
formApi.setDisabled(formType.value === 'detail');
|
||||
formApi.updateSchema(useFormSchema(formType.value));
|
||||
if (!data || !data.id) {
|
||||
// 新增时,默认选中账户
|
||||
const accountList = await getAccountSimpleList();
|
||||
const defaultAccount = accountList.find((item) => item.defaultStatus);
|
||||
if (defaultAccount) {
|
||||
await formApi.setValues({ accountId: defaultAccount.id });
|
||||
}
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getFinancePayment(data.id);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value, false);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal
|
||||
:title="getTitle"
|
||||
class="w-3/4"
|
||||
:show-confirm-button="formType !== 'detail'"
|
||||
>
|
||||
<Form class="mx-3">
|
||||
<template #items>
|
||||
<ItemForm
|
||||
ref="itemFormRef"
|
||||
:items="formData?.items ?? []"
|
||||
:supplier-id="formData?.supplierId"
|
||||
:disabled="formType === 'detail'"
|
||||
:discount-price="formData?.discountPrice ?? 0"
|
||||
@update:items="handleUpdateItems"
|
||||
@update:total-price="handleUpdateTotalPrice"
|
||||
@update:payment-price="handleUpdatePaymentPrice"
|
||||
/>
|
||||
</template>
|
||||
</Form>
|
||||
</Modal>
|
||||
</template>
|
||||
302
apps/web-ele/src/views/erp/finance/payment/modules/item-form.vue
Normal file
302
apps/web-ele/src/views/erp/finance/payment/modules/item-form.vue
Normal file
@@ -0,0 +1,302 @@
|
||||
<script lang="ts" setup>
|
||||
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
|
||||
import type { ErpPurchaseInApi } from '#/api/erp/purchase/in';
|
||||
import type { ErpPurchaseReturnApi } from '#/api/erp/purchase/return';
|
||||
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
|
||||
import { ErpBizType } from '@vben/constants';
|
||||
import { erpPriceInputFormatter } from '@vben/utils';
|
||||
|
||||
import { ElInput, ElInputNumber, ElMessage } from 'element-plus';
|
||||
|
||||
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
|
||||
import { useFormItemColumns } from '../data';
|
||||
import PurchaseInSelect from './purchase-in-select.vue';
|
||||
import SaleReturnSelect from './sale-return-select.vue';
|
||||
|
||||
interface Props {
|
||||
items?: ErpFinancePaymentApi.FinancePaymentItem[];
|
||||
supplierId?: number;
|
||||
disabled?: boolean;
|
||||
discountPrice?: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
items: () => [],
|
||||
supplierId: undefined,
|
||||
disabled: false,
|
||||
discountPrice: 0,
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:items',
|
||||
'update:total-price',
|
||||
'update:payment-price',
|
||||
]);
|
||||
|
||||
const tableData = ref<ErpFinancePaymentApi.FinancePaymentItem[]>([]); // 表格数据
|
||||
|
||||
/** 获取表格合计数据 */
|
||||
const summaries = computed(() => {
|
||||
return {
|
||||
totalPrice: tableData.value.reduce(
|
||||
(sum, item) => sum + (item.totalPrice || 0),
|
||||
0,
|
||||
),
|
||||
paidPrice: tableData.value.reduce(
|
||||
(sum, item) => sum + (item.paidPrice || 0),
|
||||
0,
|
||||
),
|
||||
paymentPrice: tableData.value.reduce(
|
||||
(sum, item) => sum + (item.paymentPrice || 0),
|
||||
0,
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
/** 表格配置 */
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
columns: useFormItemColumns(),
|
||||
data: tableData.value,
|
||||
minHeight: 250,
|
||||
autoResize: true,
|
||||
border: true,
|
||||
rowConfig: {
|
||||
keyField: 'seq',
|
||||
isHover: true,
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
toolbarConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** 监听外部传入的列数据 */
|
||||
watch(
|
||||
() => props.items,
|
||||
async (items) => {
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
tableData.value = [...items];
|
||||
await nextTick(); // 特殊:保证 gridApi 已经初始化
|
||||
await gridApi.grid.reloadData(tableData.value);
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
|
||||
/** 计算 totalPrice、paymentPrice 价格 */
|
||||
watch(
|
||||
() => [tableData.value, props.discountPrice],
|
||||
() => {
|
||||
if (!tableData.value || tableData.value.length === 0) {
|
||||
return;
|
||||
}
|
||||
const totalPrice = tableData.value.reduce(
|
||||
(prev, curr) => prev + (curr.totalPrice || 0),
|
||||
0,
|
||||
);
|
||||
const paymentPrice = tableData.value.reduce(
|
||||
(prev, curr) => prev + (curr.paymentPrice || 0),
|
||||
0,
|
||||
);
|
||||
const finalPaymentPrice = paymentPrice - (props.discountPrice || 0);
|
||||
// 通知父组件更新
|
||||
emit('update:total-price', totalPrice);
|
||||
emit('update:payment-price', finalPaymentPrice);
|
||||
},
|
||||
{ deep: true },
|
||||
);
|
||||
|
||||
/** 添加采购入库单 */
|
||||
const purchaseInSelectRef = ref();
|
||||
const handleOpenPurchaseIn = () => {
|
||||
if (!props.supplierId) {
|
||||
ElMessage.error('请选择供应商');
|
||||
return;
|
||||
}
|
||||
purchaseInSelectRef.value?.open(props.supplierId);
|
||||
};
|
||||
|
||||
const handleAddPurchaseIn = (rows: ErpPurchaseInApi.PurchaseIn[]) => {
|
||||
rows.forEach((row) => {
|
||||
const newItem: ErpFinancePaymentApi.FinancePaymentItem = {
|
||||
bizId: row.id,
|
||||
bizType: ErpBizType.PURCHASE_IN,
|
||||
bizNo: row.no,
|
||||
totalPrice: row.totalPrice,
|
||||
paidPrice: row.paymentPrice,
|
||||
paymentPrice: row.totalPrice - row.paymentPrice,
|
||||
remark: undefined,
|
||||
};
|
||||
tableData.value.push(newItem);
|
||||
});
|
||||
emit('update:items', [...tableData.value]);
|
||||
};
|
||||
|
||||
/** 添加采购退货单 */
|
||||
const saleReturnSelectRef = ref();
|
||||
const handleOpenSaleReturn = () => {
|
||||
if (!props.supplierId) {
|
||||
ElMessage.error('请选择供应商');
|
||||
return;
|
||||
}
|
||||
saleReturnSelectRef.value?.open(props.supplierId);
|
||||
};
|
||||
|
||||
const handleAddSaleReturn = (rows: ErpPurchaseReturnApi.PurchaseReturn[]) => {
|
||||
rows.forEach((row) => {
|
||||
const newItem: ErpFinancePaymentApi.FinancePaymentItem = {
|
||||
bizId: row.id,
|
||||
bizType: ErpBizType.PURCHASE_RETURN,
|
||||
bizNo: row.no,
|
||||
totalPrice: -row.totalPrice,
|
||||
paidPrice: -row.refundPrice,
|
||||
paymentPrice: -row.totalPrice + row.refundPrice,
|
||||
remark: undefined,
|
||||
};
|
||||
tableData.value.push(newItem);
|
||||
});
|
||||
emit('update:items', [...tableData.value]);
|
||||
};
|
||||
|
||||
/** 删除行 */
|
||||
const handleDelete = async (row: any) => {
|
||||
const index = tableData.value.findIndex(
|
||||
(item) => item.bizId === row.bizId && item.bizType === row.bizType,
|
||||
);
|
||||
if (index !== -1) {
|
||||
tableData.value.splice(index, 1);
|
||||
}
|
||||
// 通知父组件更新
|
||||
emit('update:items', [...tableData.value]);
|
||||
};
|
||||
|
||||
/** 处理行数据变更 */
|
||||
const handleRowChange = (row: any) => {
|
||||
const index = tableData.value.findIndex(
|
||||
(item) => item.bizId === row.bizId && item.bizType === row.bizType,
|
||||
);
|
||||
if (index === -1) {
|
||||
tableData.value.push(row);
|
||||
} else {
|
||||
tableData.value[index] = row;
|
||||
}
|
||||
emit('update:items', [...tableData.value]);
|
||||
};
|
||||
|
||||
/** 表单校验 */
|
||||
const validate = () => {
|
||||
// 检查是否有明细
|
||||
if (tableData.value.length === 0) {
|
||||
throw new Error('请添加付款明细');
|
||||
}
|
||||
// 检查每行的付款金额
|
||||
for (let i = 0; i < tableData.value.length; i++) {
|
||||
const item = tableData.value[i];
|
||||
if (!item.paymentPrice || item.paymentPrice <= 0) {
|
||||
throw new Error(`第 ${i + 1} 行:本次付款必须大于0`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ validate });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Grid class="w-full">
|
||||
<template #paymentPrice="{ row }">
|
||||
<ElInputNumber
|
||||
v-model="row.paymentPrice"
|
||||
:precision="2"
|
||||
:disabled="disabled"
|
||||
:formatter="erpPriceInputFormatter"
|
||||
placeholder="请输入本次付款"
|
||||
controls-position="right"
|
||||
class="!w-full"
|
||||
@change="handleRowChange(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #remark="{ row }">
|
||||
<ElInput
|
||||
v-model="row.remark"
|
||||
:disabled="disabled"
|
||||
placeholder="请输入备注"
|
||||
@change="handleRowChange(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
v-if="!disabled"
|
||||
:actions="[
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
popConfirm: {
|
||||
title: '确认删除该付款明细吗?',
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #bottom>
|
||||
<div class="border-border bg-muted mt-2 rounded border p-2">
|
||||
<div class="text-muted-foreground flex justify-between text-sm">
|
||||
<span class="text-foreground font-medium">合计:</span>
|
||||
<div class="flex space-x-4">
|
||||
<span>
|
||||
合计付款:{{ erpPriceInputFormatter(summaries.totalPrice) }}
|
||||
</span>
|
||||
<span>
|
||||
已付金额:{{ erpPriceInputFormatter(summaries.paidPrice) }}
|
||||
</span>
|
||||
<span>
|
||||
本次付款:
|
||||
{{ erpPriceInputFormatter(summaries.paymentPrice) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TableAction
|
||||
v-if="!disabled"
|
||||
class="mt-2 flex justify-center"
|
||||
:actions="[
|
||||
{
|
||||
label: '添加采购入库单',
|
||||
type: 'default',
|
||||
onClick: handleOpenPurchaseIn,
|
||||
},
|
||||
{
|
||||
label: '添加采购退货单',
|
||||
type: 'default',
|
||||
onClick: handleOpenSaleReturn,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
<!-- 采购入库单选择组件 -->
|
||||
<PurchaseInSelect
|
||||
ref="purchaseInSelectRef"
|
||||
@success="handleAddPurchaseIn"
|
||||
/>
|
||||
<!-- 采购退货单选择组件 -->
|
||||
<SaleReturnSelect
|
||||
ref="saleReturnSelectRef"
|
||||
@success="handleAddSaleReturn"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,112 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpPurchaseInApi } from '#/api/erp/purchase/in';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { ElDialog, ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getPurchaseInPage } from '#/api/erp/purchase/in';
|
||||
|
||||
import { usePurchaseInGridColumns, usePurchaseInGridFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits<{
|
||||
success: [rows: ErpPurchaseInApi.PurchaseIn[]];
|
||||
}>();
|
||||
|
||||
const supplierId = ref<number>(); // 供应商ID
|
||||
const open = ref<boolean>(false); // 弹窗是否打开
|
||||
const selectedRows = ref<ErpPurchaseInApi.PurchaseIn[]>([]); // 选中的行
|
||||
|
||||
/** 表格配置 */
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: usePurchaseInGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: usePurchaseInGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getPurchaseInPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
supplierId: supplierId.value,
|
||||
paymentEnable: true, // 只查询可付款的
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
range: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpPurchaseInApi.PurchaseIn>,
|
||||
gridEvents: {
|
||||
checkboxChange: ({
|
||||
records,
|
||||
}: {
|
||||
records: ErpPurchaseInApi.PurchaseIn[];
|
||||
}) => {
|
||||
selectedRows.value = records;
|
||||
},
|
||||
checkboxAll: ({ records }: { records: ErpPurchaseInApi.PurchaseIn[] }) => {
|
||||
selectedRows.value = records;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** 打开弹窗 */
|
||||
function openModal(id: number) {
|
||||
// 重置数据
|
||||
supplierId.value = id;
|
||||
open.value = true;
|
||||
selectedRows.value = [];
|
||||
// 查询列表
|
||||
gridApi.formApi?.resetForm();
|
||||
gridApi.formApi?.setValues({ supplierId: id });
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 确认选择采购入库单 */
|
||||
function handleOk() {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请选择要添加的采购入库单');
|
||||
return;
|
||||
}
|
||||
emit('success', selectedRows.value);
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
defineExpose({ open: openModal });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ElDialog
|
||||
class="!w-[50vw]"
|
||||
v-model="open"
|
||||
title="选择采购入库单"
|
||||
@confirm="handleOk"
|
||||
>
|
||||
<Grid
|
||||
class="max-h-[600px]"
|
||||
table-title="采购入库单列表(仅展示可付款的单据)"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="open = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleOk">确定</el-button>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</template>
|
||||
@@ -0,0 +1,116 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ErpPurchaseReturnApi } from '#/api/erp/purchase/return';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { ElDialog, ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getPurchaseReturnPage } from '#/api/erp/purchase/return';
|
||||
|
||||
import { useSaleReturnGridColumns, useSaleReturnGridFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits<{
|
||||
success: [rows: ErpPurchaseReturnApi.PurchaseReturn[]];
|
||||
}>();
|
||||
|
||||
const supplierId = ref<number>(); // 供应商ID
|
||||
const open = ref<boolean>(false); // 弹窗是否打开
|
||||
const selectedRows = ref<ErpPurchaseReturnApi.PurchaseReturn[]>([]); // 选中的行
|
||||
|
||||
/** 表格配置 */
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useSaleReturnGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useSaleReturnGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getPurchaseReturnPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
supplierId: supplierId.value,
|
||||
refundEnable: true, // 只查询可退款的
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
range: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<ErpPurchaseReturnApi.PurchaseReturn>,
|
||||
gridEvents: {
|
||||
checkboxChange: ({
|
||||
records,
|
||||
}: {
|
||||
records: ErpPurchaseReturnApi.PurchaseReturn[];
|
||||
}) => {
|
||||
selectedRows.value = records;
|
||||
},
|
||||
checkboxAll: ({
|
||||
records,
|
||||
}: {
|
||||
records: ErpPurchaseReturnApi.PurchaseReturn[];
|
||||
}) => {
|
||||
selectedRows.value = records;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** 打开弹窗 */
|
||||
function openModal(id: number) {
|
||||
// 重置数据
|
||||
supplierId.value = id;
|
||||
open.value = true;
|
||||
selectedRows.value = [];
|
||||
// 查询列表
|
||||
gridApi.formApi?.resetForm();
|
||||
gridApi.formApi?.setValues({ supplierId: id });
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 确认选择 */
|
||||
function handleOk() {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请选择要添加的采购退货单');
|
||||
return;
|
||||
}
|
||||
emit('success', selectedRows.value);
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
defineExpose({ open: openModal });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ElDialog
|
||||
class="!w-[50vw]"
|
||||
v-model="open"
|
||||
title="选择采购退货单"
|
||||
@confirm="handleOk"
|
||||
>
|
||||
<Grid
|
||||
class="max-h-[600px]"
|
||||
table-title="采购退货单列表(仅展示需退款的单据)"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="open = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleOk">确定</el-button>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</template>
|
||||
Reference in New Issue
Block a user