2024-06-12 22:11:48 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="leftBottom">
|
|
|
|
|
|
<Card title="特殊作业情况">
|
2024-06-19 20:21:25 +08:00
|
|
|
|
<!-- <div class="not-data" v-show="isShow">
|
2024-06-15 09:46:11 +08:00
|
|
|
|
<img src="@/assets/images/noData.png" alt="" />
|
|
|
|
|
|
<p>暂无数据</p>
|
2024-06-19 20:21:25 +08:00
|
|
|
|
</div> -->
|
2024-06-12 22:11:48 +08:00
|
|
|
|
<div class="mainContainer">
|
|
|
|
|
|
<div id="pieEchart" style="width:100%;height:100%"></div>
|
|
|
|
|
|
</div>
|
2024-06-15 09:46:11 +08:00
|
|
|
|
|
2024-06-12 22:11:48 +08:00
|
|
|
|
</Card>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import Card from "@/components/card.vue";
|
|
|
|
|
|
import { ref, onMounted, watch } from "vue";
|
2024-06-19 20:21:25 +08:00
|
|
|
|
import { GlobalStore } from "@/stores";
|
2024-06-12 22:11:48 +08:00
|
|
|
|
import * as echarts from 'echarts';
|
2024-06-19 20:21:25 +08:00
|
|
|
|
import { COMPANY } from "@/config/config";
|
|
|
|
|
|
//引入现场大屏API
|
|
|
|
|
|
import {
|
|
|
|
|
|
getStatBySpecialApi,
|
|
|
|
|
|
} from "@/api/modules/agjtLiveApi";
|
|
|
|
|
|
const store = GlobalStore();
|
2024-06-15 09:46:11 +08:00
|
|
|
|
|
2024-06-19 20:21:25 +08:00
|
|
|
|
const isShow = ref(false as any)
|
|
|
|
|
|
|
|
|
|
|
|
const innerPie = ref([
|
|
|
|
|
|
// { value: 0, name: '进行中' },
|
|
|
|
|
|
// { value: 0, name: '已完成' },
|
2024-06-15 09:46:11 +08:00
|
|
|
|
] as any)
|
2024-06-19 20:21:25 +08:00
|
|
|
|
const outPie = ref([
|
|
|
|
|
|
// {name:'高处作业',value:0,doing:0,per:0},{name:'断路作业',value:0,doing:0,per:0},{name:'吊装安全',value:0,doing:0,per:0},{name:'受限空间',value:0,doing:0,per:0},
|
|
|
|
|
|
// {name:'动火作业',value:0,doing:0,per:0},{name:'盲板抽堵',value:0,doing:0,per:0},{name:'动土作业',value:0,doing:0,per:0},{name:'临时用电',value:0,doing:0,per:0},
|
2024-06-13 21:57:10 +08:00
|
|
|
|
] as any)
|
2024-06-19 20:21:25 +08:00
|
|
|
|
|
|
|
|
|
|
//获取特殊作业情况信息
|
|
|
|
|
|
async function getSpecialInfo() {
|
|
|
|
|
|
await getStatBySpecialApi({
|
|
|
|
|
|
// projectSn: store.sn,
|
|
|
|
|
|
projectSn: 'BD3137498CB84BF0969979E0342CDBCA', // yh001---ProjectSn
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
if(res.success){
|
|
|
|
|
|
if(res.result){
|
|
|
|
|
|
//内饼图
|
|
|
|
|
|
if(res.result.total){
|
|
|
|
|
|
// innerPie.value[0].value = res.result.total.running
|
|
|
|
|
|
// innerPie.value[1].value = res.result.total.complete
|
|
|
|
|
|
innerPie.value.push({value: res.result.total.running,name:'进行中'})
|
|
|
|
|
|
innerPie.value.push({value: res.result.total.complete,name:'已完成'})
|
|
|
|
|
|
}
|
|
|
|
|
|
//外饼图
|
|
|
|
|
|
outPie.value = res.result.groupByType
|
|
|
|
|
|
outPie.value.map(item => {
|
|
|
|
|
|
item.value = item.num
|
|
|
|
|
|
item.value = item.num
|
|
|
|
|
|
})
|
|
|
|
|
|
drawPie()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-12 22:11:48 +08:00
|
|
|
|
function drawPie(){
|
|
|
|
|
|
type EChartsOption = echarts.EChartsOption;
|
|
|
|
|
|
|
|
|
|
|
|
var chartDom = document.getElementById('pieEchart')!;
|
|
|
|
|
|
var myChart = echarts.init(chartDom);
|
|
|
|
|
|
var option: EChartsOption;
|
|
|
|
|
|
|
|
|
|
|
|
option = {
|
|
|
|
|
|
tooltip: {
|
|
|
|
|
|
trigger: 'item',
|
2024-06-13 21:57:10 +08:00
|
|
|
|
// formatter: '{a} <br/>{b}: {c} ({d}%)'
|
|
|
|
|
|
formatter: function(params: any){
|
2024-06-19 20:21:25 +08:00
|
|
|
|
if(params.seriesName == 'innerPie'){
|
|
|
|
|
|
return "<div>"+ innerPie.value[params.dataIndex].name + ':' +innerPie.value[params.dataIndex].value + "</div>"
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
return "<div style='width:auto;height:auto'>"+
|
|
|
|
|
|
"<div>"+outPie.value[params.dataIndex].name+" "+ outPie.value[params.dataIndex].ratio +"%</div>"+
|
|
|
|
|
|
"<div>已完成:"+outPie.value[params.dataIndex].complete+ ' 进行中:' + outPie.value[params.dataIndex].running +"</div>"+
|
|
|
|
|
|
"</div>"
|
|
|
|
|
|
}
|
2024-06-13 21:57:10 +08:00
|
|
|
|
},
|
2024-06-12 22:11:48 +08:00
|
|
|
|
},
|
2024-06-13 21:57:10 +08:00
|
|
|
|
// legend: {
|
|
|
|
|
|
// data: [ 'Direct', 'Marketing', 'Search Engine', 'Email', 'Union Ads', 'Video Ads', 'Baidu', 'Google', 'Bing', 'Others' ]
|
|
|
|
|
|
// },
|
2024-06-12 22:11:48 +08:00
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
grid:{
|
2024-06-13 21:57:10 +08:00
|
|
|
|
left: '5%',
|
|
|
|
|
|
right: '5%',
|
|
|
|
|
|
bottom: '5%',
|
|
|
|
|
|
containLabel:true
|
2024-06-12 22:11:48 +08:00
|
|
|
|
},
|
2024-06-19 20:21:25 +08:00
|
|
|
|
name: 'innerPie',
|
2024-06-13 21:57:10 +08:00
|
|
|
|
type: 'pie',
|
|
|
|
|
|
selectedMode: 'single',
|
|
|
|
|
|
radius: [0, '30%'],
|
|
|
|
|
|
label: {
|
|
|
|
|
|
position: 'inner',
|
|
|
|
|
|
fontSize: 14
|
2024-06-12 22:11:48 +08:00
|
|
|
|
},
|
2024-06-13 21:57:10 +08:00
|
|
|
|
labelLine: {
|
|
|
|
|
|
show: false
|
2024-06-12 22:11:48 +08:00
|
|
|
|
},
|
2024-06-19 20:21:25 +08:00
|
|
|
|
data: innerPie.value
|
2024-06-12 22:11:48 +08:00
|
|
|
|
},
|
2024-06-13 21:57:10 +08:00
|
|
|
|
{
|
2024-06-19 20:21:25 +08:00
|
|
|
|
name: 'pieCircle',
|
2024-06-13 21:57:10 +08:00
|
|
|
|
type: 'pie',
|
|
|
|
|
|
radius: ['45%', '60%'],
|
|
|
|
|
|
labelLine: {
|
|
|
|
|
|
length: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
label: {
|
|
|
|
|
|
// formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ',
|
|
|
|
|
|
formatter: function(params: any){
|
2024-06-19 20:21:25 +08:00
|
|
|
|
let done = '已完成:'+ outPie.value[params.dataIndex].complete + ' '
|
|
|
|
|
|
return '{name|'+ outPie.value[params.dataIndex].name +'}{abg|} {per|'+ outPie.value[params.dataIndex].ratio +'%}\n{hr|}\n{done|'+ done
|
|
|
|
|
|
+'} 进行中:' + outPie.value[params.dataIndex].running
|
2024-06-13 21:57:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
// backgroundColor: '#1c447b',
|
|
|
|
|
|
backgroundColor: 'rgba(28,68,123,0.5)',
|
|
|
|
|
|
borderRadius: 3,
|
|
|
|
|
|
textStyle:{
|
|
|
|
|
|
color: '#FFF'
|
|
|
|
|
|
},
|
|
|
|
|
|
rich: {
|
|
|
|
|
|
name:{
|
2024-06-15 20:31:54 +08:00
|
|
|
|
color: '#fff',
|
2024-06-13 21:57:10 +08:00
|
|
|
|
align: 'center',
|
2024-06-15 20:31:54 +08:00
|
|
|
|
lineHeight: 20
|
|
|
|
|
|
},
|
|
|
|
|
|
done:{
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
lineHeight: 20
|
2024-06-13 21:57:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
hr: {
|
|
|
|
|
|
borderColor: '#8C8D8E',
|
|
|
|
|
|
width: '100%',
|
|
|
|
|
|
borderWidth: 1,
|
|
|
|
|
|
height: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
per: {
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
backgroundColor: '#4C5058',
|
|
|
|
|
|
padding: [1, 1],
|
|
|
|
|
|
borderRadius: 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-06-19 20:21:25 +08:00
|
|
|
|
data: outPie.value
|
2024-06-12 22:11:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
option && myChart.setOption(option);
|
|
|
|
|
|
}
|
2024-06-19 20:21:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//测试方法,对接口时改成相应的方法注释
|
|
|
|
|
|
const leftBottomMethod = async () => {
|
|
|
|
|
|
console.log("leftBottomMethod")
|
2024-06-15 09:46:11 +08:00
|
|
|
|
}
|
2024-06-19 20:21:25 +08:00
|
|
|
|
//将方法暴露给父组件
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
leftBottomMethod
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2024-06-15 09:46:11 +08:00
|
|
|
|
onMounted( async () => {
|
2024-06-19 20:21:25 +08:00
|
|
|
|
getSpecialInfo()
|
2024-06-12 22:11:48 +08:00
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.leftBottom {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
.mainContainer{
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
::v-deep .h-card .content {
|
|
|
|
|
|
height: 80%;
|
|
|
|
|
|
}
|
2024-06-15 09:46:11 +08:00
|
|
|
|
.not-data {
|
|
|
|
|
|
top: 40%;
|
|
|
|
|
|
width: 30%;
|
|
|
|
|
|
left: 35%;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
img {
|
|
|
|
|
|
width: 50%;
|
|
|
|
|
|
}
|
|
|
|
|
|
p {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-06-12 22:11:48 +08:00
|
|
|
|
</style>
|