4月10号

This commit is contained in:
yin 2026-04-10 18:17:39 +08:00
parent 69e6a26f03
commit 59474b0394
24 changed files with 512 additions and 491 deletions

Binary file not shown.

View File

@ -70,6 +70,7 @@ export function batchCancelReceiving(data: any): Promise<any> {
// 发送打印任务
// data: { stationId, printerName, templateId, businessType, businessId, printData }
// 未使用
export function sendPrint(data: any) {
return request({
url: '/system',
@ -112,110 +113,105 @@ export function createReceiving(data: any): Promise<any> {
// })
// }
// PDA项目使用,本项目不使用
// export function addItem(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.addItem',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function removeItem(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.removeItem',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function saveReceiving(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.saveReceiving',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function getReceiving(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.get',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function addDetail(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.addDetail',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function deleteDetail(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.deleteDetail',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function detailChange(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.detailChange',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// export function cancelReceivingDetail(data: any): Promise<any> {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.receiving.cancel',
// v,
// timestamp: new Date().getTime()
// },
// data: data
// })
// }
// ------
export function addItem(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.addItem',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function removeItem(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.removeItem',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function saveReceiving(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.saveReceiving',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function getReceiving(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.get',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function addDetail(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.addDetail',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function deleteDetail(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.deleteDetail',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function detailChange(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.detailChange',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function cancelReceivingDetail(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.receiving.cancel',
v,
timestamp: new Date().getTime()
},
data: data
})
}
export function completeReceiving(data: any): Promise<any> {
return request({
@ -243,7 +239,6 @@ export function bindReceivingStore(data: any): Promise<any> {
data: data
})
}
export function bindDetailProduct(data: any): Promise<any> {
return request({
url: '/system',

View File

@ -55,5 +55,6 @@ const handleSetLanguage = (lang: string) => {
}
.lang-text {
font-size: 14px;
color: aliceblue;
}
</style>

View File

@ -223,7 +223,7 @@
v-for="option in field.options"
:key="option.value"
:label="option.label"
:value="option.value"
:value="option.value == null ? '' : option.value"
/>
</el-select>
</div>
@ -236,7 +236,7 @@
<el-tag v-if="field.required" size="small" type="danger">必填</el-tag>
</div>
<div class="field-control">
<el-select
<el-select
v-model="customConditions[field.value].value"
multiple
:placeholder="field.placeholder || `请选择${field.label}`"
@ -249,7 +249,7 @@
v-for="option in field.options"
:key="option.value"
:label="option.label"
:value="option.value"
:value="option.value == null ? '' : option.value"
/>
</el-select>
</div>
@ -269,9 +269,9 @@
style="width: 100%;"
@change="handleCustomChange"
>
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
<el-option label="全部" :value="null" />
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
<el-option label="全部" :value="''" />
</el-select>
</div>
</div>
@ -593,7 +593,7 @@ function normalizeTextValue(field: any) {
}
}
function initCustomConditions(fields: any[]) {
function initCustomConditions(fields: any[], isSilent = false) {
fields.forEach(field => {
let defaultValue: any = undefined
let defaultOperator = ''
@ -603,8 +603,8 @@ function initCustomConditions(fields: any[]) {
case 'multiple':
defaultValue = field.multiple ? [] : undefined
break
case 'boolean':
defaultValue = null
case 'boolean':
defaultValue = ''
break
case 'daterange':
defaultValue = []
@ -640,6 +640,12 @@ function initCustomConditions(fields: any[]) {
customConditions[field.value].valueMax = undefined
}
})
if (isSilent) return
if (props.autoSubmit) {
handleCustomChange()
}
}
function loadInitialConditions(conditions: any) {
@ -788,14 +794,11 @@ function filterNode(value: string, data: any) {
}
function handleReset() {
initCustomConditions(props.availableFields)
initCustomConditions(props.availableFields, true)
activeCondition.value = null
presetSearchText.value = ''
filterPresetTree('')
emit('reset')
if (props.autoSubmit) {
buildAndEmitCustomCondition()
}
}
function handleSubmit() {

View File

@ -125,7 +125,7 @@
:total="total"
:layout="paginationLayout"
:background="paginationBackground"
:small="tableSize === 'small'"
:size="tableSize"
@size-change="handlePageSizeChange"
@current-change="handlePageChange"
/>

View File

@ -278,6 +278,11 @@ onMounted(() => {
cursor: pointer;
transition: background .3s;
.day-text,
.validity-text {
color: aliceblue;
}
&:hover {
background: rgba(0, 0, 0, .025)
}
@ -304,6 +309,7 @@ onMounted(() => {
display: flex;
align-items: center;
.menu-text {
color: aliceblue;
margin-left: 4px;
}
}
@ -316,6 +322,7 @@ onMounted(() => {
position: relative;
.user-name {
color: aliceblue;
margin-right: 8px;
font-weight: 500;
}

View File

@ -22,7 +22,7 @@
</template>
<script setup lang="ts">
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue'
import { ref, computed, onMounted, onBeforeUnmount, watch, markRaw } from 'vue'
import { useUserStore } from '@/stores/modules/user'
import WelcomCard from './components/WelcomCard.vue'
import dayjs from 'dayjs'
@ -138,7 +138,7 @@ const initModules = async () => {
if (moduleComponents[config.component]) {
modules.push({
...config,
component: moduleComponents[config.component]
component: markRaw(moduleComponents[config.component])
})
}
} catch (error) {

View File

@ -161,12 +161,14 @@
<div class="detail-container">
<keep-alive>
<component
:is="activeComponent"
:id="currentStockId"
type="stock"
@refresh="handleRefresh"
/>
<div class="detail-component-wrapper">
<component
:is="activeComponent"
:id="currentStockId"
type="stock"
@refresh="handleRefresh"
/>
</div>
</keep-alive>
</div>
</div>
@ -177,8 +179,7 @@
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</div>
</div>
</div>
<!-- 抽屉:添加 -->
<el-drawer v-model="drawer" :with-header="false" direction="rtl" size="800px">
@ -195,6 +196,7 @@
<el-drawer v-model="showRecycle" :with-header="false" direction="rtl" size="800px">
<Recycle :drawer-visible="showRecycle" />
</el-drawer>
</div>
</template>
<script setup lang="ts">

View File

@ -5,6 +5,7 @@
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:initial-conditions="initialConditions"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@ -141,6 +142,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
@ -161,6 +163,15 @@ import entryoperate from './component/entryoperate.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const route = useRoute()
// 用于将初始条件传入 ScanBox(用于根据 URL 参数填充)
const initialConditions = ref<any>(null)
// 当前已规范化的 where 条件(优先使用)
const currentCondition = ref<any>(null)
const currentConditionRaw = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
const addEntryFieldsRef = reactive(JSON.parse(JSON.stringify(addEntryFields)))
@ -223,31 +234,68 @@ function formatTime(val: any) {
* - 是简单值(string/number/array):包装为 { operator: 'eq', value: val }
* - 空或 undefined:忽略该字段
*/
function normalizeWhere(conds: any) {
if (!conds || typeof conds !== 'object') return {}
const where: any = {}
Object.keys(conds).forEach(key => {
const c = conds[key]
if (c === undefined) return
// 将 scan-box 返回的条件标准化为后端推荐结构:{ operator, value, type }
function normalizeToWhere(condition: any) {
if (!condition) return {}
// 已经是标准对象
if (c && typeof c === 'object' && ('operator' in c || 'value' in c || 'type' in c)) {
// 保持 operator/value/type 字段,若缺失则做适度默认
where[key] = {
operator: c.operator || (Array.isArray(c.value) ? 'in' : 'eq'),
value: c.value,
type: c.type || undefined
// 如果是字符串或简单值,默认映射为单号模糊查询
if (typeof condition === 'string' || typeof condition === 'number') {
return { entry_order_code: { operator: 'like', value: condition, type: 'text' } }
}
const getFieldConfig = (key: string) => {
return availableFields.find((f: any) => f.value === key)
}
const mapType = (type: string, value: any) => {
if (type === 'daterange' || Array.isArray(value)) return 'daterange'
if (type === 'number' || typeof value === 'number') return 'number'
if (type === 'boolean' || typeof value === 'boolean') return 'boolean'
return 'text'
}
const processConditionValue = (k: string, c: any) => {
const config = getFieldConfig(k)
const fieldType = config?.type || 'text'
if (c && typeof c === 'object' && !Array.isArray(c)) {
if ('operator' in c || 'value' in c || 'type' in c) {
return {
operator: c.operator || (Array.isArray(c.value) ? 'in' : (fieldType === 'daterange' ? 'between' : 'eq')),
value: c.value,
type: c.type || mapType(fieldType, c.value)
}
}
return
}
// 简单类型,直接包装为 eq(数组则为 in)
where[key] = {
operator: Array.isArray(c) ? 'in' : 'eq',
value: c
}
})
return where
if (c === null || c === undefined || c === '' || (Array.isArray(c) && c.length === 0)) return null
const simpleOp = fieldType === 'daterange' ? 'between' : 'eq'
const simpleType = mapType(fieldType, c)
return { operator: simpleOp, value: c, type: simpleType }
}
// 如果来自 ScanBox 的 preset(包含 conditions)
if (condition.conditions && typeof condition.conditions === 'object') {
const where: any = {}
Object.keys(condition.conditions).forEach(k => {
const result = processConditionValue(k, condition.conditions[k])
if (result) where[k] = result
})
return where
}
// 普通自定义条件对象
if (typeof condition === 'object') {
const where: any = {}
Object.keys(condition).forEach(k => {
const result = processConditionValue(k, condition[k])
if (result) where[k] = result
})
return where
}
return {}
}
function getStatusType(status: string) {
@ -259,7 +307,7 @@ function getStatusType(status: string) {
'COMPLETED': 'success',
'CANCELLED': 'danger'
}
return map[status] || ''
return map[status] || undefined
}
function getSyncStatusType(status: string) {
@ -269,12 +317,26 @@ function getSyncStatusType(status: string) {
'SUCCESS': 'success',
'FAIL': 'danger'
}
return map[status] || ''
return map[status] || undefined
}
onMounted(() => {
loadData()
// 先加载筛选相关数据(例如 store options、presetTree),保证 ScanBox options 可用
loadFilterData()
// 如果 URL 带有 id 参数,则构建初始筛选条件并应用
const idParam = route.query.id || route.query.entry_order_code || route.query.q
const id = Array.isArray(idParam) ? idParam[0] : idParam
if (id) {
// 设置 ScanBox 的初始条件以在 UI 中显示
initialConditions.value = { conditions: { entry_order_code: { operator: 'like', value: id, type: 'text' } } }
// 直接使用包含 operator 的完整条件触发搜索(避免丢失 operator)
handleConditionChange(initialConditions.value)
} else {
// 无 URL 参数时正常加载列表
loadData()
}
})
async function loadData() {
@ -282,8 +344,8 @@ async function loadData() {
loading.value = true
const start = Date.now()
try {
const conditions = scanBox.value?.getConditions() || {}
const where = normalizeWhere(conditions)
// 优先使用由 ScanBox 提交并经过规范化的条件(包含 operator 等信息)
const where = currentCondition.value || normalizeToWhere(scanBox.value?.getConditions?.() || {})
const params = {
pagination: {
page: pagination.currentPage,
@ -442,6 +504,12 @@ async function loadFilterData() {
}
function handleConditionChange(condition: any) {
// 保留原始条件供调试或后续使用
currentConditionRaw.value = condition
// 将条件规范化为后端期望的 where 结构
currentCondition.value = normalizeToWhere(condition)
pagination.currentPage = 1
loadData()
}
@ -454,14 +522,18 @@ function handleSortChange({ prop, order }: any) {
}
const handleConditionClear = () => {
currentCondition.value = null
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
currentCondition.value = null // 清空已保存的条件
pagination.currentPage = 1
if (scanBox.value?.reset) {
scanBox.value.reset()
} else if (scanBox.value?.clear) {
scanBox.value.clear()
}
loadData()
}

View File

@ -93,7 +93,7 @@
<!-- 底部操作按钮 -->
<div class="bottom">
<el-button-group class="toolbar-btn-group">
<el-button type="primary" icon="Check" @click="handleSave" :loading="saveLoading">
<el-button type="primary" icon="Check" disabled :loading="saveLoading">
保存
</el-button>
<el-button type="danger" icon="Refresh" @click="handleReset">

View File

@ -739,7 +739,7 @@ onUnmounted(() => {
background: #fff;
border: 1px solid #ebeef5;
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
/* border-radius: 4px; */
display: flex;
flex-direction: column;
}

View File

@ -9,11 +9,11 @@
<div class="toolbar">
<div class="toolbar-left">
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
<el-button size="small" @click="handleCreateReceiving">新建收货单</el-button>
<el-button type="success" size="small" icon="el-icon-delete" @click="confirmcomplete" title="入库单入库"
<!-- <el-button size="small" @click="handleCreateReceiving">新建收货单</el-button> -->
<!-- <el-button type="success" size="small" icon="el-icon-delete" @click="confirmcomplete" title="入库单入库"
:disabled="!hasSelection" class="toolbar-btn">
入库单入库
</el-button>
</el-button> -->
<el-button type="primary" size="small" icon="el-icon-delete" @click="confirmcomplete" title="一键入库"
:disabled="!hasSelection" class="toolbar-btn">
一键入库
@ -215,7 +215,11 @@
<el-form :model="createForm" label-width="100px" size="small">
<el-row :gutter="20">
<el-col v-for="field in addReceivingFieldsRef" :key="field.prop" :span="field.type === 'textarea' ? 24 : 12">
<el-form-item :label="field.label">
<el-form-item>
<template #label>
<span>{{ field.label }}</span>
<span v-if="['delivery_method','loading_method'].includes(field.prop)" style="color: #f56c6c; margin-left:6px">*</span>
</template>
<el-select v-if="field.type === 'select'" v-model="createForm[field.prop]"
:placeholder="'请选择' + field.label" style="width: 100%" :filterable="field.filterable">
<el-option v-for="opt in field.options" :key="opt.value" :label="opt.label" :value="opt.value" />
@ -631,6 +635,8 @@ const createForm = reactive<any>({
loading_method: '',
license_plate: '',
tracking_number: '',
total_boxes: '',
total_pallets: '',
remark: ''
})
@ -639,11 +645,14 @@ function handleCreateDialogClosed() {
}
async function submitCreateReceiving() {
// 表单校验:除备注外必须填写
const requiredFields = addReceivingFieldsRef.filter((f: { prop: string }) => f.prop !== 'remark')
for (const field of requiredFields) {
if (!createForm[field.prop]) {
ElMessage.warning(`请填写${field.label}`)
// 仅校验指定的必填字段:到货方式与装卸方式
const requiredProps = ['delivery_method', 'loading_method']
for (const prop of requiredProps) {
const val = createForm[prop]
const field = addReceivingFieldsRef.find((f: any) => f.prop === prop)
const label = field ? field.label : prop
if (val === null || val === undefined || val === '') {
ElMessage.warning(`请填写${label}`)
return
}
}

View File

@ -42,6 +42,24 @@ export const loadingMethodConfig: any = {
without_pallet: { text: '不带托盘', tagType: 'info' }
}
// 收货单号的枚举配置(类似 statusConfig),用于在筛选中加载对应选项
export const receivingConfig: any = {
eq: { text: '等于' },
ne: { text: '不等于' },
contains: { text: '包含' },
starts_with: { text: '开头为' },
like: { text: '模糊匹配' },
// 保留全部项定义以便未来扩展,但 availableFields 只会启用上面五个
ends_with: { text: '结尾为' },
// regex: { text: '正则匹配' }
}
// 数值字段通用配置,只开启常用的比较/范围操作
export const numberConfig: any = {
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le'],
defaultOperator: 'ge'
}
// 时间格式化函数
export function formatDateTime(dateStr: string): string {
if (!dateStr) return '--'
@ -82,6 +100,7 @@ export const receivingColumns = [
{ prop: 'total_pallets', label: '总托盘数', width: '90', align: 'right', sortable: true },
{ prop: 'license_plate', label: '车牌号', width: '100' },
{ prop: 'tracking_number', label: '物流单号', width: '120' },
{ prop: 'video_device_id', label: '录像设备ID', width: '140' },
{ prop: 'delivery_method', label: '来货方式', width: '90', align: 'center' },
{ prop: 'loading_method', label: '装卸方式', width: '100', align: 'center' },
{ prop: 'creator_name', label: '创建人', width: '100' },
@ -95,7 +114,15 @@ export const receivingColumns = [
// receiving配置
export const availableFields = [
{ value: 'receiving_number', label: '收货单号', type: 'text' },
{
value: 'receiving_number',
label: '收货单号',
type: 'text',
placeholder: '请输入收货单号',
// 可用操作符(后端 operator 名称):等于、不等于、包含、开头为、模糊匹配
operators: ['eq', 'ne', 'contains', 'starts_with', 'like'],
defaultOperator: 'contains'
},
{ value: 'status', label: '收货状态', type: 'select', options: Object.entries(statusConfig).map(([v, c]) => ({ value: v, label: c.text })) },
{ value: 'detail_status', label: '匹配状态', type: 'select', options: Object.entries(detailStatusConfig).map(([v, c]) => ({ value: v, label: c.text })) },
{ value: 'storage_status', label: '入库状态', type: 'select', options: Object.entries(storageStatusConfig).map(([v, c]) => ({ value: v, label: c.text })) },
@ -131,32 +158,32 @@ export const availableFields = [
label: '商品种类',
type: 'number',
placeholder: '请输入商品种类数',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between', 'notbetween', 'in', 'notin', 'isnull', 'isnotnull'],
defaultOperator: 'ge'
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
},
{
value: 'total_quantity',
label: '总数量',
type: 'number',
placeholder: '请输入总数量',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between', 'notbetween', 'in', 'notin', 'isnull', 'isnotnull'],
defaultOperator: 'ge'
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
},
{
value: 'total_boxes',
label: '总箱数',
type: 'number',
placeholder: '请输入总箱数',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between', 'notbetween', 'in', 'notin', 'isnull', 'isnotnull'],
defaultOperator: 'ge'
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
},
{
value: 'total_pallets',
label: '总托盘数',
type: 'number',
placeholder: '请输入总托盘数',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between', 'notbetween', 'in', 'notin', 'isnull', 'isnotnull'],
defaultOperator: 'ge'
operators: numberConfig.operators,
defaultOperator: numberConfig.defaultOperator
},
// 时间筛选
{
@ -353,6 +380,9 @@ export const addReceivingFields = [
{ prop: 'store_id', label: '货主', type: 'select', filterable: true, options: [] },
{ prop: 'delivery_method', label: '来货方式', type: 'select', options: Object.entries(deliveryMethodConfig).map(([v, c]: [string, any]) => ({ value: v, label: c.text })) },
{ prop: 'loading_method', label: '装卸方式', type: 'select', options: Object.entries(loadingMethodConfig).map(([v, c]: [string, any]) => ({ value: v, label: c.text })) },
// 新增可选的总箱数与总托盘数字段
{ prop: 'total_boxes', label: '总箱数', type: 'input', placeholder: '请输入总箱数', optional: true },
{ prop: 'total_pallets', label: '总托盘数', type: 'input', placeholder: '请输入总托盘数', optional: true },
{ prop: 'license_plate', label: '车牌号', type: 'input' },
{ prop: 'tracking_number', label: '物流单号', type: 'input' },
{ prop: 'remark', label: '备注', type: 'textarea' }

View File

@ -5,6 +5,7 @@
width="320px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:initial-conditions="initialConditions"
:preset-tree="presetTree"
:available-fields="availableFieldsRef"
@condition-change="handleConditionChange"
@ -98,6 +99,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, computed } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
@ -119,6 +121,14 @@ import log from './component/log.vue'
const scanBox = ref<any>(null)
const upperTable = ref<any>(null)
const route = useRoute()
// 初始条件(用于 URL 预设)
const initialConditions = ref<any>(null)
// 保存原始条件(可能包含 operator 等信息)
const currentConditionRaw = ref<any>(null)
const presetTree = ref<any[]>([])
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
@ -154,8 +164,26 @@ const selectedRow = computed(() => {
})
onMounted(() => {
loadData()
// 先加载筛选相关数据,保证 ScanBox 的选项可用
loadFilterData()
// 支持从 URL 预设筛选(例如 ?id=xxx 或 ?delivery_order_code=xxx 或 ?q=xxx)
const idParam = route.query.id || route.query.delivery_order_code || route.query.q
const id = Array.isArray(idParam) ? idParam[0] : idParam
if (id) {
// 与 receiving 页面一致,设置 ScanBox 的初始条件用于在 UI 中显示
initialConditions.value = {
type: 'custom',
conditions: {
delivery_order_code: { value: String(id), operator: 'eq', field: 'delivery_order_code', type: 'text' }
}
}
// 使用包含 operator 的完整条件触发搜索,避免丢失操作符
handleConditionChange(initialConditions.value)
} else {
loadData()
}
})
async function loadData() {
@ -163,6 +191,7 @@ async function loadData() {
loading.value = true
const start = Date.now()
try {
// 优先使用由 ScanBox 提交并经过规范化的条件(包含 operator 等信息)
const where = currentCondition.value || {}
const params: any = {
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
@ -194,9 +223,10 @@ async function loadData() {
async function loadFilterData() {
try {
// 与 receiving 页面一致,按业务类型加载 store 列表和 presetTree,避免 ScanBox options 不匹配
const [storesRes, presetRes]: any = await Promise.all([
indexApi.loadStores({ type: 'entry' }),
indexApi.fastWhereTree('entry')
indexApi.loadStores({ type: 'stockout' }),
indexApi.fastWhereTree('stockout')
])
if (storesRes && storesRes.code === 200) {
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
@ -211,7 +241,12 @@ async function loadFilterData() {
}
function handleConditionChange(condition: any) {
currentCondition.value = condition
// 保存原始条件
currentConditionRaw.value = condition
// 将条件规范化为后端期望结构:{ operator, value, type }
currentCondition.value = normalizeToWhere(condition)
pagination.currentPage = 1
loadData()
}
@ -229,16 +264,20 @@ function handleSubmit() {
}
const handleConditionClear = () => {
currentConditionRaw.value = null
currentCondition.value = null
pagination.currentPage = 1
loadData()
}
function handleConditionReset() {
currentConditionRaw.value = null
currentCondition.value = null
pagination.currentPage = 1
if (scanBox.value?.reset) {
scanBox.value.reset()
} else if (scanBox.value?.clear) {
scanBox.value.clear()
}
loadData()
}
@ -248,6 +287,68 @@ function onSelectionChange(rows: any[]) {
hasSelection.value = selectionRows.value.length > 0
}
// 将 scan-box 返回的条件标准化为后端推荐结构:{ operator, value, type }
function normalizeToWhere(condition: any) {
if (!condition) return {}
// 如果是字符串或简单值,默认映射为单号模糊查询(出库单号为 delivery_order_code)
if (typeof condition === 'string' || typeof condition === 'number') {
return { delivery_order_code: { operator: 'like', value: condition, type: 'text' } }
}
const getFieldConfig = (key: string) => {
return availableFields.find((f: any) => f.value === key)
}
const mapType = (type: string, value: any) => {
if (type === 'daterange' || Array.isArray(value)) return 'daterange'
if (type === 'number' || typeof value === 'number') return 'number'
if (type === 'boolean' || typeof value === 'boolean') return 'boolean'
return 'text'
}
const processConditionValue = (k: string, c: any) => {
const config = getFieldConfig(k)
const fieldType = config?.type || 'text'
if (c && typeof c === 'object' && !Array.isArray(c)) {
if ('operator' in c || 'value' in c || 'type' in c) {
return {
operator: c.operator || (Array.isArray(c.value) ? 'in' : (fieldType === 'daterange' ? 'between' : 'eq')),
value: c.value,
type: c.type || mapType(fieldType, c.value)
}
}
}
if (c === null || c === undefined || c === '' || (Array.isArray(c) && c.length === 0)) return null
const simpleOp = fieldType === 'daterange' ? 'between' : 'eq'
const simpleType = mapType(fieldType, c)
return { operator: simpleOp, value: c, type: simpleType }
}
if (condition.conditions && typeof condition.conditions === 'object') {
const where: any = {}
Object.keys(condition.conditions).forEach(k => {
const result = processConditionValue(k, condition.conditions[k])
if (result) where[k] = result
})
return where
}
if (typeof condition === 'object') {
const where: any = {}
Object.keys(condition).forEach(k => {
const result = processConditionValue(k, condition[k])
if (result) where[k] = result
})
return where
}
return {}
}
async function handleRowClick(row: any) {
selectedStockoutId.value = row?.id || null
}

View File

@ -828,9 +828,13 @@ function handleSearch() {
function handleReset() {
queryForm.keyword = ''
currentCondition.value = {}
if (scanBox.value?.reset) scanBox.value.reset()
pagination.currentPage = 1
loadList()
if (scanBox.value?.reset) {
scanBox.value.reset()
} else {
// 降级处理:如果没有 scanBox 实例也应该能正常重置并加载
pagination.currentPage = 1
loadList()
}
}
function handlePageChange(page: number) {

View File

@ -130,26 +130,26 @@
<el-button
v-if="row.editing"
type="success"
size="mini"
size="small"
@click="saveProperty(row)"
>保存</el-button>
<el-button
v-else
type="primary"
size="mini"
size="small"
@click="editProperty(row)"
>编辑</el-button>
<el-button
v-if="!row.editing"
type="danger"
size="mini"
size="small"
@click="deleteProperty(row)"
>删除</el-button>
<el-button
v-else
type="warning"
size="mini"
size="small"
@click="cancelEdit(row)"
>取消</el-button>
</template>
@ -239,13 +239,13 @@
/>
<el-button
v-if="addForm.options.length > 1"
type="text"
type="link"
icon="el-icon-delete"
@click="removeOption(Number(index))"
/>
</div>
<el-button
type="text"
type="link"
icon="el-icon-plus"
@click="addOption"
>

View File

@ -8,19 +8,19 @@
<div class="card-header">
<span>仓位管理(货架{{ props.rack.name }})</span>
<span>
<el-button type="text" size="small" @click="handleAddSpace">
<el-button type="link" size="small" @click="handleAddSpace">
一键排列拣货路径
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
<el-button type="link" size="small" @click="handleAddSpace">
打印
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
<el-button type="link" size="small" @click="handleAddSpace">
修复货架
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
<el-button type="link" size="small" @click="handleAddSpace">
导出
</el-button>
<el-button type="text" size="small" @click="handleAddSpace">
<el-button type="link" size="small" @click="handleAddSpace">
导入批量修改
</el-button>
</span>

View File

@ -1,7 +1,7 @@
<template>
<el-dialog
title="编辑仓位"
:visible="props.visible"
v-model="internalVisible"
width="500px"
@close="handleClose"
>
@ -91,6 +91,11 @@ const props = defineProps({
const emit = defineEmits(['close', 'saved'])
const internalVisible = ref(props.visible)
watch(() => props.visible, (nv) => { internalVisible.value = nv }, { immediate: true })
watch(internalVisible, (v) => { if (!v) emit('close') })
const formRef = ref(null)
const saving = ref(false)

View File

@ -5,7 +5,7 @@
<div class="header-actions">
<el-button
type="primary"
size="mini"
size="small"
@click="loadSpaces"
:loading="loading"
>
@ -13,7 +13,7 @@
</el-button>
<el-button
type="success"
size="mini"
size="small"
@click="generateSpaces"
:loading="generating"
v-if="!spaces.length"
@ -51,7 +51,7 @@
<div class="grid-cell">{{ space.space_code }}</div>
<div class="grid-cell">
<el-tag
size="mini"
size="small"
:type="getStatusTag(space.space_status)"
>
{{ getStatusText(space.space_status) }}
@ -59,8 +59,8 @@
</div>
<div class="grid-cell">
<el-button
type="text"
size="mini"
type="link"
size="small"
@click.stop="editSpace(space)"
>
<i class="el-icon-edit"></i>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :title="dialogTitle" v-model="props.visible" width="900px" align-center :before-close="handleClose" :close-on-click-modal="false">
<el-dialog :title="dialogTitle" v-model="internalVisible" width="900px" align-center :before-close="handleClose" :close-on-click-modal="false">
<el-form ref="zoneFormRef" :model="formData" :rules="formRules" label-width="100px" label-position="left">
<!-- 分区类型改为下拉选择 -->
<el-form-item label="分区类型" prop="zone_type">
@ -210,6 +210,7 @@ const props = defineProps({
const emit = defineEmits(['close', 'success'])
const zoneFormRef = ref<any>(null)
const internalVisible = ref(props.visible)
const aislesInput = ref('')
const submitting = ref(false)
@ -326,7 +327,8 @@ const parentDisplayName = computed(() => {
return ''
})
watch(() => props.visible, (newVal) => { if (newVal) initFormData(); else resetForm() }, { immediate: true })
watch(() => props.visible, (newVal) => { internalVisible.value = newVal; if (newVal) initFormData(); else resetForm() }, { immediate: true })
watch(internalVisible, (val) => { if (!val && !submitting.value) emit('close') })
watch(() => props.zoneData, () => initFormData(), { deep: true })
watch(() => props.parentType, (nv) => { if (nv && props.mode === 'add') autoSetZoneType(nv) }, { immediate: true })

View File

@ -16,7 +16,7 @@
<template v-slot="{ node, data }">
<span class="tree-node">
<span class="node-content">
<el-tag size="mini" :type="getZoneTypeTag(data.type)">
<el-tag size="small" :type="getZoneTypeTag(data.type)">
{{ getZoneTypeText(data.type) }}
</el-tag>
<span class="node-label">{{ data.name }}</span>

View File

@ -6,7 +6,7 @@
<el-card class="warehouse-card">
<template #header>
<span>仓库列表</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="showAddWarehouseDialog">
<el-button style="float: right; padding: 3px 0" type="link" @click="showAddWarehouseDialog">
添加仓库
</el-button>
</template>
@ -38,9 +38,9 @@
<span>{{ data.name }}</span>
</span>
<span class="tree-node-actions">
<el-button type="text" size="mini" @click.stop="addChildElement(data)">添加</el-button>
<el-button type="text" size="mini" @click.stop="editElement(data)">编辑</el-button>
<el-button type="text" size="mini" @click.stop="deleteElement(data)">删除</el-button>
<el-button type="link" size="small" @click.stop="addChildElement(data)">添加</el-button>
<el-button type="link" size="small" @click.stop="editElement(data)">编辑</el-button>
<el-button type="link" size="small" @click.stop="deleteElement(data)">删除</el-button>
</span>
</span>
</template>
@ -59,13 +59,13 @@
<span>仓库平面图</span>
<div class="view-controls">
<el-button-group>
<el-button size="mini" @click="zoomOut" :disabled="scale <= minScale">
<el-button size="small" @click="zoomOut" :disabled="scale <= minScale">
<i class="el-icon-zoom-out"></i>
</el-button>
<el-button size="mini" @click="zoomIn" :disabled="scale >= maxScale">
<el-button size="small" @click="zoomIn" :disabled="scale >= maxScale">
<i class="el-icon-zoom-in"></i>
</el-button>
<el-button size="mini" @click="resetView">
<el-button size="small" @click="resetView">
<i class="el-icon-refresh"></i> 重置
</el-button>
</el-button-group>
@ -134,8 +134,8 @@
<div v-else>原因: {{ connectivityResult.reason }}</div>
</div>
<div v-if="connectivityResult.success" class="result-actions">
<el-button size="mini" @click="visualizePath">可视化路径</el-button>
<el-button size="mini" @click="showPathDetails">查看详情</el-button>
<el-button size="small" @click="visualizePath">可视化路径</el-button>
<el-button size="small" @click="showPathDetails">查看详情</el-button>
</div>
</div>
</div>
@ -143,7 +143,7 @@
<div v-if="detectionHistory.length > 0" class="history-container">
<div class="history-header">
<span>检测历史</span>
<el-button type="text" size="mini" @click="clearHistory">清空</el-button>
<el-button type="link" size="small" @click="clearHistory">清空</el-button>
</div>
<div class="history-list">
<div v-for="record in detectionHistory" :key="record.id" class="history-item" @click="showHistoryRecord(record)">

View File

@ -34,7 +34,7 @@
<el-card v-if="props.warehouse && props.warehouse.id" class="warehouse-info-card">
<template #header>
<span>仓库信息</span>
<el-button type="text" size="small" @click="handleEditWarehouse" v-if="props.warehouse.editable">编辑</el-button>
<el-button type="link" size="small" @click="handleEditWarehouse" v-if="props.warehouse.editable">编辑</el-button>
</template>
<div class="warehouse-info-content">
@ -86,7 +86,7 @@
<el-card v-else-if="props.zone && props.zone.type === 'area'" class="zone-info-card">
<template #header>
<span>库区信息</span>
<el-button type="text" size="small" @click="handleEditZone" v-if="props.zone.editable">编辑</el-button>
<el-button type="link" size="small" @click="handleEditZone" v-if="props.zone.editable">编辑</el-button>
</template>
<div class="zone-info-content">

View File

@ -1,287 +1,77 @@
storage.receiving.getReceivingList
storage.receiving.bindStore
收货单绑定货主
Params (2)
名称 类型 必填 说明
pagination object 否 分页参数,支持 page/pageSize
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、status、store_id、日期区间等字段。示例:where.status={operator:eq,value:finished}; where.store_id={operator:eq,value:1001}; where.create_time_start={value:2026-03-01}。
id number 是 收货单ID
store_id number 是 货主ID(必须与当前仓库存在有效签约关系)
-----
storage.inventory.quickPutaway接口
收货单快捷入库上架。从收货单直接生成入库单并写入库存表,要求收货单已完成且所有明细已匹配系统商品
Params (1)
Response (4)
名称 类型 必填 说明
receiving_id number 是 收货单ID,兼容 id
-----
storage.entry.list
入库单列表查询
Params (3)
名称 类型 必填 说明
pagination object 否 分页参数,支持 page/pageSize
where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构,历史简写会在 main 中自动标准化;支持 quickWhere、order_status、store_id、order_type、日期区间等字段。示例:where.order_status={operator:eq,value:waiting}; where.order_type={operator:eq,value:purchase}; where.create_time_start={value:2026-03-01}。
sort object 否 排序参数,支持 sortField/sortOrder
Response (3)
名称 类型 必填 说明
list array 是 入库单列表
pagination object 是 分页信息(page、pageSize、total、totalPages、hasPrevious、hasNext)
summary object 是 状态汇总(total、pending、creating、created、completed、cancelled)
data.id number 是 收货单ID
data.store_id number 是 已绑定的货主ID
data.store_name string 否 货主名称/签约备注名
data.status string 是 当前收货单状态
请求携带参数:
{
"flag": "success",
"code": 200,
"message": "查询成功",
"data": {
"list": [
{
"id": 103,
"entry_order_code": "33134",
"order_type": "SCRK",
"purchase_order_code": "36151",
"total_order_lines": 0,
"order_create_time": "2026-03-27T07:43:19.000Z",
"expect_start_time": null,
"expect_end_time": null,
"logistics_code": "",
"logistics_name": "",
"express_code": "",
"supplier_code": "",
"supplier_name": "",
"source_type": "API",
"order_status": "CREATED",
"sync_status": "PENDING",
"sync_message": "",
"is_enabled": 1,
"created_at": "2026-03-27T07:43:19.000Z",
"updated_at": "2026-03-27T07:43:19.000Z",
"warehouse_id": 1000028,
"store_id": 1000147,
"remark": "新增入库单2",
"store_name": null,
"warehouse_name": null,
"deleted_at": null,
"qimen_owner_code": null,
"qimen_warehouse_code": null,
"warehouse": {
"id": 1000028,
"company_name": "天豹云仓"
},
"store": {
"id": 1000147,
"company_name": "广州天豹云仓"
}
},
{
"id": 102,
"entry_order_code": "1919810",
"order_type": "SCRK",
"purchase_order_code": "114514",
"total_order_lines": 0,
"order_create_time": "2026-03-27T07:42:17.000Z",
"expect_start_time": null,
"expect_end_time": null,
"logistics_code": "",
"logistics_name": "",
"express_code": "",
"supplier_code": "",
"supplier_name": "",
"source_type": "API",
"order_status": "CREATED",
"sync_status": "PENDING",
"sync_message": "",
"is_enabled": 1,
"created_at": "2026-03-27T07:42:17.000Z",
"updated_at": "2026-03-27T07:42:17.000Z",
"warehouse_id": 1000028,
"store_id": 1000147,
"remark": "新建入库单测试",
"store_name": null,
"warehouse_name": null,
"deleted_at": null,
"qimen_owner_code": null,
"qimen_warehouse_code": null,
"warehouse": {
"id": 1000028,
"company_name": "天豹云仓"
},
"store": {
"id": 1000147,
"company_name": "广州天豹云仓"
}
},
{
"id": 101,
"entry_order_code": "ENT1774445767744174",
"order_type": "QTRK",
"purchase_order_code": "PO-COMP-1774445767714",
"total_order_lines": 1,
"order_create_time": "2026-03-25T13:36:07.000Z",
"expect_start_time": null,
"expect_end_time": null,
"logistics_code": "",
"logistics_name": "",
"express_code": "",
"supplier_code": "",
"supplier_name": "",
"source_type": "API",
"order_status": "COMPLETED",
"sync_status": "PENDING",
"sync_message": "",
"is_enabled": 1,
"created_at": "2026-03-25T13:36:07.000Z",
"updated_at": "2026-03-25T13:36:08.000Z",
"warehouse_id": 1000028,
"store_id": 1000028,
"remark": "integration-test-complete",
"store_name": null,
"warehouse_name": null,
"deleted_at": null,
"qimen_owner_code": null,
"qimen_warehouse_code": null,
"warehouse": {
"id": 1000028,
"company_name": "天豹云仓"
},
"store": {
"id": 1000028,
"company_name": "天豹云仓"
}
},
{
"id": 100,
"entry_order_code": "ENT1774445765920918",
"order_type": "QTRK",
"purchase_order_code": "PO-1774445765881",
"total_order_lines": 0,
"order_create_time": "2026-03-25T13:36:05.000Z",
"expect_start_time": null,
"expect_end_time": null,
"logistics_code": "",
"logistics_name": "",
"express_code": "",
"supplier_code": "",
"supplier_name": "",
"source_type": "API",
"order_status": "CANCELLED",
"sync_status": "PENDING",
"sync_message": "",
"is_enabled": 1,
"created_at": "2026-03-25T13:36:05.000Z",
"updated_at": "2026-03-25T13:36:06.000Z",
"warehouse_id": 1000028,
"store_id": 1000028,
"remark": "integration-test-cancel",
"store_name": null,
"warehouse_name": null,
"deleted_at": null,
"qimen_owner_code": null,
"qimen_warehouse_code": null,
"warehouse": {
"id": 1000028,
"company_name": "天豹云仓"
},
"store": {
"id": 1000028,
"company_name": "天豹云仓"
}
},
{
"id": 99,
"entry_order_code": "ENT1774435697353684",
"order_type": "QTRK",
"purchase_order_code": "PO-COMP-1774435697311",
"total_order_lines": 1,
"order_create_time": "2026-03-25T10:48:17.000Z",
"expect_start_time": null,
"expect_end_time": null,
"logistics_code": "",
"logistics_name": "",
"express_code": "",
"supplier_code": "",
"supplier_name": "",
"source_type": "API",
"order_status": "COMPLETED",
"sync_status": "PENDING",
"sync_message": "",
"is_enabled": 1,
"created_at": "2026-03-25T10:48:17.000Z",
"updated_at": "2026-03-25T10:48:17.000Z",
"warehouse_id": 1000028,
"store_id": 1000028,
"remark": "integration-test-complete",
"store_name": null,
"warehouse_name": null,
"deleted_at": null,
"qimen_owner_code": null,
"qimen_warehouse_code": null,
"warehouse": {
"id": 1000028,
"company_name": "天豹云仓"
},
"store": {
"id": 1000028,
"company_name": "天豹云仓"
}
},
{
"id": 98,
"entry_order_code": "ENT1774435695468552",
"order_type": "QTRK",
"purchase_order_code": "PO-1774435695428",
"total_order_lines": 0,
"order_create_time": "2026-03-25T10:48:15.000Z",
"expect_start_time": null,
"expect_end_time": null,
"logistics_code": "",
"logistics_name": "",
"express_code": "",
"supplier_code": "",
"supplier_name": "",
"source_type": "API",
"order_status": "CANCELLED",
"sync_status": "PENDING",
"sync_message": "",
"is_enabled": 1,
"created_at": "2026-03-25T10:48:15.000Z",
"updated_at": "2026-03-25T10:48:16.000Z",
"warehouse_id": 1000028,
"store_id": 1000028,
"remark": "integration-test-cancel",
"store_name": null,
"warehouse_name": null,
"deleted_at": null,
"qimen_owner_code": null,
"qimen_warehouse_code": null,
"warehouse": {
"id": 1000028,
"company_name": "天豹云仓"
},
"store": {
"id": 1000028,
"company_name": "天豹云仓"
}
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 6,
"totalPages": 1,
"hasPrevious": false,
"hasNext": false
"id": 471,
"receiving_number": "R20552055",
"store_id": 1000016
}
接口响应:
{
"flag": "success",
"code": 200,
"message": "绑定货主成功",
"data": {
"id": 471,
"store_id": 1000016,
"store_name": "测试1112",
"status": "receiving"
},
"summary": {
"total": 6,
"pending": 0,
"creating": 0,
"created": 2,
"completed": 2,
"cancelled": 2
}
},
"timestamp": 1775725099
"timestamp": 1775792333
}
-----
storage.receiving.create 接口:
Params (8)
名称 类型 必填 说明
delivery_method string 是 到货方式:truck/express/air_freight/sea_freight/other
loading_method string 是 装卸方式:with_pallet/without_pallet
license_plate string 否 车牌号(delivery_method=truck 时建议传)
tracking_number string 否 物流单号(非 truck/other 场景建议传)
store_id number 否 货主ID
total_boxes number 否 总箱数
total_pallets number 否 总托盘数
remark string 否 备注
Response (2)
名称 类型 必填 说明
id number 是 新建收货单ID
receiving_number string 是 收货单号
当前项目请求数据结构:
{
"store_id": 1000016,
"delivery_method": "truck",
"loading_method": "with_pallet",
"license_plate": "粤AX2201",
"tracking_number": "T202604401114",
"remark": "[测试新建收货单2]"
}
返回数据:
{
"flag": "success",
"code": 200,
"message": "收货任务创建成功",
"id": 484,
"receiving_number": "R20553006",
"timestamp": 1775790877
}