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

新增和编辑模块接口联调

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