|
@@ -1,7 +1,8 @@
|
|
|
<template>
|
|
|
<div class="tenant">
|
|
|
<byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading"
|
|
|
- :selectConfig="selectConfig" @get-list="getList" @moreSearch="() => queryDialogVisible = true">
|
|
|
+ :selectConfig="selectConfig" :action-list="actionConfig" @get-list="getList"
|
|
|
+ @moreSearch="() => queryDialogVisible = true">
|
|
|
</byTable>
|
|
|
|
|
|
<!--高级搜索-->
|
|
@@ -18,6 +19,25 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <el-dialog title="Excel导入" v-model="openExcelDialog" width="600" v-loading="loading">
|
|
|
+ <div v-loading="excelLoading">
|
|
|
+ <el-button @click="downloadTemplate" type="primary" style="margin-bottom: 10px">Excel模板下载</el-button>
|
|
|
+ <el-upload :action="actionUrl + '/jdRefund/confirmExcelImport'" :headers="headers"
|
|
|
+ :before-upload="useImportExcelStore().updateRequestHeaders"
|
|
|
+ :on-success="handleSuccessOne" :on-progress="handleProgress" :show-file-list="false"
|
|
|
+ :on-error="handleError" accept=".xls, .xlsx">
|
|
|
+ <el-button type="primary">点击导入</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" @click=" openExcelDialog = false" size="large">
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -25,12 +45,19 @@
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import {computed, getCurrentInstance, ref} from "vue";
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
+import useImportExcelStore from "@/store/modules/importExcel";
|
|
|
+
|
|
|
+const actionUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
|
|
|
const {proxy} = getCurrentInstance();
|
|
|
const loading = ref(false);
|
|
|
|
|
|
const queryDialogVisible = ref(false);
|
|
|
|
|
|
+const openExcelDialog = ref(false);
|
|
|
+const excelLoading = ref(false);
|
|
|
+const headers = computed(() => useImportExcelStore().requestHeaders);
|
|
|
+
|
|
|
const sourceList = ref({
|
|
|
data: [],
|
|
|
pagination: {
|
|
@@ -40,6 +67,16 @@ const sourceList = ref({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+const actionConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ text: 'Excel导入',
|
|
|
+ action: () => {
|
|
|
+ openExcelDialog.value = true;
|
|
|
+ },
|
|
|
+ }]
|
|
|
+})
|
|
|
+
|
|
|
const selectConfig = computed(() => {
|
|
|
return [
|
|
|
{
|
|
@@ -269,6 +306,42 @@ const handleQuery = () => {
|
|
|
getList();
|
|
|
};
|
|
|
|
|
|
+const downloadTemplate = () => {
|
|
|
+ fetch("/static/jdRefundConfirm.xlsx")
|
|
|
+ .then((res) => res.blob())
|
|
|
+ .then((res) => {
|
|
|
+ const url = window.URL.createObjectURL(res);
|
|
|
+ let filename = "京东售后退货确认收货导入模板.xlsx";
|
|
|
+ const link = document.createElement("a");
|
|
|
+ link.style.display = "none";
|
|
|
+ link.href = url;
|
|
|
+ link.setAttribute("download", filename);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleSuccessOne = (res) => {
|
|
|
+ if (res.code !== 200) {
|
|
|
+ ElMessage.error(`导入失败:${res.msg}`)
|
|
|
+ } else {
|
|
|
+ ElMessage.success(`导入成功`);
|
|
|
+ openExcelDialog.value = false;
|
|
|
+ getList();
|
|
|
+ }
|
|
|
+ excelLoading.value = false;
|
|
|
+};
|
|
|
+
|
|
|
+const handleProgress = () => {
|
|
|
+ excelLoading.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const handleError = (err) => {
|
|
|
+ ElMessage.error(`导入失败:${err}`)
|
|
|
+ openExcelDialog.value = false;
|
|
|
+ excelLoading.value = false;
|
|
|
+};
|
|
|
+
|
|
|
getList();
|
|
|
|
|
|
</script>
|