Commit d70f0b3f by qinjianhui

feat: 左侧状态数结构替换

parent 59104af9
......@@ -11,11 +11,9 @@ import type {
SearchForm,
StatusTreeNode,
} from '@/types/api/factoryOrderNew'
// 左侧状态树 - 先保留接口定义,实际数据在前端写死
export function getStatusTreeApi() {
export function getPodOrderStateGroupListApi() {
return axios.get<never, BaseRespData<StatusTreeNode[]>>(
'factory/orderNew/getStatusTree',
'factory/podOrder/findStateGroupList',
)
}
......@@ -26,7 +24,7 @@ export function getFactoryOrderNewListApi(
statusCode?: string,
) {
return axios.post<never, BasePaginationData<FactoryOrderNewListData>>(
'factory/orderNew/list_page',
'factory/podOrder/list_page',
{
...data,
currentPage,
......
export interface StatusTreeNode {
code: string
remark: string
count: number
children?: StatusTreeNode[]
status: string
statusName: string
quantity: number
children: StatusTreeNode[] | null
}
export interface SearchForm {
......
......@@ -312,7 +312,6 @@ const handleDelete = () => {
}
const handleReArrange = (row: BatchManageData) => {
// 后端未提供“批次 -> 商品ID列表”映射时,暂用行 id 作为占位
arrangeDialogRef.value?.open({
productIdList: [row.id],
title: '重排',
......
......@@ -7,21 +7,24 @@
:expand-on-click-node="false"
:default-expanded-keys="['ALL']"
:highlight-current="true"
node-key="code"
node-key="status"
:data="statusTree"
:props="{ children: 'children', label: 'remark' }"
:props="{ children: 'children', label: 'statusName' }"
class="status-tree"
@node-click="handleStatusNodeClick"
>
<template #default="{ node, data }">
<div class="tree-node">
<div class="tree-node-label-wrapper">
<span class="tree-node-label">{{ data.remark }}</span>
<span class="tree-node-label">{{ data.statusName }}</span>
<span
v-if="data.code !== 'ALL' && (data.count || data.count === 0)"
v-if="
data.status !== 'ALL' &&
(data.quantity || data.quantity === 0)
"
class="tree-node-count"
>
{{ `(${data.count})` }}
{{ `(${data.quantity})` }}
</span>
</div>
<span
......@@ -420,20 +423,20 @@
</div>
<!-- ====== 操作按钮栏 ====== -->
<div v-if="!isSpecialLayout" class="operation-list">
<span v-if="status === 'PENDING_ACCEPT'" class="item">
<span v-if="status === 'PENDING_RECEIVE'" class="item">
<ElButton type="success" @click="handleConfirmOrder"
>确认接单</ElButton
>
</span>
<span
v-if="status === 'PENDING_ACCEPT' || status === 'SUSPENDED'"
v-if="status === 'PENDING_RECEIVE' || status === 'SUSPEND'"
class="item"
>
<ElButton type="danger" @click="handleCancelOrder">取消订单</ElButton>
</span>
<ElDropdown
v-if="status === 'PENDING_LOGISTICS'"
v-if="status === 'PENDING_CREATE_LOGISTICS'"
trigger="click"
@command="handleLogisticsCommand"
>
......@@ -460,12 +463,12 @@
</template>
</ElDropdown>
<span v-if="status === 'PENDING_LOGISTICS'" class="item">
<span v-if="status === 'PENDING_CREATE_LOGISTICS'" class="item">
<ElButton type="success" @click="handleUpdateCustomsInfo"
>更新报关信息</ElButton
>
</span>
<span v-if="status === 'PENDING_ACCEPT'" class="item">
<span v-if="status === 'PENDING_RECEIVE'" class="item">
<ElButton type="warning" @click="handleTransferOldFlow"
>转旧流程</ElButton
>
......@@ -478,7 +481,7 @@
v-if="
status === 'PENDING_PICK' ||
status === 'PENDING_REPLENISH' ||
status === 'PRODUCING'
status === 'IN_PRODUCTION'
"
trigger="click"
@command="handleDtfCommand"
......@@ -501,7 +504,7 @@
v-if="
status === 'PENDING_PICK' ||
status === 'PENDING_REPLENISH' ||
status === 'PRODUCING'
status === 'IN_PRODUCTION'
"
class="item"
>
......@@ -532,37 +535,37 @@
>补胚失败</ElButton
>
</span>
<span v-if="status === 'PENDING_DISTRIBUTE'" class="item">
<span v-if="status === 'PENDING_PACKING'" class="item">
<ElButton type="success" @click="handleSeedingWall"
>播种墙配货</ElButton
>
</span>
<span v-if="status === 'PENDING_DISTRIBUTE'" class="item">
<span v-if="status === 'PENDING_PACKING'" class="item">
<ElButton type="primary" @click="handleSinglePrint"
>单件打单</ElButton
>
</span>
<span
v-if="status === 'PRODUCING' || status === 'PENDING_DISTRIBUTE'"
v-if="status === 'IN_PRODUCTION' || status === 'PENDING_PACKING'"
class="item"
>
<ElButton type="warning" @click="handleApplyReplenish"
>申请补胚</ElButton
>
</span>
<span v-if="status === 'PRODUCING'" class="item">
<span v-if="status === 'IN_PRODUCTION'" class="item">
<ElButton type="success" @click="handleQuickProduction"
>快捷生产</ElButton
>
</span>
<span v-if="status === 'PRODUCING'" class="item">
<span v-if="status === 'IN_PRODUCTION'" class="item">
<ElButton type="success" @click="handleProductionComplete"
>生产完成</ElButton
>
</span>
<!-- 待发货 -->
<template v-if="status === 'PENDING_SHIP'">
<template v-if="status === 'PENDING_DELIVERY'">
<span class="item">
<ElButton type="primary" @click="handleWeightSort"
>称重分拣</ElButton
......@@ -588,7 +591,7 @@
</span>
</template>
<!-- 挂起 -->
<template v-if="status === 'SUSPENDED'">
<template v-if="status === 'SUSPEND'">
<span class="item">
<ElButton type="warning" @click="handleCancelSuspend"
>取消挂起</ElButton
......@@ -603,10 +606,10 @@
<span
v-if="
[
'PENDING_LOGISTICS',
'PENDING_CREATE_LOGISTICS',
'PENDING_SCHEDULE',
'PENDING_SHIP',
'DISTRIBUTING',
'PENDING_DELIVERY',
'PICKING',
].includes(status)
"
class="item"
......@@ -617,9 +620,9 @@
v-if="
status === 'PENDING_SCHEDULE' ||
status === 'PENDING_REPLENISH' ||
status === 'PRODUCING' ||
status === 'PENDING_SHIP' ||
status === 'SUSPENDED' ||
status === 'IN_PRODUCTION' ||
status === 'PENDING_DELIVERY' ||
status === 'SUSPEND' ||
status === 'PENDING_PICK'
"
class="item"
......@@ -631,13 +634,13 @@
<span
v-if="
[
'PENDING_ACCEPT',
'PENDING_LOGISTICS',
'PENDING_RECEIVE',
'PENDING_CREATE_LOGISTICS',
'PENDING_SCHEDULE',
'PENDING_PICK',
'PENDING_REPLENISH',
'PRODUCING',
'PENDING_DISTRIBUTE',
'IN_PRODUCTION',
'PENDING_PACKING',
].includes(status)
"
class="item"
......@@ -648,7 +651,7 @@
</span>
</div>
<!-- ====== 挂起状态 Tab ====== -->
<div v-if="status === 'SUSPENDED'" class="status-subtabs">
<div v-if="status === 'SUSPEND'" class="status-subtabs">
<div
v-for="tab in suspendedTabs"
:key="tab.value"
......@@ -660,11 +663,11 @@
</div>
</div>
<div v-if="status === 'PENDING_ACCEPT'" class="status-subtabs">
<div v-if="status === 'PENDING_RECEIVE'" class="status-subtabs">
<div
class="status-subtab"
:class="{ active: pendingAcceptSubTab === 'PENDING_ACCEPT' }"
@click="pendingAcceptSubTab = 'PENDING_ACCEPT'"
:class="{ active: pendingAcceptSubTab === 'PENDING_RECEIVE' }"
@click="pendingAcceptSubTab = 'PENDING_RECEIVE'"
>
待接单<span> (0) </span>
</div>
......@@ -683,7 +686,7 @@
<!-- 等待补货 -->
<WaitingRestockTable
v-if="status === 'WAITING_RESTOCK'"
v-if="status === 'AWAITING_RESTOCK'"
ref="waitingRestockRef"
/>
......@@ -822,6 +825,7 @@ import {
getFactoryOrderNewDetailApi,
getFactoryOrderNewListApi,
getFactoryOrderNewLogApi,
getPodOrderStateGroupListApi,
refreshProductInfoApi,
transferOldFlowApi,
cancelSuspendApi,
......@@ -873,10 +877,10 @@ const cardLayoutStatuses = [
'PENDING_SCHEDULE',
'PENDING_PICK',
'PENDING_REPLENISH',
'PRODUCING',
'PENDING_DISTRIBUTE',
'IN_PRODUCTION',
'PENDING_PACKING',
]
const specialLayoutStatuses = ['BATCH_MANAGE', 'WAITING_RESTOCK']
const specialLayoutStatuses = ['BATCH_MANAGE', 'AWAITING_RESTOCK']
const isCardLayout = computed(() => cardLayoutStatuses.includes(status.value))
const isSpecialLayout = computed(() =>
specialLayoutStatuses.includes(status.value),
......@@ -884,41 +888,11 @@ const isSpecialLayout = computed(() =>
const isTableLayout = computed(
() => !isCardLayout.value && !isSpecialLayout.value,
)
const defaultStatusTree: StatusTreeNode[] = [
{
code: 'ALL',
remark: '全部',
count: 0,
children: [
{ code: 'PENDING_ACCEPT', remark: '待接单', count: 0 },
{ code: 'PENDING_LOGISTICS', remark: '待创建物流', count: 0 },
{ code: 'PENDING_SCHEDULE', remark: '待排单', count: 0 },
{ code: 'BATCH_MANAGE', remark: '批次管理', count: 0 },
{ code: 'WAITING_RESTOCK', remark: '等待补货', count: 0 },
{
code: 'DISTRIBUTING',
remark: '配货中',
count: 0,
children: [
{ code: 'PENDING_PICK', remark: '待拣胚', count: 0 },
{ code: 'PENDING_REPLENISH', remark: '待补胚', count: 0 },
{ code: 'PRODUCING', remark: '生产中', count: 0 },
{ code: 'PENDING_DISTRIBUTE', remark: '待配货', count: 0 },
],
},
{ code: 'PENDING_SHIP', remark: '待发货', count: 0 },
{ code: 'COMPLETED', remark: '已完成', count: 0 },
{ code: 'SUSPENDED', remark: '挂起', count: 0 },
{ code: 'CANCELLED', remark: '已取消', count: 0 },
{ code: 'ARCHIVED', remark: '已归档', count: 0 },
],
},
]
const statusTree = ref<StatusTreeNode[]>(defaultStatusTree)
const status = ref<string>('PENDING_ACCEPT')
const pendingAcceptSubTab = ref<'PENDING_ACCEPT' | 'ACCEPT_FAIL_OUT_OF_STOCK'>(
'PENDING_ACCEPT',
const statusTree = ref<StatusTreeNode[]>()
const status = ref<string>('PENDING_RECEIVE')
const pendingAcceptSubTab = ref<'PENDING_RECEIVE' | 'ACCEPT_FAIL_OUT_OF_STOCK'>(
'PENDING_RECEIVE',
)
const suspendedTabs = [
{ label: '客户拦截', value: 'CUSTOMER_INTERCEPT', count: 0 },
......@@ -1273,13 +1247,12 @@ const {
const getStatusCodeForQuery = () => {
if (status.value === 'ALL') return undefined
if (status.value === 'PENDING_ACCEPT') return pendingAcceptSubTab.value
if (status.value === 'SUSPENDED') return `SUSPENDED_${suspendedSubTab.value}`
if (status.value === 'PENDING_RECEIVE') return pendingAcceptSubTab.value
if (status.value === 'SUSPEND') return `SUSPEND_${suspendedSubTab.value}`
return status.value
}
const search = () => {
onCurrentPageChange(1)
refresh()
}
......@@ -1316,19 +1289,19 @@ const ensureSelection = (msg = '请先选择订单'): boolean => {
const refreshCurrentView = () => {
if (isSpecialLayout.value) {
if (status.value === 'BATCH_MANAGE') batchManageRef.value?.refresh()
if (status.value === 'WAITING_RESTOCK') waitingRestockRef.value?.refresh()
if (status.value === 'AWAITING_RESTOCK') waitingRestockRef.value?.refresh()
return
}
refresh()
if (isCardLayout.value) cardLayoutRef.value?.clearSelection()
}
const handleStatusNodeClick = (node: StatusTreeNode) => {
if (status.value === node.code) return
status.value = node.code
if (node.code !== 'PENDING_ACCEPT') {
pendingAcceptSubTab.value = 'PENDING_ACCEPT'
if (status.value === node.status) return
status.value = node.status
if (node.status !== 'PENDING_RECEIVE') {
pendingAcceptSubTab.value = 'PENDING_RECEIVE'
}
if (node.code !== 'SUSPENDED') {
if (node.status !== 'SUSPEND') {
suspendedSubTab.value = 'CUSTOMER_INTERCEPT'
}
selectedRowIds.value = []
......@@ -1345,6 +1318,17 @@ const handleStatusNodeClick = (node: StatusTreeNode) => {
const toggleExpand = (node: { expanded?: boolean }) => {
node.expanded = !node.expanded
}
const loadStatusTreeCounts = async () => {
try {
const res = await getPodOrderStateGroupListApi()
statusTree.value = [
{ status: 'ALL', statusName: '全部', quantity: 0, children: res.data },
]
} catch (e) {
console.error(e)
}
}
const handlePageSizeChange = (size: number) => {
onPageSizeChange(size)
}
......@@ -1486,7 +1470,10 @@ const handleSeedingWall = () => {
}
const { getCLodop } = useLodop()
const printOrder = async (data: OrderData, callback: (status: boolean) => void) => {
const printOrder = async (
data: OrderData,
callback: (status: boolean) => void,
) => {
const lodop = getCLodop(null, null)
if (!lodop) return
lodop.PRINT_INIT('打印内容')
......@@ -1579,7 +1566,8 @@ const downloadPDF = (url: string) => {
}
}
xhr.send(null)
const data = (xhr.response || (xhr as unknown as { responseBody?: unknown }).responseBody) as
const data = (xhr.response ||
(xhr as unknown as { responseBody?: unknown }).responseBody) as
| ArrayBuffer
| string
let dataArray: Uint8Array
......@@ -1590,7 +1578,8 @@ const downloadPDF = (url: string) => {
dataArray = new Uint8Array(text.length)
for (let i = 0; i < dataArray.length; i++) dataArray[i] = text.charCodeAt(i)
}
const digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
const digits =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
let strData = ''
for (let i = 0, ii = dataArray.length; i < ii; i += 3) {
const b1 = dataArray[i] & 0xff
......@@ -1600,7 +1589,11 @@ const downloadPDF = (url: string) => {
const d2 = ((b1 & 3) << 4) | (b2 >> 4)
const d3 = i + 1 < ii ? ((b2 & 0xf) << 2) | (b3 >> 6) : 64
const d4 = i + 2 < ii ? b3 & 0x3f : 64
strData += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4)
strData +=
digits.charAt(d1) +
digits.charAt(d2) +
digits.charAt(d3) +
digits.charAt(d4)
}
return 'data:application/pdf;base64,' + strData
}
......@@ -1788,8 +1781,7 @@ const handleStatusPush = () => {
watch(
() => pendingAcceptSubTab.value,
() => {
if (status.value === 'PENDING_ACCEPT') {
onCurrentPageChange(1)
if (status.value === 'PENDING_RECEIVE') {
refresh()
}
},
......@@ -1797,8 +1789,7 @@ watch(
watch(
() => suspendedSubTab.value,
() => {
if (status.value === 'SUSPENDED') {
onCurrentPageChange(1)
if (status.value === 'SUSPEND') {
refresh()
}
},
......@@ -1815,6 +1806,7 @@ onMounted(() => {
if (treeRef.value) {
treeRef.value.setCurrentKey(status.value, true)
}
loadStatusTreeCounts()
loadCraftList()
getUserMark()
getCustomTagList()
......
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