master
loveflow 7 months ago
parent 27b7e3baa4
commit 256aa680b2

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -0,0 +1,215 @@
<template>
<div style="height: 100%; width: 100%">
<g-chart :echartdata="option"></g-chart>
</div>
</template>
<script>
export default {
props: {
chartObj: {
type: Object,
default: () => {
return {};
},
},
},
data() {
return {
option: {},
};
},
mounted() {
this.setOption();
},
methods: {
setOption() {
let dataList = this.chartObj.data;
let maxArr = [];
let maxValue = 0;
let xData = [];
let yData = [];
let total = 0;
dataList.forEach((item) => {
xData.push(item.name);
yData.push(item.value);
if (maxValue < item.value) {
maxValue = item.value;
}
});
dataList.forEach((item) => {
maxArr.push(maxValue);
total = total + item.value;
});
if (!total) {
total = 1;
}
this.option = {
grid: {
left: "14",
top: "5%", //
right: "0",
bottom: "0",
},
xAxis: {
show: false,
},
yAxis: [
{
type: "category",
inverse: true,
data: xData,
axisLine: {
show: false,
},
axisTick: {
show: false,
},
axisLabel: {
show: true,
textStyle: {
verticalAlign: "bottom",
color: "#299CD4",
fontSize: 14,
fontFamily: "Microsoft YaHei",
align: "left",
padding: [0, 0, 5, 7],
rich: {
index: {
padding: [2, 1, 0, 1],
width: 20,
height: 20,
backgroundColor: "rgba(255,255,255,0.1)",
borderRadius: 4,
align: "center",
color: "#FFDE9C",
},
name: {
padding: [4, 16, 0, 4],
color: "#ffffff",
fontSize: 14,
},
value: {
padding: [4, 0, 0, 4],
color: "#9CE0FF",
fontSize: 16,
},
rate: {
align: "right",
color: "rgba(255,255,255,0.9)",
fontSize: 12,
},
},
},
formatter: (name, index) => {
const _index = index + 1;
if (dataList.length) {
const item = dataList.filter((item) => item.name == name)[0];
return `{index|${_index}} {name|${name}}{value| ${item.value.toLocaleString()}人}`;
}
},
},
offset: 0,
},
],
series: [
{
//
type: "bar",
barWidth: 6,
itemStyle: {
color: (params) => {
var color = {
type: "linear",
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 0,
color: this.chartObj.color[0], // 0%
},
{
offset: 1,
color: this.chartObj.color[1], // 100%
},
],
};
return color;
},
},
label: {
show: false,
},
data: dataList,
z: 2,
animationEasing: "elasticOut",
},
{
//
type: "pictorialBar",
symbol: "rect",
symbolBoundingData: maxValue,
barWidth: 1,
itemStyle: {
barBorderRadius: 10,
normal: {
color: "none",
},
},
label: {
padding: [-20, 0, 0, -30],
formatter: (params) => {
var text = `{a|${((params.data * 100) / total).toFixed(0)}%}`; // `{{f|(params.data / total) * 100 + %}`;
return text;
},
rich: {
a: {
color: "#9CE0FF",
fontSize: 16,
align: "right",
},
},
position: "right",
distance: 1, //
show: true,
},
data: yData,
z: 0,
animationEasing: "elasticOut",
},
{
name: "外框",
type: "pictorialBar",
symbol: "rect",
symbolBoundingData: maxValue,
barGap: "-100%", //
data: maxArr,
barWidth: 6,
itemStyle: {
color: "rgba(255,255,255,0.06)", //
label: {
//
show: false,
},
},
z: 0,
},
],
};
},
},
watch: {
chartObj: {
handler(newval) {
this.setOption();
},
deep: true,
// immediate: true,
},
},
};
</script>

@ -0,0 +1,326 @@
<template>
<div class="dpiePanel">
<div class="dpieLegend">
<div class="dpieRow" v-for="item in data" :key="item.name">
<div
class="dpieIcon"
:style="{ backgroundColor: item.itemStyle.color }"
></div>
<div class="dpieName">{{ item.name }}</div>
<div class="dpieValue">{{ item.value }}</div>
</div>
</div>
<div style="flex: 1">
<div class="dpiebg">
<div ref="dpieWrapRef" class="dpieWrap"></div>
</div>
</div>
</div>
</template>
<script>
import * as echarts from "echarts";
import "echarts-gl";
export default {
data() {
return {
data: [
{
name: "已被核查人数",
value: 34567,
itemStyle: {
color: "#378DFF",
},
},
{
name: "未被核查人数",
value: 21456,
itemStyle: {
color: "#E15A4E",
},
},
],
total: 1,
};
},
mounted() {
this.total = 1;
for (let i = 0; i < this.data.length; i++) {
this.total += this.data[i].value;
}
this.echartsPie();
},
methods: {
echartsPie() {
let optionsData = this.data;
let hoveredIndex = "";
let chartDom = this.$refs["dpieWrapRef"];
let myChart = echarts.init(chartDom);
const getPie3D = (pieData, internalDiameterRatio) => {
//internalDiameterRatio:
let series = [];
let sumValue = 0;
let startValue = 0;
let endValue = 0;
let k = 1 / 5;
pieData.sort((a, b) => {
return b.value - a.value;
});
// series-surface
for (let i = 0; i < pieData.length; i++) {
sumValue += pieData[i].value;
let seriesItem = {
name:
typeof pieData[i].name === "undefined"
? `series${i}`
: pieData[i].name,
type: "surface",
parametric: true,
wireframe: {
show: false,
},
pieData: pieData[i],
pieStatus: {
selected: false,
hovered: false,
k: k,
},
radius: "90%",
center: ["50%", "50%"],
};
if (typeof pieData[i].itemStyle != "undefined") {
let itemStyle = {};
typeof pieData[i].itemStyle.color != "undefined"
? (itemStyle.color = pieData[i].itemStyle.color)
: null;
typeof pieData[i].itemStyle.opacity != "undefined"
? (itemStyle.opacity = pieData[i].itemStyle.opacity)
: null;
seriesItem.itemStyle = itemStyle;
}
series.push(seriesItem);
}
// 使 sumValue getParametricEquation
// series-surface series-surface.parametricEquation
for (let i = 0; i < series.length; i++) {
endValue = startValue + series[i].pieData.value;
series[i].pieData.startRatio = startValue / sumValue;
series[i].pieData.endRatio = endValue / sumValue;
series[i].parametricEquation = getParametricEquation(
series[i].pieData.startRatio,
series[i].pieData.endRatio,
false,
false,
k,
series[i].pieData.value
);
startValue = endValue;
}
let boxHeight = getHeight3D(series, 6); //3d/2626px
// legendDataseries
let option = {
// backgroundColor: "#fff",
tooltip: {
show: false,
},
legend: {
show: false,
},
xAxis3D: {
min: -1,
max: 1,
},
yAxis3D: {
min: -1,
max: 1,
},
zAxis3D: {
min: -1,
max: 1,
},
grid3D: {
show: false,
boxHeight: boxHeight, //
left: 0,
top: -20, //3d
viewControl: {
//3d
alpha: 24, //
distance: 120, //zoom
rotateSensitivity: 0, //0
zoomSensitivity: 0, //0
panSensitivity: 0, //0
autoRotate: false, //
},
},
series: series,
};
return option;
};
//3d
const getHeight3D = (series, height) => {
series.sort((a, b) => {
return b.pieData.value - a.pieData.value;
});
return (height * 50) / series[0].pieData.value;
};
// series-surface.parametricEquation
const getParametricEquation = (
startRatio,
endRatio,
isSelected,
isHovered,
k,
h
) => {
//
let midRatio = (startRatio + endRatio) / 2;
let startRadian = startRatio * Math.PI * 2;
let endRadian = endRatio * Math.PI * 2;
let midRadian = midRatio * Math.PI * 2;
//
if (startRatio === 0 && endRatio === 1) {
isSelected = false;
}
// / k 1/3
k = typeof k !== "undefined" ? k : 1 / 3;
// x y 0
let offsetX = isSelected ? Math.cos(midRadian) * 0.1 : 0;
let offsetY = isSelected ? Math.sin(midRadian) * 0.1 : 0;
// 1
let hoverRate = isHovered ? 1.05 : 1;
//
return {
u: {
min: -Math.PI,
max: Math.PI * 3,
step: Math.PI / 32,
},
v: {
min: 0,
max: Math.PI * 2,
step: Math.PI / 20,
},
x: function (u, v) {
if (u < startRadian) {
return (
offsetX +
Math.cos(startRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
if (u > endRadian) {
return (
offsetX +
Math.cos(endRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
return offsetX + Math.cos(u) * (1 + Math.cos(v) * k) * hoverRate;
},
y: function (u, v) {
if (u < startRadian) {
return (
offsetY +
Math.sin(startRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
if (u > endRadian) {
return (
offsetY +
Math.sin(endRadian) * (1 + Math.cos(v) * k) * hoverRate
);
}
return offsetY + Math.sin(u) * (1 + Math.cos(v) * k) * hoverRate;
},
z: function (u, v) {
if (u < -Math.PI * 0.5) {
return Math.sin(u);
}
if (u > Math.PI * 2.5) {
return Math.sin(u) * h * 0.1;
}
return Math.sin(v) > 0 ? 1 * h * 0.1 : -1;
},
};
};
let option = getPie3D(this.data, 0.8);
//label线2d使labelLine3dsetOption
option.series.push({
// name: "pie3d",
type: "pie",
label: {
show: true,
position: "outside",
formatter: "{c}%",
},
// startAngle: -25, //[0, 360]
clockwise: false, //3d
radius: ["80%", "80%"],
center: ["50%", "50%"], //线
itemStyle: {
opacity: 0,
},
});
option && myChart.setOption(option);
},
},
watch: {
chartObj: {
handler(newval) {
this.setOption();
},
deep: true,
// immediate: true,
},
},
};
</script>
<style lang="scss" scoped>
.dpiePanel {
position: relative;
flex: 1;
height: 100%;
.dpieLegend {
position: absolute;
right: 40px;
top: 28px;
.dpieRow {
display: flex;
align-items: center;
margin-bottom: 6px;
.dpieIcon {
margin-right: 6px;
width: 8px;
height: 8px;
transform: rotate(45deg);
}
.dpieName {
margin-right: 18px;
font-size: 12px;
color: #d0deee;
}
.dpieValue {
font-size: 16px;
color: #ffffff;
}
}
}
}
.dpieWrap {
width: 240px;
height: 120px;
}
.dpiebg {
margin-top: 10px;
width: 240px;
height: 120px;
background: url("~@/assets/images/screen/dpie.png");
background-size: 100% 100%;
display: flex;
justify-content: flex-start;
}
</style>

@ -72,12 +72,12 @@ export default {
legend: { legend: {
data: legend, data: legend,
orient: "vertical", orient: "vertical",
bottom: "6%", bottom: "2%",
left: "20%", left: "10%",
icon: "diamond", icon: "diamond",
itemHeight: 8, itemHeight: 8,
itemWidth: 8, itemWidth: 8,
itemGap: 16, itemGap: 8,
padding: 2, padding: 2,
//backgroundColor: "rgba(108,128,151,0.2)", //backgroundColor: "rgba(108,128,151,0.2)",
textStyle: { textStyle: {

@ -72,12 +72,12 @@ export default {
legend: { legend: {
data: legend, data: legend,
orient: "vertical", orient: "vertical",
bottom: "6%", bottom: "2%",
left: "20%", left: "10%",
icon: "diamond", icon: "diamond",
itemHeight: 8, itemHeight: 8,
itemWidth: 8, itemWidth: 8,
itemGap: 16, itemGap: 8,
padding: 2, padding: 2,
//backgroundColor: "rgba(108,128,151,0.2)", //backgroundColor: "rgba(108,128,151,0.2)",
textStyle: { textStyle: {

@ -43,8 +43,8 @@ export default {
color: "#E3FEFF", color: "#E3FEFF",
}, },
textAlign: "center", textAlign: "center",
left: "45%", left: "47%",
bottom: "10", bottom: "20%",
}, },
color: this.chartObj.color, color: this.chartObj.color,
graphic: { graphic: {
@ -67,7 +67,7 @@ export default {
// name: '访1', // name: '访1',
type: "pie", type: "pie",
radius: [30, 40], radius: [30, 40],
center: ["50%", "40%"], center: ["center", 80],
data: [ data: [
{ {
value: 100, //100% value: 100, //100%
@ -80,7 +80,10 @@ export default {
}, },
], ],
label: { label: {
show: true, position: "center",
formatter: ((100 * point) / total).toFixed(0) + "%",
color: this.chartObj.color[0],
fontSize: 18,
}, },
labelLine: { labelLine: {
show: false, show: false,
@ -92,7 +95,7 @@ export default {
showEmptyCircle: true, // showEmptyCircle: true, //
radius: [30, 40], radius: [30, 40],
avoidLabelOverlap: true, // avoidLabelOverlap: true, //
center: ["50%", "40%"], center: ["center", 80],
data: [ data: [
{ {
value: (point / total) * 100, value: (point / total) * 100,

@ -168,11 +168,11 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.topHeader { .topHeader {
.headText { .headText {
font-size: vh(48); font-size: vw(40);
} }
.el-menu{ .el-menu{
.el-menu-item{ .el-menu-item{
font-size: vh(20); font-size: vw(18);
} }
} }
} }

@ -19,9 +19,7 @@ export default {
}, },
methods: { methods: {
goBack() { goBack() {
this.$router.push({ this.$emit("gotoPage");
path: "/topic/screen",
});
}, },
}, },
}; };

@ -1,7 +1,7 @@
<template> <template>
<div class="enterpriseTopicPanel"> <div class="enterpriseTopicPanel">
<!-- 人员安全 --> <!-- 人员安全 -->
<topicMain> <topicMain @gotoPage="gotoPage()">
<div class="enterpriseTopic"> <div class="enterpriseTopic">
<el-tabs v-model="tabindex" @tab-click="tabChange"> <el-tabs v-model="tabindex" @tab-click="tabChange">
<el-tab-pane <el-tab-pane
@ -60,6 +60,11 @@ export default {
return ""; return "";
} }
}, },
gotoPage() {
this.$router.push({
path: "/topic/personSafety/screen",
});
},
}, },
}; };
</script> </script>
@ -114,8 +119,8 @@ export default {
border: 1px solid #5b748c; border: 1px solid #5b748c;
.filterBtnWrap { .filterBtnWrap {
padding: 2px; padding: 2px;
&:last-child{ &:last-child {
.el-divider{ .el-divider {
display: none; display: none;
} }
} }

@ -3,7 +3,7 @@
<head-wrap title="人员安全风险评估"></head-wrap> <head-wrap title="人员安全风险评估"></head-wrap>
<div class="enterpriseTopicBody"> <div class="enterpriseTopicBody">
<div class="screenRow mb18"> <div class="screenRow mb18">
<div class="screenCol mr18"> <div class="screenCol mr18" @click="gotoPage('/topic/personSafety')">
<div class="screenName"> <div class="screenName">
<div class="screenIcon"></div> <div class="screenIcon"></div>
<div class="screenNameText">重点岗位异常数</div> <div class="screenNameText">重点岗位异常数</div>
@ -60,19 +60,34 @@
<pTotal :info="tmObj.r3"></pTotal> <pTotal :info="tmObj.r3"></pTotal>
</div> </div>
</div> </div>
<div class="screenCol"> <div class="screenCol" @click="gotoPage('/topic/personSafety')">
<div class="screenName"> <div class="screenName">
<div class="screenIcon"></div> <div class="screenIcon"></div>
<div class="screenNameText">流动人员核查率</div> <div class="screenNameText">流动人员核查率</div>
</div> </div>
<div class="screenChart"></div> <div class="screenChart">
<div class="flowPersonWrap">
<div class="topWrap">
<dPieOne :chartObj="{}"></dPieOne>
</div>
<div class="btmWrap">
<div class="flowHead">
<div class="flowIcon"></div>
<div class="flowTitle">流动人口核查率低企业</div>
</div>
<div class="flowBody">
<barFive :chartObj="trbObj"></barFive>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="screenRow screenRowBtm"> <div class="screenRow screenRowBtm">
<div class="screenCol"> <div class="screenCol" @click="gotoPage('/topic/personSafety')">
<div class="screenName"> <div class="screenName">
<div class="screenIcon"></div> <div class="screenIcon"></div>
<div class="screenNameText">消防安全管理</div> <div class="screenNameText">重点人员分类</div>
</div> </div>
<div class="screenChart"> <div class="screenChart">
<div class="safeManagePanel"> <div class="safeManagePanel">
@ -96,9 +111,11 @@ import pCard from "../components/pCard.vue";
import pTotal from "../components/pTotal.vue"; import pTotal from "../components/pTotal.vue";
import pNum from "../components/num.vue"; import pNum from "../components/num.vue";
import pieSix from "@/loveflow/components/echart/pie/six.vue"; import pieSix from "@/loveflow/components/echart/pie/six.vue";
import dPieOne from "@/loveflow/components/echart/pie/dpieOne.vue";
import barFive from "@/loveflow/components/echart/bar/five.vue";
export default { export default {
components: { headWrap, pCard, pTotal, pNum, pieSix }, components: { headWrap, pCard, pTotal, pNum, pieSix, dPieOne, barFive },
data() { data() {
return { return {
total: 53981 + "", total: 53981 + "",
@ -111,21 +128,21 @@ export default {
color: ["#57F0FF", "#37A1CC", "#08FAC4"], color: ["#57F0FF", "#37A1CC", "#08FAC4"],
}, },
tl2Obj: { tl2Obj: {
name: "危险品领用人员", name: "危险品保管人员",
total: 3400, total: 3400,
point: 1200, point: 1200,
icon: require("@/assets/images/topic/pie2b.png"), icon: require("@/assets/images/topic/pie2b.png"),
color: ["#FFF7E3;", "#EB9104", "#FAC608"], color: ["#FFF7E3", "#EB9104", "#FAC608"],
}, },
tl3Obj: { tl3Obj: {
name: "危险品用人员", name: "危险品使用人员",
total: 3400, total: 3400,
point: 1300, point: 1300,
icon: require("@/assets/images/topic/pie1b.png"), icon: require("@/assets/images/topic/pie1b.png"),
color: ["#57F0FF", "#37A1CC", "#08FAC4"], color: ["#57F0FF", "#37A1CC", "#08FAC4"],
}, },
tl4Obj: { tl4Obj: {
name: "危险品领用人员", name: "危险品技术资质人员",
total: 3400, total: 3400,
point: 900, point: 900,
icon: require("@/assets/images/topic/pie4b.png"), icon: require("@/assets/images/topic/pie4b.png"),
@ -196,8 +213,27 @@ export default {
value: 865, value: 865,
}, },
], ],
trbObj: {
data: [
{ name: "兴达化工有限公司", value: 1123 },
{ name: "兴业化工有限公司", value: 808 },
{ name: "兴盛化工有限公司", value: 703 },
{ name: "兴辉化工有限公司", value: 613 },
{ name: "兴胜化工有限公司", value: 933 },
{ name: "兴飞化工有限公司", value: 573 },
{ name: "兴圣化工有限公司", value: 763 },
],
color: ["#FFDE9C", "#0E9FF7"],
},
}; };
}, },
methods: {
gotoPage(val) {
this.$router.push({
path: val,
});
},
},
}; };
</script> </script>
@ -229,6 +265,9 @@ export default {
background: url("~@/assets/images/topic/scolt.png") no-repeat center background: url("~@/assets/images/topic/scolt.png") no-repeat center
center; center;
background-size: 100% 100%; background-size: 100% 100%;
&:hover {
cursor: pointer;
}
} }
.screenMCol { .screenMCol {
@ -290,6 +329,39 @@ export default {
flex: 1; flex: 1;
} }
} }
.flowPersonWrap {
display: flex;
flex-direction: column;
flex: 1;
.btmWrap {
flex: 1;
display: flex;
flex-direction: column;
.flowHead {
margin-left: 12px;
display: flex;
align-items: center;
height: vw(36);
background: url("~@/assets/images/topic/flow.png") no-repeat
center center;
background-size: 100% 100%;
.flowIcon {
width: vw(32);
height: vw(38);
background: url("~@/assets/images/topic/fsIcon.png") no-repeat
center center;
background-size: 100% 100%;
}
.flowTitle {
font-size: vw(14);
color: #d9e7ff;
}
}
.flowBody {
flex: 1;
}
}
}
} }
} }
.screenMCol { .screenMCol {

Loading…
Cancel
Save