index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div class="app-container trainingCourse">
  3. <div class="title-box">
  4. <el-form class="form-box" :model="queryParams" ref="examineForm" :inline="true" label-width="65px">
  5. <el-form-item label="" prop="name">
  6. <div class="query-type-box">
  7. <p @click="queryTypeClick(null)" :class="queryParams.isStart == null?'check-p':''">全部</p>
  8. <p @click="queryTypeClick(0)" :class="queryParams.isStart == 0?'check-p':''">待开课</p>
  9. <p @click="queryTypeClick(1)" :class="queryParams.isStart == 1?'check-p':''">已开课</p>
  10. </div>
  11. </el-form-item>
  12. <el-form-item label="学院" prop="deptId" label-width="50px">
  13. <el-select style="width:200px;" v-model="queryParams.deptId" placeholder="请选择学院" clearable>
  14. <el-option
  15. v-for="dict in deptList"
  16. :key="dict.deptId"
  17. :label="dict.deptName"
  18. :value="dict.deptId"
  19. ></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="关键字" prop="name">
  23. <el-input
  24. maxlength="10"
  25. v-model="queryParams.searchValue"
  26. placeholder="课程名称/主讲老师"
  27. clearable
  28. size="small"/>
  29. </el-form-item>
  30. <el-form-item>
  31. <p class="inquire-button-one" @click="onSearch">查询</p>
  32. <p class="reset-button-one" @click="resetForm">重置</p>
  33. </el-form-item>
  34. <el-form-item style="float: right;">
  35. <p class="inquire-button-one" style="width:100px;" @click="controlsButton(1)"
  36. v-hasPermi="['exam:security:add']">+ 新增课程</p>
  37. </el-form-item>
  38. </el-form>
  39. </div>
  40. <div class="content-box">
  41. <el-table border :data="tableData" ref="multipleTable">
  42. <el-table-column label="序号" width="50" align="center" type="index"/>
  43. <el-table-column label="课程名称" prop="courseName" show-overflow-tooltip/>
  44. <el-table-column label="学院" prop="place" width="180" show-overflow-tooltip/>
  45. <el-table-column label="上课地点" prop="position" width="100" show-overflow-tooltip>
  46. <template slot-scope="scope">
  47. {{scope.row.subId?scope.row.subName+'-'+scope.row.subRoom:scope.row.position}}
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="主讲老师" prop="lecturerName" width="100" show-overflow-tooltip/>
  51. <el-table-column label="辅导老师" prop="tutorName" width="100" show-overflow-tooltip/>
  52. <el-table-column label="人数" prop="peopleCount" width="80" show-overflow-tooltip/>
  53. <el-table-column label="上课时间" prop="coStartDate" width="150" show-overflow-tooltip>
  54. <template slot-scope="scope">
  55. {{scope.row.coStartTime}} - {{scope.row.coEndTime}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="上课日期" prop="coStartDate" width="200" show-overflow-tooltip/>
  59. <el-table-column label="状态" prop="mainPoint" width="112" show-overflow-tooltip>
  60. <template slot-scope="scope">
  61. {{scope.row.isStart == 1?'已开课':'待开课'}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="操作" width="180" v-if="tableButtonType">
  65. <template slot-scope="scope">
  66. <div class="table-button-box">
  67. <p class="table-button-null"></p>
  68. <p class="table-button-p" @click="controlsButton(3,scope.row)"
  69. v-hasPermi="['exam:security:query']">详情</p>
  70. <p class="table-button-p" v-if="scope.row.isStart != 1" @click="controlsButton(2,scope.row)"
  71. v-hasPermiAnd="['exam:security:query','exam:security:edit']">编辑</p>
  72. <p class="table-button-p" v-if="scope.row.isStart != 1" @click="controlsButton(4,scope.row)"
  73. v-hasPermi="['exam:security:remove']">删除</p>
  74. <p class="table-button-null"></p>
  75. </div>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <pagination :page-sizes="[20, 30, 40, 50]" v-show="total>0" :total="total"
  80. layout="total, prev, pager, next, sizes, jumper"
  81. :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  82. @pagination="getList"/>
  83. </div>
  84. <!--添加/编辑弹窗-->
  85. <add-dialog v-if="addDialogType" :addDialogData="addDialogData"></add-dialog>
  86. <info-dialog v-if="infoDialogType" :infoDialogData="infoDialogData"></info-dialog>
  87. </div>
  88. </template>
  89. <script>
  90. import addDialog from './addDialog.vue'
  91. import infoDialog from './infoDialog.vue'
  92. import { securitycourseList,securitycourseDel,securitycourseInfo } from '@/api/trainingCourse/index'
  93. import { listDepartments } from '@/api/system/dept'
  94. export default {
  95. name: 'trainingCourse',
  96. components: {
  97. addDialog,
  98. infoDialog
  99. },
  100. data(){
  101. return{
  102. tableButtonType:this.hasPermiDom(['exam:security:query','exam:security:edit','exam:security:remove']),
  103. // 遮罩层
  104. loading: false,
  105. //查询数据
  106. queryParams:{
  107. isStart:null,
  108. searchValue:"",
  109. deptId:"",
  110. page:1,
  111. pageSize:20,
  112. },
  113. //列表数据
  114. tableData: [],
  115. total:0,
  116. //新增弹窗数据
  117. addDialogType:false,
  118. addDialogData:{},
  119. //详情弹窗数据
  120. infoDialogType:false,
  121. infoDialogData:{},
  122. //学院数据
  123. deptList:[],
  124. }
  125. },
  126. created(){
  127. },
  128. mounted(){
  129. this.getList();
  130. this.filterDept();
  131. },
  132. methods:{
  133. //列表状态切换
  134. queryTypeClick(type){
  135. if(this.queryParams.isStart != type){
  136. this.$set(this.queryParams,'isStart',type);
  137. this.getList();
  138. }
  139. },
  140. //获取学院
  141. filterDept(){
  142. listDepartments().then(response => {
  143. this.deptList = response.data;
  144. });
  145. },
  146. //列表搜索
  147. onSearch(){
  148. this.$set(this.queryParams,'page',1);
  149. this.getList();
  150. },
  151. //列表重置
  152. resetForm(){
  153. this.$set(this,'queryParams',{
  154. isStart:null,
  155. searchValue:"",
  156. page:1,
  157. pageSize:20,
  158. });
  159. this.onSearch();
  160. },
  161. // 查询数据列表
  162. getList() {
  163. this.loading = true;
  164. securitycourseList(this.queryParams).then( response => {
  165. this.$set(this,'tableData',response.rows);
  166. this.$set(this,'total',response.total);
  167. this.loading = false;
  168. });
  169. },
  170. //操作按钮
  171. controlsButton(type,row){
  172. if(type == 1){
  173. //新增
  174. this.$set(this,'addDialogData',{});
  175. this.$set(this,'addDialogType',true);
  176. }else if(type == 2){
  177. //编辑
  178. securitycourseInfo(row.id).then( response => {
  179. this.$set(this,'addDialogData',response.data);
  180. this.$set(this,'addDialogType',true);
  181. });
  182. }else if(type == 3){
  183. //详情
  184. securitycourseInfo(row.id).then( response => {
  185. this.$set(this,'infoDialogData',response.data);
  186. this.$set(this,'infoDialogType',true);
  187. });
  188. }else if(type == 4){
  189. //删除
  190. let self = this;
  191. this.$confirm('是否确认删除?', "警告", {
  192. confirmButtonText: "确定",
  193. cancelButtonText: "取消",
  194. type: "warning"
  195. }).then(function() {
  196. securitycourseDel(row.id).then(response => {
  197. console.log('123123')
  198. self.msgSuccess(response.msg)
  199. self.getList();
  200. })
  201. }).then(() => {
  202. }).catch(() => {});
  203. }else if(type == 5){
  204. //关闭新增&编辑窗口
  205. this.$set(this,'addDialogType',false);
  206. this.$set(this,'addDialogData',{});
  207. }else if(type == 6){
  208. //关闭新增&编辑窗口 并刷新页面
  209. this.$set(this,'addDialogType',false);
  210. this.$set(this,'addDialogData',{});
  211. this.resetForm();
  212. }else if(type == 7){
  213. //关闭详情窗口
  214. this.$set(this,'infoDialogType',false);
  215. this.$set(this,'infoDialogData',{});
  216. }
  217. },
  218. }
  219. }
  220. </script>
  221. <style scoped lang="scss">
  222. .trainingCourse{
  223. flex:1;
  224. display: flex!important;
  225. flex-direction: column;
  226. overflow: hidden;
  227. font-weight: 500;
  228. .title-box{
  229. padding-top:20px;
  230. .form-box{
  231. border-bottom:1px solid #E0E0E0;
  232. .query-type-box{
  233. margin-left:20px;
  234. display: flex;
  235. p{
  236. line-height:40px;
  237. font-size:14px;
  238. color:#333;
  239. width:80px;
  240. text-align: center;
  241. cursor: pointer;
  242. }
  243. p:nth-child(1){
  244. border:1px solid #E0E0E0;
  245. border-radius: 4px 0 0 4px
  246. }
  247. p:nth-child(2){
  248. border-top:1px solid #E0E0E0;
  249. border-bottom:1px solid #E0E0E0;
  250. }
  251. p:nth-child(3){
  252. border:1px solid #E0E0E0;
  253. border-radius: 0 4px 4px 0
  254. }
  255. .check-p{
  256. color:#fff;
  257. background: #0045AF;
  258. border-color:#0045AF!important;
  259. }
  260. }
  261. }
  262. }
  263. .content-box{
  264. flex:1;
  265. overflow: hidden;
  266. display: flex;
  267. flex-direction: column;
  268. padding:20px;
  269. }
  270. }
  271. </style>