Commit bedbfc7e by qinjianhui

Merge branch 'dev' into 'master'

Dev

See merge request !249
parents 836bb7d8 e5ce782f
......@@ -32,12 +32,12 @@ axios.interceptors.request.use(
config.headers['jwt-token'] = token
}
config.headers.timestamp = new Date().getTime()
config.headers.uuid = uuidv4().replace(/-/g, '')
config.headers.uuid = uuidv4().replace(/-/g, '')
addRequestItem({
url: config.url || '',
method: config.method || '',
startTime: dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss.SSS'),
uuid: config.headers.uuid
uuid: config.headers.uuid,
})
return config
},
......@@ -51,31 +51,39 @@ axios.interceptors.response.use(
const data = response.data
const uuid = response.config?.headers?.uuid
const item = findRequestItemByUUID(uuid)
if(response.config.url){
if (response.config.url) {
if (response.config.url.startsWith('/')) {
item.url = `${import.meta.env.VITE_API_BASE}${response.config.url}`
} else {
item.url = `${import.meta.env.VITE_API_BASE}${`/${response.config.url}`}`
item.url = `${
import.meta.env.VITE_API_BASE
}${`/${response.config.url}`}`
}
}
const fm = new FormData()
const processTime = response.headers['processtime']
const endTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss.SSS')
const clientResponseTime = getTimeDifferenceInMilliseconds(item.startTime, endTime)
const clientResponseTime = getTimeDifferenceInMilliseconds(
item.startTime,
endTime,
)
console.log(item)
if((clientResponseTime as number)>=3000){
if ((clientResponseTime as number) >= 3000) {
const user = localStorage.getItem('user')
if (user) {
const userJson:UserJson = JSON.parse(user)
const userJson: UserJson = JSON.parse(user)
fm.append('factoryCode', userJson?.factoryCode)
}
fm.append('processTime', processTime)
fm.append('url', item.url)
fm.append('method', item.method)
fm.append('requestId', response.data.requestId)
fm.append('clientResponseTime', String(clientResponseTime)+'ms')
navigator.sendBeacon(`${import.meta.env.VITE_API_BASE}/factory/ops/report-data`, fm)
fm.append('clientResponseTime', String(clientResponseTime) + 'ms')
navigator.sendBeacon(
`${import.meta.env.VITE_API_BASE}/factory/ops/report-data`,
fm,
)
}
deleteRequestByUUID(uuid)
if (data && typeof data === 'object' && typeof data.code === 'number') {
......@@ -85,14 +93,18 @@ axios.interceptors.response.use(
return Promise.reject(data)
}
if (data.code !== 200) {
showError(data.message)
if (!response.config.skipGlobalError) {
showError(data.message)
}
return Promise.reject(data)
}
}
return data
},
(error) => {
showError(error.message)
if (!error.config?.skipGlobalError) {
showError(error.message)
}
return Promise.reject(error)
},
)
......
......@@ -274,6 +274,7 @@ export function getPackingDataApi(
) {
return axios.get<never, BaseRespData<PodMakeOrderData>>(url, {
params,
skipGlobalError: true,
})
}
export function getPodBoxListApi(
......
import 'axios'
declare module 'axios' {
export interface AxiosRequestConfig {
/** 为 true 时跳过全局响应拦截器的默认错误提示,由调用方自行处理 */
skipGlobalError?: boolean
}
export interface InternalAxiosRequestConfig {
skipGlobalError?: boolean
}
}
......@@ -15,6 +15,39 @@ import type {
operateOrderListData,
} from '@/types/api/order/factoryOrderNew'
const CREATE_TIME_LIST_SORT_PROP = 'po.create_time'
/** 创建时间升序 */
const CREATE_TIME_SORT_ASC_STATUSES = new Set([
'PENDING_RECEIVE',
'PENDING_CREATE_LOGISTICS',
'PENDING_SCHEDULE',
'PENDING_DELIVERY',
'SUSPEND',
])
/** 创建时间降序 */
const CREATE_TIME_SORT_DESC_STATUSES = new Set([
'ALL',
'PICKING',
'COMPLETED',
'CANCELLED',
'ARCHIVE',
])
// 构建默认时间排序参数
export function getDefaultCreateTimeSortParams(
treeStatus: string,
): { prop: string; order: 'asc' | 'desc' } | null {
if (CREATE_TIME_SORT_ASC_STATUSES.has(treeStatus)) {
return { prop: CREATE_TIME_LIST_SORT_PROP, order: 'asc' }
}
if (CREATE_TIME_SORT_DESC_STATUSES.has(treeStatus)) {
return { prop: CREATE_TIME_LIST_SORT_PROP, order: 'desc' }
}
return null
}
interface UseOrderListAndDetailOptions {
status: Ref<string>
// 查询的状态树,与左侧状态树参数不同,用于挂起状态下suspendReason参数的修改
......@@ -53,6 +86,18 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
const listSortProp = ref<string | null>(null)
const listSortOrder = ref<'asc' | 'desc' | null>(null)
// 默认排序参数
const applyDefaultListSort = () => {
const defaultSort = getDefaultCreateTimeSortParams(treeStatus.value)
if (defaultSort) {
listSortProp.value = defaultSort.prop
listSortOrder.value = defaultSort.order
} else {
listSortProp.value = null
listSortOrder.value = null
}
}
const buildListQueryBody = (): SearchForm => {
const base = { ...getQueryPayload() } as SearchForm
if (listSortProp.value && listSortOrder.value) {
......@@ -110,8 +155,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
operationOrderList.value = []
logList.value = []
currentRow.value = null
listSortProp.value = null
listSortOrder.value = null
applyDefaultListSort()
}
const SORTABLE_COLUMN_PROPS = [
......@@ -125,7 +169,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
(typeof SORTABLE_COLUMN_PROPS)[number],
string
> = {
createTime: 'po.create_time',
createTime: CREATE_TIME_LIST_SORT_PROP,
startStockingTime: 'po.start_stocking_time',
finishTime: 'po.finish_time',
}
......@@ -152,8 +196,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
listSortProp.value = sortProp
listSortOrder.value = 'desc'
} else {
listSortProp.value = null
listSortOrder.value = null
applyDefaultListSort()
}
refreshTableList()
}
......
......@@ -147,7 +147,17 @@
</ElFormItem>
<ElFormItem
v-if="cardLayoutStatuses.includes(status)"
v-if="
cardLayoutStatuses.includes(status) ||
[
'ALL',
'PICKING',
'PENDING_DELIVERY',
'COMPLETED',
'SUSPEND',
'CANCELLED',
].includes(status)
"
label="操作单号"
>
<ElInput
......@@ -698,7 +708,8 @@
status === 'IN_PRODUCTION' ||
status === 'PENDING_DELIVERY' ||
status === 'SUSPEND' ||
status === 'PENDING_PICK'
status === 'PENDING_PICK' ||
status === 'PENDING_PACKING'
"
class="item"
>
......@@ -1313,7 +1324,10 @@ import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew'
import { useOrderDictionaries } from './hooks/useOrderDictionaries'
import { useOrderSearchForm } from './hooks/useOrderSearchForm'
import { useOrderStatusTree } from './hooks/useOrderStatusTree'
import { useOrderListAndDetail } from './hooks/useOrderListAndDetail'
import {
getDefaultCreateTimeSortParams,
useOrderListAndDetail,
} from './hooks/useOrderListAndDetail'
import { useOrderBatchActions } from './hooks/useOrderBatchActions'
import { ElButton, ElTag } from 'element-plus'
import OrderInventoryDetailDialog from './component/OrderInventoryDialog.vue'
......@@ -1454,6 +1468,12 @@ const getListQueryPayload = () => {
} else {
delete payload.status
}
// 添加默认时间排序参数
const defaultSort = getDefaultCreateTimeSortParams(status.value)
if (defaultSort) {
payload.prop = defaultSort.prop
payload.order = defaultSort.order
}
return payload
}
......
......@@ -5,7 +5,16 @@ export const FACTORY_ORDER_LIST_SEARCH_FIELD_RULES: Record<
(ctx: FactoryOrderSearchQueryVisibilityContext) => boolean
> = {
batchArrangeNumber: (c) => c.isCardLayout,
operationNo: (c) => c.isCardLayout,
operationNo: (c) =>
c.isCardLayout ||
[
'ALL',
'PICKING',
'PENDING_DELIVERY',
'COMPLETED',
'SUSPEND',
'CANCELLED',
].includes(c.status),
receiverCountry: (c) => !c.isCardLayout,
logisticsWayId: (c) => c.status === 'ALL',
customerNo: (c) => c.status === 'ALL',
......
......@@ -342,6 +342,7 @@ import { filePath } from '@/api/axios.ts'
import { ElButton, ElIcon, ElTag } from 'element-plus'
import { BaseRespData } from '@/types/api'
import type { SortingList } from '@/types/api/order'
import { showError } from '@/utils/ui.ts'
const { getCLodop } = useLodop()
......@@ -988,7 +989,24 @@ const getPackingData = async (code: string) => {
producingQuantity: number
availableInventory: number
thirdSkuCode?: string
packingId?: number
box?: number
}>
if (err.code === 208) {
loading.close()
const { packingId, box } = err.data
const area = sortingAreaList.value.find((item) => item.id === packingId)
await ElMessageBox.alert(
`重复扫码!该操作单已在仓库:${area?.warehouseName}<br/>
配货区:${area?.areaName},箱子:${box}中存在!`,
'提示',
{
confirmButtonText: '确定',
dangerouslyUseHTMLString: true,
},
)
return
}
if (props.wallType !== 'us' && err?.code === 301) {
loading.close()
await ElMessageBox.alert(
......@@ -1000,7 +1018,9 @@ const getPackingData = async (code: string) => {
dangerouslyUseHTMLString: true,
},
)
return
}
showError(err.message)
} finally {
isLock.value = false
productionOrder.value = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment