OrgFinalPreview.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="org-final-preview">
  3. <ProjectMenu cur-key="org/final" />
  4. <CommonPreview ref="preview" :project-id="project_id">
  5. <template #operator="{ courseware }">
  6. <span class="link">查看项目信息</span>
  7. <span class="link">查看教材信息</span>
  8. <span v-if="isTrue(courseware.is_can_shangjia_book)" class="link" @click="openConfirmBookDialog">上架</span>
  9. <span
  10. v-if="isTrue(courseware.is_can_reject_shangjia_book_request)"
  11. class="link"
  12. @click="rejectShangjiaBookRequest"
  13. >
  14. 驳回上架请求
  15. </span>
  16. <span v-if="isTrue(courseware.is_can_rollback_project)" class="link" @click="rollbackProject">退改</span>
  17. <span
  18. v-if="isTrue(courseware.is_can_reject_rollback_project_request)"
  19. class="link"
  20. @click="rejectRollbackProjectRequest"
  21. >
  22. 驳回退改请求
  23. </span>
  24. <span class="link" @click="goBackBookList">返回项目列表</span>
  25. </template>
  26. </CommonPreview>
  27. <ConfirmBookInfo :project-id="project_id" :visible.sync="visible" @confirm="shangjiaBook" />
  28. </div>
  29. </template>
  30. <script>
  31. import ProjectMenu from '@/views/project_manage/common/ProjectMenu.vue';
  32. import CommonPreview from '@/components/CommonPreview.vue';
  33. import ConfirmBookInfo from './components/ConfirmBookInfo.vue';
  34. import { isTrue } from '@/utils/common';
  35. import { ShangjiaBook, RollbackProject, RejectShangjiaBookRequest, RejectRollbackProjectRequest } from '@/api/project';
  36. export default {
  37. name: 'OrgFinalPreview',
  38. components: {
  39. ProjectMenu,
  40. CommonPreview,
  41. ConfirmBookInfo,
  42. },
  43. data() {
  44. return {
  45. project_id: this.$route.params.projectId || '',
  46. isTrue,
  47. visible: false,
  48. };
  49. },
  50. methods: {
  51. openConfirmBookDialog() {
  52. this.visible = true;
  53. },
  54. shangjiaBook() {
  55. const loading = this.$loading('正在上架教材,请稍等...');
  56. ShangjiaBook({ project_id: this.project_id })
  57. .then(() => {
  58. this.$message.success('上架成功');
  59. this.$refs.preview.getProjectBaseInfo();
  60. })
  61. .finally(() => {
  62. loading.close();
  63. this.visible = false;
  64. });
  65. },
  66. rollbackProject() {
  67. this.$confirm('确定要退改吗?', '提示', {
  68. confirmButtonText: '确定',
  69. cancelButtonText: '取消',
  70. type: 'warning',
  71. })
  72. .then(() => {
  73. RollbackProject({ project_id: this.project_id }).then(() => {
  74. this.$message.success('退改成功');
  75. this.$refs.preview.getProjectBaseInfo();
  76. });
  77. })
  78. .catch(() => {});
  79. },
  80. rejectShangjiaBookRequest() {
  81. this.$confirm('确定要驳回上架请求吗?', '提示', {
  82. confirmButtonText: '确定',
  83. cancelButtonText: '取消',
  84. type: 'warning',
  85. })
  86. .then(() => {
  87. RejectShangjiaBookRequest({ project_id: this.project_id }).then(() => {
  88. this.$message.success('驳回上架请求成功');
  89. this.$refs.preview.getProjectBaseInfo();
  90. });
  91. })
  92. .catch(() => {});
  93. },
  94. rejectRollbackProjectRequest() {
  95. this.$confirm('确定要驳回退改请求吗?', '提示', {
  96. confirmButtonText: '确定',
  97. cancelButtonText: '取消',
  98. type: 'warning',
  99. })
  100. .then(() => {
  101. RejectRollbackProjectRequest({ project_id: this.project_id }).then(() => {
  102. this.$message.success('驳回退改请求成功');
  103. this.$refs.preview.getProjectBaseInfo();
  104. });
  105. })
  106. .catch(() => {});
  107. },
  108. goBackBookList() {
  109. this.$router.push({ path: '/project_manage/org/final' });
  110. },
  111. },
  112. };
  113. </script>
  114. <style lang="scss" scoped>
  115. @use '@/styles/mixin.scss' as *;
  116. .org-final-preview {
  117. @include page-content(true);
  118. }
  119. </style>