AlertformData.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div class="container-box">
  3. <div class="control-btn" v-if="hasPermisson()">
  4. <div
  5. class="btn"
  6. :class="{ 'btn-active': activeName === 'default' }"
  7. @click="activeName = 'default'"
  8. >默认数据</div
  9. >
  10. <div class="btn" :class="{ 'btn-active': activeName === 'show' }" @click="activeName = 'show'"
  11. >展示数据</div
  12. >
  13. </div>
  14. <div style="margin-bottom: 10px; display: flex" v-show="activeName === 'default'">
  15. <div style="line-height: 33px">预审后生效模式:</div>
  16. <el-switch :model-value="devMode" @change="switchDevMode" />
  17. </div>
  18. <Default class="content-box" v-if="activeName === 'default'" />
  19. <Show class="content-box" v-else />
  20. </div>
  21. </template>
  22. <script setup lang="ts">
  23. import { ref } from 'vue';
  24. import Default from './components/default/Default.vue';
  25. import Show from './components/show/Show.vue';
  26. import { useUserStore } from '@/store/modules/user';
  27. import { getDevMode, switchDevMode as SDM } from '@/api/datamanagement/getDevMode';
  28. const devMode = ref(true);
  29. getDevMode().then((res) => {
  30. devMode.value = res;
  31. });
  32. const switchDevMode = () => {
  33. SDM();
  34. devMode.value = !devMode.value;
  35. };
  36. const activeName = ref('default');
  37. const userStore = useUserStore();
  38. const hasPermisson = () => {
  39. return userStore.checkPermission('question_mock_edit_admin');
  40. };
  41. </script>
  42. <style scoped lang="scss">
  43. .container-box {
  44. width: 100%;
  45. height: 100%;
  46. display: flex;
  47. flex-direction: column;
  48. min-height: calc(100vh - 90px);
  49. padding: 21px;
  50. background-color: rgba(255, 255, 255, 1);
  51. border-radius: 10px;
  52. }
  53. .control-btn {
  54. display: flex;
  55. margin-bottom: 20px;
  56. .btn {
  57. display: flex;
  58. justify-content: center;
  59. align-items: center;
  60. width: 188px;
  61. height: 38px;
  62. font-size: 14px;
  63. font-weight: 400;
  64. color: rgba(0, 0, 0, 0.88);
  65. border: 1px solid #d9d9d9;
  66. background: rgba(0, 0, 0, 0.02);
  67. cursor: pointer;
  68. }
  69. :first-child {
  70. border-radius: 8px 0px 0px 8px;
  71. }
  72. :last-child {
  73. border-radius: 0px 8px 8px 0px;
  74. }
  75. .btn-active {
  76. font-weight: 500;
  77. color: #1890ff;
  78. border: 1px solid #1890ff;
  79. background-color: rgba(24, 144, 255, 0.15);
  80. }
  81. }
  82. .content-box {
  83. flex: 1;
  84. }
  85. </style>