<script setup lang="ts">
|
import { ref } from 'vue';
|
|
import { useVbenModal } from '@vben/common-ui';
|
|
import { message } from 'ant-design-vue';
|
|
import EquView from '#/views/eims/equ/index.vue';
|
|
const emit = defineEmits<{ updateEqu: [any] }>();
|
|
const [BasicModal, modalApi] = useVbenModal({
|
fullscreenButton: false,
|
draggable: true,
|
onCancel: handleCancel,
|
onConfirm: handleConfirm
|
});
|
const equView = ref();
|
|
async function handleConfirm() {
|
try {
|
modalApi.modalLoading(true);
|
const tableSelect = equView.value.tableSelect();
|
if (tableSelect.length > 1) {
|
message.error('最多只能选择一台设备!');
|
modalApi.modalLoading(false);
|
return false;
|
}
|
emit('updateEqu', tableSelect[0]);
|
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]">
|
<EquView ref="equView" />
|
</BasicModal>
|
</template>
|
|
<style scoped></style>
|