|
@@ -0,0 +1,550 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
+ <el-col :span="12">
|
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
|
+ <el-form-item label="主题" prop="title">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.title"
|
|
|
|
+ placeholder="请输入主题"
|
|
|
|
+ clearable
|
|
|
|
+ size="small"
|
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="cyan" 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-col>
|
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
|
|
+ <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="fileName" :show-overflow-tooltip="true"/>
|
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="240" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ @click="handleStudy(scope.row)"
|
|
|
|
+ icon="el-icon-video-play"
|
|
|
|
+ v-hasPermi="['elearn:resource:edit']"
|
|
|
|
+ >开始学习</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ @click="handleHistory(scope.row)"
|
|
|
|
+ icon="el-icon-document"
|
|
|
|
+ v-hasPermi="['elearn:resource:remove']"
|
|
|
|
+ >学习记录</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 :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"
|
|
|
|
+ :headers="doc.headers"
|
|
|
|
+ :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
|
|
|
|
+ :disabled="doc.isUploading"
|
|
|
|
+ :on-progress="handleFileDocProgress"
|
|
|
|
+ :on-success="handleFileDocSuccess"
|
|
|
|
+ :auto-upload="true"
|
|
|
|
+ drag
|
|
|
|
+ >
|
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
|
+ <div class="el-upload__text">
|
|
|
|
+ {{ $t('将文件拖到此处,或') }}
|
|
|
|
+ <em>{{ $t('点击上传') }}</em>
|
|
|
|
+ </div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ <el-table :data="doc.commonfileList" border>
|
|
|
|
+ <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <a class="link-type" @click="handleDownload(scope.row)">
|
|
|
|
+ <span>{{ scope.row.fileName }}</span>
|
|
|
|
+ </a>
|
|
|
|
+ </template>
|
|
|
|
+ </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
|
|
|
|
+ v-if="scope.row.fileName.endsWith('pdf')"
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ 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"
|
|
|
|
+ icon="el-icon-download"
|
|
|
|
+ @click="handleDownload(scope.row)"
|
|
|
|
+ >{{ $t('下载') }}</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
+ @click="handleDeleteDoc(scope.row)"
|
|
|
|
+ v-hasPermi="['training:trainingrecords:file']"
|
|
|
|
+ >{{ $t('删除') }}</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
|
|
|
|
+ <div style="margin-top: -60px;float: right;margin-right: 40px;">
|
|
|
|
+ <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
|
|
|
|
+ <div style="margin-top: -30px">
|
|
|
|
+ <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <el-dialog :close-on-click-modal="false" v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)" v-dialogDrag :title="pdf.title"
|
|
|
|
+ :visible.sync="pdf.open" width="1300px" height="800px" :center="true" append-to-body @close="handleClose">
|
|
|
|
+ <div style="margin-top: -30px">
|
|
|
|
+ <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"
|
|
|
|
+ v-if="ppt"></iframe>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <el-dialog :title="history.title" :visible.sync="history.open" width="800px" :center="true" append-to-body>
|
|
|
|
+ <el-table v-loading="historyLoading" :data="historyList" border>
|
|
|
|
+ <el-table-column label="用户" align="center" prop="nickName" :show-overflow-tooltip="true"/>
|
|
|
|
+ <el-table-column label="学习时长" align="center" prop="learnTime" :show-overflow-tooltip="true">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ scope.row.learnTime }}</span> min
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import { updateLearnTime, listLearn, getLearn, delLearn, addLearn, updateLearn, exportLearn } from "@/api/training/elearn/learn";
|
|
|
|
+ import { listFile, listResource, getResource, delResource, addResource, updateResource, exportResource } from "@/api/training/elearn/resource";
|
|
|
|
+ import { treeselect } from "@/api/system/dept";
|
|
|
|
+ import { getToken } from "@/utils/auth";
|
|
|
|
+ import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
+ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
+ import {addCommonfile, allFileList, delCommonfile, updateCommonfile} from "@/api/common/commonfile";
|
|
|
|
+
|
|
|
|
+ var timer = null;
|
|
|
|
+
|
|
|
|
+ export default {
|
|
|
|
+ name: "Learn",
|
|
|
|
+ components: { Treeselect },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ history: {
|
|
|
|
+ open: false,
|
|
|
|
+ title: "",
|
|
|
|
+ },
|
|
|
|
+ ppt: false,
|
|
|
|
+ pptView: false,
|
|
|
|
+ pdf: {
|
|
|
|
+ title: '',
|
|
|
|
+ pdfUrl: '',
|
|
|
|
+ numPages: null,
|
|
|
|
+ open: false,
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageTotalNum: 1,
|
|
|
|
+ loadedRatio: 0,
|
|
|
|
+ },
|
|
|
|
+ learning: {
|
|
|
|
+ learningTimeStudied: null,
|
|
|
|
+ },
|
|
|
|
+ loadingFlash: false,
|
|
|
|
+ doc: {
|
|
|
|
+ file: "",
|
|
|
|
+ // 是否显示弹出层(报告附件)
|
|
|
|
+ open: false,
|
|
|
|
+ // 弹出层标题(报告附件)
|
|
|
|
+ title: "附件",
|
|
|
|
+ // 是否禁用上传
|
|
|
|
+ isUploading: false,
|
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
|
+ updateSupport: 0,
|
|
|
|
+ // 报告附件上传位置编号
|
|
|
|
+ ids: 0,
|
|
|
|
+ // 设置上传的请求头部
|
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
|
+ // 上传的地址
|
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
|
|
|
|
+ commonfileList: null,
|
|
|
|
+ queryParams: {
|
|
|
|
+ pId: null,
|
|
|
|
+ pType: 'elearnResource'
|
|
|
|
+ },
|
|
|
|
+ pType: 'elearnResource',
|
|
|
|
+ pId: null,
|
|
|
|
+ form: {}
|
|
|
|
+ },
|
|
|
|
+ pdf : {
|
|
|
|
+ title: '',
|
|
|
|
+ pdfUrl: '',
|
|
|
|
+ numPages: null,
|
|
|
|
+ open: false,
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageTotalNum: 1,
|
|
|
|
+ loadedRatio: 0,
|
|
|
|
+ },
|
|
|
|
+ // 遮罩层
|
|
|
|
+ loading: true,
|
|
|
|
+ historyLoading: true,
|
|
|
|
+ // 选中数组
|
|
|
|
+ ids: [],
|
|
|
|
+ // 非单个禁用
|
|
|
|
+ single: true,
|
|
|
|
+ // 非多个禁用
|
|
|
|
+ multiple: true,
|
|
|
|
+ // 显示搜索条件
|
|
|
|
+ showSearch: true,
|
|
|
|
+ // 总条数
|
|
|
|
+ total: 0,
|
|
|
|
+ // 学习资料管理表格数据
|
|
|
|
+ resourceList: [],
|
|
|
|
+ historyList: [],
|
|
|
|
+ // 弹出层标题
|
|
|
|
+ title: "",
|
|
|
|
+ // 部门树选项
|
|
|
|
+ deptOptions: undefined,
|
|
|
|
+ clientHeight:300,
|
|
|
|
+ // 是否显示弹出层
|
|
|
|
+ open: false,
|
|
|
|
+ // 用户导入参数
|
|
|
|
+ upload: {
|
|
|
|
+ // 是否显示弹出层(用户导入)
|
|
|
|
+ open: false,
|
|
|
|
+ // 弹出层标题(用户导入)
|
|
|
|
+ title: "",
|
|
|
|
+ // 是否禁用上传
|
|
|
|
+ isUploading: false,
|
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
|
+ updateSupport: 0,
|
|
|
|
+ // 设置上传的请求头部
|
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
|
+ // 上传的地址
|
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/elearn/resource/importData"
|
|
|
|
+ },
|
|
|
|
+ // 查询参数
|
|
|
|
+ queryParams: {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 20,
|
|
|
|
+ title: null,
|
|
|
|
+ remarks: null,
|
|
|
|
+ deptId: null
|
|
|
|
+ },
|
|
|
|
+ // 表单参数
|
|
|
|
+ form: {},
|
|
|
|
+ // 表单校验
|
|
|
|
+ rules: {
|
|
|
|
+ id: [
|
|
|
|
+ { required: true, message: "主键id不能为空", trigger: "blur" }
|
|
|
|
+ ],
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ // 根据名称筛选部门树
|
|
|
|
+ deptName(val) {
|
|
|
|
+ this.$refs.tree.filter(val);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ //设置表格高度对应屏幕高度
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.clientHeight = document.body.clientHeight -250
|
|
|
|
+ })
|
|
|
|
+ this.getList();
|
|
|
|
+ this.getTreeselect();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ handleHistory(row) {
|
|
|
|
+ this.history.title = row.fileName + " 学习记录";
|
|
|
|
+ this.history.open = true;
|
|
|
|
+ listLearn({"resourceId": row.resourceId}).then(response => {
|
|
|
|
+ this.historyList = response.data;
|
|
|
|
+ this.historyLoading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ handleClose() {
|
|
|
|
+ window.clearInterval(timer);
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+ handleStudy(row) {
|
|
|
|
+ //office预览
|
|
|
|
+ this.loadingFlash = true
|
|
|
|
+ this.pdf.open = true
|
|
|
|
+ this.pdf.title = row.fileName
|
|
|
|
+ this.pdf.pdfUrl = ""
|
|
|
|
+ this.ppt = true
|
|
|
|
+ //如果是PDF等直接可以打开的就不调接口,否则调用接口
|
|
|
|
+ if (row.fileName.endsWith('pdf')) {
|
|
|
|
+ this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
|
|
|
|
+ this.loadingFlash = false
|
|
|
|
+ }
|
|
|
|
+ let _this = this;
|
|
|
|
+ timer = window.setInterval(function() {
|
|
|
|
+ updateLearnTime(row).then(response => {
|
|
|
|
+ // _this.$forceUpdate();
|
|
|
|
+ });
|
|
|
|
+ }, 60000);
|
|
|
|
+ },
|
|
|
|
+ handleDoc(row) {
|
|
|
|
+ this.doc.id = row.id;
|
|
|
|
+ this.doc.title = "";
|
|
|
|
+ this.doc.open = true;
|
|
|
|
+ this.doc.queryParams.pId = row.id
|
|
|
|
+ this.doc.pId = row.id
|
|
|
|
+ this.getFileList()
|
|
|
|
+ /*this.$nextTick(() => {
|
|
|
|
+ this.$refs.doc.clearFiles()
|
|
|
|
+ })*/
|
|
|
|
+ },
|
|
|
|
+ getFileList() {
|
|
|
|
+ allFileList(this.doc.queryParams).then(response => {
|
|
|
|
+ response.forEach(element => {
|
|
|
|
+ element["isEdit"] = false
|
|
|
|
+ });
|
|
|
|
+ response.forEach(element => {
|
|
|
|
+ element["isAdd"] = false
|
|
|
|
+ });
|
|
|
|
+ this.doc.commonfileList = response;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //附件上传中处理
|
|
|
|
+ handleFileDocProgress(event, file, fileList) {
|
|
|
|
+ this.doc.file = file;
|
|
|
|
+ this.doc.isUploading = true;
|
|
|
|
+ },
|
|
|
|
+ //附件上传成功处理
|
|
|
|
+ handleFileDocSuccess(response, file, fileList) {
|
|
|
|
+ this.doc.isUploading = false;
|
|
|
|
+ this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
|
|
|
|
+ this.getFileList()
|
|
|
|
+ },
|
|
|
|
+ // 文件下载处理
|
|
|
|
+ handleDownload(row) {
|
|
|
|
+ var name = row.fileName;
|
|
|
|
+ var url = row.fileUrl;
|
|
|
|
+ var suffix = url.substring(url.lastIndexOf("."), url.length);
|
|
|
|
+ const a = document.createElement('a')
|
|
|
|
+ a.setAttribute('download', name)
|
|
|
|
+ a.setAttribute('target', '_blank')
|
|
|
|
+ a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
|
|
|
|
+ a.click()
|
|
|
|
+ },
|
|
|
|
+ openPdf() {
|
|
|
|
+ window.open(this.pdf.pdfUrl);//path是文件的全路径地址
|
|
|
|
+ },
|
|
|
|
+ handleSee(row) {
|
|
|
|
+ // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
|
|
|
|
+ this.pdf.open = true
|
|
|
|
+ this.pdf.title = row.fileName
|
|
|
|
+ this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
|
|
|
|
+ },
|
|
|
|
+ // 上一页
|
|
|
|
+ prePage() {
|
|
|
|
+ let page = this.pdf.pageNum
|
|
|
|
+ page = page > 1 ? page - 1 : this.pdf.pageTotalNum
|
|
|
|
+ this.pdf.pageNum = page
|
|
|
|
+ },
|
|
|
|
+ // 下一页
|
|
|
|
+ nextPage() {
|
|
|
|
+ let page = this.pdf.pageNum
|
|
|
|
+ page = page < this.pdf.pageTotalNum ? page + 1 : 1
|
|
|
|
+ this.pdf.pageNum = page
|
|
|
|
+ },
|
|
|
|
+ // 取消
|
|
|
|
+ cancelFile(row, index) {
|
|
|
|
+ // 如果是新增的数据
|
|
|
|
+ if (row.isAdd) {
|
|
|
|
+ this.doc.commonfileList.splice(index, 1)
|
|
|
|
+ } else {
|
|
|
|
+ // 不是新增的数据 还原数据
|
|
|
|
+ for (const i in row.oldRow) {
|
|
|
|
+ row[i] = row.oldRow[i]
|
|
|
|
+ }
|
|
|
|
+ row.isEdit = false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ edit(row) {
|
|
|
|
+ // 备份原始数据
|
|
|
|
+ row['oldRow'] = JSON.parse(JSON.stringify(row));
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ row.isEdit = true;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ save(row) {
|
|
|
|
+ row.isEdit = false;
|
|
|
|
+ var that = this;
|
|
|
|
+ that.loading = true;
|
|
|
|
+ this.form = row;
|
|
|
|
+ if (row.isAdd == true) {
|
|
|
|
+ addCommonfile(this.form).then(response => {
|
|
|
|
+ this.msgSuccess(this.$t('新增成功'));
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ updateCommonfile(this.form).then(response => {
|
|
|
|
+ this.msgSuccess(this.$t('修改成功'));
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /** 删除按钮操作 */
|
|
|
|
+ handleDeleteDoc(row) {
|
|
|
|
+ const ids = row.id || this.ids;
|
|
|
|
+ this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
|
|
|
|
+ confirmButtonText: this.$t('确定'),
|
|
|
|
+ cancelButtonText: this.$t('取消'),
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return delCommonfile(ids);
|
|
|
|
+ }).then(() => {
|
|
|
|
+ this.getFileList()
|
|
|
|
+ this.msgSuccess(this.$t('删除成功'));
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /** 查询学习资料管理列表 */
|
|
|
|
+ getList() {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ listFile(this.queryParams).then(response => {
|
|
|
|
+ this.resourceList = response.rows;
|
|
|
|
+ this.total = response.total;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 查询部门下拉树结构 */
|
|
|
|
+ getTreeselect() {
|
|
|
|
+ treeselect().then(response => {
|
|
|
|
+ this.deptOptions = response.data;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 取消按钮
|
|
|
|
+ cancel() {
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.reset();
|
|
|
|
+ },
|
|
|
|
+ // 表单重置
|
|
|
|
+ reset() {
|
|
|
|
+ this.form = {
|
|
|
|
+ id: null,
|
|
|
|
+ title: null,
|
|
|
|
+ remarks: null,
|
|
|
|
+ delFlag: null,
|
|
|
|
+ createBy: null,
|
|
|
|
+ createTime: null,
|
|
|
|
+ updateBy: null,
|
|
|
|
+ updateTime: null,
|
|
|
|
+ deptId: 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.id)
|
|
|
|
+ this.single = selection.length !== 1
|
|
|
|
+ this.multiple = !selection.length
|
|
|
|
+ },
|
|
|
|
+ /** 新增按钮操作 */
|
|
|
|
+ handleAdd() {
|
|
|
|
+ this.reset();
|
|
|
|
+ this.open = true;
|
|
|
|
+ this.title = "添加学习资料管理";
|
|
|
|
+ },
|
|
|
|
+ /** 修改按钮操作 */
|
|
|
|
+ handleUpdate(row) {
|
|
|
|
+ this.reset();
|
|
|
|
+ const id = row.id || this.ids
|
|
|
|
+ getResource(id).then(response => {
|
|
|
|
+ this.form = response.data;
|
|
|
|
+ this.open = true;
|
|
|
|
+ this.title = "修改学习资料管理";
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 提交按钮 */
|
|
|
|
+ submitForm() {
|
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ if (this.form.id != null) {
|
|
|
|
+ updateResource(this.form).then(response => {
|
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ addResource(this.form).then(response => {
|
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
|
+ this.open = false;
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 删除按钮操作 */
|
|
|
|
+ handleDelete(row) {
|
|
|
|
+ const ids = row.id || this.ids;
|
|
|
|
+ this.$confirm('是否确认删除?', "警告", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(function () {
|
|
|
|
+ return delResource(ids);
|
|
|
|
+ }).then(() => {
|
|
|
|
+ this.getList();
|
|
|
|
+ this.msgSuccess("删除成功");
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+</script>
|