feat(@vben/web-antd): erp-区分采购对象
- 修改命名空间 PurchaseOrderApi 为 ErpPurchaseOrderApi - 为接口属性添加注释,明确其含义和单位 - 更新相关视图和组件中的导入和使用pull/181/head
parent
0b47648650
commit
1cad71f3bf
|
@ -2,50 +2,51 @@ import type { PageParam, PageResult } from '@vben/request';
|
|||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace PurchaseOrderApi {
|
||||
/** 采购订单产品信息 */
|
||||
export namespace ErpPurchaseOrderApi {
|
||||
/** ERP 采购订单项信息 */
|
||||
export interface PurchaseOrderItem {
|
||||
id?: number;
|
||||
productId?: number;
|
||||
productName?: string;
|
||||
productBarCode?: string;
|
||||
productUnitId?: number;
|
||||
productUnitName?: string;
|
||||
productPrice?: number;
|
||||
count?: number;
|
||||
totalPrice?: number;
|
||||
taxPercent?: number;
|
||||
taxPrice?: number;
|
||||
totalTaxPrice?: number;
|
||||
remark?: string;
|
||||
stockCount?: number;
|
||||
id?: number; // 订单项编号
|
||||
orderId?: number; // 采购订单编号
|
||||
productId?: number; // 产品编号
|
||||
productName?: string; // 产品名称
|
||||
productBarCode?: string; // 产品条码
|
||||
productUnitId?: number; // 产品单位编号
|
||||
productUnitName?: string; // 产品单位名称
|
||||
productPrice?: number; // 产品单价,单位:元
|
||||
count?: number; // 数量
|
||||
totalPrice?: number; // 总价,单位:元
|
||||
taxPercent?: number; // 税率,百分比
|
||||
taxPrice?: number; // 税额,单位:元
|
||||
totalTaxPrice?: number; // 含税总价,单位:元
|
||||
remark?: string; // 备注
|
||||
stockCount?: number; // 库存数量(显示字段)
|
||||
}
|
||||
|
||||
/** ERP 采购订单信息 */
|
||||
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;
|
||||
returnCount?: number;
|
||||
inStatus?: number;
|
||||
returnStatus?: number;
|
||||
productNames?: string;
|
||||
creatorName?: string;
|
||||
createTime?: Date;
|
||||
items?: PurchaseOrderItem[];
|
||||
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; // 采购入库数量
|
||||
returnCount?: number; // 采购退货数量
|
||||
inStatus?: number; // 入库状态
|
||||
returnStatus?: number; // 退货状态
|
||||
productNames?: string; // 产品名称列表
|
||||
creatorName?: string; // 创建人名称
|
||||
createTime?: Date; // 创建时间
|
||||
items?: PurchaseOrderItem[]; // 订单项列表
|
||||
}
|
||||
|
||||
/** 采购订单分页查询参数 */
|
||||
|
@ -64,9 +65,9 @@ export namespace PurchaseOrderApi {
|
|||
|
||||
/** 查询采购订单分页 */
|
||||
export function getPurchaseOrderPage(
|
||||
params: PurchaseOrderApi.PurchaseOrderPageParam,
|
||||
params: ErpPurchaseOrderApi.PurchaseOrderPageParam,
|
||||
) {
|
||||
return requestClient.get<PageResult<PurchaseOrderApi.PurchaseOrder>>(
|
||||
return requestClient.get<PageResult<ErpPurchaseOrderApi.PurchaseOrder>>(
|
||||
'/erp/purchase-order/page',
|
||||
{ params },
|
||||
);
|
||||
|
@ -74,18 +75,18 @@ export function getPurchaseOrderPage(
|
|||
|
||||
/** 查询采购订单详情 */
|
||||
export function getPurchaseOrder(id: number) {
|
||||
return requestClient.get<PurchaseOrderApi.PurchaseOrder>(
|
||||
return requestClient.get<ErpPurchaseOrderApi.PurchaseOrder>(
|
||||
`/erp/purchase-order/get?id=${id}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** 新增采购订单 */
|
||||
export function createPurchaseOrder(data: PurchaseOrderApi.PurchaseOrder) {
|
||||
export function createPurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
return requestClient.post('/erp/purchase-order/create', data);
|
||||
}
|
||||
|
||||
/** 修改采购订单 */
|
||||
export function updatePurchaseOrder(data: PurchaseOrderApi.PurchaseOrder) {
|
||||
export function updatePurchaseOrder(data: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
return requestClient.put('/erp/purchase-order/update', data);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts" setup>
|
||||
import type { PurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
||||
|
||||
|
@ -55,7 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||
|
||||
const formLoading = ref(false);
|
||||
const formType = ref('');
|
||||
const formData = ref<PurchaseOrderApi.PurchaseOrder>({
|
||||
const formData = ref<ErpPurchaseOrderApi.PurchaseOrder>({
|
||||
id: undefined,
|
||||
no: undefined,
|
||||
supplierId: undefined,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts" setup>
|
||||
import type { PurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
|
@ -25,11 +25,11 @@ const getSumValue = (values: (number | undefined)[]): number => {
|
|||
};
|
||||
|
||||
interface Props {
|
||||
items?: PurchaseOrderApi.PurchaseOrderItem[];
|
||||
items?: ErpPurchaseOrderApi.PurchaseOrderItem[];
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const formData = ref<PurchaseOrderApi.PurchaseOrderItem[]>([]);
|
||||
const formData = ref<ErpPurchaseOrderApi.PurchaseOrderItem[]>([]);
|
||||
const productList = ref<any[]>([]);
|
||||
|
||||
/** 监听 props.items 变化,重新设置 formData */
|
||||
|
@ -225,7 +225,7 @@ const getData = () => {
|
|||
};
|
||||
|
||||
/** 初始化 */
|
||||
const init = (items: PurchaseOrderApi.PurchaseOrderItem[]) => {
|
||||
const init = (items: ErpPurchaseOrderApi.PurchaseOrderItem[]) => {
|
||||
formData.value = items || [];
|
||||
// 如果没有数据,默认添加一行
|
||||
if (formData.value.length === 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { PurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
import type { ErpPurchaseOrderApi } from '#/api/erp/purchase/order';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
@ -41,13 +41,13 @@ const checkedIds = ref<number[]>([]);
|
|||
function handleRowCheckboxChange({
|
||||
records,
|
||||
}: {
|
||||
records: PurchaseOrderApi.PurchaseOrder[];
|
||||
records: ErpPurchaseOrderApi.PurchaseOrder[];
|
||||
}) {
|
||||
checkedIds.value = records.map((item) => item.id);
|
||||
}
|
||||
|
||||
/** 详情 */
|
||||
function handleDetail(row: PurchaseOrderApi.PurchaseOrder) {
|
||||
function handleDetail(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
push({ name: 'ErpPurchaseOrderDetail', params: { id: row.id } });
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,12 @@ function handleCreate() {
|
|||
}
|
||||
|
||||
/** 编辑 */
|
||||
function handleEdit(row: PurchaseOrderApi.PurchaseOrder) {
|
||||
function handleEdit(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
function handleDelete(row: PurchaseOrderApi.PurchaseOrder) {
|
||||
function handleDelete(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||
handleBatchDelete([row.id]);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ async function handleBatchDelete() {
|
|||
|
||||
/** 审批/反审批操作 */
|
||||
function handleUpdateStatus(
|
||||
row: PurchaseOrderApi.PurchaseOrder,
|
||||
row: ErpPurchaseOrderApi.PurchaseOrder,
|
||||
status: number,
|
||||
) {
|
||||
const hideLoading = message.loading({
|
||||
|
@ -151,7 +151,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<PurchaseOrderApi.PurchaseOrder>,
|
||||
} as VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>,
|
||||
gridEvents: {
|
||||
checkboxAll: handleRowCheckboxChange,
|
||||
checkboxChange: handleRowCheckboxChange,
|
||||
|
|
Loading…
Reference in New Issue