Commit a6517e1c by qinjianhui

fix: 主子表调用bug修复

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