index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <!-- 考试安排 -->
  2. <template>
  3. <div class="app-container examinationArrange">
  4. <div class="page-container examinationArrangePage" v-if="pageType === 1">
  5. <div class="page-form-title-box">
  6. <el-form :model="queryParams" class="form-box" ref="queryForm"
  7. :inline="true" style="width:100%;">
  8. <el-form-item label="" prop="shareStatus">
  9. <el-select v-model="queryParams.shareStatus" placeholder="是否共享" style="width: 120px">
  10. <el-option label="共享" value="1"/>
  11. <el-option label="不共享" value="2"/>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="" prop="disciplineTypeId">
  15. <el-select v-model="queryParams.disciplineTypeId" placeholder="专业类别" style="width: 140px">
  16. <el-option
  17. v-for="dict in optionListA"
  18. :key="dict.id"
  19. :label="dict.disciplineName"
  20. :value="dict.id"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="" prop="examTypeId">
  25. <el-select v-model="queryParams.examTypeId" placeholder="考试类别" style="width: 140px">
  26. <el-option
  27. v-for="dict in optionListB"
  28. :key="dict.id"
  29. :label="dict.examTypeName"
  30. :value="dict.id"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="" prop="deptId">
  35. <el-cascader
  36. style="width: 180px"
  37. v-model="queryParams.deptId"
  38. :options="optionListC"
  39. :props="{
  40. emitPath:false,
  41. checkStrictly: true,
  42. value: 'deptId',
  43. label: 'deptName',
  44. children: 'child',
  45. }"
  46. :show-all-levels="false"
  47. filterable
  48. placeholder="学院单位"
  49. ></el-cascader>
  50. </el-form-item>
  51. <el-form-item label="" prop="status">
  52. <el-select v-model="queryParams.status" placeholder="状态" style="width: 120px">
  53. <el-option label="停用" value="0"/>
  54. <el-option label="未开始" value="1"/>
  55. <el-option label="进行中" value="2"/>
  56. <el-option label="已结束" value="3"/>
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item label="" prop="makeup">
  60. <el-select v-model="queryParams.makeup" placeholder="是否补考" style="width: 140px">
  61. <el-option label="正常考试" value="0"/>
  62. <el-option label="补考" value="1"/>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item label="" prop="searchValue">
  66. <el-input
  67. maxLength="30"
  68. v-model="queryParams.searchValue"
  69. placeholder="考试名称"
  70. style="width: 140px"
  71. />
  72. </el-form-item>
  73. <el-form-item label="" prop="state">
  74. <el-date-picker
  75. :clearable="false"
  76. v-model="dateRange"
  77. size="small"
  78. style="width: 220px"
  79. value-format="yyyy-MM-dd"
  80. type="daterange"
  81. range-separator="-"
  82. start-placeholder="开始日期"
  83. end-placeholder="结束日期"
  84. ></el-date-picker>
  85. </el-form-item>
  86. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  87. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  88. <p class="page-submit-common-style-button"
  89. style="float: right;"
  90. @click="tableButton(1)"
  91. v-hasPermiRouter="['exam:elExam:add']"
  92. >新建考试</p>
  93. </el-form>
  94. </div>
  95. <div class="page-content-box">
  96. <el-table class="table-box" border :data="dataList">
  97. <el-table-column label="考试名称" prop="examName" show-overflow-tooltip>
  98. <template slot-scope="scope">
  99. <span style="color:#0183fa;cursor: pointer;" @click="tableButton(7,scope.row)">{{scope.row.examName}}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="考试类型" prop="examTypeName" width="140" show-overflow-tooltip/>
  103. <el-table-column label="专业类别" prop="disciplineTypeName" width="140" show-overflow-tooltip/>
  104. <el-table-column label="是否共享" prop="shareStatus" width="120" show-overflow-tooltip>
  105. <template slot-scope="scope">
  106. <span style="padding:2px 10px;border:1px solid rgb(1, 131, 251);border-radius:4px;color: rgb(1, 131, 251);background-color:rgba(1, 131, 251,0.2)" v-if="scope.row.shareStatus==1">共享</span>
  107. <span style="padding:2px 10px;border:1px solid rgb(245, 154, 35);border-radius:4px;color: rgb(245, 154, 35);background-color:rgba(245, 154, 35,0.2)" v-if="scope.row.shareStatus==0">不共享</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="考试时间" prop="createTime" width="300" show-overflow-tooltip>
  111. <template slot-scope="scope">
  112. <span>{{parseTime(scope.row.startTime,"{y}-{m}-{d} {h}:{i}")}} 至 {{parseTime(scope.row.endTime,"{y}-{m}-{d} {h}:{i}")}}</span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="可考次数" prop="attemptLimit" width="100" show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. <span>{{scope.row.attemptLimit==0?'不限次数':scope.row.attemptLimit}}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="考试范围" prop="scopeType" width="140" show-overflow-tooltip>
  121. <template slot-scope="scope">
  122. <span>{{scope.row.scopeType==1?'全校':(scope.row.scopeType==2?'规则范围':(scope.row.scopeType==3?'指定考生':''))}}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="状态" prop="status" width="100" show-overflow-tooltip>
  126. <template slot-scope="scope">
  127. <span>{{scope.row.status==0?'停用':(scope.row.status==1?'未开始':(scope.row.status==2?'进行中':(scope.row.status==3?'已结束':'')))}}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="操作" width="220" show-overflow-tooltip v-if="tableButtonType">
  131. <template slot-scope="scope">
  132. <div class="table-button-box">
  133. <p class="table-button-null"></p>
  134. <p class="table-button-p"
  135. v-if="scope.row.showMakeup"
  136. v-hasPermiRouter="['exam:elExam:makeupAdd']"
  137. @click="tableButton(2,scope.row)"
  138. >补考</p>
  139. <p class="table-button-p"
  140. v-hasPermiRouter="['exam:elExam:edit']"
  141. @click="tableButton(3,scope.row)"
  142. >编辑</p>
  143. <p class="table-button-p"
  144. v-hasPermiRouter="['exam:elExam:copy']"
  145. @click="tableButton(4,scope.row)"
  146. >复制</p>
  147. <p class="table-button-p"
  148. v-hasPermiRouter="['exam:elExam:del']"
  149. @click="tableButton(5,scope.row)"
  150. >删除</p>
  151. <p class="table-button-null"></p>
  152. </div>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <pagination :page-sizes="[20, 30, 40, 50]"
  157. v-show="total>0"
  158. :total="total"
  159. :page.sync="queryParams.page"
  160. :limit.sync="queryParams.pageSize"
  161. @pagination="getList"
  162. />
  163. </div>
  164. </div>
  165. <add-page :propsData="propsData" v-if="pageType === 2"></add-page>
  166. <students-taking-make-up-exams :propsData="propsData" v-if="pageType === 3"></students-taking-make-up-exams>
  167. </div>
  168. </template>
  169. <script>
  170. //import { getDicts } from "@/api/commonality/noPermission";
  171. //import { systemUserSelect } from "@/api/commonality/permission";
  172. //import { getInfo } from "@/api/basicsModules/index";
  173. import addPage from "./addPage.vue";
  174. import studentsTakingMakeUpExams from "./studentsTakingMakeUpExams.vue";
  175. import {
  176. examElExamPage,examElExamCopy,examElExamDel,
  177. examElDisciplineTypeList,examElExamTypeList,systemDeptCurrentDept,
  178. } from "@/api/safetyEducationExaminationNew/index";
  179. export default {
  180. name: 'index',
  181. components: {
  182. addPage,
  183. studentsTakingMakeUpExams
  184. },
  185. data () {
  186. return {
  187. tableButtonType:this.hasPermiDom(['exam:elExam:makeupAdd','exam:elExam:edit','exam:elExam:copy','exam:elExam:del']),
  188. //页面状态
  189. pageType:1,
  190. //下拉列表数据
  191. optionListA:[],
  192. optionListB:[],
  193. optionListC:[],
  194. //查询条件
  195. queryParams:{
  196. page:1,
  197. pageSize:20,
  198. shareStatus :null,
  199. disciplineTypeId :null,
  200. examTypeId :null,
  201. deptId :null,
  202. status :null,
  203. makeup :null,
  204. searchValue:"",
  205. },
  206. //时间数据
  207. dateRange:[],
  208. //列表数据
  209. dataList:[{}],
  210. //数据数量
  211. total:0,
  212. //组件传参
  213. propsData:{},
  214. }
  215. },
  216. created () {
  217. },
  218. mounted () {
  219. this.getList();
  220. this.examElDisciplineTypeList();
  221. this.examElExamTypeList();
  222. this.systemDeptCurrentDept();
  223. },
  224. methods: {
  225. //查询按钮
  226. handleQuery(){
  227. this.$set(this.queryParams,'page',1);
  228. this.getList();
  229. },
  230. //重置按钮
  231. resetQuery(){
  232. this.$set(this,'dateRange',[])
  233. this.$set(this,'queryParams',{
  234. page:1,
  235. pageSize:20,
  236. shareStatus :null,
  237. disciplineTypeId :null,
  238. examTypeId :null,
  239. deptId :null,
  240. status :null,
  241. makeup :null,
  242. searchValue:"",
  243. });
  244. this.getList();
  245. },
  246. //获取数据列表
  247. getList(){
  248. let obj = JSON.parse(JSON.stringify(this.queryParams))
  249. if(this.dateRange[0]){
  250. obj.startTime = this.dateRange[0]+'T00:00:00'
  251. obj.endTime = this.dateRange[1]+'T23:59:59'
  252. }else{
  253. obj.startTime = "";
  254. obj.endTime = "";
  255. }
  256. examElExamPage(obj).then(response => {
  257. this.$set(this,'dataList',response.data.records);
  258. this.$set(this,'total',response.data.total);
  259. });
  260. },
  261. //操作按钮
  262. tableButton(type,row){
  263. let self = this;
  264. if(type == 1){
  265. //新增
  266. this.$set(this,'pageType',2);
  267. this.$set(this,'propsData',{});
  268. }else if(type == 2){
  269. //补考
  270. this.$set(this,'pageType',3);
  271. this.$set(this,'propsData',{id:row.id});
  272. }else if(type == 3){
  273. //编辑
  274. this.$set(this,'pageType',2);
  275. let obj = JSON.parse(JSON.stringify(row))
  276. this.$set(this,'propsData',obj);
  277. }else if(type == 4){
  278. //复制
  279. this.$confirm('是否确认复制?', "提示", {
  280. confirmButtonText: "确定",
  281. cancelButtonText: "取消",
  282. type: "warning"
  283. }).then(function() {
  284. }).then(() => {
  285. examElExamCopy({id:row.id}).then(response => {
  286. self.msgSuccess(response.message)
  287. self.getList();
  288. });
  289. }).catch(() => {});
  290. }else if(type == 5){
  291. //删除
  292. this.$confirm('是否确认删除?', "提示", {
  293. confirmButtonText: "确定",
  294. cancelButtonText: "取消",
  295. type: "warning"
  296. }).then(function() {
  297. }).then(() => {
  298. examElExamDel({id:row.id}).then(response => {
  299. self.msgSuccess(response.message)
  300. self.getList();
  301. });
  302. }).catch(() => {});
  303. }else if(type == 6){
  304. //返回并刷新
  305. this.$set(this,'pageType',1);
  306. this.getList();
  307. }else if(type == 7){
  308. //详情
  309. this.$set(this,'pageType',2);
  310. let obj = JSON.parse(JSON.stringify(row))
  311. obj.showType = true;
  312. this.$set(this,'propsData',obj);
  313. }
  314. },
  315. //查询全部专业类别
  316. examElDisciplineTypeList(){
  317. examElDisciplineTypeList({}).then(response => {
  318. this.$set(this,'optionListA',response.data);
  319. });
  320. },
  321. //查询全部考试类型
  322. examElExamTypeList(){
  323. examElExamTypeList({}).then(response => {
  324. this.$set(this,'optionListB',response.data);
  325. });
  326. },
  327. //学院列表
  328. systemDeptCurrentDept(){
  329. systemDeptCurrentDept({}).then(response => {
  330. const list = response.data || [];
  331. this.formatTreeData(list);
  332. this.$set(this,'optionListC',list);
  333. });
  334. },
  335. },
  336. }
  337. </script>
  338. <style scoped lang="scss">
  339. .examinationArrange{
  340. .examinationArrangePage{
  341. }
  342. }
  343. </style>