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
* @Date: 2022-11-21 14:32:52
* @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
* @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 router from "@/router";
// import { getCookie } from '../api/method'
@@ -15,12 +15,13 @@ import router from "@/router";
// axios.defaults.headers.post["Content-Type"] =
// "application/x-www-form-urlencoded";
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;
const http = axios.create({
baseURL: process.env.VUE_APP_BASE_API,
timeout: 1000 * 15,
// headers: { "Content-Type": "multipart/form-data" },
headers: {"Content-Type": "application/json"},
headers: { "Content-Type": "application/json" },
});
http.interceptors.request.use(
@@ -50,14 +51,14 @@ http.interceptors.response.use(
(response) => {
// console.log('response', response)
const {
data: {code, msg},
data: { code, msg },
} = response;
// console.log('code', code)
if (code === 0 || code === 200) {
return response;
} else {
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);
}

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-04 22:45:31
* @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
* @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) =>
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 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);
@@ -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 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)
//获取受众(修改版)
@@ -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 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 saveStu = obj => http.post("/admin/student/addStudent", 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 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 batchImportScore = (offcoursePlanId, obj) =>
http.post(`/admin/offcourse/batchImportScore?offcoursePlanId=${offcoursePlanId}`, obj);

View File

@@ -25,11 +25,26 @@
<div class="upload">
<div class="text">上传</div>
<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="tip">点击或将文件拖拽到此处上传</div>
<div class="tipz">支持扩展名.xls/.xlsx</div>
</div>
</div> -->
<div class="loadstate">
<div class="loadborder">
<div class="content">
@@ -93,14 +108,17 @@
</div>
</div>
<div class="btnn">
<button class="btn1">取消</button>
<button class="btn2">确定</button>
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="closeDrawer">确定</button>
</div>
</div>
</a-drawer>
</template>
<script>
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 {
name: "EScore",
props: {
@@ -108,9 +126,20 @@ export default {
type: Boolean,
default: false,
},
//type=3:面授课
type: {
type: String,
default: null,
},
id: {
type: Number,
default: null,
},
},
setup(props, ctx) {
const state = reactive({});
const state = reactive({
fileType: ["xls", "xlsx"],
});
const closeDrawer = () => {
ctx.emit("update:eScorevisible", false);
};
@@ -119,10 +148,35 @@ export default {
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 {
...toRefs(state),
afterVisibleChange,
closeDrawer,
handleChange,
BATCH_IMPORT_SCORE,
};
},
};

View File

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

View File

@@ -2903,16 +2903,38 @@ export default defineComponent({
{
title: "岗位",
width: "15%",
dataIndex: "signstatus",
dataIndex: "studentJobName",
key: "7",
align: "center",
customRender: (text) => {
return (
<div class="racona">
<span>
{text.record.studentJobName
? text.record.studentJobName
: "-"}
</span>
</div>
);
},
},
{
title: "Band",
width: "15%",
dataIndex: "signstatus",
dataIndex: "studentBandDesc",
key: "7",
align: "center",
customRender: (text) => {
return (
<div class="racona">
<span>
{text.record.studentBandDesc
? text.record.studentBandDesc
: "-"}
</span>
</div>
);
},
},
{
title: "报名状态",
@@ -2967,9 +2989,28 @@ export default defineComponent({
{
title: "作业成绩",
width: "15%",
dataIndex: "signstatus",
dataIndex: "workScore",
key: "7",
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: "考试成绩",