更改新增 课程类别 用value组树

This commit is contained in:
18571350067 2022-03-29 16:46:12 +08:00
parent c8fa19d304
commit cebe683a2a
1 changed files with 24 additions and 26 deletions

View File

@ -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);
// })
// },