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">
|
<div class="space-y-2">
|
||||||
<h2 class="text-2xl font-medium">导出预览</h2>
|
<h2 class="text-2xl font-medium">导出预览</h2>
|
||||||
<div class="bg-gray-200 p-6 rounded-md">
|
<div class="bg-gray-200 p-6 rounded-md">
|
||||||
<pre>{{ exportCsv }}</pre>
|
<pre>{{ csvPreview }}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<UButton
|
<UButton
|
||||||
@@ -300,6 +300,9 @@ const biddingItemColumnPinning = ref({
|
|||||||
|
|
||||||
useSortable(".bidding-item-table-tbody", biddingItemList, {
|
useSortable(".bidding-item-table-tbody", biddingItemList, {
|
||||||
animation: 150,
|
animation: 150,
|
||||||
|
onUpdate: () => {
|
||||||
|
biddingItems.value = [...biddingItemList.value];
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const applyStartPriceButtonClicked = () => {
|
const applyStartPriceButtonClicked = () => {
|
||||||
@@ -325,7 +328,7 @@ function toUnderscore(name: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export Preview
|
// Export Preview
|
||||||
const exportCsv = computed<string>(() => {
|
const csvPreview = computed<string>(() => {
|
||||||
return [
|
return [
|
||||||
...biddingItems.value.map(
|
...biddingItems.value.map(
|
||||||
(biddingItem) =>
|
(biddingItem) =>
|
||||||
@@ -337,7 +340,7 @@ const exportCsv = computed<string>(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const downloadCsv = () => {
|
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 url = URL.createObjectURL(blob);
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = url;
|
a.href = url;
|
||||||
|
|||||||
Reference in New Issue
Block a user