学生管理调整

This commit is contained in:
fan 2020-05-13 17:59:08 +08:00
parent 4d18c4ac2e
commit c30b221dc3
6 changed files with 827 additions and 329 deletions

View File

@ -89,7 +89,7 @@ export function updateExamRules(data) {
/** 根据课程ID获取试卷 */
export function getExamParperList(lessonId) {
return request({
url: `/api/exam/${lessonId}/List`,
url: `/api/exam/${lessonId}/list`,
method: 'get'
});
}

View File

@ -187,7 +187,7 @@ export function generateOfflineUser(data) {
});
}
// 导入学生成绩
export function importnStudentResults(projectCode, data) {
export function importStudentResults(projectCode, data) {
return request({
url: `/api/user/project/${projectCode}/import/student`,
method: 'post',
@ -202,3 +202,20 @@ export function getProjectClassList(projectCode) {
method: 'get'
});
}
// 导出学生成绩
export function exportStudentResults(projectCode, data) {
return request({
url: `/api/user/project/${projectCode}/export/student`,
method: 'put',
data: data
});
}
// 生成绑定微信二维码
export function getWxQrCode(params) {
return request({
url: `/api/user/wmurl`,
method: 'get',
params: params
});
}

View File

@ -1,250 +1,268 @@
<template>
<el-dialog
v-dialogDrag
:title="$t('global.personalDetails')"
:visible.sync="visible"
width="470px"
:before-close="doClose"
class="userInfo_box"
>
<div>
<div class="form_box">
<div class="title">{{ $t('global.compellation') }}:</div>
<div class="content">
<div v-show="nameShow" class="show_box">
<span>{{ userInfo.name }}</span>
<i class="el-icon-edit" @click="switcherName" />
</div>
<div v-show="!nameShow" class="flex_box">
<el-input
v-model="editInfo.name"
:placeholder="$t('global.enterName')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box">
<el-button
size="mini"
class="button_box"
:disabled="!editInfo.name"
@click="saveName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherName"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.nickName') }}:</div>
<div class="content">
<div v-show="nickNameShow" class="show_box">
<span>{{ userInfo.nickname }}</span>
<i class="el-icon-edit" @click="switcherNickname" />
</div>
<div v-show="!nickNameShow" class="flex_box">
<el-input
v-model="editInfo.nickname"
:placeholder="$t('global.enterNickname')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box">
<el-button
size="mini"
class="button_box"
:disabled="!editInfo.nickname"
@click="saveNickName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherNickname"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.mobile') }}:</div>
<div class="content">
<div v-show="mobileShow" class="show_box">
<span>{{ geTel(userInfo.mobile) }}</span>
<i class="el-icon-edit" @click="switcherMobile" />
</div>
<div v-show="!mobileShow" class="flex_box">
<el-input
v-model="editInfo.mobile"
:placeholder="$t('global.enterMobile')"
maxlength="11"
size="mini"
class="input_box"
/>
<el-select v-model="nationCode" size="mini" class="selectCountry">
<el-option
v-for="item in countryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
v-model="mobileCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="mobileCodeTime != 0"
@click="sendMobileCode"
>
{{ $t('global.sendCode') }}
<span
v-if="mobileCodeTime"
>{{ mobileCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!mobileCode"
@click="saveMobile"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherMobile"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.email') }}:</div>
<div class="content">
<div v-show="emailShow" class="show_box">
<span>{{ userInfo.email }}</span>
<i class="el-icon-edit" @click="switcherEmail" />
</div>
<div v-show="!emailShow" class="flex_box">
<el-input
v-model="editInfo.email"
:placeholder="$t('global.enterEmail')"
size="mini"
class="input_box"
/>
<el-input
v-model="emailCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="emailCodeTime != 0"
@click="sendEmailCode"
>
{{ $t('global.sendCode') }}
<span
v-if="emailCodeTime"
>{{ emailCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!emailCode"
@click="saveEmail"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherEmail"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.passWord') }}:</div>
<div class="content">
<div v-show="passwordShow" class="show_box">
<span>******</span>
<i class="el-icon-edit" @click="switcherPassWord" />
</div>
<div v-show="!passwordShow" class="flex_box">
<div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span>
<el-input
v-model="newPassWord1"
:placeholder="$t('global.enterPassWord')"
maxlength="20"
show-password
size="mini"
class="input_box"
/>
</div>
<div style="height: 28px; line-height: 28px; margin-bottom: 10px;">
<el-input
v-model="passWordCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
/>
<el-button
size="mini"
style="margin-right: 10px;"
:disabled="passWordCodeTime != 0"
@click="sendPassWordCode"
>
{{ $t('global.sendMobileCode') }}
<span
v-if="passWordCodeTime"
>{{ passWordCodeTime }}</span>
</el-button>
</div>
<div class="button_box" style="width: 150px;">
<el-button
size="mini"
class="button_box"
:disabled="!passWordCode"
@click="savePassWord"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherPassWord"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
<el-dialog
v-dialogDrag
:title="$t('global.personalDetails')"
:visible.sync="visible"
width="470px"
:before-close="doClose"
class="userInfo_box"
>
<div>
<div class="form_box">
<div class="title">{{ $t('global.compellation') }}:</div>
<div class="content">
<div v-show="nameShow" class="show_box">
<span>{{ userInfo.name }}</span>
<i class="el-icon-edit" @click="switcherName" />
</div>
<div v-show="!nameShow" class="flex_box">
<el-input
v-model="editInfo.name"
:placeholder="$t('global.enterName')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box">
<el-button
size="mini"
class="button_box"
:disabled="!editInfo.name"
@click="saveName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherName"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.close') }}</el-button>
</span>
</el-dialog>
</div>
<div class="form_box">
<div class="title">{{ $t('global.nickName') }}:</div>
<div class="content">
<div v-show="nickNameShow" class="show_box">
<span>{{ userInfo.nickname }}</span>
<i class="el-icon-edit" @click="switcherNickname" />
</div>
<div v-show="!nickNameShow" class="flex_box">
<el-input
v-model="editInfo.nickname"
:placeholder="$t('global.enterNickname')"
maxlength="20"
size="mini"
class="input_box"
/>
<div class="button_box">
<el-button
size="mini"
class="button_box"
:disabled="!editInfo.nickname"
@click="saveNickName"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherNickname"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.mobile') }}:</div>
<div class="content">
<div v-show="mobileShow" class="show_box">
<span>{{ geTel(userInfo.mobile) }}</span>
<i class="el-icon-edit" @click="switcherMobile" />
</div>
<div v-show="!mobileShow" class="flex_box">
<el-input
v-model="editInfo.mobile"
:placeholder="$t('global.enterMobile')"
maxlength="11"
size="mini"
class="input_box"
/>
<el-select v-model="nationCode" size="mini" class="selectCountry">
<el-option
v-for="item in countryList"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
<el-input
v-model="mobileCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="mobileCodeTime != 0"
@click="sendMobileCode"
>
{{ $t('global.sendCode') }}
<span
v-if="mobileCodeTime"
>{{ mobileCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!mobileCode"
@click="saveMobile"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherMobile"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.email') }}:</div>
<div class="content">
<div v-show="emailShow" class="show_box">
<span>{{ userInfo.email }}</span>
<i class="el-icon-edit" @click="switcherEmail" />
</div>
<div v-show="!emailShow" class="flex_box">
<el-input
v-model="editInfo.email"
:placeholder="$t('global.enterEmail')"
size="mini"
class="input_box"
/>
<el-input
v-model="emailCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
style="margin-top: 10px;"
/>
<el-button
size="mini"
style="margin-top: 10px; margin-right: 10px;"
:disabled="emailCodeTime != 0"
@click="sendEmailCode"
>
{{ $t('global.sendCode') }}
<span
v-if="emailCodeTime"
>{{ emailCodeTime }}</span>
</el-button>
<div class="button_box" style="margin-top: 10px;">
<el-button
size="mini"
class="button_box"
:disabled="!emailCode"
@click="saveEmail"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherEmail"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
<div class="form_box">
<div class="title">{{ $t('global.passWord') }}:</div>
<div class="content">
<div v-show="passwordShow" class="show_box">
<span>******</span>
<i class="el-icon-edit" @click="switcherPassWord" />
</div>
<div v-show="!passwordShow" class="flex_box">
<div class="passWord_box">
<span>{{ $t('global.newPassWord') }}:</span>
<el-input
v-model="newPassWord1"
:placeholder="$t('global.enterPassWord')"
maxlength="20"
show-password
size="mini"
class="input_box"
/>
</div>
<div style="height: 28px; line-height: 28px; margin-bottom: 10px;">
<el-input
v-model="passWordCode"
:placeholder="$t('global.verificationCode')"
size="mini"
class="code_box"
/>
<el-button
size="mini"
style="margin-right: 10px;"
:disabled="passWordCodeTime != 0"
@click="sendPassWordCode"
>
{{ $t('global.sendMobileCode') }}
<span
v-if="passWordCodeTime"
>{{ passWordCodeTime }}</span>
</el-button>
</div>
<div class="button_box" style="width: 150px;">
<el-button
size="mini"
class="button_box"
:disabled="!passWordCode"
@click="savePassWord"
>{{ $t('global.save') }}</el-button>
<el-button
size="mini"
class="button_box"
type="text"
@click="switcherPassWord"
>{{ $t('global.cancel') }}</el-button>
</div>
</div>
</div>
</div>
</div>
<div v-if="project.endsWith('gzb')" class="form_box">
<div class="title">绑定微信:</div>
<div class="content">
<el-button v-if="!binding&&!bindSuccess" type="primary" size="small" @click="generateQrCode">生成微信二位码</el-button>
<div v-if="binding && !bindSuccess" class="login-code-box" @click="generateQrCode">
<qrcode-vue
v-loading="loadingCode"
:value="loginUrl"
:class-name="qrcodeClassName"
:size="150"
:element-loading-text="this.$t('login.clickRefresh')"
element-loading-spinner="el-icon-refresh"
element-loading-background="rgba(255, 255, 255, 0.9)"
/>
</div>
<div v-if="bindSuccess"><span>绑定成功</span></div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.close') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import md5 from "js-md5";
import { getInfo } from "@/api/login";
import { getToken } from "@/utils/auth"; // getDesignToken
import md5 from 'js-md5';
import { getInfo } from '@/api/login';
import { getToken } from '@/utils/auth'; // getDesignToken
import {
getUserinfoName,
getUserinfoNickname,
@ -252,29 +270,42 @@ import {
getUserinfoMobileCode,
getUserinfoEmailCode,
getUserinfoEmail,
getUserinfoPassword
} from "@/api/management/user";
import { setInterval, clearInterval } from "timers";
getUserinfoPassword,
getWxQrCode
} from '@/api/management/user';
import QrcodeVue from 'qrcode.vue';
import { LoginParams } from '@/utils/login';
import { setInterval, clearInterval } from 'timers';
import { checkLoginStatus } from '@/api/login';
import { getessionStorage } from '@/utils/auth';
export default {
components: { QrcodeVue },
data() {
return {
visible: false,
loginUrl: '',
loadingCode: false,
sessionId: '',
binding: false,
bindSuccess: false,
qrcodeClassName: 'login-qrcode',
checkTimeout: null,
userInfo: {
name: "",
nickname: "",
mobile: "",
email: "",
passWord: ""
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
editInfo: {
name: "",
nickname: "",
mobile: "",
email: "",
passWord: ""
name: '',
nickname: '',
mobile: '',
email: '',
passWord: ''
},
nationCode: "86",
nationCode: '86',
nameShow: true,
nickNameShow: true,
mobileShow: true,
@ -283,6 +314,7 @@ export default {
mobileCode: null,
emailCode: null,
passWordCode: null,
checkLogin: null,
oldPassWord: null,
newPassWord1: null,
@ -295,17 +327,19 @@ export default {
mobileTime: null,
passWordTime: null,
countryList: [
{ name: this.$t("global.china"), value: "86" },
{ name: this.$t("global.australia"), value: "61" },
{ name: this.$t("global.england"), value: "44" },
{ name: this.$t("global.hongKong"), value: "852" },
{ name: this.$t("global.Japanese"), value: "81" },
{ name: this.$t("global.macao"), value: "853" },
{ name: this.$t("global.singapore"), value: "65" },
{ name: this.$t("global.taiwan"), value: "886" },
{ name: this.$t("global.america"), value: "1" }
{ name: this.$t('global.china'), value: '86' },
{ name: this.$t('global.australia'), value: '61' },
{ name: this.$t('global.england'), value: '44' },
{ name: this.$t('global.hongKong'), value: '852' },
{ name: this.$t('global.Japanese'), value: '81' },
{ name: this.$t('global.macao'), value: '853' },
{ name: this.$t('global.singapore'), value: '65' },
{ name: this.$t('global.taiwan'), value: '886' },
{ name: this.$t('global.america'), value: '1' }
],
nationCodeInit: "86" //
nationCodeInit: '86', //
loginClient: 'LianKeTang',
project:''
};
},
computed: {
@ -317,13 +351,16 @@ export default {
geTel(tel) {
const reg = /^(\d{3})\d{4}(\d{4})$/;
if (tel) {
return tel.replace(reg, "$1****$2");
return tel.replace(reg, '$1****$2');
} else {
return "";
return '';
}
},
doShow() {
this.visible = true;
this.binding = false;
this.bindSuccess = false;
this.project = getessionStorage('project');
// const token = getToken() || getDesignToken();
const token = getToken();
getInfo(token)
@ -334,20 +371,22 @@ export default {
nickname: user.nickname,
mobile: user.mobile,
email: user.email,
passWord: ""
passWord: ''
};
this.oldPassWord = user.password;
this.nationCode = user.nationCode ? user.nationCode : "86";
this.nationCode = user.nationCode ? user.nationCode : '86';
this.nationCodeInit = user.nationCode
? user.nationCode
: "86";
: '86';
})
.catch(error => {
console.log(error, "请求个人信息失败");
console.log(error, '请求个人信息失败');
});
},
doClose() {
this.visible = false;
this.binding = false;
this.bindSuccess = false;
},
switcherName() {
this.editInfo.name = this.userInfo.name;
@ -359,9 +398,9 @@ export default {
await getUserinfoName(this.info.id, this.editInfo.name);
this.userInfo.name = this.editInfo.name;
this.nameShow = !this.nameShow;
this.$store.commit("SET_NAME", this.editInfo.name);
this.$store.commit('SET_NAME', this.editInfo.name);
} catch (error) {
console.log(error, "错误");
console.log(error, '错误');
}
}
},
@ -379,9 +418,9 @@ export default {
);
this.userInfo.nickname = this.editInfo.nickname;
this.nickNameShow = !this.nickNameShow;
this.$store.commit("SET_NICKNAME", this.editInfo.nickname);
this.$store.commit('SET_NICKNAME', this.editInfo.nickname);
} catch (error) {
console.log(error, "错误");
console.log(error, '错误');
}
}
},
@ -404,7 +443,7 @@ export default {
this.mobileShow = !this.mobileShow;
this.mobileCode = null;
} catch (error) {
this.$message.info(this.$t("global.codeError"));
this.$message.info(this.$t('global.codeError'));
}
}
},
@ -431,7 +470,7 @@ export default {
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t("global.codeFaile"));
this.$message.info(this.$t('global.codeFaile'));
}
},
@ -451,7 +490,7 @@ export default {
this.emailShow = !this.emailShow;
this.emailCode = null;
} catch (error) {
this.$message.info(this.$t("global.codeError"));
this.$message.info(this.$t('global.codeError'));
}
}
},
@ -468,7 +507,7 @@ export default {
}, 1000);
await getUserinfoEmailCode(this.editInfo.email);
} catch (error) {
this.$message.info(this.$t("global.codeFaile"));
this.$message.info(this.$t('global.codeFaile'));
}
},
@ -477,7 +516,7 @@ export default {
},
async savePassWord() {
if (this.newPassWord1.length <= 5) {
this.$message.info(this.$t("global.passWordLength"));
this.$message.info(this.$t('global.passWordLength'));
} else {
this.uploadPassword();
}
@ -492,13 +531,59 @@ export default {
try {
await getUserinfoPassword(this.info.id, param);
this.passwordShow = !this.passwordShow;
this.newPassWord1 = "";
this.newPassWord1 = '';
this.passWordCode = null;
} catch (error) {
console.log(error, 11);
}
} else {
this.$message.info(this.$t("global.passWordSome"));
this.$message.info(this.$t('global.passWordSome'));
}
},
generateQrCode() {
getWxQrCode(LoginParams[this.loginClient]).then(response => {
this.sessionId = response.data.sessionId;
this.loginUrl = response.data.url;
this.binding = true;
this.clearTimer(this.checkTimeout);
this.checkTimeout = setTimeout(() => {
this.loadingCode = true;
this.loginUrl = '';
}, 3 * 60 * 1000);
this.checkLoginStatus();
});
},
checkLoginStatus() {
const self = this;
//
if (!this.binding) {
return;
}
//
//
this.clearTimer(this.checkLogin);
this.checkLogin = setTimeout(() => {
checkLoginStatus(self.sessionId).then(response => {
//
if (response.data.status == '2') {
self.clearTimer(self.checkLogin);
self.bindSuccess = true;
} else {
self.checkLoginStatus();
}
}).catch(error => {
if (error.data && error.data.status === '1') {
self.scanSuccess = true;
}
self.checkLoginStatus();
});
}, 3000);
},
clearTimer(timer) {
if (timer) {
clearTimeout(timer);
timer = null;
}
},
async sendPassWordCode() {
@ -525,11 +610,11 @@ export default {
}, 1000);
await getUserinfoMobileCode(param);
} catch (error) {
this.$message.info(this.$t("global.codeFaile"));
this.$message.info(this.$t('global.codeFaile'));
}
} else {
this.passwordShow = !this.passwordShow;
this.$message.info(this.$t("global.enterMobileNumber"));
this.$message.info(this.$t('global.enterMobileNumber'));
}
}
}

View File

@ -161,6 +161,12 @@ export default {
await this.loadInitData(json);
this.typeChoose(json);
},
mounted() {
this.interCheckGenerateStatus();
},
beforeDestroy() {
this.isLeaving = true;
},
methods: {
async loadInitData(queryData) {
this.mapIdList = [];
@ -196,6 +202,28 @@ export default {
this.reloadTable();
},
interCheckGenerateStatus() {
createAllTrainingList(this.$route.query.mapId, false).then((data)=>{
if (data.data) {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.trainingGenerating'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:true });
} else {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
setTimeout(() => {
if (!this.isLeaving) {
this.interCheckGenerateStatus(this.$route.query.mapId, false);
}
}, 15000);
}).catch(()=>{
setTimeout(() => {
if (!this.isLeaving) {
this.interCheckGenerateStatus(this.$route.query.mapId, false);
}
}, 15000);
});
},
async prdChoose(queryData) {
this.trainingTypeMap = {};
const mapId = this.$route.query.mapId;
@ -252,15 +280,26 @@ export default {
beforeClose: async (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
instance.confirmButtonText = '生成中...';
// instance.confirmButtonText = '...';
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.trainingGenerating'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:true });
try {
await createAllTrainingList(this.$route.query.mapId);
this.$message.success('生成实训成功');
const data = await createAllTrainingList(this.$route.query.mapId, true);
this.$message.success('实训生成中...');
instance.confirmButtonLoading = false;
if (!data.data) {
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
done();
} catch (error) {
instance.confirmButtonLoading = false;
this.$message.error(`生成实训失败: ${error.message}`);
this.queryList.actions.pop();
this.queryList.actions.push({ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging, disabled:false });
}
} else {
instance.confirmButtonLoading = false;
done();
}
}

View File

@ -116,7 +116,7 @@ export default {
components: { QrcodeVue, FloatPart },
data() {
const validateUsername = (rule, value, callback) => {
if (value.length < 5) {
if (value.length < 5 && !this.project.endsWith('gzb')) {
callback(new Error(this.$t('login.enterTheCorrectUserName')));
} else {
callback();

View File

@ -1,15 +1,15 @@
<template>
<div class="joylink-card">
<div style="margin-top: 20px;">
<div style="margin-top: 20px;width: 90%; position: absolute; left: 5%;">
<el-row>
<el-col :span="20">
<el-form ref="form" :model="form" label-width="80px" size="mini" style="width: 100%;margin-top: 10px;">
<el-form ref="form" :model="form" :rules="rules" label-width="100px" size="mini" style="width: 100%;margin-top: 10px;">
<el-row>
<el-col :span="6">
<el-form-item label="班级:">
<el-form-item label="班级:" prop="classId">
<el-select v-model="form.classId" placeholder="请选择" @change="getLessonByClassId">
<el-option
v-for="item in calssList"
v-for="item in classList"
:key="item.id"
:label="item.name"
:value="item.id"
@ -18,24 +18,26 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="考勤天数:">
<el-form-item label="考勤天数:" prop="attendanceDays">
<el-input-number v-model="form.attendanceDays" :min="1" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="开始日期:">
<el-form-item label="开始日期:" prop="termBeginDate">
<el-date-picker
v-model="form.termBeginDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="结束日期:">
<el-form-item label="结束日期:" prop="termEndDate">
<el-date-picker
v-model="form.termEndDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
/>
</el-form-item>
@ -43,10 +45,13 @@
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="产品类型:">
<el-select v-model="form.prdType" placeholder="请选择">
<el-form-item label="产品类型:"><span>行调</span></el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="课程:" prop="centerLessonId">
<el-select v-model="form.centerLessonId" placeholder="请选择" @change="centerLessonChange">
<el-option
v-for="item in calssList"
v-for="item in centerLessonList"
:key="item.id"
:label="item.name"
:value="item.id"
@ -55,10 +60,27 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="课程:">
<el-select v-model="form.lessonId" placeholder="请选择">
<el-form-item label="试卷:" prop="centerExamPaperId">
<el-select v-model="form.centerExamPaperId" placeholder="请选择">
<el-option
v-for="item in calssList"
v-for="item in centerExamPaperList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="产品类型:"><span>现地</span></el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="课程:" prop="localLessonId">
<el-select v-model="form.localLessonId" placeholder="请选择" @change="localLessonChange">
<el-option
v-for="item in localLessonList"
:key="item.id"
:label="item.name"
:value="item.id"
@ -67,10 +89,10 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="试:">
<el-select v-model="form.examPaperId" placeholder="请选择">
<el-form-item label=":" prop="localExamPaperId">
<el-select v-model="form.localExamPaperId" placeholder="请选择">
<el-option
v-for="item in calssList"
v-for="item in localExamPaperList"
:key="item.id"
:label="item.name"
:value="item.id"
@ -92,10 +114,34 @@
accept=".json, application/json, .csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@change="importResults"
>
成绩导入
导入学生信息
</el-button>
<el-button type="primary" size="mini" style="margin-top: 10px;" @click="exportResults">成绩导出</el-button></el-col>
</el-row>
<el-table
:data="tableData"
border
>
<el-table-column prop="index" label="序号" />
<el-table-column
prop="studentID"
label="学号"
/>
<el-table-column
prop="name"
label="姓名"
/>
<el-table-column label="考勤(10分)" prop="attendance" width="180" />
<el-table-column label="技能操作(30分)">
<el-table-column v-if="showLocal" :label="'ATS现地('+ lessonSocre +'分)'" prop="localLessonPassRate" />
<el-table-column v-if="showCenter" :label="'ATS行调('+ lessonSocre+'分)'" prop="centerLessonPassRate" />
</el-table-column>
<el-table-column label="考试成绩(60分)">
<el-table-column v-if="showLocal" :label="'ATS现地('+ examSocre+'分)'" prop="localExamSocreRadio" />
<el-table-column v-if="showCenter" :label="'ATS行调('+ examSocre+'分)'" prop="centerExamSocreRadio" />
</el-table-column>
<el-table-column label="期末成绩(100分)" prop="totolScore" />
</el-table>
</div>
</div>
</template>
@ -104,11 +150,12 @@
import { getLessonDrftList } from '@/api/jmap/lessondraft';
import XLSX from 'xlsx';
import { convertSheetToList } from '@/utils/runPlan';
import { importnStudentResults } from '@/api/management/user';
import { importStudentResults, exportStudentResults } from '@/api/management/user';
import { getSessionStorage } from '@/utils/auth';
import { ProjectCode } from '@/scripts/ProjectConfig';
import { getProjectClassList } from '@/api/management/user';
import { getLessonByClassId } from '@/api/jmap/lesson';
import { getExamList } from '@/api/management/exam';
export default {
name: 'StudentManage',
@ -117,15 +164,41 @@ export default {
data() {
return {
loading: false,
calssList: [],
classList: [],
localLessonList: [],
centerLessonList: [],
localExamPaperList: [],
centerExamPaperList: [],
showLocal: false,
showCenter: false,
tableData: [],
props: { multiple: true, value: 'id', label: 'name' },
form: {
attendanceDays: 1,
classId: '',
termBeginDate: '',
termEndDate: '',
prdType: '',
lessonId: '',
examPaperId: ''
localLessonId: '',
centerLessonId: '',
localExamPaperId: '',
centerExamPaperId: ''
},
examDataList: [
{
id: '01',
name: '现地',
children: []
}, {
id: '02',
name: '行调',
children: []
}
],
rules: {
classId: [{ required: true, message: '请选择班级', trigger: 'change' }],
attendanceDays: [{required: true, message: '请输入考勤天数', trigger: 'blur'}],
termBeginDate: [{required: true, message: '请选择开始日期', trigger: 'change'}],
termEndDate: [{required: true, message: '请选择结束日期', trigger: 'change'}]
},
pagerConfig: {
pageSize: 'pageSize',
@ -141,17 +214,25 @@ export default {
columns: [
]
},
exportData: {
classId: '',
localLessonId: ''
}
};
},
computed: {
mapId() {
return this.$route.params.mapId;
},
hasRelease() {
return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05');
project() {
return getSessionStorage('project');
},
lessonSocre() {
return this.showLocal && this.showCenter ? 15 : 30;
},
examSocre() {
return this.showLocal && this.showCenter ? 30 : 60;
}
},
watch: {
@ -160,9 +241,8 @@ export default {
}
},
mounted() {
const project = getSessionStorage('project');
getProjectClassList(ProjectCode[project]).then(resp => {
this.calssList = resp.data;
getProjectClassList(ProjectCode[this.project]).then(resp => {
this.classList = resp.data;
}).catch(() =>{
this.$message.error('获取班级数据失败!');
});
@ -180,18 +260,118 @@ export default {
}
},
query() {
this.$refs.form.validate((valid) => {
if (valid) {
if ((this.form.localLessonId && this.form.localExamPaperId) || (this.form.centerLessonId && this.form.centerExamPaperId)) {
const prdParams = [];
if (this.form.localLessonId && this.form.localExamPaperId) {
prdParams.push({prdType: '01', lessonId: this.form.localLessonId, examPaperId: this.form.localExamPaperId});
}
if (this.form.centerLessonId && this.form.centerExamPaperId) {
prdParams.push({prdType: '02', lessonId: this.form.centerLessonId, examPaperId: this.form.centerExamPaperId});
}
const params = {
attendanceDays: this.form.attendanceDays,
classId:this.form.classId,
termBeginDate: this.form.termBeginDate,
termEndDate: this.form.termEndDate,
prdParams: prdParams
};
this.exportData = {
classId: '',
localLessonId: ''
};
exportStudentResults(ProjectCode[this.project], params).then(resp => {
this.tableData = [];
this.showLocal = false;
this.showCenter = false;
this.exportData = {
classId: params.classId
};
resp.data.forEach((item, index) => {
let localExamSocreRadio = -1;
let localLessonPassRate = -1;
let centerExamSocreRadio = -1;
let centerLessonPassRate = -1;
let totolScore = 0;
item.scores.forEach(elem => {
if (elem.prdType === '01') {
this.showLocal = true;
localExamSocreRadio = elem.examSocreRadio * 100 * 60 / 100 / item.scores.length;
localLessonPassRate = elem.lessonPassRate * 100 * 30 / 100 / item.scores.length;
totolScore += localExamSocreRadio;
totolScore += localLessonPassRate;
} else if (elem.prdType === '02') {
this.showCenter = true;
centerExamSocreRadio = elem.examSocreRadio * 100 * 60 / 100 / item.scores.length;
centerLessonPassRate = elem.lessonPassRate * 100 * 30 / 100 / item.scores.length;
totolScore += centerExamSocreRadio;
totolScore += centerLessonPassRate;
}
});
totolScore += item.attendance * 100 * 10 / 100;
this.tableData.push(
{
index: index + 1,
name: item.name,
studentID: item.studentID,
attendance: item.attendance * 100 * 10 / 100,
localExamSocreRadio:localExamSocreRadio,
localLessonPassRate: localLessonPassRate,
centerExamSocreRadio: centerExamSocreRadio,
centerLessonPassRate: centerLessonPassRate,
totolScore: totolScore
});
});
}).catch(() =>{
this.$message.error('获取学生考试成绩失败!');
});
} else {
this.$messageBox('您至少需选择一种产品类型下的课程与考试!');
}
}
});
},
localLessonChange(lessonId) {
this.localExamPaperList = [];
if (lessonId) {
getExamList({lessonId:lessonId, pageSize:999, pageNum:1}).then(resp => {
this.localExamPaperList = resp.data.list;
}).catch(()=> {
this.$message.error('获取试卷列表失败!');
});
}
},
centerLessonChange(lessonId) {
this.centerExamPaperList = [];
if (lessonId) {
getExamList({lessonId:lessonId, pageSize:999, pageNum:1}).then(resp => {
this.centerExamPaperList = resp.data.list;
}).catch(()=> {
this.$message.error('获取试卷列表失败!');
});
}
},
getLessonByClassId(classId) {
getLessonByClassId(classId).then(resp => {
}).catch(()=> {
});
this.lessonList = [];
if (classId) {
getLessonByClassId(classId).then(resp => {
this.lessonList = resp.data;
this.lessonList.forEach(item => {
if (item.prdType === '01') {
this.localExamPaperList.push(item);
} else if (item.prdType === '02') {
this.centerLessonList.push(item);
}
});
}).catch(()=> {
this.$message.error('获取课程列表失败!');
});
}
},
handleImportResults(file) {
const studentData = { className: '', students:[] };
const project = getSessionStorage('project');
if (file) {
setTimeout(() => {
const that = this;
@ -217,13 +397,13 @@ export default {
const className = dataList[0][2].split(' ')[0].replace(/\s*/g, '').split('')[1];
studentData.className = className;
for ( let i = 5; i <= dataList[0].length; i++) {
if (dataList[0][i] && dataList[1][i]) {
students.push({studentID:dataList[0][i], name: dataList[1][i]});
if (dataList[2][i] && dataList[1][i]) {
students.push({studentID:dataList[2][i], name: dataList[1][i]});
}
}
studentData.students = students;
}
importnStudentResults(ProjectCode[project], studentData).then(resp => {
importStudentResults(ProjectCode[that.project], studentData).then(resp => {
that.$message.success('学生成绩导入成功!');
}).catch(error => {
that.$message.error('学生成绩导入失败!');
@ -246,7 +426,184 @@ export default {
},
exportResults() {
if (!this.tableData || !this.tableData.length) {
this.$message.error('暂无导出数据!');
return;
}
let className = '';
this.classList.forEach(item => {
if (item.id === this.exportData.classId) {
className = item.name;
}
});
const wb = XLSX.utils.book_new();
let cellNum = 0;
let data = [{A:'贵 州 装 备 制 造 职 业 学 院'}, {A:'实 训 成 绩 登 记 表'}, {A:`班级:${className} 实训课程名称: 20XX 学年 第 学期 `}];
const data1 = [{A: '序号', B: '姓名', C:'学号', D:'考勤(10分)', E: '技能操作(30分)', F: '', G: '考试成绩(60分)', H: '', I: '期末成绩', J: '备注'}, {E: 'ATS现地(15分)', F: 'ATS行调(15分)', G: 'ATS现地(30分)', H: 'ATS行调(30分)'}];
const data2 = [{A: '序号', B: '姓名', C:'学号', D:'考勤(10分)', E: '技能操作(30分)', F: '考试成绩(60分)', G: '期末成绩', H: '备注'}, { E: 'ATS现地(30分)', F: 'ATS现地(60分)'}];
const data3 = [{A: '序号', B: '姓名', C:'学号', D:'考勤(10分)', E: '技能操作(30分)', F: '考试成绩(60分)', G: '期末成绩', H: '备注'}, {E: 'ATS行调(30分)', F: 'ATS行调(60分)'}];
if (this.showCenter && this.showLocal) {
data = [...data, ...data1];
cellNum = 9;
this.tableData.forEach(item => {
data.push({
A: item.index,
B: item.name,
C: item.studentID,
D: item.attendance,
E: item.localLessonPassRate,
F: item.centerLessonPassRate,
G: item.localExamSocreRadio,
H: item.centerExamSocreRadio,
I: item.totolScore,
J: ''
});
});
} else if (this.showCenter) {
data = [...data, ...data3];
cellNum = 7;
this.tableData.forEach(item => {
data.push({
A: item.index,
B: item.name,
C: item.studentID,
D: item.attendance,
E: item.centerLessonPassRate,
F: item.centerExamSocreRadio,
G: item.totolScore,
H: ''
});
});
} else if (this.showLocal) {
data = [...data, ...data2];
cellNum = 7;
this.tableData.forEach(item => {
data.push({
A: item.index,
B: item.name,
C: item.studentID,
D: item.attendance,
E: item.localLessonPassRate,
F: item.localExamSocreRadio,
G: item.totolScore,
H: ''
});
});
}
const ws = XLSX.utils.json_to_sheet(data, {skipHeader:true});
ws['A1'].s = { //
font: {
name: '宋体',
sz: 20,
color: {rgb: '#000000'},
bold: true,
italic: false,
underline: false
},
alignment: {
horizontal: 'center',
vertical: 'center'
}
};
ws['A2'].s = { //
font: {
name: '宋体',
sz: 16,
color: {rgb: '#000000'},
bold: true,
italic: false,
underline: false
},
alignment: {
horizontal: 'center',
vertical: 'center'
}
};
ws['A3'].s = { //
font: {
name: '宋体',
sz: 12,
color: {rgb: '#000000'},
bold: false,
italic: false,
underline: false
},
alignment: {
horizontal: 'center',
vertical: 'center'
}
};
ws['!merges'] = [
{
s: {c: 0, r: 0},
e: {c: cellNum, r: 0}
},
{
s: {c: 0, r: 1},
e: {c: cellNum, r: 1}
},
{
s: {c: 0, r: 2},
e: {c: cellNum, r: 2}
},
{
s: {c: 0, r: 3},
e: {c: 0, r: 4}
},
{
s: {c: 1, r: 3},
e: {c: 1, r: 4}
},
{
s: {c: 2, r: 3},
e: {c: 2, r: 4}
},
{
s: {c: 3, r: 3},
e: {c: 3, r: 4}
}
];
if (this.showCenter && this.showLocal) {
ws['!merges'].push({
s: {c: 4, r: 3},
e: {c: 5, r: 3}
});
ws['!merges'].push({
s: {c: 6, r: 3},
e: {c: 7, r: 3}
});
ws['!merges'].push({
s: {c: 8, r: 3},
e: {c: 8, r: 4}
});
ws['!merges'].push({
s: {c: 9, r: 3},
e: {c: 9, r: 4}
});
} else {
ws['!merges'].push({
s: {c: 6, r: 3},
e: {c: 6, r: 4}
});
ws['!merges'].push({
s: {c: 7, r: 3},
e: {c: 7, r: 4}
});
}
ws['!cols'] = [
{width: 10},
{width: 10},
{width: 10},
{width: 15},
{width: 15},
{width: 15},
{width: 15},
{width: 15},
{width: 15},
{width: 15}
];
XLSX.utils.book_append_sheet(wb, ws, 'file');
XLSX.writeFile(wb, '成绩单' + '.xlsx');
},
refresh() {
this.$refs.queryListPage.refresh(true);