Commit 840f4b2c by linjinhong

物流分区修改

parent fb3b2796
...@@ -61,7 +61,6 @@ import { ...@@ -61,7 +61,6 @@ import {
updateLogisticsZone, updateLogisticsZone,
deleteLogisticsZone, deleteLogisticsZone,
importLogisticsZone, importLogisticsZone,
exportExcelLogisticsZone,
getlogisticsWayAllList, getlogisticsWayAllList,
} from '@/api/logistics' } from '@/api/logistics'
...@@ -220,7 +219,11 @@ async function getList(data?: { ...@@ -220,7 +219,11 @@ async function getList(data?: {
logisticsIdList?: string[] | string logisticsIdList?: string[] | string
codePrefix?: string codePrefix?: string
}) { }) {
loading.value = true const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await getLogisticsZoneList({ const res = await getLogisticsZoneList({
...data, ...data,
...@@ -301,7 +304,7 @@ async function getList(data?: { ...@@ -301,7 +304,7 @@ async function getList(data?: {
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} finally { } finally {
loading.value = false loading.close()
} }
} }
...@@ -392,13 +395,11 @@ function onBeforeUploadImage(file: File) { ...@@ -392,13 +395,11 @@ function onBeforeUploadImage(file: File) {
*/ */
async function downloadExcel() { async function downloadExcel() {
try { try {
const res = await exportExcelLogisticsZone()
const blob = new Blob([res as unknown as BlobPart])
const filename = '物流分区模版.xlsx'
const link = document.createElement('a') const link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = '/files/logisticsZoning.xlsx'
link.download = filename link.download = '物流分区模版.xlsx'
link.click() link.click()
document.body.removeChild(link)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
...@@ -415,10 +416,11 @@ async function exportExcel(file: { file: File }) { ...@@ -415,10 +416,11 @@ async function exportExcel(file: { file: File }) {
const res = await importLogisticsZone(formData) const res = await importLogisticsZone(formData)
if (res.code === 200) { if (res.code === 200) {
ElMessage.success('导入成功!') ElMessage.success('导入成功!')
getList(searchForm.value)
} }
} catch (error) { } catch (error) {
ElMessage.error('导入失败!') ElMessage.error('导入失败!')
} finally {
getList(searchForm.value)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment