微型课程学习
This commit is contained in:
parent
5003272c59
commit
7b2844b0c2
@ -9,6 +9,14 @@ export function listMicrocourse(query) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询流程下拉树结构
|
||||
export function treeselect() {
|
||||
return request({
|
||||
url: '/benyi/microcourse/treeselect',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询微型课程详细
|
||||
export function getMicrocourse(id) {
|
||||
return request({
|
||||
|
189
ruoyi-ui/src/views/benyi/microcoursestudy/index.vue
Normal file
189
ruoyi-ui/src/views/benyi/microcoursestudy/index.vue
Normal file
@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="4" :xs="24">
|
||||
<div class="head-container">
|
||||
<el-input
|
||||
v-model="name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
size="small"
|
||||
prefix-icon="el-icon-search"
|
||||
style="margin-bottom: 20px"
|
||||
/>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-tree
|
||||
:data="treeOptions"
|
||||
:props="defaultProps"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
default-expand-all
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="box-card-title">{{ title }}</span>
|
||||
</div>
|
||||
<div class="text item" v-show="title1">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
size="mini"
|
||||
icon="el-icon-printer"
|
||||
@click="prints"
|
||||
>打印</el-button
|
||||
>
|
||||
<div class="pad-left" v-html="note" ref="printMe"></div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { treeselect, getMicrocourse } from "@/api/benyi/microcourse";
|
||||
|
||||
export default {
|
||||
name: "Detail",
|
||||
data() {
|
||||
return {
|
||||
// 主题整合名称
|
||||
name: undefined,
|
||||
// 主题整合id
|
||||
id: undefined,
|
||||
//标题
|
||||
title: "微型课程",
|
||||
title1: "概论",
|
||||
//目的
|
||||
note: "微 型 课 程 王东异 主编",
|
||||
// 树状显示类型
|
||||
treeOptions: [],
|
||||
// 树结构
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label",
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
name(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getTreeselect();
|
||||
},
|
||||
methods: {
|
||||
/** 查询部门下拉树结构 */
|
||||
getTreeselect() {
|
||||
treeselect().then((response) => {
|
||||
this.treeOptions = response.data;
|
||||
//console.log(response.data);
|
||||
});
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.id = data.id;
|
||||
console.log(data.id);
|
||||
if (data.id >= 9999) {
|
||||
} else {
|
||||
this.title = data.label;
|
||||
this.getMicrocourseDetails();
|
||||
}
|
||||
// console.log(this.dayflowtaskList[date.id])
|
||||
// this.getStandardList();
|
||||
},
|
||||
getMicrocourseDetails() {
|
||||
getMicrocourse(this.id).then((response) => {
|
||||
this.title1 = response.data.title;
|
||||
this.note = response.data.contents;
|
||||
});
|
||||
},
|
||||
//打印
|
||||
prints() {
|
||||
//console.log(this.$refs.printMe);
|
||||
this.$print(this.$refs.printMe);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.text {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-bottom: 18px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
.clearfix:after {
|
||||
clear: both;
|
||||
}
|
||||
.box-card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
&::before {
|
||||
content: "";
|
||||
margin-right: 8px;
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
background: #1890ff;
|
||||
}
|
||||
&.mr {
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
.box-card-case {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&::before {
|
||||
content: "";
|
||||
margin-right: 8px;
|
||||
width: 4px;
|
||||
height: 14px;
|
||||
background: #2c3e50;
|
||||
}
|
||||
&.mr {
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
.box-card-info {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.pad-left {
|
||||
padding-left: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
// 禁止复制
|
||||
div {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
@ -4,10 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.ruoyi.project.benyi.domain.ByAssessmentcontent;
|
||||
import com.ruoyi.project.benyi.domain.ByDayFlowDetail;
|
||||
import com.ruoyi.project.benyi.domain.ByMath;
|
||||
import com.ruoyi.project.benyi.domain.ByTheme;
|
||||
import com.ruoyi.project.benyi.domain.*;
|
||||
import com.ruoyi.project.system.domain.SysDept;
|
||||
import com.ruoyi.project.system.domain.SysMenu;
|
||||
|
||||
@ -68,6 +65,14 @@ public class TreeSelect implements Serializable
|
||||
this.children = bytheme.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
//下拉树构造器
|
||||
public TreeSelect(ByMicrocourse byMicrocourse) {
|
||||
|
||||
this.id = byMicrocourse.getId();
|
||||
this.label = byMicrocourse.getTitle();
|
||||
this.children = byMicrocourse.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
//下拉树构造器
|
||||
public TreeSelect(ByMath bymath) {
|
||||
|
||||
|
@ -44,6 +44,16 @@ public class ByMicrocourseController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*/
|
||||
@Log(title = "微型课程学习", businessType = BusinessType.QUERY)
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(ByMicrocourse byMicrocourse) {
|
||||
List<ByMicrocourse> list = byMicrocourseService.selectByMicrocourseListTree(byMicrocourse);
|
||||
return AjaxResult.success(byMicrocourseService.buildMicrocourseTreeSelect(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出微型课程列表
|
||||
*/
|
||||
|
@ -5,6 +5,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微型课程对象 by_microcourse
|
||||
*
|
||||
@ -55,6 +58,16 @@ public class ByMicrocourse extends BaseEntity {
|
||||
@Excel(name = "序号")
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 树状父类ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 树状子类
|
||||
*/
|
||||
private List<ByMicrocourse> children = new ArrayList<ByMicrocourse>();
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
@ -119,6 +132,22 @@ public class ByMicrocourse extends BaseEntity {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public List<ByMicrocourse> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<ByMicrocourse> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
@ -131,6 +160,7 @@ public class ByMicrocourse extends BaseEntity {
|
||||
.append("upanddown", getUpanddown())
|
||||
.append("sort", getSort())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("parentid", getParentId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,14 @@ public interface ByMicrocourseMapper {
|
||||
*/
|
||||
public List<ByMicrocourse> selectByMicrocourseList(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 微型课程集合
|
||||
*/
|
||||
public List<ByMicrocourse> selectByMicrocourseListTree(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*
|
||||
|
@ -2,7 +2,9 @@ package com.ruoyi.project.benyi.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.framework.web.domain.TreeSelect;
|
||||
import com.ruoyi.project.benyi.domain.ByMicrocourse;
|
||||
import com.ruoyi.project.benyi.domain.ByTheme;
|
||||
|
||||
/**
|
||||
* 微型课程Service接口
|
||||
@ -27,6 +29,30 @@ public interface IByMicrocourseService {
|
||||
*/
|
||||
public List<ByMicrocourse> selectByMicrocourseList(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 微型课程集合
|
||||
*/
|
||||
public List<ByMicrocourse> selectByMicrocourseListTree(ByMicrocourse byMicrocourse);
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param byMicrocourses 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<ByMicrocourse> buildMicrocourseDetailTree(List<ByMicrocourse> byMicrocourses);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param byMicrocourses 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
public List<TreeSelect> buildMicrocourseTreeSelect(List<ByMicrocourse> byMicrocourses);
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*
|
||||
|
@ -1,8 +1,14 @@
|
||||
package com.ruoyi.project.benyi.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.domain.TreeSelect;
|
||||
import com.ruoyi.project.benyi.domain.ByTheme;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.benyi.mapper.ByMicrocourseMapper;
|
||||
@ -42,6 +48,100 @@ public class ByMicrocourseServiceImpl implements IByMicrocourseService {
|
||||
return byMicrocourseMapper.selectByMicrocourseList(byMicrocourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微型课程列表
|
||||
*
|
||||
* @param byMicrocourse 微型课程
|
||||
* @return 微型课程集合
|
||||
*/
|
||||
@Override
|
||||
public List<ByMicrocourse> selectByMicrocourseListTree(ByMicrocourse byMicrocourse){
|
||||
return byMicrocourseMapper.selectByMicrocourseListTree(byMicrocourse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param byMicrocourses 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<ByMicrocourse> buildMicrocourseDetailTree(List<ByMicrocourse> byMicrocourses) {
|
||||
//System.out.println("start---");
|
||||
List<ByMicrocourse> returnList = new ArrayList<ByMicrocourse>();
|
||||
List<Long> tempList = new ArrayList<Long>();
|
||||
for (ByMicrocourse item : byMicrocourses) {
|
||||
tempList.add(item.getId());
|
||||
}
|
||||
for (Iterator<ByMicrocourse> iterator = byMicrocourses.iterator(); iterator.hasNext(); ) {
|
||||
ByMicrocourse item = (ByMicrocourse) iterator.next();
|
||||
//System.out.println("test==="+!tempList.contains(item.getParentId()));
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(item.getParentId())) {
|
||||
recursionFn(byMicrocourses, item);
|
||||
returnList.add(item);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty()) {
|
||||
returnList = byMicrocourses;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param byMicrocourses 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> buildMicrocourseTreeSelect(List<ByMicrocourse> byMicrocourses) {
|
||||
List<ByMicrocourse> byMicrocourseTrees = buildMicrocourseDetailTree(byMicrocourses);
|
||||
return byMicrocourseTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn(List<ByMicrocourse> list, ByMicrocourse t) {
|
||||
// 得到子节点列表
|
||||
List<ByMicrocourse> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (ByMicrocourse tChild : childList) {
|
||||
if (hasChild(list, tChild)) {
|
||||
// 判断是否有子节点
|
||||
Iterator<ByMicrocourse> it = childList.iterator();
|
||||
while (it.hasNext()) {
|
||||
ByMicrocourse n = (ByMicrocourse) it.next();
|
||||
recursionFn(list, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<ByMicrocourse> getChildList(List<ByMicrocourse> list, ByMicrocourse t) {
|
||||
List<ByMicrocourse> tlist = new ArrayList<ByMicrocourse>();
|
||||
Iterator<ByMicrocourse> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
ByMicrocourse n = (ByMicrocourse) it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) {
|
||||
//System.out.println("parentid="+n.getParentId().longValue()+"---"+t.getId().longValue());
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<ByMicrocourse> list, ByMicrocourse t) {
|
||||
return getChildList(list, t).size() > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微型课程
|
||||
*
|
||||
|
@ -14,12 +14,27 @@
|
||||
<result property="upanddown" column="upanddown"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByMicrocourseVo">
|
||||
select id, title, author, contents, type, scpoe, upanddown, sort, create_time from by_microcourse
|
||||
</sql>
|
||||
|
||||
<sql id="selectByMicrocourseVoTree">
|
||||
select dict_value+9999 id, 0 parent_id,dict_label title,dict_sort sort from sys_dict_data where dict_type='sys_yebjlx' and dict_label !='托班(2-3岁)'
|
||||
union all
|
||||
select id, scpoe+9999, title, sort from by_microcourse
|
||||
</sql>
|
||||
|
||||
<select id="selectByMicrocourseListTree" parameterType="ByMicrocourse" resultMap="ByMicrocourseResult">
|
||||
<include refid="selectByMicrocourseVoTree"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''">and title like concat('%', #{title}, '%')</if>
|
||||
</where>
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="selectByMicrocourseList" parameterType="ByMicrocourse" resultMap="ByMicrocourseResult">
|
||||
<include refid="selectByMicrocourseVo"/>
|
||||
<where>
|
||||
|
Loading…
x
Reference in New Issue
Block a user