index.vue 8.3 KB

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