index.vue 9.8 KB

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