work on moving customers from tahesab 7
This commit is contained in:
@@ -384,17 +384,21 @@ async function load(panelPage = 1) {
|
||||
search: panelSearch.value || undefined,
|
||||
page: panelPage,
|
||||
})
|
||||
status.value = res
|
||||
// این درخواست دادههای تهحساب را شامل نمیشود؛ پس فیلدهای تهحساب را دستنخورده نگه میداریم
|
||||
if (status.value) {
|
||||
status.value.panel_total = res.panel_total
|
||||
status.value.panel_registered = res.panel_registered
|
||||
status.value.panel_only = res.panel_only
|
||||
status.value.panel_only_list = res.panel_only_list
|
||||
} else {
|
||||
status.value = res
|
||||
}
|
||||
panelList.value = res.panel_only_list.data
|
||||
panelPagination.value = {
|
||||
page: res.panel_only_list.current_page,
|
||||
lastPage: res.panel_only_list.last_page,
|
||||
total: res.panel_only_list.total,
|
||||
}
|
||||
// دادههای تهحساب فقط اگر قبلاً fetch شده باشه بروز کن
|
||||
if (tahesabFetched.value) {
|
||||
tahesabOnlyList.value = res.tahesab_only_list.data ?? []
|
||||
}
|
||||
} catch (e) { console.error(e) }
|
||||
finally { loadingPanel.value = false }
|
||||
}
|
||||
@@ -500,9 +504,12 @@ async function doImport(customers: TahesabOnlyCustomer[]) {
|
||||
if (res.success) {
|
||||
message.success(`${res.success} مشتری وارد پنل شد`)
|
||||
customers.forEach(c => { if (!res.errors.find((e: any) => e.code === c.code)) tahesabDone.add(c.code) })
|
||||
if (status.value?.tahesab_only_count != null) {
|
||||
status.value.tahesab_only_count = Math.max(0, status.value.tahesab_only_count - res.success)
|
||||
}
|
||||
}
|
||||
if (res.failed) message.warning(`${res.failed} مشتری وارد نشد`)
|
||||
await load(panelPagination.value.page)
|
||||
await loadPanel(panelPagination.value.page)
|
||||
selectedTahesab.clear()
|
||||
} catch { message.error('خطا در ارتباط با سرور') }
|
||||
finally { syncingTahesab.value = false }
|
||||
@@ -531,7 +538,10 @@ watch(() => importStore.doneCodes.length, () => {
|
||||
watch(() => importStore.status, async (s, prev) => {
|
||||
if (prev === 'running' && (s === 'done' || s === 'canceled')) {
|
||||
selectedTahesab.clear()
|
||||
await load(panelPagination.value.page)
|
||||
if (status.value?.tahesab_only_count != null) {
|
||||
status.value.tahesab_only_count = Math.max(0, status.value.tahesab_only_count - importStore.success)
|
||||
}
|
||||
await loadPanel(panelPagination.value.page)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user