mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +08:00
Merge branch '250213-prod-master_1202-gx' into test20250220
This commit is contained in:
@@ -23,8 +23,14 @@ export const importTeacherCourseRecord = (obj) => http.post('/importTeacherCours
|
||||
export const getAddress = (obj) => http.post('/admin/teacher/getAddress', obj)
|
||||
//讲师费发放情况
|
||||
export const getCharges = (obj) => http.post('/teacher/fee/getCharges', obj)
|
||||
|
||||
//讲师费发放情况
|
||||
export const exportTeacherExpense = (obj) => http.get('/admin/export/exportTeacherExpense', {params: obj})
|
||||
|
||||
|
||||
//上传组件
|
||||
export const teacherUpload = (data) =>
|
||||
http.post("/admin/teacher/teacherUpload", data, {
|
||||
headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") },
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
:zIndex="9"
|
||||
@cancel="qr_exit"
|
||||
>
|
||||
<div class="QR">
|
||||
<div class="QR">
|
||||
<div class="qr_header"></div>
|
||||
<div class="qr_main">
|
||||
<div class="qrm_header">
|
||||
@@ -22,7 +22,11 @@
|
||||
<div class="main">
|
||||
<div class="minatitl">
|
||||
<div class="up1">请下载</div>
|
||||
<div class="up2" @click="downTemplate" style="cursor: pointer">
|
||||
<div
|
||||
class="up2"
|
||||
@click="downTemplate"
|
||||
style="cursor: pointer"
|
||||
>
|
||||
模板
|
||||
</div>
|
||||
<div class="up1">,按要求填写数据并导入</div>
|
||||
@@ -31,18 +35,28 @@
|
||||
<div class="text">上传:</div>
|
||||
<div class="right">
|
||||
<div style="height: 176px; margin-bottom: 20px">
|
||||
<a-upload-dragger v-model:fileList="fileList" :action="importHomeWork" name="uploadFile"
|
||||
:headers="headers"
|
||||
@change="handleChange" :showUploadList="false">
|
||||
<a-upload-dragger
|
||||
v-model:fileList="fileList"
|
||||
:action="importHomeWork"
|
||||
name="uploadFile"
|
||||
:headers="headers"
|
||||
@change="handleChange"
|
||||
:showUploadList="false"
|
||||
>
|
||||
<p class="ant-upload-drag-icon">
|
||||
<inbox-outlined></inbox-outlined>
|
||||
</p>
|
||||
<p class="ant-upload-text">点击或将文件拖拽到此处上传</p>
|
||||
<p class="ant-upload-text">
|
||||
点击或将文件拖拽到此处上传
|
||||
</p>
|
||||
<p class="ant-upload-hint">支持扩展名:.xls/.xlsx</p>
|
||||
</a-upload-dragger>
|
||||
</div>
|
||||
<div class="loadstate">
|
||||
<div class="loadborder" v-if="uploadpercent < 100 && uploadpercent !== -1">
|
||||
<div
|
||||
class="loadborder"
|
||||
v-if="uploadpercent < 100 && uploadpercent !== -1"
|
||||
>
|
||||
<div class="content">
|
||||
<div class="img"></div>
|
||||
<div class="timebox">
|
||||
@@ -52,8 +66,7 @@
|
||||
</div>
|
||||
<a-progress :percent="uploadpercent" />
|
||||
</div>
|
||||
<div class="curloading">
|
||||
</div>
|
||||
<div class="curloading"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="loadborder" v-if="uploadErr">
|
||||
@@ -90,7 +103,11 @@
|
||||
<a-progress :percent="uploadpercent" />
|
||||
</div>
|
||||
<div class="curloading">
|
||||
<div class="cancel" style="margin-left: 20px; cursor: pointer" @click="removeUpload">
|
||||
<div
|
||||
class="cancel"
|
||||
style="margin-left: 20px; cursor: pointer"
|
||||
@click="removeUpload"
|
||||
>
|
||||
删除
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,23 +118,41 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="uploadpercent === 100" class="defeat" style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 500px;
|
||||
height: 40px;" :style="{
|
||||
background: errNum
|
||||
? 'rgba(255, 116, 116, 0.1)'
|
||||
: 'rgba(53, 174, 105, 0.1)',
|
||||
border: errNum ? '1px solid #ff7474' : '1px solid #35AE69',
|
||||
}">
|
||||
<img style="width: 14px; height: 14px; margin-left: 16px" :src="
|
||||
errNum
|
||||
? require('../../assets/images/err.png')
|
||||
: require('../../assets/images/success.png')
|
||||
" />
|
||||
<div style="margin-left: 8px" :style="{ color: errNum ? '#ff7474' : 'rgba(0,0,0,0.65)' }">
|
||||
{{ succNum }}条数据导入成功,{{ errNum }}条数据导入失败
|
||||
<div
|
||||
v-if="uploadpercent === 100"
|
||||
class="defeat"
|
||||
style="
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 500px;
|
||||
height: 40px;
|
||||
"
|
||||
:style="{
|
||||
background: errNum
|
||||
? 'rgba(255, 116, 116, 0.1)'
|
||||
: 'rgba(53, 174, 105, 0.1)',
|
||||
border: errNum
|
||||
? '1px solid #ff7474'
|
||||
: '1px solid #35AE69',
|
||||
}"
|
||||
>
|
||||
<img
|
||||
style="width: 14px; height: 14px; margin-left: 16px"
|
||||
:src="
|
||||
errNum
|
||||
? require('../../assets/images/err.png')
|
||||
: require('../../assets/images/success.png')
|
||||
"
|
||||
/>
|
||||
<div
|
||||
style="margin-left: 8px"
|
||||
:style="{
|
||||
color: errNum ? '#ff7474' : 'rgba(0,0,0,0.65)',
|
||||
}"
|
||||
>
|
||||
{{ succNum }}条数据导入成功,{{
|
||||
errNum
|
||||
}}条数据导入失败
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -137,179 +172,187 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { reactive, toRefs, watch,ref,computed } from "vue";
|
||||
import { reactive, toRefs, watch, ref, computed } from "vue";
|
||||
import { exportTeacherExpense } from "../../api/Teaching";
|
||||
import { message } from "ant-design-vue";
|
||||
import { useStore } from "vuex";
|
||||
import * as api from "../../api/index1";
|
||||
import {getCookieForName} from "@/api/method";
|
||||
export default {
|
||||
name: "importWork",
|
||||
components: {
|
||||
|
||||
import { getCookieForName } from "@/api/method";
|
||||
export default {
|
||||
name: "importWork",
|
||||
components: {},
|
||||
props: {
|
||||
showWork: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
props: {
|
||||
showWork: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
title:{
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
template:{
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
fileType: ["xls", "xlsx"],
|
||||
importHomeWork:
|
||||
process.env.VUE_APP_BASE_API + props.url,
|
||||
uploadpercent: -1,
|
||||
uploadErr: false, //上传失败
|
||||
addLoading: false,
|
||||
fileList: [],
|
||||
succNum: 0, //成功数据数
|
||||
errNum: 0, //失败数据数
|
||||
downloadErrUrl: null, //下载失败数据
|
||||
fileName: "",
|
||||
});
|
||||
const headers = { token: getCookieForName("token") };
|
||||
title: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
template: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
fileType: ["xls", "xlsx"],
|
||||
importHomeWork: process.env.VUE_APP_BASE_API + props.url,
|
||||
uploadpercent: -1,
|
||||
uploadErr: false, //上传失败
|
||||
addLoading: false,
|
||||
fileList: [],
|
||||
succNum: 0, //成功数据数
|
||||
errNum: 0, //失败数据数
|
||||
downloadErrUrl: null, //下载失败数据
|
||||
fileName: "",
|
||||
});
|
||||
const headers = { token: getCookieForName("token") };
|
||||
|
||||
const closeCodeModal = () => {
|
||||
ctx.emit("update:showWork", false);
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
state.uploadErr = false; //上传失败
|
||||
};
|
||||
const closeCodeModal = () => {
|
||||
ctx.emit("update:showWork", false);
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
state.uploadErr = false; //上传失败
|
||||
};
|
||||
|
||||
//上传文件
|
||||
const handleChange = (info) => {
|
||||
if (info) {
|
||||
var FileExt = info.file.name.replace(/.+\./, "");
|
||||
if (["xls", "xlsx"].indexOf(FileExt.toLowerCase()) === -1) {
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
message.destroy();
|
||||
message.error("请按模板格式上传文件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
let isLt1M = info.file.size < 512000000;
|
||||
if (!isLt1M) {
|
||||
//上传文件
|
||||
const handleChange = (info) => {
|
||||
if (info) {
|
||||
var FileExt = info.file.name.replace(/.+\./, "");
|
||||
if (["xls", "xlsx"].indexOf(FileExt.toLowerCase()) === -1) {
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
message.destroy();
|
||||
message.error("文件大小超出500M,请重新上传");
|
||||
message.error("请按模板格式上传文件");
|
||||
return;
|
||||
}
|
||||
|
||||
state.addLoading = true;
|
||||
state.uploadpercent = parseInt(info.file.percent);
|
||||
console.log("我是文件上传的进度---------->", info.file.percent);
|
||||
const status = info.file.status;
|
||||
console.log(info.file,'status')
|
||||
if (status !== "uploading") {
|
||||
// console.log(info.file, info.fileList);
|
||||
}
|
||||
if (status === "done") {
|
||||
state.fileName = info.file.name;
|
||||
if(info.file.response.code == 200){
|
||||
state.succNum = Number(info.file.response.data.success);
|
||||
state.errNum = Number(info.file.response.data.failed);
|
||||
state.downloadErrUrl = info.file.response.data.path;
|
||||
}else{
|
||||
state.uploadErr = true;
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1
|
||||
message.destroy();
|
||||
message.error(info.file.response.msg);
|
||||
}
|
||||
|
||||
// let i = 0;
|
||||
// let timeouts = setTimeout(() => {
|
||||
// // clearInterval(timer)
|
||||
// state.addLoading = false;
|
||||
// message.destroy();
|
||||
// message.error(`文件导入超时`);
|
||||
// }, 30000);
|
||||
// let timer = setInterval(() => {
|
||||
// let uid = info.file.response.data;
|
||||
// api
|
||||
// .getImportStatus(uid)
|
||||
// .then((res) => {
|
||||
// console.log("查询导入状态", res);
|
||||
// if (res.data.code === 200) {
|
||||
// if (res.data.data.status !== "START") {
|
||||
// i++;
|
||||
// if (i === 1) {
|
||||
// message.destroy();
|
||||
// message.success(`${info.file.name}上传成功`);
|
||||
// state.addLoading = false;
|
||||
// props.searchTaskList && props.searchTaskList();
|
||||
// }
|
||||
// state.succNum = res.data.data.successNum;
|
||||
// state.errNum = res.data.data.failedNum;
|
||||
// state.downloadErrUrl = res.data.data.url;
|
||||
// console.log("props.getStudent", props.getStudent);
|
||||
// clearInterval(timer);
|
||||
// clearTimeout(timeouts);
|
||||
// }
|
||||
// } else {
|
||||
// state.addLoading = false;
|
||||
// message.destroy();
|
||||
// clearTimeout(timeouts);
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// state.addLoading = false;
|
||||
// clearInterval(timer);
|
||||
// clearTimeout(timeouts);
|
||||
// console.log("查询导入状态失败", err);
|
||||
// });
|
||||
// }, 500);
|
||||
} else if (status === "error") {
|
||||
state.uploadErr = true;
|
||||
message.error(`${info.file.name}上传失败`);
|
||||
}
|
||||
};
|
||||
//删除
|
||||
const removeUpload = () => {
|
||||
}
|
||||
let isLt1M = info.file.size < 512000000;
|
||||
if (!isLt1M) {
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
state.uploadErr = false; //上传失败
|
||||
state.succNum = 0;
|
||||
state.errNum = 0;
|
||||
state.downloadErrUrl = null;
|
||||
state.addLoading = false;
|
||||
};
|
||||
// 下载失败数据
|
||||
const downloadEeeorData = () => {
|
||||
if (state.downloadErrUrl !== "") {
|
||||
window.open(process.env.VUE_APP_FILE_PATH + state.downloadErrUrl);
|
||||
}
|
||||
};
|
||||
function downTemplate() {
|
||||
// window.open(`${process.env.VUE_APP_BOE_API_URL}/upload/template/${props.template}`);
|
||||
window.open(`${process.env.VUE_APP_BOE_API_URL}/admin/export/exportExpenseTemplate`);
|
||||
message.destroy();
|
||||
message.error("文件大小超出500M,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
closeCodeModal,
|
||||
handleChange,
|
||||
downTemplate,
|
||||
headers,
|
||||
removeUpload,
|
||||
downloadEeeorData,
|
||||
};
|
||||
},
|
||||
}
|
||||
state.addLoading = true;
|
||||
state.uploadpercent = parseInt(info.file.percent);
|
||||
console.log("我是文件上传的进度---------->", info.file.percent);
|
||||
const status = info.file.status;
|
||||
console.log(info.file, "status");
|
||||
if (status !== "uploading") {
|
||||
// console.log(info.file, info.fileList);
|
||||
}
|
||||
if (status === "done") {
|
||||
state.fileName = info.file.name;
|
||||
if (info.file.response.code == 200) {
|
||||
state.succNum = Number(info.file.response.data.success);
|
||||
state.errNum = Number(info.file.response.data.failed);
|
||||
state.downloadErrUrl = info.file.response.data.path;
|
||||
} else {
|
||||
state.uploadErr = true;
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
message.destroy();
|
||||
message.error(info.file.response.msg);
|
||||
}
|
||||
|
||||
// let i = 0;
|
||||
// let timeouts = setTimeout(() => {
|
||||
// // clearInterval(timer)
|
||||
// state.addLoading = false;
|
||||
// message.destroy();
|
||||
// message.error(`文件导入超时`);
|
||||
// }, 30000);
|
||||
// let timer = setInterval(() => {
|
||||
// let uid = info.file.response.data;
|
||||
// api
|
||||
// .getImportStatus(uid)
|
||||
// .then((res) => {
|
||||
// console.log("查询导入状态", res);
|
||||
// if (res.data.code === 200) {
|
||||
// if (res.data.data.status !== "START") {
|
||||
// i++;
|
||||
// if (i === 1) {
|
||||
// message.destroy();
|
||||
// message.success(`${info.file.name}上传成功`);
|
||||
// state.addLoading = false;
|
||||
// props.searchTaskList && props.searchTaskList();
|
||||
// }
|
||||
// state.succNum = res.data.data.successNum;
|
||||
// state.errNum = res.data.data.failedNum;
|
||||
// state.downloadErrUrl = res.data.data.url;
|
||||
// console.log("props.getStudent", props.getStudent);
|
||||
// clearInterval(timer);
|
||||
// clearTimeout(timeouts);
|
||||
// }
|
||||
// } else {
|
||||
// state.addLoading = false;
|
||||
// message.destroy();
|
||||
// clearTimeout(timeouts);
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// state.addLoading = false;
|
||||
// clearInterval(timer);
|
||||
// clearTimeout(timeouts);
|
||||
// console.log("查询导入状态失败", err);
|
||||
// });
|
||||
// }, 500);
|
||||
} else if (status === "error") {
|
||||
state.uploadErr = true;
|
||||
message.error(`${info.file.name}上传失败`);
|
||||
}
|
||||
};
|
||||
//删除
|
||||
const removeUpload = () => {
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
state.uploadErr = false; //上传失败
|
||||
state.succNum = 0;
|
||||
state.errNum = 0;
|
||||
state.downloadErrUrl = null;
|
||||
state.addLoading = false;
|
||||
};
|
||||
// 下载失败数据
|
||||
const downloadEeeorData = () => {
|
||||
if (state.downloadErrUrl !== "") {
|
||||
window.open(process.env.VUE_APP_FILE_PATH + state.downloadErrUrl);
|
||||
}
|
||||
};
|
||||
function downTemplate() {
|
||||
// window.open(`${process.env.VUE_APP_BOE_API_URL}/upload/template/${props.template}`);
|
||||
exportTeacherExpense({})
|
||||
.then((res) => {
|
||||
console.log("exportTeacherExpense res",res)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("downTemplate err", err);
|
||||
});
|
||||
|
||||
window.open(
|
||||
`${process.env.VUE_APP_BOE_API_URL}/admin/export/exportExpenseTemplate`
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
closeCodeModal,
|
||||
handleChange,
|
||||
downTemplate,
|
||||
headers,
|
||||
removeUpload,
|
||||
downloadEeeorData,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -361,12 +404,12 @@ import {getCookieForName} from "@/api/method";
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
.line{
|
||||
.line {
|
||||
height: 1px;
|
||||
margin-top: 16px;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.contents{
|
||||
.contents {
|
||||
display: flex;
|
||||
min-height: 500px;
|
||||
.drawerMain {
|
||||
@@ -652,4 +695,4 @@ import {getCookieForName} from "@/api/method";
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user