|
|
@@ -11,6 +11,7 @@
|
|
|
<template #default="{ row }">
|
|
|
<ElButton type="primary" size="small" @click="detail(row)">详情</ElButton>
|
|
|
<ElButton type="danger" size="small" @click="del(row)">删除</ElButton>
|
|
|
+ <ElButton @click="download(row)" v-if="shouldShow">下载</ElButton>
|
|
|
</template>
|
|
|
</ElTableColumn>
|
|
|
</PagingTable>
|
|
|
@@ -61,7 +62,7 @@ import EditDialog from '@/components/EditDialog.vue'
|
|
|
import { setupEditDialog } from '@/utils/editDialog'
|
|
|
import EnumSelect from '@/components/EnumSelect.vue'
|
|
|
import { UserRole } from '@/enums'
|
|
|
-import { http } from '@/plugins/http'
|
|
|
+import { axiosInstance, http } from '@/plugins/http'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import { useClipboard } from '@vueuse/core'
|
|
|
import { useUserStore } from '@/stores/user'
|
|
|
@@ -143,4 +144,16 @@ function importList() {
|
|
|
}
|
|
|
input.click()
|
|
|
}
|
|
|
+function download(row) {
|
|
|
+ axiosInstance.get(`/phone-list/${row.id}/download`, { responseType: 'blob' }).then((res) => {
|
|
|
+ const url = window.URL.createObjectURL(new Blob([res.data]))
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.style.display = 'none'
|
|
|
+ link.href = url
|
|
|
+ link.setAttribute('download', `${row.number}.txt`)
|
|
|
+ document.body.appendChild(link)
|
|
|
+ link.click()
|
|
|
+ document.body.removeChild(link)
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|