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