8 小时以前 e1e0d48eb7ab2b305e6062f23610f8be9db3bed6
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
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesWmStockWarningApi } from '#/api/mes/wm/stock-warning';
 
import { ref } from 'vue';
 
import { useVbenModal } from '@vben/common-ui';
 
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getCurrentStockWarnings } from '#/api/mes/wm/stock-warning';
import { $t } from '#/locales';
 
import { useCurrentGridColumns } from '../data';
 
const list = ref<MesWmStockWarningApi.StockWarning[]>([]);
 
const [Grid, gridApi] = useVbenVxeGrid({
  gridOptions: {
    columns: useCurrentGridColumns(),
    height: 420,
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async () => {
          return { list: list.value, total: list.value.length };
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
    },
  } as VxeTableGridOptions<MesWmStockWarningApi.StockWarning>,
});
 
const [Modal, modalApi] = useVbenModal({
  async onConfirm() {
    await modalApi.close();
  },
  async onOpenChange(isOpen: boolean) {
    if (!isOpen) {
      list.value = [];
      return;
    }
    modalApi.lock();
    try {
      list.value = await getCurrentStockWarnings();
      gridApi.reload();
    } finally {
      modalApi.unlock();
    }
  },
});
</script>
 
<template>
  <Modal :title="$t('ui.actionTitle.view', ['实时库存预警'])" class="w-4/5">
    <Grid table-title="当前预警(实时计算,未落库)" />
  </Modal>
</template>