fix(admin): advance sailing copy selection
This commit is contained in:
@@ -306,7 +306,16 @@ async function copySelected() {
|
||||
const offsetMs = new Date(record.etdAt).getTime() - new Date(record.cutoffAt).getTime()
|
||||
const copiedCutoff = new Date(new Date(etdAt).getTime() - offsetMs)
|
||||
const cutoffAt = `${formatDate(copiedCutoff)}T${String(copiedCutoff.getHours()).padStart(2, '0')}:${String(copiedCutoff.getMinutes()).padStart(2, '0')}:${String(copiedCutoff.getSeconds()).padStart(2, '0')}`
|
||||
try { await copySailing(record.id, { etdAt, cutoffAt }); ElMessage.success('已复制为下一班'); await load() } catch (cause) { ElMessage.error(getApiErrorDetails(cause, '复制船期失败').message) }
|
||||
try {
|
||||
const result = await copySailing(record.id, { etdAt, cutoffAt })
|
||||
const copied = result.sailing
|
||||
const targetMonth = copied.etdAt.slice(0, 7)
|
||||
month.value = targetMonth
|
||||
selectedDate.value = copied.etdAt.slice(0, 10)
|
||||
selectedSailing.value = copied
|
||||
if (targetMonth === data.value?.month) await load()
|
||||
ElMessage.success(`已定位到下一班:${copied.etdAt.slice(0, 16).replace('T', ' ')}`)
|
||||
} catch (cause) { ElMessage.error(getApiErrorDetails(cause, '复制船期失败').message) }
|
||||
}
|
||||
async function openVolumeDetail() {
|
||||
if (!selectedSailing.value) return
|
||||
|
||||
Reference in New Issue
Block a user