diff --git a/dist.tar.gz b/dist.tar.gz index 61ebe0ac..87c819e2 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/src/api/workbench/workbench.ts b/src/api/workbench/workbench.ts new file mode 100644 index 00000000..6ad647fd --- /dev/null +++ b/src/api/workbench/workbench.ts @@ -0,0 +1,110 @@ +import request from '@/utils/request' + +const v = '1.0' + +/** 查询工作台列表(仓库隔离,支持分页与关键词筛选) */ +export function list(data?: { + pagination?: { page?: number; pageSize?: number } + where?: { name?: string; barcode?: string; status?: number } +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.list', + v, + timestamp: new Date().getTime() + }, + data: data || {}, + isSystemApi: true + } as any) +} + +/** 查询单个工作台详情(仓库隔离) */ +export function detail(data: { id: number }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.detail', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 新增工作台(仓库隔离,条码仓库内唯一) */ +export function create(data: { + name: string + barcode?: string + status?: number + remark?: string +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.create', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 更新工作台信息(仓库隔离) */ +export function update(data: { + id: number + name?: string + barcode?: string + status?: number + remark?: string +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.update', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 删除工作台(软删除,仓库隔离) */ +export function del(data: { id: number }) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.delete', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 检查条码在仓库内是否已存在 */ +export function checkBarcode(data: { + barcode: string + excludeId?: number +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.checkBarcode', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/lang/en-US.ts b/src/lang/en-US.ts index 974b8f82..84d618d0 100644 --- a/src/lang/en-US.ts +++ b/src/lang/en-US.ts @@ -69,6 +69,8 @@ export default { 'shipperSigning':'Shipper Signing', 'Product Flow':'Product Flow', 'Externalwarehouse':'External Warehouse', + 'workbench':'Workbench', + // 'OwnerReceiving':'Owner Receiving', }, "login": { "title": "Login", diff --git a/src/lang/zh-CN.ts b/src/lang/zh-CN.ts index ec72499c..de4067b3 100644 --- a/src/lang/zh-CN.ts +++ b/src/lang/zh-CN.ts @@ -71,6 +71,8 @@ export default { 'Productflow':'商品流水', 'Externalwarehouse':'外部仓库', 'StoreReport':'门店报告', + 'workbench':'工作台', + // 'OwnerReceiving':'仓库收货单', }, "login": { "title": "登录", diff --git a/src/router/map.ts b/src/router/map.ts index adc67ac6..a448925b 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -39,7 +39,7 @@ export const componentMap: Record = { 'store/productflow': () => import('@/views/storage/productflow/index.vue'), 'store/index': () => import('@/views/store/stores/index.vue'), 'Externalwarehouse/shipperSigning/index': () => import('@/views/Externalwarehouse/shipperSigning/index.vue'), - 'wave/index': () => import('@/views/order/waveOrder2/index.vue'), + 'wave/index': () => import('@/views/order/waveOrder/index.vue'), /** 与后端菜单 component 字段兼容 */ 'order/waveOrder': () => import('@/views/order/waveOrder/index.vue'), 'orderreview/index': () => import('@/views/order/orderreview/index.vue'), @@ -54,6 +54,7 @@ export const componentMap: Record = { 'system/print/station': () => import('@/views/system/setting/printStation/index.vue'), 'storage/log': () => import('@/views/storage/log/index.vue'), 'storage/validityperiod':() =>import('@/views/storage/validityperiod/index.vue'), + 'system/setting/workbench/index':() => import('@/views/system/setting/workbench/index.vue'), 'system/setting/expressinterface/index':() => import('@/views/system/setting/expressinterface/index.vue'), 'system/setting/encoding/index':() => import('@/views/system/setting/encoding/index.vue'), 'system/setting/shops/index':() => import('@/views/system/setting/shops/index.vue'), diff --git a/src/views/order/waveOrder2/config/waveorder-config.ts b/src/views/order/waveOrder2/config/waveorder-config.ts index 2f9811b7..bb090231 100644 --- a/src/views/order/waveOrder2/config/waveorder-config.ts +++ b/src/views/order/waveOrder2/config/waveorder-config.ts @@ -1246,3 +1246,354 @@ export const waveOrder2Columns = (() => { export const generateMockWaveList = waveOrder2TabPages[0]?.mock?.generateList ?? makeBaseMockWaveList export const generateMockDetail = waveOrder2TabPages[0]?.mock?.generateDetail ?? makeBaseMockDetail +// ============================================================ +// 十一、工具栏按钮系统(参照 orderManagement 设计) +// ============================================================ +// +// 按钮分为三类: +// 公共按钮 — 刷新、导出(不同页面调用不同接口) +// 功能按钮 — 点击后打开 pages/ 下对应表单组件 +// 基础接口 — 字段设置、隐藏详情 +// +// 按钮定义集中在 WAVEORDER2_TOOLBAR_BUTTONS,各标签页通过 +// getTabToolbarButtons(name) 获取属于该标签页的按钮列表。 + +export interface WaveOrder2ToolbarButtonConfig { + key: string + label: string + /** 按钮类别 */ + category: 'common' | 'function' | 'basic' + size?: '' | 'default' | 'small' | 'large' + type?: '' | 'primary' | 'success' | 'warning' | 'info' | 'danger' + plain?: boolean + loadingKey?: string + disabledKey?: string + action: string + /** 动态标签 key(如 detailToggleLabel) */ + dynamicLabelKey?: string + /** 仅指定标签页可见 */ + onlyForTabs?: string[] + /** 下拉按钮配置 */ + buttonType?: 'default' | 'dropdown' + dropdownOptions?: Array<{ label: string; action: string; divided?: boolean }> + /** 功能按钮关联的表单组件 key(查 FUNCTION_FORM_REGISTRY,可选) */ + formKey?: string +} + +/** 按钮类别常量 */ +export const TOOLBAR_CATEGORY = { + common: 'common', + function: 'function', + basic: 'basic' +} as const + +/** 工具栏按钮注册表(唯一真相来源) */ +export const WAVEORDER2_TOOLBAR_BUTTONS: Record = { + // ===== 公共按钮 ===== + refresh: { + key: 'refresh', + label: '刷新', + category: 'common', + type: 'primary', + size: 'small', + loadingKey: 'loading', + action: 'loadData' + }, + export: { + key: 'export', + label: '导出', + category: 'common', + size: 'small', + loadingKey: 'exportLoading', + action: 'handleExportWaybill', + buttonType: 'dropdown', + dropdownOptions: [ + { label: '不含明细', action: 'handleExportWaybill' }, + { label: '含明细', action: 'handleExportItem', divided: true } + ] + }, + + // ===== 基础接口 ===== + columnConfig: { + key: 'columnConfig', + label: '字段设置', + category: 'basic', + size: 'small', + action: 'openColumnConfigPanel' + }, + toggleDetail: { + key: 'toggleDetail', + label: '显示详情', + category: 'basic', + dynamicLabelKey: 'detailToggleLabel', + size: 'small', + action: 'toggleDetailVisible' + }, + + // ===== 功能按钮(打开表单/确认窗口) ===== + fetchGroupOrder: { + key: 'fetchGroupOrder', + label: '抓取团购单', + category: 'function', + type: 'warning', + size: 'small', + action: 'openFetchGroupOrderForm', + onlyForTabs: ['tab1'], + formKey: 'FetchGroupOrderForm' + }, + batchAutoGrouping: { + key: 'batchAutoGrouping', + label: '批量改为自动加团', + category: 'function', + type: 'warning', + size: 'small', + disabledKey: 'noSelection', + loadingKey: 'batchAutoGroupingLoading', + action: 'openBatchAutoGroupingForm', + formKey: 'BatchOperationForm' + }, + batchFinishAutoGrouping: { + key: 'batchFinishAutoGrouping', + label: '批量结束自动加团', + category: 'function', + type: 'success', + size: 'small', + disabledKey: 'noSelection', + loadingKey: 'batchFinishAutoGroupingLoading', + action: 'openBatchFinishAutoGroupingForm', + formKey: 'BatchOperationForm' + }, + batchCancel: { + key: 'batchCancel', + label: '批量取消波次', + category: 'function', + type: 'danger', + size: 'small', + disabledKey: 'noSelection', + loadingKey: 'batchCancelLoading', + action: 'openBatchCancelForm', + formKey: 'BatchOperationForm' + }, + batchAllocateExpress: { + key: 'batchAllocateExpress', + label: '快速分配快递号', + category: 'function', + type: 'success', + size: 'small', + disabledKey: 'noSelection', + loadingKey: 'batchAllocateExpressLoading', + action: 'openBatchAllocateExpressForm', + formKey: 'BatchOperationForm' + }, + batchAllocateStorage: { + key: 'batchAllocateStorage', + label: '批量分配储位', + category: 'function', + type: 'primary', + plain: true, + size: 'small', + disabledKey: 'noSelection', + loadingKey: 'batchAllocateStorageLoading', + action: 'openBatchAllocateStorageForm', + formKey: 'BatchOperationForm' + }, + batchRemoveExceptionOrders: { + key: 'batchRemoveExceptionOrders', + label: '批量移除异常订单', + category: 'function', + type: 'danger', + plain: true, + size: 'small', + disabledKey: 'noSelection', + loadingKey: 'batchRemoveExceptionOrdersLoading', + action: 'openBatchRemoveExceptionOrdersForm', + formKey: 'BatchOperationForm' + } +} + +/** 按标签页名称获取工具栏按钮列表 */ +export function getTabToolbarButtons(tabName: string): WaveOrder2ToolbarButtonConfig[] { + return Object.values(WAVEORDER2_TOOLBAR_BUTTONS).filter((btn) => { + if (btn.onlyForTabs && !btn.onlyForTabs.includes(tabName)) return false + return true + }) +} + +/** 按类别获取工具栏按钮 */ +export function getToolbarButtonsByCategory( + tabName: string, + category: string +): WaveOrder2ToolbarButtonConfig[] { + return getTabToolbarButtons(tabName).filter((btn) => btn.category === category) +} + +// ============================================================ +// 十二、功能按钮表单注册表 +// ============================================================ +// 功能按钮 → 表单组件的映射,组件放在 pages/ 目录下。 +// 新增功能按钮表单步骤: +// 1. 在 pages/ 下创建表单组件 +// 2. import 组件 +// 3. 在 FUNCTION_FORM_REGISTRY 添加一条 +// 4. 在 WAVEORDER2_TOOLBAR_BUTTONS 中设置 formKey + +import FetchGroupOrderForm from '../pages/FetchGroupOrderForm.vue' +import BatchOperationForm from '../pages/BatchOperationForm.vue' +import { + orderWaveBatchAutoGrouping, + orderWaveBatchFinishAutoGrouping, + orderWaveBatchCancel, + orderWaveBatchCancelTaskProgress, + orderWaveBatchAllocateExpress, + orderWaveBatchAllocateExpressTaskProgress, + orderWaveBatchAllocateStorage, + orderWaveBatchAllocateStorageTaskProgress, + orderWaveBatchRemoveExceptionOrders, + orderWaveBatchRemoveExceptionOrdersTaskProgress +} from '@/api/order.wave/orderwave' + +export const FUNCTION_FORM_REGISTRY: Record = { + FetchGroupOrderForm, + BatchOperationForm +} + +// ============================================================ +// 十三、批量操作表单配置(BatchOperationForm 用) +// ============================================================ + +export interface BatchOperationConfig { + /** 操作标识 */ + action: string + /** 弹窗标题 */ + title: string + /** 确认提示文本({count} 替换为选中数量) */ + confirmText: string + /** 确认按钮类型 */ + confirmType?: 'warning' | 'error' | 'info' | 'success' + /** 确认按钮文本 */ + confirmButtonText: string + /** 成功提示文本 */ + successText: string + /** 失败提示文本 */ + failText: string + /** API 方法(接收 ids 数组) */ + apiMethod: (...args: any[]) => Promise + /** 请求参数 key(默认 'ids') */ + payloadKey?: string + /** + * 从选中行提取 ID 的字段名。 + * + * 单字段(字符串):提取单个字段值组成一维数组。 + * 例 'wave_id' → [101, 102, 103] + * 支持 fallback:'wave_id,wave_no' → 优先 wave_id,无则取 wave_no + * + * 多字段(字符串数组):提取多个字段,组成 Record 数组。 + * 例 ['wave_id', 'wave_no'] → { wave_id: [101,102], wave_no: ['WV001','WV002'] } + * 此时会直接作为请求体传给 API,payloadKey 不再生效。 + * + * 未配置时默认使用 'wave_id'。 + */ + idField?: string | string[] + /** + * 自定义请求体构建函数。 + * 当需要多字段传参时使用(如同时传 wave_ids + warehouse_id), + * 传入完整的选中行数组,返回自定义 payload 对象。 + * 配置此项后,payloadKey / idField 仅用于 UI 展示。 + * + * @example + * payloadBuilder: (rows) => ({ + * wave_ids: rows.map(r => r.wave_id), + * warehouse_id: rows[0]?.warehouse_id + * }) + */ + payloadBuilder?: (rows: Record[]) => Record + /** 是否需要任务进度轮询 */ + useProgress?: boolean + /** 进度查询 API */ + progressApiMethod?: (...args: any[]) => Promise +} + +/** 各操作的配置映射 */ +export const BATCH_OPERATION_CONFIGS: Record = { + batchAutoGrouping: { + action: 'batchAutoGrouping', + title: '批量改为自动加团', + confirmText: '确定将选中的 {count} 个波次改为自动加团状态吗?', + confirmType: 'warning', + confirmButtonText: '确认修改', + successText: '批量改为自动加团成功', + failText: '批量改为自动加团失败', + apiMethod: orderWaveBatchAutoGrouping, + payloadKey: 'ids', + idField: 'wave_id' + }, + batchFinishAutoGrouping: { + action: 'batchFinishAutoGrouping', + title: '批量结束自动加团', + confirmText: '确定结束选中的 {count} 个波次的自动加团吗?', + confirmType: 'success', + confirmButtonText: '确认结束', + successText: '批量结束自动加团成功', + failText: '批量结束自动加团失败', + apiMethod: orderWaveBatchFinishAutoGrouping, + payloadKey: 'ids', + idField: 'wave_id' + }, + batchCancel: { + action: 'batchCancel', + title: '批量取消波次', + confirmText: '确定取消选中的 {count} 个波次吗?此操作不可撤销。', + confirmType: 'error', + confirmButtonText: '确认取消', + successText: '批量取消波次成功', + failText: '批量取消波次失败', + apiMethod: orderWaveBatchCancel, + payloadKey: 'wave_ids', + idField: 'wave_id', + useProgress: true, + progressApiMethod: orderWaveBatchCancelTaskProgress + }, + batchAllocateExpress: { + action: 'batchAllocateExpress', + title: '快速分配快递号', + confirmText: '确定为选中的 {count} 个波次快速分配快递号吗?', + confirmType: 'success', + confirmButtonText: '确认分配', + successText: '快递号分配任务已提交', + failText: '快递号分配失败', + apiMethod: orderWaveBatchAllocateExpress, + payloadKey: 'wave_ids', + idField: 'wave_id', + useProgress: true, + progressApiMethod: orderWaveBatchAllocateExpressTaskProgress + }, + batchAllocateStorage: { + action: 'batchAllocateStorage', + title: '批量分配储位', + confirmText: '确定为选中的 {count} 个波次批量分配储位吗?', + confirmType: 'warning', + confirmButtonText: '确认分配', + successText: '储位分配任务已提交', + failText: '储位分配失败', + apiMethod: orderWaveBatchAllocateStorage, + payloadKey: 'wave_ids', + idField: 'wave_id', + useProgress: true, + progressApiMethod: orderWaveBatchAllocateStorageTaskProgress + }, + batchRemoveExceptionOrders: { + action: 'batchRemoveExceptionOrders', + title: '批量移除异常订单', + confirmText: '确定移除选中的 {count} 个波次中的异常订单吗?', + confirmType: 'error', + confirmButtonText: '确认移除', + successText: '异常订单移除任务已提交', + failText: '移除异常订单失败', + apiMethod: orderWaveBatchRemoveExceptionOrders, + payloadKey: 'wave_ids', + idField: 'wave_id', + useProgress: true, + progressApiMethod: orderWaveBatchRemoveExceptionOrdersTaskProgress + } +} + diff --git a/src/views/order/waveOrder2/index.vue b/src/views/order/waveOrder2/index.vue index 20c3abc5..51a0186d 100644 --- a/src/views/order/waveOrder2/index.vue +++ b/src/views/order/waveOrder2/index.vue @@ -40,32 +40,14 @@
- - - - 刷新 - - - - {{ btn.label }} - - - - 导出 - +
@@ -79,7 +61,7 @@ :column-config-schema-version="1" :table-id="`wave-order2-table-${activeTabName}`" :data="mockList" - :row-key="'id'" + :row-key="'wave_no'" :columns="currentColumns" table-size="small" :pagination="pagination" @@ -152,6 +134,21 @@
+ + + + + @@ -164,13 +161,24 @@ import ScanBox from '@/components/ScanBox/index.vue' import UpperTable from '@/components/UpperTable/index.vue' import TabArea from './components/TabArea.vue' import ColumnCellRenderer from './components/ColumnCellRenderer.vue' +import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue' +import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config' +import FetchGroupOrderForm from './pages/FetchGroupOrderForm.vue' +import BatchOperationForm from './pages/BatchOperationForm.vue' import { WAVEORDER2_PAGE_CONFIG, waveOrder2Tabs, waveOrder2TabPages, - resolveTabConfig + resolveTabConfig, + getTabToolbarButtons, + BATCH_OPERATION_CONFIGS +} from './config/waveorder-config' +import type { + TabPageConfig, + DetailTabConfig, + WaveOrder2ToolbarButtonConfig, + BatchOperationConfig } from './config/waveorder-config' -import type { TabPageConfig, DetailTabConfig } from './config/waveorder-config' defineOptions({ name: 'WaveOrder2' }) @@ -258,11 +266,200 @@ const currentDetailTabApiMethod = computed(() => { return undefined }) -/** 当前标签页的自定义工具栏按钮 */ -const currentToolbarButtons = computed(() => { - return currentTabConfig.value?.toolbar?.left ?? [] + +// ============================================================ +// 工具栏按钮系统(参照 orderManagement 设计) +// ============================================================ + +/** 当前标签页的工具栏按钮列表(从 WAVEORDER2_TOOLBAR_BUTTONS 获取) */ +const currentToolbarButtons = computed(() => { + const btns = getTabToolbarButtons(activeTabName.value) + return btns.map((btn: WaveOrder2ToolbarButtonConfig) => ({ + key: btn.key, + label: btn.label, + size: btn.size, + type: btn.type, + plain: btn.plain, + loadingKey: btn.loadingKey, + disabledKey: btn.disabledKey, + action: btn.action, + dynamicLabelKey: btn.dynamicLabelKey, + buttonType: btn.buttonType, + dropdownOptions: btn.dropdownOptions + })) }) +/** 按钮禁用状态映射 */ +const buttonDisabledMap = computed>(() => ({ + noSelection: selectedRows.value.length === 0 +})) + +/** 按钮加载状态映射 */ +const buttonLoadingMap = computed>(() => ({ + loading: loading.value, + exportLoading: false, + batchAutoGroupingLoading: batchOpLoading.value && currentBatchOpAction.value === 'batchAutoGrouping', + batchFinishAutoGroupingLoading: batchOpLoading.value && currentBatchOpAction.value === 'batchFinishAutoGrouping', + batchCancelLoading: batchOpLoading.value && currentBatchOpAction.value === 'batchCancel', + batchAllocateExpressLoading: batchOpLoading.value && currentBatchOpAction.value === 'batchAllocateExpress', + batchAllocateStorageLoading: batchOpLoading.value && currentBatchOpAction.value === 'batchAllocateStorage', + batchRemoveExceptionOrdersLoading: batchOpLoading.value && currentBatchOpAction.value === 'batchRemoveExceptionOrders' +})) + +/** 按钮动态标签映射 */ +const buttonLabelMap = computed>(() => ({ + detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情' +})) + +/** 工具栏布局 key(变化时触发 OrderToolbarButtonGroup 重排) */ +const toolbarLayoutKey = computed(() => + JSON.stringify({ + loading: buttonLoadingMap.value, + disabled: buttonDisabledMap.value, + labels: buttonLabelMap.value + }) +) + +function resolveButtonLoading(loadingKey?: string) { + if (!loadingKey) return false + return Boolean(buttonLoadingMap.value[loadingKey]) +} + +function resolveButtonDisabled(disabledKey?: string) { + if (!disabledKey) return false + return Boolean(buttonDisabledMap.value[disabledKey]) +} + +function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) { + if (!dynamicLabelKey) return defaultLabel + return buttonLabelMap.value[dynamicLabelKey] || defaultLabel +} + +// ============================================================ +// 工具栏动作分发 +// ============================================================ + +/** 基础工具栏动作映射 */ +const toolbarActionMap: Record void> = { + loadData: () => { void loadMockData() }, + openColumnConfigPanel: () => { upperTableRef.value?.openColumnConfig?.() }, + toggleDetailVisible: () => { detailVisible.value = !detailVisible.value }, + handleExportWaybill: () => { console.log('[WaveOrder2] 导出(不含明细)', activeTabName.value) }, + handleExportItem: () => { console.log('[WaveOrder2] 导出(含明细)', activeTabName.value) } +} + +/** 统一工具栏按钮点击处理 */ +function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) { + const handler = toolbarActionMap[action] + if (handler) { + handler() + return + } + // 功能按钮:打开对应表单 + handleFunctionButtonAction(action) +} + +// ============================================================ +// 功能按钮表单状态 +// ============================================================ + +/** 团购单抓取表单 */ +const fetchGroupOrderFormVisible = ref(false) + +/** 批量操作表单 */ +const batchOperationFormVisible = ref(false) +const batchOperationConfig = ref(null) +const batchOperationSelectedIds = ref([]) +/** 多字段提取结果(idField 为数组时使用),直接作为请求体 */ +const batchOperationExtractedPayload = ref | null>(null) +const batchOpLoading = ref(false) +const currentBatchOpAction = ref('') + +/** 功能按钮 action → 表单打开逻辑 */ +function handleFunctionButtonAction(action: string) { + switch (action) { + case 'openFetchGroupOrderForm': + openFetchGroupOrderForm() + break + case 'openBatchAutoGroupingForm': + case 'openBatchFinishAutoGroupingForm': + case 'openBatchCancelForm': + case 'openBatchAllocateExpressForm': + case 'openBatchAllocateStorageForm': + case 'openBatchRemoveExceptionOrdersForm': + openBatchOperationForm(action) + break + default: + console.warn('[WaveOrder2] 未处理的工具栏动作:', action) + } +} + +function openFetchGroupOrderForm() { + fetchGroupOrderFormVisible.value = true +} + +function openBatchOperationForm(action: string) { + if (!selectedRows.value.length) { + ElMessage.warning('请先选择波次') + return + } + + // 根据 action 推导对应的批量操作 key + const opKey = action.replace('open', '').replace('Form', '') + // openBatchAutoGroupingForm → BatchAutoGrouping → batchAutoGrouping + const configKey = opKey.charAt(0).toLowerCase() + opKey.slice(1) + + const cfg = BATCH_OPERATION_CONFIGS[configKey] + if (!cfg) { + console.warn('[WaveOrder2] 未找到批量操作配置:', configKey) + return + } + + currentBatchOpAction.value = cfg.action + batchOperationConfig.value = { ...cfg } + + const idField = cfg.idField ?? 'wave_id' + + if (Array.isArray(idField)) { + // 多字段模式:提取所有字段,组装为 { field1: [...], field2: [...] } + const payload: Record = {} + for (const field of idField) { + payload[field] = [] + } + for (const row of selectedRows.value) { + for (const field of idField) { + const val = (row as any)[field] + payload[field]!.push(val !== undefined && val !== null ? val : null) + } + } + batchOperationExtractedPayload.value = payload + // selectedIds 用第一个字段的值供 UI 展示 + const firstField = idField[0] + batchOperationSelectedIds.value = firstField ? (payload[firstField]?.filter((v: any) => v !== null) ?? []) : [] + } else { + // 单字段模式(支持逗号分隔 fallback) + batchOperationExtractedPayload.value = null + const idFields = (idField as string).split(',').map((f: string) => f.trim()) + batchOperationSelectedIds.value = selectedRows.value + .map((r: any) => { + for (const field of idFields) { + const val = r[field] + if (val !== undefined && val !== null && val !== '') return val + } + return null + }) + .filter((v: any) => v !== null) + } + batchOperationFormVisible.value = true +} + +/** 表单操作成功后刷新列表 */ +function handleFormSuccess() { + selectedRows.value = [] + pagination.currentPage = 1 + loadMockData() +} + /** 切换标签页时重置状态并加载新数据 */ const handleTabChange = (tabName: string) => { if (activeTabName.value === tabName) return @@ -392,29 +589,6 @@ const handlePageSizeChange = (size: number) => { loadMockData() } -// ===== 工具栏 ===== -const handleRefresh = () => { - pagination.currentPage = 1 - loadMockData() -} - -const handleExport = () => { - console.log('[WaveOrder2] 导出数据', activeTabName.value) -} - -/** 自定义工具栏按钮点击 */ -const handleToolbarAction = (key: string) => { - console.log('[WaveOrder2] 工具栏操作:', key, activeTabName.value) - // 各标签页可在此扩展处理逻辑 - switch (key) { - case 'batchAssign': // 示例:批量分配 - console.log('批量分配选中行:', selectedRows.value) - break - default: - break - } -} - // ===== UpperTable ===== const upperTableRef = ref(null) const selectedRows = ref[]>([]) diff --git a/src/views/order/waveOrder2/pages/BatchOperationForm.vue b/src/views/order/waveOrder2/pages/BatchOperationForm.vue new file mode 100644 index 00000000..1039f6c9 --- /dev/null +++ b/src/views/order/waveOrder2/pages/BatchOperationForm.vue @@ -0,0 +1,246 @@ + + + + + + diff --git a/src/views/order/waveOrder2/pages/FetchGroupOrderForm.vue b/src/views/order/waveOrder2/pages/FetchGroupOrderForm.vue new file mode 100644 index 00000000..7d42d1c3 --- /dev/null +++ b/src/views/order/waveOrder2/pages/FetchGroupOrderForm.vue @@ -0,0 +1,490 @@ + + + + + + diff --git a/src/views/storage/report/report-config.ts b/src/views/storage/report/report-config.ts index d62020d7..4a22bef9 100644 --- a/src/views/storage/report/report-config.ts +++ b/src/views/storage/report/report-config.ts @@ -168,6 +168,7 @@ export const REPORT_SCAN_FIELD_GROUPS = { time: '统计配置', owner: '货主信息', options: '统计选项', + keyword: '关键字搜索', } as const type ReportScanFieldGroupKey = keyof typeof REPORT_SCAN_FIELD_GROUPS diff --git a/src/views/store/stores/index.vue b/src/views/store/stores/index.vue index 1b0b1ef1..90764ed4 100644 --- a/src/views/store/stores/index.vue +++ b/src/views/store/stores/index.vue @@ -910,7 +910,7 @@ import { storeWarehouseList, storeWarehouseUnbind, storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig, storeWarehouseAdjustPrintQuantity, storeWarehouseQueryPrintQuantityLogs, listApiConfig, storeWarehouseOpenAccount, storeWarehouseConfirmSign -} from '@/api/storeWarehouse.store/storeWarehouse' +} from '@/api/storewarehouse.store/storeWarehouse' import { listInterfaceTypes, getExpressList, getPlatformList, getQimenAppList } from '@/api/index/index' import ScanBox from '@/components/ScanBox/index.vue' import UpperTable from '@/components/UpperTable/index.vue' diff --git a/src/views/system/setting/workbench/index.vue b/src/views/system/setting/workbench/index.vue new file mode 100644 index 00000000..a5011727 --- /dev/null +++ b/src/views/system/setting/workbench/index.vue @@ -0,0 +1,463 @@ + + + + + \ No newline at end of file diff --git a/src/views/system/setting/workbench/workbench-config.ts b/src/views/system/setting/workbench/workbench-config.ts new file mode 100644 index 00000000..e844cd72 --- /dev/null +++ b/src/views/system/setting/workbench/workbench-config.ts @@ -0,0 +1,151 @@ +export type WorkbenchRecord = { + id?: number + warehouse_id?: number + name?: string + barcode?: string + status?: number + remark?: string + created_at?: string + updated_at?: string + deleted_at?: string | null +} + +export type WorkbenchDetail = WorkbenchRecord + +export const workbenchColumns = [ + { prop: 'id', label: 'ID', width: '80', sortable: true }, + { prop: 'name', label: '工作台名称', minWidth: '140', showOverflowTooltip: true }, + { prop: 'barcode', label: '条码', minWidth: '120', showOverflowTooltip: true }, + { prop: 'warehouse_id', label: '仓库ID', width: '100' }, + { prop: 'status', label: '状态', width: '80' }, + { prop: 'remark', label: '备注', minWidth: '140', showOverflowTooltip: true }, + { prop: 'created_at', label: '创建时间', minWidth: '160' }, + { prop: 'updated_at', label: '更新时间', minWidth: '160' }, + { prop: 'actions', label: '操作', width: '200', fixed: 'right' } +] + +export const workbenchScanFields = [ + { + value: 'quickWhere', + label: '关键词', + type: 'text', + placeholder: '名称/条码', + operators: ['contains'], + defaultOperator: 'contains' + }, + { + value: 'name', + label: '名称', + type: 'text', + placeholder: '请输入工作台名称', + operators: ['eq', 'contains', 'like'], + defaultOperator: 'contains' + }, + { + value: 'barcode', + label: '条码', + type: 'text', + placeholder: '请输入条码', + operators: ['eq', 'contains', 'like'], + defaultOperator: 'contains' + }, + { + value: 'status', + label: '状态', + type: 'select', + clearable: true, + options: [ + { label: '启用', value: '1' }, + { label: '禁用', value: '0' } + ] + } +] + +export function formatWorkbenchStatus(status: unknown): { text: string; type: 'success' | 'info' } { + const v = Number(status ?? 1) + return v === 1 ? { text: '启用', type: 'success' } : { text: '禁用', type: 'info' } +} + +function pad(n: number) { + return String(n).padStart(2, '0') +} + +export function formatTime(value: unknown): string { + if (!value) return '--' + const d = new Date(value as string) + if (isNaN(d.getTime())) return String(value) + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}` +} + +function getFieldConfig(key: string, fields: typeof workbenchScanFields) { + return fields.find((f) => f.value === key) +} + +function mapFieldType(type: string, value: unknown) { + if (typeof value === 'number') return 'number' + return 'text' +} + +function processConditionValue(key: string, raw: any, fields: typeof workbenchScanFields) { + if (key === 'quickWhere') { + const val = raw?.value !== undefined ? raw.value : raw + const text = val == null ? '' : String(val).trim() + return text ? text : null + } + + const config = getFieldConfig(key, fields) + const fieldType = config?.type || 'text' + + if (raw && typeof raw === 'object' && !Array.isArray(raw)) { + const op = raw.operator || (fieldType === 'select' ? 'eq' : 'contains') + const type = raw.type || mapFieldType(fieldType, raw.value) + const value = raw.value + + if (fieldType === 'select') { + return { operator: 'eq', value: value != null ? Number(value) : undefined } + } + return { operator: op, type, value } + } + + if (fieldType === 'select') { + return raw != null ? { operator: 'eq', value: Number(raw) } : null + } + if (fieldType === 'number' && raw != null) { + return { operator: 'eq', value: Number(raw) } + } + + return raw != null ? raw : null +} + +export function normalizeWorkbenchScanConditionToWhere(rawCondition: any): Record { + if (!rawCondition) return {} + + const where: Record = {} + const entries = Array.isArray(rawCondition) ? rawCondition : Object.entries(rawCondition) + + for (const [key, raw] of entries) { + const processed = processConditionValue(String(key), raw, workbenchScanFields) + if (processed == null) continue + + if (key === 'quickWhere') { + where.name = { operator: 'contains', value: processed } + where.barcode = { operator: 'contains', value: processed } + continue + } + + where[key] = processed + } + + return where +} + +export function buildWorkbenchListPayload(params: { + page: number + pageSize: number + where?: Record +}) { + return { + pagination: { page: params.page, pageSize: params.pageSize }, + where: params.where || {} + } +} diff --git a/src/views/warehouses/index.vue b/src/views/warehouses/index.vue index 0d1bfc68..fc739366 100644 --- a/src/views/warehouses/index.vue +++ b/src/views/warehouses/index.vue @@ -352,7 +352,7 @@ import { storeWarehouseUnbind, storeWarehouseRename, listApiConfig -} from '@/api/storeWarehouse.store/storeWarehouse' +} from '@/api/storewarehouse.store/storeWarehouse' import { listInterfaceTypes, getQimenAppList } from '@/api/index/index' import ScanBox from '@/components/ScanBox/index.vue' import UpperTable from '@/components/UpperTable/index.vue'