update code

dev-login
haha 2023-08-12 14:16:43 +08:00
parent 7a66d7f171
commit edff6eef7b
5 changed files with 205 additions and 76 deletions

View File

@ -20,10 +20,70 @@ const getProgressProjects=()=>{
}) })
}; };
export default{ const groupByProjectCategory=(cb)=>{
findProjectByDept, request({
getProjectBuildNode, url:`bgscreen/project/groupByProjectCategory`,
getProgressProjects method: 'get'
}).then(res=>{
let objs=(res.data||[]).map(it=>{
return {
id:it.deptName,
label:it.projectName,
schedule:it.projectSchedule,
cnt:it.deptId
}
});
const getItems=(id,schedule)=>{
let tmps=objs.filter(d=>d.id==id && d.schedule==schedule);
if(tmps.length>0){
return tmps[0];
}
return {
id:id,schedule:schedule,cnt:0
}
}
let ret1= [getItems(1,1),getItems(1,2)];
let ret2= [getItems(2,1),getItems(2,2)];
let ret3= [getItems(3,1),getItems(3,2)];
let rets= [
ret1,ret2,ret3
];
if(cb){
cb(rets);
}
});
};
const groupByCategory=(deptId,type)=>{
return request({
url: `bgscreen/project/groupByCategory`,
method: 'post',
data:{
deptId:deptId,
id:type
}
})
}
const groupByLevel=(deptId,type)=>{
return request({
url: `bgscreen/project/groupByLevel`,
method: 'post',
data:{
deptId:deptId,
id:type
}
})
}
export default{
findProjectByDept,
getProjectBuildNode,
getProgressProjects,
groupByProjectCategory,
groupByCategory,
groupByLevel
} }

View File

@ -124,20 +124,23 @@ Vue.component("project-overview-chart", {
title: { title: {
text: this.maintitle||total_datas, text: this.maintitle||total_datas,
subtext: this.text, subtext: this.text,
x: "85", textAlign:'center',
y: "89", top:'top',
itemGap :10,
textStyle: { textStyle: {
color: "#0dd2fd", color: "#0dd2fd",
fontSize: 24, fontSize: 24,
fontWeight: "bold", fontWeight: "bold",
align: "center", align: "center",
width: "200px",
}, },
subtextStyle: { subtextStyle: {
color: "#a5b5f0", color: "#a5b5f0",
fontSize: 12, fontSize: 12,
align: "center", align: "center",
}, },
padding:[95,0,0,110],
left:'left'
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',

View File

@ -10,6 +10,9 @@ Vue.component("rank-chart", {
height:{ height:{
type:Number type:Number
}, },
width:{
type:Number
},
showval:{ showval:{
type:Boolean, type:Boolean,
default:false default:false
@ -119,7 +122,7 @@ Vue.component("rank-chart", {
fontSize:'14', fontSize:'14',
}, },
name: { name: {
width: this.showval?280:300, width: this.width?this.width:this.showval?280:300,
color: '#c6d9fa', color: '#c6d9fa',
padding:[0,0,0,10], padding:[0,0,0,10],
fontSize:'16', fontSize:'16',

View File

@ -8,7 +8,7 @@
<div class="screen-content"> <div class="screen-content">
<el-row> <el-row>
<el-col :span="6" style="position: relative;"> <el-col :span="6" style="position: relative;">
<module-one-2-1 label="集团项目总览"> <module-one-2-1 label="集团项目总览" :key="elKey">
<img src="images/icon2001.png" style="position: absolute;cursor: pointer;right: 0px;top: 8px;" <img src="images/icon2001.png" style="position: absolute;cursor: pointer;right: 0px;top: 8px;"
@click="doShowDlg1"> @click="doShowDlg1">
<div class="survey_title"> <div class="survey_title">
@ -29,7 +29,7 @@
:maintitle="overviewTotal" :legend-opt="legendOpt1" :typedata="typeDistributionData" :maintitle="overviewTotal" :legend-opt="legendOpt1" :typedata="typeDistributionData"
:text="overviewText" :height="230"></project-overview-chart> :text="overviewText" :height="230"></project-overview-chart>
<rank-chart :data="availabilityData" :showval="true" :height="240"></rank-chart> <rank-chart :data="availabilityData" :showval="true" :height="300" :width="projectCategoryWidth"></rank-chart>
</module-one-2-1> </module-one-2-1>
<module-one-1-1 label="安全/质量管理"> <module-one-1-1 label="安全/质量管理">
@ -75,13 +75,13 @@
<el-col :span="12" style="position: relative;"> <el-col :span="12" style="position: relative;">
<module-one-1-1 label="项目进度汇总"> <module-one-1-1 label="项目进度汇总">
<img src="images/icon2001.png" <img src="images/icon2001.png"
style="position: absolute;cursor: pointer;right: 0px;top: 8px;" @click="doShowDlg2"> style="position: absolute;cursor: pointer;right: 13px;top: 12px;" @click="doShowDlg2">
<div class="warning-info-title" style="padding-left: 20px;"> <div class="warning-info-title" style="padding-left: 20px;">
<div :class="prjProcessNav == 0 ? 'active' : ''" @click="doPrjProcess(0, '在建项目')">在建项目 <div :class="prjProcessNav == 0 ? 'active' : ''" @click="doPrjProcess(0, '在建项目')">在建项目({{ getPrjCateCount(0) }})
</div> </div>
<div :class="prjProcessNav == 1 ? 'active' : ''" @click="doPrjProcess(1, '拟建项目')">拟建项目 <div :class="prjProcessNav == 1 ? 'active' : ''" @click="doPrjProcess(1, '拟建项目')">拟建项目({{ getPrjCateCount(1) }})
</div> </div>
<div :class="prjProcessNav == 2 ? 'active' : ''" @click="doPrjProcess(2, '验收项目')">前期项目 <div :class="prjProcessNav == 2 ? 'active' : ''" @click="doPrjProcess(2, '验收项目')">前期项目({{ getPrjCateCount(2) }})
</div> </div>
</div> </div>
<el-row> <el-row>
@ -302,10 +302,7 @@ export default {
// //
availabilityData: [ availabilityData: [
{ value: 7, prop: 42.9, text: '新区级' },
{ value: 9, prop: 22.9, text: '省级' },
{ value: 10, prop: 20, text: '市级' },
{ value: 39, prop: 14.2, text: '新城级' },
], ],
overviewText: '项目数量', overviewText: '项目数量',
overviewTotal: 100, overviewTotal: 100,
@ -476,6 +473,9 @@ export default {
], ],
warningTypeInterval: undefined, warningTypeInterval: undefined,
warningTypeIndex: 0, warningTypeIndex: 0,
projectCategory:[],
projectCategoryWidth:200,
deptInfo:{},
} }
}, },
created() { created() {
@ -491,6 +491,10 @@ export default {
this.investmentAmountData2[0].value = "" + res.onAccountAmount * 1.0; this.investmentAmountData2[0].value = "" + res.onAccountAmount * 1.0;
this.elKey++; this.elKey++;
}); });
this.$bus.$on("deptChange",dept=>{
this.deptInfo=dept;
this.onClickoOverview(0)
});
}, },
methods: { methods: {
numberWithCommas(x) { numberWithCommas(x) {
@ -509,14 +513,36 @@ export default {
doShowDlg2() { doShowDlg2() {
this.$refs.dlg2.showDialog(this.prjProcessNav) this.$refs.dlg2.showDialog(this.prjProcessNav)
}, },
getPrjCateCount(n){
if(this.projectCategory.length<n+1){
return 0;
}
let tmps=this.projectCategory[n];
if(tmps && tmps.length>0){
let sum=0;
tmps.forEach(d=>{
sum+=d.cnt;
})
return sum;
}
return 0;
},
init() { init() {
this.$api.project.groupByProjectCategory(datas=>{
this.projectCategory=datas;
this.prjPrcessTotal=this.getPrjCateCount(0);
let item=this.projectCategory.length>0?this.projectCategory[0]:null;
this.prjPrcessData[0].value=item && item.length>0?item[0].cnt:0;
this.prjPrcessData[1].value=item && item.length>1?item[1].cnt:0;
this.elKey++;
});
this.localStorage = JSON.parse(localStorage.getItem("data1")) this.localStorage = JSON.parse(localStorage.getItem("data1"))
// //
this.chartMap() this.chartMap()
// //
this.overviewInterval = setInterval(this.overviewClick, 5000); //this.overviewInterval = setInterval(this.overviewClick, 5000);
// //
this.majorInterval = setInterval(this.timer, 5000); this.majorInterval = setInterval(this.timer, 5000);
// //
@ -527,29 +553,11 @@ export default {
doPrjProcess(n, text) { doPrjProcess(n, text) {
this.prjProcessNav = n; this.prjProcessNav = n;
this.prjPrcessText = text; this.prjPrcessText = text;
if (n == 0) { this.prjPrcessTotal=this.getPrjCateCount(n);
this.prjPrcessTotal = 100; let item=this.projectCategory.length>n?this.projectCategory[n]:null;
this.prjPrcessData = [ this.prjPrcessData[0].value=item && item.length>0?item[0].cnt:0;
{ text: "正常推进项目", value: 13 }, this.prjPrcessData[1].value=item && item.length>1?item[1].cnt:0;
{ text: "进度滞后项目", value: 22 }, this.elKey++;
]
}
if (n == 1) {
this.prjPrcessTotal = 90;
this.prjPrcessData = [
{ text: "规划中项目", value: 4 },
{ text: "审批中项目", value: 9 },
{ text: "设计中项目", value: 8 },
]
}
if (n == 2) {
this.prjPrcessTotal = 130;
this.prjPrcessData = [
{ text: "进度滞后项目", value: 0 },
{ text: "正常推进项目", value: 0 },
]
}
}, },
// //
onWarningInfoNav(n, text) { onWarningInfoNav(n, text) {
@ -591,19 +599,67 @@ export default {
// //
onClickoOverview(n) { onClickoOverview(n) {
this.overview = n this.overview = n
if (this.overview == 0) { if (this.overview == 0) {
this.overviewTotal = 65; this.projectCategoryWidth=290;
this.overviewText = "项目数"; this.overviewText = "项目数";
this.surveyUrlSb = 'images/survey_icon_1.png' this.surveyUrlSb = 'images/survey_icon_1.png'
} else if (this.overview == 1) { } else if (this.overview == 1) {
this.overviewTotal = 515.97; this.projectCategoryWidth=210;
this.overviewText = "项目总投资"; this.overviewText = "项目总投资";
this.surveyUrlSb = 'images/survey_icon_2.png' this.surveyUrlSb = 'images/survey_icon_2.png'
} else { } else {
this.overviewTotal = 134.86; this.projectCategoryWidth=210;
this.overviewText = "项目年投资"; this.overviewText = "项目年投资";
this.surveyUrlSb = 'images/survey_icon_3.png' this.surveyUrlSb = 'images/survey_icon_3.png'
} }
this.$api.project.groupByCategory(this.deptInfo.id,n).then(d=>{
let tmps=(d.data||[]).map(it=>{
return {
id:it.id,
name:it.projectName,
value:it.deptId/10000.0
}
});
let sum=0;
tmps.forEach(it=>{
sum+=it.value;
})
this.overviewTotal=sum;
this.typeDistributionData=tmps;
this.elKey++;
})
this.$api.project.groupByLevel(this.deptInfo.id,n).then(d=>{
let tmps=(d.data||[]).map(it=>{
return {
id:it.id,
text:it.projectName,
value:it.deptId/10000.0,
prop:0,
}
});
let sum=0;
tmps.forEach(it=>{
sum+=it.value;
})
let total=0;
tmps.forEach((it,idx)=>{
it.prop=sum==0?0:(it.value*100.0/sum).toFixed(1)
if(idx<tmps.length-1){
total+=it.prop*1;
}else{
if(sum>0){
it.prop=(100-total).toFixed(1);
}
}
})
this.availabilityData=tmps;
this.elKey++;
})
}, },
// //
chartMap() { chartMap() {

View File

@ -83,12 +83,12 @@
<el-row> <el-row>
<el-col :span="12" > <el-col :span="12" >
<module-one-1-2 label="项目推进明细"> <module-one-1-2 label="项目推进明细">
<el-row style="padding: 20px;"> <el-row style="padding: 20px;" :key="elKey">
<el-col :span="12"> <el-col :span="12">
<div class="warning-info-title my-warning-info-title"> <div class="warning-info-title my-warning-info-title">
<div :class="pushNav==0?'active':''" @click="doPushNav(0,'在建项目')">(100)</div> <div :class="pushNav==0?'active':''" @click="doPushNav(0,'在建项目')">({{ getPrjCateCount(0) }})</div>
<div :class="pushNav==1?'active':''" @click="doPushNav(1,'拟建项目')">(20)</div> <div :class="pushNav==1?'active':''" @click="doPushNav(1,'拟建项目')">({{ getPrjCateCount(1) }})</div>
<div :class="pushNav==2?'active':''" @click="doPushNav(2,'验收项目')">(10)</div> <div :class="pushNav==2?'active':''" @click="doPushNav(2,'前期项目')">({{ getPrjCateCount(2) }})</div>
</div> </div>
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
@ -268,6 +268,7 @@ export default {
}, },
data() { data() {
return { return {
elKey:0,
// //
completionData:[ completionData:[
{name:"泾河新城荟锦坊二期",cnt:50,step:'施工阶段'}, {name:"泾河新城荟锦坊二期",cnt:50,step:'施工阶段'},
@ -282,8 +283,8 @@ export default {
pushText:'在建项目', pushText:'在建项目',
pushCount:35, pushCount:35,
pushData:[ pushData:[
{ text:"正常推进项目", value:13 }, { text:"正常推进项目", value:0 },
{ text:"进度滞后项目", value:22 }, { text:"进度滞后项目", value:1 },
], ],
costIndex:0, costIndex:0,
direction:'right', direction:'right',
@ -328,13 +329,13 @@ export default {
prjInfo:{}, prjInfo:{},
scheduleInfo:null, scheduleInfo:null,
projects:[], projects:[],
projectCategory:[]
} }
}, },
created() { created() {
this.init() this.init()
}, },
mounted() { mounted() {
this.$bus.$on("projectChange",res=>{ this.$bus.$on("projectChange",res=>{
this.loadProjectConstructionProgress(); this.loadProjectConstructionProgress();
}); });
@ -396,26 +397,12 @@ export default {
doPushNav(n,t){ doPushNav(n,t){
this.pushNav=n; this.pushNav=n;
this.pushText=t; this.pushText=t;
this.pushCount=[35,21,0][n];
this.pushUrl=['images/company_6.png','images/company_5.png','images/company_4.png'][n] this.pushUrl=['images/company_6.png','images/company_5.png','images/company_4.png'][n]
if(n==0){ this.pushCount=this.getPrjCateCount(n);
this.pushData=[ let item=this.projectCategory.length>n?this.projectCategory[n]:null;
{ text:"正常推进项目", value:13 }, this.pushData[0].value=item && item.length>0?item[0].cnt:0;
{ text:"进度滞后项目", value:22 } this.pushData[1].value=item && item.length>1?item[1].cnt:0;
] this.elKey++;
}
if(n==1){
this.pushData=[
{ text:"正常推进项目", value:4 },
{ text:"进度滞后项目", value:17 }
]
}
if(n==2){
this.pushData=[
{ text:"正常推进项目", value:0 },
{ text:"进度滞后项目", value:0 }
]
}
}, },
modifyLeftBtn(){ modifyLeftBtn(){
this.direction = 'left' this.direction = 'left'
@ -484,7 +471,20 @@ export default {
planMouseout(){ planMouseout(){
this.planInterval=setInterval(this.manufacturingPlanRoll,5000); this.planInterval=setInterval(this.manufacturingPlanRoll,5000);
}, },
getPrjCateCount(n){
if(this.projectCategory.length<n+1){
return 0;
}
let tmps=this.projectCategory[n];
if(tmps && tmps.length>0){
let sum=0;
tmps.forEach(d=>{
sum+=d.cnt;
})
return sum;
}
return 0;
},
init(){ init(){
if(localStorage.length == 0){ if(localStorage.length == 0){
var company = {text:'城投公司',id:1,type:1} var company = {text:'城投公司',id:1,type:1}
@ -498,7 +498,14 @@ export default {
this.localStorage1 = JSON.parse(localStorage.getItem("company")) this.localStorage1 = JSON.parse(localStorage.getItem("company"))
this.localStorage2 = JSON.parse(localStorage.getItem("project")) this.localStorage2 = JSON.parse(localStorage.getItem("project"))
} }
this.$api.project.groupByProjectCategory(datas=>{
this.projectCategory=datas;
this.pushCount=this.getPrjCateCount(0);
let item=this.projectCategory.length>0?this.projectCategory[0]:null;
this.pushData[0].value=item && item.length>0?item[0].cnt:0;
this.pushData[1].value=item && item.length>1?item[1].cnt:0;
this.elKey++;
});
// //
this.overviewInterval = setInterval(this.overviewClick,5000); this.overviewInterval = setInterval(this.overviewClick,5000);
// //