Commit d70f0b3f by qinjianhui

feat: 左侧状态数结构替换

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