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';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
export namespace PurchaseOrderApi {
|
export namespace ErpPurchaseOrderApi {
|
||||||
/** 采购订单产品信息 */
|
/** ERP 采购订单项信息 */
|
||||||
export interface PurchaseOrderItem {
|
export interface PurchaseOrderItem {
|
||||||
id?: number;
|
id?: number; // 订单项编号
|
||||||
productId?: number;
|
orderId?: number; // 采购订单编号
|
||||||
productName?: string;
|
productId?: number; // 产品编号
|
||||||
productBarCode?: string;
|
productName?: string; // 产品名称
|
||||||
productUnitId?: number;
|
productBarCode?: string; // 产品条码
|
||||||
productUnitName?: string;
|
productUnitId?: number; // 产品单位编号
|
||||||
productPrice?: number;
|
productUnitName?: string; // 产品单位名称
|
||||||
count?: number;
|
productPrice?: number; // 产品单价,单位:元
|
||||||
totalPrice?: number;
|
count?: number; // 数量
|
||||||
taxPercent?: number;
|
totalPrice?: number; // 总价,单位:元
|
||||||
taxPrice?: number;
|
taxPercent?: number; // 税率,百分比
|
||||||
totalTaxPrice?: number;
|
taxPrice?: number; // 税额,单位:元
|
||||||
remark?: string;
|
totalTaxPrice?: number; // 含税总价,单位:元
|
||||||
stockCount?: number;
|
remark?: string; // 备注
|
||||||
|
stockCount?: number; // 库存数量(显示字段)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ERP 采购订单信息 */
|
/** ERP 采购订单信息 */
|
||||||
export interface PurchaseOrder {
|
export interface PurchaseOrder {
|
||||||
id?: number;
|
id?: number; // 订单工单编号
|
||||||
no?: string;
|
no?: string; // 采购订单号
|
||||||
supplierId?: number;
|
supplierId?: number; // 供应商编号
|
||||||
supplierName?: string;
|
supplierName?: string; // 供应商名称
|
||||||
orderTime?: Date | string;
|
orderTime?: Date | string; // 订单时间
|
||||||
totalCount?: number;
|
totalCount?: number; // 合计数量
|
||||||
totalPrice?: number;
|
totalPrice?: number; // 合计金额,单位:元
|
||||||
totalProductPrice?: number;
|
totalProductPrice?: number; // 产品金额,单位:元
|
||||||
discountPercent?: number;
|
discountPercent?: number; // 优惠率,百分比
|
||||||
discountPrice?: number;
|
discountPrice?: number; // 优惠金额,单位:元
|
||||||
depositPrice?: number;
|
depositPrice?: number; // 定金金额,单位:元
|
||||||
accountId?: number;
|
accountId?: number; // 结算账户编号
|
||||||
status?: number;
|
status?: number; // 状态
|
||||||
remark?: string;
|
remark?: string; // 备注
|
||||||
fileUrl?: string;
|
fileUrl?: string; // 附件地址
|
||||||
inCount?: number;
|
inCount?: number; // 采购入库数量
|
||||||
returnCount?: number;
|
returnCount?: number; // 采购退货数量
|
||||||
inStatus?: number;
|
inStatus?: number; // 入库状态
|
||||||
returnStatus?: number;
|
returnStatus?: number; // 退货状态
|
||||||
productNames?: string;
|
productNames?: string; // 产品名称列表
|
||||||
creatorName?: string;
|
creatorName?: string; // 创建人名称
|
||||||
createTime?: Date;
|
createTime?: Date; // 创建时间
|
||||||
items?: PurchaseOrderItem[];
|
items?: PurchaseOrderItem[]; // 订单项列表
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 采购订单分页查询参数 */
|
/** 采购订单分页查询参数 */
|
||||||
|
@ -64,9 +65,9 @@ export namespace PurchaseOrderApi {
|
||||||
|
|
||||||
/** 查询采购订单分页 */
|
/** 查询采购订单分页 */
|
||||||
export function getPurchaseOrderPage(
|
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',
|
'/erp/purchase-order/page',
|
||||||
{ params },
|
{ params },
|
||||||
);
|
);
|
||||||
|
@ -74,18 +75,18 @@ export function getPurchaseOrderPage(
|
||||||
|
|
||||||
/** 查询采购订单详情 */
|
/** 查询采购订单详情 */
|
||||||
export function getPurchaseOrder(id: number) {
|
export function getPurchaseOrder(id: number) {
|
||||||
return requestClient.get<PurchaseOrderApi.PurchaseOrder>(
|
return requestClient.get<ErpPurchaseOrderApi.PurchaseOrder>(
|
||||||
`/erp/purchase-order/get?id=${id}`,
|
`/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);
|
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);
|
return requestClient.put('/erp/purchase-order/update', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts" setup>
|
<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';
|
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
|
|
||||||
const formLoading = ref(false);
|
const formLoading = ref(false);
|
||||||
const formType = ref('');
|
const formType = ref('');
|
||||||
const formData = ref<PurchaseOrderApi.PurchaseOrder>({
|
const formData = ref<ErpPurchaseOrderApi.PurchaseOrder>({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
no: undefined,
|
no: undefined,
|
||||||
supplierId: undefined,
|
supplierId: undefined,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts" setup>
|
<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';
|
import { onMounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ const getSumValue = (values: (number | undefined)[]): number => {
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
items?: PurchaseOrderApi.PurchaseOrderItem[];
|
items?: ErpPurchaseOrderApi.PurchaseOrderItem[];
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData = ref<PurchaseOrderApi.PurchaseOrderItem[]>([]);
|
const formData = ref<ErpPurchaseOrderApi.PurchaseOrderItem[]>([]);
|
||||||
const productList = ref<any[]>([]);
|
const productList = ref<any[]>([]);
|
||||||
|
|
||||||
/** 监听 props.items 变化,重新设置 formData */
|
/** 监听 props.items 变化,重新设置 formData */
|
||||||
|
@ -225,7 +225,7 @@ const getData = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
const init = (items: PurchaseOrderApi.PurchaseOrderItem[]) => {
|
const init = (items: ErpPurchaseOrderApi.PurchaseOrderItem[]) => {
|
||||||
formData.value = items || [];
|
formData.value = items || [];
|
||||||
// 如果没有数据,默认添加一行
|
// 如果没有数据,默认添加一行
|
||||||
if (formData.value.length === 0) {
|
if (formData.value.length === 0) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
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 { ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
@ -41,13 +41,13 @@ const checkedIds = ref<number[]>([]);
|
||||||
function handleRowCheckboxChange({
|
function handleRowCheckboxChange({
|
||||||
records,
|
records,
|
||||||
}: {
|
}: {
|
||||||
records: PurchaseOrderApi.PurchaseOrder[];
|
records: ErpPurchaseOrderApi.PurchaseOrder[];
|
||||||
}) {
|
}) {
|
||||||
checkedIds.value = records.map((item) => item.id);
|
checkedIds.value = records.map((item) => item.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 详情 */
|
/** 详情 */
|
||||||
function handleDetail(row: PurchaseOrderApi.PurchaseOrder) {
|
function handleDetail(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||||
push({ name: 'ErpPurchaseOrderDetail', params: { id: row.id } });
|
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();
|
formModalApi.setData({ type: 'edit', id: row.id }).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除 */
|
/** 删除 */
|
||||||
function handleDelete(row: PurchaseOrderApi.PurchaseOrder) {
|
function handleDelete(row: ErpPurchaseOrderApi.PurchaseOrder) {
|
||||||
handleBatchDelete([row.id]);
|
handleBatchDelete([row.id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ async function handleBatchDelete() {
|
||||||
|
|
||||||
/** 审批/反审批操作 */
|
/** 审批/反审批操作 */
|
||||||
function handleUpdateStatus(
|
function handleUpdateStatus(
|
||||||
row: PurchaseOrderApi.PurchaseOrder,
|
row: ErpPurchaseOrderApi.PurchaseOrder,
|
||||||
status: number,
|
status: number,
|
||||||
) {
|
) {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
|
@ -151,7 +151,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
refresh: true,
|
refresh: true,
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<PurchaseOrderApi.PurchaseOrder>,
|
} as VxeTableGridOptions<ErpPurchaseOrderApi.PurchaseOrder>,
|
||||||
gridEvents: {
|
gridEvents: {
|
||||||
checkboxAll: handleRowCheckboxChange,
|
checkboxAll: handleRowCheckboxChange,
|
||||||
checkboxChange: handleRowCheckboxChange,
|
checkboxChange: handleRowCheckboxChange,
|
||||||
|
|
Loading…
Reference in New Issue