ModifyTaskApply.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. semesterId: "",
  132. semesterName: "",
  133. courseCode: "",
  134. courseName: "",
  135. specialty: "",
  136. paperNumber: "",
  137. startTime: "",
  138. endTime: "",
  139. cardRuleId: "",
  140. cardRuleName: "",
  141. flowId: "",
  142. setup: 0,
  143. userId: "",
  144. userName: "",
  145. propositionName: "",
  146. auditStatus: "",
  147. reviewStatus: "",
  148. source: "",
  149. teachingRoomName: "",
  150. teacherName: "",
  151. lecturerName: "",
  152. paperName: "",
  153. examDate: "",
  154. examTime: "",
  155. };
  156. export default {
  157. name: "modify-task-apply",
  158. components: { ApplyContent },
  159. props: {
  160. instance: {
  161. type: Object,
  162. default() {
  163. return {};
  164. },
  165. },
  166. editType: {
  167. type: String,
  168. default: "",
  169. },
  170. },
  171. computed: {
  172. title() {
  173. // editType为主
  174. if (this.editType) {
  175. const names = {
  176. APPLY: "提交入库申请",
  177. PREVIEW: "入库申请详情",
  178. AUDIT: "审核入库申请",
  179. };
  180. return names[this.editType];
  181. }
  182. if (this.modalForm.setup === 1 || this.modalForm.setup === null) {
  183. return "提交入库申请";
  184. } else if (this.modalForm.setup <= 0) {
  185. return "入库申请详情";
  186. } else {
  187. return "审核入库申请";
  188. }
  189. },
  190. IS_MODEL2() {
  191. return this.modalForm.examModel === "MODEL2";
  192. },
  193. },
  194. data() {
  195. return {
  196. modalIsShow: false,
  197. modalForm: {},
  198. examRule: {},
  199. hasClassInfo: false,
  200. examRoomInfoList: [],
  201. printTotalCount: 0,
  202. };
  203. },
  204. created() {
  205. this.getExamRule();
  206. },
  207. methods: {
  208. async getExamRule() {
  209. const examRule = await examRuleDetail();
  210. this.examRule = examRule || {};
  211. },
  212. modalInfoUpdate(data) {
  213. this.modalForm = this.$objAssign(this.modalForm, data);
  214. this.getExamRoomInfo();
  215. },
  216. initData(val) {
  217. this.modalForm = this.$objAssign(initModalForm, val);
  218. this.modalForm.review = this.examRule.review;
  219. this.modalForm.customCard = this.examRule.customCard;
  220. },
  221. visibleChange() {
  222. this.initData(this.instance);
  223. },
  224. async getExamRoomInfo() {
  225. const data = await taskApplyExamObject({
  226. paperNumber: this.modalForm.paperNumber,
  227. examId: this.modalForm.examId,
  228. });
  229. if (this.IS_MODEL2) {
  230. const { printCount } = data.examRoomInfoList[0];
  231. const nums = printCount.split("+").map((item) => item * 1);
  232. console.log(nums);
  233. this.examRoomInfoList = [
  234. {
  235. backupCount: nums[1],
  236. studentCount: nums[0],
  237. printCount: nums[0] + nums[1],
  238. },
  239. ];
  240. } else {
  241. this.examRoomInfoList = data.examRoomInfoList || [];
  242. this.hasClassInfo = this.examRoomInfoList.some(
  243. (item) => item.clazzNames
  244. );
  245. }
  246. this.printTotalCount = data.printTotalCount;
  247. this.modalForm.paperName = data.paperName || "";
  248. const { date, time } = parseTimeRangeDateAndTime(
  249. data.examStartTime,
  250. data.examEndTime
  251. );
  252. this.modalForm.examDate = date;
  253. this.modalForm.examTime = time;
  254. },
  255. cancel() {
  256. this.modalIsShow = false;
  257. },
  258. open() {
  259. this.modalIsShow = true;
  260. },
  261. toCancel() {
  262. this.$confirm("确定要撤销当前申请吗?", "提示", {
  263. type: "warning",
  264. })
  265. .then(async () => {
  266. const data = await cancelOrRestartTaskApply({
  267. id: this.instance.id,
  268. }).catch(() => {});
  269. if (!data) return;
  270. this.$message.success("操作成功!");
  271. this.modified();
  272. })
  273. .catch(() => {});
  274. },
  275. modified() {
  276. this.cancel();
  277. this.$emit("modified");
  278. },
  279. },
  280. };
  281. </script>