gaoluyang
2 天以前 b64a0deae5b5d33f9e20671a68936b27f0b9b00b
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
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesProWorkOrderBomApi } from '#/api/mes/pro/workorder/bom';
 
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getWorkOrderBomItemListByWorkOrderId } from '#/api/mes/pro/workorder/bom';
 
import { useItemGridColumns } from '../data';
 
const props = defineProps<{
  workOrderId: number;
}>();
 
const [Grid] = useVbenVxeGrid({
  gridOptions: {
    columns: useItemGridColumns(),
    height: 400,
    keepSource: true,
    pagerConfig: {
      enabled: false,
    },
    proxyConfig: {
      ajax: {
        query: async () => {
          if (!props.workOrderId) {
            return [];
          }
          return await getWorkOrderBomItemListByWorkOrderId(props.workOrderId);
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
    },
  } as VxeTableGridOptions<MesProWorkOrderBomApi.WorkOrderBom>,
});
</script>
 
<template>
  <Grid table-title="物料需求" />
</template>