123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <div class="card-view">
- <div class="card-title">
- <div class="title-left">
- <p>{{ props.title }}</p>
- </div>
- <div class="title-right">
- <ul v-if="props.topTabs">
- <li
- v-for="(item, index) in props.topTabs"
- :key="index"
- :class="index == topTabsIndex ? 'liActive' : ''"
- @click="topTabsClick(item, index)"
- >
- <p>{{ item }}</p>
- </li>
- </ul>
- <el-select
- v-if="topTabsYear"
- v-model="yearModel"
- class="m-2"
- placeholder="选择年份"
- style="width: 100px"
- >
- <el-option
- v-for="item in yearOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </div>
- </div>
- <div class="tabs-Box" v-if="initTabsShow()">
- <div class="tabs-left">
- <ul v-if="props.leftTabs">
- <el-radio-group v-model="radioModel" @change="radioGroupChange">
- <el-radio
- v-for="(item, index) in props.leftTabs"
- :label="index"
- :key="index"
- size="large"
- >{{ item }}</el-radio
- >
- </el-radio-group>
- </ul>
- </div>
- <div class="tabs-right">
- <ul v-if="props.rightTabs">
- <li
- v-for="(item, index) in props.rightTabs"
- :key="index"
- :class="index == rightTabsIndex ? 'liActive' : ''"
- @click="rightTabsClick(item, index)"
- >
- <p>{{ item }}</p>
- </li>
- </ul>
- </div>
- </div>
- <div class="card-content">
- <slot></slot>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- const props = defineProps({
- title: String,
- leftTabs: Array,
- rightTabs: Array,
- topTabs: Array,
- topTabsYear: Boolean
- })
- const emit = defineEmits(['leftClick', 'rightClick', 'topClick'])
- const yearOptions = ref([
- {
- label: '2024',
- value: '2024'
- },
- {
- label: '2023',
- value: '2023'
- },
- {
- label: '2022',
- value: '2022'
- }
- ])
- const yearModel = ref('2024')
- const radioModel = ref(0)
- const rightTabsIndex = ref(0)
- const topTabsIndex = ref(0)
- const initTabsShow = () => {
- if (props.leftTabs || props.rightTabs) {
- return true
- } else {
- return false
- }
- }
- const rightTabsClick = (item, index) => {
- rightTabsIndex.value = index
- emit('rightClick', index)
- }
- const topTabsClick = (item, index) => {
- topTabsIndex.value = index
- emit('topClick', index)
- }
- const radioGroupChange = (v) => {
- emit('leftClick', props.leftTabs[v])
- }
- /** 初始化 **/
- onMounted(() => {
- initTabsShow()
- })
- </script>
- <style lang="scss" scoped>
- p,
- span,
- h4,
- h5,
- h6 {
- font-family: AlibabaPuHuiTiR;
- }
- .card-view {
- width: 100%;
- height: auto;
- .card-title {
- width: 100%;
- height: 46px;
- background: url(@/assets/imgs/oaView/card-title-lone.png) no-repeat;
- background-size: 100% 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-left: 45px;
- .title-left {
- p {
- color: #fff;
- font-size: 20px;
- font-family: AlibabaPuHuiTiB;
- font-weight: 600;
- color: #ffffff;
- background: linear-gradient(0deg, #ffff 20%, #def1ff 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- margin-top: 8px;
- }
- }
- .title-right {
- margin-top: 8px;
- height: 100%;
- ul {
- display: flex;
- align-items: center;
- height: 100%;
- li {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 64px;
- height: 24px;
- border: 2px solid #0d6795;
- background-color: transparent;
- cursor: pointer;
- margin-right: 5px;
- p {
- color: #7ac1ec;
- font-size: 16px;
- }
- }
- li:last-child {
- margin-right: 0;
- }
- .liActive {
- background-color: #29a4e4;
- p {
- color: #fff;
- }
- }
- }
- }
- }
- .tabs-Box {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 10px;
- height: 40px;
- padding-right: 0;
- .tabs-left {
- ul {
- display: flex;
- align-items: center;
- li {
- }
- }
- }
- .tabs-right {
- ul {
- display: flex;
- align-items: center;
- li {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 24px;
- border: 2px solid #0d6795;
- background-color: transparent;
- cursor: pointer;
- margin-right: 5px;
- padding: 0 4px;
- p {
- color: #7ac1ec;
- font-size: 16px;
- white-space: nowrap;
- }
- }
- li:last-child {
- margin-right: 0;
- }
- .liActive {
- background-color: #29a4e4;
- p {
- color: #fff;
- }
- }
- }
- }
- }
- .card-content {
- width: 100%;
- height: calc(100% - 86px);
- }
- }
- :deep(.tabs-left) {
- .el-radio__label {
- color: #7ac1ec;
- font-size: 16px;
- font-family: AlibabaPuHuiTiR;
- }
- .el-radio {
- margin-right: 15px;
- }
- }
- :deep(.title-right) {
- .el-select {
- .el-input {
- }
- .el-input__wrapper {
- background-color: transparent;
- border-radius: 0;
- border-color: #0d6795 !important;
- }
- input,
- span {
- color: #fff;
- }
- }
- }
- </style>
|