611 lines
12 KiB
Vue

<template>
<view class="container">
<view class="safe_content">
<view>
<view>
<view></view>
<view class="el-statistic">
<view class="head">
隐患总数
</view>
<view class="con">
{{safeDetailInfo.dangerNum}}
</view>
</view>
</view>
<view>
<view></view>
<view class="el-statistic">
<view class="head">
已整改数
</view>
<view class="con">
{{safeDetailInfo.rectificationDoneNum}}
</view>
</view>
</view>
<view>
<view></view>
<view class="el-statistic">
<view class="head">
已逾期数
</view>
<view class="con">
{{safeDetailInfo.overdueNotCloseNum}}
</view>
</view>
</view>
<view>
<view></view>
<view class="el-statistic">
<view class="head">
已逾期数
</view>
<view class="con">
{{safeDetailInfo.reviewNum}}
</view>
</view>
</view>
</view>
<view>
<image src="/static/bthgIcon/bg_safe.png" />
<view class="">
<view class="safe_content_scroll_title">
<view>问题分类</view>
<view>问题占比</view>
<view>问题数量</view>
</view>
<!-- <scroll-view scroll-y>
</scroll-view> -->
<view class="safe_content_scroll">
<view v-for="(item, index) in safeProblemList" :key="index">
<view>{{ item.name }}</view>
<view>{{ item.percent }}%</view>
<view>{{ item.count }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="columnCharts_container">
<view class="container_title">
EPC责任单位问题分析
</view>
<view class="columnCharts">
<view class="columnCharts_boxs" v-if="columnarChart1.textDataX.length > 0">
<!-- <u-charts canvas-id="columnarChart1" chartType="column" :opts="columnarChart1" ref="columnarChart1"
:cWidth="cWidth" :cHeight="cHeight1" :legends="false" /> -->
<qiun-data-charts type="column" :ontouch="true" :opts="opts"
:chartData="columnarChart1" />
<view class="columnCharts_top">
问题数量
</view>
<view class="columnCharts_right">
单位名称
</view>
</view>
<view class="no_data" v-else>
<image src="/static/bthgIcon/noData.png"></image>
<view>暂无数据</view>
</view>
</view>
</view>
<view class="pieCharts">
<view class="container_title">
危大工程
</view>
<u-charts canvas-id="pieChart1" chartType="pie" :opts="pieChart1" ref="pieChart1" :cWidth="cWidth"
:cHeight="cHeight2" :legends="true" />
</view>
</view>
</template>
<script>
import uCharts from '@/components/u-charts/component.vue';
import {
pxToRpx
} from "@/utils/tool.js";
export default {
components: {
uCharts,
},
data() {
return {
projectSn: "",
cWidth: 0,
cHeight1: 0,
cHeight2: 0,
safeDetailInfo: {},
safeProblemList: [],
columnarChart1: {
categories: [],
textDataX: [],
series: [{
// name: "温度",
data: []
}]
},
opts: {},
pieChart1: {
title: {
name: "",
color: '#7cb5ec',
fontSize: 25,
offsetY: 0,
},
series: [{
"data": 0,
color: '#3BA1FF',
name: '未开始'
},
{
"data": 0,
color: '#FBC02D',
name: '进行中'
}, {
"data": 0,
color: '#0CE4D1',
name: '已完成'
},
]
}
}
},
created() {
// const that = this;
// uni.getSystemInfo({
// success: function(res) {
// that.cWidth = res.windowWidth - pxToRpx(28) - pxToRpx(24);
// }
// });
const that = this;
uni.getSystemInfo({
success: function(res) {
console.log(res.windowWidth);
console.log(11111, res.windowHeight);
that.cWidth = res.windowWidth - uni.upx2px(96) - uni.upx2px(44);
that.cHeight1 = uni.upx2px(450)
that.cHeight2 = uni.upx2px(410)
}
});
},
mounted() {
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
this.getHomePageSafeApi();
this.getHomePageCountConstructionState();
},
onShow() {
},
onLoad(options) {
},
methods: {
// 安全管理
getHomePageSafeApi() {
const that = this;
let data = {
projectSn: this.projectSn,
};
console.log(this.projectSn)
this.sendRequest({
url: 'xmgl/homePage/countSafe',
data,
method: 'post',
success(res) {
console.log('安全管理安全隐患统计', res);
if (res.code == 200) {
that.safeDetailInfo = res.result;
}
}
});
this.sendRequest({
url: 'xmgl/homePage/countSafeTypeProblem',
data,
method: 'post',
success(res) {
console.log('安全管理问题分类统计', res);
if (res.code == 200) {
that.safeProblemList = res.result.data;
}
}
});
this.sendRequest({
url: 'xmgl/homePage/countSafeResponsibleUnit',
data,
method: 'post',
success(res) {
console.log('安全管理EPC责任单位统计', res);
if (res.code == 200) {
const resultList = res.result;
const newResult = {
categories: resultList.map(item => item.x),
textDataX: resultList.map(item => item.x),
series: [{
// name: "温度",
data: resultList.map(item => item.y ? item.y : 0)
}]
}
that.opts = {
color: [
"#5181F6",
"#00DBB6",
"#F67F51",
"#FF515A",
"#8B5CFF",
"#00CA69",
],
width: that.cWidth - uni.upx2px(60),
height: that.cHeight1,
padding: [uni.upx2px(30), 0, uni.upx2px(20), uni.upx2px(20)],
enableScroll: true,
animation: false,
duration: 0,
fontSize: uni.upx2px(22),
legend: {
show: false
},
xAxis: {
disableGrid: true,
itemCount: 4,
labelCount: newResult.categories.length,
fontSize: uni.upx2px(22),
lineHeight: uni.upx2px(40),
format: "Xdemo",
// scrollShow: true,
},
yAxis: {
format: (val) => {
console.log(111, val);
if ((val + "").indexOf(".") != -1) {
return val.toFixed(0); //保留小数后1位
} else {
return val;
}
},
},
extra: {
column: {
type: "group",
width: uni.upx2px(28),
},
}
}
that.$nextTick(() => {
that.columnarChart1 = newResult;
})
console.log("我是111", that.opts)
// if(that.columnarChart1.textDataX.length > 0) {
// that.$nextTick(() => {
// that.$refs.columnarChart1.changeData('columnarChart1', that.columnarChart1)
// })
// }
}
}
});
},
getHomePageCountConstructionState() {
const that = this;
let data = {
projectSn: this.projectSn,
};
console.log(this.projectSn)
this.sendRequest({
url: 'xmgl/homePage/countConstructionState',
data,
method: 'post',
success(res) {
console.log('安全管理安全隐患统计', res);
if (res.code == 200) {
that.pieChart1 = {
title: {
name: "",
color: '#7cb5ec',
fontSize: 25,
offsetY: 0,
},
series: [{
"data": res.result.no,
color: '#3BA1FF',
name: '未开始'
},
{
"data": res.result.ing,
color: '#FBC02D',
name: '进行中'
}, {
"data": res.result.done,
color: '#0CE4D1',
name: '已完成'
},
]
};
that.$nextTick(() => {
that.$refs.pieChart1.changeData('pieChart1', that.pieChart1)
})
}
}
})
},
}
}
</script>
<style lang="scss" scoped>
.no_data {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: rgba(0, 0, 0, 0.5);
font-size: 28rpx;
uni-image {
width: 300rpx;
height: 300rpx;
display: block;
margin: 0 auto;
}
}
.container {
margin-top: 24rpx;
// padding: 0 20rpx 20rpx;
.pieCharts {
padding: 0 32rpx;
margin-top: 20rpx;
}
.columnCharts_container {
padding: 0 32rpx;
.columnCharts {
width: calc(100%);
// min-height: 490rpx;
min-height: 450rpx;
background: #FFFFFF;
box-shadow: 0px 10rpx 20rpx 0px rgba(46, 91, 255, 0.2);
border-radius: 8rpx;
border: 2rpx solid rgba(102, 111, 232, 0.08);
padding: 24rpx;
margin-top: 20rpx;
position: relative;
.columnCharts_boxs {
display: flex;
align-items: flex-end;
width: 100%;
}
.columnCharts_top {
position: absolute;
top: 0;
left: 18rpx;
font-size: 24rpx;
}
.columnCharts_right {
position: relative;
bottom: 2.2vh;
left: 10rpx;
font-size: 24rpx;
// width: 104rpx;
width: 20%;
}
}
}
.safe_content {
>view:first-child {
display: flex;
height: 140rpx;
// background-color: #E9F2FF;
background-color: #FFFFFF;
// border-radius: 16rpx;
padding: 0 24rpx;
>view:nth-child(1) {
>view:first-child {
border: 6rpx solid #7caaf9;
}
}
>view:nth-child(2) {
>view:first-child {
border: 6rpx solid #98e87a;
}
}
>view:nth-child(3) {
>view:first-child {
border: 6rpx solid #f97c7c;
}
}
>view:nth-child(4) {
>view:first-child {
border: 6rpx solid #98e87a;
}
}
>view {
width: 25%;
display: flex;
// align-items: center;
>view:first-child {
width: 30rpx;
height: 30rpx;
background-color: white;
border-radius: 50%;
margin-left: 10rpx;
margin-top: 30rpx;
}
.el-statistic {
flex: 1;
text-align: left;
margin-left: 16rpx;
display: flex;
flex-direction: column;
justify-content: center;
.head {
color: #666666;
font-size: 28rpx;
}
.con {
color: #0056a8;
font-weight: bold;
justify-content: flex-start;
font-size: 44rpx;
}
}
}
}
>view:last-child {
margin-top: 40rpx;
display: flex;
align-items: center;
// height: 284rpx;
// align-items: center;
>image {
width: 228rpx;
height: 160rpx;
}
>view {
flex: 1;
margin-left: 20rpx;
}
.safe_content_scroll_title {
width: 100%;
display: flex;
font-size: 28rpx;
color: #707070;
>view:first-child {
font-size: 28rpx;
color: #444444;
position: relative;
margin: 0 32rpx;
width: 40%;
text-align: center;
}
>view:not(:first-child) {
// margin: 0 32rpx;
width: 30%;
text-align: center;
}
>view:nth-child(2) {
// margin-left: 64rpx;
width: 30%;
text-align: center;
}
}
.safe_content_scroll {
width: 100%;
// max-height: 284rpx;
>view:not(:first-child) {
margin-top: 40rpx;
}
>view {
display: flex;
font-size: 28rpx;
color: #707070;
cursor: pointer;
>view:first-child {
font-size: 28rpx;
color: #444444;
position: relative;
margin: 0 32rpx;
width: 34%;
text-align: center;
}
>view:first-child::after {
content: '';
position: absolute;
left: -30rpx;
top: 50%;
transform: translateY(-50%);
width: 20rpx;
height: 20rpx;
border-radius: 50%;
background-color: #3ba1ff;
}
>view:first-child::before {
content: '';
position: absolute;
right: -36rpx;
top: 50%;
transform: translateY(-50%);
width: 4rpx;
height: 90%;
background-color: #d9d9d9;
}
>view:not(:first-child) {
// margin: 0 32rpx;
text-align: center;
width: 27%;
}
>view:nth-child(2) {
// margin-left: 64rpx;
text-align: center;
}
}
}
}
}
}
.container_title {
font-size: 30rpx;
font-weight: bold;
position: relative;
margin-left: 20rpx;
margin-bottom: 16rpx;
margin-top: 32rpx;
color: #2D8EF3;
}
.container_title::after {
content: '';
position: absolute;
left: -20rpx;
top: 50%;
width: 4rpx;
height: 80%;
transform: translateY(-50%);
background-color: #2D8EF3;
}
</style>