ModifyTaskApply.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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.semesterName || "--" }}</span>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <el-form-item label="考试:">
  37. <span>{{ modalForm.examName || "--" }}</span>
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. <el-row>
  42. <el-col :span="12">
  43. <el-form-item label="拟卷教师:">
  44. <span>{{ modalForm.teacherName | defaultFieldFilter }}</span>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="12">
  48. <el-form-item label="命题老师:">
  49. <span>{{ modalForm.propositionName || modalForm.userName }}</span>
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :span="12">
  55. <el-form-item label="考试时间:">
  56. <span v-if="modalForm.examDate && modalForm.examTime">
  57. {{ modalForm.examDate }} <i class="mr-1"></i>
  58. {{ modalForm.examTime }}
  59. </span>
  60. <span v-else>--</span>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="12">
  64. <el-form-item label="审核状态:">
  65. <span>{{ modalForm.auditStatus | auditStatusFilter }}</span>
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. </el-form>
  70. <div v-if="examRoomInfoList.length && !IS_MODEL2" class="task-exam-room">
  71. <el-table
  72. :data="examRoomInfoList"
  73. border
  74. style="width: 100%"
  75. max-height="300px"
  76. >
  77. <el-table-column
  78. v-if="hasClassInfo"
  79. prop="clazzNames"
  80. label="使用班级"
  81. min-width="400"
  82. ></el-table-column>
  83. <el-table-column
  84. prop="studentCount"
  85. label="人数"
  86. min-width="100"
  87. ></el-table-column>
  88. <el-table-column
  89. prop="printCount"
  90. label="总印份数"
  91. min-width="100"
  92. ></el-table-column>
  93. </el-table>
  94. </div>
  95. <div
  96. class="part-box part-box-pad task-exam-room"
  97. v-if="examRoomInfoList.length && IS_MODEL2"
  98. >
  99. <p>
  100. 正式考生{{ examRoomInfoList[0].studentCount }}个,总印份数{{
  101. examRoomInfoList[0].printCount
  102. }}份(正式考生{{ examRoomInfoList[0].studentCount }}份,备用卷{{
  103. examRoomInfoList[0].backupCount
  104. }}份)
  105. </p>
  106. <p>考试对象:{{ examRoomInfoList[0].clazzNames }}</p>
  107. </div>
  108. </div>
  109. <apply-content
  110. v-if="modalIsShow"
  111. ref="ApplyContent"
  112. :exam-task="modalForm"
  113. :edit-type="editType"
  114. @info-update="modalInfoUpdate"
  115. @cancel="cancel"
  116. @modified="modified"
  117. ></apply-content>
  118. <div slot="footer"></div>
  119. </el-dialog>
  120. </template>
  121. <script>
  122. import ApplyContent from "./ApplyContent";
  123. import { examRuleDetail } from "../../base/api";
  124. import { cancelOrRestartTaskApply, taskApplyExamObject } from "../api";
  125. import { parseTimeRangeDateAndTime } from "@/plugins/utils";
  126. const initModalForm = {
  127. id: null,
  128. examId: "",
  129. examName: "",
  130. examModel: "",
  131. category: "",
  132. semesterId: "",
  133. semesterName: "",
  134. courseId: "",
  135. courseName: "",
  136. specialty: "",
  137. paperNumber: "",
  138. startTime: "",
  139. endTime: "",
  140. cardRuleId: "",
  141. cardRuleName: "",
  142. flowId: "",
  143. setup: null,
  144. userId: "",
  145. userName: "",
  146. propositionName: "",
  147. auditStatus: "",
  148. reviewStatus: "",
  149. source: "",
  150. teachingRoomName: "",
  151. teacherName: "",
  152. lecturerName: "",
  153. paperName: "",
  154. examDate: "",
  155. examTime: "",
  156. };
  157. export default {
  158. name: "modify-task-apply",
  159. components: { ApplyContent },
  160. props: {
  161. instance: {
  162. type: Object,
  163. default() {
  164. return {};
  165. },
  166. },
  167. editType: {
  168. type: String,
  169. default: "",
  170. },
  171. },
  172. computed: {
  173. title() {
  174. // editType为主
  175. if (this.editType) {
  176. const names = {
  177. APPLY: "提交入库申请",
  178. PREVIEW: "入库申请详情",
  179. AUDIT: "审核入库申请",
  180. };
  181. return names[this.editType];
  182. }
  183. if (this.modalForm.setup === 1 || this.modalForm.setup === null) {
  184. return "提交入库申请";
  185. } else if (this.modalForm.setup <= 0) {
  186. return "入库申请详情";
  187. } else {
  188. return "审核入库申请";
  189. }
  190. },
  191. IS_MODEL2() {
  192. return this.modalForm.examModel === "MODEL2";
  193. },
  194. },
  195. data() {
  196. return {
  197. modalIsShow: false,
  198. modalForm: {},
  199. examRule: {},
  200. hasClassInfo: false,
  201. examRoomInfoList: [],
  202. printTotalCount: 0,
  203. };
  204. },
  205. created() {
  206. this.getExamRule();
  207. },
  208. methods: {
  209. async getExamRule() {
  210. const examRule = await examRuleDetail();
  211. this.examRule = examRule || {};
  212. },
  213. modalInfoUpdate(data) {
  214. this.modalForm = this.$objAssign(this.modalForm, data);
  215. this.getExamRoomInfo();
  216. },
  217. initData(val) {
  218. this.modalForm = this.$objAssign(initModalForm, val);
  219. this.modalForm.review = this.examRule.review;
  220. this.modalForm.customCard = this.examRule.customCard;
  221. },
  222. visibleChange() {
  223. this.initData(this.instance);
  224. },
  225. async getExamRoomInfo() {
  226. const data = await taskApplyExamObject({
  227. paperNumber: this.modalForm.paperNumber,
  228. examId: this.modalForm.examId,
  229. });
  230. if (this.IS_MODEL2) {
  231. const { printCount, clazzNames } = data.examRoomInfoList[0];
  232. const nums = printCount.split("+").map((item) => item * 1);
  233. this.examRoomInfoList = [
  234. {
  235. backupCount: nums[1],
  236. studentCount: nums[0],
  237. printCount: nums[0] + nums[1],
  238. clazzNames,
  239. },
  240. ];
  241. } else {
  242. this.examRoomInfoList = data.examRoomInfoList || [];
  243. this.hasClassInfo = this.examRoomInfoList.some(
  244. (item) => item.clazzNames
  245. );
  246. }
  247. this.printTotalCount = data.printTotalCount;
  248. this.modalForm.paperName = data.paperName || "";
  249. const { date, time } = parseTimeRangeDateAndTime(
  250. data.examStartTime,
  251. data.examEndTime
  252. );
  253. this.modalForm.examDate = date;
  254. this.modalForm.examTime = time;
  255. },
  256. cancel() {
  257. this.modalIsShow = false;
  258. },
  259. open() {
  260. this.modalIsShow = true;
  261. },
  262. toCancel() {
  263. this.$confirm("确定要撤销当前申请吗?", "提示", {
  264. type: "warning",
  265. })
  266. .then(async () => {
  267. const data = await cancelOrRestartTaskApply({
  268. id: this.instance.id,
  269. }).catch(() => {});
  270. if (!data) return;
  271. this.$message.success("操作成功!");
  272. this.modified();
  273. })
  274. .catch(() => {});
  275. },
  276. modified() {
  277. this.cancel();
  278. this.$emit("modified");
  279. },
  280. },
  281. };
  282. </script>