提交 4f0754c7 编写于 作者: chendeli's avatar chendeli

上架状态不可编辑 错误信息提示修改

上级 247f45e7
......@@ -783,7 +783,7 @@
class="achievement"
>
<el-form-item required label="项目通过标准">
<el-form-item required label="项目通过标准" :class="customError.standard.className">
<el-select
v-model="formExam.passType"
placeholder="请选择"
......@@ -798,32 +798,53 @@
:value="item.value"
></el-option>
</el-select>
<div class="el-form-item__error" v-if="customError.standard.error != ''">{{customError.standard.error}}</div>
</el-form-item>
<el-form-item required label="累计学习时长大于等于:" v-show="formExam.passType == 3">
<el-input placeholder="请输入" v-model="formComponent.passTotalLearnTime" style="width:200px">
<el-form-item required label="累计学习时长大于等于:" v-show="formExam.passType == 3" :class="customError.passTotalLearnTime.className">
<el-input placeholder="请输入" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6" v-model="formComponent.passTotalLearnTime" style="width:200px" @input="focusFun($event,'passTotalLearnTime')">
<template slot="append">分钟</template>
</el-input>
<div class="el-form-item__error" v-if="customError.passTotalLearnTime.error != ''">{{customError.passTotalLearnTime.error}}</div>
</el-form-item>
<!--add 选择平均分展示-->
<div v-show="formExam.passType == 2" >
<div class="mleft60" v-show="formExam.passType == 2">
<div class="mini-source">
<div class="mini-source" style="overflow: hidden;">
<el-form-item label="项目中最高" label-width="80px" style="float: left;" :class="customError.passExamCount.className" class="min-label">
<div class="source-item">
项目中最高&nbsp;
<el-input placeholder="请输入数字" size="mini" v-model="formComponent.passExamCount" style="width:150px" @input="focusFun($event,'passExamCount')">
<el-input placeholder="请输入数字" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6" size="mini" v-model="formComponent.passExamCount" style="width:150px" @input="focusFun($event,'passExamCount')">
<template slot="append"></template>
</el-input>
&nbsp;考试成绩的平均分大于等于&nbsp;
<el-input placeholder="请输入数字" size="mini" v-model="formComponent.passAverageScore" style="width:150px" @input="focusFun($event,'passAverageScore')">
</div>
<div class="el-form-item__error" v-if="customError.passExamCount.error != ''">{{customError.passExamCount.error}}</div>
</el-form-item>
<div style="float: left;padding:0 5px;line-height: 26px;font-size: 12px;color:#606266">考试成绩的平均分大于等于</div>
<el-form-item label="" label-width="0px" style="float: left;" :class="customError.passAverageScore.className" class="min-label">
<div class="source-item">
<el-input placeholder="请输入数字" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6" size="mini" v-model="formComponent.passAverageScore" style="width:150px" @input="focusFun($event,'passAverageScore')">
<template slot="append"></template>
</el-input>
&nbsp;则项目通过
</div>
<div class="el-form-item__error" v-if="customError.passAverageScore.error != ''">{{customError.passAverageScore.error}}</div>
</el-form-item>
<div style="float: left;padding:0 5px;line-height: 26px;font-size: 12px;color:#606266">则项目通过</div>
</div>
</div>
</div>
<el-form-item required label="配置证书:">
<el-col :span="10">
<el-radio-group class="el-configure" v-model="formComponent.configure" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6">
......@@ -838,19 +859,28 @@
<div v-show="formComponent.configure == 1 && formExam.passType == 2" v-for="(item , index) in formExam.exam" :key="index">
<div class="mleft60">
<div class="soure-configure">
<div class="configure-item mb15">
<span class="configure-item-l">平均分:</span>
<el-input placeholder="请输入数字" size="mini" v-model="item.rangeMin" style="width:215px" @input="focusFun($event,'rangeMin',index)">
<div class="configure-item">
<el-form-item label="平均分:" label-width="65px" style="float: left;" :class="item.minClass" class="min-label">
<el-col :span="5">
<el-input :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6" placeholder="请输入数字" size="mini" v-model="item.rangeMin" style="width:215px" @input="focusFun($event,'rangeMin',index)">
<template slot="append"></template>
</el-input>
&nbsp;~&nbsp;
<el-input placeholder="请输入数字" size="mini" v-model="item.rangeMax" style="width:215px" @input="focusFun($event,'rangeMax',index)">
</el-col>
<div class="el-form-item__error" v-if="item.minError">{{item.minError}}</div>
</el-form-item>
<div style="float: left;padding:0 5px;line-height: 26px;">~</div>
<el-form-item label-width="0" style="float: left;margin-left:0px;" :class="item.maxClass" class="min-label">
<el-col :span="5">
<el-input :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6" placeholder="请输入数字" size="mini" v-model="item.rangeMax" style="width:215px" @input="focusFun($event,'rangeMax',index)">
<template slot="append"></template>
</el-input>
</el-col>
<div class="el-form-item__error" v-if="item.maxError">{{item.maxError}}</div>
</el-form-item>
</div>
<div class="configure-item">
<span class="configure-item-l">发放证书:</span>
<el-form-item label="发放证书:" style="margin-left: -85px;" :class="item.certClass">
<el-select
v-model="item.certificateId"
placeholder="请选择证书"
......@@ -866,6 +896,9 @@
:value="item.value"
></el-option>
</el-select>
<div class="el-form-item__error" v-if="item.certError">{{item.certError}}</div>
</el-form-item>
</div>
......@@ -877,8 +910,8 @@
</el-col>
</el-form-item> -->
<div class="configure-option">
<el-button size="mini" @click="addCertificate" icon="el-icon-plus" circle></el-button>
<el-button size="mini" @click="reduceCertificate(index)" icon="el-icon-minus" circle></el-button>
<el-button size="mini" @click="addCertificate" icon="el-icon-plus" circle :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-button>
<el-button size="mini" @click="reduceCertificate(index)" icon="el-icon-minus" circle :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-button>
</div>
</div>
......@@ -899,7 +932,7 @@
</el-form-item> -->
</div>
<el-form-item required v-show="formComponent.configure == 1 && (formExam.passType == 1 || formExam.passType == 3)" label="发放证书">
<el-form-item required v-show="formComponent.configure == 1 && (formExam.passType == 1 || formExam.passType == 3)" label="发放证书" :class="customError.certificate.className">
<el-select
v-model="formComponent.certificate"
placeholder="请选择证书"
......@@ -913,6 +946,7 @@
:value="item.value"
></el-option>
</el-select>
<div class="el-form-item__error" v-if="customError.certificate.error != ''">{{customError.certificate.error}}</div>
</el-form-item>
</el-form>
</div>
......@@ -958,7 +992,28 @@ export default {
return {
idTypeValue: 1,
idTypeProject: '',
customError:{
standard:{
className:'',
error:''
},
certificate:{
className:'',
error:''
},
passTotalLearnTime:{
className:'',
error:''
},
passExamCount:{
className:'',
error:''
},
passAverageScore:{
className:'',
error:''
}
},
projectId: null,
peopleLevel: null,
//面包屑
......@@ -1220,7 +1275,12 @@ export default {
visitTime: [
{required: false, trigger: "change", validator: checkNormalInt,}
],
showRules1:[
{ required: true, message: "请输入门数", trigger: "blur" }
],
},
rules: {
projectName: [
{ required: true, message: "请输入项目名称", trigger: "blur" },
......@@ -1311,7 +1371,20 @@ export default {
}
if(parm == 'rangeMax' && parseInt(ev) > 100){
this.formExam.exam[index][parm] = "100"
}
if(ev != ''){
if(parm == 'rangeMax'){
this.formExam.exam[index].maxClass = ''
this.formExam.exam[index].maxError = ''
}
if(parm == 'rangeMin'){
this.formExam.exam[index].minClass = ''
this.formExam.exam[index].minError = ''
}
}
}else{
if(parseInt(ev) < 0 || !this.checkIntFun(ev)){
......@@ -1320,6 +1393,12 @@ export default {
if(parm == 'passAverageScore' && parseInt(ev) > 100){
this.formComponent[parm] = "100"
}
if(ev != ''){
this.customError[parm] = {
className:'',
error:''
}
}
}
},
//表单校验
......@@ -1418,6 +1497,17 @@ export default {
this.formExam.certificateType = editData.projectData.certificateType;
this.formExam.passType = editData.projectData.passType;
this.formExam.exam = editData.certificateRule;
if(this.formExam.exam.length > 0){
for(let k=0;k<this.formExam.exam.length;k++){
this.formExam.exam[k].certClass = ''
this.formExam.exam[k].certError = ''
this.formExam.exam[k].minClass = ''
this.formExam.exam[k].minError = ''
this.formExam.exam[k].maxClass = ''
this.formExam.exam[k].maxError = ''
}
}
console.log(this.formExam.exam)
this.formComponent.passAverageScore = editData.projectData.passAverageScore > 0 ? editData.projectData.passAverageScore : ''
this.formComponent.passExamCount = editData.projectData.passExamCount > 0 ? editData.projectData.passExamCount : ''
this.formComponent.passTotalLearnTime = editData.projectData.passTotalLearnTime
......@@ -1428,6 +1518,12 @@ export default {
rangeMax: '',
certificateId: '',
certificateName: '',
minClass:'',
minError:'',
maxClass:'',
maxError:'',
certClass:'',
certError:''
}]
}
},
......@@ -3190,6 +3286,12 @@ export default {
rangeMax: '',
certificateId: '',
certificateName: '',
minClass:'',
minError:'',
maxClass:'',
maxError:'',
certClass:'',
certError:''
};
vm.formExam.exam.push(obj);
},
......@@ -3297,6 +3399,8 @@ export default {
break;
}
}
vm.formExam.exam[index].certClass = ''
vm.formExam.exam[index].certError = ''
},
// add 校验输入是否为整数
checkIntFun(str){
......@@ -3313,6 +3417,12 @@ export default {
rangeMax: '',
certificateId: '',
certificateName: '',
minClass:'',
minError:'',
maxClass:'',
maxError:'',
certClass:'',
certError:''
}];
} else if(vm.formExam.passType == 1) {
vm.formComponent.certificate = '';
......@@ -3320,19 +3430,31 @@ export default {
},
//校验分数是否存在交叉
checkCrossFun(d){
let isRepart = false;
let isRepart = false,index = null;
//alert(d.length)
if( d.length > 0 ){
for(let i = 1;i < d.length;i++){
// console.log(d[i])
if(d[i].rangeMin < d[i-1].rangeMax && d[i].rangeMin > d[i-1].rangeMin || d[i-1].rangeMax > d[i].rangeMin && d[i-1].rangeMax < d[i].rangeMax || d[i].rangeMax > d[i-1].rangeMin && d[i].rangeMax < d[i-1].rangeMax){
isRepart = true;
index = i;
//alert(isRepart)
break;
}
}
}
return isRepart
return {isRepart:isRepart,index:index}
},
hideErrorInfo(str){
if(str){
this.customError[str] = {
className:'',
error:''
}
}else{
this.customError = {}
}
},
dioErrorPop(str){
......@@ -3351,16 +3473,19 @@ export default {
if(vm.formExam.passType == 2) {
if(vm.formComponent.passExamCount == ''){
return vm.dioErrorPop('项目最高门数不能为空')
this.customError.passExamCount = {
className:'is-error',
error:'请输入门数'
}
if(!vm.checkIntFun(parseInt(vm.formComponent.passExamCount))){
return vm.dioErrorPop('项目最高门数只能是数字')
return
}
if(vm.formComponent.passAverageScore == ''){
return vm.dioErrorPop('项目通过分数不能为空')
this.customError.passAverageScore = {
className:'is-error',
error:'请输入分数'
}
return
}
if(!vm.checkIntFun(vm.formComponent.passAverageScore)){
......@@ -3369,12 +3494,15 @@ export default {
}else if(vm.formExam.passType == 3){
if(vm.formComponent.passTotalLearnTime === '' || vm.formComponent.passTotalLearnTime == null){
return vm.dioErrorPop('学习时长不能为空')
vm.customError.passTotalLearnTime = {
className : 'is-error',
error : '请输入学习时长'
}
if(!vm.checkIntFun(vm.formComponent.passTotalLearnTime)){
return vm.dioErrorPop('学习时长只能是整数数字')
return
}
// this.hideErrorInfo('learnTime')
// if(vm.formComponent.passTotalLearnTime == 0){
// return vm.dioErrorPop('学习时长必须大于')
......@@ -3386,15 +3514,18 @@ export default {
if(vm.formExam.passType == 2){
let checkIdList = [];
let isCross = vm.checkCrossFun(vm.formExam.exam);
let isCross = vm.checkCrossFun(vm.formExam.exam).isRepart;
if(isCross){
return vm.dioErrorPop('分数段之间不能有交叉重合分数')
let l = vm.checkCrossFun(vm.formExam.exam).index
vm.formExam.exam[l].minClass = 'is-error'
vm.formExam.exam[l].minError = '分数段之间不能有交叉重合分数'
vm.formExam.exam[l-1].minClass = 'is-error'
vm.formExam.exam[l-1].minError = '分数段之间不能有交叉重合分数'
return
}
for(let i=0;i<vm.formExam.exam.length;i++) {
checkIdList[i] = vm.formExam.exam[i].certificateId;
if(vm.formExam.exam[i].certificateId == ''){
return vm.dioErrorPop('证书不能为空')
}
// if(vm.formExam.exam[i].examCount == ''){
// // vm.$message('考试门数不能为空');
// this.$message({
......@@ -3403,16 +3534,45 @@ export default {
// });
// return false;
// }
if(!vm.checkIntFun(vm.formExam.exam[i].rangeMax) || !vm.checkIntFun(vm.formExam.exam[i].rangeMin)){
return vm.dioErrorPop('分数只能是整数')
}
// if(!vm.checkIntFun(vm.formExam.exam[i].rangeMax) || !vm.checkIntFun(vm.formExam.exam[i].rangeMin)){
// return vm.dioErrorPop('分数只能是整数')
// }
if(vm.formExam.exam[i].rangeMin === '' ){
vm.formExam.exam[i].minClass = 'is-error'
vm.formExam.exam[i].minError = '请输入分数'
this.$set(vm.formExam, i, vm.formExam[i])
return
}
vm.formExam.exam[i].minClass = ''
vm.formExam.exam[i].minError = ''
if(vm.formExam.exam[i].rangeMax === '' ){
vm.formExam.exam[i].maxClass = 'is-error'
vm.formExam.exam[i].maxError = '请输入分数'
this.$set(vm.formExam, i, vm.formExam[i])
return
}
vm.formExam.exam[i].maxClass = ''
vm.formExam.exam[i].maxError = ''
if((vm.formExam.exam[i].rangeMin === '' || vm.formExam.exam[i].rangeMax === '') ){
console.log(vm.formExam.exam[i].rangeMin,vm.formExam.exam[i].rangeMax)
return vm.dioErrorPop('分数不能为空')
}
if(parseInt(vm.formExam.exam[i].rangeMin) > parseInt(vm.formExam.exam[i].rangeMax)){
return vm.dioErrorPop('分数最小值不能大于最大值')
vm.formExam.exam[i].minClass = 'is-error'
vm.formExam.exam[i].minError = '分数最小值不能大于最大值'
this.$set(vm.formExam, i, vm.formExam[i])
return
}
if(vm.formExam.exam[i].certificateId == ''){
vm.formExam.exam[i].certClass = 'is-error'
vm.formExam.exam[i].certError = '请选择证书'
this.$set(vm.formExam, i, vm.formExam[i])
return
}
vm.formExam.exam[i].certClass = ''
vm.formExam.exam[i].certError = ''
if(parseInt(vm.formComponent.passAverageScore) > parseInt(vm.formExam.exam[i].rangeMin)){
return vm.dioErrorPop('项目通过分数不能大于平均分')
}
}
// 判断证书不能重复
......@@ -3440,7 +3600,11 @@ export default {
// }
}else{
if(this.formComponent.certificate == ''){
return vm.dioErrorPop('证书不能为空')
vm.customError.certificate = {
className : 'is-error',
error : '请选择证书'
}
return;
}
}
......@@ -3812,6 +3976,14 @@ export default {
};
</script>
<style lang="scss">
.min-label{
.el-form-item__label{
line-height: 26px;
}
.el-form-item__content{
line-height: 26px;
}
}
.add-manager-wrap {
.add-content {
background: #fff;
......@@ -3832,6 +4004,7 @@ export default {
}
.mb15{margin-bottom:15px}
.configure-item{
overflow:hidden;
.configure-item-l{
display: inline-block;
width:60px;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册