提交 585892a0 编写于 作者: huangwensu's avatar huangwensu

新增组件问题修复

上级 c84f99e6
......@@ -154,7 +154,7 @@
v-for="(itemTest,indexTest) in testIdSelect"
:key="indexTest"
:label="itemTest.onlineExamName"
:value="itemTest.id">
:value="itemTest.id + ''">
</el-option>
</el-select>
</el-form-item>
......@@ -178,7 +178,7 @@
v-for="(itemCertificate,indexCertificate) in certificateIdSelect"
:key="indexCertificate"
:label="itemCertificate.name"
:value="itemCertificate.id">
:value="itemCertificate.id + ''">
</el-option>
</el-select>
</el-form-item>
......@@ -206,7 +206,7 @@
v-for="(itemCourse,indexCourse) in courseIdSelect"
:key="indexCourse"
:label="itemCourse.name"
:value="itemCourse.id">
:value="itemCourse.id + ''">
</el-option>
</el-select>
</el-form-item>
......@@ -287,7 +287,7 @@ import BreadCrumb from '../../components/breadcrumb.vue'
import { doUpload, getFilePath } from "../../utils/qiniuUtil"
import { validateWord150 } from "../../utils/validate.js"
import { mapGetters } from 'vuex'
import { openLoading, closeLoading } from '../../utils/utils';
import { openLoading, closeLoading, isNotEmptyUtils } from '../../utils/utils';
let vm = null
// 判断组件是否重名
let validateRepeatWord = function(rule, value, callback, message) {
......@@ -385,6 +385,7 @@ export default {
dialogData: [],
portalComponent: {
idType: 1,
organizationId: '',
name: '',
id: '',
introduce: '',
......@@ -518,13 +519,13 @@ export default {
}else{
vm.isStorage = false
}
vm.submitBasic(url)
vm.submitBasic(flag,url)
}else{ // 下一步
vm.isStorage = false
vm.portalComponent.status = ''
vm.$refs.basicInfoForm.validate((valid) => {
if (valid) {
vm.submitBasic(url)
vm.submitBasic(flag,url)
} else {
return false;
}
......@@ -534,17 +535,20 @@ export default {
componentName() {
vm.isStorage = false
},
submitBasic(url) {
submitBasic(flag,url) {
vm.portalComponent.idType = vm.idType
vm.POST(url,{ model: vm.portalComponent }).then((res) => {
if( res.code == '000000') {
if(!vm.componentId) {
vm.componentId = res.data
}
vm.stepNum = 2
vm.getTemplateData()
vm.getModuleData()
vm.getTestListData()
vm.getCourseData()
if(flag == 2) {
vm.stepNum = 2
vm.getTemplateData()
vm.getModuleData()
vm.getTestListData()
vm.getCourseData()
}
}
})
},
......@@ -720,6 +724,7 @@ export default {
vm.templetIndex = vm.componentList.moduleModelList[index].templetModelList.length
vm.componentList.moduleModelList[index].templetModelList.push({
name: item.name,
type: item.type,
partModelList: []
})
for(let i = 0; i < item.partConfigModelList.length; i++) {
......@@ -757,8 +762,8 @@ export default {
partContentModelList: [{
id: '',
seqNo: '',
content_1: '',
content_2: ''
content1: '',
content2: ''
}]
})
}
......@@ -859,12 +864,12 @@ export default {
}
}
},
// 完成
// 完成(暂存)
finishConponent(flag) {
let req = null
if(vm.componentList.moduleModelList && vm.componentList.moduleModelList.length > 0) {
for(let i=0;i<vm.componentList.moduleModelList.length;i++) {
if(flag == 2) {
if(flag == 2) { // 完成
req = {
id: vm.componentId,
status: 2
......@@ -877,22 +882,22 @@ export default {
vm.$message.info("请给第"+ parseInt(i + 1) +"个模块添加有效模板后再保存")
return
}
}else{
}else{ // 暂存
req = {
id: vm.componentId,
status: 1
}
}
vm.componentList.moduleModelList[i].componentId = vm.componentId
vm.finishModule(req)
}
vm.finishModule(req,flag)
}else {
vm.$message.info("请添加有效模块后再保存")
return
}
},
finishModule(req) {
vm.POST('portalComponent/insertOrUpdatePortalModule',{model: vm.componentList.moduleModelList}).then((res) => {
finishModule(req, flag) {
vm.POST('portalComponent/insertOrUpdatePortalModule',{model: vm.componentList.moduleModelList,status: flag}).then((res) => {
if( res.code == '000000') {
vm.enableComponent(req)
}
......@@ -931,14 +936,14 @@ export default {
}
}
},
// 确定选择模板
// 确定选择预设模块
submitDialog() {
vm.columnFormVisible = false
let flag = false
if(vm.dialogData && vm.dialogData.length > 0) {
let flag = true
if(isNotEmptyUtils(vm.dialogData)) {
for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(vm.componentList.moduleModelList[i].id == vm.dialogData.id) {
flag = true
flag = false
vm.$confirm('该模块已经被添加到本组件,是否还需要再添加一次?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -946,7 +951,9 @@ export default {
type: 'warning'
}).then(() => {
vm.dialogData.moduleType = 2
vm.dialogData.mappingId = ''
vm.componentList.moduleModelList.push(vm.dialogData)
vm.firstTab = vm.componentList.moduleModelList.length + ''
}).catch(() => {
vm.$message({
type: 'info',
......@@ -956,9 +963,11 @@ export default {
break
}
}
if(!flag) {
if(flag) {
vm.dialogData.moduleType = 2
vm.dialogData.mappingId = ''
vm.componentList.moduleModelList.push(vm.dialogData)
vm.firstTab = vm.componentList.moduleModelList.length + ''
}
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册