521
This commit is contained in:
parent
6a2abf37ff
commit
6d2f39a4c9
@ -210,6 +210,21 @@ export function listInterfaceTypes() {
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取奇门 ERP 应用列表(用于选择 ERP / AppKey) */
|
||||||
|
export function getQimenAppList(data?: Record<string, unknown>) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'index.getQimenAppList',
|
||||||
|
v: '1.0',
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: data ?? {},
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
export function searchSpace(data:any){
|
export function searchSpace(data:any){
|
||||||
return request({
|
return request({
|
||||||
url: '/system',
|
url: '/system',
|
||||||
|
|||||||
@ -19,12 +19,16 @@ export type GetWavePlatformPrintDataParams = {
|
|||||||
wave_ids: Array<number | string>
|
wave_ids: Array<number | string>
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 接口文档:summary / wave_ids / waveGroups(主)/ platform_groups、order_list(兼容)/ ext */
|
/** 接口文档:summary / wave_ids / waveGroups(主)/ locked_wave_groups(锁定)/ platform_groups、order_list(兼容)/ ext */
|
||||||
export type WavePlatformPrintDataPayload = {
|
export type WavePlatformPrintDataPayload = {
|
||||||
summary?: Record<string, unknown>
|
summary?: Record<string, unknown>
|
||||||
wave_ids?: Array<number | string>
|
wave_ids?: Array<number | string>
|
||||||
/** 主返回:波次 → 平台 → 订单 */
|
/** 主返回:波次 → 平台 → 订单 */
|
||||||
waveGroups?: unknown[]
|
waveGroups?: unknown[]
|
||||||
|
/** 锁定波次:结构与 waveGroups 一致 */
|
||||||
|
locked_wave_groups?: unknown[]
|
||||||
|
locked_orders?: Record<string, unknown>[]
|
||||||
|
locked_count?: number
|
||||||
platform_groups?: unknown[]
|
platform_groups?: unknown[]
|
||||||
order_list?: Record<string, unknown>[]
|
order_list?: Record<string, unknown>[]
|
||||||
ext?: Record<string, unknown>
|
ext?: Record<string, unknown>
|
||||||
|
|||||||
@ -156,6 +156,27 @@ export function storeWarehouseAdjustPrintQuantity(data: {
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 按 store_id 分页查询面单余额变更日志 */
|
||||||
|
export function storeWarehouseQueryPrintQuantityLogs(data: {
|
||||||
|
store_id: number | string
|
||||||
|
pagination?: {
|
||||||
|
page?: number
|
||||||
|
page_size?: number
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'storeWarehouse.store.queryPrintQuantityLogs',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 查询签约关系下的奇门接口配置列表 */
|
/** 查询签约关系下的奇门接口配置列表 */
|
||||||
export function listApiConfig(data: {
|
export function listApiConfig(data: {
|
||||||
@ -177,7 +198,7 @@ export function listApiConfig(data: {
|
|||||||
|
|
||||||
/** 保存接口配置(新增或更新)
|
/** 保存接口配置(新增或更新)
|
||||||
* - app_name:必传,不再自动生成
|
* - app_name:必传,不再自动生成
|
||||||
* - QM_WMS 类型:须填写 qimen_app_key / qimen_customer_id / qimen_warehouse_code
|
* - QM_WMS 类型:须填写 qimen_app_key(ERP)/ qimen_warehouse_code
|
||||||
* - OPEN_API 类型:系统自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),无需传入奇门字段
|
* - OPEN_API 类型:系统自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),无需传入奇门字段
|
||||||
*/
|
*/
|
||||||
export function saveApiConfig(data: {
|
export function saveApiConfig(data: {
|
||||||
@ -185,8 +206,8 @@ export function saveApiConfig(data: {
|
|||||||
interface_type_id: number
|
interface_type_id: number
|
||||||
/** 应用名称(必传,不再自动生成) */
|
/** 应用名称(必传,不再自动生成) */
|
||||||
app_name: string
|
app_name: string
|
||||||
|
/** ERP AppKey(来自 index.getQimenAppList 下拉选择) */
|
||||||
qimen_app_key?: string
|
qimen_app_key?: string
|
||||||
qimen_customer_id?: string
|
|
||||||
qimen_warehouse_code?: string
|
qimen_warehouse_code?: string
|
||||||
api_version?: string
|
api_version?: string
|
||||||
contact_person?: string
|
contact_person?: string
|
||||||
|
|||||||
@ -32,11 +32,12 @@
|
|||||||
<div class="wave-print-meta">
|
<div class="wave-print-meta">
|
||||||
<span>仓库:<code>{{ requestMeta?.warehouse_id ?? '—' }}</code></span>
|
<span>仓库:<code>{{ requestMeta?.warehouse_id ?? '—' }}</code></span>
|
||||||
<span>请求波次:<code>{{ requestMeta?.wave_ids?.length ?? 0 }}</code></span>
|
<span>请求波次:<code>{{ requestMeta?.wave_ids?.length ?? 0 }}</code></span>
|
||||||
<span>返回波次:<code>{{ waveGroupList.length }}</code></span>
|
<span>返回普通波次:<code>{{ waveGroupList.length }}</code></span>
|
||||||
|
<span>返回锁定波次:<code>{{ lockedWaveGroupList.length }}</code></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="wave-print-section">
|
<section class="wave-print-section">
|
||||||
<h4 class="wave-print-section__title">波次 / 平台列表</h4>
|
<h4 class="wave-print-section__title">普通波次 / 平台列表</h4>
|
||||||
<div v-if="hasWaveGroups" class="wave-group-list">
|
<div v-if="hasWaveGroups" class="wave-group-list">
|
||||||
<article v-for="wave in waveGroupList" :key="wave.waveKey" class="wave-group-card">
|
<article v-for="wave in waveGroupList" :key="wave.waveKey" class="wave-group-card">
|
||||||
<header class="wave-group-card__header">
|
<header class="wave-group-card__header">
|
||||||
@ -73,6 +74,45 @@
|
|||||||
</div>
|
</div>
|
||||||
<p v-else class="wave-print-muted wave-print-section__sub">(无 waveGroups)</p>
|
<p v-else class="wave-print-muted wave-print-section__sub">(无 waveGroups)</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="wave-print-section wave-print-section--locked">
|
||||||
|
<h4 class="wave-print-section__title">锁定波次 / 平台列表</h4>
|
||||||
|
<div v-if="hasLockedWaveGroups" class="wave-group-list">
|
||||||
|
<article v-for="wave in lockedWaveGroupList" :key="wave.waveKey" class="wave-group-card wave-group-card--locked">
|
||||||
|
<header class="wave-group-card__header">
|
||||||
|
<div class="wave-group-card__title">
|
||||||
|
<span>波次:</span>
|
||||||
|
<code>{{ wave.wave_no }}</code>
|
||||||
|
<span class="wave-group-card__sep">|</span>
|
||||||
|
<span>ID:</span>
|
||||||
|
<code>{{ wave.wave_id }}</code>
|
||||||
|
</div>
|
||||||
|
<div class="wave-group-card__meta">
|
||||||
|
<el-tag size="small" type="info">平台 {{ wave.platforms.length }}</el-tag>
|
||||||
|
<el-tag size="small" type="warning">锁定订单 {{ wave.order_count }}</el-tag>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div v-if="wave.platforms.length" class="wave-platform-list">
|
||||||
|
<article v-for="platform in wave.platforms" :key="platform.platformKey" class="wave-platform-card wave-platform-card--locked">
|
||||||
|
<div class="wave-platform-card__header">
|
||||||
|
<div class="wave-platform-card__title">
|
||||||
|
<span v-if="platform.sys_logistics_name" class="wave-platform-card__logistics">{{
|
||||||
|
platform.sys_logistics_name
|
||||||
|
}}</span>
|
||||||
|
<span v-if="platform.sys_logistics_name" class="wave-platform-card__sep-inline">|</span>
|
||||||
|
{{ platform.platform_name }}
|
||||||
|
<span class="wave-platform-card__code">{{ platform.platform }}</span>
|
||||||
|
</div>
|
||||||
|
<el-tag size="small" type="danger">锁定订单 {{ platform.order_count }}</el-tag>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<p v-else class="wave-print-muted">(该锁定波次无平台数据)</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<p v-else class="wave-print-muted wave-print-section__sub">(无 locked_wave_groups)</p>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="wave-print-muted">(无数据)</div>
|
<div v-else class="wave-print-muted">(无数据)</div>
|
||||||
|
|
||||||
@ -149,17 +189,7 @@ const visibleProxy = computed({
|
|||||||
set: (v: boolean) => emit('update:modelValue', v)
|
set: (v: boolean) => emit('update:modelValue', v)
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
function buildWaveGroupList(groups: unknown[] | null | undefined, groupKeyPrefix = 'normal'): WaveGroupView[] {
|
||||||
() => props.modelValue,
|
|
||||||
(visible) => {
|
|
||||||
if (visible) {
|
|
||||||
void loadStationOptions()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const waveGroupList = computed<WaveGroupView[]>(() => {
|
|
||||||
const groups = props.payload?.waveGroups
|
|
||||||
if (!Array.isArray(groups)) return []
|
if (!Array.isArray(groups)) return []
|
||||||
return groups
|
return groups
|
||||||
.filter((x) => x && typeof x === 'object')
|
.filter((x) => x && typeof x === 'object')
|
||||||
@ -179,7 +209,7 @@ const waveGroupList = computed<WaveGroupView[]>(() => {
|
|||||||
const sys_logistics_name =
|
const sys_logistics_name =
|
||||||
logisticsRaw != null && String(logisticsRaw).trim() !== '' ? String(logisticsRaw).trim() : ''
|
logisticsRaw != null && String(logisticsRaw).trim() !== '' ? String(logisticsRaw).trim() : ''
|
||||||
return {
|
return {
|
||||||
platformKey: `${wave_id}-${platformCode}-${platformIndex}`,
|
platformKey: `${groupKeyPrefix}-${wave_id}-${platformCode}-${platformIndex}`,
|
||||||
platform: platformCode,
|
platform: platformCode,
|
||||||
platform_name: platformName,
|
platform_name: platformName,
|
||||||
sys_logistics_name,
|
sys_logistics_name,
|
||||||
@ -187,19 +217,40 @@ const waveGroupList = computed<WaveGroupView[]>(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
waveKey: `${wave_id}-${wave_no}-${waveIndex}`,
|
waveKey: `${groupKeyPrefix}-${wave_id}-${wave_no}-${waveIndex}`,
|
||||||
wave_id,
|
wave_id,
|
||||||
wave_no,
|
wave_no,
|
||||||
order_count: toNum(wave.order_count, platforms.reduce((sum, p) => sum + p.order_count, 0)),
|
order_count: toNum(wave.order_count, platforms.reduce((sum, p) => sum + p.order_count, 0)),
|
||||||
platforms
|
platforms
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
void loadStationOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const waveGroupList = computed<WaveGroupView[]>(() => {
|
||||||
|
return buildWaveGroupList(props.payload?.waveGroups, 'normal')
|
||||||
|
})
|
||||||
|
|
||||||
|
const lockedWaveGroupList = computed<WaveGroupView[]>(() => {
|
||||||
|
return buildWaveGroupList(props.payload?.locked_wave_groups, 'locked')
|
||||||
})
|
})
|
||||||
|
|
||||||
const hasWaveGroups = computed(() => {
|
const hasWaveGroups = computed(() => {
|
||||||
return waveGroupList.value.length > 0
|
return waveGroupList.value.length > 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const hasLockedWaveGroups = computed(() => {
|
||||||
|
return lockedWaveGroupList.value.length > 0
|
||||||
|
})
|
||||||
|
|
||||||
function toText(v: unknown, fallback = '—'): string {
|
function toText(v: unknown, fallback = '—'): string {
|
||||||
if (v === null || v === undefined) return fallback
|
if (v === null || v === undefined) return fallback
|
||||||
const s = String(v).trim()
|
const s = String(v).trim()
|
||||||
@ -358,6 +409,9 @@ async function printToStation() {
|
|||||||
requestCode: buildExpressRequestCode(),
|
requestCode: buildExpressRequestCode(),
|
||||||
data: {
|
data: {
|
||||||
waveGroups: props.payload.waveGroups || [],
|
waveGroups: props.payload.waveGroups || [],
|
||||||
|
locked_wave_groups: props.payload.locked_wave_groups || [],
|
||||||
|
locked_orders: props.payload.locked_orders || [],
|
||||||
|
locked_count: props.payload.locked_count ?? 0,
|
||||||
wave_ids: props.payload.wave_ids || [],
|
wave_ids: props.payload.wave_ids || [],
|
||||||
summary: props.payload.summary || {},
|
summary: props.payload.summary || {},
|
||||||
request_meta: props.requestMeta || {}
|
request_meta: props.requestMeta || {}
|
||||||
@ -502,6 +556,11 @@ function escapeHtml(s: string) {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
&--locked {
|
||||||
|
border-color: #f3d19e;
|
||||||
|
background: #fffcf5;
|
||||||
|
}
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -550,6 +609,11 @@ function escapeHtml(s: string) {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
|
|
||||||
|
&--locked {
|
||||||
|
border-color: #f8d2d2;
|
||||||
|
background: #fff7f7;
|
||||||
|
}
|
||||||
|
|
||||||
&__header {
|
&__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@ -491,6 +491,15 @@ export function unwrapWavePlatformPrintPayload(res: unknown): WavePlatformPrintD
|
|||||||
const waveGroups = Array.isArray(inner?.waveGroups)
|
const waveGroups = Array.isArray(inner?.waveGroups)
|
||||||
? inner.waveGroups
|
? inner.waveGroups
|
||||||
: normalizeWaveGroups((inner as Record<string, unknown>).wave_list)
|
: normalizeWaveGroups((inner as Record<string, unknown>).wave_list)
|
||||||
|
const locked_wave_groups = Array.isArray(inner?.locked_wave_groups)
|
||||||
|
? normalizeWaveGroups(inner.locked_wave_groups)
|
||||||
|
: undefined
|
||||||
|
const locked_orders = toOrderList(inner?.locked_orders)
|
||||||
|
const locked_count_raw = (inner as Record<string, unknown>)?.locked_count
|
||||||
|
const locked_count =
|
||||||
|
locked_count_raw !== undefined && locked_count_raw !== null && Number.isFinite(Number(locked_count_raw))
|
||||||
|
? Number(locked_count_raw)
|
||||||
|
: undefined
|
||||||
const platform_groups = Array.isArray(inner?.platform_groups) ? inner.platform_groups : undefined
|
const platform_groups = Array.isArray(inner?.platform_groups) ? inner.platform_groups : undefined
|
||||||
const order_list = toOrderList(inner?.order_list)
|
const order_list = toOrderList(inner?.order_list)
|
||||||
const extRaw = inner?.ext
|
const extRaw = inner?.ext
|
||||||
@ -499,6 +508,9 @@ export function unwrapWavePlatformPrintPayload(res: unknown): WavePlatformPrintD
|
|||||||
summary,
|
summary,
|
||||||
wave_ids,
|
wave_ids,
|
||||||
waveGroups,
|
waveGroups,
|
||||||
|
locked_wave_groups,
|
||||||
|
locked_orders: locked_orders.length ? locked_orders : undefined,
|
||||||
|
locked_count,
|
||||||
platform_groups,
|
platform_groups,
|
||||||
order_list: order_list.length ? order_list : undefined,
|
order_list: order_list.length ? order_list : undefined,
|
||||||
ext
|
ext
|
||||||
|
|||||||
@ -28,13 +28,13 @@
|
|||||||
<template v-if="Array.isArray(row.qimen_config) && row.qimen_config.length">
|
<template v-if="Array.isArray(row.qimen_config) && row.qimen_config.length">
|
||||||
<div v-for="cfg in row.qimen_config" :key="cfg.interface_type_id" class="qimen-summary">
|
<div v-for="cfg in row.qimen_config" :key="cfg.interface_type_id" class="qimen-summary">
|
||||||
<span>{{ cfg.app_name }}({{ cfg.interface_name }})</span>
|
<span>{{ cfg.app_name }}({{ cfg.interface_name }})</span>
|
||||||
<div class="qimen-info">AppKey: {{ cfg.qimen_app_key }},客户ID: {{ cfg.qimen_customer_id }},仓库编码: {{ cfg.qimen_warehouse_code }}</div>
|
<div class="qimen-info">ERP: {{ getQimenErpDisplay(cfg) }},仓库编码: {{ cfg.qimen_warehouse_code }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="typeof row.qimen_config === 'object'">
|
<template v-else-if="typeof row.qimen_config === 'object'">
|
||||||
<div class="qimen-summary">
|
<div class="qimen-summary">
|
||||||
<span>{{ row.qimen_config.app_name }}({{ row.qimen_config.interface_name }})</span>
|
<span>{{ row.qimen_config.app_name }}({{ row.qimen_config.interface_name }})</span>
|
||||||
<div class="qimen-info">AppKey: {{ row.qimen_config.qimen_app_key }},客户ID: {{ row.qimen_config.qimen_customer_id }},仓库编码: {{ row.qimen_config.qimen_warehouse_code }}</div>
|
<div class="qimen-info">ERP: {{ getQimenErpDisplay(row.qimen_config) }},仓库编码: {{ row.qimen_config.qimen_warehouse_code }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<span v-else style="color:#aaa">未配置</span>
|
<span v-else style="color:#aaa">未配置</span>
|
||||||
@ -58,13 +58,13 @@
|
|||||||
<template v-if="Array.isArray(row.qimen_config) && row.qimen_config.length">
|
<template v-if="Array.isArray(row.qimen_config) && row.qimen_config.length">
|
||||||
<div v-for="cfg in row.qimen_config" :key="cfg.interface_type_id" class="qimen-summary">
|
<div v-for="cfg in row.qimen_config" :key="cfg.interface_type_id" class="qimen-summary">
|
||||||
<span>{{ cfg.app_name }}({{ cfg.interface_name }})</span>
|
<span>{{ cfg.app_name }}({{ cfg.interface_name }})</span>
|
||||||
<div class="qimen-info">AppKey: {{ cfg.qimen_app_key }},客户ID: {{ cfg.qimen_customer_id }},仓库编码: {{ cfg.qimen_warehouse_code }}</div>
|
<div class="qimen-info">ERP: {{ getQimenErpDisplay(cfg) }},仓库编码: {{ cfg.qimen_warehouse_code }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="typeof row.qimen_config === 'object'">
|
<template v-else-if="typeof row.qimen_config === 'object'">
|
||||||
<div class="qimen-summary">
|
<div class="qimen-summary">
|
||||||
<span>{{ row.qimen_config.app_name }}({{ row.qimen_config.interface_name }})</span>
|
<span>{{ row.qimen_config.app_name }}({{ row.qimen_config.interface_name }})</span>
|
||||||
<div class="qimen-info">AppKey: {{ row.qimen_config.qimen_app_key }},客户ID: {{ row.qimen_config.qimen_customer_id }},仓库编码: {{ row.qimen_config.qimen_warehouse_code }}</div>
|
<div class="qimen-info">ERP: {{ getQimenErpDisplay(row.qimen_config) }},仓库编码: {{ row.qimen_config.qimen_warehouse_code }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<span v-else style="color:#aaa">未配置</span>
|
<span v-else style="color:#aaa">未配置</span>
|
||||||
@ -104,6 +104,10 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['view-detail'])
|
const emit = defineEmits(['view-detail'])
|
||||||
|
|
||||||
|
function getQimenErpDisplay(config: any): string {
|
||||||
|
return String(config?.erp_name || config?.erpName || config?.qimen_app_key || '').trim() || '—'
|
||||||
|
}
|
||||||
|
|
||||||
// 将字段平分为左右两列
|
// 将字段平分为左右两列
|
||||||
const leftFields = computed(() => {
|
const leftFields = computed(() => {
|
||||||
const mid = Math.ceil(detailPanel.length / 2)
|
const mid = Math.ceil(detailPanel.length / 2)
|
||||||
|
|||||||
@ -148,14 +148,91 @@
|
|||||||
<el-tabs v-model="activeTab" class="detail-tab">
|
<el-tabs v-model="activeTab" class="detail-tab">
|
||||||
<el-tab-pane label="基本详情" name="details" />
|
<el-tab-pane label="基本详情" name="details" />
|
||||||
<el-tab-pane label="操作日志" name="logs" />
|
<el-tab-pane label="操作日志" name="logs" />
|
||||||
|
<el-tab-pane label="余额变动" name="balanceLogs" />
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="detail-container">
|
<div class="detail-container">
|
||||||
<KeepAlive>
|
<div v-if="activeTab === 'balanceLogs'" class="balance-log-panel">
|
||||||
<component
|
<div class="balance-log-toolbar">
|
||||||
:is="activeComponent"
|
<el-button size="small" @click="loadBalanceLogs">刷新</el-button>
|
||||||
:id="selectedRow?.id"
|
<div class="balance-log-toolbar__meta">
|
||||||
|
<span>变动记录:{{ balanceLogPagination.total }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
v-loading="balanceLogLoading"
|
||||||
|
:data="balanceLogList"
|
||||||
|
border
|
||||||
|
size="small"
|
||||||
|
height="100%"
|
||||||
|
class="balance-log-table"
|
||||||
|
empty-text="暂无余额变动记录"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" label="#" width="58" :index="computeBalanceLogIndex" align="center" />
|
||||||
|
<el-table-column prop="created_at" label="变动时间" min-width="160">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ formatDate(getBalanceLogTime(row)) || '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="变动前" min-width="90" align="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogBefore(row) ?? '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="变动后" min-width="90" align="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogAfter(row) ?? '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="变动值" min-width="90" align="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<span :class="getBalanceLogDeltaClass(getBalanceLogDelta(row))">{{ formatBalanceLogDelta(getBalanceLogDelta(row)) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="变动类型" min-width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogChangeType(row) || '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="业务类型" min-width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogBusinessType(row) || '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="业务ID" min-width="100" align="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogBusinessId(row) ?? '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作人" min-width="120">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogOperator(row) || '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="原因" min-width="220" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ getBalanceLogReason(row) || '—' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="balance-log-pagination">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="balanceLogPagination.total"
|
||||||
|
:current-page="balanceLogPagination.currentPage"
|
||||||
|
:page-size="balanceLogPagination.pageSize"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
@current-change="handleBalanceLogPageChange"
|
||||||
|
@size-change="handleBalanceLogSizeChange"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<KeepAlive v-else>
|
||||||
|
<component
|
||||||
|
:is="activeComponent"
|
||||||
|
:id="selectedRow?.id"
|
||||||
:row="selectedRow"
|
:row="selectedRow"
|
||||||
:getAuthStatusType="getAuthStatusType"
|
:getAuthStatusType="getAuthStatusType"
|
||||||
:getAuthStatusLabel="getAuthStatusLabel"
|
:getAuthStatusLabel="getAuthStatusLabel"
|
||||||
@ -310,8 +387,7 @@
|
|||||||
<span style="margin-left:8px;color:#999">{{ cfg.interface_name || cfg.interface_category || cfg.interface_code }}</span>
|
<span style="margin-left:8px;color:#999">{{ cfg.interface_name || cfg.interface_category || cfg.interface_code }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="qimen-info">
|
<div class="qimen-info">
|
||||||
<span>AppKey:{{ cfg.qimen_app_key }}</span>
|
<span>ERP:{{ getQimenErpDisplay(cfg) }}</span>
|
||||||
<span style="margin-left:12px">客户ID:{{ cfg.qimen_customer_id }}</span>
|
|
||||||
<span style="margin-left:12px">仓库编码:{{ cfg.qimen_warehouse_code }}</span>
|
<span style="margin-left:12px">仓库编码:{{ cfg.qimen_warehouse_code }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -324,8 +400,7 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="qimen-info">
|
<div class="qimen-info">
|
||||||
<span>AppKey:{{ detailDialog.row.qimen_config.qimen_app_key }}</span>
|
<span>ERP:{{ getQimenErpDisplay(detailDialog.row.qimen_config) }}</span>
|
||||||
<span style="margin-left:12px">客户ID:{{ detailDialog.row.qimen_config.qimen_customer_id }}</span>
|
|
||||||
<span style="margin-left:12px">仓库编码:{{ detailDialog.row.qimen_config.qimen_warehouse_code }}</span>
|
<span style="margin-left:12px">仓库编码:{{ detailDialog.row.qimen_config.qimen_warehouse_code }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -609,18 +684,43 @@
|
|||||||
<!-- QM_WMS 专属字段 -->
|
<!-- QM_WMS 专属字段 -->
|
||||||
<template v-if="qimenForm.interface_code === 'QM_WMS' || (!qimenForm.interface_code && qimenDialog.editingConfig?.interface_code === 'QM_WMS')">
|
<template v-if="qimenForm.interface_code === 'QM_WMS' || (!qimenForm.interface_code && qimenDialog.editingConfig?.interface_code === 'QM_WMS')">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="奇门 AppKey" required>
|
<el-form-item label="ERP" required>
|
||||||
<el-input v-model="qimenForm.qimen_app_key" placeholder="请输入奇门对方 AppKey" />
|
<el-select
|
||||||
|
v-model="qimenForm.qimen_app_key"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择ERP"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="opt in qimenAppOptions"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col v-if="qimenDialog.editingConfig && getEditingQimenCustomerId()" :span="12">
|
||||||
<el-form-item label="客户ID" required>
|
<el-form-item label="客户ID">
|
||||||
<el-input v-model="qimenForm.qimen_customer_id" placeholder="奇门客户ID / 货主编码" />
|
<el-input
|
||||||
|
:model-value="getEditingQimenCustomerId()"
|
||||||
|
readonly
|
||||||
|
placeholder="客户ID"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="copyEditingQimenCustomerId">复制</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="仓库编码" required>
|
<el-form-item label="仓库编码" required>
|
||||||
<el-input v-model="qimenForm.qimen_warehouse_code" placeholder="奇门仓库编码" />
|
<el-input v-model="qimenForm.qimen_warehouse_code" placeholder="奇门仓库编码">
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="generateQimenWarehouseCode">随机生成</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -640,13 +740,34 @@
|
|||||||
<!-- 其他类型或未选类型时显示所有奇门字段(向后兼容)-->
|
<!-- 其他类型或未选类型时显示所有奇门字段(向后兼容)-->
|
||||||
<template v-else-if="!qimenForm.interface_code && qimenDialog.editingConfig">
|
<template v-else-if="!qimenForm.interface_code && qimenDialog.editingConfig">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="奇门 AppKey">
|
<el-form-item label="ERP">
|
||||||
<el-input v-model="qimenForm.qimen_app_key" placeholder="奇门 AppKey(如适用)" />
|
<el-select
|
||||||
|
v-model="qimenForm.qimen_app_key"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
placeholder="请选择ERP(如适用)"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="opt in qimenAppOptions"
|
||||||
|
:key="opt.value"
|
||||||
|
:label="opt.label"
|
||||||
|
:value="opt.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col v-if="getEditingQimenCustomerId()" :span="12">
|
||||||
<el-form-item label="客户ID">
|
<el-form-item label="客户ID">
|
||||||
<el-input v-model="qimenForm.qimen_customer_id" placeholder="奇门客户ID(如适用)" />
|
<el-input
|
||||||
|
:model-value="getEditingQimenCustomerId()"
|
||||||
|
readonly
|
||||||
|
placeholder="客户ID"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="copyEditingQimenCustomerId">复制</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -778,15 +899,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted, computed, watch } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Search, Plus, Refresh, QuestionFilled } from '@element-plus/icons-vue'
|
import { Search, Plus, Refresh, QuestionFilled } from '@element-plus/icons-vue'
|
||||||
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind,
|
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind,
|
||||||
storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields,
|
storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields,
|
||||||
storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig,
|
storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig,
|
||||||
storeWarehouseAdjustPrintQuantity, listApiConfig
|
storeWarehouseAdjustPrintQuantity, storeWarehouseQueryPrintQuantityLogs, listApiConfig
|
||||||
} from '@/api/storewarehouse.store/storeWarehouse'
|
} from '@/api/storeWarehouse.store/storeWarehouse'
|
||||||
import { listInterfaceTypes, getExpressList, getPlatformList } from '@/api/index/index'
|
import { listInterfaceTypes, getExpressList, getPlatformList, getQimenAppList } from '@/api/index/index'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
import Detail from './component/detail.vue'
|
import Detail from './component/detail.vue'
|
||||||
@ -807,6 +928,36 @@ const componentMap: Record<string, any> = {
|
|||||||
}
|
}
|
||||||
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.details)
|
const activeComponent = computed(() => componentMap[activeTab.value] || componentMap.details)
|
||||||
|
|
||||||
|
const balanceLogLoading = ref(false)
|
||||||
|
const balanceLogList = ref<any[]>([])
|
||||||
|
const balanceLogPagination = reactive({
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const selectedStoreId = computed<number | string | undefined>(() => {
|
||||||
|
return resolveStoreIdFromRow(selectedRow.value)
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => activeTab.value,
|
||||||
|
(tab) => {
|
||||||
|
if (tab !== 'balanceLogs') return
|
||||||
|
balanceLogPagination.currentPage = 1
|
||||||
|
void loadBalanceLogs()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => selectedRow.value?.id,
|
||||||
|
() => {
|
||||||
|
if (activeTab.value !== 'balanceLogs') return
|
||||||
|
balanceLogPagination.currentPage = 1
|
||||||
|
void loadBalanceLogs()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// 全局控制所有行的面单余额显示/隐藏
|
// 全局控制所有行的面单余额显示/隐藏
|
||||||
const balanceVisible = ref(false)
|
const balanceVisible = ref(false)
|
||||||
const toggleBalance = () => {
|
const toggleBalance = () => {
|
||||||
@ -903,6 +1054,183 @@ function handleSizeChange(size: number) {
|
|||||||
|
|
||||||
function handleRowClick(row: any) {
|
function handleRowClick(row: any) {
|
||||||
selectedRow.value = row
|
selectedRow.value = row
|
||||||
|
if (activeTab.value === 'balanceLogs') {
|
||||||
|
balanceLogPagination.currentPage = 1
|
||||||
|
void loadBalanceLogs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveStoreIdFromRow(row: any): number | string | undefined {
|
||||||
|
if (!row || typeof row !== 'object') return undefined
|
||||||
|
const candidates = [row.store_id, row.storeId, row.counterparty_id, row.counterpartyId]
|
||||||
|
for (const candidate of candidates) {
|
||||||
|
if (candidate === null || candidate === undefined || candidate === '') continue
|
||||||
|
return candidate
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
function toFiniteNumber(value: unknown): number | undefined {
|
||||||
|
if (value === null || value === undefined || value === '') return undefined
|
||||||
|
const n = Number(value)
|
||||||
|
return Number.isFinite(n) ? n : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogTime(row: any): string {
|
||||||
|
return String(row?.created_at || row?.create_time || row?.createdAt || row?.change_time || row?.updated_at || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogBefore(row: any): number | undefined {
|
||||||
|
return (
|
||||||
|
toFiniteNumber(row?.balance_before) ??
|
||||||
|
toFiniteNumber(row?.before_quantity) ??
|
||||||
|
toFiniteNumber(row?.before_print_quantity) ??
|
||||||
|
toFiniteNumber(row?.old_quantity) ??
|
||||||
|
toFiniteNumber(row?.print_quantity_before) ??
|
||||||
|
toFiniteNumber(row?.previous_quantity)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogAfter(row: any): number | undefined {
|
||||||
|
return (
|
||||||
|
toFiniteNumber(row?.balance_after) ??
|
||||||
|
toFiniteNumber(row?.after_quantity) ??
|
||||||
|
toFiniteNumber(row?.after_print_quantity) ??
|
||||||
|
toFiniteNumber(row?.new_quantity) ??
|
||||||
|
toFiniteNumber(row?.print_quantity_after) ??
|
||||||
|
toFiniteNumber(row?.current_quantity)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogDelta(row: any): number | undefined {
|
||||||
|
const direct =
|
||||||
|
toFiniteNumber(row?.change_quantity) ??
|
||||||
|
toFiniteNumber(row?.delta_quantity) ??
|
||||||
|
toFiniteNumber(row?.quantity_delta) ??
|
||||||
|
toFiniteNumber(row?.diff_quantity)
|
||||||
|
if (direct !== undefined) return direct
|
||||||
|
const before = getBalanceLogBefore(row)
|
||||||
|
const after = getBalanceLogAfter(row)
|
||||||
|
if (before === undefined || after === undefined) return undefined
|
||||||
|
return after - before
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogOperator(row: any): string {
|
||||||
|
return String(
|
||||||
|
row?.operator_name ||
|
||||||
|
row?.creator_name ||
|
||||||
|
row?.created_by_name ||
|
||||||
|
row?.operator ||
|
||||||
|
row?.user_name ||
|
||||||
|
row?.operator_id ||
|
||||||
|
row?.created_by ||
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogReason(row: any): string {
|
||||||
|
return String(row?.reason || row?.change_reason || row?.remark || row?.memo || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogChangeType(row: any): string {
|
||||||
|
return String(row?.change_type || row?.type || row?.log_type || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogBusinessType(row: any): string {
|
||||||
|
return String(row?.business_type || row?.biz_type || '')
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogBusinessId(row: any): number | string | undefined {
|
||||||
|
const candidate = row?.business_id ?? row?.biz_id
|
||||||
|
if (candidate === null || candidate === undefined || candidate === '') return undefined
|
||||||
|
return candidate
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQimenErpDisplay(config: any): string {
|
||||||
|
return String(config?.erp_name || config?.erpName || config?.qimen_app_key || '').trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getEditingQimenCustomerId(): string {
|
||||||
|
return String(qimenDialog.editingConfig?.qimen_customer_id || '').trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBalanceLogDeltaClass(delta: number | undefined): string {
|
||||||
|
if (delta === undefined) return ''
|
||||||
|
if (delta > 0) return 'text-up'
|
||||||
|
if (delta < 0) return 'text-down'
|
||||||
|
return 'text-flat'
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatBalanceLogDelta(delta: number | undefined): string {
|
||||||
|
if (delta === undefined) return '—'
|
||||||
|
if (delta > 0) return `+${delta}`
|
||||||
|
return String(delta)
|
||||||
|
}
|
||||||
|
|
||||||
|
function computeBalanceLogIndex(index: number): number {
|
||||||
|
return (balanceLogPagination.currentPage - 1) * balanceLogPagination.pageSize + index + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadBalanceLogs() {
|
||||||
|
if (!selectedRow.value) {
|
||||||
|
balanceLogList.value = []
|
||||||
|
balanceLogPagination.total = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const storeId = selectedStoreId.value
|
||||||
|
if (storeId === undefined || storeId === null || String(storeId).trim() === '') {
|
||||||
|
balanceLogList.value = []
|
||||||
|
balanceLogPagination.total = 0
|
||||||
|
ElMessage.warning('当前记录缺少 store_id,无法查询余额变动')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
balanceLogLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = (await storeWarehouseQueryPrintQuantityLogs({
|
||||||
|
store_id: storeId,
|
||||||
|
pagination: {
|
||||||
|
page: balanceLogPagination.currentPage,
|
||||||
|
page_size: balanceLogPagination.pageSize
|
||||||
|
}
|
||||||
|
})) as any
|
||||||
|
|
||||||
|
const payload = res?.data || {}
|
||||||
|
const nested = payload?.data && typeof payload.data === 'object' ? payload.data : null
|
||||||
|
const rowsRaw = payload?.list || payload?.records || payload?.logs || nested?.list || nested?.records || nested || []
|
||||||
|
const rows = Array.isArray(rowsRaw) ? rowsRaw : []
|
||||||
|
balanceLogList.value = rows
|
||||||
|
|
||||||
|
const paginationRaw = payload?.pagination || nested?.pagination || {}
|
||||||
|
const total = toFiniteNumber(paginationRaw?.total) ?? toFiniteNumber(payload?.total) ?? toFiniteNumber(nested?.total) ?? 0
|
||||||
|
const current = toFiniteNumber(paginationRaw?.page) ?? balanceLogPagination.currentPage
|
||||||
|
const pageSize =
|
||||||
|
toFiniteNumber(paginationRaw?.page_size) ??
|
||||||
|
toFiniteNumber(paginationRaw?.pageSize) ??
|
||||||
|
balanceLogPagination.pageSize
|
||||||
|
|
||||||
|
balanceLogPagination.total = total
|
||||||
|
balanceLogPagination.currentPage = current
|
||||||
|
balanceLogPagination.pageSize = pageSize
|
||||||
|
} catch {
|
||||||
|
balanceLogList.value = []
|
||||||
|
balanceLogPagination.total = 0
|
||||||
|
ElMessage.error('获取余额变动列表失败')
|
||||||
|
} finally {
|
||||||
|
balanceLogLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBalanceLogPageChange(page: number) {
|
||||||
|
balanceLogPagination.currentPage = page
|
||||||
|
void loadBalanceLogs()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBalanceLogSizeChange(size: number) {
|
||||||
|
balanceLogPagination.pageSize = size
|
||||||
|
balanceLogPagination.currentPage = 1
|
||||||
|
void loadBalanceLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── 状态辅助 ────────────────────────────────────────────────────────────────
|
// ─── 状态辅助 ────────────────────────────────────────────────────────────────
|
||||||
@ -1294,6 +1622,7 @@ const qimenDialog = reactive({
|
|||||||
formLoading: false,
|
formLoading: false,
|
||||||
editingConfig: null as any
|
editingConfig: null as any
|
||||||
})
|
})
|
||||||
|
const qimenAppOptions = ref<Array<{ label: string; value: string }>>([])
|
||||||
|
|
||||||
/** 新增时可选的接口类型 */
|
/** 新增时可选的接口类型 */
|
||||||
const selectableTypes = computed(() => qimenDialog.availableTypes)
|
const selectableTypes = computed(() => qimenDialog.availableTypes)
|
||||||
@ -1471,6 +1800,7 @@ function openQimenDialog(row: any) {
|
|||||||
qimenDialog.editingConfig = null
|
qimenDialog.editingConfig = null
|
||||||
qimenDialog.list = []
|
qimenDialog.list = []
|
||||||
qimenDialog.visible = true
|
qimenDialog.visible = true
|
||||||
|
void loadQimenAppOptions()
|
||||||
loadQimenConfigs()
|
loadQimenConfigs()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1481,6 +1811,45 @@ function resetQimenDialog() {
|
|||||||
qimenDialog.list = []
|
qimenDialog.list = []
|
||||||
qimenDialog.availableTypes = []
|
qimenDialog.availableTypes = []
|
||||||
qimenDialog.selectableTypes = []
|
qimenDialog.selectableTypes = []
|
||||||
|
qimenAppOptions.value = []
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapQimenAppOptions(rawList: any[]) {
|
||||||
|
const result: Array<{ label: string; value: string }> = []
|
||||||
|
const seen = new Set<string>()
|
||||||
|
for (const item of rawList || []) {
|
||||||
|
const appKey = String(item?.app_key ?? item?.qimen_app_key ?? item?.value ?? '').trim()
|
||||||
|
if (!appKey || seen.has(appKey)) continue
|
||||||
|
const appName = String(item?.app_name ?? item?.name ?? item?.label ?? '').trim()
|
||||||
|
result.push({
|
||||||
|
value: appKey,
|
||||||
|
label: appName ? `${appName}(${appKey})` : appKey
|
||||||
|
})
|
||||||
|
seen.add(appKey)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadQimenAppOptions() {
|
||||||
|
try {
|
||||||
|
const res: any = await getQimenAppList({})
|
||||||
|
const payload = res?.data
|
||||||
|
const listRaw =
|
||||||
|
res?.list ||
|
||||||
|
res?.records ||
|
||||||
|
(Array.isArray(res) ? res : null) ||
|
||||||
|
(Array.isArray(payload) ? payload : null) ||
|
||||||
|
payload?.list ||
|
||||||
|
payload?.records ||
|
||||||
|
payload?.data?.list ||
|
||||||
|
payload?.data?.records ||
|
||||||
|
payload?.data ||
|
||||||
|
[]
|
||||||
|
const rows = Array.isArray(listRaw) ? listRaw : []
|
||||||
|
qimenAppOptions.value = mapQimenAppOptions(rows)
|
||||||
|
} catch {
|
||||||
|
qimenAppOptions.value = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadQimenConfigs() {
|
async function loadQimenConfigs() {
|
||||||
@ -1500,7 +1869,10 @@ async function loadQimenConfigs() {
|
|||||||
const typeMap = new Map<number, any>(serverTypes.map((t: any) => [t.id, t]))
|
const typeMap = new Map<number, any>(serverTypes.map((t: any) => [t.id, t]))
|
||||||
|
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
qimenDialog.list = res.data.list || []
|
qimenDialog.list = (res.data.list || []).map((item: any) => ({
|
||||||
|
...item,
|
||||||
|
erp_display: getQimenErpDisplay(item)
|
||||||
|
}))
|
||||||
qimenDialog.total = res.data.total || 0
|
qimenDialog.total = res.data.total || 0
|
||||||
qimenDialog.contract = res.data.contract || null
|
qimenDialog.contract = res.data.contract || null
|
||||||
|
|
||||||
@ -1528,10 +1900,50 @@ async function loadQimenConfigs() {
|
|||||||
function handleInterfaceTypeChange(_code: string) {
|
function handleInterfaceTypeChange(_code: string) {
|
||||||
// interface_code 已由 v-model 绑定自动更新,此处只做联动清空
|
// interface_code 已由 v-model 绑定自动更新,此处只做联动清空
|
||||||
qimenForm.qimen_app_key = ''
|
qimenForm.qimen_app_key = ''
|
||||||
qimenForm.qimen_customer_id = ''
|
|
||||||
qimenForm.qimen_warehouse_code = ''
|
qimenForm.qimen_warehouse_code = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function randomAlphaNum(length = 12): string {
|
||||||
|
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789'
|
||||||
|
let result = ''
|
||||||
|
for (let i = 0; i < length; i += 1) {
|
||||||
|
const idx = Math.floor(Math.random() * chars.length)
|
||||||
|
result += chars[idx]
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateQimenWarehouseCode() {
|
||||||
|
qimenForm.qimen_warehouse_code = `WH_${randomAlphaNum(10)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyEditingQimenCustomerId() {
|
||||||
|
const customerId = getEditingQimenCustomerId()
|
||||||
|
if (!customerId) {
|
||||||
|
ElMessage.warning('暂无可复制的客户ID')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (navigator?.clipboard?.writeText) {
|
||||||
|
await navigator.clipboard.writeText(customerId)
|
||||||
|
} else {
|
||||||
|
const input = document.createElement('textarea')
|
||||||
|
input.value = customerId
|
||||||
|
input.style.position = 'fixed'
|
||||||
|
input.style.opacity = '0'
|
||||||
|
document.body.appendChild(input)
|
||||||
|
input.focus()
|
||||||
|
input.select()
|
||||||
|
document.execCommand('copy')
|
||||||
|
document.body.removeChild(input)
|
||||||
|
}
|
||||||
|
ElMessage.success('客户ID已复制')
|
||||||
|
} catch {
|
||||||
|
ElMessage.error('复制客户ID失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function openQimenForm(config: any) {
|
function openQimenForm(config: any) {
|
||||||
qimenDialog.editingConfig = config
|
qimenDialog.editingConfig = config
|
||||||
if (config) {
|
if (config) {
|
||||||
@ -1564,11 +1976,7 @@ async function submitQimenForm() {
|
|||||||
(!qimenForm.interface_code && qimenDialog.editingConfig?.interface_code === 'QM_WMS')
|
(!qimenForm.interface_code && qimenDialog.editingConfig?.interface_code === 'QM_WMS')
|
||||||
if (isQmWms) {
|
if (isQmWms) {
|
||||||
if (!qimenForm.qimen_app_key?.trim()) {
|
if (!qimenForm.qimen_app_key?.trim()) {
|
||||||
ElMessage.warning('奇门备山 QM_WMS 类型必须填写 AppKey')
|
ElMessage.warning('奇门备山 QM_WMS 类型必须选择ERP')
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!qimenForm.qimen_customer_id?.trim()) {
|
|
||||||
ElMessage.warning('奇门备山 QM_WMS 类型必须填写客户ID')
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!qimenForm.qimen_warehouse_code?.trim()) {
|
if (!qimenForm.qimen_warehouse_code?.trim()) {
|
||||||
@ -1595,7 +2003,6 @@ async function submitQimenForm() {
|
|||||||
// QM_WMS 类型额外传奇门字段
|
// QM_WMS 类型额外传奇门字段
|
||||||
if (isQmWms) {
|
if (isQmWms) {
|
||||||
;(payload as any).qimen_app_key = qimenForm.qimen_app_key.trim()
|
;(payload as any).qimen_app_key = qimenForm.qimen_app_key.trim()
|
||||||
;(payload as any).qimen_customer_id = qimenForm.qimen_customer_id.trim()
|
|
||||||
;(payload as any).qimen_warehouse_code = qimenForm.qimen_warehouse_code.trim()
|
;(payload as any).qimen_warehouse_code = qimenForm.qimen_warehouse_code.trim()
|
||||||
}
|
}
|
||||||
const res = await saveApiConfig(payload as any) as any
|
const res = await saveApiConfig(payload as any) as any
|
||||||
@ -1743,6 +2150,52 @@ onMounted(loadList)
|
|||||||
color: #e6a23c;
|
color: #e6a23c;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-up {
|
||||||
|
color: var(--el-color-success);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-down {
|
||||||
|
color: var(--el-color-danger);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-flat {
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-log-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
|
||||||
|
.balance-log-toolbar {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 14px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-log-table {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.balance-log-pagination {
|
||||||
|
margin-top: 10px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sign-preview {
|
.sign-preview {
|
||||||
|
|||||||
@ -27,7 +27,6 @@ export const qimenFormDefault = {
|
|||||||
interface_code: '' as string, // 本地控制字段,不提交,用于区分 QM_WMS / OPEN_API 等类型
|
interface_code: '' as string, // 本地控制字段,不提交,用于区分 QM_WMS / OPEN_API 等类型
|
||||||
app_name: '',
|
app_name: '',
|
||||||
qimen_app_key: '',
|
qimen_app_key: '',
|
||||||
qimen_customer_id: '',
|
|
||||||
qimen_warehouse_code: '',
|
qimen_warehouse_code: '',
|
||||||
api_version: '1.0',
|
api_version: '1.0',
|
||||||
contact_person: '',
|
contact_person: '',
|
||||||
@ -61,8 +60,7 @@ export const signFormItems = [
|
|||||||
// 接口配置(apiConfig)表单项配置(保留备用)
|
// 接口配置(apiConfig)表单项配置(保留备用)
|
||||||
export const qimenFormItems = [
|
export const qimenFormItems = [
|
||||||
{ label: '应用名称', prop: 'app_name', type: 'input', required: true, placeholder: '请输入应用名称', span: 24 },
|
{ label: '应用名称', prop: 'app_name', type: 'input', required: true, placeholder: '请输入应用名称', span: 24 },
|
||||||
{ label: '奇门AppKey', prop: 'qimen_app_key', type: 'input', required: true, placeholder: '请输入奇门对方AppKey', span: 12 },
|
{ label: 'ERP', prop: 'qimen_app_key', type: 'input', required: true, placeholder: '请选择ERP', span: 12 },
|
||||||
{ label: '客户ID', prop: 'qimen_customer_id', type: 'input', required: true, placeholder: '奇门客户ID/货主编码', span: 12 },
|
|
||||||
{ label: '仓库编码', prop: 'qimen_warehouse_code', type: 'input', required: true, placeholder: '奇门仓库编码', span: 12 },
|
{ label: '仓库编码', prop: 'qimen_warehouse_code', type: 'input', required: true, placeholder: '奇门仓库编码', span: 12 },
|
||||||
{ label: 'API版本', prop: 'api_version', type: 'input', placeholder: '默认1.0', span: 12 },
|
{ label: 'API版本', prop: 'api_version', type: 'input', placeholder: '默认1.0', span: 12 },
|
||||||
{ label: '联系人', prop: 'contact_person', type: 'input', span: 12 },
|
{ label: '联系人', prop: 'contact_person', type: 'input', span: 12 },
|
||||||
@ -110,8 +108,7 @@ export const qimenTableColumns = [
|
|||||||
{ prop: 'app_name', label: '应用名称', minWidth: 120 },
|
{ prop: 'app_name', label: '应用名称', minWidth: 120 },
|
||||||
{ prop: 'interface_name', label: '接口类型', width: 130 },
|
{ prop: 'interface_name', label: '接口类型', width: 130 },
|
||||||
{ prop: 'interface_code', label: '类型编码', width: 100 },
|
{ prop: 'interface_code', label: '类型编码', width: 100 },
|
||||||
{ prop: 'qimen_app_key', label: 'AppKey', minWidth: 110 },
|
{ prop: 'erp_display', label: 'ERP', minWidth: 110 },
|
||||||
{ prop: 'qimen_customer_id', label: '客户ID', minWidth: 120 },
|
|
||||||
{ prop: 'qimen_warehouse_code', label: '仓库编码', width: 110 }
|
{ prop: 'qimen_warehouse_code', label: '仓库编码', width: 110 }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user