import { ResponseImpl } from "../../modal/login"
import { getInStockListJSON } from "@/api/storageIn.uts"
import { StockList, StorageItem, StorageListResponse } from "@/modal/storageIn.uts"
const list = ref<StorageItem[]>([])
const getStorageInList = () => {
getInStockListJSON({
PageIndex: pageNum.value,
PageSize: 10,
query: searchLabel.value,
auditorStatus: TabbarList[currentTabId.value - 1]
})
.then((res : ResponseImpl<StorageListResponse>) => {
if (res.success) {
console.log(res, "-----------getInStockListJSON------------");
const json = res.response as UTSJSONObject | null
if (json != null) {
const result : StorageListResponse = {
data: json['data'] as StorageItem[],
dataCount: json['dataCount'] as number
}
if (searchLabel.value.trim().length > 0 && result.data.length == 1) {
// 直接跳转到 详情页面
const item = result.data[0] as StorageItem
uni.navigateTo({
url: "/pages/storageIn/storageIn?id=" + item.id
})
} else {
if (pageNum.value < 1) {
list.value = result.data
} else {
list.value.concat(result.data)
}
}
}
}
})
}