78
This commit is contained in:
parent
558fa53970
commit
6ea17d71ed
BIN
dist.tar.gz
BIN
dist.tar.gz
Binary file not shown.
@ -508,3 +508,51 @@ export function importStockWarehouse(
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export type StockTransactionListSort = {
|
||||
sortField?: string
|
||||
sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC' | string
|
||||
sort_field?: string
|
||||
sort_order?: string
|
||||
}
|
||||
|
||||
export type StockTransactionListParams = {
|
||||
pagination?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
where?: Record<string, any>
|
||||
sort?: StockTransactionListSort
|
||||
}
|
||||
|
||||
/** 商品出入库流水列表查询 */
|
||||
export function stockTransactionList(data: StockTransactionListParams) {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'stock.transaction.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** 货主侧商品出入库流水列表查询 */
|
||||
export function stockTransactionStoreList(
|
||||
data: StockTransactionListParams & { store_id: number }
|
||||
) {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'stock.transaction.storeList',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
import request from '@/utils/request'
|
||||
const v = "1.0";
|
||||
|
||||
/** 查询仓货签约列表 */
|
||||
/** 查询当前主体可见的仓库-货主签约列表 */
|
||||
export function storeWarehouseList(data: {
|
||||
counterparty_id?: number
|
||||
auth_status?: number
|
||||
use_status?: number
|
||||
keyword?: string
|
||||
page?: number
|
||||
page_size?: number
|
||||
@ -66,10 +63,11 @@ export function storeWarehouseConfirmSign(data: {
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** 修改签约关系使用状态 */
|
||||
/** 解除或停用签约关系(仓库侧传 warehouse_use_status,货主侧传 store_use_status) */
|
||||
export function storeWarehouseUnbind(data: {
|
||||
id: number
|
||||
use_status?: number
|
||||
warehouse_use_status?: number
|
||||
store_use_status?: number
|
||||
}) {
|
||||
return request({
|
||||
url: '/system',
|
||||
|
||||
23
src/api/storewarehouse.warehouse/storeWarehouse.ts
Normal file
23
src/api/storewarehouse.warehouse/storeWarehouse.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
/** 仓库侧查询当前仓库可见的货主签约列表 */
|
||||
export function storeWarehouseWarehouseList(data: {
|
||||
page?: number
|
||||
page_size?: number
|
||||
keyword?: string
|
||||
auth_status?: string
|
||||
}) {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storeWarehouse.warehouse.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
@ -66,6 +66,9 @@ export default {
|
||||
'packageSupplier':'Package Supplier',
|
||||
'pickcart':'Pickcart',
|
||||
'PickingShortage':'Picking Shortage',
|
||||
'shipperSigning':'Shipper Signing',
|
||||
'Product Flow':'Product Flow',
|
||||
'Externalwarehouse':'External Warehouse',
|
||||
},
|
||||
"login": {
|
||||
"title": "Login",
|
||||
|
||||
@ -67,6 +67,9 @@ export default {
|
||||
'packageSupplier':'包装供应商',
|
||||
'pickcart':'拣货车',
|
||||
'PickingShortage':'缺货补货',
|
||||
'shipperSigning':'货主签约',
|
||||
'Productflow':'商品流水',
|
||||
'Externalwarehouse':'外部仓库',
|
||||
},
|
||||
"login": {
|
||||
"title": "登录",
|
||||
|
||||
@ -8,6 +8,26 @@ import { getToken } from '@/utils/auth'
|
||||
import { usePrinterComponentStore } from '@/stores/modules/printerComponent'
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import i18n from '@/lang'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
|
||||
type RouteLogNode = {
|
||||
path: string
|
||||
name?: string | symbol
|
||||
redirect?: RouteRecordRaw['redirect']
|
||||
meta?: RouteRecordRaw['meta']
|
||||
children?: RouteLogNode[]
|
||||
}
|
||||
|
||||
/** 格式化路由树,便于控制台查看(去掉 component 等不可序列化字段) */
|
||||
function formatRoutesForLog(routes: readonly RouteRecordRaw[]): RouteLogNode[] {
|
||||
return routes.map((route) => ({
|
||||
path: route.path,
|
||||
name: route.name,
|
||||
redirect: route.redirect,
|
||||
meta: route.meta,
|
||||
children: route.children?.length ? formatRoutesForLog(route.children) : undefined
|
||||
}))
|
||||
}
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
@ -62,22 +82,15 @@ router.beforeEach(async (to, from) => {
|
||||
const permissionStore = usePermissionStore()
|
||||
// generate accessible routes based on menus
|
||||
const accessRoutes = await permissionStore.generateRoutes(user.menus || [])
|
||||
|
||||
// console.log('从后端获取并转换后的动态路由:', accessRoutes)
|
||||
// console.log('合并后的前端完整路由表 (添加前):', router.getRoutes())
|
||||
|
||||
// dynamically add accessible routes
|
||||
accessRoutes.forEach(route => {
|
||||
router.addRoute(route)
|
||||
})
|
||||
|
||||
// 打印已添加的动态路由信息与添加后的完整路由表,便于调试
|
||||
try {
|
||||
// console.log('已添加的动态路由 paths:', accessRoutes.map(r => r.path))
|
||||
} catch (e) {
|
||||
// console.log('已添加的动态路由 (无法列出 paths):', accessRoutes)
|
||||
}
|
||||
// console.log('合并后的前端完整路由表 (添加后):', router.getRoutes())
|
||||
console.log('[Router] 动态路由 (后端菜单转换):', formatRoutesForLog(accessRoutes))
|
||||
console.log('[Router] 合并后完整路由 (constantRoutes + 动态):', formatRoutesForLog(permissionStore.routes))
|
||||
console.log('[Router] Vue Router 实例路由:', formatRoutesForLog(router.getRoutes()))
|
||||
|
||||
// hack method to ensure that addRoutes is complete
|
||||
// set the replace: true, so the navigation will not leave a history record
|
||||
|
||||
@ -29,7 +29,9 @@ export const componentMap: Record<string, any> = {
|
||||
'storage/entry': () => import('@/views/storage/entry/index.vue'),
|
||||
'storage/inventory': () => import('@/views/storage/inventory/index.vue'),
|
||||
'storage/stockout': () => import('@/views/storage/stockout/index.vue'),
|
||||
'store/index': () => import('@/views/store/index.vue'),
|
||||
'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/waveOrder/index.vue'),
|
||||
/** 与后端菜单 component 字段兼容 */
|
||||
'order/waveOrder': () => import('@/views/order/waveOrder/index.vue'),
|
||||
|
||||
379
src/views/Externalwarehouse/shipperSigning/index.vue
Normal file
379
src/views/Externalwarehouse/shipperSigning/index.vue
Normal file
@ -0,0 +1,379 @@
|
||||
<template>
|
||||
<div class="shipper-signing-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="货主筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
:initial-conditions="{ use_status: 1 }"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-tag v-if="currentSubject.company_name" size="small" type="primary" effect="plain">
|
||||
当前仓库:{{ currentSubject.company_name }}
|
||||
</el-tag>
|
||||
<el-button size="small" @click="loadList">
|
||||
<el-icon><Refresh /></el-icon> 刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-input
|
||||
v-model="queryForm.keyword"
|
||||
placeholder="搜索货主名或备注"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 200px"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="upper-wrapper">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
default-align="center"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@current-change="handleRowClick"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handleSizeChange"
|
||||
>
|
||||
<template #column-counterparty_name="{ row }">
|
||||
<span>{{ row.remask || row.counterparty_name }}</span>
|
||||
<span v-if="row.remask && row.remask !== row.counterparty_name" class="real-name">({{ row.counterparty_name }})</span>
|
||||
</template>
|
||||
<template #column-auth_status="{ row }">
|
||||
<el-tag size="small" :type="getAuthStatusType(row.auth_status)" effect="light">
|
||||
{{ row.auth_status_label || getAuthStatusLabel(row.auth_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-needs_my_confirm="{ row }">
|
||||
<el-tag v-if="row.needs_my_confirm" size="small" type="warning" effect="dark">待我确认</el-tag>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</template>
|
||||
<template #column-use_status="{ row }">
|
||||
<el-tag size="small" :type="row.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ row.use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-auth_end="{ row }">
|
||||
<span :class="{ 'text-danger': isExpired(row.auth_end) }">{{ row.auth_end || '—' }}</span>
|
||||
</template>
|
||||
<template #column-print_quantity="{ row }">
|
||||
{{ row.print_quantity ?? '—' }}
|
||||
</template>
|
||||
<template #column-has_qimen_config="{ row }">
|
||||
<el-tag size="small" :type="row.has_qimen_config ? 'success' : 'info'" effect="plain">
|
||||
{{ row.has_qimen_config ? '已配置' : '未配置' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<div class="lower-level" v-if="selectedRow">
|
||||
<div class="detail-header">
|
||||
<el-tabs v-model="activeTab" class="detail-tab">
|
||||
<el-tab-pane label="签约详情" name="details" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div class="detail-container">
|
||||
<el-descriptions v-if="activeTab === 'details'" :column="2" border size="small">
|
||||
<el-descriptions-item label="签约ID">{{ selectedRow.id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="签约状态">
|
||||
<el-tag size="small" :type="getAuthStatusType(selectedRow.auth_status)" effect="light">
|
||||
{{ selectedRow.auth_status_label || getAuthStatusLabel(selectedRow.auth_status) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="签约货主">
|
||||
{{ selectedRow.remask || selectedRow.counterparty_name || '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentSubject.company_name" label="当前仓库">
|
||||
{{ currentSubject.company_name }}
|
||||
<el-tag size="small" type="primary" effect="plain" style="margin-left:6px">仓库方</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="货主ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ selectedRow.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="使用状态">
|
||||
<el-tag size="small" :type="selectedRow.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ selectedRow.use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="待我确认">
|
||||
<el-tag v-if="selectedRow.needs_my_confirm" size="small" type="warning" effect="dark">是</el-tag>
|
||||
<span v-else>否</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="授权截止">
|
||||
<span :class="{ 'text-danger': isExpired(selectedRow.auth_end) }">{{ selectedRow.auth_end || '—' }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="面单余额">{{ selectedRow.print_quantity ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="奇门配置">
|
||||
<el-tag size="small" :type="selectedRow.has_qimen_config ? 'success' : 'info'" effect="plain">
|
||||
{{ selectedRow.has_qimen_config ? '已配置' : '未配置' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="selectedRow.counterparty_name && selectedRow.remask" label="货主全称" :span="2">
|
||||
{{ selectedRow.counterparty_name }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lower-level empty" v-else>
|
||||
<el-empty description="请选择数据查看详情" :image-size="60" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
const columns = [
|
||||
{ prop: 'counterparty_name', label: '签约货主', minWidth: 140 },
|
||||
{ prop: 'auth_status', label: '签约状态', width: 100 },
|
||||
{ prop: 'needs_my_confirm', label: '待确认', width: 90 },
|
||||
{ prop: 'use_status', label: '使用状态', width: 90 },
|
||||
{ prop: 'print_quantity', label: '面单余额', width: 100 },
|
||||
{ prop: 'has_qimen_config', label: '奇门配置', width: 100 },
|
||||
{ prop: 'auth_end', label: '授权截止', width: 120 }
|
||||
]
|
||||
|
||||
const availableFields = [
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已解除', value: 4 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
value: 'use_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const presetTree: any[] = []
|
||||
|
||||
const currentSubject = ref<{ store_id?: number; company_name?: string; role?: string }>({})
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
const activeTab = ref('details')
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
const currentCondition = ref<any>({ use_status: 1 })
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
page: pagination.currentPage,
|
||||
page_size: pagination.pageSize,
|
||||
...currentCondition.value
|
||||
}
|
||||
if (queryForm.keyword) params.keyword = queryForm.keyword
|
||||
|
||||
const res = await storeWarehouseWarehouseList(params) as any
|
||||
if (res?.data) {
|
||||
const payload = res.data
|
||||
list.value = payload.list || []
|
||||
pagination.total = payload.pagination?.total || payload.total || 0
|
||||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||||
if (payload.current_subject) {
|
||||
currentSubject.value = payload.current_subject
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('获取货主签约列表失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function isExpired(dateStr: string | null): boolean {
|
||||
if (!dateStr) return false
|
||||
const d = new Date(dateStr)
|
||||
if (isNaN(d.getTime())) return false
|
||||
return d < new Date()
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleRowClick(row: any) {
|
||||
selectedRow.value = row
|
||||
}
|
||||
|
||||
function getAuthStatusType(status: number): string {
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
function getAuthStatusLabel(status: number): string {
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shipper-signing-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
flex-shrink: 0;
|
||||
gap: 12px;
|
||||
|
||||
&-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lower-level {
|
||||
margin-top: 8px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&.empty {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
padding: 12px;
|
||||
overflow: auto;
|
||||
max-height: 260px;
|
||||
}
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: #f56c6c;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.real-name {
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
:deep(.el-descriptions__label) {
|
||||
width: 110px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -125,7 +125,9 @@ const fetchPdaInfo = async () => {
|
||||
try {
|
||||
loadingPda.value = true
|
||||
pdaError.value = false
|
||||
const response = await axios.get('https://dl.wms.gztbyc.com/pda/latest.json')
|
||||
const response = await axios.get('https://dl.wms.gztbyc.com/pda/latest.json', {
|
||||
params: { timestamp: new Date().getTime() }
|
||||
})
|
||||
if (response.data) {
|
||||
pdaData.value = response.data
|
||||
}
|
||||
@ -141,7 +143,9 @@ const fetchPrintServerInfo = async () => {
|
||||
try {
|
||||
loadingPrint.value = true
|
||||
printError.value = false
|
||||
const response = await axios.get('https://dl.wms.gztbyc.com/printServer/latest.json')
|
||||
const response = await axios.get('https://dl.wms.gztbyc.com/printServer/latest.json', {
|
||||
params: { timestamp: new Date().getTime() }
|
||||
})
|
||||
if (response.data) {
|
||||
printData.value = response.data
|
||||
}
|
||||
|
||||
@ -411,6 +411,141 @@ export function formatReceivingBindingsSummary(bindings: unknown): string {
|
||||
return `${numbers.slice(0, 2).join('、')} 等 ${numbers.length} 个`
|
||||
}
|
||||
|
||||
function normalizeEntryDetailPayload(res: Record<string, unknown> | null | undefined) {
|
||||
const entryOrder = (res?.entryOrder ?? (res?.data as Record<string, unknown> | undefined)?.entryOrder) as
|
||||
| Record<string, unknown>
|
||||
| null
|
||||
| undefined
|
||||
const dataItems = (res?.data as Record<string, unknown> | undefined)?.items
|
||||
const items = Array.isArray(dataItems)
|
||||
? dataItems
|
||||
: Array.isArray(entryOrder?.items)
|
||||
? entryOrder.items
|
||||
: []
|
||||
return { entryOrder: entryOrder ?? null, items }
|
||||
}
|
||||
|
||||
function mapEntryPrintDetailItem(
|
||||
item: Record<string, unknown>,
|
||||
idx: number,
|
||||
entryOrder: Record<string, unknown> | null
|
||||
): Record<string, unknown> {
|
||||
const stock = (item.stock ?? {}) as Record<string, unknown>
|
||||
const barcodes = Array.isArray(stock.barcodes) ? stock.barcodes : []
|
||||
const firstBarcode = (barcodes[0] as Record<string, unknown> | undefined)?.barcode
|
||||
|
||||
const warehouse_item_code = String(stock.item_code ?? item.warehouse_item_code ?? item.external_item_code ?? '')
|
||||
const warehouse_item_name = String(stock.item_name ?? item.warehouse_item_name ?? item.product_name ?? '')
|
||||
const warehouse_item_spec = String(stock.sku_property ?? item.warehouse_item_spec ?? '')
|
||||
const count = Number(item.planned ?? item.count ?? 0)
|
||||
const received_quantity = Number(item.completed ?? item.received_quantity ?? 0)
|
||||
const barcode = String(item.barcode ?? firstBarcode ?? '')
|
||||
|
||||
return {
|
||||
...item,
|
||||
...stock,
|
||||
seq_no: idx + 1,
|
||||
order_line_no: item.order_line_no ?? idx + 1,
|
||||
stock_id: item.stock_id ?? stock.id,
|
||||
warehouse_item_code,
|
||||
warehouse_item_name,
|
||||
warehouse_item_spec,
|
||||
item_code: warehouse_item_code,
|
||||
product_code: warehouse_item_code,
|
||||
product_name: warehouse_item_name,
|
||||
barcode,
|
||||
count,
|
||||
planned: count,
|
||||
received_quantity,
|
||||
completed: received_quantity,
|
||||
actual_quantity: received_quantity,
|
||||
confirm_quantity: item.confirm_quantity ?? '',
|
||||
external_item_code: item.external_item_code ?? '',
|
||||
inventory_type:
|
||||
item.inventory_type != null && item.inventory_type !== ''
|
||||
? formatEntryInventoryType(null, null, item.inventory_type)
|
||||
: '',
|
||||
entry_order_code: entryOrder?.entry_order_code ?? '',
|
||||
purchase_order_code: entryOrder?.purchase_order_code ?? '',
|
||||
store_name: entryOrder?.store_remask ?? entryOrder?.store_name ?? '',
|
||||
}
|
||||
}
|
||||
|
||||
/** 将 storage.entry.get 响应组装为入库单打印模板可用数据 */
|
||||
export function buildEntryPrintFormData(
|
||||
res: Record<string, unknown> | null | undefined,
|
||||
listRow?: Record<string, unknown> | null
|
||||
): Record<string, unknown> {
|
||||
const { entryOrder, items } = normalizeEntryDetailPayload(res)
|
||||
if (!entryOrder) {
|
||||
throw new Error('入库单数据为空')
|
||||
}
|
||||
|
||||
const receivingBindings = Array.isArray(entryOrder.receivingBindings)
|
||||
? entryOrder.receivingBindings
|
||||
: Array.isArray(listRow?.receivingBindings)
|
||||
? listRow.receivingBindings
|
||||
: []
|
||||
|
||||
const details = items.map((item, idx) =>
|
||||
mapEntryPrintDetailItem(item as Record<string, unknown>, idx, entryOrder)
|
||||
)
|
||||
|
||||
const total_items = details.length
|
||||
const total_quantity = details.reduce((sum, item) => sum + (Number(item.count) || 0), 0)
|
||||
const total_received_quantity = details.reduce(
|
||||
(sum, item) => sum + (Number(item.received_quantity) || 0),
|
||||
0
|
||||
)
|
||||
|
||||
const result: Record<string, unknown> = {
|
||||
...listRow,
|
||||
...entryOrder,
|
||||
id: entryOrder.id ?? listRow?.id,
|
||||
entry_order_code: entryOrder.entry_order_code ?? listRow?.entry_order_code ?? '',
|
||||
purchase_order_code: entryOrder.purchase_order_code ?? listRow?.purchase_order_code ?? '',
|
||||
store_name: entryOrder.store_remask ?? entryOrder.store_name ?? listRow?.store_name ?? '',
|
||||
store_remask: entryOrder.store_remask ?? entryOrder.store_name ?? listRow?.store_remask ?? listRow?.store_name ?? '',
|
||||
order_status: translateEntryField('order_status', entryOrder.order_status ?? listRow?.order_status),
|
||||
order_type: translateEntryField('order_type', entryOrder.order_type ?? listRow?.order_type),
|
||||
sync_status: translateEntryField('sync_status', entryOrder.sync_status ?? listRow?.sync_status),
|
||||
source_type: translateEntryField('source_type', entryOrder.source_type ?? listRow?.source_type),
|
||||
total_order_lines: entryOrder.total_order_lines ?? listRow?.total_order_lines ?? total_items,
|
||||
total_items,
|
||||
total_quantity,
|
||||
total_received_quantity,
|
||||
receiving_bindings_summary: formatReceivingBindingsSummary(receivingBindings),
|
||||
receivingBindings,
|
||||
details,
|
||||
}
|
||||
|
||||
if (details.length > 0) {
|
||||
const first = details[0]
|
||||
const promoteFields = [
|
||||
'warehouse_item_code',
|
||||
'warehouse_item_name',
|
||||
'warehouse_item_spec',
|
||||
'product_name',
|
||||
'product_code',
|
||||
'barcode',
|
||||
'count',
|
||||
'received_quantity',
|
||||
'actual_quantity',
|
||||
'confirm_quantity',
|
||||
'stock_id',
|
||||
'order_line_no',
|
||||
'seq_no',
|
||||
]
|
||||
promoteFields.forEach((field) => {
|
||||
if (result[field] === undefined || result[field] === null || result[field] === '') {
|
||||
result[field] = first?.[field] ?? ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
export type EntryTableColumn = {
|
||||
prop: string
|
||||
label: string
|
||||
|
||||
@ -346,7 +346,8 @@ import {
|
||||
formatEntryHasReceiving,
|
||||
formatReceivingBindingsSummary,
|
||||
getEntryHasReceivingTagType,
|
||||
translateEntryField
|
||||
translateEntryField,
|
||||
buildEntryPrintFormData
|
||||
} from './entry-config'
|
||||
|
||||
import entrydetail from './component/entrydetail.vue'
|
||||
@ -478,26 +479,10 @@ async function fetchEntryPrintData(row: any, _index: number): Promise<Record<str
|
||||
throw new Error('入库单ID无效')
|
||||
}
|
||||
const res = await entryApi.getEntryDetail({ id })
|
||||
if (res?.code !== 200 || !res.data?.entryOrder) {
|
||||
if (res?.code !== 200 && res?.code !== undefined) {
|
||||
throw new Error(res?.message || '获取入库单详情失败')
|
||||
}
|
||||
const entryOrder = res.data.entryOrder as Record<string, unknown>
|
||||
const result: Record<string, unknown> = { ...entryOrder }
|
||||
|
||||
// items 与 entryOrder 同级,在 res.data 下
|
||||
const items: any[] = res.data.items || []
|
||||
result.details = items.map((item: any, idx: number) => {
|
||||
const stock = item.stock || {}
|
||||
return {
|
||||
...item,
|
||||
...stock,
|
||||
// 条码:取 barcodes 数组第一条的 barcode
|
||||
barcode: item.barcode ?? stock.barcodes?.[0]?.barcode ?? '',
|
||||
// 序号
|
||||
seq_no: idx + 1,
|
||||
}
|
||||
})
|
||||
return result
|
||||
return buildEntryPrintFormData(res as Record<string, unknown>, row)
|
||||
}
|
||||
|
||||
function openBindDialog(row: any) {
|
||||
|
||||
472
src/views/storage/productflow/index.vue
Normal file
472
src/views/storage/productflow/index.vue
Normal file
@ -0,0 +1,472 @@
|
||||
<template>
|
||||
<div class="order-sub-container" :style="{ height: containerHeight }">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
cache-key="storage-productflow"
|
||||
width="250px"
|
||||
:tree-props="{ children: 'children', label: 'label' }"
|
||||
:auto-submit="false"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFieldsRef"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleConditionReset"
|
||||
@condition-clear="handleConditionClear"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<order-toolbar-button-group
|
||||
:buttons="toolbarButtons"
|
||||
:resolve-disabled="resolveButtonDisabled"
|
||||
:resolve-loading="resolveButtonLoading"
|
||||
:resolve-label="resolveButtonLabel"
|
||||
:layout-key="toolbarLayoutKey"
|
||||
@action="handleToolbarButtonClick"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||||
<upper-table
|
||||
ref="upperTable"
|
||||
title="商品流水列表"
|
||||
default-align="center"
|
||||
table-id="storage-productflow-list"
|
||||
:enable-column-config="true"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:loading="loading"
|
||||
:query-time="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@sort-change="handleSortChange"
|
||||
@refresh="loadList"
|
||||
>
|
||||
<template #column-created_at="{ row }">
|
||||
{{ formatDateTime(row.created_at) }}
|
||||
</template>
|
||||
<template #column-transaction_type="{ row }">
|
||||
<el-tag size="small" :type="getTransactionTypeTag(row.transaction_type)" effect="light">
|
||||
{{ getTransactionTypeLabel(row.transaction_type) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-quantity="{ row }">
|
||||
<span :class="getQuantityClass(row)">{{ formatQuantityDisplay(row) }}</span>
|
||||
</template>
|
||||
<template #column-batch_no="{ row }">
|
||||
{{ row.batch_no || '—' }}
|
||||
</template>
|
||||
<template #column-order_type="{ row }">
|
||||
{{ getOrderTypeLabel(row.order_type) }}
|
||||
</template>
|
||||
<template #column-order_no="{ row }">
|
||||
{{ row.order_no || '—' }}
|
||||
</template>
|
||||
<template #column-operator_name="{ row }">
|
||||
{{ row.operator_name || '—' }}
|
||||
</template>
|
||||
<template #column-remark="{ row }">
|
||||
<span class="remark-text">{{ row.remark || '—' }}</span>
|
||||
</template>
|
||||
<template #empty>
|
||||
<div class="empty-tip">暂无商品流水</div>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<template v-if="detailVisible">
|
||||
<div
|
||||
class="pane-resizer"
|
||||
title="拖动调整列表与详情区域高度"
|
||||
@mousedown="beginSplitDrag"
|
||||
/>
|
||||
<div v-if="selectedFlowId" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
|
||||
<div class="detail-header">
|
||||
<div class="detail-info">
|
||||
<span class="detail-title">流水详情 #{{ selectedFlowId }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-container">
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item label="流水ID">{{ selectedRowData.id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="流水时间">{{ formatDateTime(selectedRowData.created_at) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="流水类型">
|
||||
<el-tag size="small" :type="getTransactionTypeTag(selectedRowData.transaction_type)" effect="light">
|
||||
{{ getTransactionTypeLabel(selectedRowData.transaction_type) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="操作人">{{ selectedRowData.operator_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商品ID">{{ selectedRowData.stock_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="货主ID">{{ selectedRowData.store_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ selectedRowData.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="批次号">{{ selectedRowData.batch_no || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="变动数量">
|
||||
<span :class="getQuantityClass(selectedRowData)">{{ formatQuantityDisplay(selectedRowData) }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="可用库存">
|
||||
{{ selectedRowData.before_quantity ?? '—' }} → {{ selectedRowData.after_quantity ?? '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="锁定库存">
|
||||
{{ selectedRowData.before_locked_quantity ?? '—' }} → {{ selectedRowData.after_locked_quantity ?? '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单类型">{{ getOrderTypeLabel(selectedRowData.order_type) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单号">{{ selectedRowData.order_no || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单ID">{{ selectedRowData.order_id || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="收货单ID">{{ selectedRowData.receiving_id || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="入库单ID">{{ selectedRowData.entry_order_id || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ selectedRowData.remark || '—' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-selection" :style="lowerPaneStyle">
|
||||
<div class="empty-tip">
|
||||
<p>请从上方列表中选择一项查看详情</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { stockTransactionList } from '@/api/stock/stock'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import {
|
||||
columns as defaultColumns,
|
||||
availableFields,
|
||||
productflowToolbarButtons,
|
||||
formatDateTime,
|
||||
getTransactionTypeLabel,
|
||||
getTransactionTypeTag,
|
||||
getOrderTypeLabel,
|
||||
formatQuantityDelta
|
||||
} from './productflow-config'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
const upperTable = ref<any>(null)
|
||||
const presetTree = ref<any[]>([])
|
||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(availableFields)))
|
||||
|
||||
const settingsStore = useSettingsStore()
|
||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||||
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
|
||||
|
||||
const {
|
||||
splitStackRef,
|
||||
beginSplitDrag,
|
||||
lowerPaneStyle,
|
||||
upperPaneStyle
|
||||
} = useVerticalSplitPane({ defaultLowerPercent: 40 })
|
||||
|
||||
const upperPaneFullStyle = computed(() => ({
|
||||
flex: '1 1 auto',
|
||||
minHeight: '0',
|
||||
overflow: 'hidden'
|
||||
}))
|
||||
|
||||
const loading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
const list = ref<any[]>([])
|
||||
const selectedFlowId = ref<number | string | null>(null)
|
||||
const detailVisible = ref(true)
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const tableSize = ref('small')
|
||||
const columns = ref(defaultColumns)
|
||||
const currentCondition = ref<any>(null)
|
||||
const currentSort = reactive({ prop: 'created_at', order: 'DESC' })
|
||||
|
||||
const toolbarButtons = productflowToolbarButtons
|
||||
|
||||
const buttonLoadingMap = computed(() => ({
|
||||
loading: loading.value
|
||||
}))
|
||||
|
||||
const buttonLabelMap = computed(() => ({
|
||||
detailToggleLabel: detailVisible.value ? '隐藏详情' : '显示详情'
|
||||
}))
|
||||
|
||||
const toolbarLayoutKey = computed(() =>
|
||||
JSON.stringify({
|
||||
loading: buttonLoadingMap.value,
|
||||
labels: buttonLabelMap.value
|
||||
})
|
||||
)
|
||||
|
||||
const selectedRowData = computed(() => {
|
||||
return list.value.find(item => item.id === selectedFlowId.value) || {}
|
||||
})
|
||||
|
||||
function resolveButtonLoading(loadingKey?: string) {
|
||||
if (!loadingKey) return false
|
||||
return Boolean((buttonLoadingMap.value as Record<string, boolean>)[loadingKey])
|
||||
}
|
||||
|
||||
function resolveButtonDisabled(_disabledKey?: string) {
|
||||
return false
|
||||
}
|
||||
|
||||
function resolveButtonLabel(defaultLabel: string, dynamicLabelKey?: string) {
|
||||
if (!dynamicLabelKey) return defaultLabel
|
||||
return (buttonLabelMap.value as Record<string, string>)[dynamicLabelKey] || defaultLabel
|
||||
}
|
||||
|
||||
const toolbarActionMap: Record<string, () => void> = {
|
||||
loadList: () => {
|
||||
void loadList()
|
||||
},
|
||||
openColumnConfigPanel: () => openColumnConfigPanel(),
|
||||
toggleDetailVisible: () => toggleDetailVisible()
|
||||
}
|
||||
|
||||
function handleToolbarButtonClick(action: ToolbarButtonConfig['action']) {
|
||||
const handler = toolbarActionMap[action]
|
||||
if (!handler) return
|
||||
safeInvoke(() => handler())
|
||||
}
|
||||
|
||||
function toggleDetailVisible() {
|
||||
detailVisible.value = !detailVisible.value
|
||||
}
|
||||
|
||||
function openColumnConfigPanel() {
|
||||
upperTable.value?.openColumnConfig?.()
|
||||
}
|
||||
|
||||
function normalizeToWhere(condition: any) {
|
||||
if (!condition) return {}
|
||||
|
||||
if (condition.conditions && typeof condition.conditions === 'object') {
|
||||
const where: Record<string, any> = {}
|
||||
Object.keys(condition.conditions).forEach(k => {
|
||||
const c = condition.conditions[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
where[k] = c.operator
|
||||
? { operator: c.operator, value: c.value, type: c.type }
|
||||
: c.value
|
||||
} else if (c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
return where
|
||||
}
|
||||
|
||||
if (typeof condition === 'object') {
|
||||
const where: Record<string, any> = {}
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
where[k] = c.operator
|
||||
? { operator: c.operator, value: c.value, type: c.type }
|
||||
: c.value
|
||||
} else if (c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
return where
|
||||
}
|
||||
|
||||
return {}
|
||||
}
|
||||
|
||||
function formatQuantityDisplay(row: any): string {
|
||||
const qty = formatQuantityDelta(row)
|
||||
if (qty === undefined || qty === null) return '—'
|
||||
if (qty > 0) return `+${qty}`
|
||||
return String(qty)
|
||||
}
|
||||
|
||||
function getQuantityClass(row: any): string {
|
||||
const qty = formatQuantityDelta(row)
|
||||
if (qty === undefined || qty === null || qty === 0) return 'qty-flat'
|
||||
return qty > 0 ? 'qty-up' : 'qty-down'
|
||||
}
|
||||
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, presetRes]: any = await Promise.all([
|
||||
indexApi.loadStores({ type: 'transaction' }),
|
||||
indexApi.fastWhereTree('stock')
|
||||
])
|
||||
if (storesRes?.code === 200 || storesRes?.flag === 'success') {
|
||||
const field = availableFieldsRef.find((i: any) => i.value === 'store_id')
|
||||
if (field) field.options = storesRes.stores || []
|
||||
}
|
||||
if (presetRes?.code === 200) {
|
||||
presetTree.value = presetRes.presetTree || []
|
||||
}
|
||||
} catch {
|
||||
// 筛选项加载失败不阻塞列表
|
||||
}
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
const start = Date.now()
|
||||
try {
|
||||
const where = currentCondition.value || {}
|
||||
const res: any = await stockTransactionList({
|
||||
where: Object.keys(where).length > 0 ? where : undefined,
|
||||
pagination: {
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
},
|
||||
sort: {
|
||||
sortField: currentSort.prop || 'created_at',
|
||||
sortOrder: currentSort.order || 'DESC'
|
||||
}
|
||||
})
|
||||
|
||||
const payload = res?.data ?? res
|
||||
if (payload?.flag === 'success' || payload?.code === 200 || payload?.code === 1 || Array.isArray(payload?.list)) {
|
||||
list.value = payload.list || []
|
||||
const pg = payload.pagination || {}
|
||||
pagination.currentPage = pg.page || pagination.currentPage
|
||||
pagination.pageSize = pg.pageSize || pagination.pageSize
|
||||
pagination.total = pg.total || 0
|
||||
queryTime.value = Date.now() - start
|
||||
|
||||
if (selectedFlowId.value && !list.value.some(item => item.id === selectedFlowId.value)) {
|
||||
selectedFlowId.value = null
|
||||
}
|
||||
} else {
|
||||
list.value = []
|
||||
pagination.total = 0
|
||||
selectedFlowId.value = null
|
||||
ElMessage.error(payload?.message || '获取商品流水失败')
|
||||
}
|
||||
} catch {
|
||||
list.value = []
|
||||
pagination.total = 0
|
||||
selectedFlowId.value = null
|
||||
ElMessage.error('获取商品流水失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
currentCondition.value = normalizeToWhere(condition)
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleConditionClear() {
|
||||
currentCondition.value = null
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
currentCondition.value = null
|
||||
pagination.currentPage = 1
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else if (scanBox.value?.clear) {
|
||||
scanBox.value.clear()
|
||||
}
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleRowClick(row: any) {
|
||||
selectedFlowId.value = row?.id ?? null
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSortChange(payload: { prop?: string; order?: string }) {
|
||||
currentSort.prop = payload?.prop || 'created_at'
|
||||
const order = String(payload?.order || '').toLowerCase()
|
||||
currentSort.order = order === 'ascending' ? 'ASC' : order === 'descending' ? 'DESC' : 'DESC'
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadFilterData()
|
||||
loadList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 10px;
|
||||
overflow: auto;
|
||||
|
||||
:deep(.el-descriptions__label) {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.order-sub-container .main-content .lower-level .detail-header {
|
||||
padding: 10px;
|
||||
|
||||
.detail-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
|
||||
.detail-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.remark-text {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.qty-up {
|
||||
color: var(--el-color-success);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.qty-down {
|
||||
color: var(--el-color-danger);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.qty-flat {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
max-width: 360px;
|
||||
}
|
||||
</style>
|
||||
149
src/views/storage/productflow/productflow-config.ts
Normal file
149
src/views/storage/productflow/productflow-config.ts
Normal file
@ -0,0 +1,149 @@
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
|
||||
export function formatDateTime(dateStr: string | null | undefined): string {
|
||||
if (!dateStr) return '—'
|
||||
return String(dateStr).replace('T', ' ').slice(0, 19)
|
||||
}
|
||||
|
||||
export const transactionTypeConfig: Record<string, { text: string; tagType: string }> = {
|
||||
INBOUND: { text: '入库', tagType: 'success' },
|
||||
OUTBOUND: { text: '出库', tagType: 'danger' },
|
||||
LOCK: { text: '锁定', tagType: 'warning' },
|
||||
UNLOCK: { text: '解锁', tagType: 'info' },
|
||||
ADJUST: { text: '调整', tagType: 'primary' },
|
||||
TRANSFER: { text: '移库', tagType: 'primary' }
|
||||
}
|
||||
|
||||
export const orderTypeConfig: Record<string, string> = {
|
||||
ORDER: '订单',
|
||||
DELIVERY_ORDER: '出库单',
|
||||
RECEIVING: '收货单',
|
||||
ENTRY_ORDER: '入库单',
|
||||
INVENTORY: '盘点单',
|
||||
RETURN: '退货单'
|
||||
}
|
||||
|
||||
export const columns = [
|
||||
{ prop: 'created_at', label: '流水时间', width: 160, sortable: true },
|
||||
{ prop: 'transaction_type', label: '流水类型', width: 90 },
|
||||
{ prop: 'stock_id', label: '商品ID', width: 90 },
|
||||
{ prop: 'store_id', label: '货主ID', width: 90 },
|
||||
{ prop: 'warehouse_id', label: '仓库ID', width: 90 },
|
||||
{ prop: 'quantity', label: '变动数量', width: 90 },
|
||||
{ prop: 'before_quantity', label: '变动前库存', width: 100 },
|
||||
{ prop: 'after_quantity', label: '变动后库存', width: 100 },
|
||||
{ prop: 'before_locked_quantity', label: '变动前锁定', width: 100 },
|
||||
{ prop: 'after_locked_quantity', label: '变动后锁定', width: 100 },
|
||||
{ prop: 'batch_no', label: '批次号', minWidth: 110 },
|
||||
{ prop: 'order_type', label: '订单类型', width: 100 },
|
||||
{ prop: 'order_no', label: '订单号', minWidth: 160 },
|
||||
{ prop: 'order_id', label: '订单ID', width: 90 },
|
||||
{ prop: 'operator_name', label: '操作人', width: 90 },
|
||||
{ prop: 'remark', label: '备注', minWidth: 140 }
|
||||
]
|
||||
|
||||
/** 商品流水主工具栏按钮 */
|
||||
export const productflowToolbarButtons: ToolbarButtonConfig[] = [
|
||||
{ key: 'refresh', label: '刷新', type: 'primary', size: 'small', loadingKey: 'loading', action: 'loadList' },
|
||||
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
|
||||
{
|
||||
key: 'toggleDetail',
|
||||
label: '显示详情',
|
||||
dynamicLabelKey: 'detailToggleLabel',
|
||||
size: 'small',
|
||||
action: 'toggleDetailVisible'
|
||||
}
|
||||
]
|
||||
|
||||
export const availableFields = [
|
||||
{
|
||||
label: '商品ID',
|
||||
value: 'stock_id',
|
||||
type: 'number',
|
||||
placeholder: '请输入商品ID',
|
||||
operators: ['eq'],
|
||||
defaultOperator: 'eq'
|
||||
},
|
||||
{
|
||||
label: '订单号',
|
||||
value: 'order_no',
|
||||
type: 'text',
|
||||
placeholder: '请输入订单号',
|
||||
operators: ['contains', 'eq'],
|
||||
defaultOperator: 'eq'
|
||||
},
|
||||
{
|
||||
label: '批次号',
|
||||
value: 'batch_no',
|
||||
type: 'text',
|
||||
placeholder: '请输入批次号',
|
||||
operators: ['contains', 'eq'],
|
||||
defaultOperator: 'eq'
|
||||
},
|
||||
{
|
||||
label: '操作人',
|
||||
value: 'operator_name',
|
||||
type: 'text',
|
||||
placeholder: '请输入操作人',
|
||||
operators: ['eq', 'contains'],
|
||||
defaultOperator: 'eq'
|
||||
},
|
||||
{
|
||||
label: '货主',
|
||||
value: 'store_id',
|
||||
type: 'select',
|
||||
multiple: true,
|
||||
filterable: true,
|
||||
options: [] as Array<{ label: string; value: unknown }>
|
||||
},
|
||||
{
|
||||
label: '流水时间',
|
||||
value: 'created_at',
|
||||
type: 'date',
|
||||
operators: ['between', 'eq', 'gt', 'lt'],
|
||||
defaultOperator: 'between'
|
||||
},
|
||||
{
|
||||
label: '流水类型',
|
||||
value: 'transaction_type',
|
||||
type: 'select',
|
||||
options: Object.entries(transactionTypeConfig).map(([value, cfg]) => ({
|
||||
label: cfg.text,
|
||||
value
|
||||
}))
|
||||
},
|
||||
{
|
||||
label: '订单类型',
|
||||
value: 'order_type',
|
||||
type: 'select',
|
||||
options: Object.entries(orderTypeConfig).map(([value, label]) => ({
|
||||
label,
|
||||
value
|
||||
}))
|
||||
}
|
||||
]
|
||||
|
||||
export function getTransactionTypeLabel(type: string): string {
|
||||
return transactionTypeConfig[type]?.text || type || '—'
|
||||
}
|
||||
|
||||
export function getTransactionTypeTag(type: string): string {
|
||||
return transactionTypeConfig[type]?.tagType || 'info'
|
||||
}
|
||||
|
||||
export function getOrderTypeLabel(type: string): string {
|
||||
return orderTypeConfig[type] || type || '—'
|
||||
}
|
||||
|
||||
export function formatQuantityDelta(row: {
|
||||
quantity?: number
|
||||
before_quantity?: number
|
||||
after_quantity?: number
|
||||
transaction_type?: string
|
||||
}): number | undefined {
|
||||
if (row.quantity !== undefined && row.quantity !== null) return row.quantity
|
||||
const before = row.before_quantity
|
||||
const after = row.after_quantity
|
||||
if (before === undefined || after === undefined) return undefined
|
||||
return after - before
|
||||
}
|
||||
379
src/views/store/shipperSigning/index.vue
Normal file
379
src/views/store/shipperSigning/index.vue
Normal file
@ -0,0 +1,379 @@
|
||||
<template>
|
||||
<div class="shipper-signing-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="货主筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
:initial-conditions="{ use_status: 1 }"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-tag v-if="currentSubject.company_name" size="small" type="primary" effect="plain">
|
||||
当前仓库:{{ currentSubject.company_name }}
|
||||
</el-tag>
|
||||
<el-button size="small" @click="loadList">
|
||||
<el-icon><Refresh /></el-icon> 刷新
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-input
|
||||
v-model="queryForm.keyword"
|
||||
placeholder="搜索货主名或备注"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 200px"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="upper-wrapper">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
default-align="center"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
@current-change="handleRowClick"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handleSizeChange"
|
||||
>
|
||||
<template #column-counterparty_name="{ row }">
|
||||
<span>{{ row.remask || row.counterparty_name }}</span>
|
||||
<span v-if="row.remask && row.remask !== row.counterparty_name" class="real-name">({{ row.counterparty_name }})</span>
|
||||
</template>
|
||||
<template #column-auth_status="{ row }">
|
||||
<el-tag size="small" :type="getAuthStatusType(row.auth_status)" effect="light">
|
||||
{{ row.auth_status_label || getAuthStatusLabel(row.auth_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-needs_my_confirm="{ row }">
|
||||
<el-tag v-if="row.needs_my_confirm" size="small" type="warning" effect="dark">待我确认</el-tag>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</template>
|
||||
<template #column-use_status="{ row }">
|
||||
<el-tag size="small" :type="row.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ row.use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-auth_end="{ row }">
|
||||
<span :class="{ 'text-danger': isExpired(row.auth_end) }">{{ row.auth_end || '—' }}</span>
|
||||
</template>
|
||||
<template #column-print_quantity="{ row }">
|
||||
{{ row.print_quantity ?? '—' }}
|
||||
</template>
|
||||
<template #column-has_qimen_config="{ row }">
|
||||
<el-tag size="small" :type="row.has_qimen_config ? 'success' : 'info'" effect="plain">
|
||||
{{ row.has_qimen_config ? '已配置' : '未配置' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<div class="lower-level" v-if="selectedRow">
|
||||
<div class="detail-header">
|
||||
<el-tabs v-model="activeTab" class="detail-tab">
|
||||
<el-tab-pane label="签约详情" name="details" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div class="detail-container">
|
||||
<el-descriptions v-if="activeTab === 'details'" :column="2" border size="small">
|
||||
<el-descriptions-item label="签约ID">{{ selectedRow.id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="签约状态">
|
||||
<el-tag size="small" :type="getAuthStatusType(selectedRow.auth_status)" effect="light">
|
||||
{{ selectedRow.auth_status_label || getAuthStatusLabel(selectedRow.auth_status) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="签约货主">
|
||||
{{ selectedRow.remask || selectedRow.counterparty_name || '—' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentSubject.company_name" label="当前仓库">
|
||||
{{ currentSubject.company_name }}
|
||||
<el-tag size="small" type="primary" effect="plain" style="margin-left:6px">仓库方</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="货主ID">{{ selectedRow.store_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ selectedRow.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="使用状态">
|
||||
<el-tag size="small" :type="selectedRow.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ selectedRow.use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="待我确认">
|
||||
<el-tag v-if="selectedRow.needs_my_confirm" size="small" type="warning" effect="dark">是</el-tag>
|
||||
<span v-else>否</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="授权截止">
|
||||
<span :class="{ 'text-danger': isExpired(selectedRow.auth_end) }">{{ selectedRow.auth_end || '—' }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="面单余额">{{ selectedRow.print_quantity ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="奇门配置">
|
||||
<el-tag size="small" :type="selectedRow.has_qimen_config ? 'success' : 'info'" effect="plain">
|
||||
{{ selectedRow.has_qimen_config ? '已配置' : '未配置' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="selectedRow.counterparty_name && selectedRow.remask" label="货主全称" :span="2">
|
||||
{{ selectedRow.counterparty_name }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lower-level empty" v-else>
|
||||
<el-empty description="请选择数据查看详情" :image-size="60" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
const columns = [
|
||||
{ prop: 'counterparty_name', label: '签约货主', minWidth: 140 },
|
||||
{ prop: 'auth_status', label: '签约状态', width: 100 },
|
||||
{ prop: 'needs_my_confirm', label: '待确认', width: 90 },
|
||||
{ prop: 'use_status', label: '使用状态', width: 90 },
|
||||
{ prop: 'print_quantity', label: '面单余额', width: 100 },
|
||||
{ prop: 'has_qimen_config', label: '奇门配置', width: 100 },
|
||||
{ prop: 'auth_end', label: '授权截止', width: 120 }
|
||||
]
|
||||
|
||||
const availableFields = [
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已解除', value: 4 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
value: 'use_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const presetTree: any[] = []
|
||||
|
||||
const currentSubject = ref<{ store_id?: number; company_name?: string; role?: string }>({})
|
||||
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
const activeTab = ref('details')
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
const currentCondition = ref<any>({ use_status: 1 })
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
page: pagination.currentPage,
|
||||
page_size: pagination.pageSize,
|
||||
...currentCondition.value
|
||||
}
|
||||
if (queryForm.keyword) params.keyword = queryForm.keyword
|
||||
|
||||
const res = await storeWarehouseWarehouseList(params) as any
|
||||
if (res?.data) {
|
||||
const payload = res.data
|
||||
list.value = payload.list || []
|
||||
pagination.total = payload.pagination?.total || payload.total || 0
|
||||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||||
if (payload.current_subject) {
|
||||
currentSubject.value = payload.current_subject
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('获取货主签约列表失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function isExpired(dateStr: string | null): boolean {
|
||||
if (!dateStr) return false
|
||||
const d = new Date(dateStr)
|
||||
if (isNaN(d.getTime())) return false
|
||||
return d < new Date()
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleRowClick(row: any) {
|
||||
selectedRow.value = row
|
||||
}
|
||||
|
||||
function getAuthStatusType(status: number): string {
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
function getAuthStatusLabel(status: number): string {
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.shipper-signing-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
flex-shrink: 0;
|
||||
gap: 12px;
|
||||
|
||||
&-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lower-level {
|
||||
margin-top: 8px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&.empty {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
padding: 12px;
|
||||
overflow: auto;
|
||||
max-height: 260px;
|
||||
}
|
||||
}
|
||||
|
||||
.text-danger {
|
||||
color: #f56c6c;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.real-name {
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
:deep(.el-descriptions__label) {
|
||||
width: 110px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,16 +1,5 @@
|
||||
<template>
|
||||
<div class="store-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="货主筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
:initial-conditions="{ use_status: 1 }"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
@ -57,8 +46,11 @@
|
||||
@page-size-change="handleSizeChange"
|
||||
>
|
||||
<template #column-counterparty_name="{ row }">
|
||||
<span>{{ row.remask || row.counterparty_name }}</span>
|
||||
<span v-if="row.remask && row.remask !== row.counterparty_name" class="real-name">({{ row.counterparty_name }})</span>
|
||||
<span>{{ row.store_name || row.remask || row.counterparty_name }}</span>
|
||||
<span
|
||||
v-if="(row.store_name || row.remask) && row.counterparty_name && (row.store_name || row.remask) !== row.counterparty_name"
|
||||
class="real-name"
|
||||
>({{ row.counterparty_name }})</span>
|
||||
</template>
|
||||
<template #column-current_subject_role="{ row }">
|
||||
<el-tag size="small" :type="row.current_subject_role === 'warehouse' ? 'primary' : 'warning'" effect="light">
|
||||
@ -70,9 +62,9 @@
|
||||
{{ row.auth_status_label || getAuthStatusLabel(row.auth_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-use_status="{ row }">
|
||||
<el-tag size="small" :type="row.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ row.use_status === 1 ? '启用' : '禁用' }}
|
||||
<template #column-warehouse_use_status="{ row }">
|
||||
<el-tag size="small" :type="row.warehouse_use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ row.warehouse_use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-is_auth_valid="{ row }">
|
||||
@ -117,7 +109,7 @@
|
||||
@click.stop="openAdjustBalanceDialog(row)"
|
||||
>调整余额</el-button>
|
||||
<el-button
|
||||
v-if="row.use_status === 1"
|
||||
v-if="row.warehouse_use_status === 1"
|
||||
size="small"
|
||||
type="danger"
|
||||
link
|
||||
@ -361,9 +353,9 @@
|
||||
{{ detailDialog.row.auth_status_label || getAuthStatusLabel(detailDialog.row.auth_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template v-else-if="field.prop === 'use_status'">
|
||||
<el-tag size="small" :type="detailDialog.row.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ detailDialog.row.use_status === 1 ? '启用' : '禁用' }}
|
||||
<template v-else-if="field.prop === 'warehouse_use_status'">
|
||||
<el-tag size="small" :type="detailDialog.row.warehouse_use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ detailDialog.row.warehouse_use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template v-else-if="field.prop === 'is_auth_valid'">
|
||||
@ -435,7 +427,7 @@
|
||||
<!-- 签约策略配置弹窗 -->
|
||||
<el-dialog
|
||||
v-model="policyDialog.visible"
|
||||
:title="`策略配置 — ${policyDialog.contractRow?.remask || policyDialog.contractRow?.counterparty_name || ''}`"
|
||||
:title="`策略配置 — ${policyDialog.contractRow?.store_name || policyDialog.contractRow?.remask || policyDialog.contractRow?.counterparty_name || ''}`"
|
||||
width="560px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@ -589,7 +581,7 @@
|
||||
<!-- 奇门接口配置管理弹窗 -->
|
||||
<el-dialog
|
||||
v-model="qimenDialog.visible"
|
||||
:title="`接口配置管理 — ${qimenDialog.contractRow?.remask || qimenDialog.contractRow?.counterparty_name || ''}`"
|
||||
:title="`接口配置管理 — ${qimenDialog.contractRow?.store_name || qimenDialog.contractRow?.remask || qimenDialog.contractRow?.counterparty_name || ''}`"
|
||||
width="80%"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
@ -1022,20 +1014,18 @@ import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind,
|
||||
storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig,
|
||||
storeWarehouseAdjustPrintQuantity, storeWarehouseQueryPrintQuantityLogs, listApiConfig,
|
||||
storeWarehouseOpenAccount
|
||||
} 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'
|
||||
import Detail from './component/detail.vue'
|
||||
import Log from './component/log.vue'
|
||||
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, signDialogDefault, signFormDefault, qimenFormDefault, signFormItems, qimenFormItems, qimenTableColumns, detailPanel, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems } from './store-config'
|
||||
import { columns as defaultColumns, signDialogDefault, signFormDefault, qimenFormDefault, signFormItems, qimenFormItems, qimenTableColumns, detailPanel, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems } from './store-config.ts'
|
||||
|
||||
// ─── 列表 ───────────────────────────────────────────────────────────────────
|
||||
const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
|
||||
const activeTab = ref('details')
|
||||
const componentMap: Record<string, any> = {
|
||||
@ -1081,23 +1071,16 @@ const toggleBalance = () => {
|
||||
}
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive<{
|
||||
keyword: string
|
||||
auth_status: number | undefined
|
||||
use_status: number | undefined
|
||||
}>({ keyword: '', auth_status: undefined, use_status: undefined })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
|
||||
const columns = ref(defaultColumns)
|
||||
const availableFields = reactive(defaultAvailableFields)
|
||||
const presetTree = ref<any[]>(defaultPresetTree)
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
page: pagination.currentPage,
|
||||
page_size: pagination.pageSize,
|
||||
...currentCondition.value
|
||||
page_size: pagination.pageSize
|
||||
}
|
||||
if (queryForm.keyword) params.keyword = queryForm.keyword
|
||||
|
||||
@ -1106,8 +1089,8 @@ async function loadList() {
|
||||
const payload = res.data
|
||||
list.value = payload.list || []
|
||||
pagination.total = payload.pagination?.total || payload.total || 0
|
||||
pagination.currentPage = payload.pagination?.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || pagination.pageSize
|
||||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||||
}
|
||||
} catch (e) {
|
||||
ElMessage.error('获取列表失败')
|
||||
@ -1116,47 +1099,11 @@ async function loadList() {
|
||||
}
|
||||
}
|
||||
|
||||
const currentCondition = ref<any>({ use_status: 1 })
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
|
||||
// 处理 ScanBox 的自定义筛选条件
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
// ScanBox 传出的是 { value, operator } 或直接是值
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
// 降级处理:如果没有 scanBox 实例也应该能正常重置并加载
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
@ -1351,12 +1298,12 @@ function handleBalanceLogSizeChange(size: number) {
|
||||
|
||||
// ─── 状态辅助 ────────────────────────────────────────────────────────────────
|
||||
function getAuthStatusType(status: number) {
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info' }
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info', 5: 'danger' }
|
||||
return (map[status] || 'info') as any
|
||||
}
|
||||
|
||||
function getAuthStatusLabel(status: number) {
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已终止' }
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除', 5: '已过期' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
@ -1370,7 +1317,7 @@ async function handleUnbind(row: any, targetStatus: number) {
|
||||
const actionLabel = targetStatus === 0 ? '禁用' : '启用'
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认要${actionLabel}与「${row.counterparty_remask || row.counterparty_name}」的签约关系吗?`,
|
||||
`确认要${actionLabel}与「${row.store_name || row.remask || row.counterparty_name}」的签约关系吗?`,
|
||||
`${actionLabel}签约`,
|
||||
{ type: targetStatus === 0 ? 'warning' : 'info', confirmButtonText: actionLabel, cancelButtonText: '取消' }
|
||||
)
|
||||
@ -1381,7 +1328,7 @@ async function handleUnbind(row: any, targetStatus: number) {
|
||||
try {
|
||||
const res = await storeWarehouseUnbind({
|
||||
id: row.id,
|
||||
use_status: targetStatus
|
||||
warehouse_use_status: targetStatus
|
||||
}) as any
|
||||
if (res?.flag === 'success' || res?.code === 200) {
|
||||
ElMessage.success(`${actionLabel}成功`)
|
||||
@ -1804,10 +1751,7 @@ function parsePrintQuantity(value: unknown): number | undefined {
|
||||
/** 调用 storeWarehouse.store.list,按签约 id 拉取最新一行(含 print_quantity) */
|
||||
async function fetchLatestContractRowById(contractId: number): Promise<any | null> {
|
||||
const filterAttempts: Record<string, unknown>[] = [
|
||||
{
|
||||
...currentCondition.value,
|
||||
...(queryForm.keyword ? { keyword: queryForm.keyword } : {})
|
||||
},
|
||||
queryForm.keyword ? { keyword: queryForm.keyword } : {},
|
||||
{}
|
||||
]
|
||||
|
||||
@ -171,39 +171,14 @@ export const columns = [
|
||||
{ prop: 'store_id', label: '货主ID', width: 90 },
|
||||
{ prop: 'counterparty_name', label: '货主', minWidth: 120 },
|
||||
{ prop: 'auth_status', label: '签约状态', width: 100 },
|
||||
{ prop: 'use_status', label: '使用状态', width: 90 },
|
||||
{ prop: 'warehouse_use_status', label: '使用状态', width: 90 },
|
||||
{ prop: 'print_quantity', label: '面单余额', width: 100 },
|
||||
//{ prop: 'is_auth_valid', label: '授权有效', width: 90, align: 'center' },
|
||||
// { prop: 'remaining_days', label: '剩余天数', width: 90, align: 'center' },
|
||||
{ prop: 'has_qimen_config', label: '奇门配置', width: 100 },
|
||||
{ prop: 'apply_time', label: '申请时间', width: 160 },
|
||||
{ prop: 'actions', label: '操作', width: 380, fixed: 'right' }
|
||||
]
|
||||
|
||||
export const availableFields = [
|
||||
// { label: '对方主体', value: 'counterparty_id', type: 'input' },
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已终止', value: 4 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
value: 'use_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 }
|
||||
]
|
||||
}
|
||||
]
|
||||
export const availableFields: any[] = []
|
||||
|
||||
export const presetTree: any[] = []
|
||||
|
||||
@ -1,16 +1,5 @@
|
||||
<template>
|
||||
<div class="warehouses-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
title="仓库筛选"
|
||||
:preset-tree="presetTree"
|
||||
:available-fields="availableFields"
|
||||
:initial-conditions="{ use_status: 1 }"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleReset"
|
||||
/>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
@ -53,8 +42,11 @@
|
||||
@page-size-change="handleSizeChange"
|
||||
>
|
||||
<template #column-counterparty_name="{ row }">
|
||||
<span>{{ row.remask || row.counterparty_name }}</span>
|
||||
<span v-if="row.remask && row.remask !== row.counterparty_name" class="real-name">({{ row.counterparty_name }})</span>
|
||||
<span>{{ row.warehouse_name || row.remask || row.counterparty_name }}</span>
|
||||
<span
|
||||
v-if="(row.warehouse_name || row.remask) && row.counterparty_name && (row.warehouse_name || row.remask) !== row.counterparty_name"
|
||||
class="real-name"
|
||||
>({{ row.counterparty_name }})</span>
|
||||
</template>
|
||||
<template #column-auth_status="{ row }">
|
||||
<el-tag size="small" :type="getAuthStatusType(row.auth_status)" effect="light">
|
||||
@ -65,9 +57,9 @@
|
||||
<el-tag v-if="row.needs_my_confirm" size="small" type="warning" effect="dark">待我确认</el-tag>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</template>
|
||||
<template #column-use_status="{ row }">
|
||||
<el-tag size="small" :type="row.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ row.use_status === 1 ? '启用' : '禁用' }}
|
||||
<template #column-store_use_status="{ row }">
|
||||
<el-tag size="small" :type="row.store_use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ row.store_use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-auth_end="{ row }">
|
||||
@ -96,14 +88,14 @@
|
||||
@click.stop="handleConfirmSign(row)"
|
||||
>确认签约</el-button>
|
||||
<el-button
|
||||
v-if="row.use_status === 1 && row.auth_status !== 1"
|
||||
v-if="row.store_use_status === 1 && row.auth_status !== 1"
|
||||
size="small"
|
||||
type="danger"
|
||||
link
|
||||
@click.stop="handleUnbind(row, 0)"
|
||||
>禁用</el-button>
|
||||
<el-button
|
||||
v-else-if="row.use_status === 0 && row.auth_status !== 1"
|
||||
v-else-if="row.store_use_status === 0 && row.auth_status !== 1"
|
||||
size="small"
|
||||
type="success"
|
||||
link
|
||||
@ -130,15 +122,15 @@
|
||||
{{ selectedRow.auth_status_label || getAuthStatusLabel(selectedRow.auth_status) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="签约仓库">{{ selectedRow.remask || selectedRow.counterparty_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="签约仓库">{{ selectedRow.warehouse_name || selectedRow.remask || selectedRow.counterparty_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item v-if="currentSubject.company_name" label="当前货主">
|
||||
{{ currentSubject.company_name }}
|
||||
<el-tag size="small" type="warning" effect="plain" style="margin-left:6px">货主方</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ selectedRow.warehouse_id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="使用状态">
|
||||
<el-tag size="small" :type="selectedRow.use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ selectedRow.use_status === 1 ? '启用' : '禁用' }}
|
||||
<el-tag size="small" :type="selectedRow.store_use_status === 1 ? 'success' : 'info'" effect="light">
|
||||
{{ selectedRow.store_use_status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="授权截止">
|
||||
@ -286,7 +278,6 @@ import {
|
||||
storeWarehouseUnbind,
|
||||
storeWarehouseRename
|
||||
} from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
|
||||
// ─── 列表列配置 ─────────────────────────────────────────────────────────────
|
||||
@ -294,40 +285,13 @@ const columns = [
|
||||
{ prop: 'counterparty_name', label: '签约仓库', minWidth: 140 },
|
||||
{ prop: 'auth_status', label: '签约状态', width: 100 },
|
||||
{ prop: 'needs_my_confirm', label: '待确认', width: 90 },
|
||||
{ prop: 'use_status', label: '使用状态', width: 90 },
|
||||
{ prop: 'store_use_status', label: '使用状态', width: 90 },
|
||||
{ prop: 'print_quantity', label: '面单余额', width: 100 },
|
||||
{ prop: 'has_qimen_config', label: '奇门配置', width: 100 },
|
||||
{ prop: 'auth_end', label: '授权截止', width: 120 },
|
||||
{ prop: 'actions', label: '操作', width: 280, fixed: 'right' }
|
||||
]
|
||||
|
||||
// ─── 筛选字段配置 ─────────────────────────────────────────────────────────
|
||||
const availableFields = [
|
||||
{
|
||||
label: '签约状态',
|
||||
value: 'auth_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '待审核', value: 1 },
|
||||
{ label: '已通过', value: 2 },
|
||||
{ label: '已拒绝', value: 3 },
|
||||
{ label: '已终止', value: 4 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '使用状态',
|
||||
value: 'use_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '禁用', value: 0 }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const presetTree: any[] = []
|
||||
|
||||
// ─── 当前主体信息(从列表接口返回) ────────────────────────────────────────
|
||||
const currentSubject = ref<{ store_id?: number; company_name?: string; role?: string }>({})
|
||||
|
||||
@ -336,17 +300,10 @@ const loading = ref(false)
|
||||
const list = ref<any[]>([])
|
||||
const selectedRow = ref<any>(null)
|
||||
const tableRef = ref<any>(null)
|
||||
const scanBox = ref<any>(null)
|
||||
const activeTab = ref('details')
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const queryForm = reactive<{
|
||||
keyword: string
|
||||
auth_status: number | undefined
|
||||
use_status: number | undefined
|
||||
}>({ keyword: '', auth_status: undefined, use_status: undefined })
|
||||
|
||||
const currentCondition = ref<any>({ use_status: 1 })
|
||||
const queryForm = reactive({ keyword: '' })
|
||||
|
||||
// ─── 加载列表 ──────────────────────────────────────────────────────────────
|
||||
async function loadList() {
|
||||
@ -354,8 +311,7 @@ async function loadList() {
|
||||
try {
|
||||
const params: any = {
|
||||
page: pagination.currentPage,
|
||||
page_size: pagination.pageSize,
|
||||
...currentCondition.value
|
||||
page_size: pagination.pageSize
|
||||
}
|
||||
if (queryForm.keyword) params.keyword = queryForm.keyword
|
||||
|
||||
@ -364,8 +320,8 @@ async function loadList() {
|
||||
const payload = res.data
|
||||
list.value = payload.list || []
|
||||
pagination.total = payload.pagination?.total || payload.total || 0
|
||||
pagination.currentPage = payload.pagination?.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || pagination.pageSize
|
||||
pagination.currentPage = payload.pagination?.page || payload.page || pagination.currentPage
|
||||
pagination.pageSize = payload.pagination?.pageSize || payload.page_size || pagination.pageSize
|
||||
if (payload.current_subject) {
|
||||
currentSubject.value = payload.current_subject
|
||||
}
|
||||
@ -384,41 +340,11 @@ function isExpired(dateStr: string): boolean {
|
||||
return d < new Date()
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
const where: any = {}
|
||||
if (condition) {
|
||||
Object.keys(condition).forEach(k => {
|
||||
const c = condition[k]
|
||||
if (c && typeof c === 'object' && c.value !== undefined) {
|
||||
if (c.value !== '' && c.value !== null) {
|
||||
where[k] = c.value
|
||||
}
|
||||
} else if (c !== '' && c !== null && c !== undefined) {
|
||||
where[k] = c
|
||||
}
|
||||
})
|
||||
}
|
||||
currentCondition.value = where
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
queryForm.keyword = ''
|
||||
currentCondition.value = {}
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
} else {
|
||||
pagination.currentPage = 1
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadList()
|
||||
@ -436,12 +362,12 @@ function handleRowClick(row: any) {
|
||||
|
||||
// ─── 工具函数 ──────────────────────────────────────────────────────────────
|
||||
function getAuthStatusType(status: number): string {
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info' }
|
||||
const map: Record<number, string> = { 1: 'warning', 2: 'success', 3: 'danger', 4: 'info', 5: 'danger' }
|
||||
return map[status] || 'info'
|
||||
}
|
||||
|
||||
function getAuthStatusLabel(status: number): string {
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已终止' }
|
||||
const map: Record<number, string> = { 1: '待审核', 2: '已通过', 3: '已拒绝', 4: '已解除', 5: '已过期' }
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
@ -454,7 +380,7 @@ async function handleUnbind(row: any, targetStatus: number) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await storeWarehouseUnbind({ id: row.id, use_status: targetStatus })
|
||||
await storeWarehouseUnbind({ id: row.id, store_use_status: targetStatus })
|
||||
ElMessage.success(`${action}成功`)
|
||||
loadList()
|
||||
} catch (e) {
|
||||
@ -586,7 +512,7 @@ function goBackToStep1() {
|
||||
async function handleConfirmSign(row: any) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认与「${row.remask || row.counterparty_name}」的签约关系?`,
|
||||
`确认与「${row.warehouse_name || row.remask || row.counterparty_name}」的签约关系?`,
|
||||
'确认签约',
|
||||
{ type: 'warning' }
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user