Compare commits

..

No commits in common. "b31eef97c2d807c6cc5c620dfe3eb01b4440e924" and "0b00014427bdbc5aa75e02a3f92c8ed77d10cd8a" have entirely different histories.

5 changed files with 160 additions and 125 deletions

View File

@ -15,11 +15,11 @@
<div class="app-info">
<div class="app-name">WMS PDA端</div>
<div class="app-version" v-if="pdaData">V {{ pdaData.version }}</div>
<div class="app-date" v-if="pdaData">{{ formatDate(pdaData.publishedAtUtc) }}</div>
<div class="app-date" v-if="pdaData">{{ formatDate(pdaData.publishedAt) }}</div>
<div class="app-error" v-if="pdaError">获取版本信息失败</div>
</div>
<div class="app-action">
<el-button type="primary" size="small" :disabled="!pdaData?.url" @click="showQrCode('扫描二维码下载 PDA', pdaData?.url)">
<el-button type="primary" size="small" :disabled="!pdaData?.downloadUrl" @click="showQrCode('扫描二维码下载 PDA', pdaData?.downloadUrl)">
下载
</el-button>
</div>
@ -116,16 +116,13 @@ import dayjs from 'dayjs'
import axios from 'axios'
import QRCode from 'qrcode'
/**
* PDA(WMS PDA 端)版本信息
* 字段与 `pda/latest.json` 保持一致:{ version, file, url, sha256, publishedAtUtc }
*/
interface PdaVersionInfo {
version: string
file: string
url: string
sha256?: string
publishedAtUtc: string
versionName: string
downloadUrl: string
fileName: string
forceUpdate: boolean
publishedAt: string
}
interface PrintServerVersionInfo {

View File

@ -72,7 +72,6 @@
import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { warehouseSearch, stockWarehouse } from '@/api/stock/stock'
import { buildStockQuery } from '@/utils/stockQueryBuilder'
import {
isStockApiSuccess,
parseStockWarehouseSearch,
@ -194,8 +193,8 @@ function formatRowLabel(item: StockPickerItem): string {
async function loadInitialList() {
loading.value = true
try {
// where 统一按 stock.warehouse.list 规范:{ 字段: { operator, value, type } }
const where = buildStockQuery(props.storeId ? { store_id: props.storeId } : {})
const where: Record<string, unknown> = {}
if (props.storeId) where.store_id = props.storeId
const res: any = await stockWarehouse({ page: 1, pageSize: PICKER_LIST_PAGE_SIZE }, where)
if (!isStockApiSuccess(res)) {
list.value = []

View File

@ -60,7 +60,6 @@
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { stockWarehouse, warehouseSearch } from '@/api/stock/stock'
import { buildStockQuery } from '@/utils/stockQueryBuilder'
import { isComboGoodsApiSuccess, parseStockWarehouseListResponse } from '../combo-stock-config'
import {
getStockItemCode,
@ -136,8 +135,10 @@ function mapRows(rawList: unknown[]): ComboStockPickerItem[] {
async function loadInitialList() {
loading.value = true
try {
// where 统一按 stock.warehouse.list 规范:{ 字段: { operator, value, type } }
const where = buildStockQuery(props.storeId ? { store_id: props.storeId } : {})
const where: Record<string, unknown> = {}
if (props.storeId) {
where.store_id = props.storeId
}
const res: any = await stockWarehouse({ page: 1, pageSize: PICKER_LIST_PAGE_SIZE }, where)
if (!isComboGoodsApiSuccess(res)) {
list.value = []

View File

@ -297,8 +297,6 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { buildStockQuery } from '@/utils/stockQueryBuilder'
import { stockScanField } from '@/views/stock/stock/stock-config'
// ─── 列表列配置 ─────────────────────────────────────────────────────────────
const columns = [
@ -327,113 +325,119 @@ const columns = [
{ prop: 'update_at_display', label: '更新时间', width: 160, sortable: true }
]
// ─── 筛选字段配置(字段结构与系统商品页 stock/stock 保持一致)────────────────
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
const availableFields: any[] = [
// ===== 商品标识 =====
stockScanField('product', {
value: 'id',
label: 'SKU',
{
label: '关键词',
value: 'keyword',
type: 'text',
placeholder: '请输入SKU',
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
stockScanField('product', {
value: 'item_code',
label: '商品编码',
type: 'text',
placeholder: '请输入商品编码',
operators: ['eq', 'ne', 'contains', 'startswith', 'endswith'],
defaultOperator: 'eq'
}),
stockScanField('product', {
value: 'goods_code',
label: '货物编码',
type: 'text',
placeholder: '请输入货物编码',
operators: ['eq', 'ne', 'contains'],
defaultOperator: 'eq'
}),
// ===== 商品信息 =====
stockScanField('info', {
value: 'item_name',
operators: ['like'],
placeholder: '商品编码/名称/条码',
group: '基础信息'
},
{
label: '商品名称',
value: 'item_name',
type: 'text',
placeholder: '请输入商品名称',
operators: ['eq', 'ne', 'contains'],
defaultOperator: 'eq'
}),
stockScanField('info', {
value: 'barcode',
label: '条码',
type: 'text',
placeholder: '请输入商品条码',
operators: ['eq', 'contains'],
defaultOperator: 'eq'
}),
stockScanField('info', {
value: 'brand_name',
group: '基础信息'
},
{
label: '品牌',
value: 'brand_name',
type: 'text',
placeholder: '请输入品牌',
operators: ['eq', 'ne', 'contains', 'startswith', 'endswith'],
defaultOperator: 'eq'
}),
// ===== 商品属性 =====
stockScanField('attribute', {
value: 'is_images',
label: '是否有图片',
type: 'boolean'
}),
stockScanField('attribute', {
value: 'has_bound_item',
label: '外部商品绑定',
type: 'boolean',
placeholder: '请选择是否已绑定外部商品'
}),
stockScanField('attribute', {
value: 'level',
label: 'ABC分类',
type: 'select',
placeholder: '请选择分类',
options: [
{ value: 'A', label: 'A类' },
{ value: 'B', label: 'B类' },
{ value: 'C', label: 'C类' }
]
}),
// ===== 库存信息 =====
stockScanField('inventory', {
value: 'quantity',
group: '基础信息'
},
{
label: '条码',
value: 'goods_code',
type: 'text',
group: '基础信息'
},
{
label: 'SKU',
value: 'id',
type: 'text',
group: '基础信息'
},
{
label: '条码',
value: 'barcode',
type: 'text',
group: '基础信息'
},
{
label: '库存数量',
type: 'number',
placeholder: '请输入库存数量',
operators: ['eq', 'ne', 'gt', 'lt', 'ge', 'le', 'between'],
defaultOperator: 'ge'
}),
// ===== 管理标识 =====
stockScanField('management', {
value: 'quantity',
type: 'text',
group: '基础信息'
},
{
label: '外部商品绑定',
value: 'has_bound_item',
type: 'select',
group: '流程状态',
options: [
{ label: '全部', value: undefined },
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
]
},
{
label: 'ABC分类',
value: 'level',
type: 'select',
group: '流程状态',
options: [
{ label: '全部', value: undefined },
{ label: 'A', value: 'A' },
{ label: 'B', value: 'B' },
{ label: 'C', value: 'C' }
]
},
{
label: '是否图片',
value: 'is_images',
type: 'select',
group: '流程状态',
options: [
{ label: '全部', value: undefined },
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
]
},
{
label: 'SN管理',
value: 'is_sn_mgmt',
label: '序列号管理',
type: 'boolean',
placeholder: '请选择是否序列号管理'
}),
stockScanField('management', {
value: 'is_shelf_life_mgmt',
type: 'select',
group: '流程状态',
options: [
{ label: '全部', value: undefined },
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
]
},
{
label: '保质期管理',
type: 'boolean',
placeholder: '请选择是否保质期管理'
}),
stockScanField('management', {
value: 'is_batch_mgmt',
value: 'is_shelf_life_mgmt',
type: 'select',
group: '流程状态',
options: [
{ label: '全部', value: undefined },
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
]
},
{
label: '批次管理',
type: 'boolean',
placeholder: '请选择是否批次管理'
})
value: 'is_batch_mgmt',
type: 'select',
group: '流程状态',
options: [
{ label: '全部', value: undefined },
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' }
]
}
]
const presetTree: any[] = []
@ -447,7 +451,7 @@ const scanBox = ref<any>(null)
const activeTab = ref('info')
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
const queryForm = reactive({ warehouse_id: undefined as number | string | undefined })
const queryForm = reactive({ keyword: '', warehouse_id: undefined as number | string | undefined })
const currentCondition = ref<any>({})
const currentSort = reactive({ prop: '', order: '' })
const summary = ref<any>(null)
@ -476,7 +480,10 @@ const {
function buildExportPayload() {
const payload: any = {
where: buildStockQuery(currentCondition.value)
where: { ...currentCondition.value }
}
if (queryForm.keyword) {
payload.where.keyword = queryForm.keyword
}
if (queryForm.warehouse_id !== undefined && queryForm.warehouse_id !== null && queryForm.warehouse_id !== '') {
payload.warehouse_id = queryForm.warehouse_id
@ -617,6 +624,9 @@ function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
handler()
}
// ─── 特殊字段键(不作为 where 条件,需要单独提取)──────────────────────
const SPECIAL_KEYS = ['keyword', 'warehouse_id']
// ─── 加载列表 ──────────────────────────────────────────────────────────────
async function loadList() {
loading.value = true
@ -626,7 +636,10 @@ async function loadList() {
page: pagination.currentPage,
pageSize: pagination.pageSize
},
where: buildStockQuery(currentCondition.value)
where: { ...currentCondition.value }
}
if (queryForm.keyword) {
params.where.keyword = queryForm.keyword
}
const sort: StockWarehouseListSort | undefined = currentSort.prop
@ -659,14 +672,41 @@ async function loadList() {
// ─── 事件处理 ──────────────────────────────────────────────────────────────
function handleConditionChange(condition: any) {
// ScanBox 直接下发 { field: { value, operator, type } } 结构,
// 原样保留,交由 buildStockQuery 转为后端 where 规范,避免丢失操作符/类型
currentCondition.value = condition && typeof condition === 'object' ? condition : {}
const where: any = {}
// 重置特殊字段
queryForm.keyword = ''
queryForm.warehouse_id = undefined
if (condition) {
Object.keys(condition).forEach(k => {
if (SPECIAL_KEYS.includes(k)) {
// 关键词、仓库 从 condition 提取到 queryForm
const c = condition[k]
const val = (c && typeof c === 'object' && c.value !== undefined) ? c.value : c
if (k === 'keyword' && val) {
queryForm.keyword = val
} else if (k === 'warehouse_id' && val !== undefined && val !== null && val !== '') {
queryForm.warehouse_id = val
}
return
}
const c = condition[k]
if (c && typeof c === 'object' && c.value !== undefined) {
if (c.value !== '' && c.value !== null) {
where[k] = c.value
}
} else if (c !== '' && c !== null && c !== undefined) {
where[k] = c
}
})
}
currentCondition.value = where
pagination.currentPage = 1
loadList()
}
function handleReset() {
queryForm.keyword = ''
currentCondition.value = {}
if (scanBox.value?.reset) {
scanBox.value.reset()

View File

@ -111,7 +111,6 @@ import { ref, reactive, onMounted, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Search, Delete, RefreshLeft, Refresh } from '@element-plus/icons-vue'
import * as stockApi from '@/api/stock/stock'
import { buildStockQuery } from '@/utils/stockQueryBuilder'
import { parseTime } from '@/utils/index'
import { formatBarcodeText } from '@/utils/barcode'
@ -218,12 +217,11 @@ const loadData = async () => {
if (loading.value) return
loading.value = true
try {
// where 统一按 stock.warehouse.list 规范:{ 字段: { operator, value, type } }
const params: any = buildStockQuery({
const params: any = {
is_deleted: 1, // Assuming backend supports this flag for recycle bin
keyword: searchKeyword.value,
type: filterType.value
})
}
const response = await stockApi.stockWarehouse(pagination, params)
if (response && (response as any).code === 200) {
list.value = (response as any).data.list || []