Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
0bfae6cc
Commit
0bfae6cc
authored
Jun 29, 2026
by
wusiyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 工厂订单new添加默认时间排序功能 #1009800
parent
237d010d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
6 deletions
+62
-6
src/views/order/factoryOrderNew/hooks/useOrderListAndDetail.ts
+52
-5
src/views/order/factoryOrderNew/index.vue
+10
-1
No files found.
src/views/order/factoryOrderNew/hooks/useOrderListAndDetail.ts
View file @
0bfae6cc
...
...
@@ -15,6 +15,43 @@ 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_PICK'
,
'PENDING_REPLENISH'
,
'IN_PRODUCTION'
,
'PENDING_PACKING'
,
'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 +90,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 +159,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 +173,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 +200,7 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
listSortProp
.
value
=
sortProp
listSortOrder
.
value
=
'desc'
}
else
{
listSortProp
.
value
=
null
listSortOrder
.
value
=
null
applyDefaultListSort
()
}
refreshTableList
()
}
...
...
src/views/order/factoryOrderNew/index.vue
View file @
0bfae6cc
...
...
@@ -1313,7 +1313,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 +1457,12 @@ const getListQueryPayload = () => {
}
else
{
delete
payload
.
status
}
// 添加默认时间排序参数
const
defaultSort
=
getDefaultCreateTimeSortParams
(
status
.
value
)
if
(
defaultSort
)
{
payload
.
prop
=
defaultSort
.
prop
payload
.
order
=
defaultSort
.
order
}
return
payload
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment