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
| <script lang="ts" setup>
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
| import { watch } from 'vue';
|
| import { useVbenVxeGrid } from '#/adapter/vxe-table';
| import { getPurchaseSourceList } from '#/api/mes/wm/batch';
|
| import { usePurchaseSourceColumns } from '../data';
|
| const props = defineProps<{
| batchCode?: string;
| }>();
|
| const [Grid, gridApi] = useVbenVxeGrid({
| gridOptions: {
| columns: usePurchaseSourceColumns(),
| minHeight: 240,
| pagerConfig: {
| enabled: false,
| },
| rowConfig: {
| isHover: true,
| },
| showOverflow: true,
| toolbarConfig: {
| enabled: false,
| },
| } as VxeTableGridOptions<MesWmBatchApi.PurchaseSource>,
| });
|
| /** 加载采购来源列表 */
| async function getList() {
| if (!props.batchCode) {
| await gridApi.grid?.loadData([]);
| return;
| }
| gridApi.setLoading(true);
| try {
| const list = await getPurchaseSourceList(props.batchCode);
| await gridApi.grid?.loadData(list);
| } finally {
| gridApi.setLoading(false);
| }
| }
|
| watch(
| () => props.batchCode,
| () => {
| getList();
| },
| { immediate: true },
| );
| </script>
|
| <template>
| <Grid class="w-full" />
| </template>
|
|