RegulationAndNotice.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div class="outer-person-container">
  3. <div class="container-title">
  4. <span class="line"></span>
  5. <span class="title">管理规定与通知</span>
  6. </div>
  7. <div class="tab-content">
  8. <el-tabs v-model="activeName">
  9. <el-tab-pane label="保卫" name="security">
  10. <div class="item-content">
  11. <div class="regulation-item" v-for="item in securityRegulationData" :key="item.id">
  12. <div class="round" @click="handleItemRedirect(item)"> </div>
  13. <div class="item-name" @click="handleItemRedirect(item)">{{ item.name }}</div>
  14. </div>
  15. </div>
  16. </el-tab-pane>
  17. <el-tab-pane label="保密" name="confidentiality">
  18. <div class="item-content">
  19. <div class="regulation-item" v-for="item in confidentialityRegulationData" :key="item.id">
  20. <div class="round" @click="handleItemRedirect(item)"> </div>
  21. <div class="item-name" @click="handleItemRedirect(item)">{{ item.name }}</div>
  22. </div>
  23. </div>
  24. </el-tab-pane>
  25. </el-tabs>
  26. </div>
  27. <div class="more">
  28. <span class="more-text" @click="handleMoreRedirect">更多</span>
  29. <el-icon class="more-icon" @click="handleMoreRedirect"><DArrowRight /></el-icon>
  30. <!-- <img
  31. style="cursor: pointer"
  32. @click="handleMoreRedirect"
  33. src="@/assets/images/security-confidientiality/overview-more.png"
  34. alt=""
  35. /> -->
  36. </div>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import { onUnmounted, ref, watch } from 'vue';
  41. import { useRouter } from 'vue-router';
  42. import type { RegulationItem } from '../types';
  43. import { ElIcon } from 'element-plus';
  44. import { DArrowRight } from '@element-plus/icons-vue';
  45. import { getSecurityOverview, getConfidentialityOverview } from '@/api/security-confidentiality-overview';
  46. const router = useRouter();
  47. const activeName = ref(sessionStorage.getItem('security-confidentiality-overview-active') || 'security');
  48. const securityRegulationData = ref<RegulationItem[]>([]);
  49. const confidentialityRegulationData = ref<RegulationItem[]>([]);
  50. async function getSecurityRegulationData() {
  51. const res = await getSecurityOverview();
  52. if (!res) return [];
  53. return res.length > 4 ? res.slice(0, 4) : res;
  54. }
  55. async function getConfidentialityRegulationData() {
  56. const res = await getConfidentialityOverview();
  57. if (!res) return [];
  58. return res.length > 4 ? res.slice(0, 4) : res;
  59. }
  60. onUnmounted(() => {
  61. sessionStorage.setItem('security-confidentiality-overview-active', activeName.value);
  62. });
  63. watch(
  64. () => activeName.value,
  65. async (val) => {
  66. if (val === 'security') {
  67. securityRegulationData.value = await getSecurityRegulationData();
  68. } else if (val === 'confidentiality') {
  69. confidentialityRegulationData.value = await getConfidentialityRegulationData();
  70. }
  71. },
  72. {
  73. immediate: true,
  74. },
  75. );
  76. function handleItemRedirect(item: RegulationItem) {
  77. sessionStorage.setItem(`${activeName.value}-regulation-active`, 'regulation');
  78. if (item.managementType === 1) {
  79. router.push({
  80. path: `/security-confidentiality/${activeName.value}-regulation-notice`,
  81. });
  82. } else if (item.managementType === 2) {
  83. router.push({
  84. path: `/security-confidentiality/${activeName.value}-regulation-notice-item`,
  85. query: { id: item.id, operate: 'notice-view' },
  86. });
  87. }
  88. }
  89. function handleMoreRedirect() {
  90. sessionStorage.setItem(`${activeName.value}-regulation-active`, 'regulation');
  91. router.push({
  92. path: `/security-confidentiality/${activeName.value}-regulation-notice`,
  93. });
  94. }
  95. </script>
  96. <style scoped lang="scss">
  97. .container-title {
  98. height: 24px;
  99. display: flex;
  100. align-items: center;
  101. font-weight: 500;
  102. font-size: 16px;
  103. color: #000000;
  104. .line {
  105. width: 3px;
  106. height: 16px;
  107. background: #1777ff;
  108. margin-right: 10px;
  109. }
  110. .title {
  111. margin-right: 12px;
  112. }
  113. }
  114. .outer-person-container {
  115. width: 100%;
  116. height: 100%;
  117. padding-top: 14px;
  118. }
  119. .tab-content {
  120. height: calc(100% - 50px);
  121. padding: 0 10px;
  122. }
  123. .regulation-item {
  124. padding: 7px 0;
  125. display: flex;
  126. align-items: center;
  127. }
  128. .round {
  129. width: 6px;
  130. height: 6px;
  131. background: #1777ff;
  132. border-radius: 50%;
  133. margin-right: 6px;
  134. cursor: pointer;
  135. }
  136. .item-name {
  137. max-width: calc(100% - 12px);
  138. color: rgba($color: #000000, $alpha: 0.85);
  139. font-size: 14px;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. cursor: pointer;
  144. }
  145. .item-name:hover {
  146. color: #1777ff;
  147. }
  148. .more {
  149. width: 50px;
  150. font-size: 12px;
  151. display: flex;
  152. align-items: center;
  153. float: inline-end;
  154. color: #007bff;
  155. }
  156. .more:hover {
  157. color: #94c1ff;
  158. }
  159. .more-text {
  160. cursor: pointer;
  161. padding-right: 5px;
  162. }
  163. .more-icon {
  164. cursor: pointer;
  165. }
  166. :deep(.el-tabs__header) {
  167. margin: 0;
  168. }
  169. :deep(.el-tabs__item) {
  170. font-size: 14px !important;
  171. }
  172. :deep(.el-tabs__active-bar) {
  173. bottom: 5px;
  174. height: 3px;
  175. width: 16px !important;
  176. margin-left: 6px;
  177. }
  178. </style>