<script lang="ts" setup>
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { MesWmBatchApi } from '#/api/mes/wm/batch';
|
|
import { watch } from 'vue';
|
|
import { Tag } from 'ant-design-vue';
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { getProcessTraceList } from '#/api/mes/wm/batch';
|
|
import { useProcessTraceColumns } from '../data';
|
|
const props = defineProps<{
|
batchCode?: string;
|
}>();
|
|
const [Grid, gridApi] = useVbenVxeGrid({
|
gridOptions: {
|
columns: useProcessTraceColumns(),
|
minHeight: 240,
|
pagerConfig: {
|
enabled: false,
|
},
|
rowConfig: {
|
isHover: true,
|
},
|
showOverflow: true,
|
toolbarConfig: {
|
enabled: false,
|
},
|
} as VxeTableGridOptions<MesWmBatchApi.ProcessTrace>,
|
});
|
|
/** 加载工序流转列表 */
|
async function getList() {
|
if (!props.batchCode) {
|
await gridApi.grid?.loadData([]);
|
return;
|
}
|
gridApi.setLoading(true);
|
try {
|
const list = await getProcessTraceList(props.batchCode);
|
await gridApi.grid?.loadData(list);
|
} finally {
|
gridApi.setLoading(false);
|
}
|
}
|
|
watch(
|
() => props.batchCode,
|
() => {
|
getList();
|
},
|
{ immediate: true },
|
);
|
</script>
|
|
<template>
|
<Grid class="w-full">
|
<template #eventType="{ row }">
|
<Tag v-if="row.eventType === 'OUT'" color="success">产出</Tag>
|
<Tag v-else color="processing">投入</Tag>
|
</template>
|
</Grid>
|
</template>
|