项目选择课程类别调整变更

This commit is contained in:
Yjhon 2022-03-29 16:56:32 +08:00
parent c1aa1f7abc
commit 6ada0ac0c2
3 changed files with 29 additions and 21 deletions

View File

@ -8,8 +8,8 @@
<a-menu-item key="self">自主课程</a-menu-item> <a-menu-item key="self">自主课程</a-menu-item>
<!-- :disabled="tabDis" --> <!-- :disabled="tabDis" -->
</a-menu> </a-menu>
<!-- :defaultExpandedKeys="defaultExpandedKeys" --> <!-- :defaultExpandedKeys="defaultExpandedKeys :replaceFields="replaceFields"" -->
<a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" :replaceFields="replaceFields"> <a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" >
<a-icon slot="switcherIcon" type="down" /> <a-icon slot="switcherIcon" type="down" />
</a-tree> </a-tree>
</a-col> </a-col>
@ -62,6 +62,7 @@
import { coursewareClassList } from '@/api/course/courseware' import { coursewareClassList } from '@/api/course/courseware'
import { listByClass } from '@/api/course/course' import { listByClass } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem' import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { dictToTree } from '@/utils/util'
import { STable } from '@/components' import { STable } from '@/components'
const rootParentId = 0 const rootParentId = 0
@ -87,7 +88,7 @@ export default {
menuKey: ['sys'], // menuKey: ['sys'], //
// //
queryParam: { name: '', classType: 1, type: 1, tags: [] }, queryParam: { name: '', classType: 1, type: 1, tags: [] },
replaceFields: { children: 'children', title: 'name', key: 'value', value: 'id' }, // replaceFields: { children: 'children', title: 'name', key: 'value', value: 'id' },
expandedKeys: [], expandedKeys: [],
autoExpandParent: true, autoExpandParent: true,
dictCourseTag: [], // dictCourseTag: [], //
@ -256,21 +257,28 @@ export default {
}, },
// //
getCourseTreeData(type) { // getCourseTreeData(type) {
coursewareClassList({ type: type }).then((res) => { // coursewareClassList({ type: type }).then((res) => {
//list🌲 // //list🌲
const list2tree1 = (list, parentId) => { // const list2tree1 = (list, parentId) => {
return list.filter((item) => { // return list.filter((item) => {
// // //
if (!this.treeDataOne) this.treeDataOne.push(item.value) // if (!this.treeDataOne) this.treeDataOne.push(item.value)
if (item.parentId === parentId) { // if (item.parentId === parentId) {
item.children = list2tree1(list, item.id) // item.children = list2tree1(list, item.id)
return true // return true
} // }
return false // return false
}) // })
} // }
this.treeData = list2tree1(res.data, 0) // this.treeData = list2tree1(res.data, 0)
// })
// },
getCourseTreeData () {
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
const result = dictToTree(res.data, [], 0)
console.log('result',result)
this.treeData = result
}) })
}, },
}, },

View File

@ -17,7 +17,7 @@
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item ref="parentid" label="上级编号" prop="parentid"> <a-form-model-item ref="parentid" label="所属上级" prop="parentid">
<a-input-number v-if="operable" v-model="form.parentid" :min="0"/> <a-input-number v-if="operable" v-model="form.parentid" :min="0"/>
<span v-else>{{ form.parentid }}</span> <span v-else>{{ form.parentid }}</span>
</a-form-model-item> </a-form-model-item>

View File

@ -66,11 +66,11 @@ export default {
selectedRowKeys: [], // key selectedRowKeys: [], // key
selectedRows: [], // selectedRows: [], //
columns: [ columns: [
{ title: '编号', width: 30, dataIndex: 'id', key: 'id' }, // { title: '', width: 30, dataIndex: 'id', key: 'id' },
{ title: '词典项名称', width: 30, dataIndex: 'name', key: 'name' }, { title: '词典项名称', width: 30, dataIndex: 'name', key: 'name' },
{ title: '词典项值', width: 30, dataIndex: 'value', key: 'value' }, { title: '词典项值', width: 30, dataIndex: 'value', key: 'value' },
{ title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' }, { title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
{ title: '上级编号', width: 30, dataIndex: 'parentid', key: 'parentid' }, { title: '上级', width: 30, dataIndex: 'parentid', key: 'parentid' },
{ title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' } { title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' }
], ],
loadData: parameter => { loadData: parameter => {