You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

506 lines
13 KiB

2 years ago
<template>
2 years ago
<div class="box">
<div class="top-box">
<div class="topbox-item">
<div class="topbox-item-left">
<div class="topbox-itemleft-img"></div>
<span>不良反应</span>
2 years ago
</div>
2 years ago
<div class="topbox-item-content">
<div class="topbox-itemleft-color">12121111111111111111</div>
<span></span>
</div>
<div class="topbox-item-right">
<div>较去年</div>
<span class="spanshang"></span> <span class="spanxia"></span>
</div>
</div>
<div class="topbox-item">
<div class="topbox-item-left">
<div class="topbox-itemleft-img"></div>
<span>严重不良反应</span>
</div>
<div class="topbox-item-content">
<div class="topbox-itemleft-color">1212</div>
<span></span>
</div>
<div class="topbox-item-right">
<div class="redStyle">较去年</div>
<span class="spanshang"></span> <span class="spanxia"></span>
</div>
</div>
<div class="topbox-item">
<div class="topbox-item-left">
<div class="topbox-itemleft-img"></div>
<span>发生死亡不良反应</span>
</div>
<div class="topbox-item-content">
<div class="topbox-itemleft-color">1212</div>
<span></span>
2 years ago
</div>
2 years ago
<div class="topbox-item-right">
<div class="redStyle">较去年</div>
<span class="spanshang"></span> <span class="spanxia"></span>
</div>
</div>
2 years ago
</div>
2 years ago
<div class="bottom-box" ref="bottom-box"></div>
</div>
2 years ago
</template>
<script>
import * as echarts from "echarts";
2 years ago
import {
getCosmeticsBL,
getMedicalDevicesBL,
getDrugBL,
} from "@/api/largeScreen";
2 years ago
export default {
2 years ago
name: "",
components: {},
data() {
return {
option1: {},
// echarts
myChart1: {},
center: ["18%", "50%"],
};
},
created() {},
mounted() {
this.getData();
},
methods: {
getData() {
2 years ago
let newRouter = this.$route.query;
console.log(newRouter.type);
if (newRouter.type == 1) {
//药品
getDrugBL({ name: newRouter.code }).then((res) => {
console.log(res);
this.$nextTick(() => {
let chartDom = this.$refs["bottom-box"];
this.myChart1 = echarts.init(chartDom);
this.initEcharts();
});
2 years ago
});
2 years ago
}
if (newRouter.type != 1 && newRouter.type != 2) {
//化妆品
getCosmeticsBL({ name: newRouter.code }).then((res) => {
console.log(res);
this.$nextTick(() => {
let chartDom = this.$refs["bottom-box"];
this.myChart1 = echarts.init(chartDom);
this.initEcharts();
});
2 years ago
});
2 years ago
}
if (newRouter.type == 2) {
//医疗器械
getMedicalDevicesBL({ name: newRouter.code }).then((res) => {
console.log(res);
this.$nextTick(() => {
let chartDom = this.$refs["bottom-box"];
this.myChart1 = echarts.init(chartDom);
this.initEcharts();
});
2 years ago
});
2 years ago
}
2 years ago
},
2 years ago
initEcharts() {
this.option1 = {
grid: {
left: "10%",
top: 0,
bottom: 0,
right: "60%",
containLabel: true,
},
tooltip: {
trigger: "item",
formatter: "{b} : {c} ({d}%)",
position: "right",
},
legend: {
type: "scroll",
orient: "vartical",
top: "center",
right: "20",
itemWidth: 10,
itemHeight: 8,
itemGap: 16,
icon: "circle",
textStyle: {
color: "#A3E2F4",
fontSize: 12,
fontWeight: 0,
rich: {
name: {
fontSize: 12,
padding: [25, 0, 5, 0], //图例位置
},
percent: {
fontSize: 12,
color: "#ccc",
width: 80, // 设置宽度
height: 20, // 设置高度
backgroundColor: {
type: "linear",
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{ offset: 0, color: "rgba(36, 64, 97, 1)" }, // 渐变起始色,淡白色
{ offset: 1, color: "rgba(36, 64, 97, 0)" }, // 渐变结束色,逐渐透明
],
2 years ago
},
2 years ago
},
},
},
data: [
{
value: 10,
name: "一般不良反应",
},
{
value: 5,
name: "严重不良反应",
},
{
value: 15,
name: "发生死亡不良反应",
},
],
formatter: function (name) {
let data = [
{
value: 10,
name: "一般不良反应",
},
{
value: 5,
name: "严重不良反应",
},
{
value: 15,
name: "发生死亡不良反应",
},
];
// 获取该选项在数据数组中的索引
var index = data.findIndex(function (item) {
return item.name == name;
});
// 获取该选项的值
var value = data[index].value;
// 计算该选项的百分比
var percent =
(
(value /
data.reduce(function (sum, item) {
return sum + item.value;
}, 0)) *
100
).toFixed(2) + "%";
// 返回自定义的显示内容
return "{name|" + name + "}\n{percent|" + percent + "}";
},
},
polar: { center: this.center, color: "#0B3A72" },
angleAxis: { center: this.center, color: "#0B3A72" },
radiusAxis: {
color: "#0B3A72",
center: this.center,
min: 40,
max: 120,
interval: 20,
axisLine: {
show: false,
lineStyle: {
color: "#0B3E5E",
width: 1,
type: "solid",
},
},
axisLabel: {
formatter: "{value} %",
show: false,
padding: [0, 0, 20, 0],
color: "#0B3E5E",
fontSize: 16,
},
splitLine: {
lineStyle: {
color: "#0B3E5E",
width: 2,
type: "solid",
},
},
},
calculable: true,
series: [
{
color: "#0B3A72",
center: this.center,
type: "pie",
radius: ["5%", "10%"],
hoverAnimation: false,
labelLine: {
normal: {
show: false,
length: 30,
length2: 55,
},
emphasis: {
show: false,
},
},
data: [
{
name: "",
value: 0,
itemStyle: {
normal: {
color: "#0B3E5E",
},
2 years ago
},
2 years ago
},
],
},
{
center: this.center,
type: "pie",
radius: ["100%", "99%"],
color: "#0B3A72",
hoverAnimation: false,
labelLine: {
normal: {
show: false,
length: 30,
length2: 55,
},
emphasis: {
show: false,
},
},
name: "",
data: [
{
name: "",
value: 0,
itemStyle: {
normal: {
2 years ago
color: "#0B3A72",
2 years ago
},
2 years ago
},
2 years ago
},
],
},
{
center: this.center,
stack: "a",
type: "pie",
radius: ["20%", "90%"],
roseType: "area",
zlevel: 10,
label: {
normal: {
show: false,
formatter: "",
textStyle: {
fontSize: 12,
},
},
emphasis: {
show: true,
},
},
labelLine: {
normal: {
show: false,
length: 200,
length2: 55,
},
emphasis: {
show: false,
},
},
data: [
{
value: 10,
name: "一般不良反应",
},
{
value: 5,
name: "严重不良反应",
},
{
value: 15,
name: "发生死亡不良反应",
},
],
},
],
};
this.myChart1.setOption(this.option1);
2 years ago
},
2 years ago
},
computed: {},
};
2 years ago
</script>
<style scoped lang='scss'>
2 years ago
.box {
}
2 years ago
.top-box {
2 years ago
.topbox-item {
&:nth-child(1) {
.topbox-itemleft-img {
background: url("../../../assets/images/daping/buliang1.png");
}
.topbox-itemleft-color {
background: linear-gradient(0deg, #ffffff 0%, #0373e0 100%);
}
}
2 years ago
2 years ago
&:nth-child(2) {
.topbox-itemleft-img {
background: url("../../../assets/images/daping/buliang2.png");
}
2 years ago
2 years ago
.topbox-itemleft-color {
background: linear-gradient(0deg, #ffffff 0%, #bf6e35 100%);
}
}
2 years ago
2 years ago
&:nth-child(3) {
.topbox-itemleft-img {
background: url("../../../assets/images/daping/buliang3.png");
}
2 years ago
2 years ago
.topbox-itemleft-color {
background: linear-gradient(0deg, #ffffff 0%, #f04f50 100%);
}
}
2 years ago
2 years ago
display: flex;
align-items: center;
height: 40px;
width: 98%;
background: url("../../../assets/images/daping/toushi.png");
background-size: contain;
background-repeat: no-repeat;
background-position: bottom;
> div {
display: flex;
align-items: center;
}
2 years ago
2 years ago
.topbox-item-left {
margin-left: 20px;
flex: 1.9;
2 years ago
2 years ago
.topbox-itemleft-img {
width: 20px;
height: 20px;
2 years ago
background-size: contain;
background-repeat: no-repeat;
2 years ago
margin-right: 10px;
}
span {
font-size: 14px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
color: #b7d4f5;
line-height: 50px;
}
}
2 years ago
2 years ago
.topbox-item-content {
flex: 1.5;
.topbox-itemleft-color {
max-width: 110px;
white-space: nowrap;
/* 不换行 */
overflow: hidden;
/* 溢出内容隐藏 */
text-overflow: ellipsis;
/* 显示省略号 */
font-size: 26px;
font-family: YouSheBiaoTiHei;
font-weight: 400;
color: #ffffff;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-right: 5px;
}
span {
font-size: 16px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
color: #b7d4f5;
line-height: 50px;
opacity: 0.5;
}
}
2 years ago
2 years ago
.topbox-item-right {
flex: 1;
.redStyle {
font-size: 16px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
color: #ffffff;
2 years ago
background: linear-gradient(0deg, #ffffff 0%, #d21b1b 100%);
2 years ago
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-right: 5px;
}
div {
font-size: 16px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
color: #ffffff;
background: linear-gradient(0deg, #ffffff 0%, #26e0c4 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-right: 5px;
}
span {
font-size: 16px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
}
.spanshang {
color: #26e0c4;
}
.spanxia {
color: #da1b1b;
}
2 years ago
}
2 years ago
}
2 years ago
}
.bottom-box {
2 years ago
height: 170px;
width: 100%;
2 years ago
}
</style>