feat:增加面授课成绩导入

This commit is contained in:
lixg
2023-01-04 15:04:21 +08:00
parent 9b3f9e47ee
commit 78119e4093
5 changed files with 130 additions and 22 deletions

View File

@@ -2,11 +2,11 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-21 14:32:52 * @Date: 2022-11-21 14:32:52
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-12-17 21:00:28 * @LastEditTime: 2023-01-04 13:49:54
* @FilePath: /fe-manage/src/api/config.js * @FilePath: /fe-manage/src/api/config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
import {message} from "ant-design-vue"; import { message } from "ant-design-vue";
import axios from "axios"; import axios from "axios";
import router from "@/router"; import router from "@/router";
// import { getCookie } from '../api/method' // import { getCookie } from '../api/method'
@@ -15,12 +15,13 @@ import router from "@/router";
// axios.defaults.headers.post["Content-Type"] = // axios.defaults.headers.post["Content-Type"] =
// "application/x-www-form-urlencoded"; // "application/x-www-form-urlencoded";
export const FILE_UPLOAD_URL = process.env.VUE_APP_BASE_API + '/file/upload' export const FILE_UPLOAD_URL = process.env.VUE_APP_BASE_API + '/file/upload'
export const BATCH_IMPORT_SCORE = process.env.VUE_APP_BASE_API + '/admin/offcourse/batchImportScore'
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
const http = axios.create({ const http = axios.create({
baseURL: process.env.VUE_APP_BASE_API, baseURL: process.env.VUE_APP_BASE_API,
timeout: 1000 * 15, timeout: 1000 * 15,
// headers: { "Content-Type": "multipart/form-data" }, // headers: { "Content-Type": "multipart/form-data" },
headers: {"Content-Type": "application/json"}, headers: { "Content-Type": "application/json" },
}); });
http.interceptors.request.use( http.interceptors.request.use(
@@ -50,14 +51,14 @@ http.interceptors.response.use(
(response) => { (response) => {
// console.log('response', response) // console.log('response', response)
const { const {
data: {code, msg}, data: { code, msg },
} = response; } = response;
// console.log('code', code) // console.log('code', code)
if (code === 0 || code === 200) { if (code === 0 || code === 200) {
return response; return response;
} else { } else {
if (code === 1000) { if (code === 1000) {
process.env.NODE_ENV === 'development' ? router.push({path: 'login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL) process.env.NODE_ENV === 'development' ? router.push({ path: 'login' }) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
} }
console.log("api %o", msg); console.log("api %o", msg);
} }

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-04 22:45:31 * @Date: 2022-11-04 22:45:31
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-12-08 20:20:26 * @LastEditTime: 2023-01-04 12:36:46
* @FilePath: /fe-manage/src/api/index1.js * @FilePath: /fe-manage/src/api/index1.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
@@ -44,7 +44,7 @@ import qs from "qs";
//上传文件 //上传文件
export const uploadFile = (obj) => export const uploadFile = (obj) =>
http.post("/test/testRequest", qs.stringify({obj})); http.post("/test/testRequest", qs.stringify({ obj }));
// 接口-请求 // 接口-请求
@@ -56,7 +56,7 @@ export const getLearnPath = (obj) => http.post("/admin/router/list", obj);
export const handleLearnPath = (obj) => http.post("/admin/router/handle", obj); export const handleLearnPath = (obj) => http.post("/admin/router/handle", obj);
//获取路径图统计数据 //获取路径图统计数据
export const getLearnCount = (routerId) => export const getLearnCount = (routerId) =>
http.get("/admin/router/getCount", {params: {routerId: routerId}}); http.get("/admin/router/getCount", { params: { routerId: routerId } });
//新建或编辑关卡 //新建或编辑关卡
export const editChapter = (obj) => http.post("/admin/router/editChapter", obj); export const editChapter = (obj) => http.post("/admin/router/editChapter", obj);
@@ -111,7 +111,7 @@ export const searchUsersByOrgId = (obj) => http.post('/admin/router/searchUsersB
//获取组织信息(修改版) //获取组织信息(修改版)
export const getOrgInfo = (obj) => http.post('/admin/orgStruct/getOrgInfo', obj) export const getOrgInfo = (obj) => http.post('/admin/orgStruct/getOrgInfo', obj)
export const getOrgTreeInfo = (obj) => http.get('/org/initOrg', {params: obj}) export const getOrgTreeInfo = (obj) => http.get('/org/initOrg', { params: obj })
//获取员工(修改版) //获取员工(修改版)
export const getMemberInfo = (obj) => http.post('/admin/orgStruct/getMemberInfo', obj) export const getMemberInfo = (obj) => http.post('/admin/orgStruct/getMemberInfo', obj)
//获取受众(修改版) //获取受众(修改版)
@@ -121,7 +121,7 @@ export const optionAuthPerm = (obj) => http.post('/admin/AuthPerm/optionAuthPerm
//获取学员列表 //获取学员列表
export const getStuList = (obj) => http.post('/admin/orgStruct/getStudentRef', obj) export const getStuList = (obj) => http.post('/admin/orgStruct/getStudentRef', obj)
//获取用户登录 //获取用户登录
export const getUser = () => http.post('/admin/CheckUser/login', {withCredentials: true}) export const getUser = () => http.post('/admin/CheckUser/login', { withCredentials: true })
//公共信息--------------------------------------------------- //公共信息---------------------------------------------------
//添加项目学员 //添加项目学员
@@ -133,7 +133,7 @@ export const addStudentCourse = (obj) => http.post("/admin/offcourse/addStudent"
export const orgtree = () => http.get("/org/tree"); export const orgtree = () => http.get("/org/tree");
export const saveStu = obj => http.post("/admin/student/addStudent", obj); export const saveStu = obj => http.post("/admin/student/addStudent", obj);
export const moveStudent = obj => http.post("/admin/student/moveStudent", obj); export const moveStudent = obj => http.post("/admin/student/moveStudent", obj);
export const getStuPage = obj => http.get("/admin/student/getStudent", {params: obj}); export const getStuPage = obj => http.get("/admin/student/getStudent", { params: obj });
export const delStudentList = obj => http.post("/admin/student/delStudent", obj); export const delStudentList = obj => http.post("/admin/student/delStudent", obj);
export const validateName = obj => http.post("/admin/validate/validateName", obj); export const validateName = obj => http.post("/admin/validate/validateName", obj);
@@ -154,3 +154,7 @@ export const noticeList = (projectId) =>
// }) // })
// export const choiceEvaluation = (obj) => http.post('/evaluation/choiceEvaluation', obj); // export const choiceEvaluation = (obj) => http.post('/evaluation/choiceEvaluation', obj);
// //面授课批量导入成绩
export const batchImportScore = (offcoursePlanId, obj) =>
http.post(`/admin/offcourse/batchImportScore?offcoursePlanId=${offcoursePlanId}`, obj);

View File

@@ -25,11 +25,26 @@
<div class="upload"> <div class="upload">
<div class="text">上传</div> <div class="text">上传</div>
<div class="right"> <div class="right">
<div class="load"> <div style="height: 176px; margin-bottom: 20px">
<a-upload-dragger
v-model:fileList="fileList"
:action="BATCH_IMPORT_SCORE + '?offcoursePlanId=' + id"
name="file"
:multiple="true"
@change="handleChange"
>
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
</p>
<p class="ant-upload-text">点击或将文件拖拽到此处上传</p>
<p class="ant-upload-hint">支持扩展名.xls/.xlsx</p>
</a-upload-dragger>
</div>
<!-- <div class="load">
<div class="cloud"></div> <div class="cloud"></div>
<div class="tip">点击或将文件拖拽到此处上传</div> <div class="tip">点击或将文件拖拽到此处上传</div>
<div class="tipz">支持扩展名.xls/.xlsx</div> <div class="tipz">支持扩展名.xls/.xlsx</div>
</div> </div> -->
<div class="loadstate"> <div class="loadstate">
<div class="loadborder"> <div class="loadborder">
<div class="content"> <div class="content">
@@ -93,14 +108,17 @@
</div> </div>
</div> </div>
<div class="btnn"> <div class="btnn">
<button class="btn1">取消</button> <button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="closeDrawer">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs } from "vue"; import { reactive, toRefs } from "vue";
import { message } from "ant-design-vue";
import * as api from "../../api/index1";
import { BATCH_IMPORT_SCORE } from "@/api/config";
export default { export default {
name: "EScore", name: "EScore",
props: { props: {
@@ -108,9 +126,20 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
//type=3:面授课
type: {
type: String,
default: null,
},
id: {
type: Number,
default: null,
},
}, },
setup(props, ctx) { setup(props, ctx) {
const state = reactive({}); const state = reactive({
fileType: ["xls", "xlsx"],
});
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:eScorevisible", false); ctx.emit("update:eScorevisible", false);
}; };
@@ -119,10 +148,35 @@ export default {
console.log("state", bool); console.log("state", bool);
}; };
//上传文件
const handleChange = (info) => {
console.log("info", info, props.id);
const status = info.file.status;
if (status !== "uploading") {
console.log(info.file, info.fileList);
}
if (status === "done") {
const formData = new FormData();
formData.append("uploadFile", info.file);
// formData.append("offcoursePlanId", props.id);
console.log(info.file);
api.batchImportScore(props.id, formData).then((res) => {
// if (res.data.code === 200) {
// console.log('上传成功')
// }
console.log("上传成绩", res);
});
message.success(`${info.file.name} file uploaded successfully.`);
} else if (status === "error") {
message.error(`${info.file.name} file upload failed.`);
}
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
handleChange,
BATCH_IMPORT_SCORE,
}; };
}, },
}; };

View File

@@ -105,7 +105,7 @@
:style="{ display: hideshow ? 'none' : 'block' }" :style="{ display: hideshow ? 'none' : 'block' }"
> >
<div class="btnsbox"> <div class="btnsbox">
<div class="btn4_tit" @click="handleAllJion"> <div class="btn4_tit" @click="showEScoreModal">
<span>批量录入成绩</span> <span>批量录入成绩</span>
</div> </div>
<div class="btn4_op1" @click="handleAllover"> <div class="btn4_op1" @click="handleAllover">
@@ -300,6 +300,9 @@
v-model:checkStuId="checkStuId" v-model:checkStuId="checkStuId"
v-model:projectId="projectId" v-model:projectId="projectId"
/> />
<!-- 导入作业成绩抽屉 -->
<ExportScore v-model:eScorevisible="eScorevisible" :type="3" :id="id" />
</template> </template>
<script setup> <script setup>
import { computed, defineProps, onMounted, ref, watch } from "vue"; import { computed, defineProps, onMounted, ref, watch } from "vue";
@@ -309,7 +312,7 @@ import ChangeLevelModal from "./ChangeLevelModal.vue";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
// import { topStudent } from "../../api/indexProjStu"; // import { topStudent } from "../../api/indexProjStu";
import SeeStu from "../../components/drawers/SeeStu"; import SeeStu from "../../components/drawers/SeeStu";
import ExportScore from "../drawers/ExportScore.vue";
const props = defineProps({ const props = defineProps({
type: Number, type: Number,
id: String, id: String,
@@ -551,7 +554,7 @@ const projectId = ref(null);
// console.log(checkStuId.value, projectId.value) // console.log(checkStuId.value, projectId.value)
// } // }
//面授课批量操作 //面授课批量操作下拉框
const hideshow = ref(true); const hideshow = ref(true);
const hideShow = () => { const hideShow = () => {
if (hideshow.value == true) { if (hideshow.value == true) {
@@ -560,6 +563,11 @@ const hideShow = () => {
hideshow.value = true; hideshow.value = true;
} }
}; };
//批量导入成绩
const eScorevisible = ref(false);
const showEScoreModal = () => {
eScorevisible.value = true;
};
</script> </script>
<style lang="scss"> <style lang="scss">
.TableStudent { .TableStudent {

View File

@@ -2903,16 +2903,38 @@ export default defineComponent({
{ {
title: "岗位", title: "岗位",
width: "15%", width: "15%",
dataIndex: "signstatus", dataIndex: "studentJobName",
key: "7", key: "7",
align: "center", align: "center",
customRender: (text) => {
return (
<div class="racona">
<span>
{text.record.studentJobName
? text.record.studentJobName
: "-"}
</span>
</div>
);
},
}, },
{ {
title: "Band", title: "Band",
width: "15%", width: "15%",
dataIndex: "signstatus", dataIndex: "studentBandDesc",
key: "7", key: "7",
align: "center", align: "center",
customRender: (text) => {
return (
<div class="racona">
<span>
{text.record.studentBandDesc
? text.record.studentBandDesc
: "-"}
</span>
</div>
);
},
}, },
{ {
title: "报名状态", title: "报名状态",
@@ -2967,9 +2989,28 @@ export default defineComponent({
{ {
title: "作业成绩", title: "作业成绩",
width: "15%", width: "15%",
dataIndex: "signstatus", dataIndex: "workScore",
key: "7", key: "7",
align: "center", align: "center",
customRender: ({ record }) => {
switch (String(record.status)) {
case "0":
return (
<span
style={{ color: "#4EA6FF", cursor: "pointer" }}
onClick={() => {
handlJoinStu(record);
}}
>
成绩录入
</span>
);
case "1":
return "-";
case "2":
return "-";
}
},
}, },
{ {
title: "考试成绩", title: "考试成绩",