运维学堂-在线课程模块

This commit is contained in:
xusd 2024-04-26 18:14:38 +08:00
parent d1f2d7c0ad
commit 2d706d3337
11 changed files with 1021 additions and 0 deletions

View File

@ -78,6 +78,12 @@
<version>3.8.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.inspur</groupId>
<artifactId>inspur-operations</artifactId>
<version>3.8.7</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -0,0 +1,115 @@
package com.inspur.web.controller.operations;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.inspur.operations.domain.CourseOnlineInfo;
import com.inspur.operations.service.ICourseOnlineInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 在线课程信息Controller
*
* @author inspur
* @date 2024-04-26
*/
@RestController
@RequestMapping("/operations/courseOnline")
public class CourseOnlineInfoController extends BaseController
{
@Autowired
private ICourseOnlineInfoService courseOnlineInfoService;
/**
* 查询在线课程信息列表
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:list')")
@GetMapping("/list")
public TableDataInfo list(CourseOnlineInfo courseOnlineInfo)
{
startPage();
List<CourseOnlineInfo> list = courseOnlineInfoService.selectCourseOnlineInfoList(courseOnlineInfo);
return getDataTable(list);
}
/**
* 导出在线课程信息列表
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:export')")
@Log(title = "在线课程信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CourseOnlineInfo courseOnlineInfo)
{
List<CourseOnlineInfo> list = courseOnlineInfoService.selectCourseOnlineInfoList(courseOnlineInfo);
ExcelUtil<CourseOnlineInfo> util = new ExcelUtil<CourseOnlineInfo>(CourseOnlineInfo.class);
util.exportExcel(response, list, "在线课程信息数据");
}
/**
* 获取在线课程信息详细信息
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:query')")
@GetMapping(value = "/{classId}")
public AjaxResult getInfo(@PathVariable("classId") String classId)
{
return success(courseOnlineInfoService.selectCourseOnlineInfoByClassId(classId));
}
/**
* 新增在线课程信息
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:add')")
@Log(title = "在线课程信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CourseOnlineInfo courseOnlineInfo)
{
return toAjax(courseOnlineInfoService.insertCourseOnlineInfo(courseOnlineInfo));
}
/**
* 修改在线课程信息
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:edit')")
@Log(title = "在线课程信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CourseOnlineInfo courseOnlineInfo)
{
return toAjax(courseOnlineInfoService.updateCourseOnlineInfo(courseOnlineInfo));
}
/**
* 删除在线课程信息
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:remove')")
@Log(title = "在线课程信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{classIds}")
public AjaxResult remove(@PathVariable String[] classIds)
{
return toAjax(courseOnlineInfoService.deleteCourseOnlineInfoByClassIds(classIds));
}
/**
* 修改在线课程信息状态
*/
@PreAuthorize("@ss.hasPermi('operations:courseOnline:changeStatus')")
@Log(title = "在线课程信息修改状态", businessType = BusinessType.OTHER)
@PostMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody CourseOnlineInfo courseOnlineInfo){
return toAjax(courseOnlineInfoService.updateCourseOnlineInfo(courseOnlineInfo));
}
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.inspur</groupId>
<artifactId>inspur</artifactId>
<version>3.8.7</version>
</parent>
<artifactId>inspur-operations</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.inspur</groupId>
<artifactId>inspur-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.0.7</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,85 @@
package com.inspur.operations.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 在线课程信息对象 course_online_info
*
* @author inspur
* @date 2024-04-26
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class CourseOnlineInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String classId;
/**
* 课程名称
*/
@Excel(name = "课程名称")
private String className;
/**
* 课程类型
*/
@Excel(name = "课程类型")
private String classType;
/**
* 课程讲师
*/
@Excel(name = "课程讲师")
private String classLecturer;
/**
* 课程参与者
*/
@Excel(name = "课程参与者")
private String classParticipant;
/**
* 课程描述
*/
@Excel(name = "课程描述")
private String classDescription;
/**
* 课程开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "课程开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date classStartTime;
/**
* 课程结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "课程结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date classEndTime;
/**
* 参加方式
*/
@Excel(name = "参加方式")
private String classJoinMethod;
/**
* 状态0 未启用1 已启用
*/
@Excel(name = "状态",dictType = "sys_normal_disable")
private String status;
}

View File

@ -0,0 +1,61 @@
package com.inspur.operations.mapper;
import java.util.List;
import com.inspur.operations.domain.CourseOnlineInfo;
/**
* 在线课程信息Mapper接口
*
* @author inspur
* @date 2024-04-26
*/
public interface CourseOnlineInfoMapper
{
/**
* 查询在线课程信息
*
* @param classId 在线课程信息主键
* @return 在线课程信息
*/
public CourseOnlineInfo selectCourseOnlineInfoByClassId(String classId);
/**
* 查询在线课程信息列表
*
* @param courseOnlineInfo 在线课程信息
* @return 在线课程信息集合
*/
public List<CourseOnlineInfo> selectCourseOnlineInfoList(CourseOnlineInfo courseOnlineInfo);
/**
* 新增在线课程信息
*
* @param courseOnlineInfo 在线课程信息
* @return 结果
*/
public int insertCourseOnlineInfo(CourseOnlineInfo courseOnlineInfo);
/**
* 修改在线课程信息
*
* @param courseOnlineInfo 在线课程信息
* @return 结果
*/
public int updateCourseOnlineInfo(CourseOnlineInfo courseOnlineInfo);
/**
* 删除在线课程信息
*
* @param classId 在线课程信息主键
* @return 结果
*/
public int deleteCourseOnlineInfoByClassId(String classId);
/**
* 批量删除在线课程信息
*
* @param classIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCourseOnlineInfoByClassIds(String[] classIds);
}

View File

@ -0,0 +1,61 @@
package com.inspur.operations.service;
import java.util.List;
import com.inspur.operations.domain.CourseOnlineInfo;
/**
* 在线课程信息Service接口
*
* @author inspur
* @date 2024-04-26
*/
public interface ICourseOnlineInfoService
{
/**
* 查询在线课程信息
*
* @param classId 在线课程信息主键
* @return 在线课程信息
*/
public CourseOnlineInfo selectCourseOnlineInfoByClassId(String classId);
/**
* 查询在线课程信息列表
*
* @param courseOnlineInfo 在线课程信息
* @return 在线课程信息集合
*/
public List<CourseOnlineInfo> selectCourseOnlineInfoList(CourseOnlineInfo courseOnlineInfo);
/**
* 新增在线课程信息
*
* @param courseOnlineInfo 在线课程信息
* @return 结果
*/
public int insertCourseOnlineInfo(CourseOnlineInfo courseOnlineInfo);
/**
* 修改在线课程信息
*
* @param courseOnlineInfo 在线课程信息
* @return 结果
*/
public int updateCourseOnlineInfo(CourseOnlineInfo courseOnlineInfo);
/**
* 批量删除在线课程信息
*
* @param classIds 需要删除的在线课程信息主键集合
* @return 结果
*/
public int deleteCourseOnlineInfoByClassIds(String[] classIds);
/**
* 删除在线课程信息信息
*
* @param classId 在线课程信息主键
* @return 结果
*/
public int deleteCourseOnlineInfoByClassId(String classId);
}

View File

@ -0,0 +1,98 @@
package com.inspur.operations.service.impl;
import java.util.List;
import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.operations.domain.CourseOnlineInfo;
import com.inspur.operations.mapper.CourseOnlineInfoMapper;
import com.inspur.operations.service.ICourseOnlineInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 在线课程信息Service业务层处理
*
* @author inspur
* @date 2024-04-26
*/
@Service
public class CourseOnlineInfoServiceImpl implements ICourseOnlineInfoService
{
@Autowired
private CourseOnlineInfoMapper courseOnlineInfoMapper;
/**
* 查询在线课程信息
*
* @param classId 在线课程信息主键
* @return 在线课程信息
*/
@Override
public CourseOnlineInfo selectCourseOnlineInfoByClassId(String classId)
{
return courseOnlineInfoMapper.selectCourseOnlineInfoByClassId(classId);
}
/**
* 查询在线课程信息列表
*
* @param courseOnlineInfo 在线课程信息
* @return 在线课程信息
*/
@Override
public List<CourseOnlineInfo> selectCourseOnlineInfoList(CourseOnlineInfo courseOnlineInfo)
{
return courseOnlineInfoMapper.selectCourseOnlineInfoList(courseOnlineInfo);
}
/**
* 新增在线课程信息
*
* @param courseOnlineInfo 在线课程信息
* @return 结果
*/
@Override
public int insertCourseOnlineInfo(CourseOnlineInfo courseOnlineInfo)
{
courseOnlineInfo.setCreateTime(DateUtils.getNowDate());
courseOnlineInfo.setClassId(IdUtils.fastSimpleUUID());
return courseOnlineInfoMapper.insertCourseOnlineInfo(courseOnlineInfo);
}
/**
* 修改在线课程信息
*
* @param courseOnlineInfo 在线课程信息
* @return 结果
*/
@Override
public int updateCourseOnlineInfo(CourseOnlineInfo courseOnlineInfo)
{
courseOnlineInfo.setUpdateTime(DateUtils.getNowDate());
return courseOnlineInfoMapper.updateCourseOnlineInfo(courseOnlineInfo);
}
/**
* 批量删除在线课程信息
*
* @param classIds 需要删除的在线课程信息主键
* @return 结果
*/
@Override
public int deleteCourseOnlineInfoByClassIds(String[] classIds)
{
return courseOnlineInfoMapper.deleteCourseOnlineInfoByClassIds(classIds);
}
/**
* 删除在线课程信息信息
*
* @param classId 在线课程信息主键
* @return 结果
*/
@Override
public int deleteCourseOnlineInfoByClassId(String classId)
{
return courseOnlineInfoMapper.deleteCourseOnlineInfoByClassId(classId);
}
}

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.operations.mapper.CourseOnlineInfoMapper">
<resultMap type="com.inspur.operations.domain.CourseOnlineInfo" id="CourseOnlineInfoResult">
<result property="classId" column="class_id" />
<result property="className" column="class_name" />
<result property="classType" column="class_type" />
<result property="classLecturer" column="class_lecturer" />
<result property="classParticipant" column="class_participant" />
<result property="classDescription" column="class_description" />
<result property="classStartTime" column="class_start_time" />
<result property="classEndTime" column="class_end_time" />
<result property="classJoinMethod" column="class_join_method" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCourseOnlineInfoVo">
select class_id, class_name, class_type, class_lecturer, class_participant, class_description, class_start_time, class_end_time, class_join_method, status, create_by, create_time, update_by, update_time from course_online_info
</sql>
<select id="selectCourseOnlineInfoList" parameterType="com.inspur.operations.domain.CourseOnlineInfo" resultMap="CourseOnlineInfoResult">
<include refid="selectCourseOnlineInfoVo"/>
<where>
<if test="className != null and className != ''"> and class_name like concat('%', #{className}, '%')</if>
<if test="classType != null and classType != ''"> and class_type = #{classType}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="classLecturer != null and classLecturer != ''"> and class_lecturer like concat('%', #{classLecturer}, '%')</if>
</where>
</select>
<select id="selectCourseOnlineInfoByClassId" parameterType="String" resultMap="CourseOnlineInfoResult">
<include refid="selectCourseOnlineInfoVo"/>
where class_id = #{classId}
</select>
<insert id="insertCourseOnlineInfo" parameterType="com.inspur.operations.domain.CourseOnlineInfo">
insert into course_online_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="classId != null">class_id,</if>
<if test="className != null">class_name,</if>
<if test="classType != null">class_type,</if>
<if test="classLecturer != null">class_lecturer,</if>
<if test="classParticipant != null">class_participant,</if>
<if test="classDescription != null">class_description,</if>
<if test="classStartTime != null">class_start_time,</if>
<if test="classEndTime != null">class_end_time,</if>
<if test="classJoinMethod != null">class_join_method,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="classId != null">#{classId},</if>
<if test="className != null">#{className},</if>
<if test="classType != null">#{classType},</if>
<if test="classLecturer != null">#{classLecturer},</if>
<if test="classParticipant != null">#{classParticipant},</if>
<if test="classDescription != null">#{classDescription},</if>
<if test="classStartTime != null">#{classStartTime},</if>
<if test="classEndTime != null">#{classEndTime},</if>
<if test="classJoinMethod != null">#{classJoinMethod},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCourseOnlineInfo" parameterType="com.inspur.operations.domain.CourseOnlineInfo">
update course_online_info
<trim prefix="SET" suffixOverrides=",">
<if test="className != null">class_name = #{className},</if>
<if test="classType != null">class_type = #{classType},</if>
<if test="classLecturer != null">class_lecturer = #{classLecturer},</if>
<if test="classParticipant != null">class_participant = #{classParticipant},</if>
<if test="classDescription != null">class_description = #{classDescription},</if>
<if test="classStartTime != null">class_start_time = #{classStartTime},</if>
<if test="classEndTime != null">class_end_time = #{classEndTime},</if>
<if test="classJoinMethod != null">class_join_method = #{classJoinMethod},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where class_id = #{classId}
</update>
<delete id="deleteCourseOnlineInfoByClassId" parameterType="String">
delete from course_online_info where class_id = #{classId}
</delete>
<delete id="deleteCourseOnlineInfoByClassIds" parameterType="String">
delete from course_online_info where class_id in
<foreach item="classId" collection="array" open="(" separator="," close=")">
#{classId}
</foreach>
</delete>
</mapper>

View File

@ -187,6 +187,7 @@
<module>inspur-om</module>
<module>inspur-order</module>
<module>inspur-knowledgeBase</module>
<module>inspur-operations</module>
</modules>
<packaging>pom</packaging>

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询在线课程信息列表
export function listCourseOnline(query) {
return request({
url: '/operations/courseOnline/list',
method: 'get',
params: query
})
}
// 查询在线课程信息详细
export function getCourseOnline(classId) {
return request({
url: '/operations/courseOnline/' + classId,
method: 'get'
})
}
// 新增在线课程信息
export function addCourseOnline(data) {
return request({
url: '/operations/courseOnline',
method: 'post',
data: data
})
}
// 修改在线课程信息
export function updateCourseOnline(data) {
return request({
url: '/operations/courseOnline',
method: 'put',
data: data
})
}
// 删除在线课程信息
export function delCourseOnline(classId) {
return request({
url: '/operations/courseOnline/' + classId,
method: 'delete'
})
}
// 修改在线课程信息状态
export function changeStatus(data) {
return request({
url: '/operations/courseOnline/changeStatus',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,396 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="课程名称" prop="className">
<el-input
v-model="queryParams.className"
placeholder="请输入课程名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="课程类型" prop="classType">
<el-select v-model="queryParams.classType" placeholder="请选择课程类型" clearable>
<el-option
v-for="dict in dict.type.class_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="课程讲师" prop="classLecturer">
<el-input
v-model="queryParams.classLecturer"
placeholder="请输入课程讲师"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['operations:courseOnline:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['operations:courseOnline:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['operations:courseOnline:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['operations:courseOnline:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="courseOnlineList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="课程名称" align="center" prop="className" />
<el-table-column label="课程类型" align="center" prop="classType">
<template slot-scope="scope">
<dict-tag :options="dict.type.class_type" :value="scope.row.classType"/>
</template>
</el-table-column>
<el-table-column label="课程讲师" align="center" prop="classLecturer" />
<el-table-column label="课程参与者" align="center" prop="classParticipant" />
<el-table-column label="课程描述" align="center" prop="classDescription" />
<el-table-column label="课程开始时间" align="center" prop="classStartTime" width="180"/>
<el-table-column label="课程结束时间" align="center" prop="classEndTime" width="180"/>
<el-table-column label="参加方式" align="center" prop="classJoinMethod" />
<el-table-column label="状态" align="center" prop="status" >
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['operations:courseOnline:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['operations:courseOnline:remove']"
>删除</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-delete"
@click="handleStart(scope.row)"
v-if="scope.row.status === '1'"
v-hasPermi="['operations:courseOnline:changeStatus']"
>启用</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-delete"
@click="handleStop(scope.row)"
v-if="scope.row.status === '0'"
v-hasPermi="['operations:courseOnline:changeStatus']"
>停用</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改在线课程信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="课程名称" prop="className">
<el-input v-model="form.className" placeholder="请输入课程名称" />
</el-form-item>
<el-form-item label="课程类型" prop="classType">
<el-select v-model="form.classType" placeholder="请选择课程类型">
<el-option
v-for="dict in dict.type.class_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="课程讲师" prop="classLecturer">
<el-input v-model="form.classLecturer" placeholder="请输入课程讲师" />
</el-form-item>
<el-form-item label="课程参与者" prop="classParticipant">
<el-input v-model="form.classParticipant" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="课程描述" prop="classDescription">
<el-input v-model="form.classDescription" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="课程开始时间" prop="classStartTime">
<el-date-picker clearable
v-model="form.classStartTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择课程开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="课程结束时间" prop="classEndTime">
<el-date-picker clearable
v-model="form.classEndTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择课程结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="参加方式" prop="classJoinMethod">
<el-input v-model="form.classJoinMethod" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCourseOnline, getCourseOnline, delCourseOnline, addCourseOnline, updateCourseOnline,changeStatus } from "@/api/operations/courseOnline";
export default {
name: "CourseOnline",
dicts: ['class_type','sys_normal_disable'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 线
courseOnlineList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
className: null,
classType: null,
classLecturer: null,
},
//
form: {},
//
rules: {
className: [
{ required: true, message: "课程名称不能为空", trigger: "blur" }
],
classType: [
{ required: true, message: "课程类型不能为空", trigger: "change" }
],
classLecturer: [
{ required: true, message: "课程讲师不能为空", trigger: "blur" }
],
classStartTime: [
{ required: true, message: "课程开始时间不能为空", trigger: "change" }
],
classEndTime: [
{ required: true, message: "课程结束时间不能为空", trigger: "change" }
],
}
};
},
created() {
this.getList();
},
methods: {
handleStart(row){
this.loading = true;
const form = {
classId:row.classId,
status: '0'
}
this.handleChangeStatus(form);
},
handleStop(row){
this.loading = true;
const form = {
classId:row.classId,
status: '1'
}
this.handleChangeStatus(form);
},
//
handleChangeStatus(form){
changeStatus(form).then(()=>{
this.$modal.msgSuccess("状态修改成功");
this.getList();
})
},
/** 查询在线课程信息列表 */
getList() {
this.loading = true;
listCourseOnline(this.queryParams).then(response => {
this.courseOnlineList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
classId: null,
className: null,
classType: null,
classLecturer: null,
classParticipant: null,
classDescription: null,
classStartTime: null,
classEndTime: null,
classJoinMethod: null,
status: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.classId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加在线课程信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const classId = row.classId || this.ids
getCourseOnline(classId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改在线课程信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.classId != null) {
updateCourseOnline(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCourseOnline(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const classIds = row.classId || this.ids;
this.$modal.confirm('是否确认删除在线课程信息编号为"' + classIds + '"的数据项?').then(function() {
return delCourseOnline(classIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('operations/courseOnline/export', {
...this.queryParams
}, `courseOnline_${new Date().getTime()}.xlsx`)
}
}
};
</script>