118 lines
2.9 KiB
Vue
118 lines
2.9 KiB
Vue
<template>
|
|
<div
|
|
v-if="minimized && sessionActive"
|
|
class="create-order-float"
|
|
role="button"
|
|
tabindex="0"
|
|
@click="restoreCreateOrderDialog"
|
|
@keydown.enter="restoreCreateOrderDialog"
|
|
>
|
|
<div class="create-order-float__header">
|
|
<span class="create-order-float__title">建单</span>
|
|
<el-button
|
|
class="create-order-float__close"
|
|
link
|
|
type="info"
|
|
:icon="Close"
|
|
@click.stop="handleClose"
|
|
/>
|
|
</div>
|
|
<div class="create-order-float__body">
|
|
<p v-if="floatSummary.loading" class="create-order-float__status">正在创建订单…</p>
|
|
<p v-else-if="floatSummary.parsing" class="create-order-float__status">正在解析 Excel…</p>
|
|
<p v-else-if="floatSummary.rowCount > 0" class="create-order-float__status">
|
|
{{ floatSummary.rowCount }} 行明细 · {{ floatSummary.orderCount }} 个订单
|
|
</p>
|
|
<p v-else class="create-order-float__status">后台运行中,切换页面不中断,点击还原窗口</p>
|
|
</div>
|
|
<el-button type="primary" size="small" class="create-order-float__restore" @click.stop="restoreCreateOrderDialog">
|
|
还原窗口
|
|
</el-button>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { Close } from '@element-plus/icons-vue'
|
|
import { ElMessageBox } from 'element-plus'
|
|
import { useCreateOrderSession } from '../composables/useCreateOrderSession'
|
|
|
|
const {
|
|
minimized,
|
|
sessionActive,
|
|
floatSummary,
|
|
restoreCreateOrderDialog,
|
|
closeCreateOrderSession
|
|
} = useCreateOrderSession()
|
|
|
|
async function handleClose() {
|
|
const hasData = floatSummary.value.rowCount > 0 || floatSummary.value.loading || floatSummary.value.parsing
|
|
if (hasData) {
|
|
try {
|
|
await ElMessageBox.confirm('关闭后将清空当前建单数据,是否继续?', '关闭建单', {
|
|
type: 'warning',
|
|
confirmButtonText: '关闭并清空',
|
|
cancelButtonText: '取消'
|
|
})
|
|
} catch {
|
|
return
|
|
}
|
|
}
|
|
closeCreateOrderSession()
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.create-order-float {
|
|
position: fixed;
|
|
right: 24px;
|
|
bottom: 24px;
|
|
z-index: 3000;
|
|
width: 220px;
|
|
padding: 12px 14px;
|
|
border-radius: 10px;
|
|
background: #ffffff;
|
|
border: 1px solid #d9ecff;
|
|
box-shadow: 0 8px 24px rgba(64, 158, 255, 0.18);
|
|
cursor: pointer;
|
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
}
|
|
|
|
.create-order-float:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 12px 28px rgba(64, 158, 255, 0.24);
|
|
}
|
|
|
|
.create-order-float__header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.create-order-float__title {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #303133;
|
|
}
|
|
|
|
.create-order-float__close {
|
|
padding: 0;
|
|
min-height: auto;
|
|
}
|
|
|
|
.create-order-float__body {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.create-order-float__status {
|
|
margin: 0;
|
|
font-size: 12px;
|
|
line-height: 1.5;
|
|
color: #606266;
|
|
}
|
|
|
|
.create-order-float__restore {
|
|
width: 100%;
|
|
}
|
|
</style>
|