Commit 3a03af12 by qinjianhui

feat: 挂起状态功能开发

parent 893492ca
...@@ -241,11 +241,23 @@ export function getSuspendListApi( ...@@ -241,11 +241,23 @@ export function getSuspendListApi(
data: SearchForm, data: SearchForm,
currentPage: number, currentPage: number,
pageSize: number, pageSize: number,
statusCode?: string, pauseReason?: number,
) { ) {
return axios.post<never, BasePaginationData<FactoryOrderNewListData>>( return axios.post<never, BasePaginationData<FactoryOrderNewListData>>(
'factory/podOrderPauseControl/list_page', 'factory/podOrderPauseControl/list_page',
{ ...data, currentPage, pageSize, statusCode }, { ...data, currentPage, pageSize, pauseReason },
)
}
export function getSuspendStatisticsApi(
data: SearchForm,
currentPage: number,
pageSize: number,
pauseReason?: number,
) {
return axios.post<never, BaseRespData<Record<string, number>>>(
'factory/podOrderPauseControl/suspendStatistics',
{ ...data, currentPage, pageSize, pauseReason },
) )
} }
......
...@@ -5,9 +5,7 @@ import { ...@@ -5,9 +5,7 @@ import {
getFactoryOrderNewDetailApi, getFactoryOrderNewDetailApi,
getFactoryOrderNewListApi, getFactoryOrderNewListApi,
getFactoryOrderNewLogApi, getFactoryOrderNewLogApi,
getSuspendDetailApi,
getSuspendListApi, getSuspendListApi,
getSuspendLogApi,
} from '@/api/factoryOrderNew' } from '@/api/factoryOrderNew'
import type { import type {
FactoryOrderNewListData, FactoryOrderNewListData,
...@@ -22,6 +20,7 @@ interface UseOrderListAndDetailOptions { ...@@ -22,6 +20,7 @@ interface UseOrderListAndDetailOptions {
isTableLayout: Ref<boolean> isTableLayout: Ref<boolean>
getQueryPayload: () => Record<string, unknown> getQueryPayload: () => Record<string, unknown>
getListPageAcceptedSubStatus: () => number | undefined getListPageAcceptedSubStatus: () => number | undefined
suspendedSubTab: Ref<number>
} }
export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
...@@ -31,6 +30,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -31,6 +30,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
isTableLayout, isTableLayout,
getQueryPayload, getQueryPayload,
getListPageAcceptedSubStatus, getListPageAcceptedSubStatus,
suspendedSubTab,
} = options } = options
const subLoading = ref(false) const subLoading = ref(false)
...@@ -59,9 +59,11 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -59,9 +59,11 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
getQueryPayload(), getQueryPayload(),
page, page,
size, size,
status.value, suspendedSubTab.value,
).then(async (res) => { ).then(async (res) => {
const records = Array.isArray(res.data?.records) ? res.data.records : [] const records = Array.isArray(res.data?.records)
? res.data.records
: []
await nextTick(() => { await nextTick(() => {
tableRef.value.setCurrentRow(records[0]) tableRef.value.setCurrentRow(records[0])
currentRow.value = records[0] as never currentRow.value = records[0] as never
...@@ -76,7 +78,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -76,7 +78,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
status.value === 'ALL' ? undefined : status.value, status.value === 'ALL' ? undefined : status.value,
getListPageAcceptedSubStatus(), getListPageAcceptedSubStatus(),
).then(async (res) => { ).then(async (res) => {
const records = res.data.records const records = res.data.records || []
await nextTick(() => { await nextTick(() => {
tableRef.value.setCurrentRow(records[0]) tableRef.value.setCurrentRow(records[0])
currentRow.value = (records[0] as never) || null currentRow.value = (records[0] as never) || null
...@@ -116,21 +118,27 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) { ...@@ -116,21 +118,27 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
return return
} }
const id = currentRow.value.id const id = currentRow.value.id
const isSuspend = status.value === 'SUSPEND' // const isSuspend = status.value === 'SUSPEND'
const effectiveTab = tabName ?? activeTab.value const effectiveTab = tabName ?? activeTab.value
subLoading.value = true subLoading.value = true
try { try {
if (effectiveTab === 'product') { if (effectiveTab === 'product') {
productList.value = [] productList.value = []
const productRes = isSuspend // const productRes = isSuspend
? await getSuspendDetailApi(id) // ? await getSuspendDetailApi(id)
: await getFactoryOrderNewDetailApi(id) // : await getFactoryOrderNewDetailApi(id)
productList.value = Array.isArray(productRes.data) ? productRes.data : [] const productRes = await getFactoryOrderNewDetailApi(id)
if (productRes.code !== 200) return
productList.value = Array.isArray(productRes.data)
? productRes.data
: []
} else { } else {
logList.value = [] logList.value = []
const logRes = isSuspend // const logRes = isSuspend
? await getSuspendLogApi(id) // ? await getSuspendLogApi(id)
: await getFactoryOrderNewLogApi(id) // : await getFactoryOrderNewLogApi(id)
const logRes = await getFactoryOrderNewLogApi(id)
if (logRes.code !== 200) return
logList.value = Array.isArray(logRes.data) ? logRes.data : [] logList.value = Array.isArray(logRes.data) ? logRes.data : []
} }
} catch (e) { } catch (e) {
......
import { computed, ref, nextTick } from 'vue' import { computed, ref, nextTick } from 'vue'
import { getPodOrderAcceptedStatisticsApi, getPodOrderStateGroupListApi } from '@/api/factoryOrderNew' import {
getPodOrderAcceptedStatisticsApi,
getPodOrderStateGroupListApi,
getSuspendStatisticsApi,
} from '@/api/factoryOrderNew'
import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew' import type { StatusTreeNode } from '@/types/api/order/factoryOrderNew'
interface UseOrderStatusTreeOptions { interface UseOrderStatusTreeOptions {
...@@ -11,8 +15,13 @@ interface UseOrderStatusTreeOptions { ...@@ -11,8 +15,13 @@ interface UseOrderStatusTreeOptions {
} }
export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
const { getQueryPayload, currentPage, pageSize, onClearTableState, onRefreshCurrentView } = const {
options getQueryPayload,
currentPage,
pageSize,
onClearTableState,
onRefreshCurrentView,
} = options
const cardLayoutStatuses = [ const cardLayoutStatuses = [
'PENDING_SCHEDULE', 'PENDING_SCHEDULE',
...@@ -25,9 +34,9 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -25,9 +34,9 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
const statusTree = ref<StatusTreeNode[]>() const statusTree = ref<StatusTreeNode[]>()
const status = ref<string>('PENDING_RECEIVE') const status = ref<string>('PENDING_RECEIVE')
const pendingAcceptSubTab = ref<'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK'>( const pendingAcceptSubTab = ref<
'PENDING_RECEIVE', 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK'
) >('PENDING_RECEIVE')
const pendingAcceptCounts = ref<{ const pendingAcceptCounts = ref<{
acceptedOutOfStockCount?: number acceptedOutOfStockCount?: number
pendingCount?: number pendingCount?: number
...@@ -36,16 +45,18 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -36,16 +45,18 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
pendingCount: 0, pendingCount: 0,
acceptedOutOfStockCount: 0, acceptedOutOfStockCount: 0,
}) })
const suspendedTabs = [ const suspendedTabs = ref([
{ label: '客户拦截', value: 'CUSTOMER_INTERCEPT', count: 0 }, { label: '客户拦截', key: 'customerInterceptCount', value: 1, count: 0 },
{ label: '地址异常', value: 'ADDRESS_EXCEPTION', count: 0 }, { label: '地址异常', key: 'addressExceptionCount', value: 2, count: 0 },
{ label: '其他', value: 'OTHER', count: 0 }, { label: '其他', key: 'otherReasonCount', value: 4, count: 0 },
] ])
const suspendedSubTab = ref('CUSTOMER_INTERCEPT') const suspendedSubTab = ref(1)
const treeRef = ref() const treeRef = ref()
const isCardLayout = computed(() => cardLayoutStatuses.includes(status.value)) const isCardLayout = computed(() => cardLayoutStatuses.includes(status.value))
const isSpecialLayout = computed(() => specialLayoutStatuses.includes(status.value)) const isSpecialLayout = computed(() =>
specialLayoutStatuses.includes(status.value),
)
const isTableLayout = computed( const isTableLayout = computed(
() => !isCardLayout.value && !isSpecialLayout.value, () => !isCardLayout.value && !isSpecialLayout.value,
) )
...@@ -76,6 +87,25 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -76,6 +87,25 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
} }
} }
const getSuspendCounts = async () => {
try {
const res = await getSuspendStatisticsApi(
getQueryPayload(),
currentPage.value,
pageSize.value,
suspendedSubTab.value,
)
if (res.code !== 200 || !res.data) return
const data = res.data || {}
suspendedTabs.value = suspendedTabs.value.map((tab) => ({
...tab,
count: data[String(tab.key)] ?? 0,
}))
} catch (e) {
console.error(e)
}
}
const loadStatusTreeCounts = async () => { const loadStatusTreeCounts = async () => {
try { try {
const res = await getPodOrderStateGroupListApi() const res = await getPodOrderStateGroupListApi()
...@@ -96,12 +126,15 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -96,12 +126,15 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
pendingAcceptSubTab.value = 'PENDING_RECEIVE' pendingAcceptSubTab.value = 'PENDING_RECEIVE'
} }
if (node.status !== 'SUSPEND') { if (node.status !== 'SUSPEND') {
suspendedSubTab.value = 'CUSTOMER_INTERCEPT' suspendedSubTab.value = 1
} }
onClearTableState() onClearTableState()
if (!isSpecialLayout.value) { if (!isSpecialLayout.value) {
onRefreshCurrentView() onRefreshCurrentView()
} }
if (node.status === 'SUSPEND') {
void getSuspendCounts()
}
} }
const handlePendingAcceptTabClick = ( const handlePendingAcceptTabClick = (
...@@ -132,6 +165,7 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) { ...@@ -132,6 +165,7 @@ export function useOrderStatusTree(options: UseOrderStatusTreeOptions) {
isTableLayout, isTableLayout,
getListPageAcceptedSubStatus, getListPageAcceptedSubStatus,
getPendingReceiveCounts, getPendingReceiveCounts,
getSuspendCounts,
loadStatusTreeCounts, loadStatusTreeCounts,
handleStatusNodeClick, handleStatusNodeClick,
handlePendingAcceptTabClick, handlePendingAcceptTabClick,
......
...@@ -574,14 +574,9 @@ ...@@ -574,14 +574,9 @@
> >
</span> </span>
<!-- 待发货 --> <span v-if="status === 'PENDING_DELIVERY'" class="item">
<template v-if="status === 'PENDING_DELIVERY'"> <ElButton type="primary" @click="handleWeightSort">称重分拣</ElButton>
<span class="item">
<ElButton type="primary" @click="handleWeightSort"
>称重分拣</ElButton
>
</span> </span>
</template>
<!-- 已完成 --> <!-- 已完成 -->
<template v-if="status === 'COMPLETED'"> <template v-if="status === 'COMPLETED'">
<span class="item"> <span class="item">
...@@ -666,7 +661,7 @@ ...@@ -666,7 +661,7 @@
:key="tab.value" :key="tab.value"
class="status-subtab" class="status-subtab"
:class="{ active: suspendedSubTab === tab.value }" :class="{ active: suspendedSubTab === tab.value }"
@click="suspendedSubTab = tab.value" @click="handleSuspendTabClick(tab.value)"
> >
{{ tab.label }}({{ tab.count || 0 }}) {{ tab.label }}({{ tab.count || 0 }})
</div> </div>
...@@ -1005,6 +1000,7 @@ const { ...@@ -1005,6 +1000,7 @@ const {
isTableLayout, isTableLayout,
getListPageAcceptedSubStatus, getListPageAcceptedSubStatus,
getPendingReceiveCounts, getPendingReceiveCounts,
getSuspendCounts,
loadStatusTreeCounts, loadStatusTreeCounts,
handlePendingAcceptTabClick: handlePendingAcceptTabClickRaw, handlePendingAcceptTabClick: handlePendingAcceptTabClickRaw,
toggleExpand, toggleExpand,
...@@ -1045,6 +1041,7 @@ const { ...@@ -1045,6 +1041,7 @@ const {
isTableLayout, isTableLayout,
getQueryPayload, getQueryPayload,
getListPageAcceptedSubStatus, getListPageAcceptedSubStatus,
suspendedSubTab,
}) })
statusCurrentPageRef.value = currentPage.value statusCurrentPageRef.value = currentPage.value
statusPageSizeRef.value = pageSize.value statusPageSizeRef.value = pageSize.value
...@@ -1066,6 +1063,9 @@ const refreshCurrentView = (options?: { isRefreshTree?: boolean }) => { ...@@ -1066,6 +1063,9 @@ const refreshCurrentView = (options?: { isRefreshTree?: boolean }) => {
statusPageSizeRef.value = pageSize.value statusPageSizeRef.value = pageSize.value
void getPendingReceiveCounts() void getPendingReceiveCounts()
} }
if (status.value === 'SUSPEND') {
void getSuspendCounts()
}
refreshTableList() refreshTableList()
} }
refreshCurrentViewProxy.value = () => refreshCurrentView() refreshCurrentViewProxy.value = () => refreshCurrentView()
...@@ -1076,7 +1076,7 @@ const handleStatusNodeClick = (node: { status: string }) => { ...@@ -1076,7 +1076,7 @@ const handleStatusNodeClick = (node: { status: string }) => {
pendingAcceptSubTab.value = 'PENDING_RECEIVE' pendingAcceptSubTab.value = 'PENDING_RECEIVE'
} }
if (node.status !== 'SUSPEND') { if (node.status !== 'SUSPEND') {
suspendedSubTab.value = 'CUSTOMER_INTERCEPT' suspendedSubTab.value = 1
} }
clearTableState() clearTableState()
if (!isSpecialLayout.value) { if (!isSpecialLayout.value) {
...@@ -1086,6 +1086,14 @@ const handleStatusNodeClick = (node: { status: string }) => { ...@@ -1086,6 +1086,14 @@ const handleStatusNodeClick = (node: { status: string }) => {
const handlePendingAcceptTabClick = ( const handlePendingAcceptTabClick = (
tab: 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK', tab: 'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK',
) => handlePendingAcceptTabClickRaw(tab, refreshTableList) ) => handlePendingAcceptTabClickRaw(tab, refreshTableList)
const handleSuspendTabClick = (value: number) => {
if (suspendedSubTab.value === value) return
suspendedSubTab.value = value
currentPage.value = 1
statusCurrentPageRef.value = 1
refreshTableList()
}
const mainColumns = [ const mainColumns = [
{ {
prop: 'factoryOrderNumber', prop: 'factoryOrderNumber',
......
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