提交 282c77d6 编写于 作者: chendeli's avatar chendeli

edit 逻辑

上级 65346331
......@@ -78,14 +78,15 @@
</el-form-item>
</el-col>
</el-row>
<el-form-item v-if="hasCertificate" label="组件完成(%)" prop="certificateCondition">
<el-form-item label="组件完成(%)" prop="certificateCondition">
<el-input-number
v-model="portalComponent.certificateCondition"
controls-position="right"
@change="handleChange"
:disabled="componentStatus == 3 || componentStatus == 4"
:step="10"
:min="10"
:precision="0"
:step="1"
:min="0"
:max="100">
</el-input-number>
</el-form-item>
......@@ -107,6 +108,13 @@
<el-input v-model="item.name" @blur="moduleNameValidate(index)" :disabled="fieldDisabled(item)" size="small" placeholder="请选择模块名称" style="width:288px;"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<!-- <el-col :span="10">
<el-form-item label="模块名称" prop="name">
<el-input v-model="item.name" @blur="moduleNameValidate(index)" :disabled="fieldDisabled(item)" size="small" placeholder="请选择模块名称" style="width:288px;"></el-input>
</el-form-item>
</el-col> -->
<el-col :span="8" v-if="idType == 1">
<el-form-item label="是否对外开放" prop="openFlag">
<el-radio-group v-model="item.openFlag" @change="selectIsOpen(index)" :disabled="fieldDisabled(item) || item.openDisabled">
......@@ -115,6 +123,14 @@
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8" v-if="idType == 1">
<el-form-item label="通过标准" prop="passType">
<el-radio-group v-model="item.passType" @change="selectStandard(index)" :disabled="fieldDisabled(item) || item.openDisabled">
<el-radio :label="1">全部完成</el-radio>
<el-radio :label="2">无要求</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="6" v-if="idType == 1">
<el-form-item label="是否启用" prop="status">
<el-radio-group v-model="item.status" @change="selectIsOpenStatus(index)" :disabled="fieldDisabled(item)">
......@@ -405,14 +421,15 @@ export default {
imageUrl:'',
seqNo: '',
certificateId: '', // 0 没有证书,配置证书为否
certificateCondition: '60', // 证书完成率
certificateCondition: '100', // 证书完成率
status: ''
},
componentList: {
moduleModelList: [{
id: '',
name: '',
openFlag: '', // 1 否 不开放 2 是 开放
openFlag: '', // 1 否 不开放 2 是 开放,
passType:'1',//1:全部完成 2:无要求
templetModelList: []
}]
},
......@@ -510,6 +527,10 @@ export default {
})
}
},
selectStandard(index){
},
// 删除图片
deleteImg() {
vm.portalComponent.imageUrl = ''
......@@ -520,14 +541,19 @@ export default {
vm.portalComponent.certificateId = ''
if(val == '否') {
vm.hasCertificate = false
vm.portalComponent.certificateCondition = 0
//vm.portalComponent.certificateCondition = 0
}else{
vm.hasCertificate = true
vm.portalComponent.certificateCondition = 60
//vm.portalComponent.certificateCondition = 100
}
vm.portalComponent.certificateCondition = 100
},
// 获取组件完成率
handleChange(value) {
console.log(value)
if(value == 1){
}
vm.portalComponent.certificateCondition = value
},
// 获取证书下拉列表
......@@ -854,6 +880,7 @@ export default {
openFlag: 1, // 1不开放 2开放
moduleType: 1, // 2为从预设模块中添加
status: 1, // 1 不启用 2启用
passType:1,
templetModelList: []
});
vm.componentList.moduleModelList[(vm.componentList.moduleModelList.length - 1)].openDisabled = true;
......@@ -1397,5 +1424,3 @@ export default {
}
}
</style>
......@@ -756,33 +756,26 @@
>{{tag.name}}</el-tag>
</el-col>
</el-form-item>
<el-form-item label="学习时长控制:" class="time-contrl">
<el-form-item required label="学习时长:" class="time-contrl">
<el-col :span="10">
<el-radio-group class="el-time-ctr" v-model="formComponent.courseRequire" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6">
<el-radio :label="1">是(则项目中各课程须达到课程配置中的观看时长要求才允许通过)</el-radio>
<el-radio :label="1">是(必须达到课程配置的观看时长要求才算通过)</el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-col>
</el-form-item>
<el-form-item label="配置证书:">
<el-col :span="10">
<el-radio-group class="el-configure" v-model="formComponent.configure" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-col>
</el-form-item>
</el-form>
<el-form
ref="formExam"
label-width="150px"
:model="formExam"
class="achievement"
v-show="formComponent.configure == 1"
>
<el-form-item label="项目成绩评定条件">
<el-form-item required label="项目通过标准">
<el-select
v-model="formExam.certificateType"
v-model="formExam.passType"
placeholder="请选择"
style="width: 350px"
@change="updateCertificateType"
......@@ -796,30 +789,92 @@
></el-option>
</el-select>
</el-form-item>
<div v-show="formExam.certificateType == 2" v-for="(item , index) in formExam.exam" :key="index">
<el-form-item label="发放证书">
<el-col :span="6">
<el-select
v-model="item.certificateId"
placeholder="请选择证书"
style=""
@change="updateCertificate(index)"
:disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"
>
<el-option
v-for="item in optionsCertificate"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-col>
<el-col :span="3">
<el-button @click="addCertificate" icon="el-icon-plus" circle></el-button>
<el-button @click="reduceCertificate(index)" icon="el-icon-minus" circle></el-button>
</el-col>
</el-form-item>
<el-form-item label="项目中最高">
<el-form-item required label="累计学习时长大于等于:" v-show="formExam.passType == 3">
<el-input placeholder="请输入" v-model="formComponent.passTotalLearnTime" style="width:200px">
<template slot="append">分钟</template>
</el-input>
</el-form-item>
<!--add 选择平均分展示-->
<div class="mleft60" v-show="formExam.passType == 2">
<div class="mini-source">
<div class="source-item">
项目中最高&nbsp;
<el-input placeholder="请输入数字" size="mini" v-model="formComponent.passExamCount" style="width:150px">
<template slot="append"></template>
</el-input>
&nbsp;考试成绩的平均分大于等于&nbsp;
<el-input placeholder="请输入数字" size="mini" v-model="formComponent.passAverageScore" style="width:150px">
<template slot="append"></template>
</el-input>
&nbsp;则项目通过
</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">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-col>
</el-form-item>
<!--edit 选择配置证书展示-->
<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">
<template slot="append"></template>
</el-input>
&nbsp;~&nbsp;
<el-input placeholder="请输入数字" size="mini" v-model="item.rangeMax" style="width:215px">
<template slot="append"></template>
</el-input>
</div>
<div class="configure-item">
<span class="configure-item-l">发放证书:</span>
<el-select
v-model="item.certificateId"
placeholder="请选择证书"
size="mini"
style="width: 450px;"
@change="updateCertificate(index)"
:disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"
>
<el-option
v-for="item in optionsCertificate"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</div>
<!-- <el-form-item label="发放证书" style="width:100px;">
<el-col :span="3">
<el-button @click="addCertificate" icon="el-icon-plus" circle></el-button>
<el-button @click="reduceCertificate(index)" icon="el-icon-minus" circle></el-button>
</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>
</div>
</div>
</div>
<!-- <el-form-item label="项目中最高">
<el-col :span="3">
<el-input v-model="item.examCount" @change="updateCount(index)" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-input>
</el-col>
......@@ -831,9 +886,10 @@
<el-col :span="3">
<el-input v-model="item.rangeMax" @change="updateMax(index)" :disabled="projectStatus == 3 || projectStatus == 4 || projectStatus == 5 || projectStatus == 6"></el-input>
</el-col>
</el-form-item>
</el-form-item> -->
</div>
<el-form-item v-show="formExam.certificateType == 1" label="发放证书">
<el-form-item required v-show="formComponent.configure == 1 && (formExam.passType == 1 || formExam.passType == 3)" label="发放证书">
<el-select
v-model="formComponent.certificate"
placeholder="请选择证书"
......@@ -1055,6 +1111,9 @@ export default {
configure: 2,
certificate: "",
courseRequire: 0, //0:不控制 1:按课程时长配置要求
passExamCount:'',
passAverageScore:'',
passTotalLearnTime:''
},
tagsComponent: [],
projectStatus: "",
......@@ -1063,6 +1122,7 @@ export default {
//考试数据
formExam: {
certificateType: 1,
passType:1,
exam: [{
examCount: 1,
rangeMin: '',
......@@ -1072,14 +1132,19 @@ export default {
}]
},
certificateTypeList: [
{
label: '所有组件通过',
value: 1,
},
{
label: '根据平均分发证书',
label: '根据平均分设定',
value: 2,
},
{
label: '所有组件通过即发放',
value: 1,
}
label: '根据项目内学习时长设定',
value: 3,
},
],
visibleName: false,
organizationContent: '',
......@@ -1320,7 +1385,11 @@ export default {
}
//初始化考试平均分配置数据
this.formExam.certificateType = editData.projectData.certificateType;
this.formExam.passType = editData.projectData.passType;
this.formExam.exam = editData.certificateRule;
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 > 0 ? editData.projectData.passTotalLearnTime : ''
if(this.formExam.exam.length == 0) {
this.formExam.exam = [{
examCount: 1,
......@@ -1528,14 +1597,23 @@ export default {
projectId: this.projectId,
type: type,
status: this.projectStatus,
certificateType: this.formExam.certificateType,
certificateType: this.formExam.passType == 2 ? 2 : 1,
getCertificateRule: [],
courseRequire: this.formComponent.courseRequire,
passType:this.formExam.passType
};
if(this.formExam.passType == 2){
param.passAverageScore = this.formComponent.passAverageScore
param.passExamCount = this.formComponent.passExamCount
}
if(this.formExam.passType == 3){
param.passTotalLearnTime = this.formComponent.passTotalLearnTime
}
// console.log('排序后',vm.tagsComponent,'param',param);
if(this.formComponent.configure == 1) {
// 2.多证书有规
if(this.formExam.certificateType == 2) {
if(this.formExam.passType == 2) {
let ruleData = vm.formExam.exam;
for(let o=0;o<ruleData.length;o++) {
if(ruleData[o].certificateId != '' && ruleData[o].certificateId != null) {
......@@ -1552,11 +1630,11 @@ export default {
}
}
// 1.单证书无规则
else {
if(this.formComponent.certificate != '' && this.formComponent.certificate != null) {
param.certificateId[0] = this.formComponent.certificate;
}
}
else {
if(this.formComponent.certificate != '' && this.formComponent.certificate != null) {
param.certificateId[0] = this.formComponent.certificate;
}
}
}
vm.POST("portal/portalInfo/componentDraft", param).then(res => {
console.log(res);
......@@ -3071,6 +3149,9 @@ export default {
// }
},
addCertificate() {
if(vm.formExam.exam.length == 5){
return;
}
let obj = {
examCount: 1,
rangeMin: '',
......@@ -3185,6 +3266,11 @@ export default {
}
}
},
// add 校验输入是否为整数
checkIntFun(str){
let r = /^\+?[0-9]*$/;
return r.test(str);
},
//更新项目成绩评定条件
updateCertificateType() {
console.log('更新certificateType',vm.formExam.certificateType)
......@@ -3200,52 +3286,182 @@ export default {
vm.formComponent.certificate = '';
}
},
//校验分数是否存在交叉
checkCrossFun(d){
let isRepart = false;
//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){
isRepart = true;
//alert(isRepart)
break;
}
}
}
return isRepart
},
//校验考试通过平均分配置
checkCertificate () {
if(vm.formComponent.configure == 2) {
return true;
// if(vm.formComponent.configure == 2) {
// return true;
// }
if(vm.formExam.passType == 2) {
if(vm.formComponent.passExamCount == ''){
this.$message({
message: '项目最高门数不能为空!',
type: 'warning'
});
return false;
}
if(!vm.checkIntFun(parseInt(vm.formComponent.passExamCount))){
this.$message({
message: '项目最高门数只能是数字!',
type: 'warning'
});
return false;
}
if(vm.formComponent.passAverageScore == ''){
this.$message({
message: '项目通过分数不能为空!',
type: 'warning'
});
return false;
}
if(!vm.checkIntFun(vm.formComponent.passAverageScore)){
this.$message({
message: '项目通过分数只能是数字!',
type: 'warning'
});
return false;
}
}
if(vm.formExam.passType == 3){
if(vm.formComponent.passTotalLearnTime === ''){
this.$message({
message: '学习时长不能为空',
type: 'warning'
});
return false;
}
if(!vm.checkIntFun(vm.formComponent.passTotalLearnTime)){
this.$message({
message: '学习时长只能是数字!',
type: 'warning'
});
return false;
}
if(vm.formComponent.passTotalLearnTime == 0){
this.$message({
message: '学习时长必须大于0',
type: 'warning'
});
return false;
}
}
console.log(vm.formExam.exam)
//空判断
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('考试门数不能为空');
if(vm.formComponent.configure == 1) {
if(vm.formExam.passType == 2){
let checkIdList = [];
let isCross = vm.checkCrossFun(vm.formExam.exam);
if(isCross){
this.$message({
message: '分数段之间不能有交叉重合分数',
type: 'warning'
});
return false;
}
if(vm.formExam.exam[i].rangeMin == '' || vm.formExam.exam[i].rangeMax == ''){
vm.$message('分数不能为空');
return false;
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('证书不能为空');
this.$message({
message: '证书不能为空',
type: 'warning'
});
return false;
}
// if(vm.formExam.exam[i].examCount == ''){
// // vm.$message('考试门数不能为空');
// this.$message({
// message: '考试门数不能为空',
// type: 'warning'
// });
// return false;
// }
if(!vm.checkIntFun(vm.formExam.exam[i].rangeMax) || !vm.checkIntFun(vm.formExam.exam[i].rangeMin)){
this.$message({
message: '分数只能是整数',
type: 'warning'
});
return false;
}
if(vm.formExam.exam[i].rangeMin > vm.formExam.exam[i].rangeMax){
this.$message({
message: '分数最小值不能大于最大值',
type: 'warning'
});
return false;
}
if(vm.formExam.exam[i].rangeMin == '' || vm.formExam.exam[i].rangeMax == ''){
//vm.$message('分数不能为空');
this.$message({
message: '分数不能为空',
type: 'warning'
});
return false;
}
}
}
// 判断证书不能重复
checkIdList = checkIdList.sort();
for(let j=0;j<checkIdList.length-1;j++) {
if (checkIdList[j] == checkIdList[j+1]) {
vm.$message('证书不能重复选择');
return false;
// 判断证书不能重复
checkIdList = checkIdList.sort();
for(let j=0;j<checkIdList.length-1;j++) {
if (checkIdList[j] == checkIdList[j+1]) {
//vm.$message('证书不能重复选择');
this.$message({
message: '证书不能重复选择',
type: 'warning'
});
return false;
}
}
}
// 考试门数必须相同
for(let i=0;i<vm.formExam.exam.length-1;i++) {
if (vm.formExam.exam[i].examCount != vm.formExam.exam[i+1].examCount) {
vm.$message('考试门数必须相同');
// 考试门数必须相同
// for(let i=0;i<vm.formExam.exam.length-1;i++) {
// if (vm.formExam.exam[i].examCount != vm.formExam.exam[i+1].examCount) {
// // vm.$message('考试门数必须相同');
// this.$message({
// message: '考试门数必须相同',
// type: 'warning'
// });
// return false;
// }
// }
}else{
if(this.formComponent.certificate == ''){
this.$message({
message: '考试门数不能为空',
type: 'warning'
});
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;
}
}
// if(vm.formComponent.configure == 1 && vm.formExam.certificateType == 1) {
// if(vm.formComponent.certificate == '') {
// vm.$message('证书不能为空!');
// return false;
// }
// }
}
return true;
},
......@@ -3613,6 +3829,33 @@ export default {
.rim {
border: 1px solid #dddddd;
}
.mleft60{
margin-left:60px;
}
.soure-configure{
background: #F9F9F9;padding:15px;width:550px;font-size: 12px;color:#606266;position:relative;margin-bottom:20px;
.configure-option{
position: absolute;
right: -95px;
top:50%;
margin-top:-15px;
}
.mb15{margin-bottom:15px}
.configure-item{
.configure-item-l{
display: inline-block;
width:60px;
text-align: right;
}
}
}
.mini-source{
background: #F9F9F9;width:650px;padding:15px;
margin-bottom:20px;
.source-item{
padding-top:0px;font-size:12px;line-height: 28px;color: #606266;
}
}
.step-content {
overflow: hidden;
height: 60px;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册