123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <template>
- <!-- 血氧趋势 -->
- <view class="bobox" :style="boxstyle">
- <view class="box-title">
- <view class="box-title-left">血氧趋势</view>
- </view>
- <view class="ytitle" v-show="!loading && !isEmpty">百分比</view>
- <view class="echartbox">
- <qiun-data-charts v-show="!isEmpty" type="column" :opts="opts" :chartData="chartData"
- tooltipFormat="spTooltip" />
- <myEmpty v-show="isEmpty" style="padding: 40rpx 0 0 0;"></myEmpty>
- </view>
- <view class="legend" v-if="!loading && !isEmpty">
- <view class="legend-item">
- <view class="legend-dot" style="background-color: #FF5558;"></view><text>{{'<'}}70%</text>
- </view>
- <view class="legend-item">
- <view class="legend-dot" style="background-color: #FDBD27;"></view><text>70 - 89%</text>
- </view>
- <view class="legend-item">
- <view class="legend-dot" style="background-color: #52D087;"></view><text>90 - 100%</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import myEmpty from "@/pages_watch/components/myEmpty/myEmpty.vue";
- export default {
- name: "boChart",
- props: {
- loading: {
- type: Boolean,
- default: false
- },
- boxstyle: {
- type: Object,
- default: () => {}
- }
- },
- components: {
- myEmpty
- },
- data() {
- return {
- isEmpty: true,
- chartData: {},
- opts: {
- padding: [15, 0, 15, 0],
- enableScroll: false,
- dataLabel: false,
- legend: {
- show: false
- },
- xAxis: {
- disableGrid: true,
- fontSize: 12,
- axisLine: false,
- fontColor: '#ccc',
- labelCount: 7,
- format: "formatterTime",
- },
- yAxis: {
- gridType: "dash",
- dashLength: 2,
- data: [{
- fontColor: '#ccc',
- min: 0,
- // max: 100,
- axisLine: false,
- fontSize: 12,
- }]
- },
- extra: {
- tooltip: {
- gridType: "dash",
- showArrow: false,
- legendShow: true,
- legendShape: "circle"
- },
- column: {
- type: "group",
- width: 12,
- barBorderRadius: [4, 4, 0, 0],
- }
- }
- }
- }
- },
- methods: {
- setChartData(data) {
- if (data && data.list.length > 0) {
- this.isEmpty = false
- let chartData = {
- categories: data.list.map(item => item.createTime),
- series: [{
- name: "血氧",
- data: data.list.map(item => ({
- value: item.minBoxy,
- color: item.status === 1 ? "#FDBD27" : item.status === 2 ? "#FF5558" : "#52D087"
- }))
- }]
- }
- this.chartData = JSON.parse(JSON.stringify(chartData));
- } else {
- this.isEmpty = true
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @mixin u-flex($flexD, $alignI, $justifyC) {
- display: flex;
- flex-direction: $flexD;
- align-items: $alignI;
- justify-content: $justifyC;
- }
- .bobox {
- background: #fff;
- }
- .echartbox {
- height: 520rpx;
- width: 100%;
- }
- .box-title {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- @include u-flex(row, center, space-between);
- &-left {
- font-weight: 500;
- font-size: 36rpx;
- color: #222222;
- line-height: 42rpx;
- }
- &-right {
- @include u-flex(row, center, flex-start);
- image {
- height: 48rpx;
- width: 48rpx;
- }
- }
- }
- .ytitle {
- margin-top: 10rpx;
- line-height: 34rpx;
- margin-bottom: 24rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #999999;
- }
- .legend {
- height: 48rpx;
- margin-top: 44rpx;
- margin-bottom: 24rpx;
- @include u-flex(row, center, space-between);
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #757575;
- &-item {
- flex: 1;
- text-align: center;
- @include u-flex(row, center, center);
- }
- &-dot {
- width: 12rpx;
- height: 12rpx;
- border-radius: 50%;
- margin: 12rpx;
- }
- }
- </style>
|