提交专业力必修

This commit is contained in:
Pengxiansen
2025-01-23 14:51:49 +08:00
parent d0176acb45
commit 990380ac1a
23 changed files with 2226 additions and 2238 deletions

View File

@@ -18,10 +18,7 @@
<div class="main">
<div class="minatitl">
<div class="up1">请下载</div>
<span
class="up2"
style="cursor: pointer"
@click="downloadTemplate"
<span class="up2" style="cursor: pointer" @click="downloadTemplate"
>模板</span
>
<div class="up1">按要求填写数据并导入</div>
@@ -38,7 +35,7 @@
:multiple="false"
@change="handleChange"
:data="{
growId: Number(courseId),
growthId: Number(courseId),
type: courseType,
}"
:showUploadList="false"
@@ -101,7 +98,11 @@
下载失败数据
</div>
</div>
<div v-if="notMatchUrl != ''" :style="{left:downloadErrUrl !== ''?'181px':'46px'}" class="defeat2">
<div
v-if="notMatchUrl != ''"
:style="{ left: downloadErrUrl !== '' ? '181px' : '46px' }"
class="defeat2"
>
<div class="detext" @click="notDown">下载不匹配的学员</div>
</div>
</div>
@@ -117,17 +118,23 @@
}}条数据解析失败
</div>
</div>
<div v-if="showBottomBar&&notMatchUrl != ''" class="group_data">
<div v-if="showBottomBar && notMatchUrl != ''" class="group_data">
<div class="icon">
<RightCircleFilled style="color: #4ea6ff;fontSize:18px;" />
<RightCircleFilled style="color: #4ea6ff; fontsize: 18px" />
</div>
<div class="text">
待导入学员的岗位与本专业力必修的要求不匹配是否导入
</div>
<div class="text">待导入学员的岗位与本专业力必修的要求不匹配是否导入</div>
<div class="right">
<!-- <a-radio-group size="small" v-model:value="groupValue" button-style="solid">
<a-radio-button style="margin-right:20px;width: 50px;text-align: center;" value="1"></a-radio-button>
<a-radio-button style="width: 50px;text-align: center;" value="0"></a-radio-button>
</a-radio-group> -->
<a-switch v-model:checked="groupValue" checkedChildren="是" unCheckedChildren="否" />
<a-switch
v-model:checked="groupValue"
checkedChildren="是"
unCheckedChildren="否"
/>
</div>
</div>
<!-- <div class="loadborder">
@@ -197,10 +204,14 @@
<script>
import { computed, reactive, toRefs } from "vue";
import { message } from "ant-design-vue";
import { getImportStatus,saveStudent } from "@/api/growthpath"
import {
getImportStatus,
saveStudent,
downLoadImpTemplate,
} from "@/api/growthpath";
import { useStore } from "vuex";
import {getCookieForName} from "@/api/method";
import { RightCircleFilled } from '@ant-design/icons-vue';
import { getCookieForName } from "@/api/method";
import { RightCircleFilled } from "@ant-design/icons-vue";
export default {
name: "ImportStu",
props: {
@@ -218,16 +229,16 @@ export default {
},
},
components: {
RightCircleFilled
RightCircleFilled,
},
setup(props, ctx) {
const store = useStore();
const state = reactive({
redisKey: '',
redisKey: "",
locationHref: process.env.VUE_APP_BASE_API,
template: process.env.VUE_APP_UP_LOAD_STUDENT_TEMPLATE,
importStudent:
process.env.VUE_APP_BASE_API + "/admin/grow/importGrowStudentToCache",
process.env.VUE_APP_BASE_API + "/professional/allocation/importLearner",
timers: "", // 定时器,用于清空定时器使用
isAddStudent: false, // 用于判断用户是否关闭弹框需要重新获取学员列表
uploadpercent: -1,
@@ -237,7 +248,7 @@ export default {
succNum: 0, //成功数据数
errNum: 0, //失败数据数
downloadErrUrl: "",
notMatchUrl: '',
notMatchUrl: "",
showBottomBar: false, // 显示底部成功条数和失败条数
fileName: "",
groupValue: true,
@@ -253,36 +264,59 @@ export default {
state.uploadErr = false; //上传失败
state.showBottomBar = false;
state.downloadErrUrl = "";
state.notMatchUrl = '';
if(state.redisKey&&state.succNum!=0&&item){
state.notMatchUrl = "";
if (state.redisKey && state.succNum != 0 && item) {
saveStudent({
redisKey: state.redisKey,
growId: props.courseId,
isImportNotMatchStudent: state.groupValue ? 1 : 0
}).then(res=>{
console.log(res,'res')
// 通知父组件重新获取学员列表
message.success("导入成功");
ctx.emit("update:AddImpStuvisible", false);
ctx.emit("AddImpStuvisibleClose", true);
}).catch(err=>{
message.error("导入失败");
ctx.emit("update:AddImpStuvisible", false);
ctx.emit("AddImpStuvisibleClose", false);
isImportNotMatchStudent: state.groupValue ? 1 : 0,
})
}else{
.then((res) => {
console.log(res, "res");
// 通知父组件重新获取学员列表
message.success("导入成功");
ctx.emit("update:AddImpStuvisible", false);
ctx.emit("AddImpStuvisibleClose", true);
})
.catch((err) => {
message.error("导入失败");
ctx.emit("update:AddImpStuvisible", false);
ctx.emit("AddImpStuvisibleClose", false);
});
} else {
ctx.emit("update:AddImpStuvisible", false);
ctx.emit("AddImpStuvisibleClose", false);
}
state.redisKey = ''
state.redisKey = "";
state.succNum = 0;
state.errNum = 0;
state.isAddStudent = false;
};
const downloadTemplate = () => {
console.log(`${process.env.VUE_APP_BOE_API_URL}/upload/files/2024/6/专业力必修-导入学员模版.xlsx`,'xiazai')
window.open(`${process.env.VUE_APP_BOE_API_URL}/upload/files/2024/7/专业力必修-录入学员模版.xlsx`);
}
downLoadImpTemplate().catch((err) => {
let blob = new Blob([err.data], {
type: "application/vnd.ms-excel",
});
console.log(blob);
let url = window.URL.createObjectURL(blob);
// 创建a标签并为其添加属性
const link = document.createElement("a");
link.href = url;
link.download = "专业力必修-录入学员模版.xlsx";
// 触发点击事件执行下载
document.body.appendChild(link);
link.click();
// 下载完成就删掉a标签
document.body.removeChild(link);
//释放blob对象
window.URL.revokeObjectURL(url);
});
// window.open(
// `${process.env.VUE_APP_BOE_API_URL}/upload/files/2024/7/专业力必修-录入学员模版.xlsx`
// );
};
const afterVisibleChange = (bool) => {
console.log("state", bool);
@@ -301,11 +335,11 @@ export default {
message.error("文件格式错误");
return;
}
if(info.file.size > 50000000){
if (info.file.size > 50000000) {
state.fileList = [];
state.uploadpercent = -1;
message.destroy();
message.error("文件大小超出50M请重新上传")
message.error("文件大小超出50M请重新上传");
return;
}
}
@@ -328,17 +362,17 @@ export default {
});
state.fileName = info.file.name;
let i = 0;
if(info.file.response.code == 1){
if (info.file.response.code == 1) {
state.fileList = [];
state.addLoading = false;
state.uploadpercent = -1;
message.destroy();
message.error(info.file.response.msg)
return
message.error(info.file.response.msg);
return;
}
state.timers = setInterval(() => {
state.redisKey = info.file.response.data;
getImportStatus({redisKey:state.redisKey})
getImportStatus({ redisKey: state.redisKey })
.then((res) => {
console.log("查询导入状态", res);
if (res.data.code === 200) {
@@ -354,7 +388,7 @@ export default {
state.succNum = res.data.data.successNum;
state.errNum = res.data.data.failedNum;
state.downloadErrUrl = res.data.data.url;
state.notMatchUrl = res.data.data.notMatchUrl
state.notMatchUrl = res.data.data.notMatchUrl;
clearInterval(state.timers);
}
}
@@ -376,14 +410,22 @@ export default {
// 下载失败数据
const downloadEeeorData = () => {
if (state.downloadErrUrl !== "") {
window.open(process.env.VUE_APP_BOE_API_URL + '/upload/boe/file' + state.downloadErrUrl);
window.open(
process.env.VUE_APP_BOE_API_URL +
"/upload/boe/file" +
state.downloadErrUrl
);
}
};
const notDown = () => {
if (state.notMatchUrl !== "") {
window.open(process.env.VUE_APP_BOE_API_URL + '/upload/boe/file' + state.notMatchUrl);
window.open(
process.env.VUE_APP_BOE_API_URL +
"/upload/boe/file" +
state.notMatchUrl
);
}
}
};
//删除
const removeUpload = () => {
@@ -394,10 +436,10 @@ export default {
state.addLoading = false;
state.uploadErr = false; //上传失败
state.succNum = 0;
state.redisKey = ''
state.redisKey = "";
state.errNum = 0;
state.downloadErrUrl = "";
state.notMatchUrl = '';
state.notMatchUrl = "";
};
return {
@@ -418,7 +460,7 @@ export default {
</script>
<style lang="scss">
.AddLevelImpStu > .ant-drawer-content-wrapper {
.AddLevelImpStu > .ant-drawer-content-wrapper {
min-width: 800px !important;
width: 800px !important;
}
@@ -503,17 +545,17 @@ export default {
margin-top: 10px;
}
}
.group_data{
.group_data {
display: flex;
align-items: center;
background-color: #d9ecff;
height: 40px;
margin-top: 12px;
.icon{
.icon {
margin: 0 20px;
}
.text{
margin-right:20px;
.text {
margin-right: 20px;
}
}
.loadstate {