ModifyTaskApply.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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">
  14. <el-form class="form-info" label-width="130px">
  15. <el-row>
  16. <el-col :span="10">
  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="14">
  24. <el-form-item label="适用专业(方向):">
  25. <span>{{ modalForm.specialty | defaultFieldFilter }}</span>
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="10">
  31. <el-form-item label="试卷编号:">
  32. <span>{{ modalForm.paperNumber }}</span>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="14">
  36. <el-form-item label="命题时间:">
  37. <span>
  38. {{ modalForm.startTime | timestampFilter }} 至
  39. {{ modalForm.endTime | timestampFilter }}</span
  40. >
  41. </el-form-item>
  42. </el-col>
  43. </el-row>
  44. <el-row>
  45. <el-col :span="10">
  46. <el-form-item label="题卡规则:">
  47. <span>{{ modalForm.cardRuleName }}</span>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :span="14">
  51. <el-form-item label="命题老师:">
  52. <span>{{ modalForm.userName }}</span>
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. <el-row>
  57. <el-col :span="10">
  58. <el-form-item label="审核状态:">
  59. <span>{{ modalForm.auditStatus | auditStatusFilter }}</span>
  60. </el-form-item>
  61. </el-col>
  62. <el-col :span="14">
  63. <el-form-item label="审核结果:">
  64. <span>{{ modalForm.reviewStatus | reviewStatusFilter }}</span>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. </el-form>
  69. </div>
  70. <div class="mb-4">
  71. <el-steps align-center>
  72. <el-step
  73. v-for="(step, index) in steps"
  74. :key="index"
  75. :title="step.title"
  76. :description="step.desc"
  77. :status="step.status"
  78. ></el-step>
  79. </el-steps>
  80. </div>
  81. <div class="mb-2" v-if="needReview">
  82. <el-button
  83. v-for="item in menus"
  84. :key="item.id"
  85. :type="item.id == curMenu.id ? 'primary' : 'default'"
  86. @click="selectMenu(item)"
  87. >{{ item.name }}</el-button
  88. >
  89. </div>
  90. <div class="part-box part-box-pad part-box-border">
  91. <apply-content
  92. v-if="modalIsShow"
  93. v-show="curMenu.id === '1'"
  94. ref="ApplyContent"
  95. :exam-task="modalForm"
  96. :edit-type="editType"
  97. :exam-rule="examRule"
  98. @cancel="cancel"
  99. @modified="modified"
  100. ></apply-content>
  101. <apply-audit-history
  102. v-if="needReview"
  103. v-show="curMenu.id === '2'"
  104. ref="ApplyAuditHistory"
  105. :exam-task-id="modalForm.id"
  106. ></apply-audit-history>
  107. </div>
  108. <div slot="footer"></div>
  109. </el-dialog>
  110. </template>
  111. <script>
  112. import ApplyContent from "./ApplyContent";
  113. import ApplyAuditHistory from "./ApplyAuditHistory";
  114. import { examRuleDetail } from "../../base/api";
  115. const initModalForm = {
  116. id: null,
  117. courseCode: "",
  118. courseName: "",
  119. specialty: "",
  120. paperNumber: "",
  121. startTime: "",
  122. endTime: "",
  123. cardRuleId: "",
  124. cardRuleName: "",
  125. userId: "",
  126. userName: "",
  127. auditStatus: "",
  128. reviewStatus: ""
  129. };
  130. const STEPS = [
  131. {
  132. title: "提交申请",
  133. status: {
  134. wait: {
  135. desc: "待进行",
  136. range: []
  137. },
  138. process: {
  139. desc: "进行中",
  140. range: ["NEW", "READY", "STAGE"]
  141. },
  142. success: {
  143. desc: "已完成",
  144. range: ["SUBMIT", "FINISH"]
  145. }
  146. }
  147. },
  148. {
  149. title: "审核",
  150. status: {
  151. wait: {
  152. desc: "待进行",
  153. range: ["NEW", "READY", "STAGE"]
  154. },
  155. process: {
  156. desc: "进行中",
  157. range: ["SUBMIT"]
  158. },
  159. success: {
  160. desc: "已完成",
  161. range: ["FINISH"]
  162. }
  163. }
  164. },
  165. {
  166. title: "入库",
  167. status: {
  168. wait: {
  169. desc: "待进行",
  170. range: ["NEW", "READY", "STAGE", "SUBMIT"]
  171. },
  172. process: {
  173. desc: "进行中",
  174. range: []
  175. },
  176. success: {
  177. desc: "已完成",
  178. range: ["FINISH"]
  179. }
  180. }
  181. }
  182. ];
  183. export default {
  184. name: "modify-task-apply",
  185. components: { ApplyContent, ApplyAuditHistory },
  186. props: {
  187. instance: {
  188. type: Object,
  189. default() {
  190. return {};
  191. }
  192. },
  193. editType: {
  194. type: String,
  195. default: "APPLY",
  196. validator: val => ["APPLY", "PREVIEW", "AUDIT"].includes(val)
  197. }
  198. },
  199. computed: {
  200. title() {
  201. const names = {
  202. APPLY: "提交入库申请",
  203. PREVIEW: "入库申请详情",
  204. AUDIT: "审核入库申请"
  205. };
  206. return names[this.editType];
  207. }
  208. },
  209. data() {
  210. return {
  211. modalIsShow: false,
  212. modalForm: {},
  213. needReview: false,
  214. examRule: {},
  215. steps: [],
  216. actStep: "",
  217. menus: [
  218. { id: "1", name: "命题处理", component: "apply-content" },
  219. { id: "2", name: "审核意见", component: "apply-audit-history" }
  220. ],
  221. curMenu: {}
  222. };
  223. },
  224. created() {
  225. this.getExamRule();
  226. },
  227. methods: {
  228. async getExamRule() {
  229. const examRule = await examRuleDetail();
  230. this.examRule = examRule || {};
  231. this.needReview = examRule && examRule.review;
  232. },
  233. initData(val) {
  234. this.modalForm = this.$objAssign(initModalForm, val);
  235. this.modalForm.includePaper = this.examRule.includePaper;
  236. this.modalForm.review = this.examRule.review;
  237. this.modalForm.customCard = this.examRule.customCard;
  238. this.buildSteps();
  239. },
  240. buildSteps() {
  241. const curStatus = this.instance.status;
  242. // 构建steps
  243. const stepList = this.needReview ? STEPS : [STEPS[0], STEPS[2]];
  244. this.steps = stepList.map(step => {
  245. const validStepStatus = Object.keys(step.status).find(key =>
  246. step.status[key].range.includes(curStatus)
  247. );
  248. return {
  249. title: step.title,
  250. status: validStepStatus,
  251. desc: step.status[validStepStatus].desc
  252. };
  253. });
  254. },
  255. visibleChange() {
  256. this.initData(this.instance);
  257. this.curMenu = this.menus[0];
  258. },
  259. cancel() {
  260. this.modalIsShow = false;
  261. },
  262. open() {
  263. this.modalIsShow = true;
  264. },
  265. selectMenu(item) {
  266. this.curMenu = item;
  267. },
  268. modified() {
  269. this.cancel();
  270. this.$emit("modified");
  271. }
  272. }
  273. };
  274. </script>