表格样式
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<public-title :title="props.title">
|
<public-title :title="props.title">
|
||||||
<template #title>
|
<template #right>
|
||||||
{{ props.tips }}
|
{{ props.tips }}
|
||||||
</template>
|
</template>
|
||||||
</public-title>
|
</public-title>
|
||||||
@@ -9,14 +9,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import PublicTitle from '/@/components/publicTitle.vue';
|
import PublicTitle from '/@/components/publicTitle.vue';
|
||||||
import { useSpin } from '/@/components/body-d-left/bodyLeftHooks.ts';
|
import {useSpin} from '/@/components/body-d-left/bodyLeftHooks.ts';
|
||||||
import { useHealth } from '/@/components/body-d-right/bodyRightHooks.ts';
|
import {useHealth} from '/@/components/body-d-right/bodyRightHooks.ts';
|
||||||
import { screenPie } from '/@/components/item-d/pieCharts.ts';
|
import {screenPie} from '/@/components/item-d/pieCharts.ts';
|
||||||
import { onMounted, ref, unref, watch } from 'vue';
|
import {onMounted, ref, unref, watch} from 'vue';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => '',
|
default: () => '',
|
||||||
@@ -33,44 +33,44 @@
|
|||||||
type: String,
|
type: String,
|
||||||
default: () => '',
|
default: () => '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const healthChart = ref<HTMLElement>();
|
const healthChart = ref<HTMLElement>();
|
||||||
|
|
||||||
const { setSpin, spinning } = useSpin();
|
const {setSpin, spinning} = useSpin();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.data,
|
() => props.data,
|
||||||
() => {
|
() => {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const { healthData, getValue, setHealth } = useHealth();
|
const {healthData, getValue, setHealth} = useHealth();
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
// setHealth(props.data);
|
// setHealth(props.data);
|
||||||
// const yData = unref(getValue);
|
// const yData = unref(getValue);
|
||||||
// let total = yData.reduce((accumulator, currentValue) => Number(accumulator) + Number(currentValue), 0);
|
// let total = yData.reduce((accumulator, currentValue) => Number(accumulator) + Number(currentValue), 0);
|
||||||
initChart(props.data, 78, props.color);
|
initChart(props.data, 78, props.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initChart(chartData, total, color) {
|
function initChart(chartData, total, color) {
|
||||||
let myChart = echarts.init(healthChart.value);
|
let myChart = echarts.init(healthChart.value);
|
||||||
let options = screenPie(chartData, total, color);
|
let options = screenPie(chartData, total, color);
|
||||||
myChart.setOption(options);
|
myChart.setOption(options);
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
myChart.resize();
|
myChart.resize();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.inner {
|
.inner {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: calc(100% - 40px);
|
height: calc(100% - 40px);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="terminal-container">
|
<div class="terminal-container">
|
||||||
<public-title title="睡眠">
|
<public-title title="睡眠">
|
||||||
<template #title>平均睡眠时长:6小时30分</template>
|
<template #right>平均睡眠时长:6小时30分</template>
|
||||||
</public-title>
|
</public-title>
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
@@ -13,33 +13,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import PublicTitle from '/@/components/publicTitle.vue';
|
import PublicTitle from '/@/components/publicTitle.vue';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
import { ringOption, useHealth } from '/@/components/body-d-right/bodyRightHooks';
|
import {ringOption, useHealth} from '/@/components/body-d-right/bodyRightHooks';
|
||||||
import { ref, onMounted, unref } from 'vue';
|
import {ref, onMounted, unref} from 'vue';
|
||||||
import { sleepCharts } from '/@/components/secondaryScreen/screen-right/screenRightHooks';
|
import {sleepCharts} from '/@/components/secondaryScreen/screen-right/screenRightHooks';
|
||||||
|
|
||||||
const sleepChart = ref<HTMLElement>();
|
const sleepChart = ref<HTMLElement>();
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
const { healthData, getValue, setHealth } = useHealth();
|
const {healthData, getValue, setHealth} = useHealth();
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
initChart();
|
initChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initChart() {
|
function initChart() {
|
||||||
let myChart = echarts.init(sleepChart.value);
|
let myChart = echarts.init(sleepChart.value);
|
||||||
let options = sleepCharts();
|
let options = sleepCharts();
|
||||||
myChart.setOption(options);
|
myChart.setOption(options);
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
myChart.resize();
|
myChart.resize();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.inner {
|
.inner {
|
||||||
height: calc(100% - 40px);
|
height: calc(100% - 40px);
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@@ -60,5 +60,5 @@
|
|||||||
.sleepChart {
|
.sleepChart {
|
||||||
height: 80%;
|
height: 80%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<public-title title="预警"/>
|
<public-title title="预警"/>
|
||||||
<div class="inner-screen">
|
<div class="inner-screen">
|
||||||
<a-table :dataSource="dataSource" :columns="columns"/>
|
<a-table class="ant-table-striped" :dataSource="tableInfo.dataSource" :columns="tableInfo.columns"
|
||||||
|
:pagination="tableInfo.pagination"
|
||||||
|
:rowClassName="(record, index) => (index % 2 === 1 ? 'table-default' : 'table-striped')"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -10,6 +12,15 @@
|
|||||||
import {ref} from 'vue';
|
import {ref} from 'vue';
|
||||||
import PublicTitle from '/@/components/publicTitle.vue';
|
import PublicTitle from '/@/components/publicTitle.vue';
|
||||||
|
|
||||||
|
const tableInfo = ref({
|
||||||
|
dataSource: [],
|
||||||
|
columns: [],
|
||||||
|
pagination: {
|
||||||
|
current: 1,
|
||||||
|
pageSize: 2,
|
||||||
|
total: 20
|
||||||
|
}
|
||||||
|
})
|
||||||
const dataSource = ref([
|
const dataSource = ref([
|
||||||
{
|
{
|
||||||
key: '1',
|
key: '1',
|
||||||
@@ -36,16 +47,19 @@ const columns = ref([
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
key: 'name',
|
key: 'name',
|
||||||
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
dataIndex: 'age',
|
dataIndex: 'age',
|
||||||
key: 'age',
|
key: 'age',
|
||||||
|
align: 'right',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '住址',
|
title: '住址',
|
||||||
dataIndex: 'address',
|
dataIndex: 'address',
|
||||||
key: 'address',
|
key: 'address',
|
||||||
|
align: 'center',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
@@ -59,13 +73,51 @@ const columns = ref([
|
|||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-table-tbody tr:nth-child(even)) {
|
:deep(.ant-table) {
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
background-color: transparent;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.ant-table-tbody tr:nth-child(odd)) {
|
:deep(.ant-table-tbody > tr > td) {
|
||||||
background-color: #0A0A0C;
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-table-row:hover) {
|
||||||
|
background-color: transparent !important;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-table-striped :deep(.table-striped) td {
|
||||||
|
background-color: #0A0A0C;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-table-striped :deep(.table-default) td {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
:deep(.ant-pagination-prev .ant-pagination-item-link, .ant-pagination-next .ant-pagination-item-link) {
|
||||||
|
background-color: #1F2935;
|
||||||
|
color: #8291A9;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-pagination-item) {
|
||||||
|
background-color: #1F2935;
|
||||||
|
color: #ffffff;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前页选中的样式
|
||||||
|
:deep(.ant-pagination-item-active) {
|
||||||
|
background-color: #0081FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-pagination-item-active a,.ant-pagination-item a) {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user