TaskApplyManage.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <div class="task-apply-manage">
  3. <div class="part-box part-box-filter part-box-flex">
  4. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  5. <el-form-item label="审核状态:">
  6. <el-select
  7. v-model="filter.auditStatus"
  8. style="width: 142px;"
  9. placeholder="请选择"
  10. clearable
  11. >
  12. <el-option
  13. v-for="(val, key) in AUDITING_STATUS"
  14. :key="key"
  15. :value="key"
  16. :label="val"
  17. ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="审核结果:">
  21. <el-select
  22. v-model="filter.reviewStatus"
  23. style="width: 142px;"
  24. placeholder="请选择"
  25. clearable
  26. >
  27. <el-option
  28. v-for="(val, key) in AUDITING_RESULT"
  29. :key="key"
  30. :value="key"
  31. :label="val"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="题卡规则:">
  36. <card-rule-select
  37. ref="CardRuleSelect"
  38. v-model.trim="filter.cardRuleId"
  39. placeholder="请选择"
  40. clearable
  41. ></card-rule-select>
  42. </el-form-item>
  43. <el-form-item label="课程(代码):" label-width="110px">
  44. <course-select
  45. ref="CourseSelect"
  46. v-model.trim="filter.courseCode"
  47. placeholder="请选择"
  48. clearable
  49. ></course-select>
  50. </el-form-item>
  51. <el-form-item label="试卷编号:">
  52. <paper-number-select
  53. ref="PaperNumberSelect"
  54. v-model="filter.paperNumber"
  55. placeholder="请选择"
  56. clearable
  57. ></paper-number-select>
  58. </el-form-item>
  59. <el-form-item label="命题时间:">
  60. <el-date-picker
  61. v-model="createTime"
  62. type="datetimerange"
  63. :picker-options="pickerOptions"
  64. range-separator="至"
  65. start-placeholder="开始日期"
  66. end-placeholder="结束日期"
  67. value-format="timestamp"
  68. align="right"
  69. unlink-panels
  70. >
  71. </el-date-picker>
  72. </el-form-item>
  73. <el-form-item label-width="0px">
  74. <el-button type="primary" icon="el-icon-search" @click="toPage(1)"
  75. >查询</el-button
  76. >
  77. </el-form-item>
  78. </el-form>
  79. </div>
  80. <div class="part-box">
  81. <el-table ref="TableList" :data="examTasks" border stripe>
  82. <el-table-column
  83. type="index"
  84. label="序号"
  85. width="70"
  86. align="center"
  87. :index="indexMethod"
  88. ></el-table-column>
  89. <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
  90. <el-table-column prop="courseName" label="课程(代码)">
  91. <template slot-scope="scope">
  92. {{ scope.row.courseName }}({{ scope.row.courseCode }})
  93. </template>
  94. </el-table-column>
  95. <el-table-column
  96. prop="specialty"
  97. label="适用专业(方向)"
  98. ></el-table-column>
  99. <el-table-column prop="cardRuleName" label="题卡规则"></el-table-column>
  100. <el-table-column
  101. prop="userName"
  102. label="命题老师"
  103. width="100"
  104. ></el-table-column>
  105. <el-table-column prop="startTime" label="命题开始时间">
  106. <span slot-scope="scope">{{
  107. scope.row.startTime | timestampFilter
  108. }}</span>
  109. </el-table-column>
  110. <el-table-column prop="endTime" label="命题结束时间">
  111. <span slot-scope="scope">{{
  112. scope.row.endTime | timestampFilter
  113. }}</span>
  114. </el-table-column>
  115. <el-table-column prop="auditStatus" label="审核状态" width="100">
  116. <template slot-scope="scope">
  117. {{ scope.row.auditStatus | auditStatusFilter }}
  118. </template>
  119. </el-table-column>
  120. <el-table-column prop="reviewStatus" label="审核结果" width="100">
  121. <template slot-scope="scope">
  122. {{ scope.row.reviewStatus | reviewStatusFilter }}
  123. </template>
  124. </el-table-column>
  125. <el-table-column
  126. class-name="action-column"
  127. label="操作"
  128. align="center"
  129. width="120px"
  130. >
  131. <template slot-scope="scope">
  132. <el-button
  133. v-if="scope.row.auditStatus || scope.row.reviewStatus"
  134. class="btn-table-icon"
  135. type="text"
  136. icon="icon icon-circle-right"
  137. @click="toPreview(scope.row)"
  138. title="查看详情"
  139. ></el-button>
  140. <el-button
  141. v-if="!scope.row.auditStatus && !scope.row.reviewStatus"
  142. class="btn-table-icon"
  143. type="text"
  144. icon="icon icon-edit"
  145. @click="toEdit(scope.row)"
  146. title="立即申请"
  147. ></el-button>
  148. <el-button
  149. v-if="
  150. scope.row.auditStatus === 'AUDITED' &&
  151. scope.row.reviewStatus === 'NOT_PASS'
  152. "
  153. class="btn-table-icon"
  154. type="text"
  155. icon="icon icon-edit"
  156. @click="toEdit(scope.row)"
  157. title="重新申请"
  158. ></el-button>
  159. <el-button
  160. v-if="
  161. scope.row.auditStatus === 'NOT_AUDITED' &&
  162. scope.row.status === 'SUBMIT'
  163. "
  164. class="btn-table-icon"
  165. type="text"
  166. icon="icon icon-close-act"
  167. @click="toCancel(scope.row)"
  168. title="撤销申请"
  169. ></el-button>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. <div class="part-page">
  174. <el-pagination
  175. background
  176. layout="total,prev, pager, next"
  177. :current-page="current"
  178. :total="total"
  179. :page-size="size"
  180. @current-change="toPage"
  181. >
  182. </el-pagination>
  183. </div>
  184. </div>
  185. <!-- ModifyTaskApply -->
  186. <modify-task-apply
  187. ref="ModifyTaskApply"
  188. :edit-type="editType"
  189. :instance="curExamTask"
  190. @modified="taskModified"
  191. ></modify-task-apply>
  192. </div>
  193. </template>
  194. <script>
  195. import ModifyTaskApply from "../components/ModifyTaskApply";
  196. import { AUDITING_STATUS } from "@/constants/enumerate";
  197. import pickerOptions from "@/constants/datePickerOptions";
  198. import { taskApplyListPage, cancelOrRestartTaskApply } from "../api";
  199. import { mapActions } from "vuex";
  200. export default {
  201. name: "task-apply-manage",
  202. components: {
  203. ModifyTaskApply
  204. },
  205. data() {
  206. return {
  207. filter: {
  208. auditStatus: "",
  209. reviewStatus: "",
  210. cardRuleId: "",
  211. courseCode: "",
  212. paperNumber: "",
  213. startTime: "",
  214. endTime: ""
  215. },
  216. current: 1,
  217. size: this.GLOBAL.pageSize,
  218. total: 0,
  219. editType: "APPLY",
  220. AUDITING_STATUS,
  221. AUDITING_RESULT: { NOT_PASS: "未通过" },
  222. examTasks: [],
  223. curExamTask: {},
  224. curUserId: this.$ls.get("user", { id: "" }).id,
  225. userRoles: this.$ls.get("user", { roleList: [] }).roleList,
  226. // date-picker
  227. createTime: [],
  228. pickerOptions
  229. };
  230. },
  231. created() {
  232. this.getList();
  233. },
  234. methods: {
  235. ...mapActions("exam", ["updateWaitTaskCount"]),
  236. async getList() {
  237. const datas = {
  238. ...this.filter,
  239. pageNumber: this.current,
  240. pageSize: this.size
  241. };
  242. if (this.createTime) {
  243. datas.startTime = this.createTime[0];
  244. datas.endTime = this.createTime[1];
  245. }
  246. const data = await taskApplyListPage(datas);
  247. this.examTasks = data.records;
  248. this.total = data.total;
  249. },
  250. toPage(page) {
  251. this.current = page;
  252. this.getList();
  253. },
  254. toCancel(row) {
  255. this.$confirm("确定要撤销当前申请吗?", "提示", {
  256. cancelButtonClass: "el-button--danger is-plain",
  257. confirmButtonClass: "el-button--primary",
  258. type: "warning"
  259. })
  260. .then(async () => {
  261. const data = await cancelOrRestartTaskApply({
  262. id: row.id,
  263. status: "CANCEL"
  264. }).catch(() => {});
  265. if (!data) return;
  266. this.$message.success("操作成功!");
  267. this.getList();
  268. })
  269. .catch(() => {});
  270. },
  271. toEdit(row) {
  272. console.log(row);
  273. this.curExamTask = row;
  274. this.editType = "APPLY";
  275. this.$refs.ModifyTaskApply.open();
  276. },
  277. toPreview(row) {
  278. this.curExamTask = row;
  279. this.editType = "PREVIEW";
  280. this.$refs.ModifyTaskApply.open();
  281. },
  282. taskModified() {
  283. this.getList();
  284. this.updateWaitTaskCount(this.userRoles);
  285. }
  286. }
  287. };
  288. </script>