ui: 下载商品数据前确认同步范围
This commit is contained in:
@@ -521,8 +521,25 @@ async function run(action, fn) {
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadProductData() {
|
||||
function confirmDownloadProductData() {
|
||||
if (taskRunning.value || running.value) return
|
||||
const shopID = String(query.value.platformShopId || '').trim()
|
||||
const shopName = shopOptions.value.find((shop) => String(shop.value) === shopID)?.label || shopID
|
||||
dialog.warning({
|
||||
title: '确认下载商品数据',
|
||||
content: shopID
|
||||
? `将从 erpgo 下载店铺「${shopName}」的商品数据并更新本地记录,可能需要几分钟。`
|
||||
: '未选择店铺,将从 erpgo 逐店铺下载所有店铺的商品数据并更新本地记录,可能需要几分钟。',
|
||||
positiveText: '开始下载',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: () => {
|
||||
if (taskRunning.value || running.value) return
|
||||
void downloadProductData(shopID)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async function downloadProductData(shopID) {
|
||||
// 商品多的店铺要拉几十页,耗时十几秒到几分钟。
|
||||
// 必须先给出可见反馈,否则按钮看起来像坏了。
|
||||
running.value = '下载数据'
|
||||
@@ -893,7 +910,7 @@ onUnmounted(() => {
|
||||
type="primary"
|
||||
:loading="running === '下载数据'"
|
||||
:disabled="taskRunning || running !== ''"
|
||||
@click="downloadProductData"
|
||||
@click="confirmDownloadProductData"
|
||||
>
|
||||
下载数据
|
||||
</n-button>
|
||||
|
||||
Reference in New Issue
Block a user