4月15
This commit is contained in:
parent
9712731d19
commit
c52355ad8c
2
env.d.ts
vendored
2
env.d.ts
vendored
@ -4,7 +4,7 @@ declare module '@/utils/auth' {
|
||||
export function setToken(token: string): void
|
||||
export function removeToken(): void
|
||||
}
|
||||
declare module '@/api/user' {
|
||||
declare module '@/api/user/user' {
|
||||
export function login(data: any): Promise<any>
|
||||
export function getInfo(data: any): Promise<any>
|
||||
export function changeRole(data: any): Promise<any>
|
||||
|
||||
@ -10,6 +10,13 @@
|
||||
"build-only": "vite build",
|
||||
"type-check": "vue-tsc --build",
|
||||
"update": "node ./workflows/api-doc-sync/update.mjs",
|
||||
"apiconfig": "node ./workflows/api-doc-system/update.mjs",
|
||||
"apiconfig:clear-pending": "node ./workflows/api-doc-system/clear-pending.mjs",
|
||||
"apiconfig:clean-marked": "node ./workflows/api-doc-system/cleanup-marked.mjs",
|
||||
"apiconfig:api-list-update": "node ./workflows/api-doc-system/api-list-update.mjs",
|
||||
"apiconfig:api-interface-update": "node ./workflows/api-doc-system/api-interface-update.mjs",
|
||||
"apiconfig:api-interface-clean": "node ./workflows/api-doc-system/api-interface-clean.mjs",
|
||||
"apiagent": "node ./workflows/api-doc-agent/run.mjs",
|
||||
"lint": "eslint . --cache",
|
||||
"lint:fix": "eslint . --cache --fix",
|
||||
"format": "prettier . --write",
|
||||
|
||||
39
src/api/order.deliveryOrder/orderdeliveryOrder.ts
Normal file
39
src/api/order.deliveryOrder/orderdeliveryOrder.ts
Normal file
@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
export type OrderWhere = Record<string, any>
|
||||
export type OrderSort = {
|
||||
sortField?: string
|
||||
sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
field?: string
|
||||
order?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
}
|
||||
export type OrderPagination = {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export type DeliveryOrderListParams = {
|
||||
pagination?: OrderPagination
|
||||
where?: OrderWhere
|
||||
sort?: OrderSort
|
||||
}
|
||||
|
||||
export function orderDeliveryOrderList(data: DeliveryOrderListParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.deliveryOrder.list',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const orderDeliveryOrder = {
|
||||
list: orderDeliveryOrderList
|
||||
}
|
||||
76
src/api/order.index/orderindex.ts
Normal file
76
src/api/order.index/orderindex.ts
Normal file
@ -0,0 +1,76 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
export type OrderListParams = {
|
||||
pagination?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
currentPage?: number
|
||||
page_size?: number
|
||||
size?: number
|
||||
}
|
||||
where?: Record<string, any>
|
||||
sort?: {
|
||||
sortField?: string
|
||||
sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
field?: string
|
||||
order?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
}
|
||||
}
|
||||
|
||||
export type ManualOutboundParams = {
|
||||
warehouseId?: number
|
||||
warehouse_id?: number
|
||||
warehouseIds?: number[]
|
||||
queryTimeoutMs?: number
|
||||
executionTimeoutMs?: number
|
||||
}
|
||||
|
||||
export function orderList(data: OrderListParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderManualOutboundOrder(data: ManualOutboundParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.manualOutboundOrder',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderBadgeCount(): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.badgeCount',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data: {},
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const order = {
|
||||
list: orderList,
|
||||
manualOutboundOrder: orderManualOutboundOrder,
|
||||
badgeCount: orderBadgeCount
|
||||
}
|
||||
62
src/api/order.outboundOrder/orderoutboundOrder.ts
Normal file
62
src/api/order.outboundOrder/orderoutboundOrder.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
export type OrderWhere = Record<string, any>
|
||||
export type OrderSort = {
|
||||
sortField?: string
|
||||
sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
field?: string
|
||||
order?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
}
|
||||
export type OrderPagination = {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export type OutboundOrderListParams = {
|
||||
pagination?: OrderPagination
|
||||
where?: OrderWhere
|
||||
sort?: OrderSort
|
||||
}
|
||||
|
||||
export type ManualOutboundParams = {
|
||||
warehouseId?: number
|
||||
warehouse_id?: number
|
||||
warehouseIds?: number[]
|
||||
queryTimeoutMs?: number
|
||||
executionTimeoutMs?: number
|
||||
}
|
||||
|
||||
export function orderOutboundOrderList(data: OutboundOrderListParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.outboundOrder.list',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderOutboundOrderManualOutboundOrder(data: ManualOutboundParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.outboundOrder.manualOutboundOrder',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const orderOutboundOrder = {
|
||||
list: orderOutboundOrderList,
|
||||
manualOutboundOrder: orderOutboundOrderManualOutboundOrder
|
||||
}
|
||||
94
src/api/order.pendingOrder/orderpendingOrder.ts
Normal file
94
src/api/order.pendingOrder/orderpendingOrder.ts
Normal file
@ -0,0 +1,94 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
export type OrderWhere = Record<string, any>
|
||||
export type OrderSort = {
|
||||
sortField?: string
|
||||
sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
field?: string
|
||||
order?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
}
|
||||
export type OrderPagination = {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export type PendingOrderListParams = {
|
||||
pagination?: OrderPagination
|
||||
where?: OrderWhere
|
||||
sort?: OrderSort
|
||||
}
|
||||
|
||||
export type PendingOrderIdsParams = {
|
||||
ids: Array<number | string>
|
||||
}
|
||||
|
||||
export type PendingOrderReverseReviewParams = {
|
||||
ids?: Array<number | string>
|
||||
id?: number | string
|
||||
order_id?: number | string
|
||||
}
|
||||
|
||||
export function orderPendingOrderList(data: PendingOrderListParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.list',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderPendingOrderReverseReviewOrder(data: PendingOrderReverseReviewParams): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.reverseReviewOrder',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderPendingOrderMarkPendingOutboundOrder(data: PendingOrderIdsParams): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.markPendingOutboundOrder',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderPendingOrderCancelOrder(data: PendingOrderIdsParams): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.cancelOrder',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const orderPendingOrder = {
|
||||
list: orderPendingOrderList,
|
||||
reverseReviewOrder: orderPendingOrderReverseReviewOrder,
|
||||
markPendingOutboundOrder: orderPendingOrderMarkPendingOutboundOrder,
|
||||
cancelOrder: orderPendingOrderCancelOrder
|
||||
}
|
||||
58
src/api/order.reviewOrder/orderreviewOrder.ts
Normal file
58
src/api/order.reviewOrder/orderreviewOrder.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
export type OrderWhere = Record<string, any>
|
||||
export type OrderSort = {
|
||||
sortField?: string
|
||||
sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
field?: string
|
||||
order?: 'asc' | 'desc' | 'ASC' | 'DESC'
|
||||
}
|
||||
export type OrderPagination = {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export type ReviewOrderListParams = {
|
||||
pagination?: OrderPagination
|
||||
where?: OrderWhere
|
||||
sort?: OrderSort
|
||||
}
|
||||
|
||||
export type ReviewOrderSubmitParams = {
|
||||
ids: Array<number | string>
|
||||
}
|
||||
|
||||
export function orderReviewOrderList(data: ReviewOrderListParams = {}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.reviewOrder.list',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderReviewOrderReviewOrder(data: ReviewOrderSubmitParams): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.reviewOrder.reviewOrder',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const orderReviewOrder = {
|
||||
list: orderReviewOrderList,
|
||||
reviewOrder: orderReviewOrderReviewOrder
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
const v = "1.0";
|
||||
|
||||
/** 获取账号绑定基础信息(页面初始化用) */
|
||||
export const getBindInfo = () => {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'account.getBindInfo',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data: {},
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export interface BindWechatCodeParams {
|
||||
/** 是否强制刷新状态,true 时跳过缓存等待窗口 */
|
||||
forceRefresh?: boolean
|
||||
/** 是否显式开启长轮询等待;true 时进入最长 60 秒等待 */
|
||||
waitForChange?: boolean
|
||||
/** 长轮询开关(兼容字段);true 时进入最长 60 秒等待 */
|
||||
longPoll?: boolean
|
||||
/** 等待超时毫秒数;后端自动封顶 60000 */
|
||||
waitTimeoutMs?: number
|
||||
/** 初始化请求标记;true 时强制立即返回,不进入长等待 */
|
||||
init?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信绑定二维码及轮询状态
|
||||
* 支持长轮询:longPoll/waitForChange=true 时服务端最长等待 60 秒
|
||||
* 初始化调用时传 init:true,服务端立即返回二维码数据
|
||||
* 返回: { status: 'waiting'|'scanned'|'bound'|'expired', code, qrUrl, nickname, openid }
|
||||
*/
|
||||
export const getBindWechatCode = (params?: BindWechatCodeParams) => {
|
||||
const isLongPoll = params?.longPoll || params?.waitForChange
|
||||
const waitMs = params?.waitTimeoutMs ?? (isLongPoll ? 60000 : 0)
|
||||
// HTTP 超时需大于后端等待时长
|
||||
const httpTimeout = isLongPoll ? Math.max(waitMs, 60000) + 10000 : 15000
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'user.getBindWechatCode',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data: params ?? {},
|
||||
isSystemApi: true,
|
||||
timeout: httpTimeout
|
||||
} as any)
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑微信
|
||||
* 删除 ye4s 数据库中的绑定关联记录,并清除缓存
|
||||
*/
|
||||
export const unbindWechat = () => {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'user.unbindWechat',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data: {},
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
@ -115,4 +115,4 @@ export function unbindWechat(data: { user_id: number }) {
|
||||
},
|
||||
data
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -358,4 +358,4 @@ export function warehouseSearch(data: {
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
}
|
||||
@ -69,4 +69,4 @@ export function deleteDetail(data:any): Promise<any> {
|
||||
|
||||
export function detailChange(data:any): Promise<any> {
|
||||
return Promise.reject(new Error('storage.entry.detailChange 已下线,入库单明细不再对外编辑'))
|
||||
}
|
||||
}
|
||||
@ -68,6 +68,53 @@ export function transferLocation(data:any) {
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
/**
|
||||
* 出入库记录列表查询
|
||||
* 支持where条件、分页、排序、批次分组切换。
|
||||
* 默认按库位合并数量(合并模式),group_by_batch=true时返回每条明细(明细模式)
|
||||
*/
|
||||
export function getTransactionList(data: {
|
||||
/** 统一where条件对象,可用字段:transaction_type(INBOUND/OUTBOUND)、stock_id、space_id、store_id、order_type(SCRK/MATCH)、order_no、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、operator_name、created_at(支持between) */
|
||||
where?: Record<string, any>
|
||||
/** 分页参数,默认page=1, pageSize=20 */
|
||||
pagination?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
/** 排序参数,默认sortField='created_at', sortOrder='DESC' */
|
||||
sort?: {
|
||||
sortField?: string
|
||||
sortOrder?: string
|
||||
}
|
||||
/** 是否按批次查询,默认false。false=合并模式(按库位+商品聚合),true=明细模式(逐条返回) */
|
||||
group_by_batch?: boolean
|
||||
}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storage.transaction.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function getExpiryList(data: any): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storage.expiry.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data
|
||||
})
|
||||
}
|
||||
// export function transaction(data:any) {
|
||||
// return request({
|
||||
// url: '/system',
|
||||
@ -80,4 +127,4 @@ export function transferLocation(data:any) {
|
||||
// data,
|
||||
// isSystemApi: true
|
||||
// } as any)
|
||||
// }
|
||||
// }
|
||||
@ -29,4 +29,4 @@ export const stockoutListItems = (data: {
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
const v = "1.0"
|
||||
|
||||
export const getinventoryList = (params: any) => {
|
||||
return request({
|
||||
url: `/api/storage/stock/list`,
|
||||
method: 'get',
|
||||
params: {
|
||||
method: 'storage.stock.getProductstockList',
|
||||
version: v,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 未使用,保留
|
||||
export const getinventoryDetail = (data: any) => {
|
||||
return request({
|
||||
url: `/api/storage/stock/detail`,
|
||||
method: 'get',
|
||||
params: {
|
||||
method: 'storage.stock.getProductstockDetail',
|
||||
version: v,
|
||||
...data
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = "1.0"
|
||||
|
||||
/**
|
||||
* 出入库记录列表查询
|
||||
* 支持where条件、分页、排序、批次分组切换。
|
||||
* 默认按库位合并数量(合并模式),group_by_batch=true时返回每条明细(明细模式)
|
||||
*/
|
||||
export function getTransactionList(data: {
|
||||
/** 统一where条件对象,可用字段:transaction_type(INBOUND/OUTBOUND)、stock_id、space_id、store_id、order_type(SCRK/MATCH)、order_no、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、operator_name、created_at(支持between) */
|
||||
where?: Record<string, any>
|
||||
/** 分页参数,默认page=1, pageSize=20 */
|
||||
pagination?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
/** 排序参数,默认sortField='created_at', sortOrder='DESC' */
|
||||
sort?: {
|
||||
sortField?: string
|
||||
sortOrder?: string
|
||||
}
|
||||
/** 是否按批次查询,默认false。false=合并模式(按库位+商品聚合),true=明细模式(逐条返回) */
|
||||
group_by_batch?: boolean
|
||||
}): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storage.transaction.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const v = '1.0'
|
||||
|
||||
export function getExpiryList(data: any): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'storage.expiry.list',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data
|
||||
})
|
||||
}
|
||||
@ -283,4 +283,4 @@ export function quickPutaway(data: {
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getList(params: any) {
|
||||
return request({
|
||||
url: '/vue-admin-template/table/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -95,3 +95,59 @@ export function logout(data?: Record<string, any>) {
|
||||
isSystemApi: true
|
||||
} as SystemApiRequestConfig<Record<string, any>>);
|
||||
}
|
||||
|
||||
export interface BindWechatCodeParams {
|
||||
/** 是否强制刷新状态,true 时跳过缓存等待窗口 */
|
||||
forceRefresh?: boolean
|
||||
/** 是否显式开启长轮询等待;true 时进入最长 60 秒等待 */
|
||||
waitForChange?: boolean
|
||||
/** 长轮询开关(兼容字段);true 时进入最长 60 秒等待 */
|
||||
longPoll?: boolean
|
||||
/** 等待超时毫秒数;后端自动封顶 60000 */
|
||||
waitTimeoutMs?: number
|
||||
/** 初始化请求标记;true 时强制立即返回,不进入长等待 */
|
||||
init?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信绑定二维码及轮询状态
|
||||
* 支持长轮询:longPoll/waitForChange=true 时服务端最长等待 60 秒
|
||||
* 初始化调用时传 init:true,服务端立即返回二维码数据
|
||||
* 返回: { status: 'waiting'|'scanned'|'bound'|'expired', code, qrUrl, nickname, openid }
|
||||
*/
|
||||
export const getBindWechatCode = (params?: BindWechatCodeParams) => {
|
||||
const isLongPoll = params?.longPoll || params?.waitForChange
|
||||
const waitMs = params?.waitTimeoutMs ?? (isLongPoll ? 60000 : 0)
|
||||
// HTTP 超时需大于后端等待时长
|
||||
const httpTimeout = isLongPoll ? Math.max(waitMs, 60000) + 10000 : 15000
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'user.getBindWechatCode',
|
||||
v: '1.0',
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data: params ?? {},
|
||||
isSystemApi: true,
|
||||
timeout: httpTimeout
|
||||
} as SystemApiRequestConfig<BindWechatCodeParams>)
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑微信
|
||||
* 删除 ye4s 数据库中的绑定关联记录,并清除缓存
|
||||
*/
|
||||
export const unbindWechat = () => {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'user.unbindWechat',
|
||||
v: '1.0',
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data: {},
|
||||
isSystemApi: true
|
||||
} as SystemApiRequestConfig<Record<string, any>>)
|
||||
}
|
||||
@ -113,7 +113,7 @@
|
||||
import { ref, reactive, watch, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Plus, Camera, CameraFilled } from '@element-plus/icons-vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import SparkMD5 from 'spark-md5'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
const props = defineProps<{
|
||||
id?: number
|
||||
|
||||
@ -4,7 +4,7 @@ import elementEnLocale from 'element-plus/es/locale/lang/en'
|
||||
import elementZhLocale from 'element-plus/es/locale/lang/zh-cn'
|
||||
import localEnUS from './en-US.ts'
|
||||
import localZhCN from './zh-CN.ts'
|
||||
import * as indexApi from '@/api/index.ts'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
// ==================== 配置 ====================
|
||||
const CONFIG = {
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
getInfo as apiGetInfo,
|
||||
changeRole as apiChangeRole,
|
||||
logout as apiLogout
|
||||
} from '@/api/user'
|
||||
} from '@/api/user/user'
|
||||
import { useAppStore } from './app'
|
||||
import { useTagsViewStore } from './tagsView'
|
||||
|
||||
@ -49,7 +49,7 @@ export const useUserStore = defineStore('user', {
|
||||
|
||||
async register(payload: any) {
|
||||
// Dynamically import the API module and call register if available to avoid static import error
|
||||
const apiModule: any = await import('@/api/user')
|
||||
const apiModule: any = await import('@/api/user/user')
|
||||
if (typeof apiModule.register !== 'function') {
|
||||
throw new Error('register API is not available')
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ import { ElMessage } from 'element-plus'
|
||||
import localZh from '@/lang/zh-CN'
|
||||
import localEn from '@/lang/en-US'
|
||||
import _ from 'lodash'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
// 标签页选中项
|
||||
const activeTab = ref('local')
|
||||
|
||||
@ -259,7 +259,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { getStoreRoles, auditApply } from '@/api/store'
|
||||
import { getStoreRoles, auditApply } from '@/api/store/store'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { QuestionFilled, CircleCheck, CircleClose } from '@element-plus/icons-vue'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { createStore } from '@/api/store'
|
||||
import { createStore } from '@/api/store/store'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { createWarehouse } from '@/api/store'
|
||||
import { createWarehouse } from '@/api/store/store'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { joinStore } from '@/api/store'
|
||||
import { joinStore } from '@/api/store/store'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { SuccessFilled, CopyDocument, Refresh } from '@element-plus/icons-vue'
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import { joinWarehouse } from '@/api/store'
|
||||
import { joinWarehouse } from '@/api/store/store'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { SuccessFilled, CopyDocument, Refresh } from '@element-plus/icons-vue'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { ref, onMounted, onBeforeUnmount, unref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getDashboardData } from '@/api/dashboard'
|
||||
import { getDashboardData } from '@/api/dashboard/dashboard'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
export function useDashboard(props: { method: string; queryParams?: any }) {
|
||||
|
||||
@ -240,7 +240,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, type FormInstance } from 'element-plus'
|
||||
import { Loading, CircleCheck, RefreshRight } from '@element-plus/icons-vue'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import * as userApi from '@/api/user'
|
||||
import * as userApi from '@/api/user/user'
|
||||
import { setToken } from '@/utils/auth'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import LangSelect from '@/components/LangSelect/index.vue'
|
||||
|
||||
@ -99,7 +99,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { getarchiveOrderlist } from '@/api/order/order'
|
||||
|
||||
import {
|
||||
|
||||
@ -189,7 +189,6 @@ export const reviewColums = [
|
||||
{ prop: 'name', label: '收货人', width: '110' },
|
||||
{ prop: 'mobile', label: '手机号', width: '120' },
|
||||
{ prop: 'status', label: '订单状态', width: '100' },
|
||||
{ prop: 'inspection_status', label: '审核状态', width: '100' },
|
||||
{ prop: 'is_urgency', label: '紧急', width: '80' },
|
||||
{ prop: 'logistics_name', label: '物流公司', width: '120' },
|
||||
{ prop: 'items_total', label: '商品总数', width: '100' },
|
||||
@ -211,7 +210,6 @@ export const reviewOrderDetail = [
|
||||
{ prop: 'buyer_nick', label: '买家昵称' },
|
||||
{ prop: 'seller_nick', label: '卖家昵称' },
|
||||
{ prop: 'status', label: '订单状态' },
|
||||
{ prop: 'inspection_status', label: '审核状态' },
|
||||
{ prop: 'step', label: '流程步骤' },
|
||||
{ prop: 'is_urgency', label: '是否紧急' },
|
||||
{ prop: 'invoice_flag', label: '发票标记' },
|
||||
@ -290,7 +288,6 @@ export const pendingCloums = [
|
||||
{ prop: 'mobile', label: '手机号', width: '120' },
|
||||
{ prop: 'status', label: '订单状态', width: '100' },
|
||||
{ prop: 'sync_status', label: '同步状态', width: '100' },
|
||||
{ prop: 'inspection_status', label: '审核状态', width: '100' },
|
||||
{ prop: 'storage_status', label: '分配状态', width: '100' },
|
||||
{ prop: 'post_status', label: '快递状态', width: '100' },
|
||||
{ prop: 'pick_status', label: '拣货状态', width: '100' },
|
||||
@ -319,7 +316,6 @@ export const pendingOrderDetail = [
|
||||
{ prop: 'seller_nick', label: '卖家昵称' },
|
||||
{ prop: 'status', label: '订单状态' },
|
||||
{ prop: 'sync_status', label: '同步状态' },
|
||||
{ prop: 'inspection_status', label: '审核状态' },
|
||||
{ prop: 'step', label: '流程步骤' },
|
||||
{ prop: 'is_urgency', label: '是否紧急' },
|
||||
{ prop: 'invoice_flag', label: '发票标记' },
|
||||
|
||||
@ -99,7 +99,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { getarchiveOrderlist } from '@/api/order/order'
|
||||
|
||||
import {
|
||||
|
||||
@ -1,63 +1,19 @@
|
||||
<template>
|
||||
<div class="order-sub-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="320px"
|
||||
: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">
|
||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||
|
||||
<template v-for="(btn, index) in deliverybuttonList" :key="index">
|
||||
<el-dropdown
|
||||
v-if="btn.type === 'dropdown'"
|
||||
trigger="hover"
|
||||
@command="(cmd:any) => handleCommand(btn.command, cmd)"
|
||||
>
|
||||
<el-button size="small" :loading="btn.loading">
|
||||
{{ btn.label }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="opt in btn.options"
|
||||
:key="opt.value"
|
||||
:command="opt.value"
|
||||
:divided="opt.divided"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
||||
<el-button
|
||||
v-else
|
||||
size="small"
|
||||
:type="btn.btnType || 'default'"
|
||||
:disabled="btn.needSelection && !hasSelection"
|
||||
@click="handleCommand(btn.command)"
|
||||
>
|
||||
{{ btn.label }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<el-button size="small" @click="handleCreate">新建配送单</el-button>
|
||||
<el-button size="small" :disabled="!hasSelection" @click="confirmBatchCancel">批量作废</el-button>
|
||||
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索配送单号" v-model="quickSearch" style="width:220px" @keyup.enter.native="onQuickSearch" />
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="搜索配送单号"
|
||||
v-model="quickSearch"
|
||||
style="width:220px"
|
||||
@keyup.enter.native="onQuickSearch"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -111,7 +67,7 @@
|
||||
<div class="detail-container">
|
||||
<KeepAlive>
|
||||
<div v-if="activeTab === 'details'">
|
||||
<detail :data="selectedDetail" :config="deliverydetail" :column="3" v-loading="detailLoading" />
|
||||
<detail :data="selectedRow" :config="deliverydetail" :column="3" />
|
||||
</div>
|
||||
<div v-else-if="activeTab === 'items'">
|
||||
<orderdetail :orderId="selectedOrderId" />
|
||||
@ -135,90 +91,38 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as orderApi from '@/api/order/order'
|
||||
import { orderDeliveryOrder } from '@/api/order.deliveryOrder/orderdeliveryOrder'
|
||||
|
||||
import {
|
||||
deliveryAvailableFields,
|
||||
deliveryColumns,
|
||||
deliverydetail,
|
||||
deliverybuttonList,
|
||||
translateOrderField
|
||||
} from './config/order-common-config'
|
||||
import detail from './component/detail.vue'
|
||||
import log from './component/log.vue'
|
||||
import orderdetail from './component/orderdetail.vue'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
const upperTable = ref<any>(null)
|
||||
|
||||
const presetTree = ref<any[]>([])
|
||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(deliveryAvailableFields)))
|
||||
|
||||
const activeTab = ref('details')
|
||||
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const tableSize = ref('small')
|
||||
const columns = ref(deliveryColumns)
|
||||
|
||||
|
||||
const selectionRows = ref<any[]>([])
|
||||
const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const selectedDetail = ref<any>(null)
|
||||
|
||||
const quickSearch = ref('')
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
|
||||
})
|
||||
|
||||
async function fetchOrderDetail(id: number | string) {
|
||||
detailLoading.value = true
|
||||
try {
|
||||
const res = await orderApi.orderDetail({ id })
|
||||
if (res && res.code === 200 && res.data) {
|
||||
selectedDetail.value = res.data.order
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Fetch detail error:', e)
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function translateField(fieldValue: string, value: any) {
|
||||
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
|
||||
if (field && field.options) {
|
||||
const option = field.options.find((opt: any) => opt.value === value)
|
||||
return option ? option.label : value
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function getStatusType(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
'PENDING': 'info',
|
||||
'SYNCING': 'primary',
|
||||
'SUCCESS': 'success',
|
||||
'FAIL': 'danger'
|
||||
}
|
||||
return map[status] || ''
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadFilterData()
|
||||
})
|
||||
|
||||
async function loadData() {
|
||||
@ -231,11 +135,21 @@ async function loadData() {
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
},
|
||||
quickSearch: quickSearch.value,
|
||||
where: scanBox.value?.getCondition ? scanBox.value.getCondition() : {}
|
||||
where: quickSearch.value
|
||||
? {
|
||||
delivery_order_code: {
|
||||
operator: 'like',
|
||||
value: quickSearch.value,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
: {},
|
||||
sort: {
|
||||
sortField: 'updated_at',
|
||||
sortOrder: 'DESC'
|
||||
}
|
||||
}
|
||||
const res: any = await orderApi.orderDeliveryList(params)
|
||||
// 根据接口文档1和返回示例,成功状态码 code 为 1,且数据在 res.data 中
|
||||
const res: any = await orderDeliveryOrder.list(params)
|
||||
if (res && (res.code === 200 || res.code === 1)) {
|
||||
const responseData = res.data || {}
|
||||
list.value = responseData.list || []
|
||||
@ -254,40 +168,6 @@ async function loadData() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, presetRes]: any = await Promise.all([
|
||||
indexApi.loadStores({ type: 'delivery' }),
|
||||
indexApi.fastWhereTree('delivery')
|
||||
])
|
||||
if (storesRes && storesRes.code === 200) {
|
||||
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
|
||||
if (f) f.options = storesRes.stores || []
|
||||
}
|
||||
if (presetRes && presetRes.code === 200) {
|
||||
presetTree.value = presetRes.presetTree || []
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function handleConditionChange(condition: any) {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
const handleConditionClear = () => {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
pagination.currentPage = 1
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
}
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onSelectionChange(rows: any[]) {
|
||||
selectionRows.value = rows || []
|
||||
hasSelection.value = selectionRows.value.length > 0
|
||||
@ -295,11 +175,6 @@ function onSelectionChange(rows: any[]) {
|
||||
|
||||
function handleRowClick(row: any) {
|
||||
selectedOrderId.value = row?.id || null
|
||||
if (selectedOrderId.value) {
|
||||
fetchOrderDetail(selectedOrderId.value)
|
||||
} else {
|
||||
selectedDetail.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
@ -317,71 +192,6 @@ function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleCreate() {
|
||||
ElMessage.info('新建配送单')
|
||||
}
|
||||
|
||||
async function confirmBatchCancel() {
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定要批量作废选中的配送单吗?`, '确认', { type: 'warning' })
|
||||
ElMessage.success('操作成功')
|
||||
loadData()
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
exportLoading.value = true
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
ElMessage.success('导出成功')
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
// 统一执行命令
|
||||
function handleCommand(commandName: string, subCommand?: string) {
|
||||
const handlers: Record<string, Function> = {
|
||||
handleDeliveryOperation,
|
||||
handleDeliveryPrintOperation,
|
||||
handleExport,
|
||||
handleCreate,
|
||||
confirmBatchCancel
|
||||
}
|
||||
const handler = handlers[commandName]
|
||||
if (handler) {
|
||||
handler(subCommand)
|
||||
}
|
||||
}
|
||||
|
||||
const deliveryCommandLabels: Record<string, string> = {
|
||||
'export-delivery-nodetail': '导出配送单(不含明细)',
|
||||
'import-delivery-detail': '快递号导入(含明细)'
|
||||
}
|
||||
|
||||
async function handleDeliveryOperation(command: string) {
|
||||
const label = deliveryCommandLabels[command] || '操作'
|
||||
exportLoading.value = true
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
ElMessage.success(`${label}成功`)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
const deliveryPrintLabels: Record<string, string> = {
|
||||
'print-delivery': '打印发货单',
|
||||
'print-picking': '打印拣货单',
|
||||
'print-waybill-cainiao': '打印面单(菜鸟)',
|
||||
'print-waybill-pdd': '打印面单(拼多多)'
|
||||
}
|
||||
|
||||
function handleDeliveryPrintOperation(command: string) {
|
||||
const label = deliveryPrintLabels[command] || '打印操作'
|
||||
if (!hasSelection.value) {
|
||||
ElMessage.warning(`请先选择要${label}的订单`)
|
||||
return
|
||||
}
|
||||
ElMessage.success(`正在执行: ${label} (选中 ${selectionRows.value.length} 个订单)`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@ -99,7 +99,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { getarchiveOrderlist } from '@/api/order/order'
|
||||
|
||||
import {
|
||||
|
||||
@ -135,7 +135,7 @@ import { ElMessage } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { getexpectionOrderlist } from '@/api/order/order'
|
||||
|
||||
import {
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<div class="order-management-wrapper" :style="{ height: containerHeight }">
|
||||
<div class="tabs-header-action">
|
||||
<el-button size="small" :loading="badgeLoading" @click="refreshBadgeCounts">刷新角标</el-button>
|
||||
</div>
|
||||
<!-- 使用 keep-alive 强制保留所有标签 -->
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
@ -39,8 +42,10 @@
|
||||
import { ref, watch, onMounted, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import { orderBadgeCount } from '@/api/order.index/orderindex'
|
||||
import ReviewOrder from './reviewOrder.vue'
|
||||
import PendingOrder from './pendingOrder.vue'
|
||||
import OutboundOrder from './outboundOrder.vue'
|
||||
import ExceptionOrder from './exceptionOrder.vue'
|
||||
import DeliveryOrder from './deliveryOrder.vue'
|
||||
import EntrustWarehouse from './entrustWarehouse.vue'
|
||||
@ -51,6 +56,7 @@ import OrderWorkbench from './orderWorkbench.vue'
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const settingsStore = useSettingsStore()
|
||||
const badgeLoading = ref(false)
|
||||
|
||||
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
|
||||
const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 150px)' : 'calc(100vh - 100px)')
|
||||
@ -58,7 +64,14 @@ const containerHeight = computed(() => shortcutExpanded.value ? 'calc(100vh - 15
|
||||
const activeTab = ref('reviewOrder')
|
||||
const forceRenderAll = ref(false) // 只有 activeTab 对应的组件会被渲染
|
||||
|
||||
const tabs = ref([
|
||||
type OrderTabItem = {
|
||||
name: string
|
||||
label: string
|
||||
count: number | string
|
||||
component: any
|
||||
}
|
||||
|
||||
const tabs = ref<OrderTabItem[]>([
|
||||
{
|
||||
name: 'orderWorkbench',
|
||||
label: '订单工作台',
|
||||
@ -77,6 +90,12 @@ const tabs = ref([
|
||||
count: 10,
|
||||
component: PendingOrder
|
||||
},
|
||||
{
|
||||
name: 'outboundOrder',
|
||||
label: '待出库订单',
|
||||
count: 0,
|
||||
component: OutboundOrder
|
||||
},
|
||||
{
|
||||
name: 'exceptionOrder',
|
||||
label: '待处理异常订单',
|
||||
@ -109,6 +128,43 @@ const tabs = ref([
|
||||
}
|
||||
])
|
||||
|
||||
const badgeToTabMap: Record<string, string> = {
|
||||
reviewOrder: 'reviewOrder',
|
||||
pendingOrder: 'pendingOrder',
|
||||
outboundOrder: 'outboundOrder',
|
||||
expectionOrder: 'exceptionOrder',
|
||||
entrustOrder: 'entrustWarehouse',
|
||||
deliveryOrder: 'deliveryOrder',
|
||||
deliveryExpectionOrder: 'deliveryException',
|
||||
archiveOrder: 'archiveOrder'
|
||||
}
|
||||
|
||||
async function loadBadgeCounts() {
|
||||
if (badgeLoading.value) return
|
||||
badgeLoading.value = true
|
||||
try {
|
||||
const res: any = await orderBadgeCount()
|
||||
if (!res || ![1, 200].includes(res.code) || !res.data) return
|
||||
const data = res.data as Record<string, number | string>
|
||||
tabs.value = tabs.value.map((tab) => {
|
||||
const badgeKey = Object.keys(badgeToTabMap).find((key) => badgeToTabMap[key] === tab.name)
|
||||
if (!badgeKey) return tab
|
||||
return {
|
||||
...tab,
|
||||
count: data[badgeKey] ?? 0
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('order.badgeCount error:', error)
|
||||
} finally {
|
||||
badgeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function refreshBadgeCounts() {
|
||||
loadBadgeCounts()
|
||||
}
|
||||
|
||||
// 初始化:从URL参数获取激活的标签
|
||||
const initFromRoute = () => {
|
||||
const tabFromUrl = route.query.tab as string
|
||||
@ -155,6 +211,7 @@ watch(
|
||||
|
||||
onMounted(() => {
|
||||
initFromRoute()
|
||||
loadBadgeCounts()
|
||||
})
|
||||
|
||||
// 点击标签时处理
|
||||
@ -173,15 +230,24 @@ const handleTabClick = (tab: any) => {
|
||||
tab: tabName
|
||||
}
|
||||
})
|
||||
loadBadgeCounts()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.order-management-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tabs-header-action {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 16px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.tab-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@ -1,159 +1,376 @@
|
||||
<template>
|
||||
<div class="order-workbench">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<el-card shadow="never" class="panel-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>订单数据总览</span>
|
||||
<el-button type="primary" @click="fetchAllData" :loading="loading">刷新数据</el-button>
|
||||
<div class="header-title">
|
||||
<h3>订单工作台总列表</h3>
|
||||
<span>接口:order.list / order.badgeCount / order.manualOutboundOrder</span>
|
||||
</div>
|
||||
<el-button type="primary" :loading="loading" @click="loadWorkbenchData">刷新数据</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="table-sections">
|
||||
<!-- 待审核订单 -->
|
||||
<section class="table-section">
|
||||
<h3>待审核订单 (order.reviewOrder.list)</h3>
|
||||
<el-table :data="reviewOrders" border stripe style="width: 100%">
|
||||
<el-table-column prop="delivery_order_code" label="订单号" />
|
||||
<el-table-column prop="source_platform_name" label="平台" />
|
||||
<el-table-column prop="status" label="状态" />
|
||||
<el-table-column prop="is_mock" label="数据来源">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.is_mock ? 'warning' : 'success'">
|
||||
{{ scope.row.is_mock ? '模拟数据' : '服务端数据' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section>
|
||||
|
||||
<!-- 待处理订单 -->
|
||||
<section class="table-section">
|
||||
<h3>待处理订单 (order.pendingOrder.list)</h3>
|
||||
<el-table :data="pendingOrders" border stripe style="width: 100%">
|
||||
<el-table-column prop="delivery_order_code" label="订单号" />
|
||||
<el-table-column prop="source_platform_name" label="平台" />
|
||||
<el-table-column prop="status" label="状态" />
|
||||
<el-table-column prop="is_mock" label="数据来源">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.is_mock ? 'warning' : 'success'">
|
||||
{{ scope.row.is_mock ? '模拟数据' : '服务端数据' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section>
|
||||
|
||||
<!-- 配送订单 -->
|
||||
<section class="table-section">
|
||||
<h3>配送订单 (order.deliveryOrder.list)</h3>
|
||||
<el-table :data="deliveryOrders" border stripe style="width: 100%">
|
||||
<el-table-column prop="delivery_order_code" label="订单号" />
|
||||
<el-table-column prop="source_platform_name" label="平台" />
|
||||
<el-table-column prop="dispatch_lane" label="道口" />
|
||||
<el-table-column prop="is_mock" label="数据来源">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.is_mock ? 'warning' : 'success'">
|
||||
{{ scope.row.is_mock ? '模拟数据' : '服务端数据' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section>
|
||||
<div class="badge-grid">
|
||||
<div v-for="item in badgeItems" :key="item.key" class="badge-item">
|
||||
<span class="badge-label">{{ item.label }}</span>
|
||||
<span class="badge-value">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-row">
|
||||
<el-input v-model="filters.delivery_order_code" clearable placeholder="订单号" class="filter-item" />
|
||||
<el-input v-model="filters.buyer_nick" clearable placeholder="买家昵称" class="filter-item" />
|
||||
<el-select v-model="filters.status" clearable placeholder="订单状态" class="filter-item">
|
||||
<el-option v-for="status in statusOptions" :key="status.value" :label="status.label" :value="status.value" />
|
||||
</el-select>
|
||||
<el-button type="primary" :loading="loading" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" :data="orderListData" border stripe>
|
||||
<el-table-column prop="delivery_order_code" label="订单号" min-width="160" />
|
||||
<el-table-column prop="source_platform_name" label="平台" min-width="100" />
|
||||
<el-table-column prop="buyer_nick" label="买家昵称" min-width="140" />
|
||||
<el-table-column prop="status" label="状态" min-width="120" />
|
||||
<el-table-column prop="outbound_status" label="出库状态" min-width="120" />
|
||||
<el-table-column prop="create_at" label="创建时间" min-width="180" />
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-wrap">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:current-page="pagination.page"
|
||||
:page-size="pagination.pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="pagination.total"
|
||||
@current-change="handlePageChange"
|
||||
@size-change="handlePageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="panel-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<div class="header-title">
|
||||
<h3>手动出库迁移</h3>
|
||||
<span>接口:order.manualOutboundOrder</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="manual-form">
|
||||
<el-input-number v-model="manualForm.warehouseId" :min="1" :step="1" controls-position="right" placeholder="单仓库ID" />
|
||||
<el-input
|
||||
v-model="manualWarehouseIdsText"
|
||||
placeholder="仓库ID数组,逗号分隔(例:100000,1000028)"
|
||||
clearable
|
||||
/>
|
||||
<el-input-number v-model="manualForm.queryTimeoutMs" :min="1" :step="500" controls-position="right" placeholder="查询超时(ms)" />
|
||||
<el-input-number v-model="manualForm.executionTimeoutMs" :min="1" :step="500" controls-position="right" placeholder="执行超时(ms)" />
|
||||
<el-button type="primary" :loading="manualLoading" @click="handleManualOutbound">
|
||||
执行迁移
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
v-if="manualResult"
|
||||
type="success"
|
||||
:closable="false"
|
||||
show-icon
|
||||
:title="`已处理 ${manualResult.totalSelected} 条,创建 ${manualResult.totalCreated} 条,跳过 ${manualResult.totalSkipped} 条,超时 ${manualResult.totalTimeout} 条`"
|
||||
/>
|
||||
|
||||
<el-table v-if="manualResult?.results?.length" :data="manualResult.results" border stripe class="result-table">
|
||||
<el-table-column prop="warehouseId" label="仓库ID" min-width="120" />
|
||||
<el-table-column prop="selectedCount" label="命中数量" min-width="120" />
|
||||
<el-table-column prop="createdCount" label="创建数量" min-width="120" />
|
||||
<el-table-column prop="skippedCount" label="跳过数量" min-width="120" />
|
||||
<el-table-column prop="timeoutCount" label="超时数量" min-width="120" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import {
|
||||
orderReviewList,
|
||||
orderPendingList,
|
||||
orderDeliveryList
|
||||
} from '@/api/order/order'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { orderBadgeCount, orderList, orderManualOutboundOrder } from '@/api/order.index/orderindex'
|
||||
|
||||
const loading = ref(false)
|
||||
const reviewOrders = ref<any[]>([])
|
||||
const pendingOrders = ref<any[]>([])
|
||||
const deliveryOrders = ref<any[]>([])
|
||||
const manualLoading = ref(false)
|
||||
|
||||
// 模拟数据生成器
|
||||
const createMockData = (type: string) => [
|
||||
{
|
||||
id: 'mock_' + (Math.random() * 1000).toFixed(0),
|
||||
delivery_order_code: `MOCK_${type}_${Date.now()}`,
|
||||
source_platform_name: '虚拟平台',
|
||||
status: 'pending',
|
||||
dispatch_lane: type === 'DELIVERY' ? 'm4' : '-',
|
||||
is_mock: true
|
||||
}
|
||||
const filters = reactive({
|
||||
delivery_order_code: '',
|
||||
buyer_nick: '',
|
||||
status: ''
|
||||
})
|
||||
|
||||
const statusOptions = [
|
||||
{ label: '待处理', value: 'pedding' },
|
||||
{ label: '已完成', value: 'fin' },
|
||||
{ label: '异常', value: 'error' }
|
||||
]
|
||||
|
||||
const fetchAllData = async () => {
|
||||
const orderListData = ref<any[]>([])
|
||||
const badgeData = ref<Record<string, number | string>>({
|
||||
reviewOrder: 0,
|
||||
pendingOrder: 0,
|
||||
outboundOrder: 0,
|
||||
expectionOrder: 0,
|
||||
entrustOrder: 0,
|
||||
deliveryOrder: 0,
|
||||
deliveryExpectionOrder: 0,
|
||||
archiveOrder: 0
|
||||
})
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const manualForm = reactive({
|
||||
warehouseId: undefined as number | undefined,
|
||||
queryTimeoutMs: undefined as number | undefined,
|
||||
executionTimeoutMs: undefined as number | undefined
|
||||
})
|
||||
const manualWarehouseIdsText = ref('')
|
||||
const manualResult = ref<any>(null)
|
||||
|
||||
const badgeItems = computed(() => [
|
||||
{ key: 'reviewOrder', label: '待审核', value: badgeData.value.reviewOrder ?? 0 },
|
||||
{ key: 'pendingOrder', label: '待处理', value: badgeData.value.pendingOrder ?? 0 },
|
||||
{ key: 'outboundOrder', label: '待出库', value: badgeData.value.outboundOrder ?? 0 },
|
||||
{ key: 'expectionOrder', label: '异常', value: badgeData.value.expectionOrder ?? 0 },
|
||||
{ key: 'entrustOrder', label: '委托外仓', value: badgeData.value.entrustOrder ?? 0 },
|
||||
{ key: 'deliveryOrder', label: '配送', value: badgeData.value.deliveryOrder ?? 0 },
|
||||
{ key: 'deliveryExpectionOrder', label: '配送异常', value: badgeData.value.deliveryExpectionOrder ?? 0 },
|
||||
{ key: 'archiveOrder', label: '归档', value: badgeData.value.archiveOrder ?? 0 }
|
||||
])
|
||||
|
||||
function buildWhere() {
|
||||
const where: Record<string, any> = {}
|
||||
if (filters.delivery_order_code) {
|
||||
where.delivery_order_code = { operator: 'like', value: filters.delivery_order_code, type: 'text' }
|
||||
}
|
||||
if (filters.buyer_nick) {
|
||||
where.buyer_nick = { operator: 'like', value: filters.buyer_nick, type: 'text' }
|
||||
}
|
||||
if (filters.status) {
|
||||
where.status = { operator: 'eq', value: filters.status, type: 'text' }
|
||||
}
|
||||
return where
|
||||
}
|
||||
|
||||
async function loadOrderListData() {
|
||||
const response: any = await orderList({
|
||||
pagination: {
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
},
|
||||
where: buildWhere(),
|
||||
sort: {
|
||||
sortField: 'updated_at',
|
||||
sortOrder: 'DESC'
|
||||
}
|
||||
})
|
||||
|
||||
if (!response || ![1, 200].includes(response.code)) {
|
||||
throw new Error(response?.message || 'order.list 请求失败')
|
||||
}
|
||||
|
||||
const responseData = response.data || {}
|
||||
orderListData.value = responseData.list || []
|
||||
pagination.total = responseData.pagination?.total || 0
|
||||
}
|
||||
|
||||
async function loadBadgeData() {
|
||||
const response: any = await orderBadgeCount()
|
||||
if (!response || ![1, 200].includes(response.code)) {
|
||||
throw new Error(response?.message || 'order.badgeCount 请求失败')
|
||||
}
|
||||
badgeData.value = {
|
||||
...badgeData.value,
|
||||
...(response.data || {})
|
||||
}
|
||||
}
|
||||
|
||||
async function loadWorkbenchData() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
const commonParams = { pagination: { page: 1, pageSize: 20 } }
|
||||
|
||||
try {
|
||||
// 1. 获取待审核订单
|
||||
const resReview = await orderReviewList(commonParams).catch(() => ({ data: { list: [] } }))
|
||||
if (resReview.data?.list?.length) {
|
||||
reviewOrders.value = resReview.data.list
|
||||
} else {
|
||||
reviewOrders.value = createMockData('REVIEW')
|
||||
}
|
||||
|
||||
// 2. 获取待处理订单
|
||||
const resPending = await orderPendingList(commonParams).catch(() => ({ data: { list: [] } }))
|
||||
if (resPending.data?.list?.length) {
|
||||
pendingOrders.value = resPending.data.list
|
||||
} else {
|
||||
pendingOrders.value = createMockData('PENDING')
|
||||
}
|
||||
|
||||
// 3. 获取配送订单
|
||||
const resDelivery = await orderDeliveryList(commonParams).catch(() => ({ data: { list: [] } }))
|
||||
if (resDelivery.data?.list?.length) {
|
||||
deliveryOrders.value = resDelivery.data.list
|
||||
} else {
|
||||
deliveryOrders.value = createMockData('DELIVERY')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fetch error:', error)
|
||||
await Promise.all([loadOrderListData(), loadBadgeData()])
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error?.message || '加载订单工作台数据失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadWorkbenchData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
filters.delivery_order_code = ''
|
||||
filters.buyer_nick = ''
|
||||
filters.status = ''
|
||||
pagination.page = 1
|
||||
loadWorkbenchData()
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.page = page
|
||||
loadWorkbenchData()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.page = 1
|
||||
loadWorkbenchData()
|
||||
}
|
||||
|
||||
function parseWarehouseIds(value: string): number[] {
|
||||
return value
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => !!item)
|
||||
.map((item) => Number(item))
|
||||
.filter((item) => Number.isFinite(item))
|
||||
}
|
||||
|
||||
async function handleManualOutbound() {
|
||||
if (manualLoading.value) return
|
||||
manualLoading.value = true
|
||||
|
||||
const warehouseIds = parseWarehouseIds(manualWarehouseIdsText.value)
|
||||
const payload: Record<string, any> = {}
|
||||
if (manualForm.warehouseId) {
|
||||
payload.warehouseId = manualForm.warehouseId
|
||||
}
|
||||
if (warehouseIds.length) {
|
||||
payload.warehouseIds = warehouseIds
|
||||
}
|
||||
if (manualForm.queryTimeoutMs) {
|
||||
payload.queryTimeoutMs = manualForm.queryTimeoutMs
|
||||
}
|
||||
if (manualForm.executionTimeoutMs) {
|
||||
payload.executionTimeoutMs = manualForm.executionTimeoutMs
|
||||
}
|
||||
|
||||
try {
|
||||
const response: any = await orderManualOutboundOrder(payload)
|
||||
if (!response || ![1, 200].includes(response.code)) {
|
||||
throw new Error(response?.message || '手动出库迁移失败')
|
||||
}
|
||||
manualResult.value = response.data || null
|
||||
ElMessage.success('手动出库迁移已执行')
|
||||
await loadWorkbenchData()
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error?.message || '手动出库迁移失败')
|
||||
} finally {
|
||||
manualLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchAllData()
|
||||
loadWorkbenchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style scoped lang="scss">
|
||||
.order-workbench {
|
||||
padding: 20px;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.table-sections {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 30px;
|
||||
.panel-card {
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.table-section {
|
||||
h3 {
|
||||
margin-bottom: 15px;
|
||||
padding-left: 10px;
|
||||
border-left: 4px solid #409eff;
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
span {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.badge-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.badge-item {
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
background: #fafafa;
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.badge-label {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.badge-value {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.filter-item {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.pagination-wrap {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.manual-form {
|
||||
display: grid;
|
||||
grid-template-columns: 180px minmax(280px, 1fr) 160px 160px 120px;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.result-table {
|
||||
margin-top: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
255
src/views/order/orderManagement/outboundOrder.vue
Normal file
255
src/views/order/orderManagement/outboundOrder.vue
Normal file
@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<div class="order-sub-container">
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||
<el-button size="small" type="warning" :loading="manualLoading" @click="handleManualOutbound">
|
||||
手动出库迁移
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-input
|
||||
size="small"
|
||||
placeholder="搜索出库单号"
|
||||
v-model="quickSearch"
|
||||
style="width:220px"
|
||||
@keyup.enter.native="onQuickSearch"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="manual-form">
|
||||
<el-input-number v-model="manualForm.warehouseId" :min="1" :step="1" controls-position="right" placeholder="单仓库ID" />
|
||||
<el-input
|
||||
v-model="manualWarehouseIdsText"
|
||||
placeholder="仓库ID数组,逗号分隔(例:100000,1000028)"
|
||||
clearable
|
||||
/>
|
||||
<el-input-number v-model="manualForm.queryTimeoutMs" :min="1" :step="500" controls-position="right" placeholder="查询超时(ms)" />
|
||||
<el-input-number v-model="manualForm.executionTimeoutMs" :min="1" :step="500" controls-position="right" placeholder="执行超时(ms)" />
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
v-if="manualResult"
|
||||
type="success"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="manual-result"
|
||||
:title="`已处理 ${manualResult.totalSelected} 条,创建 ${manualResult.totalCreated} 条,跳过 ${manualResult.totalSkipped} 条,超时 ${manualResult.totalTimeout} 条`"
|
||||
/>
|
||||
|
||||
<div class="upper-wrapper">
|
||||
<upper-table
|
||||
ref="upperTable"
|
||||
title="待出库订单列表"
|
||||
:data="list"
|
||||
:columns="columns"
|
||||
:table-size="tableSize"
|
||||
:pagination="pagination"
|
||||
:show-index="true"
|
||||
:show-actions="true"
|
||||
:show-selection="true"
|
||||
:loading="loading"
|
||||
:queryTime="queryTime"
|
||||
@current-change="handleRowClick"
|
||||
@page-change="handlePageChange"
|
||||
@page-size-change="handlePageSizeChange"
|
||||
@refresh="loadData"
|
||||
>
|
||||
<template #column-status="{ row }">
|
||||
<el-tag :type="row.status === 'pedding' ? 'warning' : row.status === 'cancel' ? 'danger' : 'info'" size="small">
|
||||
{{ translateOrderField('status', row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #column-outbound_status="{ row }">
|
||||
<el-tag :type="row.outbound_status === 'fin' ? 'success' : row.outbound_status === 'padding' ? 'warning' : 'info'" size="small">
|
||||
{{ row.outbound_status || 'none' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<div class="lower-level" :class="tableSize">
|
||||
<template v-if="selectedOrderId">
|
||||
<div class="detail-header">
|
||||
<el-tabs v-model="activeTab" class="detail-tab">
|
||||
<el-tab-pane label="订单明细" name="details" />
|
||||
<el-tab-pane label="商品明细" name="items" />
|
||||
<el-tab-pane label="操作日志" name="logs" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div class="detail-container">
|
||||
<KeepAlive>
|
||||
<div v-if="activeTab === 'details'">
|
||||
<detail :data="selectedRow" :config="pendingOrderDetail" :column="3" />
|
||||
</div>
|
||||
<div v-else-if="activeTab === 'items'">
|
||||
<orderdetail :orderId="selectedOrderId" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<log :data="selectedRow" />
|
||||
</div>
|
||||
</KeepAlive>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { orderOutboundOrder } from '@/api/order.outboundOrder/orderoutboundOrder'
|
||||
import { pendingCloums, pendingOrderDetail, translateOrderField } from './config/order-common-config'
|
||||
import detail from './component/detail.vue'
|
||||
import log from './component/log.vue'
|
||||
import orderdetail from './component/orderdetail.vue'
|
||||
|
||||
const upperTable = ref<any>(null)
|
||||
const activeTab = ref('details')
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const manualLoading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const tableSize = ref('small')
|
||||
const columns = ref(pendingCloums)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const quickSearch = ref('')
|
||||
|
||||
const manualForm = reactive({
|
||||
warehouseId: undefined as number | undefined,
|
||||
queryTimeoutMs: undefined as number | undefined,
|
||||
executionTimeoutMs: undefined as number | undefined
|
||||
})
|
||||
const manualWarehouseIdsText = ref('')
|
||||
const manualResult = ref<any>(null)
|
||||
|
||||
const selectedRow = computed(() => {
|
||||
return list.value.find((item: any) => item.id === selectedOrderId.value) || null
|
||||
})
|
||||
|
||||
function buildWhere() {
|
||||
const where: Record<string, any> = {}
|
||||
if (quickSearch.value) {
|
||||
where.delivery_order_code = {
|
||||
operator: 'like',
|
||||
value: quickSearch.value,
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
return where
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
const start = Date.now()
|
||||
try {
|
||||
const res: any = await orderOutboundOrder.list({
|
||||
pagination: {
|
||||
page: pagination.currentPage,
|
||||
pageSize: pagination.pageSize
|
||||
},
|
||||
where: buildWhere(),
|
||||
sort: {
|
||||
sortField: 'updated_at',
|
||||
sortOrder: 'DESC'
|
||||
}
|
||||
})
|
||||
if (res && (res.code === 1 || res.code === 200) && res.data) {
|
||||
list.value = res.data.list || []
|
||||
pagination.total = res.data.pagination?.total || 0
|
||||
} else {
|
||||
list.value = []
|
||||
pagination.total = 0
|
||||
}
|
||||
} catch (error) {
|
||||
list.value = []
|
||||
pagination.total = 0
|
||||
ElMessage.error('获取待出库订单失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
queryTime.value = Date.now() - start
|
||||
}
|
||||
}
|
||||
|
||||
function parseWarehouseIds(value: string): number[] {
|
||||
return value
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => !!item)
|
||||
.map((item) => Number(item))
|
||||
.filter((item) => Number.isFinite(item))
|
||||
}
|
||||
|
||||
async function handleManualOutbound() {
|
||||
if (manualLoading.value) return
|
||||
manualLoading.value = true
|
||||
try {
|
||||
const warehouseIds = parseWarehouseIds(manualWarehouseIdsText.value)
|
||||
const payload: Record<string, any> = {}
|
||||
if (manualForm.warehouseId) payload.warehouseId = manualForm.warehouseId
|
||||
if (warehouseIds.length) payload.warehouseIds = warehouseIds
|
||||
if (manualForm.queryTimeoutMs) payload.queryTimeoutMs = manualForm.queryTimeoutMs
|
||||
if (manualForm.executionTimeoutMs) payload.executionTimeoutMs = manualForm.executionTimeoutMs
|
||||
const res: any = await orderOutboundOrder.manualOutboundOrder(payload)
|
||||
if (res && (res.code === 1 || res.code === 200)) {
|
||||
manualResult.value = res.data || null
|
||||
ElMessage.success('手动出库迁移已执行')
|
||||
await loadData()
|
||||
} else {
|
||||
ElMessage.error(res?.message || '手动出库迁移失败')
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('手动出库迁移失败')
|
||||
} finally {
|
||||
manualLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleRowClick(row: any) {
|
||||
selectedOrderId.value = row?.id || null
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onQuickSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "./styles/order-sub.scss";
|
||||
|
||||
.manual-form {
|
||||
display: grid;
|
||||
grid-template-columns: 180px minmax(280px, 1fr) 160px 160px;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.manual-result {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
</style>
|
||||
@ -16,40 +16,9 @@
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||
<el-button size="small" type="primary" :disabled="!hasSelection" @click="handleBatchProcess">批量下发</el-button>
|
||||
|
||||
<template v-for="(btn, index) in pendingOrderbuttonList" :key="index">
|
||||
<el-dropdown
|
||||
v-if="btn.type === 'dropdown'"
|
||||
trigger="hover"
|
||||
@command="(cmd:any) => handleCommand(btn.command, cmd)"
|
||||
>
|
||||
<el-button size="small" :loading="btn.loading">
|
||||
{{ btn.label }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-for="opt in btn.options"
|
||||
:key="opt.value"
|
||||
:command="opt.value"
|
||||
:divided="opt.divided"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
||||
<el-button
|
||||
v-else
|
||||
size="small"
|
||||
:type="btn.btnType"
|
||||
@click="handleCommand(btn.command)"
|
||||
>
|
||||
{{ btn.label }}
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button size="small" :disabled="!hasSelection" :loading="actionLoading" @click="handleReverseReview">反审回待审核</el-button>
|
||||
<el-button size="small" type="warning" :disabled="!hasSelection" :loading="actionLoading" @click="handleMarkPendingOutbound">标记待出库</el-button>
|
||||
<el-button size="small" type="danger" :disabled="!hasSelection" :loading="actionLoading" @click="handleCancelOrder">取消订单</el-button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
@ -92,12 +61,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #column-inspection_status="{ row }">
|
||||
<el-tag :type="row.inspection_status === 'fin' ? 'success' : row.inspection_status === 'reject' ? 'danger' : 'info'" size="small">
|
||||
{{ translateOrderField('inspection_status', row.inspection_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #column-is_urgency="{ row }">
|
||||
<el-tag :type="row.is_urgency === 'Y' ? 'danger' : 'info'" size="small">
|
||||
{{ translateOrderField('is_urgency', row.is_urgency) }}
|
||||
@ -174,18 +137,15 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import { getpendingOrderlist } from '@/api/order/order'
|
||||
import { orderPendingOrder } from '@/api/order.pendingOrder/orderpendingOrder'
|
||||
|
||||
import {
|
||||
pendingCloums,
|
||||
pendingAvailableFields,
|
||||
pendingOrderDetail,
|
||||
pendingOrderbuttonList,
|
||||
translateOrderField
|
||||
} from './config/order-common-config'
|
||||
import ArchiveOrderPanel from './component/ArchiveOrderPanel.vue'
|
||||
@ -201,7 +161,7 @@ const activeTab = ref('details')
|
||||
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const actionLoading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
@ -225,7 +185,6 @@ function getStatusType(status: string) {
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadFilterData()
|
||||
})
|
||||
|
||||
async function loadData() {
|
||||
@ -251,7 +210,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await getpendingOrderlist(queryParams)
|
||||
const res = await orderPendingOrder.list(queryParams)
|
||||
if (res && (res.code === 1 || res.code === 200) && res.data) {
|
||||
list.value = res.data.list || []
|
||||
pagination.total = res.data.pagination?.total || res.data.total || 0
|
||||
@ -288,19 +247,6 @@ function buildWhereConditions(rawConditions: Record<string, any>) {
|
||||
return where
|
||||
}
|
||||
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, presetRes]: any = await Promise.all([
|
||||
indexApi.loadStores({ type: 'order' }),
|
||||
indexApi.fastWhereTree('order')
|
||||
])
|
||||
if (storesRes?.code === 200) {
|
||||
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
|
||||
if (f) f.options = storesRes.stores || []
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function handleConditionChange() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
@ -342,53 +288,75 @@ function onQuickSearch() {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleBatchProcess() {
|
||||
ElMessage.success(`成功并发下发 ${selectionRows.value.length} 个订单`)
|
||||
function getSelectedIds() {
|
||||
return selectionRows.value
|
||||
.map((item: any) => item?.id)
|
||||
.filter((id: any) => id !== undefined && id !== null)
|
||||
}
|
||||
|
||||
// 统一执行命令
|
||||
function handleCommand(commandName: string, subCommand?: string) {
|
||||
const handlers: Record<string, Function> = {
|
||||
handleExcelOperation,
|
||||
handlePrintOperation,
|
||||
}
|
||||
const handler = handlers[commandName]
|
||||
if (handler) {
|
||||
handler(subCommand)
|
||||
async function callAction(
|
||||
title: string,
|
||||
action: () => Promise<any>,
|
||||
successText: string
|
||||
) {
|
||||
if (actionLoading.value) return
|
||||
actionLoading.value = true
|
||||
try {
|
||||
const res = await action()
|
||||
if (res && (res.code === 1 || res.code === 200)) {
|
||||
ElMessage.success(`${successText} ${res.data?.updated_count || 0} 条`)
|
||||
upperTable.value?.clearSelection?.()
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
await loadData()
|
||||
} else {
|
||||
ElMessage.error(res?.message || `${title}失败`)
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(`${title}失败`)
|
||||
} finally {
|
||||
actionLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const commandLabels: Record<string, string> = {
|
||||
'import-order': '订单导入',
|
||||
'import-delivery': '快递号导入',
|
||||
'import-address': '地址导入',
|
||||
'export-summary': '导出订单(不含明细)',
|
||||
'export-detail': '导出订单(含明细)'
|
||||
}
|
||||
|
||||
async function handleExcelOperation(command: string) {
|
||||
const label = commandLabels[command] || 'EXCEL操作'
|
||||
exportLoading.value = true
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
ElMessage.success(`${label}成功`)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
const printLabels: Record<string, string> = {
|
||||
'print-delivery': '打印发货单',
|
||||
'print-picking': '打印拣货单',
|
||||
'print-waybill-cainiao': '打印面单(菜鸟)',
|
||||
'print-waybill-pdd': '打印面单(拼多多)'
|
||||
}
|
||||
|
||||
function handlePrintOperation(command: string) {
|
||||
const label = printLabels[command] || '打印操作'
|
||||
if (!hasSelection.value) {
|
||||
ElMessage.warning(`请先选择要${label}的订单`)
|
||||
async function handleReverseReview() {
|
||||
const ids = getSelectedIds()
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('请先选择订单')
|
||||
return
|
||||
}
|
||||
ElMessage.success(`正在执行: ${label} (选中 ${selectionRows.value.length} 个订单)`)
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定将选中的 ${ids.length} 条订单反审回待审核吗?`, '确认', { type: 'warning' })
|
||||
await callAction('反审', () => orderPendingOrder.reverseReviewOrder({ ids }), '反审成功')
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
async function handleMarkPendingOutbound() {
|
||||
const ids = getSelectedIds()
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('请先选择订单')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定将选中的 ${ids.length} 条订单标记为待出库吗?`, '确认', { type: 'warning' })
|
||||
await callAction(
|
||||
'标记待出库',
|
||||
() => orderPendingOrder.markPendingOutboundOrder({ ids }),
|
||||
'标记待出库成功'
|
||||
)
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
async function handleCancelOrder() {
|
||||
const ids = getSelectedIds()
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('请先选择订单')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定取消选中的 ${ids.length} 条订单吗?`, '确认', { type: 'error' })
|
||||
await callAction('取消订单', () => orderPendingOrder.cancelOrder({ ids }), '取消订单成功')
|
||||
} catch (error) {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -17,9 +17,7 @@
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||
<el-button size="small" type="success" :disabled="!hasSelection" @click="openReviewDialog(selectionRows)">批量审核</el-button>
|
||||
<el-button size="small" type="danger" :disabled="!hasSelection" @click="confirmBatchCancel">批量拦截</el-button>
|
||||
<el-button size="small" :loading="exportLoading" @click="handleExport">导出</el-button>
|
||||
<el-button size="small" type="success" :disabled="!hasSelection" :loading="reviewSubmitting" @click="handleBatchReview">批量审核通过</el-button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
@ -56,12 +54,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #column-inspection_status="{ row }">
|
||||
<el-tag :type="row.inspection_status === 'fin' ? 'success' : row.inspection_status === 'reject' ? 'danger' : 'warning'" size="small">
|
||||
{{ translateOrderField('inspection_status', row.inspection_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #column-order_status="{ row }">
|
||||
<el-tag :type="getStatusType(row.order_status)" size="small">
|
||||
{{ translateOrderField('order_status', row.order_status) }}
|
||||
@ -104,7 +96,7 @@
|
||||
<div v-else-if="activeTab === 'review'" class="review-tab-panel">
|
||||
<el-alert type="info" :closable="false" show-icon title="可对当前选中订单发起审核操作" />
|
||||
<div class="review-tab-action">
|
||||
<el-button size="small" type="primary" @click="openReviewDialog([selectedRow])">审核当前订单</el-button>
|
||||
<el-button size="small" type="primary" :loading="reviewSubmitting" @click="handleSingleReview">审核当前订单</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
@ -121,12 +113,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<order-review-dialog
|
||||
v-model="reviewDialogVisible"
|
||||
:orders="reviewTargets"
|
||||
:submitting="reviewSubmitting"
|
||||
@submit="handleSubmitReview"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -135,8 +121,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import { getreviewOrderlist, reviewOrder } from '@/api/order/order'
|
||||
import { orderReviewOrder } from '@/api/order.reviewOrder/orderreviewOrder'
|
||||
|
||||
import {
|
||||
reviewAvailableFields,
|
||||
@ -146,7 +131,6 @@ import {
|
||||
} from './config/order-common-config'
|
||||
import detail from './component/detail.vue'
|
||||
import log from './component/log.vue'
|
||||
import OrderReviewDialog from './component/OrderReviewDialog.vue'
|
||||
|
||||
const scanBox = ref<any>(null)
|
||||
const upperTable = ref<any>(null)
|
||||
@ -158,7 +142,6 @@ const activeTab = ref('details')
|
||||
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
@ -169,9 +152,7 @@ const columns = ref(reviewColums)
|
||||
const selectionRows = ref<any[]>([])
|
||||
const hasSelection = ref(false)
|
||||
const selectedOrderId = ref<number | string | null>(null)
|
||||
const reviewDialogVisible = ref(false)
|
||||
const reviewSubmitting = ref(false)
|
||||
const reviewTargets = ref<any[]>([])
|
||||
|
||||
const quickSearch = ref('')
|
||||
|
||||
@ -179,22 +160,12 @@ const selectedRow = computed(() => {
|
||||
return list.value.find((i: any) => i.id === selectedOrderId.value) || null
|
||||
})
|
||||
|
||||
function translateField(fieldValue: string, value: any) {
|
||||
const field = availableFieldsRef.find((f: any) => f.value === fieldValue)
|
||||
if (field && field.options) {
|
||||
const option = field.options.find((opt: any) => opt.value === value)
|
||||
return option ? option.label : value
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
function getStatusType(status: string) {
|
||||
return status === 'AUDITED' ? 'success' : 'warning'
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadFilterData()
|
||||
})
|
||||
|
||||
async function loadData() {
|
||||
@ -220,7 +191,7 @@ async function loadData() {
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await getreviewOrderlist(queryParams)
|
||||
const res = await orderReviewOrder.list(queryParams)
|
||||
if (res && (res.code === 1 || res.code === 200) && res.data) {
|
||||
list.value = res.data.list || []
|
||||
pagination.total = res.data.pagination?.total || res.data.total || 0
|
||||
@ -257,22 +228,6 @@ function buildWhereConditions(rawConditions: Record<string, any>) {
|
||||
return where
|
||||
}
|
||||
|
||||
async function loadFilterData() {
|
||||
try {
|
||||
const [storesRes, presetRes]: any = await Promise.all([
|
||||
indexApi.loadStores({ type: 'order' }),
|
||||
indexApi.fastWhereTree('order')
|
||||
])
|
||||
if (storesRes?.code === 200) {
|
||||
const f = availableFieldsRef.find((i: any) => i.value === 'store_id')
|
||||
if (f) f.options = storesRes.stores || []
|
||||
}
|
||||
if (presetRes?.code === 200) {
|
||||
presetTree.value = presetRes.presetTree || []
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function handleConditionChange() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
@ -314,47 +269,25 @@ function onQuickSearch() {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function openReviewDialog(rows: any[]) {
|
||||
const targets = (rows || []).filter((item: any) => item?.id || item?.delivery_order_code)
|
||||
if (!targets.length) {
|
||||
async function submitReview(ids: Array<number | string>) {
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('请先选择需要审核的订单')
|
||||
return
|
||||
}
|
||||
reviewTargets.value = targets
|
||||
reviewDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleSubmitReview(payload: { review_status: string; operator_name: string; operate_time: string }) {
|
||||
if (reviewSubmitting.value) return
|
||||
reviewSubmitting.value = true
|
||||
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
reviewTargets.value.map((order) =>
|
||||
reviewOrder({
|
||||
id: order.id,
|
||||
delivery_order_code: order.delivery_order_code,
|
||||
review_status: payload.review_status,
|
||||
inspection_status: payload.review_status,
|
||||
operator_name: payload.operator_name,
|
||||
operate_time: payload.operate_time
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
const successCount = results.filter((res) => res && (res.code === 1 || res.code === 200)).length
|
||||
const failCount = results.length - successCount
|
||||
|
||||
if (successCount > 0) {
|
||||
ElMessage.success(`审核成功 ${successCount} 条${failCount > 0 ? `,失败 ${failCount} 条` : ''}`)
|
||||
reviewDialogVisible.value = false
|
||||
reviewTargets.value = []
|
||||
const res = await orderReviewOrder.reviewOrder({ ids })
|
||||
if (res && (res.code === 1 || res.code === 200)) {
|
||||
ElMessage.success(`审核成功 ${res.data?.updated_count || ids.length} 条`)
|
||||
upperTable.value?.clearSelection?.()
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
loadData()
|
||||
return
|
||||
await loadData()
|
||||
} else {
|
||||
ElMessage.error(res?.message || '订单审核失败,请稍后重试')
|
||||
}
|
||||
ElMessage.error('订单审核失败,请稍后重试')
|
||||
} catch (error) {
|
||||
ElMessage.error('订单审核失败,请稍后重试')
|
||||
} finally {
|
||||
@ -362,20 +295,27 @@ async function handleSubmitReview(payload: { review_status: string; operator_nam
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmBatchCancel() {
|
||||
async function handleBatchReview() {
|
||||
const ids = selectionRows.value.map((item: any) => item?.id).filter((id: any) => id !== undefined && id !== null)
|
||||
if (!ids.length) {
|
||||
ElMessage.warning('请先选择需要审核的订单')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定要拦截选中的订单吗?`, '警告', { type: 'error' })
|
||||
ElMessage.success('操作成功')
|
||||
loadData()
|
||||
await ElMessageBox.confirm(`确定审核通过选中的 ${ids.length} 条订单吗?`, '确认', { type: 'warning' })
|
||||
await submitReview(ids)
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
exportLoading.value = true
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
ElMessage.success('导出成功')
|
||||
}, 1000)
|
||||
async function handleSingleReview() {
|
||||
if (!selectedRow.value?.id) {
|
||||
ElMessage.warning('请先选择订单')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm('确定审核通过当前订单吗?', '确认', { type: 'warning' })
|
||||
await submitReview([selectedRow.value.id])
|
||||
} catch (e) {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
import { ref, reactive, onMounted, onUnmounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { CircleCheckFilled, Loading, RefreshRight } from '@element-plus/icons-vue'
|
||||
import { getBindWechatCode, unbindWechat, getBindInfo } from '@/api/profile'
|
||||
import { getBindWechatCode, unbindWechat } from '@/api/user/user'
|
||||
|
||||
type QrStatus = 'waiting' | 'pending' | 'scanned' | 'bound' | 'expired'
|
||||
|
||||
@ -197,26 +197,6 @@ const refreshQrCode = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化:先查询绑定状态,未绑定则自动加载二维码 */
|
||||
const fetchBindInfo = async () => {
|
||||
try {
|
||||
const res = await getBindInfo()
|
||||
const data = res?.data
|
||||
if (data?.status === 'bound' || data?.isBound) {
|
||||
isBound.value = true
|
||||
binderInfo.nickname = data.nickname || ''
|
||||
binderInfo.openid = data.openid || ''
|
||||
} else {
|
||||
isBound.value = false
|
||||
await initQrCode()
|
||||
}
|
||||
} catch {
|
||||
// 查询失败时仍尝试显示二维码
|
||||
isBound.value = false
|
||||
await initQrCode()
|
||||
}
|
||||
}
|
||||
|
||||
/** 解绑微信 */
|
||||
const handleUnbind = () => {
|
||||
ElMessageBox.confirm('确定要解除微信绑定吗?', '提示', {
|
||||
@ -242,7 +222,7 @@ const handleUnbind = () => {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchBindInfo()
|
||||
initQrCode()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
@ -291,7 +291,7 @@
|
||||
import { ref, reactive, watch, onMounted, nextTick, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Check, Refresh, InfoFilled, Plus } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { stockDefaultFormData, stockFormRules } from '../stock-config'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Check, Refresh, QuestionFilled } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Refresh, Plus } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import StoreStock from './store_stock.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -525,7 +525,7 @@
|
||||
import { ref, reactive, watch, onMounted, nextTick } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { Plus, Check, Refresh, Close, QuestionFilled } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { stockDefaultFormData, stockFormRules } from '../stock-config'
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
import { ref, reactive, onMounted, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Search, Delete, RefreshLeft, Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { parseTime } from '@/utils/index'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@ -128,7 +128,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
|
||||
const props = defineProps<{
|
||||
id?: number | string | null
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
import { ref, reactive, computed, watch, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
|
||||
const props = defineProps<{
|
||||
store_id?: number
|
||||
|
||||
@ -236,8 +236,8 @@ import Recycle from './component/recycle.vue'
|
||||
import { stockColumns, availableFields as stockAvailableFields, stockBatchConfig } from './stock-config'
|
||||
|
||||
// API
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as indexApi from '@/api/index.ts'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
// Store
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
import { ref, reactive, watch, onMounted } from 'vue'
|
||||
import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as entryApi from '@/api/storage/entry'
|
||||
import * as entryApi from '@/api/storage.entry/entry'
|
||||
|
||||
import {entrydetail} from '../entry-config'
|
||||
|
||||
|
||||
@ -146,8 +146,8 @@ import { useRoute } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as entryApi from '@/api/storage/entry'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import * as entryApi from '@/api/storage.entry/entry'
|
||||
import * as XLSX from 'xlsx'
|
||||
|
||||
import {
|
||||
|
||||
@ -36,9 +36,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import * as inventoryApi from '@/api/storage/inventory'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as inventoryApi from '@/api/storage.inventory/inventory'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -123,9 +123,9 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
// import * as entryApi from '@/api/storage/entry'
|
||||
import * as inventoryApi from '@/api/storage/inventory'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
// import * as entryApi from '@/api/storage.entry/entry'
|
||||
import * as inventoryApi from '@/api/storage.inventory/inventory'
|
||||
|
||||
import {
|
||||
availableFields,
|
||||
|
||||
@ -110,8 +110,8 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import { getTransactionList } from '@/api/storage/transaction'
|
||||
import * as indexApi from '@/api/index'
|
||||
import { getTransactionList } from '@/api/storage.inventory/inventory'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import {
|
||||
transactionColumns,
|
||||
availableFields,
|
||||
|
||||
@ -112,8 +112,8 @@
|
||||
import { ref, onMounted, watch, computed, reactive } from 'vue'
|
||||
import { availableFields, detailpanel } from '../receiving-config'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import * as receivingApi from '@/api/storage/receiving'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as receivingApi from '@/api/storage_receiving/receiving'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { Picture, Check, Refresh } from '@element-plus/icons-vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
import { ref, reactive, watch, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -285,8 +285,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { FullScreen, Close, CopyDocument, Search } from '@element-plus/icons-vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import AddProduct from '@/views/stock/stock/component/add.vue'
|
||||
import * as receivingApi from '@/api/storage/receiving'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as receivingApi from '@/api/storage_receiving/receiving'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import { buildStockQuery } from '@/utils/stockQueryBuilder'
|
||||
|
||||
import basic from '../window/basic.vue'
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Refresh, Download } from '@element-plus/icons-vue'
|
||||
// import * as stockApi from '@/api/stock'
|
||||
// import * as stockApi from '@/api/stock/stock'
|
||||
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
|
||||
@ -249,8 +249,8 @@ import Details from './component/DetailsPanel.vue'
|
||||
import StorageComp from './component/Storage.vue'
|
||||
import Logs from './component/Logs.vue'
|
||||
import Product from './component/Product.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as receivingApi from '@/api/storage/receiving'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import * as receivingApi from '@/api/storage_receiving/receiving'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import {
|
||||
receivingColumns,
|
||||
@ -264,9 +264,9 @@ import {
|
||||
printFormConfig,
|
||||
addReceivingFields
|
||||
} from './receiving-config'
|
||||
import * as printerApi from '@/api/printer'
|
||||
import * as templateApi from '@/api/printTemplate'
|
||||
import * as stationApi from '@/api/print/station'
|
||||
import * as printerApi from '@/api/printer.station/printerstation'
|
||||
import * as templateApi from '@/api/setting.printTemplate/printTemplate'
|
||||
import * as stationApi from '@/api/print/print'
|
||||
import JsBarcode from 'jsbarcode'
|
||||
import * as XLSX from 'xlsx'
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
import { ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { productColumns } from '../stockout-config'
|
||||
import * as stockoutApi from '@/api/storage/stockout'
|
||||
import * as stockoutApi from '@/api/storage.stockout/stockout'
|
||||
|
||||
const props = defineProps<{
|
||||
id: string | number
|
||||
|
||||
@ -103,8 +103,8 @@ import { useRoute } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as stockoutApi from '@/api/storage/stockout' //现有的对应 API
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import * as stockoutApi from '@/api/storage.stockout/stockout' //现有的对应 API
|
||||
|
||||
import {
|
||||
availableFields,
|
||||
|
||||
@ -181,8 +181,8 @@ import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as validityApi from '@/api/storage/validityperiod'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { getExpiryList } from '@/api/storage.inventory/inventory'
|
||||
import * as XLSX from 'xlsx'
|
||||
import expiryQuery from './component/expiryQuery.vue'
|
||||
import {
|
||||
@ -276,7 +276,7 @@ async function loadData() {
|
||||
: undefined
|
||||
}
|
||||
|
||||
const res: any = await validityApi.getExpiryList(params)
|
||||
const res: any = await getExpiryList(params)
|
||||
if (res && (res.code === 200 || res.code === 1 || res.flag === 'success')) {
|
||||
const data = res.data || res
|
||||
const rows = Array.isArray(data.list) ? data.list : []
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
import { ref, reactive, watch, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import * as stockApi from '@/api/stock'
|
||||
import * as stockApi from '@/api/stock/stock'
|
||||
import RequestData from '@/components/RequestData/index.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@ -732,8 +732,8 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Search, Plus, Refresh, QuestionFilled } from '@element-plus/icons-vue'
|
||||
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind, storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields, storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig, storeWarehouseAdjustPrintQuantity, listApiConfig } from '@/api/storeWarehouse'
|
||||
import { listInterfaceTypes } from '@/api/index'
|
||||
import { storeWarehouseList, storeWarehouseSign, storeWarehouseUnbind, storeWarehouseRename, storeWarehouseGetPolicyConfig, storeWarehouseGetPolicyConfigFields, storeWarehouseSavePolicyConfig, saveApiConfig, storeWarehouseDeleteQimenConfig, storeWarehouseAdjustPrintQuantity, listApiConfig } from '@/api/storeWarehouse.store/storeWarehouse'
|
||||
import { listInterfaceTypes } from '@/api/index/index'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import Detail from './component/detail.vue'
|
||||
|
||||
@ -261,8 +261,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, reactive, nextTick, computed } from 'vue'
|
||||
import { accountList, accountAdd, accountUpdate, accountdelete, accountResetPassword, getBindWechatCode, unbindWechat } from '@/api/setting/account'
|
||||
import { roleList } from '@/api/setting/role'
|
||||
import { accountList, accountAdd, accountUpdate, accountdelete, accountResetPassword, getBindWechatCode, unbindWechat } from '@/api/setting.account/account'
|
||||
import { roleList } from '@/api/setting.role/role'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import ImagesUpload from '@/components/ImagesUpload/index.vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
@ -200,7 +200,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { permissionList, permissionAdd, permissionUpdate, permissionDelete } from '@/api/setting/permission'
|
||||
import { permissionList, permissionAdd, permissionUpdate, permissionDelete } from '@/api/setting.permission/permission'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
import {
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Check, Refresh } from '@element-plus/icons-vue'
|
||||
import * as stationApi from '@/api/print/station'
|
||||
import * as stationApi from '@/api/print/print'
|
||||
|
||||
const emit = defineEmits(['saved'])
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import * as stationApi from '@/api/print/station'
|
||||
import * as stationApi from '@/api/print/print'
|
||||
// import { t } from 'vue-router/dist/index-DFCq6eJK.js'
|
||||
// import { fi } from 'element-plus/es/locales.mjs'
|
||||
|
||||
|
||||
@ -183,8 +183,8 @@ import ExpressCompany from './components/expressCompany.vue'
|
||||
import ComponentList from './components/Printer.vue'
|
||||
import Add from './components/add.vue'
|
||||
|
||||
import * as stationApi from '@/api/print/station'
|
||||
import * as indexApi from '@/api/index'
|
||||
import * as stationApi from '@/api/print/print'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { Delete, Download, Plus, Refresh } from '@element-plus/icons-vue'
|
||||
|
||||
@ -53,7 +53,7 @@ import { ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Document, Folder } from '@element-plus/icons-vue'
|
||||
import TemplateEditor from './components/TemplateEditor.vue'
|
||||
import * as TemplatesApi from '@/api/printTemplate'
|
||||
import * as TemplatesApi from '@/api/setting.printTemplate/printTemplate'
|
||||
import { usePrintTemplateStore } from '@/stores/modules/printTemplate'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
|
||||
@ -196,8 +196,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
|
||||
import { roleList, roleAdd, roleDelete, roleUpdate, permissionroleList } from '@/api/setting/role'
|
||||
import { permissionList } from '@/api/setting/permission'
|
||||
import { roleList, roleAdd, roleDelete, roleUpdate, permissionroleList } from '@/api/setting.role/role'
|
||||
import { permissionList } from '@/api/setting.permission/permission'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
roleRules,
|
||||
|
||||
@ -354,7 +354,7 @@
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Search, ArrowDown } from '@element-plus/icons-vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
|
||||
interface Rack {
|
||||
id: number
|
||||
|
||||
@ -179,7 +179,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
|
||||
interface PathNode {
|
||||
sequence: number
|
||||
|
||||
@ -94,7 +94,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted, onBeforeUnmount, getCurrentInstance, } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
|
||||
const props = defineProps({
|
||||
title: { type: String, default: '仓位属性管理' },
|
||||
|
||||
@ -296,7 +296,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
|
||||
interface RackPosition {
|
||||
x: number
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed, } from 'vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import * as spaceApi from '@/api/warehouse'
|
||||
import * as spaceApi from '@/api/warehouse/warehouse'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
import SpaceForm from './SpaceForm.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
import { ElMessage } from 'element-plus'
|
||||
// import { defineProps, defineEmits } from 'vue'
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, computed } from 'vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@ -128,7 +128,7 @@ import spaceCard from './spaceCard.vue'
|
||||
import PathManagement from './PathManagement.vue'
|
||||
import RackPositionEditor from './RackPositionEditor.vue'
|
||||
import AreaRacksList from './AreaRacksList.vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
|
||||
// 仓库数据
|
||||
const warehouseList = ref<any[]>([])
|
||||
|
||||
@ -217,7 +217,7 @@
|
||||
import { ref, reactive, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
|
||||
import WarehouseViewer from './WarehouseViewer.vue'
|
||||
import ZoneDialog from './ZoneDialog.vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
||||
|
||||
const warehouseTreeRef = ref(null)
|
||||
|
||||
@ -162,7 +162,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import * as warehouseApi from '@/api/warehouse'
|
||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||
|
||||
const props = defineProps({
|
||||
rack: { type: Object, default: null },
|
||||
|
||||
1058
src/需求文档.txt
1058
src/需求文档.txt
File diff suppressed because it is too large
Load Diff
71
workflows/api-doc-agent/README.md
Normal file
71
workflows/api-doc-agent/README.md
Normal file
@ -0,0 +1,71 @@
|
||||
# API Doc Agent Workflow
|
||||
|
||||
该工作流面向 Agent 编程场景:直接基于 `api-doc-system/module` 的最新接口信息判断可用性,再在可用时返回该接口的 `params/response` 结构用于编码。
|
||||
|
||||
## 目录结构
|
||||
|
||||
- `run.mjs`: API Agent 统一入口,负责脚本路由与执行。
|
||||
- `scripts/`: 所有脚本目录,每个脚本独立管理自己的代码与数据。
|
||||
- `config/`: 公共配置目录(占位:`接口.md`、`新增模块和接口.md`)。
|
||||
- `docs/`: 公共文档目录(占位:`接口.md`、`新增模块和接口.md`)。
|
||||
|
||||
当前内置脚本:
|
||||
|
||||
- `scripts/interface-availability/`: 接口可用性测试脚本(`npm run apiagent -- <method>`)。
|
||||
- `scripts/api-list-update/`: 扫描 `src/api` 并回写 `接口.md` 文档(`npm run apiagent -- --script api-list-update`)。
|
||||
|
||||
## 可用性规则
|
||||
|
||||
- 仅当接口状态满足以下条件才判定可用:
|
||||
- `isUsed = true`
|
||||
- `isPlaceholder = false`
|
||||
|
||||
## 运行
|
||||
|
||||
```bash
|
||||
npm run apiagent -- <method>
|
||||
```
|
||||
|
||||
示例:
|
||||
|
||||
```bash
|
||||
npm run apiagent -- storage.receiving.bindStore
|
||||
```
|
||||
|
||||
查看当前可用脚本:
|
||||
|
||||
```bash
|
||||
npm run apiagent -- --script list
|
||||
```
|
||||
|
||||
执行指定脚本(可扩展):
|
||||
|
||||
```bash
|
||||
npm run apiagent -- --script interface storage.receiving.bindStore
|
||||
```
|
||||
|
||||
执行 API 列表更新(生成模块与接口总览):
|
||||
|
||||
```bash
|
||||
npm run apiagent -- --script api-list-update
|
||||
```
|
||||
|
||||
## 输出
|
||||
|
||||
- 终端打印 JSON 结果,包含:
|
||||
- `available`: 是否可用于编码
|
||||
- `check`: `isUsed` / `isPlaceholder` 判断结果
|
||||
- `interfaceSpec`: 可用时提供 `endpoint`、`params`、`response` 等接口结构
|
||||
- 同时会写入脚本私有结果文件:
|
||||
- `workflows/api-doc-agent/scripts/interface-availability/results/YYYYMMDD/<method>.json`
|
||||
- 仅扫描 `module` 中生命周期为 `active` 的模块快照;已标记删除模块不会参与可用性判断。
|
||||
- `api-list-update` 会扫描 `src/api` 下所有接口模块与 API 文件,并更新:
|
||||
- `workflows/api-doc-agent/docs/接口.md`
|
||||
- `workflows/api-doc-agent/config/接口.md`
|
||||
- 输出结果归档:`workflows/api-doc-agent/results/YYYYMMDD/api-list-update.json`
|
||||
|
||||
## 使用建议
|
||||
|
||||
1. 先执行 `npm run apiconfig` 更新 `module` 最新接口数据。
|
||||
2. 再执行 `npm run apiagent -- <method>` 判断接口可用性。
|
||||
3. 若 `available=true`,可直接用 `interfaceSpec.params/response` 生成接口定义和调用代码。
|
||||
20
workflows/api-doc-agent/config/scripts.mjs
Normal file
20
workflows/api-doc-agent/config/scripts.mjs
Normal file
@ -0,0 +1,20 @@
|
||||
const INTERFACE_AVAILABILITY_ENTRY = new URL(
|
||||
"../scripts/interface-availability/run.mjs",
|
||||
import.meta.url,
|
||||
).href;
|
||||
const API_LIST_UPDATE_ENTRY = new URL("../scripts/api-list-update/run.mjs", import.meta.url).href;
|
||||
|
||||
export const DEFAULT_API_DOC_AGENT_SCRIPT = "interface";
|
||||
|
||||
export const API_DOC_AGENT_SCRIPTS = {
|
||||
interface: {
|
||||
name: "interface",
|
||||
description: "接口可用性检查脚本",
|
||||
entry: INTERFACE_AVAILABILITY_ENTRY,
|
||||
},
|
||||
"api-list-update": {
|
||||
name: "api-list-update",
|
||||
description: "扫描 src/api 并更新接口.md",
|
||||
entry: API_LIST_UPDATE_ENTRY,
|
||||
},
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user