- 新增 ToolbarButtonGroup 组件及类型定义,订单、波次等页面统一使用, 工具栏按钮样式分类(刷新/设置/操作/取消)收敛到一处 - 订单共享模块迁移至 views/order/shared:创建订单会话、通用表单、 导出、工具栏动作、订单元数据缓存;stockPickerHelpers 归入 stock/utils - 抽离 ScanBox 字段工厂、货主/快递下拉选项映射、状态文本工具, 新增 list-page.scss、status-text.scss,order-common-config 改为再导出 - UpperTable 虚拟滚动优化:实测行高兜底、渲染行数组引用复用、 rowKey/复制码/收起文本缓存、窗口行数按 4 行量化、ResizeObserver 同步视口, 减少滚动抖动与整表重建 - 列表页状态列改用轻量文本样式替代 el-tag,降低大列表渲染开销; 标签页缓存默认上限由 3 调整为 8 - 补充标签页性能测量结论、页面模板抽离现状与实施方案文档
331 lines
7.4 KiB
Vue
331 lines
7.4 KiB
Vue
<template>
|
||
<el-dialog
|
||
v-model="visible"
|
||
class="manual-waybill-dialog"
|
||
width="min(560px, 92vw)"
|
||
align-center
|
||
append-to-body
|
||
:show-close="false"
|
||
destroy-on-close
|
||
:close-on-click-modal="false"
|
||
@closed="handleClosed"
|
||
>
|
||
<!-- 面板结构对齐「按订单批量分配储位」(UnifiedTaskProgressDialog / TaskProgressPanel) -->
|
||
<div class="task-panel">
|
||
<header class="task-panel__head">
|
||
<div class="task-panel__titles">
|
||
<h2>手工录入运单号</h2>
|
||
<p>为指定待处理订单创建运单记录</p>
|
||
</div>
|
||
<button class="task-panel__close" type="button" aria-label="关闭" @click="visible = false">
|
||
<svg viewBox="0 0 12 12" fill="none">
|
||
<path d="M1 1L11 11M11 1L1 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" />
|
||
</svg>
|
||
</button>
|
||
</header>
|
||
|
||
<div class="task-panel__body">
|
||
<div class="task-panel__form">
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">订单 ID</span>
|
||
<strong class="task-panel__field-value">{{ orderId ?? '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">订单号</span>
|
||
<strong class="task-panel__field-value">{{ orderCode || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label">运单号</span>
|
||
<el-form
|
||
ref="formRef"
|
||
:model="formModel"
|
||
:rules="rules"
|
||
class="task-panel__field-form"
|
||
@submit.prevent
|
||
>
|
||
<el-form-item prop="waybill_code">
|
||
<el-input
|
||
v-model="formModel.waybill_code"
|
||
size="default"
|
||
placeholder="请输入运单号"
|
||
clearable
|
||
maxlength="64"
|
||
show-word-limit
|
||
@keyup.enter="handleSubmit"
|
||
/>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
</div>
|
||
<p class="task-panel__form-tip">
|
||
仅允许步骤 1~3 且未归档中的订单录入;运单号必填,重复录入会覆盖原运单记录。
|
||
</p>
|
||
</div>
|
||
|
||
<footer class="task-panel__foot">
|
||
<span class="task-panel__hint">提交前请确认运单号无误</span>
|
||
<div class="task-panel__actions">
|
||
<el-button size="small" @click="visible = false">取消</el-button>
|
||
<el-button size="small" type="primary" :loading="loading" @click="handleSubmit">确认录入</el-button>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</el-dialog>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { reactive, ref, watch } from 'vue'
|
||
import type { FormInstance, FormRules } from 'element-plus'
|
||
|
||
const visible = defineModel<boolean>({ default: false })
|
||
const waybillCode = defineModel<string>('waybillCode', { default: '' })
|
||
|
||
defineProps<{
|
||
loading: boolean
|
||
orderId: number | null
|
||
orderCode: string
|
||
}>()
|
||
|
||
const emit = defineEmits<{
|
||
(e: 'submit'): void
|
||
(e: 'closed'): void
|
||
}>()
|
||
|
||
const formRef = ref<FormInstance>()
|
||
|
||
const formModel = reactive({
|
||
waybill_code: ''
|
||
})
|
||
|
||
watch(
|
||
() => waybillCode.value,
|
||
(value) => {
|
||
formModel.waybill_code = value
|
||
},
|
||
{ immediate: true }
|
||
)
|
||
|
||
watch(
|
||
() => formModel.waybill_code,
|
||
(value) => {
|
||
if (waybillCode.value !== value) {
|
||
waybillCode.value = value
|
||
}
|
||
}
|
||
)
|
||
|
||
const rules: FormRules = {
|
||
waybill_code: [
|
||
{ required: true, message: '请输入运单号', trigger: 'blur' },
|
||
{
|
||
validator: (_rule, value, callback) => {
|
||
if (!String(value ?? '').trim()) {
|
||
callback(new Error('运单号不能为空'))
|
||
return
|
||
}
|
||
callback()
|
||
},
|
||
trigger: 'blur'
|
||
}
|
||
]
|
||
}
|
||
|
||
async function handleSubmit() {
|
||
const valid = await formRef.value?.validate().catch(() => false)
|
||
if (!valid) return
|
||
emit('submit')
|
||
}
|
||
|
||
function handleClosed() {
|
||
formRef.value?.resetFields()
|
||
emit('closed')
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
/* 面板结构 / 尺寸对齐 TaskProgressPanel(按订单批量分配储位) */
|
||
.task-panel {
|
||
background: #fff;
|
||
color: #303133;
|
||
|
||
&__head {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
gap: 12px;
|
||
padding: 16px;
|
||
}
|
||
|
||
&__titles {
|
||
flex: 1;
|
||
min-width: 0;
|
||
|
||
h2 {
|
||
margin: 0;
|
||
font-size: 18px;
|
||
line-height: 24px;
|
||
font-weight: 400;
|
||
color: #303133;
|
||
}
|
||
|
||
p {
|
||
margin: 4px 0 0;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #909399;
|
||
}
|
||
}
|
||
|
||
&__close {
|
||
width: 24px;
|
||
height: 24px;
|
||
flex: none;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border: none;
|
||
border-radius: 4px;
|
||
background: transparent;
|
||
color: #909399;
|
||
cursor: pointer;
|
||
transition: color 0.2s;
|
||
|
||
svg {
|
||
width: 12px;
|
||
height: 12px;
|
||
}
|
||
|
||
&:hover {
|
||
color: #409eff;
|
||
}
|
||
}
|
||
|
||
&__body {
|
||
padding: 12px 16px 0;
|
||
}
|
||
|
||
&__form {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8px;
|
||
}
|
||
|
||
&__field {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 16px;
|
||
min-height: 40px;
|
||
padding: 8px 12px;
|
||
border: 1px solid #ebeef5;
|
||
border-radius: 4px;
|
||
background: #fafafa;
|
||
|
||
/* 运单号输入行:不需要灰色容器,与上方静态信息行拉开层次 */
|
||
&--input {
|
||
align-items: flex-start;
|
||
min-height: 0;
|
||
/* 左 12px 与上方标签对齐;右 0 让输入框右边顶到灰色容器右边缘 */
|
||
padding: 4px 0 0 12px;
|
||
border: none;
|
||
border-radius: 0;
|
||
background: transparent;
|
||
|
||
.task-panel__field-label {
|
||
padding-top: 7px;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* 标签列固定宽度(含必填星号占位):输入框左边缘与上方静态信息行的标签列对齐 */
|
||
&__field-label {
|
||
position: relative;
|
||
flex: 0 0 88px;
|
||
width: 88px;
|
||
padding-left: 10px;
|
||
box-sizing: border-box;
|
||
font-size: 12px;
|
||
line-height: 20px;
|
||
color: #606266;
|
||
text-align: left;
|
||
}
|
||
|
||
&__field-value {
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
text-align: right;
|
||
word-break: break-all;
|
||
}
|
||
|
||
&__field-form {
|
||
flex: 1;
|
||
min-width: 0;
|
||
max-width: none;
|
||
|
||
:deep(.el-form-item) {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
:deep(.el-form-item__content) {
|
||
margin-left: 0 !important;
|
||
width: 100%;
|
||
}
|
||
|
||
:deep(.el-input) {
|
||
width: 100%;
|
||
}
|
||
}
|
||
|
||
&__form-tip {
|
||
margin: 8px 0 0;
|
||
padding: 8px 12px;
|
||
border-radius: 4px;
|
||
background: #f4f4f5;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #909399;
|
||
}
|
||
|
||
&__foot {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 16px;
|
||
}
|
||
|
||
&__hint {
|
||
font-size: 12px;
|
||
color: #909399;
|
||
}
|
||
|
||
&__actions {
|
||
display: flex;
|
||
align-items: center;
|
||
/* 与工具栏按钮组(OrderToolbarButtonGroup)保持一致:gap 6px */
|
||
gap: 6px;
|
||
|
||
:deep(.el-button) {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
}
|
||
}
|
||
}
|
||
</style>
|
||
|
||
<style lang="scss">
|
||
/* el-dialog 会被 append 到 body:去掉默认头/内边距,统一交给面板(同 UnifiedTaskProgressDialog) */
|
||
.el-dialog.manual-waybill-dialog {
|
||
padding: 0;
|
||
overflow: hidden;
|
||
|
||
.el-dialog__header {
|
||
display: none;
|
||
}
|
||
|
||
.el-dialog__body {
|
||
padding: 0;
|
||
}
|
||
}
|
||
</style>
|