ModifyTaskApply.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <el-dialog
  3. class="modify-task-apply"
  4. :visible.sync="modalIsShow"
  5. :title="title"
  6. top="10px"
  7. width="900px"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. @open="visibleChange"
  12. >
  13. <div class="part-box part-box-pad part-box-border part-box-gray">
  14. <el-form class="form-info mb-4" label-width="120px">
  15. <el-row>
  16. <el-col :span="12">
  17. <el-form-item label="课程(代码):">
  18. <span
  19. >{{ modalForm.courseName }}({{ modalForm.courseCode }})</span
  20. >
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="12">
  24. <el-form-item label="教研室:">
  25. <span>{{ modalForm.teachingRoomName | defaultFieldFilter }}</span>
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="12">
  31. <el-form-item label="使用学期:">
  32. <span>{{ modalForm.paperName || "--" }}</span>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <el-form-item label="考试时间:">
  37. <span v-if="modalForm.examDate && modalForm.examTime">
  38. {{ modalForm.examDate }} <i class="mr-1"></i>
  39. {{ modalForm.examTime }}
  40. </span>
  41. <span v-else>--</span>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. <el-row>
  46. <el-col :span="12">
  47. <el-form-item label="拟卷教师:">
  48. <span>{{ modalForm.teacherName | defaultFieldFilter }}</span>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <el-form-item label="命题老师:">
  53. <span>{{ modalForm.propositionName || modalForm.userName }}</span>
  54. </el-form-item>
  55. </el-col>
  56. </el-row>
  57. <el-row>
  58. <el-col :span="12">
  59. <el-form-item label="审核状态:">
  60. <span>{{ modalForm.auditStatus | auditStatusFilter }}</span>
  61. </el-form-item>
  62. </el-col>
  63. </el-row>
  64. </el-form>
  65. <table class="table task-exam-room" v-if="examRoomInfoList.length">
  66. <colgroup>
  67. <col width="400" />
  68. <col width="100" />
  69. <col width="100" />
  70. </colgroup>
  71. <tr>
  72. <th>使用班级</th>
  73. <th>人数</th>
  74. <th>总印份数</th>
  75. </tr>
  76. <tr v-for="(item, index) in examRoomInfoList" :key="index">
  77. <td>{{ item.clazzNames }}</td>
  78. <td>{{ item.studentCount }}</td>
  79. <td>{{ item.printCount }}</td>
  80. </tr>
  81. </table>
  82. </div>
  83. <div class="task-apply-steps" v-if="flows.length">
  84. <el-steps align-center>
  85. <el-step
  86. v-for="flow in flows"
  87. :key="flow.taskKey"
  88. :title="flow.taskName"
  89. :status="flow.status"
  90. >
  91. <div slot="description">
  92. <div class="step-info" v-if="flow.firstUser">
  93. <span>{{ flow.firstUser }}</span>
  94. <el-popover
  95. v-if="flow.moreUser"
  96. placement="top-start"
  97. width="300"
  98. trigger="hover"
  99. :content="flow.moreUser"
  100. >
  101. <span class="color-primary ml-1" slot="reference">更多</span>
  102. </el-popover>
  103. </div>
  104. </div>
  105. </el-step>
  106. </el-steps>
  107. </div>
  108. <div class="mb-4 tab-btns" v-if="needReview">
  109. <el-button
  110. v-for="item in menus"
  111. :key="item.id"
  112. size="medium"
  113. :type="item.id == curMenu.id ? 'primary' : 'default'"
  114. @click="selectMenu(item)"
  115. >{{ item.name }}</el-button
  116. >
  117. </div>
  118. <div v-if="modalIsShow">
  119. <apply-content
  120. v-show="curMenu.id === '1'"
  121. ref="ApplyContent"
  122. :exam-task="modalForm"
  123. :edit-type="editType"
  124. @step-change="stepChange"
  125. @cancel="cancel"
  126. @modified="modified"
  127. ></apply-content>
  128. <apply-audit-history
  129. v-if="needReview"
  130. v-show="curMenu.id === '2'"
  131. ref="ApplyAuditHistory"
  132. :flow-id="modalForm.flowId"
  133. ></apply-audit-history>
  134. <apply-submit-history
  135. v-if="needReview"
  136. v-show="curMenu.id === '3'"
  137. ref="ApplySubmitHistory"
  138. :exam-task-id="modalForm.id"
  139. ></apply-submit-history>
  140. </div>
  141. <div slot="footer"></div>
  142. </el-dialog>
  143. </template>
  144. <script>
  145. import ApplyContent from "./ApplyContent";
  146. import ApplyAuditHistory from "./ApplyAuditHistory";
  147. import ApplySubmitHistory from "./ApplySubmitHistory";
  148. import { examRuleDetail } from "../../base/api";
  149. import { cancelOrRestartTaskApply, taskApplyExamObject } from "../api";
  150. import { parseTimeRangeDateAndTime } from "@/plugins/utils";
  151. const initModalForm = {
  152. id: null,
  153. courseCode: "",
  154. courseName: "",
  155. specialty: "",
  156. paperNumber: "",
  157. startTime: "",
  158. endTime: "",
  159. cardRuleId: "",
  160. cardRuleName: "",
  161. flowId: "",
  162. setup: 0,
  163. userId: "",
  164. userName: "",
  165. propositionName: "",
  166. auditStatus: "",
  167. reviewStatus: "",
  168. source: "",
  169. teachingRoomName: "",
  170. teacherName: "",
  171. lecturerName: "",
  172. paperName: "",
  173. examDate: "",
  174. examTime: ""
  175. };
  176. export default {
  177. name: "modify-task-apply",
  178. components: { ApplyContent, ApplyAuditHistory, ApplySubmitHistory },
  179. props: {
  180. instance: {
  181. type: Object,
  182. default() {
  183. return {};
  184. }
  185. },
  186. editType: {
  187. type: String,
  188. default: ""
  189. }
  190. },
  191. computed: {
  192. title() {
  193. // editType为主
  194. if (this.editType) {
  195. const names = {
  196. APPLY: "提交入库申请",
  197. PREVIEW: "入库申请详情",
  198. AUDIT: "审核入库申请"
  199. };
  200. return names[this.editType];
  201. }
  202. if (this.modalForm.setup === 1 || this.modalForm.setup === null) {
  203. return "提交入库申请";
  204. } else if (this.modalForm.setup <= 0) {
  205. return "入库申请详情";
  206. } else {
  207. return "审核入库申请";
  208. }
  209. }
  210. },
  211. data() {
  212. return {
  213. modalIsShow: false,
  214. modalForm: {},
  215. needReview: false,
  216. examRule: {},
  217. menus: [
  218. { id: "1", name: "命题处理", component: "apply-content" },
  219. { id: "2", name: "审核意见", component: "apply-audit-history" },
  220. { id: "3", name: "提交记录", component: "apply-submit-history" }
  221. ],
  222. curMenu: {},
  223. flows: [],
  224. examRoomInfoList: [],
  225. printTotalCount: 0
  226. };
  227. },
  228. created() {
  229. this.getExamRule();
  230. },
  231. methods: {
  232. async getExamRule() {
  233. const examRule = await examRuleDetail();
  234. this.examRule = examRule || {};
  235. this.needReview = examRule && examRule.review;
  236. },
  237. initData(val) {
  238. this.modalForm = this.$objAssign(initModalForm, val);
  239. this.modalForm.includePaper = this.examRule.includePaper;
  240. this.modalForm.review = this.examRule.review;
  241. this.modalForm.customCard = this.examRule.customCard;
  242. },
  243. visibleChange() {
  244. this.initData(this.instance);
  245. this.curMenu = this.menus[0];
  246. this.getExamRoomInfo();
  247. },
  248. async getExamRoomInfo() {
  249. const data = await taskApplyExamObject(this.instance.paperNumber);
  250. this.examRoomInfoList = data.examRoomInfoList || [];
  251. this.printTotalCount = data.printTotalCount;
  252. this.modalForm.paperName = data.paperName || "";
  253. const { date, time } = parseTimeRangeDateAndTime(
  254. data.examStartTime,
  255. data.examEndTime
  256. );
  257. this.modalForm.examDate = date;
  258. this.modalForm.examTime = time;
  259. },
  260. cancel() {
  261. this.modalIsShow = false;
  262. },
  263. open() {
  264. this.modalIsShow = true;
  265. },
  266. toCancel() {
  267. this.$confirm("确定要撤销当前申请吗?", "提示", {
  268. type: "warning"
  269. })
  270. .then(async () => {
  271. const data = await cancelOrRestartTaskApply({
  272. id: this.instance.id
  273. }).catch(() => {});
  274. if (!data) return;
  275. this.$message.success("操作成功!");
  276. this.modified();
  277. })
  278. .catch(() => {});
  279. },
  280. selectMenu(item) {
  281. this.curMenu = item;
  282. },
  283. stepChange(flows) {
  284. this.flows = flows;
  285. },
  286. modified() {
  287. this.cancel();
  288. this.$emit("modified");
  289. }
  290. }
  291. };
  292. </script>