1
This commit is contained in:
parent
99dd76a1ab
commit
ae76229068
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="external-stock-container">
|
<div class="order-sub-container">
|
||||||
<scan-box
|
<scan-box
|
||||||
ref="scanBox"
|
ref="scanBox"
|
||||||
width="250px"
|
width="250px"
|
||||||
@ -13,33 +13,14 @@
|
|||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<el-button size="small" @click="loadList">
|
<order-toolbar-button-group
|
||||||
<el-icon><Refresh /></el-icon> 刷新
|
:buttons="toolbarButtons"
|
||||||
</el-button>
|
:resolve-disabled="resolveButtonDisabled"
|
||||||
<el-button size="small" plain @click="tableRef?.openColumnConfig?.()">字段设置</el-button>
|
:resolve-loading="resolveButtonLoading"
|
||||||
<el-divider direction="vertical" />
|
:resolve-label="resolveButtonLabel"
|
||||||
<el-dropdown
|
:layout-key="toolbarLayoutKey"
|
||||||
trigger="click"
|
@action="handleToolbarButtonClick"
|
||||||
@command="handleExportCommand"
|
/>
|
||||||
>
|
|
||||||
<el-button
|
|
||||||
size="small"
|
|
||||||
type="primary"
|
|
||||||
:loading="exportLoading"
|
|
||||||
>
|
|
||||||
导出<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item command="selected" :disabled="!hasSelection">
|
|
||||||
导出选中
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="all" :divided="true">
|
|
||||||
导出全部
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -53,7 +34,7 @@
|
|||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div class="split-stack" ref="splitStackRef">
|
<div class="split-stack" ref="splitStackRef">
|
||||||
<div class="upper-wrapper" :style="upperPaneStyle">
|
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||||||
<upper-table
|
<upper-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
default-align="center"
|
default-align="center"
|
||||||
@ -118,6 +99,7 @@
|
|||||||
</upper-table>
|
</upper-table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<template v-if="detailVisible">
|
||||||
<div
|
<div
|
||||||
class="pane-resizer"
|
class="pane-resizer"
|
||||||
title="拖动调整列表与详情区域高度"
|
title="拖动调整列表与详情区域高度"
|
||||||
@ -211,9 +193,12 @@
|
|||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="lower-level empty" v-else :style="lowerPaneStyle">
|
<div class="no-selection" v-else :style="lowerPaneStyle">
|
||||||
<el-empty description="请选择数据查看详情" :image-size="60" />
|
<div class="empty-tip">
|
||||||
|
<p>请从上方列表中选择一项查看详情</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div><!-- .split-stack -->
|
</div><!-- .split-stack -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -264,7 +249,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted, computed } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { Refresh, ArrowDown } from '@element-plus/icons-vue'
|
|
||||||
import { stockWarehouseExternalList, stockWarehouseExternalExport, getExportTaskProgress, saveWarehouseStock, type StockWarehouseListSort } from '@/api/stock/stock'
|
import { stockWarehouseExternalList, stockWarehouseExternalExport, getExportTaskProgress, saveWarehouseStock, type StockWarehouseListSort } from '@/api/stock/stock'
|
||||||
import { getImages } from '@/api/index/index'
|
import { getImages } from '@/api/index/index'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
@ -273,6 +257,8 @@ import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
|||||||
import ErpStock from '@/views/stock/stock/component/erpStock.vue'
|
import ErpStock from '@/views/stock/stock/component/erpStock.vue'
|
||||||
import Log from '@/views/stock/stock/component/log.vue'
|
import Log from '@/views/stock/stock/component/log.vue'
|
||||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||||
|
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||||
|
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
|
|
||||||
@ -327,7 +313,7 @@ const availableFields: any[] = [
|
|||||||
group: '基础信息'
|
group: '基础信息'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '货物编码',
|
label: '条码',
|
||||||
value: 'goods_code',
|
value: 'goods_code',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
group: '基础信息'
|
group: '基础信息'
|
||||||
@ -504,14 +490,6 @@ async function handleExportSelected() {
|
|||||||
await submitExportTask(buildExportSelectedPayload())
|
await submitExportTask(buildExportSelectedPayload())
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleExportCommand(command: string) {
|
|
||||||
if (command === 'selected') {
|
|
||||||
handleExportSelected()
|
|
||||||
} else if (command === 'all') {
|
|
||||||
handleExportAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── 上下分栏拖动 ──────────────────────────────────────────────────────────
|
// ─── 上下分栏拖动 ──────────────────────────────────────────────────────────
|
||||||
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
||||||
defaultLowerPercent: 35,
|
defaultLowerPercent: 35,
|
||||||
@ -519,6 +497,96 @@ const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVer
|
|||||||
maxLowerPercent: 70
|
maxLowerPercent: 70
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const detailVisible = ref(true)
|
||||||
|
const upperPaneFullStyle = computed(() => ({
|
||||||
|
flex: '1 1 auto',
|
||||||
|
minHeight: '0',
|
||||||
|
overflow: 'hidden'
|
||||||
|
}))
|
||||||
|
|
||||||
|
function toggleDetailVisible() {
|
||||||
|
detailVisible.value = !detailVisible.value
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 工具栏按钮配置 ────────────────────────────────────────────────────────
|
||||||
|
const toolbarButtons = computed<ToolbarButtonConfig[]>(() => [
|
||||||
|
{
|
||||||
|
key: 'refresh',
|
||||||
|
label: '刷新',
|
||||||
|
size: 'small',
|
||||||
|
action: 'handleRefresh'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'columnConfig',
|
||||||
|
label: '字段设置',
|
||||||
|
size: 'small',
|
||||||
|
action: 'openColumnConfigPanel'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'export',
|
||||||
|
label: '导出',
|
||||||
|
size: 'small',
|
||||||
|
loadingKey: 'exportLoading',
|
||||||
|
action: 'handleExportAll',
|
||||||
|
buttonType: 'dropdown',
|
||||||
|
dropdownOptions: [
|
||||||
|
{ label: '导出选中', action: 'handleExportSelected' },
|
||||||
|
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'toggleDetail',
|
||||||
|
label: '显示详情',
|
||||||
|
dynamicLabelKey: 'detailToggleLabel',
|
||||||
|
size: 'small',
|
||||||
|
action: 'toggleDetailVisible'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const buttonLoadingMap = computed(() => ({
|
||||||
|
exportLoading: exportLoading.value
|
||||||
|
}))
|
||||||
|
|
||||||
|
const buttonLabelMap = computed(() => ({
|
||||||
|
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||||||
|
}))
|
||||||
|
|
||||||
|
const toolbarLayoutKey = computed(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
loading: buttonLoadingMap.value,
|
||||||
|
labels: buttonLabelMap.value,
|
||||||
|
permissions: toolbarButtons.value.map((button) => button.key).join(',')
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
function resolveButtonLoading(loadingKey?: string) {
|
||||||
|
if (!loadingKey) return false
|
||||||
|
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveButtonDisabled(_disabledKey?: string) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
|
||||||
|
if (!dynamicLabelKey) return defaultLabel
|
||||||
|
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolbarActionMap: Record<string, () => void> = {
|
||||||
|
handleRefresh: () => loadList(),
|
||||||
|
openColumnConfigPanel: () => tableRef.value?.openColumnConfig?.(),
|
||||||
|
handleExportAll: () => handleExportAll(),
|
||||||
|
handleExportSelected: () => handleExportSelected(),
|
||||||
|
toggleDetailVisible: () => toggleDetailVisible()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||||
|
const handler = toolbarActionMap[action]
|
||||||
|
if (!handler) return
|
||||||
|
handler()
|
||||||
|
}
|
||||||
|
|
||||||
// ─── 特殊字段键(不作为 where 条件,需要单独提取)──────────────────────
|
// ─── 特殊字段键(不作为 where 条件,需要单独提取)──────────────────────
|
||||||
const SPECIAL_KEYS = ['keyword', 'warehouse_id']
|
const SPECIAL_KEYS = ['keyword', 'warehouse_id']
|
||||||
|
|
||||||
@ -721,82 +789,19 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.external-stock-container {
|
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||||
display: flex;
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
.main-content {
|
.order-sub-container .main-content .lower-level .detail-container {
|
||||||
flex: 1;
|
padding: 10px;
|
||||||
display: flex;
|
overflow: auto;
|
||||||
flex-direction: column;
|
|
||||||
min-width: 0;
|
|
||||||
padding: 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar {
|
.empty-tip {
|
||||||
display: flex;
|
text-align: center;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
gap: 12px;
|
|
||||||
|
|
||||||
&-left {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.upper-wrapper {
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.split-stack {
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.pane-resizer {
|
|
||||||
flex: 0 0 6px;
|
|
||||||
min-height: 6px;
|
|
||||||
background: #e4e7ed;
|
|
||||||
cursor: row-resize;
|
|
||||||
flex-shrink: 0;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: #dcdfe6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-bar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
padding: 8px 12px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
background: #f0f9eb;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #606266;
|
line-height: 1.5;
|
||||||
flex-shrink: 0;
|
padding: 40px 0;
|
||||||
|
color: #909399;
|
||||||
b {
|
|
||||||
color: #303133;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-divider {
|
|
||||||
color: #dcdfe6;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-thumb {
|
.table-thumb {
|
||||||
@ -812,29 +817,6 @@ onMounted(() => {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lower-level {
|
|
||||||
border: 1px solid #ebeef5;
|
|
||||||
border-radius: 4px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
&.empty {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-header {
|
|
||||||
padding: 0 12px;
|
|
||||||
border-bottom: 1px solid #ebeef5;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-container {
|
|
||||||
padding: 12px;
|
|
||||||
overflow: auto;
|
|
||||||
flex: 1;
|
|
||||||
min-height: 0;
|
|
||||||
|
|
||||||
.image-gallery {
|
.image-gallery {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@ -848,7 +830,10 @@ onMounted(() => {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
.erp-stock-wrapper,
|
||||||
|
.log-wrapper {
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -346,11 +346,22 @@ async function loadBindingData() {
|
|||||||
throw new Error('入库单数据为空')
|
throw new Error('入库单数据为空')
|
||||||
}
|
}
|
||||||
|
|
||||||
const bindings = Array.isArray(entryOrder.receivingBindings) ? entryOrder.receivingBindings : []
|
// items / receivingBindings 与 entryOrder 平级(都在 res.data 下),
|
||||||
receivingBindings.value = bindings.map(mapReceivingBindingRow)
|
// 优先从 res.data 取,兜底从 entryOrder 内部取
|
||||||
itemBindingRows.value = buildItemBindingRows(
|
const data = (res.data && typeof res.data === 'object') ? res.data as Record<string, unknown> : {}
|
||||||
Array.isArray(entryOrder.items) ? entryOrder.items : []
|
const bindings = Array.isArray(data.receivingBindings)
|
||||||
)
|
? data.receivingBindings
|
||||||
|
: Array.isArray(entryOrder.receivingBindings)
|
||||||
|
? entryOrder.receivingBindings
|
||||||
|
: []
|
||||||
|
const items = Array.isArray(data.items)
|
||||||
|
? data.items
|
||||||
|
: Array.isArray(entryOrder.items)
|
||||||
|
? entryOrder.items
|
||||||
|
: []
|
||||||
|
|
||||||
|
receivingBindings.value = (bindings as EntryOrderReceivingBinding[]).map(mapReceivingBindingRow)
|
||||||
|
itemBindingRows.value = buildItemBindingRows(items as EntryDetailItem[])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取绑定关系失败:', error)
|
console.error('获取绑定关系失败:', error)
|
||||||
ElMessage.error('获取绑定关系失败')
|
ElMessage.error('获取绑定关系失败')
|
||||||
|
|||||||
@ -0,0 +1,292 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:model-value="visible"
|
||||||
|
title="收货绑定详情"
|
||||||
|
width="900px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@update:model-value="$emit('update:visible', $event)"
|
||||||
|
@closed="handleClosed"
|
||||||
|
align-center
|
||||||
|
>
|
||||||
|
<div v-loading="loading" class="binding-detail-content">
|
||||||
|
<el-tabs v-model="activeTab" type="card">
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="(item, index) in detailList"
|
||||||
|
:key="item.receivingId"
|
||||||
|
:label="item.receivingNumber"
|
||||||
|
:name="String(index)"
|
||||||
|
>
|
||||||
|
<div class="receiving-info-section">
|
||||||
|
<div class="section-title">收货单信息</div>
|
||||||
|
<el-descriptions :column="3" size="small" border>
|
||||||
|
<el-descriptions-item label="收货单号">{{ item.receivingNumber }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="收货单状态">
|
||||||
|
<el-tag size="small" :type="getReceivingStatusTag(item.status)">{{ item.statusLabel }}</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="创建时间">{{ item.createdAt }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="供应商">{{ item.supplierName || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="运单号">{{ item.expressCode || '—' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注">{{ item.remark || '—' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="product-detail-section">
|
||||||
|
<div class="section-title">
|
||||||
|
商品明细
|
||||||
|
<span class="section-count">共 {{ item.details.length }} 条</span>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="item.details"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
size="small"
|
||||||
|
row-key="id"
|
||||||
|
empty-text="暂无商品明细"
|
||||||
|
max-height="360"
|
||||||
|
>
|
||||||
|
<el-table-column prop="product_code" label="商品编码" width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="product_name" label="商品名称" min-width="160" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="sku_property" label="规格" width="120" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="planned_quantity" label="计划数量" width="90" align="right" />
|
||||||
|
<el-table-column prop="actual_quantity" label="实收数量" width="90" align="right" />
|
||||||
|
<el-table-column prop="unit" label="单位" width="70" align="center" />
|
||||||
|
<el-table-column prop="batch_number" label="批次号" width="130" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="production_date" label="生产日期" width="110" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatDateCell(row.production_date) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="expiry_date" label="过期日期" width="110" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatDateCell(row.expiry_date) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="status" label="状态" width="90" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag size="small" :type="getDetailStatusTag(row.status)">{{ row.statusLabel || row.status || '—' }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<div v-if="!detailList.length && !loading" class="empty-state">暂无可显示的收货绑定数据</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button size="small" @click="handleClose">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import { getReceivingDetail } from '@/api/storage_receiving/receiving'
|
||||||
|
import { formatDateTime } from '@/views/storage/receiving/receiving-config'
|
||||||
|
|
||||||
|
interface ReceivingDetailItem {
|
||||||
|
receivingId: number | string
|
||||||
|
receivingNumber: string
|
||||||
|
status: string
|
||||||
|
statusLabel: string
|
||||||
|
createdAt: string
|
||||||
|
supplierName: string
|
||||||
|
expressCode: string
|
||||||
|
remark: string
|
||||||
|
details: Record<string, unknown>[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean
|
||||||
|
receivingBindings?: unknown[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:visible': [value: boolean]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const activeTab = ref('0')
|
||||||
|
const detailList = ref<ReceivingDetailItem[]>([])
|
||||||
|
|
||||||
|
const receivingStatusOptions: Record<string, string> = {
|
||||||
|
CREATED: '已创建',
|
||||||
|
PENDING: '待收货',
|
||||||
|
RECEIVING: '收货中',
|
||||||
|
PARTIAL: '部分收货',
|
||||||
|
COMPLETED: '已完成',
|
||||||
|
CANCELLED: '已作废',
|
||||||
|
}
|
||||||
|
|
||||||
|
function getReceivingStatusTag(status: string): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
CREATED: 'info',
|
||||||
|
PENDING: 'warning',
|
||||||
|
RECEIVING: 'primary',
|
||||||
|
PARTIAL: 'primary',
|
||||||
|
COMPLETED: 'success',
|
||||||
|
CANCELLED: 'danger',
|
||||||
|
}
|
||||||
|
return map[status?.toUpperCase()] || 'info'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDetailStatusTag(status: string): string {
|
||||||
|
const map: Record<string, string> = {
|
||||||
|
PENDING: 'info',
|
||||||
|
RECEIVED: 'success',
|
||||||
|
PARTIAL: 'warning',
|
||||||
|
CANCELLED: 'danger',
|
||||||
|
}
|
||||||
|
return map[status?.toUpperCase()] || 'info'
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDateCell(value: unknown): string {
|
||||||
|
if (!value) return '—'
|
||||||
|
const str = String(value)
|
||||||
|
// 仅取日期部分
|
||||||
|
if (str.length >= 10) return str.substring(0, 10)
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeDetailRow(raw: Record<string, unknown>): Record<string, unknown> {
|
||||||
|
// 收货明细 API (storage.receiving.getReceivingDetail) 返回的字段名:
|
||||||
|
// barcode / product_name / actual_quantity / batch_number / production_date / expiry_date / storage_status 等
|
||||||
|
return {
|
||||||
|
id: raw.id,
|
||||||
|
product_code: raw.barcode ?? raw.product_code ?? raw.item_code ?? '—',
|
||||||
|
product_name: raw.product_name ?? raw.item_name ?? '—',
|
||||||
|
sku_property: raw.sku_property ?? raw.spec ?? '',
|
||||||
|
planned_quantity: raw.planned_quantity ?? raw.plan_quantity ?? raw.quantity ?? 0,
|
||||||
|
actual_quantity: raw.actual_quantity ?? raw.received_quantity ?? 0,
|
||||||
|
unit: raw.unit ?? raw.stock_unit ?? '',
|
||||||
|
batch_number: raw.batch_number ?? '',
|
||||||
|
production_date: raw.production_date ?? '',
|
||||||
|
expiry_date: raw.expiry_date ?? '',
|
||||||
|
status: raw.status ?? raw.storage_status ?? raw.detail_status ?? '',
|
||||||
|
statusLabel: raw.status_label ?? '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchReceivingDetail(binding: Record<string, unknown>): Promise<ReceivingDetailItem | null> {
|
||||||
|
const receivingId = binding.receiving_id as number | string
|
||||||
|
if (!receivingId) return null
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await getReceivingDetail({
|
||||||
|
id: Number(receivingId),
|
||||||
|
pagination: { page: 1, pageSize: 500 },
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res?.code !== 200) return null
|
||||||
|
|
||||||
|
const receivingData = (res.data?.receiving ?? {}) as Record<string, unknown>
|
||||||
|
const rawDetails = Array.isArray(receivingData.details)
|
||||||
|
? receivingData.details
|
||||||
|
: Array.isArray(res.data?.list)
|
||||||
|
? res.data.list
|
||||||
|
: Array.isArray(res.data?.details)
|
||||||
|
? res.data.details
|
||||||
|
: []
|
||||||
|
|
||||||
|
const status = String(receivingData.status ?? receivingData.receiving_status ?? '')
|
||||||
|
const statusUpper = status.toUpperCase()
|
||||||
|
|
||||||
|
return {
|
||||||
|
receivingId,
|
||||||
|
receivingNumber: String(
|
||||||
|
receivingData.receiving_number ?? binding.receiving_number ?? `#${receivingId}`
|
||||||
|
),
|
||||||
|
status: statusUpper,
|
||||||
|
statusLabel: receivingStatusOptions[statusUpper] || status || '—',
|
||||||
|
createdAt: receivingData.created_at
|
||||||
|
? formatDateTime(String(receivingData.created_at))
|
||||||
|
: '—',
|
||||||
|
supplierName: String(receivingData.supplier_name ?? ''),
|
||||||
|
expressCode: String(receivingData.express_code ?? receivingData.waybill_code ?? ''),
|
||||||
|
remark: String(receivingData.remark ?? ''),
|
||||||
|
details: rawDetails.map(normalizeDetailRow),
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`获取收货单 ${receivingId} 详情失败:`, e)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadAllDetails() {
|
||||||
|
const bindings = props.receivingBindings
|
||||||
|
if (!Array.isArray(bindings) || bindings.length === 0) {
|
||||||
|
detailList.value = []
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const results = await Promise.all(
|
||||||
|
bindings.map((b) => fetchReceivingDetail(b as Record<string, unknown>))
|
||||||
|
)
|
||||||
|
detailList.value = results.filter(Boolean) as ReceivingDetailItem[]
|
||||||
|
activeTab.value = '0'
|
||||||
|
} catch (e) {
|
||||||
|
console.error('加载收货绑定详情失败:', e)
|
||||||
|
detailList.value = []
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
emit('update:visible', false)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClosed() {
|
||||||
|
detailList.value = []
|
||||||
|
activeTab.value = '0'
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(newVal) => {
|
||||||
|
if (newVal) {
|
||||||
|
void loadAllDetails()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: false },
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.binding-detail-content {
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.receiving-info-section,
|
||||||
|
.product-detail-section {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-left: 4px;
|
||||||
|
border-left: 3px solid var(--el-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-count {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #909399;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 200px;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -78,13 +78,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #column-hasReceiving="{ row }">
|
<template #column-hasReceiving="{ row }">
|
||||||
<el-tag size="small" :type="getEntryHasReceivingTagType(row.hasReceiving, row)">
|
<el-tag
|
||||||
|
size="small"
|
||||||
|
:type="getEntryHasReceivingTagType(row.hasReceiving, row)"
|
||||||
|
:class="{ 'clickable-tag': resolveEntryHasReceiving(row) }"
|
||||||
|
@click.stop="openReceivingBindingsDialog(row)"
|
||||||
|
>
|
||||||
{{ formatEntryHasReceiving(row.hasReceiving, row) }}
|
{{ formatEntryHasReceiving(row.hasReceiving, row) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #column-receivingBindings="{ row }">
|
<template #column-receivingBindings="{ row }">
|
||||||
<span :title="formatReceivingBindingsSummary(row.receivingBindings)">
|
<span
|
||||||
|
class="receiving-bindings-cell"
|
||||||
|
:title="'点击复制收货单号\n' + formatReceivingBindingsSummary(row.receivingBindings)"
|
||||||
|
@click.stop="copyReceivingBindings(row)"
|
||||||
|
>
|
||||||
{{ formatReceivingBindingsSummary(row.receivingBindings) }}
|
{{ formatReceivingBindingsSummary(row.receivingBindings) }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@ -220,6 +229,12 @@
|
|||||||
@success="handleBindDialogSuccess"
|
@success="handleBindDialogSuccess"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 收货绑定详情弹窗 -->
|
||||||
|
<ReceivingBindingDetailDialog
|
||||||
|
v-model:visible="receivingBindingsDialogVisible"
|
||||||
|
:receiving-bindings="receivingBindingsDialogData"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 新建入库单对话框 -->
|
<!-- 新建入库单对话框 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="createDialogVisible"
|
v-model="createDialogVisible"
|
||||||
@ -366,6 +381,7 @@ import {
|
|||||||
formatEntryHasReceiving,
|
formatEntryHasReceiving,
|
||||||
formatReceivingBindingsSummary,
|
formatReceivingBindingsSummary,
|
||||||
getEntryHasReceivingTagType,
|
getEntryHasReceivingTagType,
|
||||||
|
resolveEntryHasReceiving,
|
||||||
translateEntryField,
|
translateEntryField,
|
||||||
buildEntryPrintFormData
|
buildEntryPrintFormData
|
||||||
} from './entry-config'
|
} from './entry-config'
|
||||||
@ -374,6 +390,7 @@ import entrydetail from './component/entrydetail.vue'
|
|||||||
import log from './component/log.vue'
|
import log from './component/log.vue'
|
||||||
import entryoperate from './component/entryoperate.vue'
|
import entryoperate from './component/entryoperate.vue'
|
||||||
import BindReceivingToEntryDialog from './component/BindReceivingToEntryDialog.vue'
|
import BindReceivingToEntryDialog from './component/BindReceivingToEntryDialog.vue'
|
||||||
|
import ReceivingBindingDetailDialog from './component/ReceivingBindingDetailDialog.vue'
|
||||||
import DirectInboundLogs from './component/DirectInboundLogs.vue'
|
import DirectInboundLogs from './component/DirectInboundLogs.vue'
|
||||||
import EntryBindingRelations from './component/EntryBindingRelations.vue'
|
import EntryBindingRelations from './component/EntryBindingRelations.vue'
|
||||||
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
|
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
|
||||||
@ -526,6 +543,10 @@ const selectedRow = computed(() => {
|
|||||||
const bindDialogVisible = ref(false)
|
const bindDialogVisible = ref(false)
|
||||||
const bindTargetRow = ref<any>(null)
|
const bindTargetRow = ref<any>(null)
|
||||||
|
|
||||||
|
// 收货绑定详情弹窗
|
||||||
|
const receivingBindingsDialogVisible = ref(false)
|
||||||
|
const receivingBindingsDialogData = ref<any[]>([])
|
||||||
|
|
||||||
const reviewDialogVisible = ref(false)
|
const reviewDialogVisible = ref(false)
|
||||||
const reviewTargetRow = ref<any>(null)
|
const reviewTargetRow = ref<any>(null)
|
||||||
const reviewSubmitting = ref(false)
|
const reviewSubmitting = ref(false)
|
||||||
@ -562,6 +583,16 @@ function openBindDialog(row: any) {
|
|||||||
bindDialogVisible.value = true
|
bindDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openReceivingBindingsDialog(row: any) {
|
||||||
|
const bindings = row?.receivingBindings
|
||||||
|
if (!Array.isArray(bindings) || bindings.length === 0) {
|
||||||
|
ElMessage.info('该入库单暂无绑定的收货单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
receivingBindingsDialogData.value = bindings
|
||||||
|
receivingBindingsDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
function handleBindDialogClosed() {
|
function handleBindDialogClosed() {
|
||||||
bindTargetRow.value = null
|
bindTargetRow.value = null
|
||||||
}
|
}
|
||||||
@ -724,6 +755,50 @@ async function copySyncMessage(row: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提取收货单号列表(供复制) */
|
||||||
|
function getReceivingNumbers(bindings: unknown): string[] {
|
||||||
|
if (!Array.isArray(bindings) || !bindings.length) return []
|
||||||
|
return bindings
|
||||||
|
.map((item) => {
|
||||||
|
const binding = item as Record<string, unknown>
|
||||||
|
const receiving = (binding.receiving ?? {}) as Record<string, unknown>
|
||||||
|
const number = receiving.receiving_number ?? binding.receiving_number
|
||||||
|
return number ? String(number) : ''
|
||||||
|
})
|
||||||
|
.filter(Boolean)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyReceivingBindings(row: any) {
|
||||||
|
const numbers = getReceivingNumbers(row?.receivingBindings)
|
||||||
|
if (!numbers.length) {
|
||||||
|
ElMessage.warning('该入库单暂无绑定的收货单')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const text = numbers.join('\n')
|
||||||
|
try {
|
||||||
|
if (navigator.clipboard?.writeText) {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
} else {
|
||||||
|
throw new Error('no clipboard api')
|
||||||
|
}
|
||||||
|
ElMessage.success(`已复制 ${numbers.length} 个收货单号`)
|
||||||
|
} catch {
|
||||||
|
try {
|
||||||
|
const ta = document.createElement('textarea')
|
||||||
|
ta.value = text
|
||||||
|
ta.style.position = 'fixed'
|
||||||
|
ta.style.opacity = '0'
|
||||||
|
document.body.appendChild(ta)
|
||||||
|
ta.select()
|
||||||
|
document.execCommand('copy')
|
||||||
|
document.body.removeChild(ta)
|
||||||
|
ElMessage.success(`已复制 ${numbers.length} 个收货单号`)
|
||||||
|
} catch {
|
||||||
|
ElMessage.error('复制失败,请手动选择文本复制')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 先加载筛选相关数据(例如 store options、presetTree),保证 ScanBox options 可用
|
// 先加载筛选相关数据(例如 store options、presetTree),保证 ScanBox options 可用
|
||||||
loadFilterData()
|
loadFilterData()
|
||||||
@ -1208,4 +1283,18 @@ function handleImport() {
|
|||||||
.sync-message--success {
|
.sync-message--success {
|
||||||
color: var(--el-color-success);
|
color: var(--el-color-success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clickable-tag {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.receiving-bindings-cell {
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.receiving-bindings-cell:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: var(--el-color-primary-light-3);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
import {
|
import {
|
||||||
scanWorkflowField,
|
|
||||||
type ToolbarButtonConfig
|
type ToolbarButtonConfig
|
||||||
} from '@/views/order/orderManagement/config/order-common-config'
|
} from '@/views/order/orderManagement/config/order-common-config'
|
||||||
|
|
||||||
/** ScanBox 基础信息分组(对齐待处理订单排版) */
|
/** ScanBox 基础信息分组(对齐待处理订单排版) */
|
||||||
export const RECEIVING_SCAN_BASIC_INFO_GROUP = '基础信息'
|
export const RECEIVING_SCAN_BASIC_INFO_GROUP = '基础信息'
|
||||||
|
|
||||||
|
/** ScanBox 流程状态分组 */
|
||||||
|
export const RECEIVING_SCAN_WORKFLOW_GROUP = '流程状态'
|
||||||
|
|
||||||
|
/** ScanBox 时间分组 */
|
||||||
|
export const RECEIVING_SCAN_TIME_GROUP = '时间'
|
||||||
|
|
||||||
/** 为收货 ScanBox 基础信息字段附加分组标签 */
|
/** 为收货 ScanBox 基础信息字段附加分组标签 */
|
||||||
export type ReceivingScanFieldConfig = Record<string, any> & {
|
export type ReceivingScanFieldConfig = Record<string, any> & {
|
||||||
group: string
|
group: string
|
||||||
@ -19,6 +24,14 @@ export function receivingScanBasicField(field: Record<string, any>): ReceivingSc
|
|||||||
return { ...field, group: RECEIVING_SCAN_BASIC_INFO_GROUP } as ReceivingScanFieldConfig
|
return { ...field, group: RECEIVING_SCAN_BASIC_INFO_GROUP } as ReceivingScanFieldConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function receivingScanWorkflowField(field: Record<string, any>): ReceivingScanFieldConfig {
|
||||||
|
return { ...field, group: RECEIVING_SCAN_WORKFLOW_GROUP } as ReceivingScanFieldConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
export function receivingScanTimeField(field: Record<string, any>): ReceivingScanFieldConfig {
|
||||||
|
return { ...field, group: RECEIVING_SCAN_TIME_GROUP } as ReceivingScanFieldConfig
|
||||||
|
}
|
||||||
|
|
||||||
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
|
/** ScanBox 默认 props(与波次模块 scan-box 侧栏一致) */
|
||||||
export const receivingScanBoxConfig = {
|
export const receivingScanBoxConfig = {
|
||||||
width: '250px',
|
width: '250px',
|
||||||
@ -178,6 +191,7 @@ export const receivingStoreColumns = [
|
|||||||
|
|
||||||
// receiving配置(基础信息在前,流程状态在后;对齐待处理订单 ScanBox 分组)
|
// receiving配置(基础信息在前,流程状态在后;对齐待处理订单 ScanBox 分组)
|
||||||
export const availableFields: ReceivingScanFieldConfig[] = [
|
export const availableFields: ReceivingScanFieldConfig[] = [
|
||||||
|
// ── 基础信息 ──
|
||||||
receivingScanBasicField({
|
receivingScanBasicField({
|
||||||
value: 'receiving_number',
|
value: 'receiving_number',
|
||||||
label: '收货单号',
|
label: '收货单号',
|
||||||
@ -258,34 +272,6 @@ export const availableFields: ReceivingScanFieldConfig[] = [
|
|||||||
operators: numberConfig.operators,
|
operators: numberConfig.operators,
|
||||||
defaultOperator: numberConfig.defaultOperator
|
defaultOperator: numberConfig.defaultOperator
|
||||||
}),
|
}),
|
||||||
receivingScanBasicField({
|
|
||||||
value: 'created_at',
|
|
||||||
label: '创建时间',
|
|
||||||
type: 'daterange',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间'
|
|
||||||
}),
|
|
||||||
receivingScanBasicField({
|
|
||||||
value: 'updated_at',
|
|
||||||
label: '更新时间',
|
|
||||||
type: 'daterange',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间'
|
|
||||||
}),
|
|
||||||
receivingScanBasicField({
|
|
||||||
value: 'receiving_start_time',
|
|
||||||
label: '收货开始时间',
|
|
||||||
type: 'daterange',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间'
|
|
||||||
}),
|
|
||||||
receivingScanBasicField({
|
|
||||||
value: 'receiving_end_time',
|
|
||||||
label: '收货结束时间',
|
|
||||||
type: 'daterange',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间'
|
|
||||||
}),
|
|
||||||
receivingScanBasicField({
|
receivingScanBasicField({
|
||||||
value: 'creator_id',
|
value: 'creator_id',
|
||||||
label: '创建人',
|
label: '创建人',
|
||||||
@ -310,20 +296,21 @@ export const availableFields: ReceivingScanFieldConfig[] = [
|
|||||||
operators: ['eq', 'contains'],
|
operators: ['eq', 'contains'],
|
||||||
defaultOperator: 'eq'
|
defaultOperator: 'eq'
|
||||||
}),
|
}),
|
||||||
// 流程/状态(每项独立分组,对齐待处理订单 scanWorkflowField 排版)
|
|
||||||
scanWorkflowField({
|
// ── 流程状态 ──
|
||||||
|
receivingScanWorkflowField({
|
||||||
value: 'status',
|
value: 'status',
|
||||||
label: '收货状态',
|
label: '收货状态',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: Object.entries(statusConfig).map(([v, c]) => ({ value: v, label: c.text }))
|
options: Object.entries(statusConfig).map(([v, c]) => ({ value: v, label: c.text }))
|
||||||
}) as ReceivingScanFieldConfig,
|
}),
|
||||||
scanWorkflowField({
|
receivingScanWorkflowField({
|
||||||
value: 'detail_status',
|
value: 'detail_status',
|
||||||
label: '匹配状态',
|
label: '匹配状态',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
options: Object.entries(detailStatusConfig).map(([v, c]) => ({ value: v, label: c.text }))
|
options: Object.entries(detailStatusConfig).map(([v, c]) => ({ value: v, label: c.text }))
|
||||||
}) as ReceivingScanFieldConfig,
|
}),
|
||||||
scanWorkflowField({
|
receivingScanWorkflowField({
|
||||||
value: 'storage_status',
|
value: 'storage_status',
|
||||||
label: '入库状态',
|
label: '入库状态',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -333,8 +320,8 @@ export const availableFields: ReceivingScanFieldConfig[] = [
|
|||||||
{ value: 'partial', label: '部分入库' },
|
{ value: 'partial', label: '部分入库' },
|
||||||
{ value: 'all', label: '已入库' }
|
{ value: 'all', label: '已入库' }
|
||||||
]
|
]
|
||||||
}) as ReceivingScanFieldConfig,
|
}),
|
||||||
scanWorkflowField({
|
receivingScanWorkflowField({
|
||||||
value: 'is_review',
|
value: 'is_review',
|
||||||
label: '审核状态',
|
label: '审核状态',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -343,7 +330,37 @@ export const availableFields: ReceivingScanFieldConfig[] = [
|
|||||||
{ value: 0, label: '未审核' },
|
{ value: 0, label: '未审核' },
|
||||||
{ value: 1, label: '已审核' }
|
{ value: 1, label: '已审核' }
|
||||||
]
|
]
|
||||||
}) as ReceivingScanFieldConfig,
|
}),
|
||||||
|
|
||||||
|
// ── 时间 ──
|
||||||
|
receivingScanTimeField({
|
||||||
|
value: 'created_at',
|
||||||
|
label: '创建时间',
|
||||||
|
type: 'daterange',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间'
|
||||||
|
}),
|
||||||
|
receivingScanTimeField({
|
||||||
|
value: 'updated_at',
|
||||||
|
label: '更新时间',
|
||||||
|
type: 'daterange',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间'
|
||||||
|
}),
|
||||||
|
receivingScanTimeField({
|
||||||
|
value: 'receiving_start_time',
|
||||||
|
label: '收货开始时间',
|
||||||
|
type: 'daterange',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间'
|
||||||
|
}),
|
||||||
|
receivingScanTimeField({
|
||||||
|
value: 'receiving_end_time',
|
||||||
|
label: '收货结束时间',
|
||||||
|
type: 'daterange',
|
||||||
|
startPlaceholder: '开始时间',
|
||||||
|
endPlaceholder: '结束时间'
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
export const addReceving = [
|
export const addReceving = [
|
||||||
|
|||||||
@ -17,38 +17,13 @@
|
|||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<div class="toolbar-left">
|
<div class="toolbar-left">
|
||||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
<order-toolbar-button-group
|
||||||
<el-dropdown
|
:buttons="toolbarButtons"
|
||||||
trigger="click"
|
:resolve-disabled="resolveButtonDisabled"
|
||||||
@command="handleExportCommand"
|
:resolve-loading="resolveButtonLoading"
|
||||||
>
|
:resolve-label="resolveButtonLabel"
|
||||||
<el-button
|
:layout-key="toolbarLayoutKey"
|
||||||
size="small"
|
@action="handleToolbarButtonClick"
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
:loading="exportLoading"
|
|
||||||
>
|
|
||||||
导出<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
|
||||||
</el-button>
|
|
||||||
<template #dropdown>
|
|
||||||
<el-dropdown-menu>
|
|
||||||
<el-dropdown-item command="selected" :disabled="!hasSelection">
|
|
||||||
导出选中
|
|
||||||
</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="all" :divided="true">
|
|
||||||
导出全部
|
|
||||||
</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</template>
|
|
||||||
</el-dropdown>
|
|
||||||
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
|
|
||||||
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="toolbar-right">
|
|
||||||
<WarehouseSelect
|
|
||||||
v-model="selectedWarehouseId"
|
|
||||||
@change="handleWarehouseChange"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -82,6 +57,12 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #column-detail_status="{ row }">
|
||||||
|
<el-tag v-if="row.detail_status" :type="detailStatusTagType(row.detail_status)" size="small">
|
||||||
|
{{ detailStatusText(row.detail_status) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #column-storage_status="{ row }">
|
<template #column-storage_status="{ row }">
|
||||||
<el-tag v-if="row.storage_status" :type="storageStatusTagType(row.storage_status)" size="small">
|
<el-tag v-if="row.storage_status" :type="storageStatusTagType(row.storage_status)" size="small">
|
||||||
{{ storageStatusText(row.storage_status) }}
|
{{ storageStatusText(row.storage_status) }}
|
||||||
@ -165,11 +146,12 @@
|
|||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { ArrowDown } from '@element-plus/icons-vue'
|
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
||||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||||
|
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||||
|
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||||
import * as indexApi from '@/api/index/index'
|
import * as indexApi from '@/api/index/index'
|
||||||
import * as receivingApi from '@/api/storage_receiving/receiving'
|
import * as receivingApi from '@/api/storage_receiving/receiving'
|
||||||
@ -177,6 +159,7 @@ import {
|
|||||||
receivingStoreColumns,
|
receivingStoreColumns,
|
||||||
availableFields,
|
availableFields,
|
||||||
statusConfig,
|
statusConfig,
|
||||||
|
detailStatusConfig,
|
||||||
storageStatusConfig,
|
storageStatusConfig,
|
||||||
deliveryMethodConfig,
|
deliveryMethodConfig,
|
||||||
loadingMethodConfig,
|
loadingMethodConfig,
|
||||||
@ -222,11 +205,104 @@ function openColumnConfigPanel() {
|
|||||||
upperTable.value?.openColumnConfig?.()
|
upperTable.value?.openColumnConfig?.()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 货主侧:移除货主筛选项
|
// ─── 工具栏按钮配置 ────────────────────────────────────────────────────────
|
||||||
const availableFieldsRef = reactive(
|
const toolbarButtons = computed<ToolbarButtonConfig[]>(() => [
|
||||||
JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
|
{
|
||||||
|
key: 'refresh',
|
||||||
|
label: '刷新',
|
||||||
|
type: 'primary',
|
||||||
|
size: 'small',
|
||||||
|
action: 'handleRefresh'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'export',
|
||||||
|
label: '导出',
|
||||||
|
size: 'small',
|
||||||
|
plain: true,
|
||||||
|
loadingKey: 'exportLoading',
|
||||||
|
action: 'handleExportAll',
|
||||||
|
buttonType: 'dropdown',
|
||||||
|
dropdownOptions: [
|
||||||
|
{ label: '导出选中', action: 'handleExportSelected' },
|
||||||
|
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'columnConfig',
|
||||||
|
label: '字段设置',
|
||||||
|
size: 'small',
|
||||||
|
action: 'openColumnConfigPanel'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'toggleDetail',
|
||||||
|
label: '显示详情',
|
||||||
|
dynamicLabelKey: 'detailToggleLabel',
|
||||||
|
size: 'small',
|
||||||
|
action: 'toggleDetailVisible'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const buttonLoadingMap = computed(() => ({
|
||||||
|
exportLoading: exportLoading.value
|
||||||
|
}))
|
||||||
|
|
||||||
|
const buttonLabelMap = computed(() => ({
|
||||||
|
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||||||
|
}))
|
||||||
|
|
||||||
|
const toolbarLayoutKey = computed(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
loading: buttonLoadingMap.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) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
|
||||||
|
if (!dynamicLabelKey) return defaultLabel
|
||||||
|
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolbarActionMap: Record<string, () => void> = {
|
||||||
|
handleRefresh: () => loadData(),
|
||||||
|
handleExportAll: () => handleExportAll(),
|
||||||
|
handleExportSelected: () => handleExportSelected(),
|
||||||
|
openColumnConfigPanel: () => openColumnConfigPanel(),
|
||||||
|
toggleDetailVisible: () => toggleDetailVisible()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||||
|
const handler = toolbarActionMap[action]
|
||||||
|
if (!handler) return
|
||||||
|
handler()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 货主侧:移除货主筛选项,添加仓库筛选(插入到第一个基础信息分类中)
|
||||||
|
const availableFieldsRef = reactive((() => {
|
||||||
|
const fields = JSON.parse(JSON.stringify(availableFields)).filter((f: any) => f.value !== 'store_id')
|
||||||
|
// 在收货单号之后插入全部仓库
|
||||||
|
const idx = fields.findIndex((f: any) => f.value === 'receiving_number')
|
||||||
|
if (idx !== -1) {
|
||||||
|
fields.splice(idx + 1, 0, {
|
||||||
|
label: '全部仓库',
|
||||||
|
value: 'warehouse_id',
|
||||||
|
type: 'custom',
|
||||||
|
component: WarehouseSelect,
|
||||||
|
props: { width: '100%' },
|
||||||
|
group: '基础信息'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return fields
|
||||||
|
})())
|
||||||
|
|
||||||
const activeTab = ref('details')
|
const activeTab = ref('details')
|
||||||
|
|
||||||
const list = ref<any[]>([])
|
const list = ref<any[]>([])
|
||||||
@ -263,9 +339,6 @@ const columns = ref(receivingStoreColumns)
|
|||||||
const selectedReceivingId = ref<number | string | null>(null)
|
const selectedReceivingId = ref<number | string | null>(null)
|
||||||
const currentSort = reactive({ prop: '', order: '' })
|
const currentSort = reactive({ prop: '', order: '' })
|
||||||
|
|
||||||
// 仓库选择
|
|
||||||
const selectedWarehouseId = ref<string | number | null>(null)
|
|
||||||
|
|
||||||
const componentMap: Record<string, any> = {
|
const componentMap: Record<string, any> = {
|
||||||
details: Details,
|
details: Details,
|
||||||
logs: Logs,
|
logs: Logs,
|
||||||
@ -286,6 +359,12 @@ function statusTagType(s: string) {
|
|||||||
function statusText(s: string) {
|
function statusText(s: string) {
|
||||||
return (statusConfig as any)[s]?.text || s || '--'
|
return (statusConfig as any)[s]?.text || s || '--'
|
||||||
}
|
}
|
||||||
|
function detailStatusTagType(s: string) {
|
||||||
|
return (detailStatusConfig as any)[s]?.tagType || 'info'
|
||||||
|
}
|
||||||
|
function detailStatusText(s: string) {
|
||||||
|
return (detailStatusConfig as any)[s]?.text || s || '--'
|
||||||
|
}
|
||||||
function storageStatusTagType(s: string) {
|
function storageStatusTagType(s: string) {
|
||||||
return (storageStatusConfig as any)[s]?.tagType || 'info'
|
return (storageStatusConfig as any)[s]?.tagType || 'info'
|
||||||
}
|
}
|
||||||
@ -350,11 +429,6 @@ async function loadData() {
|
|||||||
try {
|
try {
|
||||||
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
|
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
|
||||||
|
|
||||||
// 仓库筛选
|
|
||||||
if (selectedWarehouseId.value) {
|
|
||||||
where.warehouse_id = { operator: 'eq', value: selectedWarehouseId.value, type: 'number' }
|
|
||||||
}
|
|
||||||
|
|
||||||
const params: any = {
|
const params: any = {
|
||||||
pagination: {
|
pagination: {
|
||||||
page: pagination.currentPage,
|
page: pagination.currentPage,
|
||||||
@ -432,11 +506,6 @@ function handleConditionReset() {
|
|||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleWarehouseChange() {
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleRowClick(row: any) {
|
function handleRowClick(row: any) {
|
||||||
selectedReceivingId.value = row?.id || null
|
selectedReceivingId.value = row?.id || null
|
||||||
}
|
}
|
||||||
@ -454,9 +523,6 @@ function handlePageSizeChange(size: number) {
|
|||||||
|
|
||||||
function buildExportPayload() {
|
function buildExportPayload() {
|
||||||
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
|
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
|
||||||
if (selectedWarehouseId.value) {
|
|
||||||
where.warehouse_id = { operator: 'eq', value: selectedWarehouseId.value, type: 'number' }
|
|
||||||
}
|
|
||||||
const payload: any = { where }
|
const payload: any = { where }
|
||||||
if (currentSort.prop) {
|
if (currentSort.prop) {
|
||||||
payload.sort = {
|
payload.sort = {
|
||||||
@ -474,9 +540,6 @@ function buildExportSelectedPayload() {
|
|||||||
id: { operator: 'in', value: ids }
|
id: { operator: 'in', value: ids }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selectedWarehouseId.value) {
|
|
||||||
payload.where.warehouse_id = { operator: 'eq', value: selectedWarehouseId.value, type: 'number' }
|
|
||||||
}
|
|
||||||
return payload
|
return payload
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,14 +554,6 @@ async function handleExportSelected() {
|
|||||||
}
|
}
|
||||||
await submitExportTask(buildExportSelectedPayload())
|
await submitExportTask(buildExportSelectedPayload())
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleExportCommand(command: string) {
|
|
||||||
if (command === 'selected') {
|
|
||||||
handleExportSelected()
|
|
||||||
} else if (command === 'all') {
|
|
||||||
handleExportAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@ -165,10 +165,8 @@ function normalizeReportEndDateParam(value: unknown): string | undefined {
|
|||||||
|
|
||||||
/** ScanBox 筛选字段分组(库存报表模块专用) */
|
/** ScanBox 筛选字段分组(库存报表模块专用) */
|
||||||
export const REPORT_SCAN_FIELD_GROUPS = {
|
export const REPORT_SCAN_FIELD_GROUPS = {
|
||||||
time: '统计配置',
|
basic: '基础信息',
|
||||||
owner: '货主信息',
|
time: '时间筛选',
|
||||||
options: '统计选项',
|
|
||||||
keyword: '关键字搜索',
|
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
type ReportScanFieldGroupKey = keyof typeof REPORT_SCAN_FIELD_GROUPS
|
type ReportScanFieldGroupKey = keyof typeof REPORT_SCAN_FIELD_GROUPS
|
||||||
@ -189,6 +187,12 @@ export const reportScanBoxConfig = {
|
|||||||
|
|
||||||
/** ScanBox 侧栏可用字段(与 storage.report.search 的 where 对应) */
|
/** ScanBox 侧栏可用字段(与 storage.report.search 的 where 对应) */
|
||||||
export const reportScanBoxAvailableFields = [
|
export const reportScanBoxAvailableFields = [
|
||||||
|
reportScanField('basic', {
|
||||||
|
value: 'keyword',
|
||||||
|
label: '关键字',
|
||||||
|
type: 'text',
|
||||||
|
placeholder: '搜索商品名称/编码/条码'
|
||||||
|
}),
|
||||||
reportScanField('time', {
|
reportScanField('time', {
|
||||||
value: 'report_period',
|
value: 'report_period',
|
||||||
label: '统计时间',
|
label: '统计时间',
|
||||||
@ -196,7 +200,7 @@ export const reportScanBoxAvailableFields = [
|
|||||||
startPlaceholder: '开始日期',
|
startPlaceholder: '开始日期',
|
||||||
endPlaceholder: '结束日期'
|
endPlaceholder: '结束日期'
|
||||||
}),
|
}),
|
||||||
reportScanField('owner', {
|
reportScanField('basic', {
|
||||||
value: 'store_id',
|
value: 'store_id',
|
||||||
label: '货主',
|
label: '货主',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@ -205,18 +209,12 @@ export const reportScanBoxAvailableFields = [
|
|||||||
placeholder: '请选择货主',
|
placeholder: '请选择货主',
|
||||||
options: [] as { label: string; value: number }[]
|
options: [] as { label: string; value: number }[]
|
||||||
}),
|
}),
|
||||||
reportScanField('options', {
|
reportScanField('basic', {
|
||||||
value: 'by_space',
|
value: 'by_space',
|
||||||
label: '按库位统计',
|
label: '按库位统计',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
placeholder: '开启后按商品+库位+货主返回;关闭则按商品+货主聚合'
|
placeholder: '开启后按商品+库位+货主返回;关闭则按商品+货主聚合'
|
||||||
}),
|
}),
|
||||||
reportScanField('keyword', {
|
|
||||||
value: 'keyword',
|
|
||||||
label: '关键字',
|
|
||||||
type: 'text',
|
|
||||||
placeholder: '搜索商品名称/编码/条码'
|
|
||||||
})
|
|
||||||
]
|
]
|
||||||
|
|
||||||
/** 将 ScanBox 条件转为接口扁平 where;无有效条件时返回 {} */
|
/** 将 ScanBox 条件转为接口扁平 where;无有效条件时返回 {} */
|
||||||
@ -284,5 +282,11 @@ export function normalizeScanConditionToReportWhere(condition: any): Record<stri
|
|||||||
where.keyword = String(keyword).trim()
|
where.keyword = String(keyword).trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 仓库筛选
|
||||||
|
const warehouseId = conds.warehouse_id?.value ?? conds.warehouse_id
|
||||||
|
if (warehouseId != null && warehouseId !== '' && warehouseId !== undefined) {
|
||||||
|
where.warehouse_id = warehouseId
|
||||||
|
}
|
||||||
|
|
||||||
return where
|
return where
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,25 +26,6 @@
|
|||||||
<el-tag size="small" effect="plain">出库合计 {{ formatNumber(sumOutbound) }}</el-tag>
|
<el-tag size="small" effect="plain">出库合计 {{ formatNumber(sumOutbound) }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-right">
|
|
||||||
<WarehouseSelect
|
|
||||||
v-model="selectedWarehouseId"
|
|
||||||
@change="handleWarehouseChange"
|
|
||||||
/>
|
|
||||||
<el-input
|
|
||||||
v-model="keyword"
|
|
||||||
placeholder="搜索商品名称/编码/条码"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
style="width: 240px; margin-left: 8px"
|
|
||||||
@keyup.enter="handleKeywordSearch"
|
|
||||||
@clear="handleKeywordSearch"
|
|
||||||
>
|
|
||||||
<template #prefix>
|
|
||||||
<el-icon><Search /></el-icon>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="split-stack" ref="splitStackRef">
|
<div class="split-stack" ref="splitStackRef">
|
||||||
@ -124,7 +105,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, reactive, ref } from 'vue'
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { Search } from '@element-plus/icons-vue'
|
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
@ -158,9 +138,24 @@ const scanBox = ref<any>(null)
|
|||||||
const upperTable = ref<any>(null)
|
const upperTable = ref<any>(null)
|
||||||
|
|
||||||
const presetTree = ref<any[]>([])
|
const presetTree = ref<any[]>([])
|
||||||
const availableFieldsRef = reactive(
|
const availableFieldsRef = reactive((() => {
|
||||||
JSON.parse(JSON.stringify(reportScanBoxAvailableFields)).filter((f: any) => f.value !== 'store_id' && f.value !== 'by_space')
|
const fields = JSON.parse(JSON.stringify(reportScanBoxAvailableFields)).filter(
|
||||||
|
(f: any) => f.value !== 'store_id' && f.value !== 'by_space'
|
||||||
)
|
)
|
||||||
|
// 在关键字之后插入全部仓库(基础信息分组)
|
||||||
|
const idx = fields.findIndex((f: any) => f.value === 'keyword')
|
||||||
|
if (idx !== -1) {
|
||||||
|
fields.splice(idx + 1, 0, {
|
||||||
|
label: '全部仓库',
|
||||||
|
value: 'warehouse_id',
|
||||||
|
type: 'custom',
|
||||||
|
component: WarehouseSelect,
|
||||||
|
props: { width: '100%' },
|
||||||
|
group: '基础信息'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return fields
|
||||||
|
})())
|
||||||
|
|
||||||
const settingsStore = useSettingsStore()
|
const settingsStore = useSettingsStore()
|
||||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||||||
@ -235,8 +230,6 @@ const currentSort = reactive<{ prop: string; order: '' | 'ascending' | 'descendi
|
|||||||
|
|
||||||
const selectedRid = ref<string | null>(null)
|
const selectedRid = ref<string | null>(null)
|
||||||
const currentConditionRaw = ref<any>({})
|
const currentConditionRaw = ref<any>({})
|
||||||
const selectedWarehouseId = ref<string | number | null>(null)
|
|
||||||
const keyword = ref('')
|
|
||||||
|
|
||||||
const selectedRow = computed(() => fullList.value.find((r) => r.__rid === selectedRid.value) || null)
|
const selectedRow = computed(() => fullList.value.find((r) => r.__rid === selectedRid.value) || null)
|
||||||
|
|
||||||
@ -320,13 +313,6 @@ function buildSortPayload(): StockReportSearchBody['sort'] | undefined {
|
|||||||
|
|
||||||
function buildReportQueryPayload(): StockReportSearchBody {
|
function buildReportQueryPayload(): StockReportSearchBody {
|
||||||
const where = normalizeScanConditionToReportWhere(currentConditionRaw.value)
|
const where = normalizeScanConditionToReportWhere(currentConditionRaw.value)
|
||||||
if (selectedWarehouseId.value) {
|
|
||||||
where.warehouse_id = selectedWarehouseId.value
|
|
||||||
}
|
|
||||||
// 关键字搜索
|
|
||||||
if (keyword.value.trim()) {
|
|
||||||
where.keyword = keyword.value.trim()
|
|
||||||
}
|
|
||||||
const sort = buildSortPayload()
|
const sort = buildSortPayload()
|
||||||
const body: StockReportSearchBody = {}
|
const body: StockReportSearchBody = {}
|
||||||
if (Object.keys(where).length > 0) {
|
if (Object.keys(where).length > 0) {
|
||||||
@ -381,26 +367,14 @@ function handleConditionChange(condition: any) {
|
|||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleWarehouseChange() {
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleConditionClear() {
|
function handleConditionClear() {
|
||||||
currentConditionRaw.value = {}
|
currentConditionRaw.value = {}
|
||||||
keyword.value = ''
|
|
||||||
pagination.currentPage = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleKeywordSearch() {
|
|
||||||
pagination.currentPage = 1
|
pagination.currentPage = 1
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleConditionReset() {
|
function handleConditionReset() {
|
||||||
currentConditionRaw.value = {}
|
currentConditionRaw.value = {}
|
||||||
keyword.value = ''
|
|
||||||
pagination.currentPage = 1
|
pagination.currentPage = 1
|
||||||
if (scanBox.value?.reset) {
|
if (scanBox.value?.reset) {
|
||||||
scanBox.value.reset()
|
scanBox.value.reset()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user