新增按版本获取价格设置明细的接口,优化产品下拉选项查询,更新相关服务和前端调用逻辑。
This commit is contained in:
@@ -227,7 +227,7 @@ import {
|
||||
surchargeAppliesToRow,
|
||||
toDetailPayload
|
||||
} from '../../utils/priceSet'
|
||||
import { getPriceSet, listSetDetailByProduct, importSetDetailPricesAsync, pullSetDetailsFromLibraryAsync, previewPullFromLibrary, previewImportDetailPrices, updateSetDetail, updateSetDetailSurchargeAsync, delSetDetail } from '@/api/price/set'
|
||||
import { getPriceSet, listSetDetailByProduct, listSetDetailByVersion, importSetDetailPricesAsync, pullSetDetailsFromLibraryAsync, previewPullFromLibrary, previewImportDetailPrices, updateSetDetail, updateSetDetailSurchargeAsync, delSetDetail } from '@/api/price/set'
|
||||
import { listRegionOptions } from '@/api/data/region'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -437,12 +437,8 @@ async function loadLatestPriorVersionDraft() {
|
||||
return row
|
||||
})
|
||||
if (!products.length) return false
|
||||
const chunks = await Promise.all(products.map(p =>
|
||||
listSetDetailByProduct(prior.psvId, p.productCode)
|
||||
.then(r => r.data || [])
|
||||
.catch(() => [])
|
||||
))
|
||||
applyLocalDraft(products, chunks.flat())
|
||||
const detailRes = await listSetDetailByVersion(prior.psvId)
|
||||
applyLocalDraft(products, detailRes.data || [])
|
||||
return true
|
||||
} finally {
|
||||
pulling.value = false
|
||||
|
||||
@@ -123,9 +123,21 @@ function toEffMs(v) {
|
||||
return Number.isNaN(t) ? NaN : t
|
||||
}
|
||||
|
||||
/** Sort by effective time descending; drafts without time last. */
|
||||
function sortByEffectiveTime(list) {
|
||||
/** draft / pending first, then effect, then expired; within group by effective time desc. */
|
||||
function statusRank(v) {
|
||||
const s = String(v && v.status != null ? v.status : '')
|
||||
if (s === '0') return 0
|
||||
if (s === '3') return 1
|
||||
if (s === '1') return 2
|
||||
if (s === '2') return 3
|
||||
return 9
|
||||
}
|
||||
|
||||
function sortVersions(list) {
|
||||
return (list || []).slice().sort((a, b) => {
|
||||
const ra = statusRank(a)
|
||||
const rb = statusRank(b)
|
||||
if (ra !== rb) return ra - rb
|
||||
const ta = toEffMs(a)
|
||||
const tb = toEffMs(b)
|
||||
const aNull = Number.isNaN(ta)
|
||||
@@ -143,7 +155,7 @@ const filteredVersions = computed(() => {
|
||||
const filtered = statusTab.value === 'all'
|
||||
? list
|
||||
: list.filter(v => String(v.status) === statusTab.value)
|
||||
return sortByEffectiveTime(filtered)
|
||||
return sortVersions(filtered)
|
||||
})
|
||||
|
||||
function detailCount(row) {
|
||||
|
||||
Reference in New Issue
Block a user