浏览代码

培训 - 考试管理 - 学习资料管理

wangggziwen 1 年之前
父节点
当前提交
4cef66d1b7

+ 14 - 0
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElResourceController.java

@@ -1,6 +1,7 @@
 package com.ruoyi.project.training.elearn.controller;
 
 import java.util.List;
+
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -33,6 +34,18 @@ public class TElResourceController extends BaseController
     @Autowired
     private ITElResourceService tElResourceService;
 
+    /**
+     * 查询课件列表
+     */
+    @PreAuthorize("@ss.hasPermi('elearn:resource:list')")
+    @GetMapping("/listFile")
+    public TableDataInfo listFile(TElResource tElResource)
+    {
+        startPage();
+        List<TElResource> list = tElResourceService.selectFileList(tElResource);
+        return getDataTable(list);
+    }
+
     /**
      * 查询学习资料管理列表
      */
@@ -76,6 +89,7 @@ public class TElResourceController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TElResource tElResource)
     {
+        tElResource.setCreateBy(String.valueOf(getUserId()));
         return toAjax(tElResourceService.insertTElResource(tElResource));
     }
 

+ 33 - 0
master/src/main/java/com/ruoyi/project/training/elearn/domain/TElResource.java

@@ -33,6 +33,39 @@ public class TElResource extends BaseEntity
     @Excel(name = "部门id")
     private Long deptId;
 
+    /** 文件id */
+    private Long fileId;
+
+    /** 文件名 */
+    private String fileName;
+
+    /** 路径 */
+    private String fileUrl;
+
+    public Long getFileId() {
+        return fileId;
+    }
+
+    public void setFileId(Long fileId) {
+        this.fileId = fileId;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    public String getFileUrl() {
+        return fileUrl;
+    }
+
+    public void setFileUrl(String fileUrl) {
+        this.fileUrl = fileUrl;
+    }
+
     public void setId(Long id)
     {
         this.id = id;

+ 5 - 0
master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElResourceMapper.java

@@ -12,6 +12,11 @@ import com.ruoyi.project.training.elearn.domain.TElResource;
  */
 public interface TElResourceMapper 
 {
+    /**
+     * 查询课件列表
+     */
+    public List<TElResource> selectFileList(TElResource tElResource);
+
     /**
      * 查询学习资料管理
      * 

+ 5 - 0
master/src/main/java/com/ruoyi/project/training/elearn/service/ITElResourceService.java

@@ -27,6 +27,11 @@ public interface ITElResourceService
      */
     public List<TElResource> selectTElResourceList(TElResource tElResource);
 
+    /**
+     * 查询课件列表
+     */
+    public List<TElResource> selectFileList(TElResource tElResource);
+
     /**
      * 新增学习资料管理
      * 

+ 8 - 0
master/src/main/java/com/ruoyi/project/training/elearn/service/impl/TElResourceServiceImpl.java

@@ -44,6 +44,14 @@ public class TElResourceServiceImpl implements ITElResourceService
         return tElResourceMapper.selectTElResourceList(tElResource);
     }
 
+    /**
+     * 查询课件列表
+     */
+    public List<TElResource> selectFileList(TElResource tElResource)
+    {
+        return tElResourceMapper.selectFileList(tElResource);
+    }
+
     /**
      * 新增学习资料管理
      *

+ 16 - 0
master/src/main/resources/mybatis/training/elearn/TElResourceMapper.xml

@@ -15,6 +15,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime"    column="update_time"    />
         <result property="deptId"    column="dept_id"    />
         <result property="deptName" column="dept_name" />
+        <result property="fileId" column="file_id" />
+        <result property="fileName" column="file_name" />
+        <result property="fileUrl" column="file_url" />
     </resultMap>
 
     <sql id="selectTElResourceVo">
@@ -97,5 +100,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </update>
+
+    <select id="selectFileList" parameterType="TElResource" resultMap="TElResourceResult">
+        select d.id as file_id, d.file_name, d.file_url, r.id, r.title
+            from t_commonfile d inner join T_EL_RESOURCE r on d.P_ID = r.id
+        <where>
+            <if test="title != null">and r.title like concat(concat('%', #{title}), '%')</if>
+        </where>
+        and d.DEL_FLAG = 0
+        and r.DEL_FLAG = 0
+        and d.P_TYPE='elearnResource'
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
     
 </mapper>

+ 10 - 1
ui/src/api/training/elearn/resource.js

@@ -1,5 +1,14 @@
 import request from '@/utils/request'
 
+// 查询课件列表
+export function listFile(query) {
+  return request({
+    url: '/elearn/resource/listFile',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询学习资料管理列表
 export function listResource(query) {
   return request({
@@ -50,4 +59,4 @@ export function exportResource(query) {
     method: 'get',
     params: query
   })
-}
+}

+ 11 - 29
ui/src/views/training/elearn/resource/index.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="题" prop="title">
+      <el-form-item label="题" prop="title">
         <el-input
           v-model="queryParams.title"
-          placeholder="请输入题"
+          placeholder="请输入题"
           clearable
           size="small"
           @keyup.enter.native="handleQuery"
@@ -60,7 +60,7 @@
 
     <el-table v-loading="loading" :data="resourceList" @selection-change="handleSelectionChange" :height="clientHeight" border>
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="题" align="center" prop="title" :show-overflow-tooltip="true"/>
+      <el-table-column label="题" align="center" prop="title" :show-overflow-tooltip="true"/>
       <el-table-column label="课件" align="center">
         <template slot-scope="scope">
           <el-button
@@ -68,11 +68,12 @@
             type="text"
             icon="el-icon-folder"
             @click="handleDoc(scope.row)"
-          >查看课件
+          >上传课件
           </el-button>
         </template>
       </el-table-column>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
+      <el-table-column label="上传人" align="center" prop="createBy" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -104,8 +105,8 @@
     <!-- 添加或修改学习资料管理对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="题" prop="title">
-          <el-input v-model="form.title" placeholder="请输入题" />
+        <el-form-item label="题" prop="title">
+          <el-input v-model="form.title" placeholder="请输入题" />
         </el-form-item>
         <el-form-item label="备注" prop="remarks">
           <el-input v-model="form.remarks" placeholder="请输入备注" />
@@ -122,9 +123,8 @@
 
     <!-- 课件附件 -->
     <el-dialog  :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" append-to-body >
-      <el-upload v-hasPermi="['training:trainingrecords:file']"
-                 ref="doc"
-                 :limit="50"
+      <el-upload ref="doc"
+                 :limit="1"
                  :headers="doc.headers"
                  :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
                  :disabled="doc.isUploading"
@@ -149,18 +149,6 @@
         </el-table-column>
         <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
         <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
-        <!--        <el-table-column :label="$t('培训日期')" align="center" prop="pDate"  width="150">-->
-        <!--          <template slot-scope="scope">-->
-        <!--            <el-date-picker-->
-        <!--              v-if="scope.row.isEdit"-->
-        <!--              v-model="scope.row.pDate"-->
-        <!--              type="date"-->
-        <!--              value-format="yyyy-MM-dd"-->
-        <!--              placeholder="日期">-->
-        <!--            </el-date-picker>-->
-        <!--            <span v-else>{{ parseTime(scope.row.pDate, '{y}-{m}-{d}') }}</span>-->
-        <!--          </template>-->
-        <!--        </el-table-column>-->
         <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
           <template slot-scope="scope">
             <el-button
@@ -170,9 +158,6 @@
               icon="el-icon-view"
               @click="handleSee(scope.row)"
             >{{ $t('预览') }}</el-button>
-            <el-button v-hasPermi="['training:trainingrecords:file']"  type="text" size="small" v-if="scope.row.isEdit" @click="save(scope.row)">保存</el-button>
-            <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">取消</el-button>
-            <!--            <el-button v-hasPermi="['training:trainingrecords:file']" v-if="!scope.row.isEdit" @click="edit(scope.row)" icon="el-icon-edit" type="text" size="mini">编辑</el-button>-->
             <el-button
               size="mini"
               type="text"
@@ -184,7 +169,6 @@
               type="text"
               icon="el-icon-delete"
               @click="handleDeleteDoc(scope.row)"
-              v-hasPermi="['training:trainingrecords:file']"
             >{{ $t('删除') }}</el-button>
           </template>
         </el-table-column>
@@ -323,14 +307,12 @@ export default {
   methods: {
     handleDoc(row) {
       this.doc.id = row.id;
-      this.doc.title = "";
+      this.doc.title = "上传课件";
       this.doc.open = true;
       this.doc.queryParams.pId = row.id
       this.doc.pId = row.id
+      this.doc.commonfileList = null;
       this.getFileList()
-      /*this.$nextTick(() => {
-        this.$refs.doc.clearFiles()
-      })*/
     },
     getFileList() {
       allFileList(this.doc.queryParams).then(response => {