重构产品价和红线价功能
This commit is contained in:
@@ -113,6 +113,7 @@ const form = reactive({
|
||||
})
|
||||
/** Draft IMPORT Excel attachment id; stamped onto prc_price_set_product on finish */
|
||||
const draftPefId = ref(undefined)
|
||||
const draftPefIds = ref([])
|
||||
const savedPriceBuildMode = ref(undefined)
|
||||
const savedProductsSnapshot = ref([])
|
||||
const buildModeDirty = computed(() =>
|
||||
@@ -314,7 +315,9 @@ function buildPayload(opts = {}) {
|
||||
priceBuildMode: version.priceBuildMode || undefined
|
||||
}
|
||||
}
|
||||
if (draftPefId.value != null) {
|
||||
if (draftPefIds.value.length) {
|
||||
payload.pefIds = draftPefIds.value.slice()
|
||||
} else if (draftPefId.value != null) {
|
||||
payload.pefId = draftPefId.value
|
||||
}
|
||||
if (opts.forceDetails || hasUnsavedDetail) {
|
||||
@@ -376,6 +379,11 @@ function onPsvIdUpdate(psvId) {
|
||||
|
||||
function onPefIdUpdate(pefId) {
|
||||
draftPefId.value = pefId
|
||||
if (pefId == null || pefId === '') return
|
||||
const id = String(pefId)
|
||||
if (!draftPefIds.value.some(x => String(x) === id)) {
|
||||
draftPefIds.value.push(pefId)
|
||||
}
|
||||
}
|
||||
|
||||
/** Step2 chose PULL / IMPORT: edit live-saves mode; create only local + optional preview pull. */
|
||||
@@ -391,6 +399,7 @@ function onPriceBuildModeUpdate(mode) {
|
||||
form.version.priceBuildMode = mode
|
||||
if (mode !== 'IMPORT') {
|
||||
draftPefId.value = undefined
|
||||
draftPefIds.value = []
|
||||
}
|
||||
form.details.splice(0, form.details.length)
|
||||
if (detailsRef.value && detailsRef.value.clearLocalDraft) {
|
||||
@@ -485,6 +494,7 @@ function applySetData(data, asCopy, asNewVersion) {
|
||||
form.version.status = undefined
|
||||
form.version.priceBuildMode = undefined
|
||||
draftPefId.value = undefined
|
||||
draftPefIds.value = []
|
||||
savedPriceBuildMode.value = undefined
|
||||
form.details = []
|
||||
form.products = []
|
||||
@@ -498,6 +508,7 @@ function applySetData(data, asCopy, asNewVersion) {
|
||||
form.version.status = (resume && resume.status) || '0'
|
||||
form.version.priceBuildMode = undefined
|
||||
draftPefId.value = undefined
|
||||
draftPefIds.value = []
|
||||
savedPriceBuildMode.value = undefined
|
||||
form.details = []
|
||||
form.products = []
|
||||
@@ -509,6 +520,7 @@ function applySetData(data, asCopy, asNewVersion) {
|
||||
form.version.status = current.status
|
||||
form.version.priceBuildMode = current.priceBuildMode || undefined
|
||||
draftPefId.value = undefined
|
||||
draftPefIds.value = []
|
||||
savedPriceBuildMode.value = current.priceBuildMode || undefined
|
||||
form.details = []
|
||||
form.products = (current.products || []).map(p => ({ ...p }))
|
||||
|
||||
Reference in New Issue
Block a user