提交 4a8e5ee6 编写于 作者: zhentian.jia's avatar zhentian.jia

证书分数校验问题

上级 29238f88
...@@ -273,6 +273,16 @@ export function getEcologySelect(data) { ...@@ -273,6 +273,16 @@ export function getEcologySelect(data) {
} }
return ecologyist; return ecologyist;
} }
export function isOverlap(startA,endA,startB,endB) {
let maxStart = Math.max(startA,startB);
let minEnd = Math.min(endA,endB);
console.log('maxStart',maxStart,'minEnd',minEnd);
if(maxStart <= minEnd) {
return true;
} else {
return false;
}
}
export function getRegionOption() { export function getRegionOption() {
let option = [{ let option = [{
value: 'zhejiang', value: 'zhejiang',
......
...@@ -616,6 +616,8 @@ ...@@ -616,6 +616,8 @@
v-model="formExam.certificateType" v-model="formExam.certificateType"
placeholder="请选择" placeholder="请选择"
style="width: 350px" style="width: 350px"
@change="updateCertificateType"
:disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"
> >
<el-option <el-option
v-for="item in certificateTypeList" v-for="item in certificateTypeList"
...@@ -633,6 +635,7 @@ ...@@ -633,6 +635,7 @@
placeholder="请选择证书" placeholder="请选择证书"
style="" style=""
@change="updateCertificate(index)" @change="updateCertificate(index)"
:disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"
> >
<el-option <el-option
v-for="item in optionsCertificate" v-for="item in optionsCertificate"
...@@ -649,21 +652,21 @@ ...@@ -649,21 +652,21 @@
</el-form-item> </el-form-item>
<el-form-item label="项目中最高"> <el-form-item label="项目中最高">
<el-col :span="3"> <el-col :span="3">
<el-input v-model="item.examCount"></el-input> <el-input v-model="item.examCount" @change="updateCount(index)" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-input>
</el-col> </el-col>
<el-col class="line" :span="3.5" > &nbsp 门考试平均分:</el-col> <el-col class="line" :span="3.5" > &nbsp 门考试平均分:</el-col>
<el-col :span="3"> <el-col :span="3">
<el-input v-model="item.rangeMin" @change="updateMin(index)"></el-input> <el-input v-model="item.rangeMin" @change="updateMin(index)" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-input>
</el-col> </el-col>
<el-col class="line" :span="1.5"> &nbsp 分~ &nbsp</el-col> <el-col class="line" :span="1.5"> &nbsp 分~ &nbsp</el-col>
<el-col :span="3"> <el-col :span="3">
<el-input v-model="item.rangeMax" @change="updateMax(index)"></el-input> <el-input v-model="item.rangeMax" @change="updateMax(index)" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-input>
</el-col> </el-col>
</el-form-item> </el-form-item>
</div> </div>
<el-form-item v-show="formExam.certificateType == 1" label="发放证书"> <el-form-item v-show="formExam.certificateType == 1" label="发放证书">
<el-select <el-select
v-model="formExam.certificate" v-model="formComponent.certificate"
placeholder="请选择证书" placeholder="请选择证书"
style="width: 350px" style="width: 350px"
:disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"
...@@ -880,8 +883,8 @@ export default { ...@@ -880,8 +883,8 @@ export default {
certificateType: 1, certificateType: 1,
exam: [{ exam: [{
examCount: 1, examCount: 1,
rangeMin: 100, rangeMin: '',
rangeMax: 100, rangeMax: '',
certificateId: '', certificateId: '',
certificateName: '', certificateName: '',
}] }]
...@@ -1253,17 +1256,24 @@ export default { ...@@ -1253,17 +1256,24 @@ export default {
certificateType: this.formExam.certificateType, certificateType: this.formExam.certificateType,
getCertificateRule: [], getCertificateRule: [],
}; };
let ruleData = vm.formExam.exam; // 2.多证书有规
for(let o=0;o<ruleData.length;o++) { if(this.formExam.certificateType == 2) {
param.certificateId[o] = ruleData[o].certificateId, let ruleData = vm.formExam.exam;
param.getCertificateRule[o] = { for(let o=0;o<ruleData.length;o++) {
certificateId: ruleData[o].certificateId, param.certificateId[o] = ruleData[o].certificateId,
certificateName: ruleData[o].certificateName, param.getCertificateRule[o] = {
examCount: ruleData[o].examCount, certificateId: ruleData[o].certificateId,
portalProjectId: this.projectId, certificateName: ruleData[o].certificateName,
rangeMax: ruleData[o].rangeMax, examCount: ruleData[o].examCount,
rangeMin: ruleData[o].rangeMin, portalProjectId: this.projectId,
rangeMax: ruleData[o].rangeMax,
rangeMin: ruleData[o].rangeMin,
}
} }
}
// 1.单证书无规则
else {
param.certificateId[0] = this.formComponent.certificate;
} }
vm.POST("portal/portalInfo/componentDraft", param).then(res => { vm.POST("portal/portalInfo/componentDraft", param).then(res => {
console.log(res); console.log(res);
...@@ -3056,46 +3066,71 @@ export default { ...@@ -3056,46 +3066,71 @@ export default {
}, },
addCertificate() { addCertificate() {
let obj = { let obj = {
num: 1, examCount: 1,
rangeMin: 100, rangeMin: '',
rangeMax: 100, rangeMax: '',
certificate: '', certificateId: '',
certificateName: '',
}; };
vm.formExam.exam.push(obj); vm.formExam.exam.push(obj);
}, },
reduceCertificate(index) { reduceCertificate(index) {
console.log(index); // console.log(index);
vm.formExam.exam.splice(index,1); if(vm.formExam.exam.length > 1) {
}, vm.formExam.exam.splice(index,1);
baseCheck(index) { } else {
vm.formExam.exam[index].rangeMin = parseInt(vm.formExam.exam[index].rangeMin); vm.$message('至少配置一个证书');
vm.formExam.exam[index].rangeMax = parseInt(vm.formExam.exam[index].rangeMax);
if(vm.formExam.exam[index].rangeMin > 100) {
vm.formExam.exam[index].rangeMin = 100;
} }
if(vm.formExam.exam[index].rangeMax > 100) { },
vm.formExam.exam[index].rangeMax = 100; //考试门数更新校验
updateCount(index) {
if(vm.formExam.exam[index].examCount) {
vm.formExam.exam[index].examCount = parseInt(vm.formExam.exam[index].examCount);
if(!Number.isInteger(vm.formExam.exam[index].examCount)){
vm.formExam.exam[index].examCount = '';
}
if(vm.formExam.exam[index].examCount <= 0) {
vm.formExam.exam[index].examCount = '';
}
} }
if(vm.formExam.exam[index].rangeMin < 0) { },
vm.formExam.exam[index].rangeMin = 0; //区间控制在0~100
baseCheck(index) {
if(vm.formExam.exam[index].rangeMin != '') {
vm.formExam.exam[index].rangeMin = parseInt(vm.formExam.exam[index].rangeMin);
if(vm.formExam.exam[index].rangeMin > 100) {
vm.formExam.exam[index].rangeMin = 100;
}
if(vm.formExam.exam[index].rangeMin < 0) {
vm.formExam.exam[index].rangeMin = 0;
}
} }
if(vm.formExam.exam[index].rangeMax < 0) { if(vm.formExam.exam[index].rangeMax != '') {
vm.formExam.exam[index].rangeMax = 0; vm.formExam.exam[index].rangeMax = parseInt(vm.formExam.exam[index].rangeMax);
if(vm.formExam.exam[index].rangeMax > 100) {
vm.formExam.exam[index].rangeMax = 100;
}
if(vm.formExam.exam[index].rangeMax < 0) {
vm.formExam.exam[index].rangeMax = 0;
}
} }
}, },
//区间不能有交集 //区间不能有交集
withoutUnion(index,type) { withoutUnion(index,type) {
let examList = vm.formExam.exam; let examList = vm.formExam.exam;
for(let i=0;i<examList.length;i++) { let nowMin = vm.formExam.exam[index].rangeMin;
if(index === i) { let nowMax = vm.formExam.exam[index].rangeMax;
break; console.log('nowMin',nowMin,'nowMax',nowMax);
} if(nowMin!=='' && nowMax!=='') {
if(vm.formExam.exam[index].rangeMax >= examList[i].rangeMin && for(let i=0;i<examList.length;i++) {
vm.formExam.exam[index].rangeMax <= examList[i].rangeMax) { if(index !== i && examList[i].rangeMin!=='' && examList[i].rangeMax!=='') {
if(type == 'max') { let overlapStatus = operationData.isOverlap(examList[i].rangeMin,examList[i].rangeMax,nowMin,nowMax);
vm.formExam.exam[index].rangeMax = vm.formExam.exam[index].rangeMin; if(overlapStatus === true) {//区间有交集
} else if(type == 'min') { vm.$message('设置分数区间不能重合');
vm.formExam.exam[index].rangeMin = vm.formExam.exam[index].rangeMax; vm.formExam.exam[index].rangeMin = '';
vm.formExam.exam[index].rangeMax = '';
// console.log('重合制空',vm.formExam.exam[index])
}
} }
} }
} }
...@@ -3103,23 +3138,30 @@ export default { ...@@ -3103,23 +3138,30 @@ export default {
updateMin(index) { updateMin(index) {
vm.baseCheck(index); vm.baseCheck(index);
if(!Number.isInteger(vm.formExam.exam[index].rangeMin)){ if(!Number.isInteger(vm.formExam.exam[index].rangeMin)){
vm.formExam.exam[index].rangeMin = vm.formExam.exam[index].rangeMax; vm.formExam.exam[index].rangeMin = '';
return;
}
// console.log('更新 nowMin',vm.formExam.exam[index].rangeMin,'nowMax',vm.formExam.exam[index].rangeMax);
if(vm.formExam.exam[index].rangeMin == '' || vm.formExam.exam[index].rangeMax == '') {
return; return;
} }
if(vm.formExam.exam[index].rangeMin > vm.formExam.exam[index].rangeMax) { if(vm.formExam.exam[index].rangeMin > vm.formExam.exam[index].rangeMax) {
vm.formExam.exam[index].rangeMin = vm.formExam.exam[index].rangeMax; vm.formExam.exam[index].rangeMin = vm.formExam.exam[index].rangeMax;
} }
vm.withoutUnion(index,'min')
}, },
updateMax(index) { updateMax(index) {
vm.baseCheck(index); vm.baseCheck(index);
if(!Number.isInteger(vm.formExam.exam[index].rangeMax)){ if(!Number.isInteger(vm.formExam.exam[index].rangeMax)){
// console.log('只能整数'); // console.log('只能整数');
vm.formExam.exam[index].rangeMax = vm.formExam.exam[index].rangeMin; vm.formExam.exam[index].rangeMax = '';
return;
}
if(vm.formExam.exam[index].rangeMin == '' || vm.formExam.exam[index].rangeMax == '') {
return; return;
} }
if(vm.formExam.exam[index].rangeMin > vm.formExam.exam[index].rangeMax) { if(vm.formExam.exam[index].rangeMin > vm.formExam.exam[index].rangeMax) {
vm.formExam.exam[index].rangeMax = vm.formExam.exam[index].rangeMin; vm.formExam.exam[index].rangeMax = vm.formExam.exam[index].rangeMin;
// console.log('max值',vm.formExam.exam[index].rangeMax);
} }
vm.withoutUnion(index,'max') vm.withoutUnion(index,'max')
}, },
...@@ -3131,10 +3173,59 @@ export default { ...@@ -3131,10 +3173,59 @@ export default {
break; break;
} }
} }
console.log('item',vm.formExam.exam[index])
}, },
//更新项目成绩评定条件
updateCertificateType() {
console.log('更新certificateType',vm.formExam.certificateType)
if(vm.formExam.certificateType == 2) {
vm.formExam.exam = [{
examCount: 1,
rangeMin: '',
rangeMax: '',
certificateId: '',
certificateName: '',
}];
} else if(vm.formExam.certificateType == 1) {
vm.formComponent.certificate = '';
}
},
//校验考试通过平均分配置
checkCertificate () { checkCertificate () {
//空判断
if(vm.formExam.certificateType == 2) {
let checkIdList = [];
for(let i=0;i<vm.formExam.exam.length;i++) {
checkIdList[i] = vm.formExam.exam[i].certificateId;
if(vm.formExam.exam[i].certificateId == ''){
vm.$message('证书不能为空');
return false;
}
if(vm.formExam.exam[i].examCount == ''){
vm.$message('考试门数不能为空');
return false;
}
if(vm.formExam.exam[i].rangeMin == '' || vm.formExam.exam[i].rangeMax == ''){
vm.$message('分数不能为空');
return false;
}
}
// 判断证书不能重复
checkIdList = checkIdList.sort();
for(let j=0;j<checkIdList.length-1;j++) {
if (checkIdList[j] == checkIdList[j+1]) {
vm.$message('证书不能重复选择');
return false;
}
}
} else if(vm.formExam.certificateType == 1) {
//组件通过即发放 证书必填
if(vm.formComponent.configure == 1 && vm.formExam.certificateType == 1) {
if(vm.formComponent.certificate == '') {
vm.$message('证书不能为空!');
return false;
}
}
}
return true; return true;
} }
} }
......
...@@ -58,18 +58,20 @@ export default { ...@@ -58,18 +58,20 @@ export default {
index: 'item-manager' index: 'item-manager'
}, },
] ]
},{ },
title: '学情报告', // {
icon: 'el-icon-document', // title: '学情报告',
index: 'report', // icon: 'el-icon-document',
subs: [ // index: 'report',
{ // subs: [
title: '项目列表', // {
icon: 'el-icon-setting', // title: '项目列表',
index: 'report-list' // icon: 'el-icon-setting',
} // index: 'report-list'
] // }
},{ // ]
// },
{
title: '系统管理', title: '系统管理',
icon: 'el-icon-menu', icon: 'el-icon-menu',
index: 'system', index: 'system',
...@@ -80,18 +82,19 @@ export default { ...@@ -80,18 +82,19 @@ export default {
index: 'role' index: 'role'
} }
] ]
},{ },
title: '学期报告', // {
icon: 'el-icon-menu', // title: '学情报告',
index: 'learning', // icon: 'el-icon-menu',
subs: [ // index: 'learning',
{ // subs: [
title: '项目列表', // {
icon: 'el-icon-setting', // title: '项目列表',
index: 'item-list' // icon: 'el-icon-setting',
}, // index: 'item-list'
] // },
} // ]
// }
] ]
} }
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册