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
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesWmProductSalesLineApi } from '#/api/mes/wm/productsales/line';
 
import { useVbenModal } from '../../../../../packages/effects/common-ui/src';
 
import { Button } from 'ant-design-vue';
 
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getProductSalesLinePage } from '#/api/mes/wm/productsales/line';
import ItemForm from '#/views/mes/md/item/modules/form.vue';
 
const props = defineProps<{
  clientId: number;
}>();
 
const [ItemFormModal, itemFormModalApi] = useVbenModal({
  connectedComponent: ItemForm,
  destroyOnClose: true,
});
 
/** 查看物料详情 */
function handleViewItem(row: MesWmProductSalesLineApi.ProductSalesLine) {
  itemFormModalApi.setData({ id: row.itemId, formType: 'detail' }).open();
}
 
const [Grid] = useVbenVxeGrid({
  gridOptions: {
    columns: [
      {
        field: 'itemCode',
        title: '物料编码',
        width: 140,
        slots: { default: 'itemCode' },
      },
      {
        field: 'itemName',
        title: '物料名称',
        minWidth: 150,
      },
      {
        field: 'specification',
        title: '规格型号',
        minWidth: 140,
      },
      {
        field: 'unitMeasureName',
        title: '单位',
        width: 100,
      },
      {
        field: 'quantity',
        title: '出库数量',
        width: 120,
      },
      {
        field: 'batchCode',
        title: '批次号',
        minWidth: 140,
      },
    ],
    height: 320,
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async ({ page }) => {
          return await getProductSalesLinePage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            clientId: props.clientId,
          });
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
    },
  } as VxeTableGridOptions<MesWmProductSalesLineApi.ProductSalesLine>,
});
</script>
 
<template>
  <ItemFormModal />
  <Grid table-title="产品清单">
    <template #itemCode="{ row }">
      <Button type="link" @click="handleViewItem(row)">
        {{ row.itemCode }}
      </Button>
    </template>
  </Grid>
</template>