- setting.warehouse 新增 b2b_packing_quantity_check(默认关闭):开启后 B2B 备货完成 会校验「分箱数量合计 = 应备数量」与「总箱数 = 箱号数」,不符时返回 400 与差异明细; 仓库设置表单补充该开关与说明 - 待处理/配送 B2B 接口补充驼峰别名与图片参数简写 (pickupPlateNumber、pickupFileIds、file_ids、fileIds、pickup_images、orderItemId、boxNo), 配送 B2B 列表说明补充 images / pickup_images 字段结构 - 货主签约与外部仓库页面补充「对方角色」列与详情、我方/对方主体 ID、 待我确认状态;余额日志兼容 balance_before / balance_after 旧字段, 新增「对方主体ID」等值筛选,分页规格统一支持 200 条 - 新增《拣货单模板 148×210 设计与实施》文档及模板 JSON,供波次批量打印拣货单使用
1641 lines
56 KiB
Vue
1641 lines
56 KiB
Vue
<template>
|
||
<div class="order-sub-container" :style="{ height: containerHeight }">
|
||
<scan-box
|
||
ref="scanBox"
|
||
cache-key="warehouses-list"
|
||
width="220px"
|
||
title="仓库筛选"
|
||
:auto-submit="false"
|
||
:preset-tree="presetTree"
|
||
:available-fields="availableFields"
|
||
:initial-conditions="{ use_status: 1 }"
|
||
@condition-change="handleConditionChange"
|
||
@reset="handleReset"
|
||
@condition-clear="handleConditionClear"
|
||
@submit="handleSubmit"
|
||
/>
|
||
|
||
<div class="main-content">
|
||
<div class="toolbar">
|
||
<div class="toolbar-left">
|
||
<order-toolbar-button-group
|
||
:buttons="toolbarButtons"
|
||
:resolve-disabled="resolveButtonDisabled"
|
||
:resolve-loading="resolveButtonLoading"
|
||
:resolve-label="resolveButtonLabel"
|
||
:layout-key="toolbarLayoutKey"
|
||
@action="handleToolbarButtonClick"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="split-stack" ref="splitStackRef">
|
||
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||
<upper-table
|
||
ref="tableRef"
|
||
title="仓库签约列表"
|
||
default-align="center"
|
||
:enable-column-config="true"
|
||
table-id="warehouses-list"
|
||
:data="list"
|
||
:columns="columns"
|
||
:table-size="tableSize"
|
||
:loading="loading"
|
||
:pagination="pagination"
|
||
:page-sizes="[10, 20, 50, 100, 200]"
|
||
:show-index="true"
|
||
:show-selection="true"
|
||
:show-actions="true"
|
||
:query-time="queryTime"
|
||
row-key="id"
|
||
@current-change="handleRowClick"
|
||
@row-click="handleRowClick"
|
||
@page-change="handlePageChange"
|
||
@page-size-change="handleSizeChange"
|
||
@sort-change="handleSortChange"
|
||
@selection-change="handleSelectionChange"
|
||
>
|
||
<template #column-counterparty_name="{ row }">
|
||
<span>{{ row.warehouse_name || row.remask || row.counterparty_name }}</span>
|
||
<span
|
||
v-if="(row.warehouse_name || row.remask) && row.counterparty_name && (row.warehouse_name || row.remask) !== row.counterparty_name"
|
||
class="real-name"
|
||
>({{ row.counterparty_name }})</span>
|
||
</template>
|
||
<template #column-store_name="{ row }">
|
||
<span>{{ row.remask || row.store_name || '—' }}</span>
|
||
<span
|
||
v-if="row.remask && row.store_name && row.remask !== row.store_name"
|
||
class="real-name"
|
||
>({{ row.store_name }})</span>
|
||
</template>
|
||
<template #column-counterparty_role="{ row }">
|
||
<span :class="getStatusTextClass(row.counterparty_role === 'warehouse' ? 'primary' : 'warning')">
|
||
{{ row.counterparty_role === 'warehouse' ? '仓库方' : '货主方' }}
|
||
</span>
|
||
</template>
|
||
<template #column-auth_status="{ row }">
|
||
<span :class="getStatusTextClass(getAuthStatusType(row.auth_status))">
|
||
{{ row.auth_status_label || getAuthStatusLabel(row.auth_status) }}
|
||
</span>
|
||
</template>
|
||
<template #column-needs_my_confirm="{ row }">
|
||
<span v-if="row.needs_my_confirm" :class="getStatusTextClass('warning')">待我确认</span>
|
||
<span v-else class="text-muted">—</span>
|
||
</template>
|
||
<template #column-use_status="{ row }">
|
||
<span :class="getStatusTextClass(row.use_status === 1 ? 'success' : 'info')">
|
||
{{ row.use_status === 1 ? '启用' : '禁用' }}
|
||
</span>
|
||
</template>
|
||
<template #column-auth_end="{ row }">
|
||
<span :class="{ 'text-danger': isExpired(row.auth_end) }">{{ row.auth_end || '—' }}</span>
|
||
</template>
|
||
<template #column-print_quantity="{ row }">
|
||
{{ row.print_quantity ?? '—' }}
|
||
</template>
|
||
<template #column-has_qimen_config="{ row }">
|
||
<span
|
||
:class="getStatusTextClass(row.has_qimen_config ? 'success' : 'info')"
|
||
@click.stop="openQimenDialog(row)"
|
||
style="cursor:pointer"
|
||
>
|
||
{{ row.has_qimen_config ? '已配置' : '未配置' }}
|
||
</span>
|
||
</template>
|
||
<template #column-actions="{ row }">
|
||
<div class="wave-operation-actions">
|
||
<el-button
|
||
size="small"
|
||
type="primary"
|
||
link
|
||
@click.stop="handleRename(row)"
|
||
>修改备注</el-button>
|
||
<el-button
|
||
v-if="row.needs_my_confirm"
|
||
size="small"
|
||
type="warning"
|
||
link
|
||
@click.stop="handleConfirmSign(row)"
|
||
>确认签约</el-button>
|
||
<el-button
|
||
v-if="row.use_status === 1 && row.auth_status !== 1"
|
||
size="small"
|
||
type="danger"
|
||
link
|
||
@click.stop="handleUnbind(row, 0)"
|
||
>禁用</el-button>
|
||
<el-button
|
||
v-else-if="row.use_status === 0 && row.auth_status !== 1"
|
||
size="small"
|
||
type="success"
|
||
link
|
||
@click.stop="handleUnbind(row, 1)"
|
||
>启用</el-button>
|
||
<span v-else class="text-muted">—</span>
|
||
</div>
|
||
</template>
|
||
</upper-table>
|
||
</div>
|
||
|
||
<template v-if="detailVisible">
|
||
<div
|
||
class="pane-resizer"
|
||
title="拖动调整列表与详情区域高度"
|
||
@mousedown="beginSplitDrag"
|
||
/>
|
||
<div class="lower-level" v-if="selectedRow" :style="lowerPaneStyle">
|
||
<div class="detail-header">
|
||
<el-tabs v-model="activeTab" class="detail-tab">
|
||
<el-tab-pane label="签约详情" name="details" />
|
||
<el-tab-pane label="操作日志" name="logs" />
|
||
</el-tabs>
|
||
</div>
|
||
|
||
<div class="detail-container">
|
||
<div v-if="activeTab === 'details'" class="detail-panel">
|
||
<!-- 签约主体 -->
|
||
<div class="section">
|
||
<div class="section-title">签约主体</div>
|
||
<el-descriptions :column="2" border size="small" class="detail-descriptions">
|
||
<el-descriptions-item v-if="currentSubject.company_name" :label="currentSubjectLabel">
|
||
{{ currentSubject.company_name }}
|
||
<el-tag
|
||
size="small"
|
||
:type="currentSubjectRole === 'warehouse' ? 'primary' : 'warning'"
|
||
effect="plain"
|
||
style="margin-left:6px"
|
||
>{{ currentSubjectRoleLabel }}</el-tag>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="签约仓库" :span="currentSubject.company_name ? 1 : 2">
|
||
{{ selectedRow.warehouse_name || selectedRow.remask || selectedRow.counterparty_name || '—' }}
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
</div>
|
||
|
||
<!-- 签约信息 -->
|
||
<div class="section">
|
||
<div class="section-title">签约信息</div>
|
||
<el-descriptions :column="3" border size="small" class="detail-descriptions">
|
||
<el-descriptions-item label="签约ID">{{ selectedRow.id ?? '—' }}</el-descriptions-item>
|
||
<el-descriptions-item label="签约状态">
|
||
<span :class="getStatusTextClass(getAuthStatusType(selectedRow.auth_status))">
|
||
{{ selectedRow.auth_status_label || getAuthStatusLabel(selectedRow.auth_status) }}
|
||
</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="对方角色">
|
||
<span :class="getStatusTextClass(selectedRow.counterparty_role === 'warehouse' ? 'primary' : 'warning')">
|
||
{{ getCounterpartyRoleLabel(selectedRow.counterparty_role) }}
|
||
</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="己方主体ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
|
||
<el-descriptions-item label="对方主体ID">
|
||
{{ selectedRow.counterparty_id ?? selectedRow.warehouse_id ?? '—' }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="使用状态">
|
||
<span :class="getStatusTextClass(selectedRow.use_status === 1 ? 'success' : 'info')">
|
||
{{ selectedRow.use_status === 1 ? '启用' : '禁用' }}
|
||
</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="授权截止">
|
||
<span :class="{ 'text-danger': isExpired(selectedRow.auth_end) }">{{ selectedRow.auth_end || '—' }}</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="面单余额">{{ selectedRow.print_quantity ?? '—' }}</el-descriptions-item>
|
||
<el-descriptions-item label="待我确认">
|
||
<span :class="getStatusTextClass(selectedRow.needs_my_confirm ? 'warning' : 'info')">
|
||
{{ selectedRow.needs_my_confirm ? '是' : '否' }}
|
||
</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="奇门配置" :span="3">
|
||
<span :class="getStatusTextClass(selectedRow.has_qimen_config ? 'success' : 'info')">
|
||
{{ selectedRow.has_qimen_config ? '已配置' : '未配置' }}
|
||
</span>
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
</div>
|
||
</div>
|
||
<div v-else class="log-panel">
|
||
<div class="header-actions">
|
||
<div class="left-actions">
|
||
<el-button size="small" type="primary" :loading="logLoading" @click="loadLogs">刷新</el-button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="table-host">
|
||
<upper-table
|
||
table-id="warehouses-store-logs"
|
||
:data="logList"
|
||
:columns="logColumns"
|
||
default-align="center"
|
||
table-size="small"
|
||
:show-selection="true"
|
||
:loading="logLoading"
|
||
row-key="id"
|
||
empty-text="暂无操作日志"
|
||
:pagination="logPagination"
|
||
:page-sizes="[10, 20, 50, 100]"
|
||
@page-change="handleLogPageChange"
|
||
@page-size-change="handleLogSizeChange"
|
||
>
|
||
<!-- 已选数量放左下角(UpperTable 分页区左侧) -->
|
||
<template #pagination-info="{ count }">已选 {{ count }} 项</template>
|
||
|
||
<template #column-business_type="{ row }">{{ row.business_type || '—' }}</template>
|
||
<!-- 后端余额日志字段为 balance_before / balance_after,兼容旧字段名 -->
|
||
<template #column-before_quantity="{ row }">{{ row.balance_before ?? row.before_quantity ?? '—' }}</template>
|
||
<template #column-after_quantity="{ row }">{{ row.balance_after ?? row.after_quantity ?? '—' }}</template>
|
||
<template #column-reason="{ row }">{{ row.reason || '—' }}</template>
|
||
<template #column-operator_name="{ row }">{{ row.operator_name || '—' }}</template>
|
||
<template #column-created_at="{ row }">{{ row.created_at || '—' }}</template>
|
||
</upper-table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="no-selection" v-else :style="lowerPaneStyle">
|
||
<div class="empty-tip">
|
||
<p>请从上方列表中选择一项查看详情</p>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 发起签约弹窗:面板结构 / 尺寸对齐「批量修改平台信息」(UpdateOrderMetaForm) -->
|
||
<el-dialog
|
||
v-model="signDialog.visible"
|
||
class="sign-panel-dialog"
|
||
width="min(560px, 92vw)"
|
||
align-center
|
||
append-to-body
|
||
:show-close="false"
|
||
:close-on-click-modal="false"
|
||
@close="resetSignDialog"
|
||
>
|
||
<div class="task-panel">
|
||
<header class="task-panel__head">
|
||
<div class="task-panel__titles">
|
||
<h2>{{ signDialog.title }}</h2>
|
||
<p>{{ signSubtitle }}</p>
|
||
</div>
|
||
<button
|
||
class="task-panel__close"
|
||
type="button"
|
||
aria-label="关闭"
|
||
@click="signDialog.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">
|
||
<!-- Step 1:填写对方主体 -->
|
||
<div v-if="signDialog.step === 1" class="task-panel__form">
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">当前货主</span>
|
||
<strong class="task-panel__field-value">{{ currentSubject.company_name || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label is-required">对方主体 ID</span>
|
||
<div class="task-panel__field-form">
|
||
<el-input-number
|
||
v-model.number="signForm.counterparty_id"
|
||
size="default"
|
||
placeholder="请输入对方主体 ID"
|
||
style="width: 100%"
|
||
:controls="false"
|
||
@keyup.enter="doPreviewSign"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 2:预览 / 提交结果 -->
|
||
<div v-else-if="signDialog.step === 2" class="task-panel__form">
|
||
<!-- 预览模式:展示双方主体信息 -->
|
||
<template v-if="signDialog.signMode === 'preview'">
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">己方(货主)</span>
|
||
<strong class="task-panel__field-value">{{ signDialog.currentSubject?.company_name || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">对方(仓库)</span>
|
||
<strong class="task-panel__field-value">{{ signDialog.counterparty?.company_name || '—' }}</strong>
|
||
</div>
|
||
</template>
|
||
<!-- 提交后:展示合同信息 -->
|
||
<template v-else>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">签约 ID</span>
|
||
<strong class="task-panel__field-value">{{ signDialog.contract?.id || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">签约状态</span>
|
||
<span class="task-panel__field-value">
|
||
<span :class="getStatusTextClass(getAuthStatusType(signDialog.contract?.auth_status ?? 0))">
|
||
{{ signDialog.contract?.auth_status_label || '—' }}
|
||
</span>
|
||
</span>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">仓库</span>
|
||
<strong class="task-panel__field-value">
|
||
{{ signDialog.contract?.warehouse_name || signDialog.contract?.counterparty_name || '—' }}
|
||
</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">货主</span>
|
||
<strong class="task-panel__field-value">{{ signDialog.contract?.store_name || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">备注</span>
|
||
<strong class="task-panel__field-value">{{ signDialog.contract?.remask || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">面单余额</span>
|
||
<strong class="task-panel__field-value">{{ signDialog.contract?.print_quantity ?? '—' }}</strong>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
|
||
<!-- 提示条:对齐「手工录入运单号」的 .task-panel__form-tip -->
|
||
<p class="task-panel__form-tip">{{ signTip }}</p>
|
||
</div>
|
||
|
||
<footer class="task-panel__foot">
|
||
<span class="task-panel__hint">{{ signFooterHint }}</span>
|
||
<div class="task-panel__actions">
|
||
<!-- Step 1: 填写信息 -->
|
||
<template v-if="signDialog.step === 1">
|
||
<el-button size="small" @click="signDialog.visible = false">取消</el-button>
|
||
<el-button size="small" type="primary" :loading="signDialog.loading" @click="doPreviewSign">
|
||
预览
|
||
</el-button>
|
||
</template>
|
||
<!-- Step 2: 预览结果 -->
|
||
<template v-else-if="signDialog.step === 2">
|
||
<el-button size="small" @click="goBackToStep1">返回</el-button>
|
||
<el-button
|
||
v-if="signDialog.signMode === 'preview'"
|
||
size="small"
|
||
type="primary"
|
||
:loading="signDialog.loading"
|
||
@click="doSubmitSign"
|
||
>确认提交</el-button>
|
||
<el-button v-else size="small" @click="signDialog.visible = false">关闭</el-button>
|
||
</template>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<!-- 奇门接口配置查看弹窗 -->
|
||
<el-dialog
|
||
v-model="qimenDialog.visible"
|
||
:title="`接口配置查看 — ${qimenDialog.contractRow?.warehouse_name || qimenDialog.contractRow?.remask || qimenDialog.contractRow?.counterparty_name || ''}`"
|
||
width="90%"
|
||
align-center
|
||
:close-on-click-modal="false"
|
||
@close="resetQimenDialog"
|
||
>
|
||
<div style="display:flex;justify-content:flex-end;margin-bottom:10px">
|
||
<el-button size="small" @click="loadQimenConfigs">
|
||
刷新
|
||
</el-button>
|
||
</div>
|
||
<el-table :data="qimenDialog.list" v-loading="qimenDialog.loading" size="small" border>
|
||
<el-table-column prop="app_name" label="应用名称" min-width="120" />
|
||
<el-table-column prop="interface_name" label="接口类型" width="130" />
|
||
<el-table-column label="ERP" min-width="110">
|
||
<template #default="{ row }">{{ row.erp_display || '—' }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="货主编码" min-width="150">
|
||
<template #default="{ row }">
|
||
<div class="copy-cell">
|
||
<span class="copy-text">{{ row.qimen_customer_id || '—' }}</span>
|
||
<el-button v-if="row.qimen_customer_id" size="small" type="primary" link @click="copyText(row.qimen_customer_id)">复制</el-button>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="仓库编码" min-width="130">
|
||
<template #default="{ row }">
|
||
<div class="copy-cell">
|
||
<span class="copy-text">{{ row.qimen_warehouse_code || '—' }}</span>
|
||
<el-button v-if="row.qimen_warehouse_code" size="small" type="primary" link @click="copyText(row.qimen_warehouse_code)">复制</el-button>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="APPKEY" min-width="200">
|
||
<template #default="{ row }">
|
||
<div class="copy-cell">
|
||
<span class="copy-text">{{ row.self_app_key || '—' }}</span>
|
||
<el-button v-if="row.self_app_key" size="small" type="primary" link @click="copyText(row.self_app_key)">复制</el-button>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="APPSECRET" min-width="150">
|
||
<template #default="{ row }">
|
||
<div class="copy-cell">
|
||
<template v-if="visibleSecrets[row.id || row.interface_type_id]">
|
||
<span class="copy-text">{{ row.self_app_secret || '—' }}</span>
|
||
<el-button v-if="row.self_app_secret" size="small" type="primary" link @click="copyText(row.self_app_secret)">复制</el-button>
|
||
</template>
|
||
<el-button v-else-if="row.self_app_secret" size="small" type="warning" link @click="toggleSecret(row)">显示</el-button>
|
||
<span v-else>—</span>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="状态" width="70" align="center">
|
||
<template #default="{ row }">
|
||
<el-tag size="small" :type="row.is_enabled ? 'success' : 'info'">{{ row.is_enabled ? '启用' : '停用' }}</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<template #empty>
|
||
<el-empty description="暂无奇门配置" :image-size="50" />
|
||
</template>
|
||
</el-table>
|
||
<template #footer>
|
||
<el-button size="small" @click="qimenDialog.visible = false">关闭</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<!-- 修改备注:面板结构 / 尺寸对齐「批量修改平台信息」(UpdateOrderMetaForm) -->
|
||
<el-dialog
|
||
v-model="renameVisible"
|
||
class="rename-remark-dialog"
|
||
width="min(560px, 92vw)"
|
||
align-center
|
||
append-to-body
|
||
:show-close="false"
|
||
:close-on-click-modal="false"
|
||
>
|
||
<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="renameVisible = 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">签约仓库</span>
|
||
<strong class="task-panel__field-value">{{ renameRow?.counterparty_name || '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field">
|
||
<span class="task-panel__field-label">仓库 ID</span>
|
||
<strong class="task-panel__field-value">{{ renameRow?.warehouse_id ?? '—' }}</strong>
|
||
</div>
|
||
<div class="task-panel__field task-panel__field--input">
|
||
<span class="task-panel__field-label is-required">备注名</span>
|
||
<div class="task-panel__field-control">
|
||
<el-input
|
||
v-model="renameForm.remask"
|
||
size="default"
|
||
placeholder="请输入新的备注名"
|
||
clearable
|
||
@keyup.enter="submitRename"
|
||
/>
|
||
<p class="task-panel__field-tip">备注名用于区分同名仓库,不能为空</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<footer class="task-panel__foot">
|
||
<span class="task-panel__hint">提交后立即生效,请确认备注名无误</span>
|
||
<div class="task-panel__actions">
|
||
<el-button size="small" @click="renameVisible = false">取消</el-button>
|
||
<el-button size="small" type="primary" :loading="renameLoading" @click="submitRename">确定</el-button>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<AsyncExportProgressDialog
|
||
v-model:visible="exportDialogVisible"
|
||
title="面单日志导出"
|
||
:loading="exportLoading"
|
||
:progress-percent="exportProgressPercent"
|
||
:progress-status="exportProgressStatus"
|
||
:status-label="exportStatusLabel"
|
||
:task-id="exportTaskProgress.taskId"
|
||
:message="exportTaskProgress.message"
|
||
:error="exportTaskProgress.error"
|
||
:meta="exportTaskProgress"
|
||
:update-time="exportTaskProgress.updateTime"
|
||
/>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||
import {
|
||
warehouseList,
|
||
storeWarehouseSign,
|
||
storeWarehouseConfirmSign,
|
||
storeWarehouseUnbind,
|
||
storeWarehouseRename,
|
||
listApiConfig,
|
||
storeWarehouseExportStorePrintQuantityLogs,
|
||
storeWarehouseExportStorePrintQuantityLogsTaskProgress,
|
||
storeWarehouseQueryStorePrintQuantityLogs
|
||
} from '@/api/storewarehouse.store/storeWarehouse'
|
||
import { listInterfaceTypes, getQimenAppList } from '@/api/index/index'
|
||
import ScanBox from '@/components/ScanBox/index.vue'
|
||
import UpperTable from '@/components/UpperTable/index.vue'
|
||
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||
import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
||
import { getStatusTextClass } from '@/utils/statusText'
|
||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||
import { useSettingsStore } from '@/stores/modules/settings'
|
||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||
import { safeInvoke } from '@/utils/safe-invoke'
|
||
|
||
const settingsStore = useSettingsStore()
|
||
const containerHeight = computed(() => '100%' /* 高度由布局层(.app-router-page 的 flex:1)提供,不再自己算 vh */)
|
||
|
||
const {
|
||
splitStackRef,
|
||
beginSplitDrag,
|
||
lowerPaneStyle,
|
||
upperPaneStyle,
|
||
} = useVerticalSplitPane({ defaultLowerPercent: 35 })
|
||
|
||
const upperPaneFullStyle = computed(() => ({
|
||
flex: '1 1 auto',
|
||
minHeight: '0',
|
||
overflow: 'hidden',
|
||
}))
|
||
|
||
const detailVisible = ref(true)
|
||
|
||
const toolbarButtons: ToolbarButtonConfig[] = [
|
||
{ key: 'refresh', label: '刷新', category: 'refresh', size: 'small', loadingKey: 'loading', action: 'loadList' },
|
||
{
|
||
key: 'toggleDetail',
|
||
label: '显示详情',
|
||
dynamicLabelKey: 'detailToggleLabel',
|
||
category: 'setting',
|
||
size: 'small',
|
||
action: 'toggleDetailVisible'
|
||
},
|
||
{ key: 'openSign', label: '发起签约', category: 'action', size: 'small', action: 'openSignDialog' },
|
||
{ key: 'exportLogs', label: '导出日志', category: 'action', size: 'small', loadingKey: 'exportLoading', action: 'handleExportLogs' },
|
||
]
|
||
|
||
// ─── 工具栏状态管理 ──────────────────────────────────────────────────────────
|
||
const buttonLoadingMap = computed(() => ({
|
||
loading: loading.value,
|
||
exportLoading: exportLoading.value
|
||
}))
|
||
|
||
const buttonDisabledMap = computed(() => ({}))
|
||
|
||
const buttonLabelMap = computed(() => ({
|
||
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||
}))
|
||
|
||
const toolbarLayoutKey = computed(() =>
|
||
JSON.stringify({
|
||
loading: buttonLoadingMap.value,
|
||
disabled: buttonDisabledMap.value,
|
||
labels: buttonLabelMap.value
|
||
})
|
||
)
|
||
|
||
function resolveButtonLoading(loadingKey?: string) {
|
||
if (!loadingKey) return false
|
||
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
|
||
}
|
||
|
||
function resolveButtonDisabled(disabledKey?: string) {
|
||
if (!disabledKey) return false
|
||
return Boolean((buttonDisabledMap.value as Record<string, boolean>)[disabledKey])
|
||
}
|
||
|
||
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
|
||
if (!dynamicLabelKey) return defaultLabel
|
||
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
|
||
}
|
||
|
||
function toggleDetailVisible() {
|
||
detailVisible.value = !detailVisible.value
|
||
}
|
||
|
||
const toolbarActionMap: Record<string, () => void> = {
|
||
loadList: () => { void loadList() },
|
||
openSignDialog: () => openSignDialog(),
|
||
handleExportLogs: () => { void handleExportLogs() },
|
||
toggleDetailVisible: () => toggleDetailVisible()
|
||
}
|
||
|
||
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||
const handler = toolbarActionMap[action]
|
||
if (!handler) return
|
||
safeInvoke(() => handler())
|
||
}
|
||
|
||
// ─── 列表列配置 ─────────────────────────────────────────────────────────────
|
||
const columns = [
|
||
{ prop: 'counterparty_name', label: '签约仓库', minWidth: 140 },
|
||
{ prop: 'store_name', label: '货主备注', minWidth: 140 },
|
||
{ prop: 'warehouse_id', label: '仓库ID', width: 90 },
|
||
{ prop: 'counterparty_role', label: '对方角色', width: 90 },
|
||
{ prop: 'auth_status', label: '签约状态', width: 100 },
|
||
{ prop: 'needs_my_confirm', label: '待确认', width: 90 },
|
||
{ prop: 'use_status', label: '使用状态', width: 90 },
|
||
{ prop: 'print_quantity', label: '面单余额', width: 100 },
|
||
{ prop: 'has_qimen_config', label: '奇门配置', width: 100 },
|
||
{ prop: 'auth_end', label: '授权截止', width: 120 },
|
||
{ prop: 'actions', label: '操作', width: 280, fixed: 'right' }
|
||
]
|
||
|
||
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
|
||
const availableFields = [
|
||
{
|
||
label: '关键词',
|
||
value: 'keyword',
|
||
type: 'text',
|
||
group: '基础信息',
|
||
placeholder: '搜索仓库名或备注'
|
||
},
|
||
{
|
||
label: '对方主体ID',
|
||
value: 'warehouse_id',
|
||
type: 'number',
|
||
group: '基础信息',
|
||
placeholder: '对方主体ID(兼容 counterparty_id)',
|
||
// 文档:warehouse_id(兼容 counterparty_id),等值匹配
|
||
operators: ['eq'],
|
||
defaultOperator: 'eq',
|
||
hideOperator: true
|
||
},
|
||
{
|
||
label: '签约状态',
|
||
value: 'auth_status',
|
||
type: 'select',
|
||
options: [
|
||
{ label: '待审核', value: 1 },
|
||
{ label: '已通过', value: 2 },
|
||
{ label: '已拒绝', value: 3 },
|
||
{ label: '已解除', value: 4 },
|
||
{ label: '已过期', value: 5 }
|
||
]
|
||
},
|
||
{
|
||
label: '使用状态',
|
||
value: 'use_status',
|
||
type: 'select',
|
||
options: [
|
||
{ label: '全部', value: undefined },
|
||
{ label: '启用', value: 1 },
|
||
{ label: '禁用', value: 0 }
|
||
]
|
||
}
|
||
]
|
||
|
||
const presetTree: any[] = []
|
||
|
||
// ─── 当前主体信息(从列表接口返回) ────────────────────────────────────────
|
||
const currentSubject = ref<{ store_id?: number; company_name?: string; role?: string }>({})
|
||
|
||
/** 当前主体角色(取自列表响应 current_subject.role):warehouse=仓库方,store=货主方 */
|
||
const currentSubjectRole = computed(() => String(currentSubject.value.role || '').toLowerCase())
|
||
const currentSubjectLabel = computed(() => (currentSubjectRole.value === 'warehouse' ? '当前仓库' : '当前货主'))
|
||
const currentSubjectRoleLabel = computed(() => (currentSubjectRole.value === 'warehouse' ? '仓库方' : '货主方'))
|
||
|
||
/** 对方主体角色(文档 counterparty_role):warehouse=仓库方,store=货主方 */
|
||
function getCounterpartyRoleLabel(role?: string): string {
|
||
if (role === 'warehouse') return '仓库方'
|
||
if (role === 'store') return '货主方'
|
||
return '—'
|
||
}
|
||
|
||
// ─── 列表状态 ──────────────────────────────────────────────────────────────
|
||
const loading = ref(false)
|
||
const queryTime = ref(0)
|
||
const tableSize = ref<'small' | 'default' | 'large'>('small')
|
||
const list = ref<any[]>([])
|
||
const selectionRows = ref<any[]>([])
|
||
const selectedRow = ref<any>(null)
|
||
const tableRef = ref<any>(null)
|
||
const scanBox = ref<any>(null)
|
||
const activeTab = ref('details')
|
||
|
||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||
const currentCondition = ref<any>({ use_status: 1 })
|
||
|
||
// ─── 操作日志状态 ──────────────────────────────────────────────────────────
|
||
const logLoading = ref(false)
|
||
const logList = ref<any[]>([])
|
||
const logPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||
|
||
/** 操作日志列配置(UpperTable) */
|
||
const logColumns = [
|
||
{ prop: 'id', label: 'ID', width: '70' },
|
||
{ prop: 'business_type', label: '业务类型', minWidth: '100' },
|
||
{ prop: 'change_quantity', label: '变更数量', width: '100' },
|
||
{ prop: 'before_quantity', label: '变更前面单余额', width: '130' },
|
||
{ prop: 'after_quantity', label: '变更后面单余额', width: '130' },
|
||
{ prop: 'reason', label: '变更原因', minWidth: '140' },
|
||
{ prop: 'operator_name', label: '操作人', width: '100' },
|
||
{ prop: 'created_at', label: '操作时间', width: '170' }
|
||
]
|
||
|
||
// ─── 导出日志(异步任务) ──────────────────────────────────────────────────
|
||
const {
|
||
exportLoading,
|
||
exportDialogVisible,
|
||
exportTaskProgress,
|
||
exportProgressPercent,
|
||
exportProgressStatus,
|
||
exportStatusLabel,
|
||
submitExportTask
|
||
} = useAsyncExportTask({
|
||
storageKey: 'warehouses:exportLogsTaskId',
|
||
submitExport: (payload) => storeWarehouseExportStorePrintQuantityLogs(payload as any),
|
||
queryProgress: (params) => storeWarehouseExportStorePrintQuantityLogsTaskProgress(params)
|
||
})
|
||
|
||
// ─── 加载列表 ──────────────────────────────────────────────────────────────
|
||
async function loadList() {
|
||
loading.value = true
|
||
const startTime = Date.now()
|
||
try {
|
||
const params: any = {
|
||
page: pagination.currentPage,
|
||
page_size: pagination.pageSize,
|
||
...currentCondition.value
|
||
}
|
||
|
||
const res = await warehouseList(params) as any
|
||
if (res?.data) {
|
||
const payload = res.data
|
||
list.value = payload.list || []
|
||
pagination.total = payload.pagination?.total || payload.total || 0
|
||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||
if (payload.current_subject) {
|
||
currentSubject.value = payload.current_subject
|
||
}
|
||
}
|
||
} catch (e) {
|
||
ElMessage.error('获取列表失败')
|
||
} finally {
|
||
queryTime.value = Date.now() - startTime
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
function isExpired(dateStr: string): boolean {
|
||
if (!dateStr) return false
|
||
const d = new Date(dateStr)
|
||
if (isNaN(d.getTime())) return false
|
||
return d < new Date()
|
||
}
|
||
|
||
function handleConditionChange(condition: any) {
|
||
const where: any = {}
|
||
if (condition) {
|
||
Object.keys(condition).forEach(k => {
|
||
const c = condition[k]
|
||
if (c && typeof c === 'object' && !Array.isArray(c) && c.value !== undefined) {
|
||
if (c.value !== '' && c.value !== null && c.value !== undefined) {
|
||
where[k] = c.value
|
||
}
|
||
} else if (c !== '' && c !== null && c !== undefined) {
|
||
where[k] = c
|
||
}
|
||
})
|
||
}
|
||
currentCondition.value = where
|
||
pagination.currentPage = 1
|
||
loadList()
|
||
}
|
||
|
||
function handleSubmit() {
|
||
pagination.currentPage = 1
|
||
loadList()
|
||
}
|
||
|
||
function handleConditionClear() {
|
||
currentCondition.value = {}
|
||
pagination.currentPage = 1
|
||
loadList()
|
||
}
|
||
|
||
function handleReset() {
|
||
currentCondition.value = {}
|
||
pagination.currentPage = 1
|
||
if (scanBox.value?.reset) {
|
||
scanBox.value.reset()
|
||
} else if (scanBox.value?.clear) {
|
||
scanBox.value.clear()
|
||
}
|
||
loadList()
|
||
}
|
||
|
||
function handlePageChange(page: number) {
|
||
pagination.currentPage = page
|
||
loadList()
|
||
}
|
||
|
||
function handleSizeChange(size: number) {
|
||
pagination.pageSize = size
|
||
pagination.currentPage = 1
|
||
loadList()
|
||
}
|
||
|
||
function handleRowClick(row: any) {
|
||
selectedRow.value = row
|
||
}
|
||
|
||
function handleSortChange(_sort: { prop: string; order: string }) {
|
||
// 预留排序事件处理
|
||
}
|
||
|
||
function handleSelectionChange(rows: any[]) {
|
||
selectionRows.value = rows || []
|
||
}
|
||
|
||
// ─── 工具函数 ──────────────────────────────────────────────────────────────
|
||
function getAuthStatusType(status: number): string {
|
||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info', 5: 'danger' }
|
||
return map[status] || 'info'
|
||
}
|
||
|
||
function getAuthStatusLabel(status: number): string {
|
||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除', 5: '已过期' }
|
||
return map[status] || '未知'
|
||
}
|
||
|
||
// ─── 启用/禁用 ─────────────────────────────────────────────────────────────
|
||
async function handleUnbind(row: any, targetStatus: number) {
|
||
const action = targetStatus === 1 ? '启用' : '禁用'
|
||
try {
|
||
await ElMessageBox.confirm(`确认${action}该签约关系?`, '提示', { type: 'warning', buttonSize: 'small' })
|
||
} catch {
|
||
return
|
||
}
|
||
try {
|
||
// 实测(2026-11-19):当前主体 role=warehouse 时,传 store_use_status 与 warehouse_use_status
|
||
// 均返回 success 但 use_status 不变(静默失败);文档语义:仓库侧传 warehouse_use_status,货主侧传 store_use_status
|
||
const useStatusField = currentSubjectRole.value === 'store' ? 'store_use_status' : 'warehouse_use_status'
|
||
const res = (await storeWarehouseUnbind({ id: row.id, [useStatusField]: targetStatus } as any)) as any
|
||
if (res?.flag === 'success' || res?.code === 200) {
|
||
ElMessage.success(`${action}成功`)
|
||
loadList()
|
||
} else {
|
||
ElMessage.error(res?.message || `${action}失败`)
|
||
}
|
||
} catch (e) {
|
||
ElMessage.error(`${action}失败`)
|
||
}
|
||
}
|
||
|
||
// ─── 修改备注 ──────────────────────────────────────────────────────────────
|
||
const renameVisible = ref(false)
|
||
const renameLoading = ref(false)
|
||
const renameRow = ref<any>(null)
|
||
const renameForm = reactive({ remask: '' })
|
||
|
||
/** 打开修改备注面板(替代原 ElMessageBox.prompt,样式对齐批量修改信息表单) */
|
||
function handleRename(row: any) {
|
||
renameRow.value = row
|
||
renameForm.remask = String(row?.remask ?? '')
|
||
renameVisible.value = true
|
||
}
|
||
|
||
async function submitRename() {
|
||
if (renameLoading.value) return
|
||
const id = Number(renameRow.value?.id)
|
||
if (!Number.isInteger(id) || id <= 0) {
|
||
ElMessage.warning('缺少仓库 ID')
|
||
return
|
||
}
|
||
const remask = renameForm.remask.trim()
|
||
if (!remask) {
|
||
ElMessage.warning('请输入新的备注名')
|
||
return
|
||
}
|
||
renameLoading.value = true
|
||
try {
|
||
await storeWarehouseRename({ id, remask })
|
||
ElMessage.success('备注修改成功')
|
||
renameVisible.value = false
|
||
loadList()
|
||
} catch {
|
||
// 请求层已提示错误
|
||
} finally {
|
||
renameLoading.value = false
|
||
}
|
||
}
|
||
|
||
// ─── 发起签约 ──────────────────────────────────────────────────────────────
|
||
const signDialog = reactive({
|
||
visible: false,
|
||
title: '发起签约',
|
||
step: 1,
|
||
loading: false,
|
||
signMode: '' as string,
|
||
temp_code: '' as string,
|
||
contract: null as any,
|
||
currentSubject: null as any,
|
||
counterparty: null as any
|
||
})
|
||
|
||
const signForm = reactive({
|
||
counterparty_id: undefined as number | undefined
|
||
})
|
||
|
||
/** 发起签约面板副标题(按步骤 / 结果态变化) */
|
||
const signSubtitle = computed(() => {
|
||
if (signDialog.step === 1) return '填写对方主体 ID 后预览双方的签约信息'
|
||
if (signDialog.signMode === 'preview') return '请确认双方主体信息,确认无误后提交'
|
||
return '签约结果如下,可关闭窗口'
|
||
})
|
||
|
||
/** 发起签约面板页脚提示 */
|
||
const signFooterHint = computed(() => {
|
||
if (signDialog.step === 1) return '对方主体 ID 为仓库方的主体编号'
|
||
if (signDialog.signMode === 'preview') return '确认提交后将等待对方确认'
|
||
return '签约状态已更新'
|
||
})
|
||
|
||
/** 发起签约面板提示条文案(按步骤 / 结果态变化) */
|
||
const signTip = computed(() => {
|
||
if (signDialog.step === 1) return '填写对方(仓库方)的主体 ID,预览确认无误后再提交。'
|
||
if (signDialog.signMode === 'preview') return '请确认签约信息,确认无误后点击「确认提交」。'
|
||
if (signDialog.signMode === 'already_exists') return '对方已发起签约申请,等待处理。'
|
||
if (signDialog.signMode === 'already_confirmed') return '该签约已完成,无需重复提交。'
|
||
if (signDialog.signMode === 'initiate') return '已提交申请,等待对方确认。'
|
||
return '签约结果如下,可直接关闭窗口。'
|
||
})
|
||
|
||
function openSignDialog() {
|
||
signDialog.visible = true
|
||
signDialog.step = 1
|
||
signDialog.title = '发起签约'
|
||
signDialog.signMode = ''
|
||
signDialog.temp_code = ''
|
||
signDialog.contract = null
|
||
signDialog.currentSubject = null
|
||
signDialog.counterparty = null
|
||
signForm.counterparty_id = undefined
|
||
}
|
||
|
||
function resetSignDialog() {
|
||
signForm.counterparty_id = undefined
|
||
signDialog.step = 1
|
||
signDialog.loading = false
|
||
signDialog.temp_code = ''
|
||
}
|
||
|
||
async function doPreviewSign() {
|
||
if (!signForm.counterparty_id) {
|
||
ElMessage.warning('请输入对方主体ID')
|
||
return
|
||
}
|
||
signDialog.loading = true
|
||
try {
|
||
const res = await storeWarehouseSign({
|
||
counterparty_id: signForm.counterparty_id
|
||
}) as any
|
||
if (res?.data) {
|
||
const d = res.data
|
||
signDialog.signMode = d.mode || ''
|
||
signDialog.temp_code = d.temp_code || ''
|
||
signDialog.contract = d.contract || null
|
||
signDialog.currentSubject = d.current_subject || null
|
||
signDialog.counterparty = d.counterparty || null
|
||
signDialog.step = 2
|
||
signDialog.title = '签约预览'
|
||
}
|
||
} catch (e) {
|
||
ElMessage.error('获取预览失败')
|
||
} finally {
|
||
signDialog.loading = false
|
||
}
|
||
}
|
||
|
||
async function doSubmitSign() {
|
||
if (!signForm.counterparty_id) {
|
||
ElMessage.warning('缺少对方主体ID')
|
||
return
|
||
}
|
||
signDialog.loading = true
|
||
try {
|
||
const payload: { counterparty_id: number; temp_code?: string } = {
|
||
counterparty_id: signForm.counterparty_id
|
||
}
|
||
if (signDialog.temp_code) {
|
||
payload.temp_code = signDialog.temp_code
|
||
}
|
||
await storeWarehouseSign(payload)
|
||
ElMessage.success('签约申请已提交')
|
||
signDialog.visible = false
|
||
loadList()
|
||
} catch (e) {
|
||
ElMessage.error('提交签约失败')
|
||
} finally {
|
||
signDialog.loading = false
|
||
}
|
||
}
|
||
|
||
function goBackToStep1() {
|
||
signDialog.step = 1
|
||
signDialog.signMode = ''
|
||
signDialog.temp_code = ''
|
||
signDialog.contract = null
|
||
signDialog.currentSubject = null
|
||
signDialog.counterparty = null
|
||
}
|
||
|
||
async function handleConfirmSign(row: any) {
|
||
try {
|
||
await ElMessageBox.confirm(
|
||
`确认与「${row.warehouse_name || row.remask || row.counterparty_name}」的签约关系?`,
|
||
'确认签约',
|
||
{ type: 'warning', buttonSize: 'small' }
|
||
)
|
||
} catch {
|
||
return
|
||
}
|
||
try {
|
||
const res = await storeWarehouseConfirmSign({ id: row.id })
|
||
if (res?.flag === 'success' || res?.code === 200 || res?.data?.mode === 'confirm') {
|
||
ElMessage.success('签约已确认')
|
||
loadList()
|
||
} else {
|
||
ElMessage.error(res?.message || '确认签约失败')
|
||
}
|
||
} catch (e) {
|
||
ElMessage.error('确认签约失败')
|
||
}
|
||
}
|
||
|
||
// ─── 奇门接口配置查看 ──────────────────────────────────────────────────────
|
||
const qimenDialog = reactive({
|
||
visible: false,
|
||
loading: false,
|
||
contractRow: null as any,
|
||
list: [] as any[],
|
||
availableTypes: [] as any[]
|
||
})
|
||
const qimenAppOptions = ref<Array<{ label: string; value: string }>>([])
|
||
const visibleSecrets = reactive<Record<string | number, boolean>>({})
|
||
|
||
function toggleSecret(row: any) {
|
||
const key = row.id || row.interface_type_id
|
||
visibleSecrets[key] = !visibleSecrets[key]
|
||
}
|
||
|
||
function openQimenDialog(row: any) {
|
||
qimenDialog.contractRow = row
|
||
qimenDialog.list = []
|
||
qimenDialog.visible = true
|
||
void loadQimenAppOptions()
|
||
loadQimenConfigs()
|
||
}
|
||
|
||
function resetQimenDialog() {
|
||
qimenDialog.contractRow = null
|
||
qimenDialog.list = []
|
||
qimenDialog.availableTypes = []
|
||
qimenAppOptions.value = []
|
||
}
|
||
|
||
function getQimenErpDisplay(config: any): string {
|
||
return String(config?.erp_name || config?.erpName || config?.qimen_app_key || '').trim()
|
||
}
|
||
|
||
function mapQimenAppOptions(rawList: any[]) {
|
||
const result: Array<{ label: string; value: string }> = []
|
||
const seen = new Set<string>()
|
||
for (const item of rawList || []) {
|
||
const appKey = String(item?.app_key ?? item?.qimen_app_key ?? item?.value ?? '').trim()
|
||
if (!appKey || seen.has(appKey)) continue
|
||
const appName = String(item?.app_name ?? item?.name ?? item?.label ?? '').trim()
|
||
result.push({ value: appKey, label: appName ? `${appName}(${appKey})` : appKey })
|
||
seen.add(appKey)
|
||
}
|
||
return result
|
||
}
|
||
|
||
async function loadQimenAppOptions() {
|
||
try {
|
||
const res: any = await getQimenAppList({})
|
||
const payload = res?.data
|
||
const listRaw =
|
||
res?.list || res?.records || (Array.isArray(res) ? res : null) ||
|
||
(Array.isArray(payload) ? payload : null) || payload?.list || payload?.records ||
|
||
payload?.data?.list || payload?.data?.records || payload?.data || []
|
||
const rows = Array.isArray(listRaw) ? listRaw : []
|
||
qimenAppOptions.value = mapQimenAppOptions(rows)
|
||
} catch {
|
||
qimenAppOptions.value = []
|
||
}
|
||
}
|
||
|
||
async function loadQimenConfigs() {
|
||
if (!qimenDialog.contractRow) return
|
||
qimenDialog.loading = true
|
||
try {
|
||
const [res, typesRes] = await Promise.all([
|
||
listApiConfig({ id: qimenDialog.contractRow.id }) as Promise<any>,
|
||
listInterfaceTypes() as Promise<any>
|
||
])
|
||
const serverTypes: any[] = Array.isArray(typesRes?.list) ? typesRes.list : []
|
||
const typeMap = new Map<number, any>(serverTypes.map((t: any) => [t.id, t]))
|
||
if (res?.data) {
|
||
qimenDialog.list = (res.data.list || []).map((item: any) => ({
|
||
...item,
|
||
erp_display: getQimenErpDisplay(item)
|
||
}))
|
||
;(res.data.list || []).forEach((item: any) => {
|
||
const tid = item.interface_type_id
|
||
if (tid && !typeMap.has(tid)) {
|
||
typeMap.set(tid, {
|
||
id: tid,
|
||
interface_code: item.interface_code || item.interface_category || '',
|
||
interface_name: item.interface_name || item.interface_code || `类型 ${tid}`
|
||
})
|
||
}
|
||
})
|
||
}
|
||
qimenDialog.availableTypes = Array.from(typeMap.values())
|
||
} catch {
|
||
ElMessage.error('加载接口配置列表失败')
|
||
} finally {
|
||
qimenDialog.loading = false
|
||
}
|
||
}
|
||
|
||
async function copyText(text: string) {
|
||
try {
|
||
if (navigator?.clipboard?.writeText) {
|
||
await navigator.clipboard.writeText(text)
|
||
} else {
|
||
const input = document.createElement('textarea')
|
||
input.value = text
|
||
input.style.position = 'fixed'
|
||
input.style.opacity = '0'
|
||
document.body.appendChild(input)
|
||
input.focus()
|
||
input.select()
|
||
document.execCommand('copy')
|
||
document.body.removeChild(input)
|
||
}
|
||
ElMessage.success('已复制')
|
||
} catch {
|
||
ElMessage.error('复制失败')
|
||
}
|
||
}
|
||
|
||
// ─── 操作日志 ──────────────────────────────────────────────────────────────
|
||
async function loadLogs() {
|
||
if (!selectedRow.value?.id) return
|
||
logLoading.value = true
|
||
try {
|
||
const res = await storeWarehouseQueryStorePrintQuantityLogs({
|
||
where: { id: selectedRow.value.id },
|
||
pagination: {
|
||
page: logPagination.currentPage,
|
||
page_size: logPagination.pageSize
|
||
}
|
||
}) as any
|
||
if (res?.data) {
|
||
const payload = res.data
|
||
logList.value = payload.list || []
|
||
logPagination.total = payload.pagination?.total || payload.total || 0
|
||
}
|
||
} catch {
|
||
ElMessage.error('获取操作日志失败')
|
||
} finally {
|
||
logLoading.value = false
|
||
}
|
||
}
|
||
|
||
function handleLogPageChange(page: number) {
|
||
logPagination.currentPage = page
|
||
void loadLogs()
|
||
}
|
||
|
||
function handleLogSizeChange(size: number) {
|
||
logPagination.pageSize = size
|
||
logPagination.currentPage = 1
|
||
void loadLogs()
|
||
}
|
||
|
||
// 监听 tab 切换,切换到操作日志时自动加载
|
||
watch(activeTab, (val) => {
|
||
if (val === 'logs' && selectedRow.value) {
|
||
logPagination.currentPage = 1
|
||
loadLogs()
|
||
}
|
||
})
|
||
|
||
watch(selectedRow, (row) => {
|
||
if (row && activeTab.value === 'logs') {
|
||
logPagination.currentPage = 1
|
||
loadLogs()
|
||
}
|
||
})
|
||
|
||
// ─── 导出操作日志 ──────────────────────────────────────────────────────────
|
||
async function handleExportLogs() {
|
||
if (!selectedRow.value?.id) {
|
||
ElMessage.warning('请先选择一条签约记录')
|
||
return
|
||
}
|
||
await submitExportTask({
|
||
where: { id: selectedRow.value.id }
|
||
})
|
||
}
|
||
|
||
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
||
onMounted(() => {
|
||
loadList()
|
||
})
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
@use "@/styles/list-page.scss";
|
||
@use "@/styles/status-text.scss";
|
||
|
||
/* 详情区外壳与 storage/entry_owner 一致:不留上/下间距,左右 10px,
|
||
面板自身 padding: 6px 10px 8px(合计内容缩进 20px) */
|
||
.order-sub-container .main-content .lower-level .detail-container {
|
||
padding: 0 10px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
box-sizing: border-box;
|
||
overflow: auto;
|
||
flex: 1;
|
||
min-height: 0;
|
||
|
||
/* 签约详情:分区标题 + 带边框描述列表(对齐 stock/external_stock「基本信息」新设计) */
|
||
.detail-panel {
|
||
flex: 1;
|
||
min-height: 0;
|
||
padding: 6px 10px 8px;
|
||
box-sizing: border-box;
|
||
overflow: auto;
|
||
|
||
.section {
|
||
margin-bottom: 12px;
|
||
|
||
&:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 14px;
|
||
font-weight: 600;
|
||
color: #303133;
|
||
margin-bottom: 10px;
|
||
padding-left: 8px;
|
||
border-left: 3px solid #409eff;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
.detail-descriptions :deep(.el-descriptions__label) {
|
||
width: 110px;
|
||
background: #fafbfc;
|
||
font-weight: 500;
|
||
}
|
||
}
|
||
|
||
/* 操作日志:按钮行 + 自适应表格 + 右对齐分页(对齐 storage/entry_owner 的日志面板新设计) */
|
||
.log-panel {
|
||
flex: 1;
|
||
min-height: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding: 6px 10px 8px;
|
||
overflow: hidden;
|
||
background: #fff;
|
||
box-sizing: border-box;
|
||
|
||
.header-actions {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 6px;
|
||
flex-shrink: 0;
|
||
gap: 4px;
|
||
flex-wrap: wrap;
|
||
|
||
.left-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
|
||
/* 清除 Element Plus 默认按钮左边距,统一由 gap 控制等间距 */
|
||
:deep(.el-button) {
|
||
margin-left: 0;
|
||
margin-right: 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
.table-host {
|
||
flex: 1;
|
||
min-height: 120px;
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
display: flex;
|
||
flex-direction: column;
|
||
|
||
/* UpperTable 需要确定高度;表格自带 border,不需要卡片阴影/圆角 */
|
||
:deep(.upper-table-container) {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
box-shadow: none;
|
||
border-radius: 0;
|
||
}
|
||
|
||
:deep(.table-container) {
|
||
flex: 1;
|
||
min-height: 0;
|
||
height: auto !important;
|
||
}
|
||
|
||
/* 分页区:左侧「已选 N 项」+ 右侧分页器,无分隔线 */
|
||
:deep(.pagination-container) {
|
||
flex-shrink: 0;
|
||
padding: 0;
|
||
border-top: none;
|
||
margin-top: 6px;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
:deep(.pagination-info) {
|
||
font-size: 12px;
|
||
color: #606266;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.empty-tip {
|
||
text-align: center;
|
||
font-size: 13px;
|
||
color: #909399;
|
||
padding: 16px;
|
||
}
|
||
|
||
.real-name {
|
||
color: #999;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.wave-operation-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 4px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.text-muted {
|
||
color: #c0c4cc;
|
||
}
|
||
|
||
.text-danger {
|
||
color: #f56c6c;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.copy-cell {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
.copy-text {
|
||
font-family: monospace;
|
||
font-size: 12px;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
flex: 1;
|
||
}
|
||
}
|
||
|
||
/* 修改备注:面板结构 / 尺寸对齐「批量修改平台信息」(UpdateOrderMetaForm) */
|
||
.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;
|
||
padding: 4px 0 0 12px;
|
||
border: none;
|
||
border-radius: 0;
|
||
background: transparent;
|
||
|
||
.task-panel__field-label {
|
||
padding-top: 7px;
|
||
|
||
&.is-required::before {
|
||
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;
|
||
white-space: nowrap;
|
||
|
||
&.is-required::before {
|
||
content: '*';
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
line-height: 20px;
|
||
color: #f56c6c;
|
||
}
|
||
}
|
||
|
||
&__field-value {
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
color: #303133;
|
||
text-align: right;
|
||
word-break: break-all;
|
||
}
|
||
|
||
&__field-control {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
&__field-form {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
&__form-tip {
|
||
margin: 8px 0 0;
|
||
padding: 8px 12px;
|
||
border-radius: 4px;
|
||
background: #f4f4f5;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #909399;
|
||
}
|
||
|
||
&__field-tip {
|
||
margin: 4px 0 0;
|
||
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:去掉默认头/内边距,统一交给面板 */
|
||
.el-dialog.rename-remark-dialog,
|
||
.el-dialog.sign-panel-dialog {
|
||
padding: 0;
|
||
overflow: hidden;
|
||
|
||
.el-dialog__header {
|
||
display: none;
|
||
}
|
||
|
||
.el-dialog__body {
|
||
padding: 0;
|
||
}
|
||
}
|
||
</style>
|