更改新增 课程类别 用value组树
This commit is contained in:
parent
c8fa19d304
commit
cebe683a2a
|
@ -16,7 +16,7 @@
|
|||
<!-- 课程类别 -->
|
||||
<a-col :span="9" :offset="3">
|
||||
<a-form-model-item label="课程类别" :label-col="{ span: 8 }" :wrapper-col="{ span: 12 }">
|
||||
<a-tree-select v-model="form.courseType" :replaceFields="replaceFields" :tree-data="dictCourseType" placeholder="请选择课程类别"></a-tree-select>
|
||||
<a-tree-select v-model="form.courseType" :tree-data="dictCourseType" placeholder="请选择课程类别"></a-tree-select>
|
||||
|
||||
<!-- <a-select v-model="form.courseType" placeholder="--请选择--">
|
||||
<a-select-option v-for="(item, index) in dictCourseType" :key="index" :value="item.value">
|
||||
|
@ -104,10 +104,9 @@
|
|||
|
||||
|
||||
<script>
|
||||
import { coursewareClassList } from '@/api/course/courseware'
|
||||
// import { coursewareClassList } from '@/api/course/courseware'
|
||||
import { courseAdd, getCourseDetails } from '@/api/course/course'
|
||||
import storage from 'store'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
|
||||
import { dictToTree } from '@/utils/util'
|
||||
import DbUpload from '@/components/DbUpload/DbUpload.vue'
|
||||
|
@ -143,7 +142,6 @@ export default {
|
|||
getCourseDetails,
|
||||
},
|
||||
created() {
|
||||
this.getCourseTreeData(0) //进来首先获取系统课程
|
||||
this.dictionaryDropDown()
|
||||
if(this.$route.query.id) this.loadData();
|
||||
},
|
||||
|
@ -184,10 +182,10 @@ export default {
|
|||
this.industry = res.data
|
||||
})
|
||||
// 课程类别
|
||||
// dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
|
||||
// 词典转树结构
|
||||
// this.dictCourseType = dictToTree(res.data, [], 0)
|
||||
// })
|
||||
this.dictCourseType = dictToTree(res.data, [], 0)
|
||||
})
|
||||
// 人员类型
|
||||
dictionaryDropDown({ dictionaryCode: '0005' }).then((res) => {
|
||||
this.dictPerson = res.data
|
||||
|
@ -215,25 +213,25 @@ export default {
|
|||
},
|
||||
|
||||
|
||||
//获取课程分类数据,转换成树结构
|
||||
getCourseTreeData(type) {
|
||||
coursewareClassList({ type: type }).then((res) => {
|
||||
//list转🌲
|
||||
const list2tree1 = (list, parentId) => {
|
||||
return list.filter((item) => {
|
||||
// 默认选中第一个节点
|
||||
if (!this.treeDataOne) this.treeDataOne.push(item.value)
|
||||
if (item.parentId === parentId) {
|
||||
item.children = list2tree1(list, item.id)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
}
|
||||
this.dictCourseType = list2tree1(res.data, 0)
|
||||
console.log("dict",this.dictCourseType);
|
||||
})
|
||||
},
|
||||
// //获取课程分类数据,转换成树结构
|
||||
// getCourseTreeData(type) {
|
||||
// coursewareClassList({ type: type }).then((res) => {
|
||||
// //list转🌲
|
||||
// const list2tree1 = (list, parentId) => {
|
||||
// return list.filter((item) => {
|
||||
// // 默认选中第一个节点
|
||||
// if (!this.treeDataOne) this.treeDataOne.push(item.value)
|
||||
// if (item.parentId === parentId) {
|
||||
// item.children = list2tree1(list, item.id)
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// })
|
||||
// }
|
||||
// this.dictCourseType = list2tree1(res.data, 0)
|
||||
// console.log("dict",this.dictCourseType);
|
||||
// })
|
||||
// },
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue