Commit 7b15e487 by qinjianhui

Merge branch 'dev' into 'master'

Dev

See merge request !196
parents 980ed3a4 bfcc7948
......@@ -6,6 +6,8 @@ export interface StatusTreeNode {
}
export interface SearchForm {
status?: string
pauseReason?: number
platform?: string
craftCode?: string | string[]
thirdSkuCode?: string
......
......@@ -6,6 +6,8 @@ export interface StatusTreeNode {
}
export interface SearchForm {
status?: string
pauseReason?: number
platform?: string
craftCode?: string | string[]
thirdSkuCode?: string
......
......@@ -16,6 +16,8 @@ import type {
interface UseOrderListAndDetailOptions {
status: Ref<string>
// 查询的状态树,与左侧状态树参数不同,用于挂起状态下suspendReason参数的修改
treeStatus: Ref<string>
isCardLayout: Ref<boolean>
isTableLayout: Ref<boolean>
getQueryPayload: () => Record<string, unknown>
......@@ -26,6 +28,7 @@ interface UseOrderListAndDetailOptions {
export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
const {
status,
treeStatus,
isCardLayout,
isTableLayout,
getQueryPayload,
......@@ -69,14 +72,14 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
refresh: refreshTableList,
} = usePageList<FactoryOrderNewListData>({
query: (page, size) => {
const isSuspend = status.value === 'SUSPEND'
const isSuspendTree = treeStatus.value === 'SUSPEND'
return getFactoryOrderNewListApi(
buildListQueryBody(),
page,
size,
status.value === 'ALL' ? undefined : status.value,
getListPageAcceptedSubStatus(),
isSuspend ? suspendedSubTab.value : undefined,
isSuspendTree ? suspendedSubTab.value : undefined,
).then(async (res) => {
const records = res.data.records || []
await nextTick(() => {
......@@ -133,7 +136,8 @@ export function useOrderListAndDetail(options: UseOrderListAndDetailOptions) {
) {
return
}
const sortProp = LIST_SORT_PROP_BY_COLUMN[prop as keyof typeof LIST_SORT_PROP_BY_COLUMN]
const sortProp =
LIST_SORT_PROP_BY_COLUMN[prop as keyof typeof LIST_SORT_PROP_BY_COLUMN]
if (order === 'ascending') {
listSortProp.value = sortProp
listSortOrder.value = 'asc'
......
......@@ -49,6 +49,25 @@
:inline="true"
label-width="70px"
>
<ElFormItem v-if="status === 'ALL'" label="订单状态">
<ElTreeSelect
v-model="searchFormStatusSelect"
:data="statusTreeChildren"
:props="{
value: 'status',
label: 'statusName',
children: 'children',
}"
node-key="status"
placeholder="请选择"
collapse-tags
multiple
clearable
filterable
check-strictly
style="width: 180px"
/>
</ElFormItem>
<ElFormItem label="平台">
<ElSelect
v-model="searchForm.platform"
......@@ -673,8 +692,8 @@
<div v-if="isCardLayout" :key="status" class="card-content">
<CardLayout
ref="cardLayoutRef"
:status="status"
:query-payload="getQueryPayload()"
:status="listQueryStatus"
:query-payload="getListQueryPayload()"
@selection-change="handleCardSelectionChange"
@view-detail="handleViewDetail"
/>
......@@ -1093,11 +1112,54 @@ const {
onClearTableState: () => {},
onRefreshCurrentView: () => {},
})
// 查询状态树
const statusTreeChildren = computed(() => {
const tree = JSON.parse(JSON.stringify(statusTree.value?.[0]?.children))
if (!tree) return []
tree.forEach((item: any) => {
if (item.status === 'PICKING') item.children = []
})
return tree.filter(
(item: any) =>
item.status !== 'AWAITING_RESTOCK' && item.status !== 'BATCH_MANAGE',
)
})
const searchFormStatusSelect = computed({
get() {
const val = searchForm.value.status
if (!val) return []
return String(val).split(',').filter(Boolean)
},
set(val: string | string[] | undefined) {
const arr = Array.isArray(val) ? val : val ? [val] : []
searchForm.value.status = arr.length ? arr.join(',') : undefined
},
})
getFactoryOrderSearchVisibilityContext = () => ({
status: status.value,
status: searchForm.value.status ?? status.value,
isCardLayout: isCardLayout.value,
})
// 全部状态下列表/导出请求status参数
const listQueryStatus = computed(() => {
if (status.value === 'ALL' && searchForm.value.status) {
return searchForm.value.status
}
return status.value
})
const getListQueryPayload = () => {
const payload = { ...getQueryPayload() }
if (status.value === 'ALL' && searchForm.value.status) {
payload.status = searchForm.value.status
} else {
delete payload.status
}
return payload
}
const {
subLoading,
activeTab,
......@@ -1123,10 +1185,11 @@ const {
handleTabClick,
handleMainTableSortChange,
} = useOrderListAndDetail({
status,
status: listQueryStatus,
treeStatus: status,
isCardLayout,
isTableLayout,
getQueryPayload,
getQueryPayload: getListQueryPayload,
getListPageAcceptedSubStatus,
suspendedSubTab,
})
......@@ -1171,7 +1234,7 @@ const submitExportForm = async () => {
try {
await exportFactoryOrderInfo({
...params,
...(resourceType === 2 ? getQueryPayload() : {}),
...(resourceType === 2 ? getListQueryPayload() : {}),
} as ExportParams)
ElMessage.success('请求成功,请稍后到右上角[我的下载]中查看')
exportVisible.value = false
......
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