cardViewLone.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div class="card-view">
  3. <div class="card-title">
  4. <div class="title-left">
  5. <p>{{ props.title }}</p>
  6. </div>
  7. <div class="title-right">
  8. <ul v-if="props.topTabs">
  9. <li
  10. v-for="(item, index) in props.topTabs"
  11. :key="index"
  12. :class="index == topTabsIndex ? 'liActive' : ''"
  13. @click="topTabsClick(item, index)"
  14. >
  15. <p>{{ item }}</p>
  16. </li>
  17. </ul>
  18. <el-select
  19. v-if="topTabsYear"
  20. v-model="yearModel"
  21. class="m-2"
  22. placeholder="选择年份"
  23. style="width: 100px"
  24. >
  25. <el-option
  26. v-for="item in yearOptions"
  27. :key="item.value"
  28. :label="item.label"
  29. :value="item.value"
  30. />
  31. </el-select>
  32. </div>
  33. </div>
  34. <div class="tabs-Box" v-if="initTabsShow()">
  35. <div class="tabs-left">
  36. <ul v-if="props.leftTabs">
  37. <el-radio-group v-model="radioModel" @change="radioGroupChange">
  38. <el-radio
  39. v-for="(item, index) in props.leftTabs"
  40. :label="index"
  41. :key="index"
  42. size="large"
  43. >{{ item }}</el-radio
  44. >
  45. </el-radio-group>
  46. </ul>
  47. </div>
  48. <div class="tabs-right">
  49. <ul v-if="props.rightTabs">
  50. <li
  51. v-for="(item, index) in props.rightTabs"
  52. :key="index"
  53. :class="index == rightTabsIndex ? 'liActive' : ''"
  54. @click="rightTabsClick(item, index)"
  55. >
  56. <p>{{ item }}</p>
  57. </li>
  58. </ul>
  59. </div>
  60. </div>
  61. <div class="card-content">
  62. <slot></slot>
  63. </div>
  64. </div>
  65. </template>
  66. <script setup lang="ts">
  67. const props = defineProps({
  68. title: String,
  69. leftTabs: Array,
  70. rightTabs: Array,
  71. topTabs: Array,
  72. topTabsYear: Boolean
  73. })
  74. const emit = defineEmits(['leftClick', 'rightClick', 'topClick'])
  75. const yearOptions = ref([
  76. {
  77. label: '2024',
  78. value: '2024'
  79. },
  80. {
  81. label: '2023',
  82. value: '2023'
  83. },
  84. {
  85. label: '2022',
  86. value: '2022'
  87. }
  88. ])
  89. const yearModel = ref('2024')
  90. const radioModel = ref(0)
  91. const rightTabsIndex = ref(0)
  92. const topTabsIndex = ref(0)
  93. const initTabsShow = () => {
  94. if (props.leftTabs || props.rightTabs) {
  95. return true
  96. } else {
  97. return false
  98. }
  99. }
  100. const rightTabsClick = (item, index) => {
  101. rightTabsIndex.value = index
  102. emit('rightClick', index)
  103. }
  104. const topTabsClick = (item, index) => {
  105. topTabsIndex.value = index
  106. emit('topClick', index)
  107. }
  108. const radioGroupChange = (v) => {
  109. emit('leftClick', props.leftTabs[v])
  110. }
  111. /** 初始化 **/
  112. onMounted(() => {
  113. initTabsShow()
  114. })
  115. </script>
  116. <style lang="scss" scoped>
  117. p,
  118. span,
  119. h4,
  120. h5,
  121. h6 {
  122. font-family: AlibabaPuHuiTiR;
  123. }
  124. .card-view {
  125. width: 100%;
  126. height: auto;
  127. .card-title {
  128. width: 100%;
  129. height: 46px;
  130. background: url(@/assets/imgs/oaView/card-title-lone.png) no-repeat;
  131. background-size: 100% 100%;
  132. display: flex;
  133. align-items: center;
  134. justify-content: space-between;
  135. padding-left: 45px;
  136. .title-left {
  137. p {
  138. color: #fff;
  139. font-size: 20px;
  140. font-family: AlibabaPuHuiTiB;
  141. font-weight: 600;
  142. color: #ffffff;
  143. background: linear-gradient(0deg, #ffff 20%, #def1ff 100%);
  144. -webkit-background-clip: text;
  145. -webkit-text-fill-color: transparent;
  146. margin-top: 8px;
  147. }
  148. }
  149. .title-right {
  150. margin-top: 8px;
  151. height: 100%;
  152. ul {
  153. display: flex;
  154. align-items: center;
  155. height: 100%;
  156. li {
  157. display: flex;
  158. align-items: center;
  159. justify-content: center;
  160. width: 64px;
  161. height: 24px;
  162. border: 2px solid #0d6795;
  163. background-color: transparent;
  164. cursor: pointer;
  165. margin-right: 5px;
  166. p {
  167. color: #7ac1ec;
  168. font-size: 16px;
  169. }
  170. }
  171. li:last-child {
  172. margin-right: 0;
  173. }
  174. .liActive {
  175. background-color: #29a4e4;
  176. p {
  177. color: #fff;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. .tabs-Box {
  184. width: 100%;
  185. display: flex;
  186. align-items: center;
  187. justify-content: space-between;
  188. padding: 0 10px;
  189. height: 40px;
  190. padding-right: 0;
  191. .tabs-left {
  192. ul {
  193. display: flex;
  194. align-items: center;
  195. li {
  196. }
  197. }
  198. }
  199. .tabs-right {
  200. ul {
  201. display: flex;
  202. align-items: center;
  203. li {
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. height: 24px;
  208. border: 2px solid #0d6795;
  209. background-color: transparent;
  210. cursor: pointer;
  211. margin-right: 5px;
  212. padding: 0 4px;
  213. p {
  214. color: #7ac1ec;
  215. font-size: 16px;
  216. white-space: nowrap;
  217. }
  218. }
  219. li:last-child {
  220. margin-right: 0;
  221. }
  222. .liActive {
  223. background-color: #29a4e4;
  224. p {
  225. color: #fff;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. .card-content {
  232. width: 100%;
  233. height: calc(100% - 86px);
  234. }
  235. }
  236. :deep(.tabs-left) {
  237. .el-radio__label {
  238. color: #7ac1ec;
  239. font-size: 16px;
  240. font-family: AlibabaPuHuiTiR;
  241. }
  242. .el-radio {
  243. margin-right: 15px;
  244. }
  245. }
  246. :deep(.title-right) {
  247. .el-select {
  248. .el-input {
  249. }
  250. .el-input__wrapper {
  251. background-color: transparent;
  252. border-radius: 0;
  253. border-color: #0d6795 !important;
  254. }
  255. input,
  256. span {
  257. color: #fff;
  258. }
  259. }
  260. }
  261. </style>