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

新增组件问题修复

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