车间能级提升-智能设备管理系统
baoshiwei
2025-04-17 bb79260cbeeac88cfbadc9606eea57002e8945bc
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
<script setup lang="ts">
import type { VxeGridProps } from '#/adapter/vxe-table';
 
import { ref } from 'vue';
 
import { useVbenModal } from '@vben/common-ui';
import { DictEnum } from '@vben/constants';
 
import { message } from 'ant-design-vue';
 
import { renderDict } from '#/utils/render';
import InnerView from '#/views/eims/spare/index.vue';
 
const emit = defineEmits<{ updateSelect: [any] }>();
 
const [BasicModal, modalApi] = useVbenModal({
  fullscreenButton: false,
  draggable: true,
  onCancel: handleCancel,
  onConfirm: handleConfirm
});
const innerView = ref();
 
async function handleConfirm() {
  try {
    modalApi.modalLoading(true);
    const tableSelect = innerView.value.tableSelect();
    const eList = tableSelect.filter((item: any) => !item.actualStock && item.actualStock <= 0);
    // 检测选择的备件库存是否正常
    if (eList.length > 0) {
      message.error('存在库存不足备件,请重新选择');
      return false;
    }
    emit('updateSelect', tableSelect);
    await handleCancel();
  } catch (error) {
    console.error(error);
  } finally {
    modalApi.modalLoading(false);
  }
}
 
async function handleCancel() {
  modalApi.close();
}
</script>
 
<template>
  <BasicModal :fullscreen-button="true" class="w-[800px]">
    <InnerView ref="innerView" />
  </BasicModal>
</template>
 
<style scoped></style>