Commit fdc8ea89 by wuqian

ts校验修复

parent 488d5e46
...@@ -286,7 +286,7 @@ const goodsColumns = computed(() => { ...@@ -286,7 +286,7 @@ const goodsColumns = computed(() => {
}, },
] ]
}) })
const tableData = ref<PodUsOrderListData[]>([]) const tableData = ref<PodUsOrderListData[][]>([])
const goodsData = ref<ProductList[]>([]) const goodsData = ref<ProductList[]>([])
const searchVisible = ref(false) const searchVisible = ref(false)
const goodsLoading = ref(false) const goodsLoading = ref(false)
...@@ -393,16 +393,16 @@ const submitExportForm = async () => { ...@@ -393,16 +393,16 @@ const submitExportForm = async () => {
idList: [], idList: [],
} }
// 使用函数封装映射逻辑 // 使用函数封装映射逻辑
const mapIds = (items: PodUsOrderListData[]) => const mapIds = (items: PodUsOrderListData[][] | PodUsOrderListData[]) => {
items // 如果是二维数组,先展平成一维数组
.filter( const flatItems = Array.isArray(items[0])
(el): el is PodUsOrderListData & { id: string | number } => ? (items as PodUsOrderListData[][]).flat()
el.id !== undefined && el.id !== null, : (items as PodUsOrderListData[])
) return flatItems.map((el) => Number(el.id))
.map((el) => Number(el.id)) }
switch (resourceType) { switch (resourceType) {
case 0: case 0:
params.idList = mapIds(tableData.value as PodUsOrderListData[]) params.idList = mapIds(tableData.value.flat())
break break
case 1: case 1:
params.idList = mapIds(selection.value) params.idList = mapIds(selection.value)
......
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