gaoluyang
2026-06-29 27cd042df9aca0383a49f3514bc21958dd890912
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesWmProductSalesApi } from '#/api/mes/wm/productsales';
 
import { useVbenModal } from '../../../../../packages/effects/common-ui/src';
import { DICT_TYPE } from '../../../../../packages/constants/src';
 
import { Button } from 'ant-design-vue';
 
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getProductSalesPage } from '#/api/mes/wm/productsales';
import ProductSalesForm from '#/views/mes/wm/productsales/modules/form.vue';
 
const props = defineProps<{
  clientId: number;
}>();
 
const [DetailModal, detailModalApi] = useVbenModal({
  connectedComponent: ProductSalesForm,
  destroyOnClose: true,
});
 
/** 查看销售出库单详情 */
function handleViewSales(row: MesWmProductSalesApi.ProductSales) {
  if (row.id) {
    detailModalApi.setData({ formType: 'detail', id: row.id }).open();
  }
}
 
const [Grid] = useVbenVxeGrid({
  gridOptions: {
    columns: [
      {
        field: 'code',
        title: '出库单编号',
        minWidth: 160,
        slots: { default: 'code' },
      },
      {
        field: 'name',
        title: '出库单名称',
        minWidth: 150,
      },
      {
        field: 'salesOrderCode',
        title: '销售订单编号',
        minWidth: 140,
      },
      {
        field: 'salesDate',
        title: '出库日期',
        width: 180,
        formatter: 'formatDateTime',
      },
      {
        field: 'status',
        title: '单据状态',
        width: 120,
        cellRender: {
          name: 'CellDict',
          props: { type: DICT_TYPE.MES_WM_PRODUCT_SALES_STATUS },
        },
      },
    ],
    height: 320,
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async ({ page }) => {
          return await getProductSalesPage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            clientId: props.clientId,
          });
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
    },
  } as VxeTableGridOptions<MesWmProductSalesApi.ProductSales>,
});
</script>
 
<template>
  <DetailModal />
  <Grid table-title="销售记录">
    <template #code="{ row }">
      <Button type="link" @click="handleViewSales(row)">
        {{ row.code }}
      </Button>
    </template>
  </Grid>
</template>