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

新增和编辑模块接口联调

上级 67cb46c3
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</div> </div>
<div class="tab-content"> <div class="tab-content">
<el-tabs type="card" v-model="firstTab" closable @tab-remove="removeTab"> <el-tabs type="card" v-model="firstTab" closable @tab-remove="removeTab">
<el-tab-pane v-for="(item,index) in componentList.moduleList" :key="index" :label="'模块' + parseInt(index + 1)" :name='"" + parseInt(index + 1)'> <el-tab-pane v-for="(item,index) in componentList.moduleModelList" :key="index" :label="'模块' + parseInt(index + 1)" :name='"" + parseInt(index + 1)'>
<div> <div>
<el-form ref="moduleForm" :model="item" :rules="rules" label-suffix=":" label-width="130px" style="width:100%;"> <el-form ref="moduleForm" :model="item" :rules="rules" label-suffix=":" label-width="130px" style="width:100%;">
<el-row> <el-row>
...@@ -108,13 +108,15 @@ ...@@ -108,13 +108,15 @@
</el-form> </el-form>
<div class="template-btn"> <div class="template-btn">
<span class="word-size">添加一个模板</span> <span class="word-size">添加一个模板</span>
<el-button type="primary" size="small" @click="addTest(index)" style="margin-left:0;">单个考试</el-button> <el-button
<el-button type="primary" size="small" @click="addCourse(index)" style="margin-left:0;">单个课程</el-button> v-for="(_item,_index) in templateDataList"
<el-button type="primary" size="small" @click="addMatterTest(index)" style="margin-left:0;">摸底考试后培训</el-button> :key="_index"
<el-button type="primary" size="small" @click="addTrainTest(index)" style="margin-left:0;">培训后考试</el-button> type="primary"
<el-button type="primary" size="small" @click="addMatterTrain(index)" style="margin-left:0;">摸底考试获得资格,培训再次考试</el-button> size="small"
@click="addTemplate(_item,index,_index)"
style="margin-right:0px;">{{_item.name}}</el-button>
</div> </div>
<div v-for="(item1,index1) in item.templateList" :key="index1"> <div v-for="(item1,index1) in item.templetModelList" :key="index1">
<el-form ref="templateForm" :model="item1" :rules="templateRules" label-suffix=":" label-width="130px" style="width:100%;"> <el-form ref="templateForm" :model="item1" :rules="templateRules" label-suffix=":" label-width="130px" style="width:100%;">
<div class="template-content"> <div class="template-content">
<div class="template-content-div"> <div class="template-content-div">
...@@ -127,7 +129,7 @@ ...@@ -127,7 +129,7 @@
<i class="el-icon-delete" @click="deleteTemplate(index,index1)" style="color:red;"></i> <i class="el-icon-delete" @click="deleteTemplate(index,index1)" style="color:red;"></i>
</span> </span>
</div> </div>
<div v-for="(item2,index2) in item1.partList" :key="index2"> <div v-for="(item2,index2) in item1.partModelList" :key="index2">
<!-- 考试 --> <!-- 考试 -->
<div v-if="item2.type == 1"> <div v-if="item2.type == 1">
<el-row> <el-row>
...@@ -160,7 +162,7 @@ ...@@ -160,7 +162,7 @@
</div> </div>
<!-- 课程 --> <!-- 课程 -->
<div v-if="item2.type == 2"> <div v-if="item2.type == 2">
<el-row v-for="(item3,index3) in item2.partContentList" :key="index3"> <el-row v-for="(item3,index3) in item2.partContentModelList" :key="index3">
<el-col :span="10"> <el-col :span="10">
<el-form-item label="课程名称" prop="name"> <el-form-item label="课程名称" prop="name">
<el-input v-model="item3.name" size="mini" placeholder="请输入课程名称" style="width:288px;"></el-input> <el-input v-model="item3.name" size="mini" placeholder="请输入课程名称" style="width:288px;"></el-input>
...@@ -246,6 +248,8 @@ export default { ...@@ -246,6 +248,8 @@ export default {
title: '模块 1', title: '模块 1',
name: '1' name: '1'
}], }],
templateDataList: [],
templetIndex: 0,
componentList: { componentList: {
name: '', name: '',
id: '', id: '',
...@@ -254,10 +258,12 @@ export default { ...@@ -254,10 +258,12 @@ export default {
seqNo: '', seqNo: '',
certificateId: '', // 0 没有证书 certificateId: '', // 0 没有证书
certificateCondition: '60', certificateCondition: '60',
moduleList: [{ moduleModelList: [{
name: '', name: '',
openFlag: '', // 1不开放 2开放 openFlag: '', // 1不开放 2开放
templateList: [] templetModelList: [
]
}] }]
}, },
resourceArray: [], resourceArray: [],
...@@ -324,6 +330,8 @@ export default { ...@@ -324,6 +330,8 @@ export default {
// 下一步 // 下一步
nextStep() { nextStep() {
vm.stepNum = 2 vm.stepNum = 2
vm.getTemplateData()
vm.getModuleData()
}, },
// 上传组件图片 // 上传组件图片
beforeAvatarUpload(file) { beforeAvatarUpload(file) {
...@@ -362,6 +370,22 @@ export default { ...@@ -362,6 +370,22 @@ export default {
// 获取组件完成率 // 获取组件完成率
handleChange(value) { handleChange(value) {
},
// 获取默认模板
getTemplateData() {
vm.GET('/portalComponent/TempletConfigList').then((res) => {
if( res.code == '000000') {
vm.templateDataList = res.data.templetConfigModelList
}
})
},
// 通过编辑获取模块信息
getModuleData() {
vm.GET('/portalComponent/ModuleList').then((res) => {
if( res.code == '000000') {
vm.componentList.moduleModelList = res.data.moduleModelList
}
})
}, },
// 是否对外开放 // 是否对外开放
selectIsOpen() { selectIsOpen() {
...@@ -369,128 +393,85 @@ export default { ...@@ -369,128 +393,85 @@ export default {
}, },
// 删除tab // 删除tab
removeTab(targetName) { removeTab(targetName) {
vm.componentList.moduleList.splice(targetName - 1,1) vm.componentList.moduleModelList.splice(targetName - 1,1)
}, },
// 添加空白模块 // 添加空白模块
addModule() { addModule() {
let seq = vm.componentList.moduleList.length + 1 let seq = vm.componentList.moduleModelList.length + 1
vm.componentList.moduleList.push({ vm.componentList.moduleModelList.push({
name: '', name: '',
openFlag: '', // 1不开放 2开放 openFlag: '', // 1不开放 2开放
templateList: [] templetModelList: []
}) })
}, },
// 从模板中添加 // 从模板中添加
addFromModule() { addFromModule() {
vm.columnFormVisible = true vm.columnFormVisible = true
}, },
// 添加单个考试 // 添加模板
addTest(index) { addTemplate(item,index,_index) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) { vm.templetIndex = vm.componentList.moduleModelList[index].templetModelList.length
if(index == i) { vm.componentList.moduleModelList[index].templetModelList.push({
vm.componentList.moduleList[i].templateList.push({ name: item.name,
name: '单个考试', partModelList: []
partList: [{ })
for(let i = 0; i < item.partConfigModelList.length; i++) {
if(item.partConfigModelList[i].type == 1) { // 考试
vm.componentList.moduleModelList[index].templetModelList[vm.templetIndex].partModelList.push({
titleName: '', titleName: '',
type: 1, // 1考试 2课程 type: 1, // 1考试 2课程
name: '', name: '',
id: '', // 新增时为空 id: '', // 新增时为空
seqNo: '', seqNo: '',
conditionFlag: 1, // 1为没有限制 2有限制 conditionFlag: item.partConfigModelList[i].conditionFlag, // 1为没有限制 2有限制
numFlag: 1, // 1为单个 2为可以无限添加 numFlag: item.partConfigModelList[i].numFlag, // 1为单个 2为可以无限添加
templetSeqNo: '', templetSeqNo: '',
partContentList: [{ partContentModelList: [{
id: '',
}]
}]
})
}
}
},
// 添加单个课程
addCourse(index) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) {
if(index == i) {
vm.componentList.moduleList[i].templateList.push({
name: '单个课程',
partList:[{
titleName: '',
type: 2, // 1考试 2课程
name: '',
id: '', // 新增时为空
seqNo: '', seqNo: '',
conditionFlag: 1, // 1为没有限制 2有限制 content_1: '',
numFlag: 1, // 1为单个 2为可以无限添加 content_2: ''
templetSeqNo: '',
partContentList: [{
}]
}] }]
}) })
} }else if(item.partConfigModelList[i].type == 2) { // 课程
} vm.componentList.moduleModelList[index].templetModelList[vm.templetIndex].partModelList.push({
},
//摸底考试后培训
addMatterTest(index) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) {
if(index == i) {
vm.componentList.moduleList[i].templateList.push({
name: '摸底考试后培训',
partList: [{
titleName: '',
type: 1, // 1考试 2课程
name: '',
id: '', // 新增时为空
seqNo: '',
conditionFlag: 1, // 1为没有限制 2有限制
numFlag: 1, // 1为单个 2为可以无限添加
templetSeqNo: '',
partContentList: [{
}]
},{
titleName: '', titleName: '',
type: 2, // 1考试 2课程 type: 2, // 1考试 2课程
name: '', name: '',
id: '', // 新增时为空 id: '', // 新增时为空
seqNo: '', seqNo: '',
conditionFlag: 1, // 1为没有限制 2有限制 conditionFlag: item.partConfigModelList[i].conditionFlag, // 1为没有限制 2有限制
numFlag: 2, // 1为单个 2为可以无限添加 numFlag: item.partConfigModelList[i].numFlag, // 1为单个 2为可以无限添加
templetSeqNo: '', templetSeqNo: '',
partContentList: [{ partContentModelList: [{
id: '',
}] seqNo: '',
content_1: '',
content_2: ''
}] }]
}) })
} }
} }
}, vm.templetIndex ++
// 培训后考试
addTrainTest() {
},
// 摸底考试获得资格,培训再次考试
addMatterTrain() {
}, },
// 删除模板 // 删除模板
deleteTemplate(index,index1) { deleteTemplate(index,index1) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(index == i) { if(index == i) {
vm.componentList.moduleList[i].templateList.splice(index1,1) vm.componentList.moduleModelList[i].templetModelList.splice(index1,1)
break break
} }
} }
}, },
// 添加多个课程 // 添加多个课程
addMatterCourse(index,index1,index2) { addMatterCourse(index,index1,index2) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(index == i) { if(index == i) {
for(let j = 0; j < vm.componentList.moduleList[i].templateList.length; j++) { for(let j = 0; j < vm.componentList.moduleModelList[i].templetModelList.length; j++) {
if(index1 == j) { if(index1 == j) {
for(let q = 0; q < vm.componentList.moduleList[i].templateList[j].partList.length;q++){ for(let q = 0; q < vm.componentList.moduleModelList[i].templetModelList[j].partModelList.length;q++){
if(index2 == q) { if(index2 == q) {
vm.componentList.moduleList[i].templateList[j].partList[q].partContentList.push({ vm.componentList.moduleModelList[i].templetModelList[j].partModelList[q].partContentModelList.push({
id: '', id: '',
seqNo: '', seqNo: '',
content_1: '', content_1: '',
...@@ -508,13 +489,13 @@ export default { ...@@ -508,13 +489,13 @@ export default {
}, },
// 删除多个课程 // 删除多个课程
deleteMatterCourse(index,index1,index2,index3) { deleteMatterCourse(index,index1,index2,index3) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(index == i) { if(index == i) {
for(let j = 0; j < vm.componentList.moduleList[i].templateList.length; j++) { for(let j = 0; j < vm.componentList.moduleModelList[i].templetModelList.length; j++) {
if(index1 == j) { if(index1 == j) {
for(let q = 0; q < vm.componentList.moduleList[i].templateList[j].partList.length;q++){ for(let q = 0; q < vm.componentList.moduleModelList[i].templetModelList[j].partModelList.length;q++){
if(index2 == q) { if(index2 == q) {
vm.componentList.moduleList[i].templateList[j].partList[q].partContentList.splice(index3,1) vm.componentList.moduleModelList[i].templetModelList[j].partModelList[q].partContentModelList.splice(index3,1)
break break
} }
} }
...@@ -527,12 +508,12 @@ export default { ...@@ -527,12 +508,12 @@ export default {
}, },
// 模板下移 // 模板下移
sortUp(index,index1) { sortUp(index,index1) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(index == i) { if(index == i) {
if(index1 != vm.componentList.moduleList[i].templateList.length - 1) { // 判断是最后一个不能下移 if(index1 != vm.componentList.moduleModelList[i].templetModelList.length - 1) { // 判断是最后一个不能下移
let temp = vm.componentList.moduleList[i].templateList[index1] let temp = vm.componentList.moduleModelList[i].templetModelList[index1]
vm.$set(vm.componentList.moduleList[i].templateList,index1,vm.componentList.moduleList[i].templateList[index1 + 1]) vm.$set(vm.componentList.moduleModelList[i].templetModelList,index1,vm.componentList.moduleModelList[i].templetModelList[index1 + 1])
vm.$set(vm.componentList.moduleList[i].templateList,parseInt(index1+1),temp) vm.$set(vm.componentList.moduleModelList[i].templetModelList,parseInt(index1+1),temp)
} }
break break
} }
...@@ -540,12 +521,12 @@ export default { ...@@ -540,12 +521,12 @@ export default {
}, },
// 模板下移 // 模板下移
sortDown(index,index1) { sortDown(index,index1) {
for(let i = 0; i < vm.componentList.moduleList.length; i++) { for(let i = 0; i < vm.componentList.moduleModelList.length; i++) {
if(index == i) { if(index == i) {
if(index1 != 0) { // 判断是第一个不能上移 if(index1 != 0) { // 判断是第一个不能上移
let temp = vm.componentList.moduleList[i].templateList[index1] let temp = vm.componentList.moduleModelList[i].templetModelList[index1]
vm.$set(vm.componentList.moduleList[i].templateList,index1,vm.componentList.moduleList[i].templateList[index1 - 1]) vm.$set(vm.componentList.moduleModelList[i].templetModelList,index1,vm.componentList.moduleModelList[i].templetModelList[index1 - 1])
vm.$set(vm.componentList.moduleList[i].templateList,parseInt(index1-1),temp) vm.$set(vm.componentList.moduleModelList[i].templetModelList,parseInt(index1-1),temp)
} }
break break
} }
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<el-table-column label="操作" fixed="right" align="center" min-width="200"> <el-table-column label="操作" fixed="right" align="center" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="small" @click="editComponentList(scope.row)">编辑</el-button> <el-button type="primary" size="small" @click="editComponentList(scope.row)">编辑</el-button>
<el-button type="primary" size="small" disabled>启用</el-button> <el-button type="primary" size="small" @click="enable(scope.row)">启用</el-button>
<el-button type="primary" size="small">禁用</el-button> <el-button type="primary" size="small">禁用</el-button>
<el-button type="primary" size="small">删除</el-button> <el-button type="primary" size="small">删除</el-button>
</template> </template>
...@@ -113,12 +113,7 @@ export default { ...@@ -113,12 +113,7 @@ export default {
methods: { methods: {
// 列表查询 // 列表查询
search() { search() {
let req = { vm.GET('/portalComponent/queryPortalComponent',vm.searchParam).then((res) => {
name: '',
pageNo: 1,
pageSize: 15
}
vm.GET('/portalComponent/queryPortalComponent',req).then((res) => {
if( res.code == '000000' ) { if( res.code == '000000' ) {
vm.tableData = res.data.queryList vm.tableData = res.data.queryList
vm.totalRows = res.data.total vm.totalRows = res.data.total
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册