index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="audit">
  3. <MenuPage only-key="/personal_workbench/check_task" />
  4. <CommonPreview :id="id" ref="preview" :project-id="project_id" :is-audit="true" type="audit">
  5. <template #operator="{ courseware }">
  6. <span v-if="isTrue(courseware.is_can_add_audit_remark)" class="link" @click="addRemark">添加审核批注</span>
  7. <span
  8. v-if="isTrue(courseware.is_can_finish_audit)"
  9. class="link"
  10. @click="finishCoursewareCurFlowNodeAudit('false', 'complete', courseware.cur_audit_flow_node_type)"
  11. >
  12. 审核完成
  13. </span>
  14. <span
  15. v-if="isTrue(courseware.is_can_audit_pass)"
  16. class="link"
  17. @click="finishCoursewareCurFlowNodeAudit('true', 'pass', courseware.cur_audit_flow_node_type)"
  18. >
  19. 审核通过
  20. </span>
  21. <span
  22. v-if="isTrue(courseware.is_can_audit_reject)"
  23. class="link"
  24. @click="finishCoursewareCurFlowNodeAudit('false', 'reject', courseware.cur_audit_flow_node_type)"
  25. >
  26. 审核驳回
  27. </span>
  28. <span class="link" @click="goBackBookList">返回教材列表</span>
  29. </template>
  30. </CommonPreview>
  31. </div>
  32. </template>
  33. <script>
  34. import MenuPage from '@/views/personal_workbench/common/menu.vue';
  35. import CommonPreview from '@/components/CommonPreview.vue';
  36. import { isTrue } from '@/utils/validate';
  37. import { FinishCoursewareCurFlowNodeAudit } from '@/api/project';
  38. export default {
  39. name: 'AuditTaskPage',
  40. components: {
  41. MenuPage,
  42. CommonPreview,
  43. },
  44. data() {
  45. return {
  46. id: this.$route.params.id || '',
  47. project_id: this.$route.query.project_id || '',
  48. isSubmitting: false,
  49. actionTip: {
  50. complete: '审核完成',
  51. pass: '审核通过',
  52. reject: '审核驳回',
  53. },
  54. isTrue,
  55. };
  56. },
  57. methods: {
  58. /**
  59. * 提交课件到审核流程
  60. * @param {'true'|'false'} is_pass - 是否通过审核
  61. * @param {'complete'|'pass'|'reject'} action - 操作类型
  62. * @param {string} flow_node_type - 审核流程节点类型
  63. */
  64. async finishCoursewareCurFlowNodeAudit(is_pass, action, flow_node_type) {
  65. if (this.isSubmitting) return;
  66. try {
  67. await this.$confirm(`是否确认${this.actionTip[action]}?`, '提示', {
  68. confirmButtonText: '确定',
  69. cancelButtonText: '取消',
  70. type: 'warning',
  71. });
  72. if (flow_node_type === 2) {
  73. await this.$confirm(`当前为终审环节,请确认${this.actionTip[action]}?`, '提示', {
  74. confirmButtonText: '确定',
  75. cancelButtonText: '取消',
  76. type: 'warning',
  77. });
  78. }
  79. this.isSubmitting = true;
  80. await FinishCoursewareCurFlowNodeAudit({ id: this.id, is_pass });
  81. this.$message.success('操作成功');
  82. this.$refs.preview.getBookCoursewareInfo(this.id);
  83. } catch (err) {
  84. // 忽略用户取消确认的情况
  85. if (err === 'cancel' || err === 'close') return;
  86. // 若为请求错误,尽量展示友好信息
  87. const msg = (err && err.message) || (err && err.msg) || '操作失败';
  88. this.$message.error(msg);
  89. } finally {
  90. this.isSubmitting = false;
  91. }
  92. },
  93. goBackBookList() {
  94. this.$router.push({ path: `/personal_workbench/check_task` });
  95. },
  96. // 点击添加审核意见
  97. addRemark() {
  98. this.$refs.preview.addRemark();
  99. },
  100. },
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. @use '@/styles/mixin.scss' as *;
  105. .audit {
  106. @include page-content(true);
  107. overflow: hidden;
  108. &__header {
  109. .courseware {
  110. .flow-nodename {
  111. flex: 1;
  112. }
  113. }
  114. }
  115. .main-container {
  116. flex: 1;
  117. min-width: 1110px;
  118. overflow: auto;
  119. }
  120. main.preview-main {
  121. display: flex;
  122. flex: 1;
  123. flex-direction: column;
  124. row-gap: 5px;
  125. width: 1100px;
  126. min-width: 1100px;
  127. min-height: 100%;
  128. padding: 5px;
  129. margin: 0 5px;
  130. background-color: #fff;
  131. border: 3px solid #f44444;
  132. border-radius: 4px;
  133. box-shadow: 0 2px 4px rgba(0, 0, 0, 10%);
  134. .title {
  135. display: inline-flex;
  136. column-gap: 24px;
  137. align-items: center;
  138. width: 100%;
  139. min-width: 280px;
  140. height: 64px;
  141. padding: 18px 24px;
  142. font-size: 20px;
  143. color: #fff;
  144. background-color: #f44444;
  145. border-top-left-radius: 12px;
  146. border-bottom-right-radius: 16px;
  147. }
  148. }
  149. .audit-content {
  150. display: flex;
  151. column-gap: 20px;
  152. min-width: 1810px;
  153. height: calc(100vh - 175px);
  154. .remark-list {
  155. width: 300px;
  156. overflow: auto;
  157. border: 1px solid #e5e5e5;
  158. h5 {
  159. padding: 0 5px;
  160. margin: 0;
  161. font-size: 18px;
  162. line-height: 40px;
  163. background: #f2f3f5;
  164. }
  165. .delete-btn {
  166. padding-left: 10px;
  167. color: #f44444;
  168. border-left: 1px solid #e5e5e5;
  169. }
  170. ul {
  171. height: calc(100% - 40px);
  172. overflow: auto;
  173. li {
  174. border-bottom: 1px solid #e5e5e5;
  175. > p {
  176. padding: 5px;
  177. }
  178. :deep p {
  179. margin: 0;
  180. }
  181. .remark-bottom {
  182. display: flex;
  183. align-items: center;
  184. justify-content: space-between;
  185. padding: 0 5px;
  186. font-size: 14px;
  187. color: #555;
  188. border-top: 1px solid #e5e5e5;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. :deep .audit-dialog {
  196. .el-dialog__body {
  197. padding: 5px 20px;
  198. }
  199. }
  200. </style>
  201. <style lang="scss">
  202. .tox-tinymce-aux {
  203. z-index: 9999 !important;
  204. }
  205. </style>