admin_new P0/P1 全量补齐合并 (5项差距 + CRUD真API + 询价/看板真数据) #3
@ -96,11 +96,34 @@ const inquiryId = computed(() => String(route.params.id || ''))
|
|||||||
async function load() {
|
async function load() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
await new Promise(r => setTimeout(r, 200))
|
const resp: any = await httpGet('/supplier/inquiry/getById', { id: inquiryId.value })
|
||||||
|
if (resp && resp.id) {
|
||||||
|
detail.value = {
|
||||||
|
...FALLBACK,
|
||||||
|
...resp,
|
||||||
|
id: String(resp.id || inquiryId.value),
|
||||||
|
title: resp.title || FALLBACK.title,
|
||||||
|
productName: resp.productName || resp.product || FALLBACK.productName,
|
||||||
|
productBrand: resp.brand || resp.productBrand || FALLBACK.productBrand,
|
||||||
|
specification: resp.specification || resp.spec || FALLBACK.specification,
|
||||||
|
unit: resp.unit || FALLBACK.unit,
|
||||||
|
quantity: resp.purchaseQuantity || resp.quantity || FALLBACK.quantity,
|
||||||
|
shippingAddress: resp.shippingAddress || resp.address || FALLBACK.shippingAddress,
|
||||||
|
deliveryDate: resp.deliveryDate || FALLBACK.deliveryDate,
|
||||||
|
priceValidDate: resp.priceValidDate || FALLBACK.priceValidDate,
|
||||||
|
enterpriseName: resp.inquiryEnterpriseName || resp.enterpriseName || FALLBACK.enterpriseName,
|
||||||
|
fileList: resp.fileList || FALLBACK.fileList,
|
||||||
|
quotationList: resp.quotationList || FALLBACK.quotationList,
|
||||||
|
raw: resp,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
detail.value = { ...FALLBACK, id: inquiryId.value }
|
detail.value = { ...FALLBACK, id: inquiryId.value }
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
detail.value = { ...FALLBACK, id: inquiryId.value }
|
detail.value = { ...FALLBACK, id: inquiryId.value }
|
||||||
} finally { loading.value = false }
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fmtDate(s: any): string {
|
function fmtDate(s: any): string {
|
||||||
|
|||||||
@ -74,12 +74,13 @@ async function load() {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = null
|
error.value = null
|
||||||
try {
|
try {
|
||||||
const data = await httpGet<any>('/sys/openapi/inquiry/list', {
|
const resp = await httpGet<any>('/supplier/inquiry/page', {
|
||||||
page: page.value,
|
page: page.value,
|
||||||
limit: limit.value,
|
limit: limit.value,
|
||||||
...(filters.value.status ? { status: filters.value.status } : {})
|
...(filters.value.status ? { status: filters.value.status } : {})
|
||||||
})
|
})
|
||||||
const arr = Array.isArray(data) ? data : []
|
const arr = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||||
|
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
|
||||||
list.value = arr.map((it: any) => ({
|
list.value = arr.map((it: any) => ({
|
||||||
id: String(it.id ?? ''),
|
id: String(it.id ?? ''),
|
||||||
customer: it.inquiryEnterpriseName || it.customer || it.customerName || '--',
|
customer: it.inquiryEnterpriseName || it.customer || it.customerName || '--',
|
||||||
@ -89,7 +90,6 @@ async function load() {
|
|||||||
time: it.publishDate || it.createDate || it.time,
|
time: it.publishDate || it.createDate || it.time,
|
||||||
raw: it
|
raw: it
|
||||||
}))
|
}))
|
||||||
total.value = arr.length + (page.value - 1) * limit.value
|
|
||||||
// 各状态计数 (基于当前页结果)
|
// 各状态计数 (基于当前页结果)
|
||||||
stats.all = list.value.length
|
stats.all = list.value.length
|
||||||
list.value.forEach(r => { stats[r.status] = (stats[r.status] || 0) + 1 })
|
list.value.forEach(r => { stats[r.status] = (stats[r.status] || 0) + 1 })
|
||||||
|
|||||||
@ -100,13 +100,14 @@ export const useInquiryStore = defineStore('inquiry', () => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = null
|
error.value = null
|
||||||
try {
|
try {
|
||||||
const data = await httpGet<any[]>('/sys/openapi/inquiry/list', {
|
const resp = await httpGet<any>('/supplier/inquiry/page', {
|
||||||
page: page.value,
|
page: page.value,
|
||||||
limit: limit.value,
|
limit: limit.value,
|
||||||
...(statusFilter.value ? { status: statusFilter.value } : {})
|
...(statusFilter.value ? { status: statusFilter.value } : {})
|
||||||
})
|
})
|
||||||
list.value = (Array.isArray(data) ? data : []).map(normalizeInquiry)
|
const arr = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||||
total.value = list.value.length + (page.value - 1) * limit.value // 简化 total(后端不返)
|
list.value = arr.map(normalizeInquiry)
|
||||||
|
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
|
||||||
isLive.value = true
|
isLive.value = true
|
||||||
lastFetchedAt.value = Date.now()
|
lastFetchedAt.value = Date.now()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
@ -123,7 +124,7 @@ export const useInquiryStore = defineStore('inquiry', () => {
|
|||||||
*/
|
*/
|
||||||
async function fetchOne(id: string): Promise<Inquiry | null> {
|
async function fetchOne(id: string): Promise<Inquiry | null> {
|
||||||
try {
|
try {
|
||||||
const data = await httpGet<any>(`/sys/openapi/inquiry/${id}`)
|
const data = await httpGet<any>('/supplier/inquiry/getById', { id })
|
||||||
return data ? normalizeInquiry(data) : null
|
return data ? normalizeInquiry(data) : null
|
||||||
} catch {
|
} catch {
|
||||||
return null
|
return null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user