|
@@ -0,0 +1,1209 @@
|
|
|
|
+<template>
|
|
|
|
+ <div>
|
|
|
|
+ <section class="content">
|
|
|
|
+ <div class="box box-info">
|
|
|
|
+ <!-- 头信息 -->
|
|
|
|
+ <div class="box-header with-border">
|
|
|
|
+ <h3 class="box-title">课程列表</h3>
|
|
|
|
+ <div class="box-tools pull-right">
|
|
|
|
+ <button
|
|
|
|
+ type="button"
|
|
|
|
+ class="btn btn-box-tool"
|
|
|
|
+ data-widget="collapse"
|
|
|
|
+ >
|
|
|
|
+ <i class="fa fa-minus"></i>
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- 正文信息 -->
|
|
|
|
+ <div
|
|
|
|
+ class="box-body"
|
|
|
|
+ v-loading.body="fileLoading"
|
|
|
|
+ element-loading-text="课程上传中,请稍后..."
|
|
|
|
+ >
|
|
|
|
+ <!-- 表单 -->
|
|
|
|
+ <el-form
|
|
|
|
+ :inline="true"
|
|
|
|
+ :model="formSearch"
|
|
|
|
+ label-position="right"
|
|
|
|
+ label-width="100px"
|
|
|
|
+ >
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item label="课程名称" class="pull-left">
|
|
|
|
+ <el-input
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ placeholder="请输入课程名称"
|
|
|
|
+ v-model="formSearch.name"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="课程代码" class="pull-left">
|
|
|
|
+ <el-input
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ placeholder="请输入课程代码"
|
|
|
|
+ v-model="formSearch.code"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="课程状态" class="pull-left">
|
|
|
|
+ <el-select
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ v-model="formSearch.enable"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in statusList"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="层次" class="pull-left">
|
|
|
|
+ <el-select
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ v-model="formSearch.level"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in levelList"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="专业" class="pull-left" prop="specialtyId">
|
|
|
|
+ <el-select
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ remote
|
|
|
|
+ :remote-method="getSpecialtyList4Search"
|
|
|
|
+ :loading="specialtyLoading4Search"
|
|
|
|
+ filterable
|
|
|
|
+ clearable
|
|
|
|
+ v-model="formSearch.specialtyId"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in specialtyList4SearchWrapper"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.id"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item class="pull-right">
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="search"
|
|
|
|
+ @click="searchForm"
|
|
|
|
+ >查询</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="primary" @click="impCourse">
|
|
|
|
+ <i class="fa fa-upload" aria-hidden="true"></i>导入
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button size="small" type="primary" @click="exportCourse">
|
|
|
|
+ <i class="fa fa-download" aria-hidden="true"></i>导出
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="plus"
|
|
|
|
+ @click="insertCourse"
|
|
|
|
+ >新增</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="success" @click="enableByIds">
|
|
|
|
+ <i class="fa fa-check" aria-hidden="true"></i>启用
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button size="small" type="warning" @click="disableByIds">
|
|
|
|
+ <i class="fa fa-close" aria-hidden="true"></i>禁用
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+
|
|
|
|
+ <!-- 添加或新增课程弹出框 -->
|
|
|
|
+ <el-dialog title="课程学习" :visible.sync="courseDialog" size="tiny">
|
|
|
|
+ <el-form
|
|
|
|
+ :inline="true"
|
|
|
|
+ :model="courseForm"
|
|
|
|
+ ref="courseForm"
|
|
|
|
+ :rules="rules"
|
|
|
|
+ label-position="right"
|
|
|
|
+ label-width="90px"
|
|
|
|
+ >
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item label="课程代码" label-width="120px" prop="code">
|
|
|
|
+ <el-input
|
|
|
|
+ :disabled="null != courseForm.id"
|
|
|
|
+ class="pull_length"
|
|
|
|
+ v-model="courseForm.code"
|
|
|
|
+ auto-complete="off"
|
|
|
|
+ placeholder="请输入课程代码"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item label="课程名称" label-width="120px" prop="name">
|
|
|
|
+ <el-input
|
|
|
|
+ class="pull_length"
|
|
|
|
+ v-model="courseForm.name"
|
|
|
|
+ auto-complete="off"
|
|
|
|
+ placeholder="请输入课程名称"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item label="层次" label-width="120px" prop="level">
|
|
|
|
+ <el-select
|
|
|
|
+ style="width: 198px"
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ v-model="courseForm.level"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in levelList"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="课程状态"
|
|
|
|
+ label-width="120px"
|
|
|
|
+ prop="enable"
|
|
|
|
+ >
|
|
|
|
+ <el-radio-group
|
|
|
|
+ class="pull_right_sm"
|
|
|
|
+ v-model="courseForm.enable"
|
|
|
|
+ >
|
|
|
|
+ <el-radio label="true">开启</el-radio>
|
|
|
|
+ <el-radio label="false">关闭</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row class="pull-center">
|
|
|
|
+ <el-button type="primary" @click="submitForm">保 存</el-button>
|
|
|
|
+ <el-button @click="courseDialog = false;">取 消</el-button>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 导入弹窗 -->
|
|
|
|
+ <el-dialog title="导入窗口" size="tiny" :visible.sync="impDialog">
|
|
|
|
+ <el-form>
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item style="margin-left:20px">
|
|
|
|
+ <el-upload
|
|
|
|
+ class="form_left"
|
|
|
|
+ ref="upload"
|
|
|
|
+ accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
|
|
+ :action="uploadAction"
|
|
|
|
+ :headers="uploadHeaders"
|
|
|
|
+ :data="uploadData"
|
|
|
|
+ :before-upload="beforeUpload"
|
|
|
|
+ :on-progress="uploadProgress"
|
|
|
|
+ :on-success="uploadSuccess"
|
|
|
|
+ :on-error="uploadError"
|
|
|
|
+ :file-list="fileList"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ :multiple="false"
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" slot="trigger" type="primary"
|
|
|
|
+ >选择文件</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="success" @click="submitUpload"
|
|
|
|
+ >确认上传</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="danger" @click="removeFile"
|
|
|
|
+ >清空文件</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="info" @click="exportFile"
|
|
|
|
+ >下载模板</el-button
|
|
|
|
+ >
|
|
|
|
+ <div slot="tip" class="el-upload__tip">
|
|
|
|
+ 只能上传xlsx文件
|
|
|
|
+ </div>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 导入错误信息列表 -->
|
|
|
|
+ <el-dialog title="错误提示" :visible.sync="errDialog">
|
|
|
|
+ <div
|
|
|
|
+ class="text-danger"
|
|
|
|
+ v-for="errMessage in errMessages"
|
|
|
|
+ :key="errMessage.lineNum"
|
|
|
|
+ >
|
|
|
|
+ 第{{ errMessage.lineNum }}行:{{ errMessage.msg }}
|
|
|
|
+ </div>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="errDialog = false;">确定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 关联专业弹出框 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ :title="specialtyDialogTitle"
|
|
|
|
+ :visible.sync="specialtyDialog"
|
|
|
|
+ size="small"
|
|
|
|
+ >
|
|
|
|
+ <!-- 表单 -->
|
|
|
|
+ <el-form
|
|
|
|
+ :inline="true"
|
|
|
|
+ :model="specialtySearchForm"
|
|
|
|
+ label-position="right"
|
|
|
|
+ label-width="100px"
|
|
|
|
+ >
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item label="专业名称" class="pull-left">
|
|
|
|
+ <el-input
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ placeholder="请输入专业名称"
|
|
|
|
+ v-model="specialtySearchForm.name"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="专业代码" class="pull-left">
|
|
|
|
+ <el-input
|
|
|
|
+ class="input_width_lg"
|
|
|
|
+ placeholder="请输入专业代码"
|
|
|
|
+ v-model="specialtySearchForm.code"
|
|
|
|
+ ></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item class="pull-right">
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="search"
|
|
|
|
+ @click="searchSpecialtyPage"
|
|
|
|
+ >查询
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ icon="search"
|
|
|
|
+ @click="addRelation"
|
|
|
|
+ >新增
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+
|
|
|
|
+ <!-- 专业列表 -->
|
|
|
|
+ <el-table
|
|
|
|
+ :data="specialtyTableData"
|
|
|
|
+ border
|
|
|
|
+ style="width: 100%;text-align:center;"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column prop="id" label="ID" width="150">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="name" label="专业名称" width="250">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="code" label="专业代码"> </el-table-column>
|
|
|
|
+ <el-table-column prop="updateTime" label="更新时间" width="170">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ <span>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="info"
|
|
|
|
+ @click="deleteRelation(scope.row);"
|
|
|
|
+ >
|
|
|
|
+ <i class="el-icon-edit"></i> 取消关联
|
|
|
|
+ </el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div class="page pull-right">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @current-change="handleSpecialtyCurrentChange"
|
|
|
|
+ :current-page="currentSpecialtyPage"
|
|
|
|
+ :page-size="10"
|
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
|
+ :total="specialtyTotal"
|
|
|
|
+ >
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 添加关联 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ title="添加关联专业"
|
|
|
|
+ v-model="addRelationDialog"
|
|
|
|
+ size="tiny"
|
|
|
|
+ >
|
|
|
|
+ <el-form
|
|
|
|
+ :inline="true"
|
|
|
|
+ :model="addRelationForm"
|
|
|
|
+ ref="addRelationForm"
|
|
|
|
+ label-position="right"
|
|
|
|
+ label-width="100px"
|
|
|
|
+ :rules="addRelationRules"
|
|
|
|
+ >
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-form-item label="专业" class="pull-left" prop="specialtyId">
|
|
|
|
+ <el-select
|
|
|
|
+ class="input"
|
|
|
|
+ remote
|
|
|
|
+ :remote-method="getSpecialtyList4AddRelation"
|
|
|
|
+ :loading="specialtyLoading4AddRelation"
|
|
|
|
+ filterable
|
|
|
|
+ clearable
|
|
|
|
+ v-model="addRelationForm.specialtyId"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in specialtyList4AddRelationWrapper"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.id"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row class="pull_center">
|
|
|
|
+ <el-button type="primary" @click="submitAddRelationForm"
|
|
|
|
+ >保 存</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button @click="addRelationDialog = false;">取 消</el-button>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 页面列表 -->
|
|
|
|
+ <el-table
|
|
|
|
+ :data="tableData"
|
|
|
|
+ border
|
|
|
|
+ style="width: 100%;text-align:center;"
|
|
|
|
+ @selection-change="selectChange"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column type="selection" width="50"></el-table-column>
|
|
|
|
+ <el-table-column prop="id" label="课程ID" width="150">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="name" label="课程名称" width="250">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="code" label="课程代码"> </el-table-column>
|
|
|
|
+ <el-table-column label="层次">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ <span>{{ getLevel(scope.row.level) }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="状态" width="70">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ <span>
|
|
|
|
+ <el-tag :type="getTag(scope.row.enable)">
|
|
|
|
+ {{ getEnable(scope.row.enable) }}
|
|
|
|
+ </el-tag>
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="updateTime" label="更新时间" width="170">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <div>
|
|
|
|
+ <el-button size="mini" type="primary" @click="relation(row);">
|
|
|
|
+ 关联专业
|
|
|
|
+ </el-button>
|
|
|
|
+ <span>
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="info"
|
|
|
|
+ @click="editCourse(row);"
|
|
|
|
+ >
|
|
|
|
+ <i class="el-icon-edit"></i> 修改
|
|
|
|
+ </el-button>
|
|
|
|
+ </span>
|
|
|
|
+ <span v-if="!scope.row.enable">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="success"
|
|
|
|
+ @click="enableById(row);"
|
|
|
|
+ >
|
|
|
|
+ <i class="fa fa-check" aria-hidden="true"></i>启用
|
|
|
|
+ </el-button>
|
|
|
|
+ </span>
|
|
|
|
+ <span v-if="scope.row.enable">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="warning"
|
|
|
|
+ @click="disableById(row);"
|
|
|
|
+ >
|
|
|
|
+ <i class="fa fa-close" aria-hidden="true"></i>禁用
|
|
|
|
+ </el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div class="page pull-right">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
+ :current-page="currentPage"
|
|
|
|
+ :page-size="10"
|
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
|
+ :total="total"
|
|
|
|
+ >
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </section>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { core_api, ENABLE_TYPE, LEVEL_TYPE } from "../constants/constants.js";
|
|
|
|
+import { mapState } from "vuex";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ specialtyLoading4Search: false,
|
|
|
|
+ specialtyList4Search: [],
|
|
|
|
+ formSearch: {
|
|
|
|
+ name: "",
|
|
|
|
+ code: "",
|
|
|
|
+ enable: "",
|
|
|
|
+ level: "",
|
|
|
|
+ specialtyId: ""
|
|
|
|
+ },
|
|
|
|
+ courseForm: {
|
|
|
|
+ id: null,
|
|
|
|
+ name: "",
|
|
|
|
+ code: "",
|
|
|
|
+ level: "ALL",
|
|
|
|
+ enable: "true"
|
|
|
|
+ },
|
|
|
|
+ statusList: ENABLE_TYPE,
|
|
|
|
+ levelList: LEVEL_TYPE,
|
|
|
|
+ selectedCourseIds: [],
|
|
|
|
+ tableData: [],
|
|
|
|
+ currentPage: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ total: 10,
|
|
|
|
+ specialtyAllList: [],
|
|
|
|
+ specialtyList: [],
|
|
|
|
+ selectedSpecialtyList: [],
|
|
|
|
+ specialtys: [],
|
|
|
|
+ specialtyAll: [],
|
|
|
|
+
|
|
|
|
+ impDialog: false,
|
|
|
|
+ uploadAction: core_api + "/course/import",
|
|
|
|
+ uploadHeaders: {},
|
|
|
|
+ uploadData: {},
|
|
|
|
+ errMessages: [],
|
|
|
|
+ errDialog: false,
|
|
|
|
+ fileLoading: false,
|
|
|
|
+ fileList: [],
|
|
|
|
+
|
|
|
|
+ courseDialog: false,
|
|
|
|
+ relationDialog: false,
|
|
|
|
+
|
|
|
|
+ rules: {
|
|
|
|
+ name: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入课程名称",
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ code: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入课程代码",
|
|
|
|
+ trigger: "blur"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ level: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择层次",
|
|
|
|
+ trigger: "change"
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ status: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择状态",
|
|
|
|
+ trigger: "change"
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ specialtyDialog: false,
|
|
|
|
+ specialtyDialogTitle: null,
|
|
|
|
+ specialtySearchForm: {
|
|
|
|
+ courseId: null,
|
|
|
|
+ code: null,
|
|
|
|
+ name: null
|
|
|
|
+ },
|
|
|
|
+ specialtyTableData: [],
|
|
|
|
+ currentSpecialtyPage: 1,
|
|
|
|
+ specialtyPageSize: 10,
|
|
|
|
+ specialtyTotal: 10,
|
|
|
|
+
|
|
|
|
+ addRelationDialog: false,
|
|
|
|
+ addRelationForm: {
|
|
|
|
+ specialtyId: null,
|
|
|
|
+ courseId: null
|
|
|
|
+ },
|
|
|
|
+ specialtyLoading4AddRelation: false,
|
|
|
|
+ specialtyList4AddRelation: [],
|
|
|
|
+ addRelationRules: {
|
|
|
|
+ specialtyId: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ type: "number",
|
|
|
|
+ message: "请选择专业",
|
|
|
|
+ trigger: "change"
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState({
|
|
|
|
+ user: state => state.user
|
|
|
|
+ }),
|
|
|
|
+ courseIds() {
|
|
|
|
+ var courseIds = "";
|
|
|
|
+ for (let courseId of this.selectedCourseIds) {
|
|
|
|
+ if (!courseIds) {
|
|
|
|
+ courseIds += courseId;
|
|
|
|
+ } else {
|
|
|
|
+ courseIds += "," + courseId;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return courseIds;
|
|
|
|
+ },
|
|
|
|
+ specialtyAllListSelect() {
|
|
|
|
+ let specialtyList = [];
|
|
|
|
+ for (let specialty of this.specialtyAllList) {
|
|
|
|
+ let specialtyInfo = specialty.name + "(" + specialty.code + ")";
|
|
|
|
+ specialtyList.push({ id: specialty.id, specialtyInfo: specialtyInfo });
|
|
|
|
+ }
|
|
|
|
+ return specialtyList;
|
|
|
|
+ },
|
|
|
|
+ getSpecialtyAllSelect4Search() {
|
|
|
|
+ let specialtyList4Search = [];
|
|
|
|
+ for (let specialty of this.specialtys) {
|
|
|
|
+ let specialtyInfo = specialty.name + "(" + specialty.code + ")";
|
|
|
|
+ specialtyList4Search.push({
|
|
|
|
+ id: specialty.id,
|
|
|
|
+ specialtyInfo: specialtyInfo
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return specialtyList4Search;
|
|
|
|
+ },
|
|
|
|
+ specialtyList4SearchWrapper() {
|
|
|
|
+ var specialtyList = [];
|
|
|
|
+ for (let course of this.specialtyList4Search) {
|
|
|
|
+ var name = course.name + " - " + course.code;
|
|
|
|
+ var id = course.id;
|
|
|
|
+ specialtyList.push({ id: id, name: name });
|
|
|
|
+ }
|
|
|
|
+ return specialtyList;
|
|
|
|
+ },
|
|
|
|
+ specialtyList4AddRelationWrapper() {
|
|
|
|
+ var specialtyList = [];
|
|
|
|
+ for (let course of this.specialtyList4AddRelation) {
|
|
|
|
+ var name = course.name + " - " + course.code;
|
|
|
|
+ var id = course.id;
|
|
|
|
+ specialtyList.push({ id: id, name: name });
|
|
|
|
+ }
|
|
|
|
+ return specialtyList;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ deleteRelation(row) {
|
|
|
|
+ var specialtyId = row.id;
|
|
|
|
+ var courseId = this.specialtySearchForm.courseId;
|
|
|
|
+ var param = new URLSearchParams({
|
|
|
|
+ courseId: courseId,
|
|
|
|
+ specialtyId: specialtyId
|
|
|
|
+ });
|
|
|
|
+ var url = core_api + "/courseSpeciatlyRelation/delete?" + param;
|
|
|
|
+ this.$http
|
|
|
|
+ .delete(url)
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "取消关联成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchSpecialtyPage();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ submitAddRelationForm() {
|
|
|
|
+ this.$refs.addRelationForm.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ var param = new URLSearchParams(this.addRelationForm);
|
|
|
|
+ var url = core_api + "/courseSpeciatlyRelation/add?" + param;
|
|
|
|
+ this.$http.post(url, this.speciallyForm).then(
|
|
|
|
+ () => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "添加成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchSpecialtyPage();
|
|
|
|
+ this.addRelationDialog = false;
|
|
|
|
+ },
|
|
|
|
+ response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ console.log("error submit!");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getSpecialtyList4AddRelation(query) {
|
|
|
|
+ this.specialtyLoading4AddRelation = true;
|
|
|
|
+ this.$http
|
|
|
|
+ .get(core_api + "/specialty/query?name=" + query)
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.specialtyList4AddRelation = response.data;
|
|
|
|
+ this.specialtyLoading4AddRelation = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ addRelation() {
|
|
|
|
+ this.addRelationForm.specialtyId = null;
|
|
|
|
+ this.addRelationForm.courseId = this.specialtySearchForm.courseId;
|
|
|
|
+ this.addRelationDialog = true;
|
|
|
|
+ if (this.$refs.addRelationForm) {
|
|
|
|
+ this.$refs.addRelationForm.resetFields();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleSpecialtyCurrentChange(val) {
|
|
|
|
+ this.currentSpecialtyPage = val;
|
|
|
|
+ this.searchSpecialtyPage();
|
|
|
|
+ },
|
|
|
|
+ searchSpecialtyPage() {
|
|
|
|
+ var param = new URLSearchParams(this.specialtySearchForm);
|
|
|
|
+ var url =
|
|
|
|
+ core_api +
|
|
|
|
+ "/specialty/specialtyPage/" +
|
|
|
|
+ (this.currentPage - 1) +
|
|
|
|
+ "/" +
|
|
|
|
+ this.pageSize +
|
|
|
|
+ "?" +
|
|
|
|
+ param;
|
|
|
|
+ this.$http.get(url).then(response => {
|
|
|
|
+ this.specialtyTableData = response.data.content;
|
|
|
|
+ this.specialtyTotal = response.data.totalElements;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getEnable(enable) {
|
|
|
|
+ if (enable == true) {
|
|
|
|
+ return "启用";
|
|
|
|
+ } else if (enable == false) {
|
|
|
|
+ return "禁用";
|
|
|
|
+ }
|
|
|
|
+ return enable;
|
|
|
|
+ },
|
|
|
|
+ getTag(status) {
|
|
|
|
+ if (status == true) {
|
|
|
|
+ return "success";
|
|
|
|
+ } else if (status == false) {
|
|
|
|
+ return "danger";
|
|
|
|
+ }
|
|
|
|
+ return status;
|
|
|
|
+ },
|
|
|
|
+ getLevel(level) {
|
|
|
|
+ if (level == "ZSB") {
|
|
|
|
+ return "专升本";
|
|
|
|
+ } else if (level == "GQZ") {
|
|
|
|
+ return "高起专";
|
|
|
|
+ } else if (level == "GQB") {
|
|
|
|
+ return "高起本";
|
|
|
|
+ } else {
|
|
|
|
+ return "不限";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ getSpecialtyList4Search(query) {
|
|
|
|
+ this.specialtyLoading4Search = true;
|
|
|
|
+ this.$http
|
|
|
|
+ .get(core_api + "/specialty/query?name=" + query)
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.specialtyList4Search = response.data;
|
|
|
|
+ this.specialtyLoading4Search = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ searchForm() {
|
|
|
|
+ var param = new URLSearchParams(this.formSearch);
|
|
|
|
+ var url =
|
|
|
|
+ core_api +
|
|
|
|
+ "/course/coursePage/" +
|
|
|
|
+ (this.currentPage - 1) +
|
|
|
|
+ "/" +
|
|
|
|
+ this.pageSize +
|
|
|
|
+ "?" +
|
|
|
|
+ param;
|
|
|
|
+ this.$http.get(url).then(response => {
|
|
|
|
+ console.log(response);
|
|
|
|
+ this.tableData = response.data.content;
|
|
|
|
+ this.total = response.data.totalElements;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ handleCurrentChange(val) {
|
|
|
|
+ this.currentPage = val;
|
|
|
|
+ this.searchForm();
|
|
|
|
+ },
|
|
|
|
+ selectChange(row) {
|
|
|
|
+ this.selectedCourseIds = [];
|
|
|
|
+ row.forEach(element => {
|
|
|
|
+ this.selectedCourseIds.push(element.id);
|
|
|
|
+ });
|
|
|
|
+ console.log(this.selectedCourseIds);
|
|
|
|
+ },
|
|
|
|
+ //新增
|
|
|
|
+ insertCourse() {
|
|
|
|
+ this.courseForm.id = null;
|
|
|
|
+ this.courseForm.name = null;
|
|
|
|
+ this.courseForm.code = null;
|
|
|
|
+ this.courseForm.level = "ALL";
|
|
|
|
+ this.courseForm.enable = "true";
|
|
|
|
+
|
|
|
|
+ this.courseDialog = true;
|
|
|
|
+ },
|
|
|
|
+ //修改
|
|
|
|
+ editCourse(row) {
|
|
|
|
+ this.courseForm = Object.assign({}, row);
|
|
|
|
+ this.courseForm.enable = row.enable ? "true" : "false";
|
|
|
|
+ this.courseId = row.id;
|
|
|
|
+
|
|
|
|
+ this.courseDialog = true;
|
|
|
|
+ },
|
|
|
|
+ exportCourse() {
|
|
|
|
+ var param = new URLSearchParams(this.formSearch);
|
|
|
|
+ window.open(
|
|
|
|
+ core_api +
|
|
|
|
+ "/course/export?$key=" +
|
|
|
|
+ this.user.key +
|
|
|
|
+ "&$token=" +
|
|
|
|
+ this.user.token +
|
|
|
|
+ "&" +
|
|
|
|
+ param
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //关联课程
|
|
|
|
+ relation(row) {
|
|
|
|
+ this.specialtyDialogTitle =
|
|
|
|
+ "关联专业列表 【课程名称:" +
|
|
|
|
+ row.name +
|
|
|
|
+ "】【 课程代码:" +
|
|
|
|
+ row.code +
|
|
|
|
+ "】";
|
|
|
|
+ this.specialtySearchForm.courseId = row.id;
|
|
|
|
+ this.specialtySearchForm.name = null;
|
|
|
|
+ this.specialtySearchForm.code = null;
|
|
|
|
+
|
|
|
|
+ this.searchSpecialtyPage();
|
|
|
|
+ this.specialtyDialog = true;
|
|
|
|
+ },
|
|
|
|
+ closeCourse() {
|
|
|
|
+ this.courseDialog = false;
|
|
|
|
+ },
|
|
|
|
+ saveRelation() {},
|
|
|
|
+ //保存(新增/修改)
|
|
|
|
+ submitForm() {
|
|
|
|
+ var url = core_api + "/course";
|
|
|
|
+ if (null != this.courseForm.id) {
|
|
|
|
+ //修改
|
|
|
|
+ this.$refs.courseForm.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.$http.put(url, this.courseForm).then(
|
|
|
|
+ () => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "修改成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ this.resetForm();
|
|
|
|
+ this.courseDialog = false;
|
|
|
|
+ },
|
|
|
|
+ response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ console.log("error submit!");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.courseForm.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.$http.post(url, this.courseForm).then(
|
|
|
|
+ () => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "添加成功"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ this.resetForm();
|
|
|
|
+ this.courseDialog = false;
|
|
|
|
+ },
|
|
|
|
+ response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ console.log("error submit!");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //重置
|
|
|
|
+ resetForm() {
|
|
|
|
+ this.$refs.courseForm.resetFields();
|
|
|
|
+ },
|
|
|
|
+ //删除单个数据
|
|
|
|
+ deleteById(row) {
|
|
|
|
+ this.$confirm("是否删除该课程?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ var url = core_api + "/course/" + row.id;
|
|
|
|
+ this.$http
|
|
|
|
+ .delete(url)
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "删除成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //删除多条数据
|
|
|
|
+ deleteByIds() {
|
|
|
|
+ if (this.selectedCourseIds.length === 0) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "warning",
|
|
|
|
+ message: "请选择要删除的课程"
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$confirm("是否删除这些课程?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "error"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ var url = core_api + "/course/" + this.courseIds;
|
|
|
|
+ this.$http
|
|
|
|
+ .delete(url)
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "删除成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //启用
|
|
|
|
+ enableByIds() {
|
|
|
|
+ if (this.selectedCourseIds.length === 0) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "warning",
|
|
|
|
+ message: "请选择要开启的课程"
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$confirm("是否启用这些课程?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ var url = core_api + "/course/enable/" + this.courseIds;
|
|
|
|
+ this.$http
|
|
|
|
+ .put(url, {})
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "开启成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ enableById(row) {
|
|
|
|
+ this.$confirm("是否启用该课程?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ var url = core_api + "/course/enable/" + row.id;
|
|
|
|
+ this.$http
|
|
|
|
+ .put(url, {})
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "开启成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //禁用
|
|
|
|
+ disableByIds() {
|
|
|
|
+ if (this.selectedCourseIds.length === 0) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "warning",
|
|
|
|
+ message: "请选择要禁用的课程"
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$confirm("是否禁用这些课程?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "error"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ var url = core_api + "/course/disable/" + this.courseIds;
|
|
|
|
+ this.$http
|
|
|
|
+ .put(url, {})
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "禁用成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //禁用
|
|
|
|
+ disableById(row) {
|
|
|
|
+ this.$confirm("是否禁用该课程?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "error"
|
|
|
|
+ }).then(() => {
|
|
|
|
+ var url = core_api + "/course/disable/" + row.id;
|
|
|
|
+ this.$http
|
|
|
|
+ .put(url, {})
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "禁用成功!"
|
|
|
|
+ });
|
|
|
|
+ this.searchForm();
|
|
|
|
+ })
|
|
|
|
+ .catch(response => {
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ showClose: true,
|
|
|
|
+ message: response.data.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //导入
|
|
|
|
+ impCourse() {
|
|
|
|
+ this.impDialog = true;
|
|
|
|
+ this.initUpload();
|
|
|
|
+ },
|
|
|
|
+ initUpload() {
|
|
|
|
+ this.fileList = [];
|
|
|
|
+ },
|
|
|
|
+ beforeUpload(file) {
|
|
|
|
+ console.log(file);
|
|
|
|
+ },
|
|
|
|
+ uploadProgress() {
|
|
|
|
+ console.log("uploadProgress");
|
|
|
|
+ },
|
|
|
|
+ uploadSuccess(response) {
|
|
|
|
+ if (!response.hasError) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ this.fileLoading = false;
|
|
|
|
+ this.impDialog = false;
|
|
|
|
+ this.searchForm();
|
|
|
|
+ } else {
|
|
|
|
+ this.fileLoading = false;
|
|
|
|
+ this.impDialog = false;
|
|
|
|
+ this.errMessages = response.failRecords;
|
|
|
|
+ this.errDialog = true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ uploadError(response) {
|
|
|
|
+ var jsonStr = response.message.substring(4);
|
|
|
|
+ var resp = eval("(" + jsonStr + ")");
|
|
|
|
+ if (response.status == 500) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: resp.desc,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.fileLoading = false;
|
|
|
|
+ },
|
|
|
|
+ //确定上传
|
|
|
|
+ submitUpload() {
|
|
|
|
+ if (!this.checkUpload()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ this.$refs.upload.submit();
|
|
|
|
+ this.fileLoading = true;
|
|
|
|
+ },
|
|
|
|
+ checkUpload() {
|
|
|
|
+ var fileList = this.$refs.upload.uploadFiles;
|
|
|
|
+ if (fileList.length == 0) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传文件不能为空",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (fileList.length > 1) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "每次只能上传一个文件",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ for (let file of fileList) {
|
|
|
|
+ if (!file.name.endsWith(".xlsx")) {
|
|
|
|
+ this.$notify({
|
|
|
|
+ message: "上传文件必须为xlsx格式",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ this.initUpload();
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ },
|
|
|
|
+ //清空文件
|
|
|
|
+ removeFile() {
|
|
|
|
+ // this.fileList = [];
|
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
|
+ },
|
|
|
|
+ //下载模板
|
|
|
|
+ exportFile() {
|
|
|
|
+ window.location.href =
|
|
|
|
+ core_api +
|
|
|
|
+ "/course/importTemplate?$key=" +
|
|
|
|
+ this.user.key +
|
|
|
|
+ "&$token=" +
|
|
|
|
+ this.user.token;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //初始化查询
|
|
|
|
+ created() {
|
|
|
|
+ this.searchForm();
|
|
|
|
+ this.uploadHeaders = {
|
|
|
|
+ key: this.user.key,
|
|
|
|
+ token: this.user.token
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.input_width_lg {
|
|
|
|
+ width: 180px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.pull-center {
|
|
|
|
+ margin-left: 30%;
|
|
|
|
+}
|
|
|
|
+</style>
|