Compare commits

..

No commits in common. "b12420e5a9f7d61f2d4a9687ba2aab726bf81d10" and "41a3563bce2e68ef7119ba33cdbd7f03073866bc" have entirely different histories.

7 changed files with 12 additions and 177 deletions

View File

@ -150,12 +150,6 @@ export type StockCheckTask = {
checked_items: number
/** 差异行数 */
diff_items: number
/**
* 是否静态盘点:0=关闭 / 1=开启(库位盘点恒为 0)
*
* 部分回包可能写成驼峰 `isStatic` 或布尔值,前端判定统一走 `isStaticCheckRow()`。
*/
is_static?: number | boolean | null
remark: string
created_at?: string
updated_at?: string
@ -363,11 +357,6 @@ export type StockCheckResultRow = StockCheckDetailRow & {
*
* mode 口径:按库位盘点(type=location)一律盲盘 blind(前端传值被忽略);
* 按商品盘点(type=store/goods)按传入值(默认明盘 open)。
*
* isStatic 口径:**仅商品盘点(type=store/goods)有效**,0=关闭(缺省)/1=开启;
* 按库位盘点(type=location)不显示该选项、**不传该字段**。
* 开启静态盘点的任务审核通过后会锁定移库 / 分配储位操作(拣货不受影响),
* 待盘点完成(finish)后由后端自动解锁。
*/
export type StockCheckCreateParams = {
/** 盘点名称/主题 */
@ -383,13 +372,6 @@ export type StockCheckCreateParams = {
mode?: StockCheckMode
/** 货主ID(type=store 时必填;添加商品明细时商品货主必须与该货主一致) */
store_id?: number
/**
* 是否静态盘点:0=关闭(缺省)/ 1=开启
*
* 仅商品盘点(type=store / goods)有效;库位盘点(type=location)不显示选项、不传。
* 开启后审核通过会锁定移库 / 分配储位操作(拣货不受影响),盘点完成后自动解锁。
*/
isStatic?: 0 | 1
remark?: string
}

View File

@ -5,7 +5,7 @@ const v = "1.0"
/** storage.inventory.list 请求参数 */
export type InventoryListParams = {
/** 统一 where 条件对象,可用字段:stock_id(商品ID)、space_id(库位ID)、store_id(货主ID)、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、batch_no(批次号)、inbound_order_no(入库单号)、available_quantity(可用数量,支持 gt/lt)、inbound_time(入库时间,支持 between)、created_at(创建时间,支持 between)、stock_query(虚拟筛选字段:按商品编码/名称/货物编码/条码/SKU ID 匹配;value 可传单个值或数组,如 { operator: 'like', value: '111' } / { operator: 'contains', value: ['111', '6971587968127'], type: 'text' }) */
/** 统一 where 条件对象,可用字段:stock_id(商品ID)、space_id(库位ID)、store_id(货主ID)、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、batch_no(批次号)、inbound_order_no(入库单号)、available_quantity(可用数量,支持 gt/lt)、inbound_time(入库时间,支持 between)、created_at(创建时间,支持 between)、stock_query(虚拟筛选字段:按商品编码/名称/货物编码/条码/SKU ID 模糊匹配,如 { operator: 'like', value: '111' }) */
where?: Record<string, any>
/** 分页参数 { page, pageSize },默认 page=1, pageSize=20 */
pagination?: { page?: number; pageSize?: number }

View File

@ -4,8 +4,7 @@
根据 operationButtons 配置渲染按钮列表。
支持的行为类型:
- actionType='action' → 触发 @operation-action 事件(可选配置 confirmMessage 弹确认框;
confirmMessageWhen(row) 可按行数据覆盖确认文案,confirmUseHtml 允许 HTML 渲染)
- actionType='action' → 触发 @operation-action 事件(可选配置 confirmMessage 弹确认框)
- actionType='form' → 打开 COMPONENT_REGISTRY 中注册的表单组件
显隐与禁用:
@ -91,17 +90,15 @@ const actionLoadingMap = reactive<Record<string, boolean>>({})
// ============================================================
async function handleActionClick(btn: OperationButtonConfig) {
const confirmMessage = resolveConfirmMessage(btn)
if (confirmMessage) {
if (btn.confirmMessage) {
try {
await ElMessageBox.confirm(
confirmMessage,
btn.confirmMessage,
btn.confirmTitle || '确认操作',
{
confirmButtonText: btn.confirmButtonText || '确定',
cancelButtonText: '取消',
type: (btn.confirmType || 'warning') as any,
dangerouslyUseHTMLString: Boolean(btn.confirmUseHtml),
buttonSize: 'small'
}
)
@ -118,19 +115,6 @@ async function handleActionClick(btn: OperationButtonConfig) {
}
}
/** 确认文案:confirmMessageWhen(row) 优先,返回空则回退静态 confirmMessage */
function resolveConfirmMessage(btn: OperationButtonConfig): string {
if (typeof btn.confirmMessageWhen === 'function') {
try {
const dynamic = btn.confirmMessageWhen(props.row)
if (dynamic) return dynamic
} catch {
/* 忽略,回退静态 confirmMessage */
}
}
return btn.confirmMessage || ''
}
// ============================================================
// form 按钮:打开表单弹窗
// ============================================================

View File

@ -225,18 +225,6 @@ export const VALUE_MAPS: Record<string, Record<string, string>> = {
open: '明盘',
blind: '盲盘'
},
/**
* 是否静态盘点 is_static(0=关闭 / 1=开启;回包兼容布尔 true/false)
*
* 仅商品盘点可用;开启的任务审核通过后会锁定移库 / 分配储位(拣货不受影响),
* 盘点完成后由后端自动解锁。
*/
is_static: {
'1': '开启',
'0': '关闭',
true: '开启',
false: '关闭'
},
/** 明细行形态 scope_type(明细行的类型:商品行 / 库位行) */
scope_type: {
goods: '商品',
@ -290,20 +278,6 @@ export function isLegacyAllCheckType(type: unknown): boolean {
return String(type ?? '').trim().toLowerCase() === 'all'
}
/**
* 任务是否开启「静态盘点」
*
* 仅商品盘点(type=store/goods)有效,库位盘点恒为关闭。
* 回包字段可能是 `is_static`(下划线)或 `isStatic`(驼峰),值可能是 0/1 或布尔,
* 这里统一归一,供列表标记 / 审核提示 / 操作成功文案复用。
*/
export function isStaticCheckRow(row: Record<string, any> | null | undefined): boolean {
if (!row) return false
if (isLocationScopeType(row.type)) return false
const raw = row.is_static ?? row.isStatic
return raw === true || Number(raw) === 1 || String(raw ?? '').trim() === '1'
}
/** 翻译 value → label */
export function translate(field: string, value: any): string {
const map = VALUE_MAPS[field]
@ -479,22 +453,6 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
table: { minWidth: 100, align: 'center' },
slot: { type: 'tag', tagType: 'info', translateField: 'mode' }
},
/**
* 静态盘点标记(is_static,仅商品盘点可开启)
*
* 开启后:审核通过会锁定移库 / 分配储位操作(拣货不受影响),盘点完成后自动解锁。
*/
is_static: {
key: 'is_static',
label: '静态盘点',
scanBox: null,
table: { minWidth: 90, align: 'center' },
slot: {
type: 'tag',
tagType: { '1': 'warning', '0': 'info', true: 'warning', false: 'info' },
translateField: 'is_static'
}
},
status: {
key: 'status',
label: '盘点状态',
@ -641,13 +599,6 @@ export interface OperationButtonConfig {
*/
labelWhen?: (row: Record<string, any>) => string
confirmMessage?: string
/**
* 按行数据动态覆盖确认文案(返回空串/undefined 时回退 confirmMessage)
* 例:审核通过时,开启静态盘点的任务需额外提示移库/分配储位锁定
*/
confirmMessageWhen?: (row: Record<string, any>) => string
/** 确认文案是否按 HTML 渲染(confirmMessageWhen 需换行/高亮时开启) */
confirmUseHtml?: boolean
confirmTitle?: string
confirmType?: 'warning' | 'danger' | 'info'
confirmButtonText?: string
@ -1170,7 +1121,6 @@ const TABLE_COLUMN_KEYS = [
'title',
'type',
'mode',
'is_static',
'store_name',
'status',
'detail_status',
@ -1189,7 +1139,7 @@ const DETAIL_SECTIONS = [
{
title: '基本信息',
columnCount: 3,
fieldKeys: ['check_no', 'title', 'type', 'mode', 'is_static', 'status', 'detail_status', 'store_id', 'store_name']
fieldKeys: ['check_no', 'title', 'type', 'mode', 'status', 'detail_status', 'store_id', 'store_name']
},
{
title: '进度信息',
@ -1250,18 +1200,6 @@ const OPERATION_BUTTONS: OperationButtonConfig[] = [
actionType: 'action',
type: 'primary',
confirmMessage: '审核通过后即可开始盘点作业。确定通过?',
// 开启静态盘点:审核通过后锁定移库 / 分配储位(拣货不受影响),盘点完成后自动解锁
confirmMessageWhen: (row) =>
isStaticCheckRow(row)
? '<div>该盘点单已开启<b>静态盘点</b>,审核通过后:</div>' +
'<ul style="margin: 6px 0 8px; padding-left: 18px; line-height: 1.7;">' +
'<li>锁定<b>移库</b>、<b>分配储位</b>操作</li>' +
'<li><b>拣货不受影响</b></li>' +
'<li>需等盘点完成后自动解锁</li>' +
'</ul>' +
'<div>确定通过?</div>'
: '',
confirmUseHtml: true,
confirmTitle: '审核通过',
confirmType: 'info',
confirmButtonText: '确定通过',

View File

@ -361,7 +361,6 @@ import {
getTabToolbarButtons,
isCheckApiSuccess,
isLocationScopeType,
isStaticCheckRow,
loadStoreOptions,
storeOptions,
buildWhereConditions,
@ -567,16 +566,9 @@ async function handleOperationAction(key: string, row: Record<string, any>) {
case 'submitCheck':
await runCheckAction(() => stockCheckSubmit({ id }), '已提交审核')
break
case 'auditPass': {
const staticTip = isStaticCheckRow(row)
? ',已锁定移库/分配储位,盘点完成后自动解锁'
: ''
await runCheckAction(
() => stockCheckAudit({ id, action: 'approve' }),
`审核已通过${staticTip}`
)
case 'auditPass':
await runCheckAction(() => stockCheckAudit({ id, action: 'approve' }), '审核已通过')
break
}
case 'auditReject':
await handleAuditReject(row)
break

View File

@ -10,9 +10,6 @@
- mode 盘点方式:open 明盘 / blind 盲盘
—— 库位类(location)固定为 blind 盲盘且不可更改;商品类(store / goods)默认明盘
- store_id 货主ID(type=store 时必填)
- isStatic 是否静态盘点:0 关闭(缺省)/ 1 开启
—— **仅商品盘点(store / goods)有效**,库位盘点不显示选项且不传;
开启后审核通过会锁定移库 / 分配储位操作(拣货不受影响),盘点完成后自动解锁
- remark 备注
盘点时间不在本表单维护:主表已无 check_date,start_time(首个盘点明细写入时间)/
end_time(完成盘点时间)由盘点作业流程自动回填,前端不传。
@ -81,16 +78,6 @@
<span v-else-if="form.mode === 'blind'" class="form-tip">盲盘:盘点作业时前端不显示账面数量</span>
</el-form-item>
<el-form-item v-if="!isLocationType" label="静态盘点" prop="isStatic">
<el-radio-group v-model="form.isStatic">
<el-radio :value="0">关闭</el-radio>
<el-radio :value="1">开启</el-radio>
</el-radio-group>
<span v-if="form.isStatic === 1" class="form-tip form-tip--block">
开启后:审核通过将锁定移库、分配储位操作(拣货不受影响),盘点完成后自动解锁
</span>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" maxlength="200" show-word-limit placeholder="可留空" />
</el-form-item>
@ -160,15 +147,12 @@ const form = reactive<{
type: StockCheckType
store_id: number | undefined
mode: StockCheckMode
/** 是否静态盘点:0=关闭 / 1=开启(仅商品盘点可传,库位盘点不传) */
isStatic: 0 | 1
remark: string
}>({
title: '',
type: 'location',
store_id: undefined,
mode: 'blind',
isStatic: 0,
remark: ''
})
@ -191,8 +175,6 @@ watch(
() => form.type,
(type) => {
form.mode = isLocationScopeType(type) ? 'blind' : 'open'
// 静态盘点仅商品盘点有效,库位盘点重置为关闭
if (isLocationScopeType(type)) form.isStatic = 0
}
)
@ -219,7 +201,6 @@ function resetForm() {
form.type = 'location'
form.store_id = undefined
form.mode = 'blind'
form.isStatic = 0
form.remark = ''
}
@ -249,8 +230,6 @@ async function handleSubmit() {
type: form.type,
mode: form.mode,
store_id: form.type === 'store' ? form.store_id : undefined,
// 静态盘点仅商品盘点(store/goods)有效:库位盘点不显示选项、不传该字段
...(isLocationType.value ? {} : { isStatic: form.isStatic }),
remark: form.remark.trim() || undefined
})
if (!isCheckApiSuccess(res)) {
@ -301,15 +280,6 @@ async function handleSubmit() {
color: #909399;
}
/* 独立成行的提示(宽占满、无左间距),沿用 warning 色 */
.form-tip--block {
display: block;
margin-left: 0;
margin-top: 2px;
width: 100%;
line-height: 1.5;
}
.type-tip {
width: 100%;
margin-top: 2px;

View File

@ -3,8 +3,6 @@
两种模式(由来源盘点单的 type 决定):
- 商品类(type=store/goods):从 storage.inventory.list 勾选商品 → stock.check.addDetail 传 stock_ids
· 商品查询框支持**换行一行一个**(去空行、去重),整体作为
`where.stock_query = { operator: 'contains', value: [...], type: 'text' }` 数组查询
· ⚠️ 服务端按「商品 + 库存库位」**拆行**:一个商品在该仓库的每个**启用库存库位**各生成一条
明细行(location_id/location_code 快照 + 账面取该库位库存),故「新增条数」可能多于所选商品数
· 无启用库存库位的商品不入明细,计入 invalid_stock_ids(提示为「无效商品」)
@ -64,18 +62,12 @@
<div class="task-panel__toolbar-main">
<el-input
v-model="filters.keyword"
type="textarea"
size="small"
clearable
:autosize="{ minRows: 1, maxRows: 4 }"
resize="none"
placeholder="商品编码 / 名称 / 条码,一行一个"
placeholder="商品编码 / 名称 / 条码"
class="filter-item filter-item--keyword"
@keydown.ctrl.enter.prevent="handleSearch"
@keyup.enter="handleSearch"
/>
<span v-if="keywordList.length > 1" class="filter-keyword-count">
已识别 {{ keywordList.length }} 个查询值
</span>
<el-input
v-model="filters.batch_no"
size="small"
@ -413,18 +405,6 @@ const submitChannelTip = computed(() => {
})
const filters = reactive({ keyword: '', batch_no: '' })
/**
* 商品查询关键字:支持换行一行一个,逐行去空格、去空行、去重
*
* 查询时整体作为 `where.stock_query.value` 数组下发(operator=contains / type=text),
* 后端按商品编码 / 名称 / 条码等字段对数组内每个值做匹配。
*/
const keywordList = computed<string[]>(() => {
const parts = String(filters.keyword ?? '').split(/\r?\n/)
return [...new Set(parts.map((s) => s.trim()).filter(Boolean))]
})
const rows = ref<Record<string, any>[]>([])
const loading = ref(false)
const submitting = ref(false)
@ -506,7 +486,7 @@ function mapRow(item: any, index: number): Record<string, any> {
async function loadRows() {
loading.value = true
try {
const keywords = keywordList.value
const keyword = filters.keyword.trim()
const batchNo = filters.batch_no.trim()
const res: any = await getInventoryList({
where: {
@ -514,11 +494,8 @@ async function loadRows() {
...(boundStoreId.value
? { store_id: { operator: 'eq', value: boundStoreId.value, type: 'number' } }
: {}),
// stock_query 为虚拟筛选字段:按商品编码/名称/条码/SKU ID 匹配;
// 支持换行一行一个 → value 传数组,由后端逐值匹配
...(keywords.length
? { stock_query: { operator: 'contains', value: keywords, type: 'text' } }
: {}),
// stock_query 为虚拟筛选字段:按商品编码/名称/条码/SKU ID 模糊匹配
...(keyword ? { stock_query: { operator: 'like', value: keyword } } : {}),
...(batchNo ? { batch_no: batchNo } : {})
},
pagination: { page: pagination.page, pageSize: pagination.pageSize },
@ -973,14 +950,6 @@ watch(
width: 260px;
}
/* 商品查询支持换行一行一个:提示已识别多少个查询值 */
.filter-keyword-count {
font-size: 12px;
line-height: 20px;
color: #909399;
flex-shrink: 0;
}
/* 表格固定高度:数据少也保持同样大小,超出时表格内部滚动(短屏自适应) */
.picker-table {
height: min(520px, calc(100vh - 340px));