|
|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
<template>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-row v-loading.fullscreen.lock="exportLoading">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<div style="padding: 10px 0;display: flex">
|
|
|
|
|
<el-button type="primary" style="margin-left: 0.5%;margin-top: 0px;" @click="addServiceArea">
|
|
|
|
|
@ -35,11 +35,16 @@
|
|
|
|
|
style="margin-left: 0.5%;margin-top: 0px;"
|
|
|
|
|
ref="upload"
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
action="http://localhost:9440/PetrolCafeteriaFee/User/uploadFileImportMMUser"
|
|
|
|
|
:action="action"
|
|
|
|
|
:auto-upload="true"
|
|
|
|
|
:headers="headers">
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<el-button type="success">导入Excel文件</el-button>
|
|
|
|
|
<el-button type="success">
|
|
|
|
|
<el-icon style="vertical-align: middle;">
|
|
|
|
|
<Upload />
|
|
|
|
|
</el-icon>
|
|
|
|
|
<span style="vertical-align: middle;">批量导入Excel数据</span>
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- <el-button class="ml-3" type="success" @click="submitUpload">
|
|
|
|
|
选择导入的Excel文件
|
|
|
|
|
@ -47,6 +52,15 @@
|
|
|
|
|
</el-upload>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-popover placement="top-start" title="注意" :width="500" trigger="hover" content="批量导入Excel数据需要上传指定的模版,点击下载模版">
|
|
|
|
|
<template #reference>
|
|
|
|
|
<el-button @click="downloadTemplateFile" style="margin-left: 60%;" type="warning" round class="m-2"><el-icon>
|
|
|
|
|
<Warning />
|
|
|
|
|
</el-icon></el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-button text type="danger" style="margin-top: 0px;margin-left: auto;color: white;" @click="del">
|
|
|
|
|
<el-icon>
|
|
|
|
|
<delete />
|
|
|
|
|
@ -181,7 +195,7 @@ import { Upload } from '@element-plus/icons-vue';
|
|
|
|
|
import pro from '../../../util/tool.js';
|
|
|
|
|
import { onMounted, reactive, ref, toRefs, warn } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { getMMUserInfo, deleteMMUser, saveMMUserInfo, getMealFiterDataList } from '@/util/api/api.js';
|
|
|
|
|
import { getMMUserInfo, deleteMMUser, saveMMUserInfo, getMealFiterDataList,downloadTemplateMMUserExcel } from '@/util/api/api.js';
|
|
|
|
|
|
|
|
|
|
import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
|
|
|
|
|
|
|
|
|
|
@ -249,6 +263,10 @@ const picUrl = ref(localStorage.getItem('picUrl'));
|
|
|
|
|
const random = ref(Math.random());
|
|
|
|
|
|
|
|
|
|
const headers = ref({ loginId: localStorage.getItem('loginName') })
|
|
|
|
|
//const action = ref("https://zhyw.nmgjtjt.com:9500/PetrolCafeteriaFee/User/uploadFileImportMMUser");
|
|
|
|
|
const action = ref(localStorage.getItem('mmUserExcelUploadUrl'));
|
|
|
|
|
|
|
|
|
|
const exportLoading = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
@ -447,14 +465,13 @@ function del() {
|
|
|
|
|
}
|
|
|
|
|
let msg = "";
|
|
|
|
|
if (serivceAreaList.length == 1) {
|
|
|
|
|
msg = '是否确定删除该数据?';
|
|
|
|
|
msg = '已经录入绑定车辆的用户信息不能被删除,是否确定删除该数据?';
|
|
|
|
|
} else {
|
|
|
|
|
msg = '是否批量删除' + serivceAreaList.length + '条数据?';
|
|
|
|
|
msg = '已经录入绑定车辆的用户信息不能被删除,是否批量删除' + serivceAreaList.length + '条数据?';
|
|
|
|
|
}
|
|
|
|
|
ElMessageBox.confirm(
|
|
|
|
|
msg,
|
|
|
|
|
'提示',
|
|
|
|
|
{
|
|
|
|
|
'提示',{
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
type: 'warning',
|
|
|
|
|
@ -537,6 +554,37 @@ function errorFile(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function downloadTemplateFile(){
|
|
|
|
|
//设置加载状态为true
|
|
|
|
|
exportLoading.value = true;
|
|
|
|
|
downloadTemplateMMUserExcel({ searchForm: JSON.stringify(searchForm) }).then(res => {
|
|
|
|
|
if (res.data != "") {
|
|
|
|
|
//fileName:下载的文件名
|
|
|
|
|
var fileName = decodeURIComponent(res.headers["content-disposition"].split("=")[1])
|
|
|
|
|
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel;charset=utf-8' });
|
|
|
|
|
// 针对ie浏览器
|
|
|
|
|
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
|
|
|
window.navigator.msSaveOrOpenBlob(blob, fileName);
|
|
|
|
|
} else {
|
|
|
|
|
//非ie浏览器
|
|
|
|
|
var downloadElement = document.createElement("a");
|
|
|
|
|
var href = window.URL.createObjectURL(blob); //下载的url
|
|
|
|
|
downloadElement.href = href;
|
|
|
|
|
downloadElement.download = fileName; //下载后文件名
|
|
|
|
|
document.body.appendChild(downloadElement);
|
|
|
|
|
downloadElement.click(); //点击下载
|
|
|
|
|
document.body.removeChild(downloadElement); //下载完成移除元素
|
|
|
|
|
window.URL.revokeObjectURL(href); //释放blob对象
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
reloadTableData();
|
|
|
|
|
//设置加载状态为false
|
|
|
|
|
exportLoading.value = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|