fix(export): sync bidding items order on sort and rename preview
Updates the iddingItems state when the sortable list is reordered to ensure the exported data reflects the visual order. Additionally, renames the xportCsv computed property to csvPreview for better clarity.
This commit is contained in:
@@ -163,7 +163,7 @@
|
||||
<div class="space-y-2">
|
||||
<h2 class="text-2xl font-medium">导出预览</h2>
|
||||
<div class="bg-gray-200 p-6 rounded-md">
|
||||
<pre>{{ exportCsv }}</pre>
|
||||
<pre>{{ csvPreview }}</pre>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<UButton
|
||||
@@ -300,6 +300,9 @@ const biddingItemColumnPinning = ref({
|
||||
|
||||
useSortable(".bidding-item-table-tbody", biddingItemList, {
|
||||
animation: 150,
|
||||
onUpdate: () => {
|
||||
biddingItems.value = [...biddingItemList.value];
|
||||
},
|
||||
});
|
||||
|
||||
const applyStartPriceButtonClicked = () => {
|
||||
@@ -325,7 +328,7 @@ function toUnderscore(name: string) {
|
||||
}
|
||||
|
||||
// Export Preview
|
||||
const exportCsv = computed<string>(() => {
|
||||
const csvPreview = computed<string>(() => {
|
||||
return [
|
||||
...biddingItems.value.map(
|
||||
(biddingItem) =>
|
||||
@@ -337,7 +340,7 @@ const exportCsv = computed<string>(() => {
|
||||
});
|
||||
|
||||
const downloadCsv = () => {
|
||||
const blob = new Blob([exportCsv.value], { type: "text/csv;charset=utf-8;" });
|
||||
const blob = new Blob([csvPreview.value], { type: "text/csv;charset=utf-8;" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
|
||||
Reference in New Issue
Block a user