Commit a6517e1c by qinjianhui

fix: 主子表调用bug修复

parent bbb0d9e5
......@@ -21,7 +21,7 @@ export function getFactoryOrderNewListApi(
data: SearchForm,
currentPage: number,
pageSize: number,
statusCode?: string,
status?: string,
) {
return axios.post<never, BasePaginationData<FactoryOrderNewListData>>(
'factory/podOrder/list_page',
......@@ -29,7 +29,7 @@ export function getFactoryOrderNewListApi(
...data,
currentPage,
pageSize,
statusCode,
status,
},
)
}
......@@ -85,7 +85,7 @@ export function confirmOrderWithWarehouseApi(
warehouseId: number | string,
) {
return axios.post<never, BaseRespData<void>>(
'factory/orderNew/confirmWithWarehouse',
'factory/podOrder/ordersAccepted',
{ ids, warehouseId },
)
}
......@@ -94,7 +94,7 @@ export function cancelOrderWithReasonApi(
ids: (number | string)[],
reason: string,
) {
return axios.post<never, BaseRespData<void>>('factory/orderNew/cancel', {
return axios.post<never, BaseRespData<void>>('factory/podOrder/cancelOrders', {
ids,
reason,
})
......
......@@ -37,24 +37,51 @@ export interface SearchForm {
export interface FactoryOrderNewListData {
id: number
orderNumber?: string
customerOrderNumber?: string
shopOrderNumber?: string
factoryOrderNumber?: string
factoryNo?: number
factoryCode?: string
factoryCountryCode?: string
warehouseId?: number
warehouseName?: string
namespace?: string
status?: string
statusName?: string
customerTags?: { name: string }[]
logisticsWayCode?: string
logisticsWayName?: string
totalWeight?: number
totalProductNum?: number
logisticsSourceNo?: string
platform?: string
shopNumber?: string
weight?: number
productAmount?: number
totalAmount?: number
productNum?: number
shipmentType?: number
expressSheet?: string
trackingNumber?: string
processNumber?: string
userMark?: string
receiverName?: string
receiverPhone?: string
receiverCode?: string
receiverAddress?: string
receiverCountry?: string
receiverProvince?: string
receiverCity?: string
receiverDistrict?: string
receiverAddress1?: string
receiverAddress2?: string
receiverPostCode?: string
trackStatus?: number
prepaidAmount?: number
pause?: boolean
serviceAmount?: number
mixed?: boolean
tagsId?: string
source?: string
logisticsCompanyName?: string
logisticsCompanyCode?: string
selfOwned?: boolean
createTime?: string
acceptTime?: string
finishTime?: string
updateTime?: string
version?: number
totalCustomsWeight?: number
totalCustomsValue?: number
statusName?: string
thirdOrderNumber?: string
}
export interface ProductListData {
......@@ -159,4 +186,3 @@ export interface PickFailData {
afterOutOccupied?: number
afterOutAvailable?: number
}
......@@ -277,7 +277,7 @@ const columns = [
minWidth: 180,
prop: 'standardDesignImage',
align: 'center',
render: ({ row }: { row: BatchManageData; index: number }) => {
render: ({ row }: { row: BatchManageData }) => {
return (
<div>
<span>
......
......@@ -415,7 +415,9 @@
</ElFormItem>
<ElFormItem>
<ElButton type="primary" @click="refreshCurrentView"> 查询 </ElButton>
<ElButton type="primary" @click="refreshCurrentView">
查询
</ElButton>
<ElButton @click="reset"> 重置 </ElButton>
</ElFormItem>
</ElForm>
......@@ -705,6 +707,7 @@
<div class="table-list flex-1 overflow-hidden">
<TableView
ref="mainTableRef"
highlight-current-row
:paginated-data="tableData"
:columns="mainColumns"
serial-numberable
......@@ -792,14 +795,14 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="tsx">
import {
ArrowDown,
ArrowUp,
CaretTop,
CaretBottom,
} from '@element-plus/icons-vue'
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import {
ElForm,
ElFormItem,
......@@ -807,10 +810,10 @@ import {
ElMessageBox,
ElTree,
} from 'element-plus'
import type { TabsPaneContext } from 'element-plus'
import splitDiv from '@/components/splitDiv/splitDiv.vue'
import TableView from '@/components/TableView.vue'
import usePageList from '@/utils/hooks/usePageList'
import type { CustomColumn } from '@/types/table'
import type {
FactoryOrderNewListData,
LogListData,
......@@ -1059,94 +1062,103 @@ const pickerOptions = {
const activeTab = ref<'product' | 'log'>('product')
const productList = ref<ProductListData[]>([])
const currentRow = ref<FactoryOrderNewListData | null>(null)
const skipCurrentRowWatch = ref(false)
const selectedRowIds = ref<(number | string)[]>([])
const selectedRows = ref<FactoryOrderNewListData[]>([])
const cardSelectedIds = ref<(number | string)[]>([])
const logList = ref<LogListData[]>([])
const mainColumns: CustomColumn<FactoryOrderNewListData>[] = [
{ key: 'orderNumber', prop: 'orderNumber', label: '订单编号', minWidth: 160 },
const mainTableRef = ref()
const mainColumns = [
{
prop: 'factoryOrderNumber',
label: '订单编号',
minWidth: 160,
align: 'center',
},
{
key: 'customerOrderNumber',
prop: 'customerOrderNumber',
prop: 'thirdOrderNumber',
label: '客户单号',
minWidth: 160,
align: 'center',
},
{
key: 'shopOrderNumber',
prop: 'shopOrderNumber',
prop: 'shopNumber',
label: '店铺单号',
minWidth: 160,
},
{ key: 'statusName', prop: 'statusName', label: '订单状态', minWidth: 120 },
{
key: 'customerTags',
prop: 'customerTags',
prop: 'statusName',
label: '订单状态',
minWidth: 120,
align: 'center',
},
{
prop: 'tagsIdList',
label: '客户标签',
minWidth: 160,
},
{
key: 'logisticsWayName',
prop: 'logisticsWayName',
label: '物流方式',
minWidth: 140,
align: 'center',
},
{
key: 'logisticsSourceNo',
prop: 'logisticsSourceNo',
prop: 'trackingNumber',
label: '物流跟踪号',
minWidth: 160,
align: 'center',
},
{ key: 'totalWeight', prop: 'totalWeight', label: '总克重', minWidth: 120 },
{ prop: 'weight', label: '总克重', minWidth: 120, align: 'right' },
{
key: 'totalProductNum',
prop: 'totalProductNum',
prop: 'productNum',
label: '商品总数量',
minWidth: 120,
align: 'right',
},
{ key: 'receiverName', prop: 'receiverName', label: '收货人', minWidth: 120 },
{ prop: 'receiverName', label: '收货人', align: 'center', minWidth: 120 },
{
key: 'receiverPhone',
prop: 'receiverPhone',
label: '收货人电话',
minWidth: 140,
align: 'center',
},
{
key: 'receiverCode',
prop: 'receiverCode',
prop: 'receiverPostCode',
label: '收货人邮编',
minWidth: 140,
align: 'center',
},
{
key: 'receiverAddress',
prop: 'receiverAddress',
label: '收货地址',
minWidth: 220,
showOverflowTooltip: true,
},
{
key: 'createTime',
prop: 'createTime',
label: '创建时间',
minWidth: 180,
sortable: true,
align: 'left',
render: ({ row }: { row: FactoryOrderNewListData }) => {
return (
<div>
<span>{row?.receiverCountry || ''}</span>
<span>{row?.receiverProvince || ''}</span>
<span>{row?.receiverCity || ''}</span>
<span>{row?.receiverDistrict || ''}</span>
</div>
)
},
},
{ prop: 'createTime', label: '创建时间', minWidth: 180, align: 'center' },
{
key: 'acceptTime',
prop: 'acceptTime',
prop: 'startStockingTime',
label: '接单时间',
sortable: true,
minWidth: 180,
align: 'center',
},
{
key: 'finishTime',
prop: 'finishTime',
label: '完成时间',
sortable: true,
minWidth: 180,
},
{
key: 'operation',
prop: 'operation',
label: '操作',
minWidth: 120,
......@@ -1246,14 +1258,28 @@ const {
page,
size,
status.value,
).then((res) => res.data)
).then(async (res) => {
const { records } = res.data
await nextTick(() => {
mainTableRef.value.setCurrentRow(records[0])
currentRow.value = (records as never)[0]
})
return res.data
})
}
return getFactoryOrderNewListApi(
getQueryPayload(),
page,
size,
status.value === 'ALL' ? undefined : status.value,
).then((res) => res.data)
).then(async (res) => {
const { records } = res.data
await nextTick(() => {
mainTableRef.value.setCurrentRow(records[0])
currentRow.value = (records as never)[0]
})
return res.data
})
},
})
......@@ -1314,11 +1340,9 @@ const handleStatusNodeClick = (node: StatusTreeNode) => {
cardSelectedIds.value = []
productList.value = []
logList.value = []
currentRow.value = null
if (!isSpecialLayout.value) {
refreshCurrentView()
if (isTableLayout.value) {
loadSubTables()
}
}
}
const toggleExpand = (node: { expanded?: boolean }) => {
......@@ -1344,7 +1368,7 @@ const handleMainSelectionChange = (rows: FactoryOrderNewListData[]) => {
const handleCardSelectionChange = (items: { id: number | string }[]) => {
cardSelectedIds.value = items.map((i) => i.id)
}
const loadSubTables = async () => {
const loadSubTables = async (tabName?: 'product' | 'log') => {
if (!currentRow.value) {
productList.value = []
logList.value = []
......@@ -1352,8 +1376,9 @@ const loadSubTables = async () => {
}
const id = currentRow.value.id
const isSuspend = status.value === 'SUSPEND'
const effectiveTab = tabName ?? activeTab.value
try {
if (activeTab.value === 'product') {
if (effectiveTab === 'product') {
productList.value = []
const productRes = isSuspend
? await getSuspendDetailApi(id)
......@@ -1371,17 +1396,27 @@ const loadSubTables = async () => {
console.error(e)
}
}
watch(currentRow, (row) => {
if (!row) return
if (!isTableLayout.value) return
if (skipCurrentRowWatch.value) {
skipCurrentRowWatch.value = false
return
}
void loadSubTables()
})
const handleMainRowClick = (row: FactoryOrderNewListData) => {
skipCurrentRowWatch.value = true
currentRow.value = row
productList.value = []
logList.value = []
loadSubTables()
void loadSubTables()
}
const handleSubTabClick = () => {
if (currentRow.value) {
void loadSubTables()
}
const handleSubTabClick = (tab: TabsPaneContext) => {
if (!currentRow.value) return
const name = tab?.props?.name as 'product' | 'log' | undefined
void loadSubTables(name)
}
const handleConfirmOrder = () => {
......
......@@ -57,9 +57,9 @@
</template>
<script setup lang="ts">
import { updateCustomDeclarationInfoApi } from '@/api/podCnOrder'
import { FactoryOrderNewListData } from '@/types/api/factoryOrderNew';
import {
CustomDeclarationInfoForm,
PodCnOrderListData,
} from '@/types/api/podCnOrder'
defineOptions({
......@@ -67,7 +67,7 @@ defineOptions({
})
const props = defineProps<{
modelValue: boolean
orderSelection: PodCnOrderListData[]
orderSelection: FactoryOrderNewListData[]
}>()
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void
......
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