update code

dev-login
haha 2023-08-12 14:54:19 +08:00
parent edff6eef7b
commit 1fe3b97466
2 changed files with 59 additions and 22 deletions

View File

@ -1,7 +1,7 @@
import Vue from 'vue'
Vue.component("project-overview-chart", {
template: `
<div style="position: relative" @click="doClick">
<div class='project-overview-chart' style="position: relative" @click="doClick">
<div :style="{'height': height+'px'}" ref="warningPieChart">
</div>

View File

@ -32,13 +32,13 @@
<rank-chart :data="availabilityData" :showval="true" :height="300" :width="projectCategoryWidth"></rank-chart>
</module-one-2-1>
<module-one-1-1 label="安全/质量管理">
<div class="warning-info-title" style="padding-left: 20px;">
<div :class="qualityNav == 0 ? 'active' : ''" @click="qualityNav = 0">安全管</div>
<div :class="qualityNav == 1 ? 'active' : ''" @click="qualityNav = 1">质量管</div>
<module-one-1-1 label="安全/质量管理" >
<div class="warning-info-title" style="padding-left: 20px;" >
<div :class="qualityNav == 0 ? 'active' : ''" @click="qualityNavClick(0)"></div>
<div :class="qualityNav == 1 ? 'active' : ''" @click="qualityNavClick(1)"></div>
</div>
<project-overview-chart :sp="'\n'" maintitle="205" :legend-opt="legendOpt2"
:typedata="dangersDatas" text="隐患总数" :height="230"></project-overview-chart>
<project-overview-chart :sp="'\n'" :maintitle="qualityNavTotal" :legend-opt="legendOpt2" :key="elKey"
:typedata="dangersDatas" :text="qualityNavTitle" :height="220" style="top:0px"></project-overview-chart>
</module-one-1-1>
</el-col>
<el-col :span="12">
@ -268,19 +268,23 @@ export default {
},
},
},
legendOpt2: {
legendOpt2: {
icon: "rect",
orient: "horizontal",
left:'50%',
top:'top',
itemGap:0,
textStyle: {
fontSize: 14,
rich: {
name: {
color: "#c3dbfd",
padding: [10, 5, 20, 5],
padding: [5, 2, 20, 2],
},
percent: {
color: "#4676FD",
fontSize: 16,
padding: [0, 5, 0, 5],
padding: [0, 2, 0, 2],
},
},
}
@ -291,19 +295,9 @@ export default {
{ text: '西安市地铁2号线二期工程施工总承包项目2标段', id: 2, type: 2 },
{ text: '苏州桑田岛项目', id: 3, type: 2 },
],
dangersDatas: [
{ name: '四口,临边防护工程', value: '0' },
{ name: '混泥土', value: '0' },
{ name: '移动脚手架', value: '0' },
{ name: '砌体', value: '0' },
{ name: '模板支架', value: '0' },
{ name: '外墙', value: '0' }
],
dangersDatas: [],
//
availabilityData: [
],
availabilityData: [],
overviewText: '项目数量',
overviewTotal: 100,
//
@ -314,6 +308,8 @@ export default {
],
//
qualityNav: 0,
qualityNavTitle:'',
qualityNavTotal:0,
//
infoNav: 0,
staffText: '在岗人员',
@ -494,9 +490,50 @@ export default {
this.$bus.$on("deptChange",dept=>{
this.deptInfo=dept;
this.onClickoOverview(0)
this.qualityNavClick(0);
});
},
methods: {
qualityNavClick(n){
this.qualityNav=n;
if(n==0){
this.qualityNavTitle="安全隐患总数";
this.$api.problemmodify.safetySummary(this.deptInfo.id,0).then(d=>{
this.dangersDatas=(d||[]).map(it=>{
return {
text:it.problemArea,
prop:'0.0',
name:it.problemArea,
value:+it.roleType||0
}
});
let sum=0;
this.dangersDatas.forEach(it=>{
sum+=it.value*1;
})
this.qualityNavTotal=sum;
this.elKey++;
})
}else{
this.qualityNavTitle="质量隐患总数";
this.$api.problemmodify.qualitySummary(this.deptInfo.id,0).then(d=>{
this.dangersDatas=(d||[]).map(it=>{
return {
text:it.problemArea,
prop:'0.0',
name:it.problemArea,
value:+it.roleType||0
}
});
let sum=0;
this.dangersDatas.forEach(it=>{
sum+=it.value*1;
})
this.qualityNavTotal=sum;
this.elKey++;
})
}
},
numberWithCommas(x) {
x = x.toString();
var pattern = /(-?\d+)(\d{3})/;