index.vue 8.7 KB

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