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{
findProjectByDept,
getProjectBuildNode,
getProgressProjects
const groupByProjectCategory=(cb)=>{
request({
url:`bgscreen/project/groupByProjectCategory`,
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: {
text: this.maintitle||total_datas,
subtext: this.text,
x: "85",
y: "89",
textAlign:'center',
top:'top',
itemGap :10,
textStyle: {
color: "#0dd2fd",
fontSize: 24,
fontWeight: "bold",
align: "center",
width: "200px",
},
subtextStyle: {
color: "#a5b5f0",
fontSize: 12,
align: "center",
},
padding:[95,0,0,110],
left:'left'
},
tooltip: {
trigger: 'item',

View File

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

View File

@ -8,7 +8,7 @@
<div class="screen-content">
<el-row>
<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;"
@click="doShowDlg1">
<div class="survey_title">
@ -29,7 +29,7 @@
:maintitle="overviewTotal" :legend-opt="legendOpt1" :typedata="typeDistributionData"
: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-1-1 label="安全/质量管理">
@ -75,13 +75,13 @@
<el-col :span="12" style="position: relative;">
<module-one-1-1 label="项目进度汇总">
<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="prjProcessNav == 0 ? 'active' : ''" @click="doPrjProcess(0, '在建项目')">在建项目
<div :class="prjProcessNav == 0 ? 'active' : ''" @click="doPrjProcess(0, '在建项目')">在建项目({{ getPrjCateCount(0) }})
</div>
<div :class="prjProcessNav == 1 ? 'active' : ''" @click="doPrjProcess(1, '拟建项目')">拟建项目
<div :class="prjProcessNav == 1 ? 'active' : ''" @click="doPrjProcess(1, '拟建项目')">拟建项目({{ getPrjCateCount(1) }})
</div>
<div :class="prjProcessNav == 2 ? 'active' : ''" @click="doPrjProcess(2, '验收项目')">前期项目
<div :class="prjProcessNav == 2 ? 'active' : ''" @click="doPrjProcess(2, '验收项目')">前期项目({{ getPrjCateCount(2) }})
</div>
</div>
<el-row>
@ -302,10 +302,7 @@ export default {
//
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: '项目数量',
overviewTotal: 100,
@ -476,6 +473,9 @@ export default {
],
warningTypeInterval: undefined,
warningTypeIndex: 0,
projectCategory:[],
projectCategoryWidth:200,
deptInfo:{},
}
},
created() {
@ -491,6 +491,10 @@ export default {
this.investmentAmountData2[0].value = "" + res.onAccountAmount * 1.0;
this.elKey++;
});
this.$bus.$on("deptChange",dept=>{
this.deptInfo=dept;
this.onClickoOverview(0)
});
},
methods: {
numberWithCommas(x) {
@ -509,14 +513,36 @@ export default {
doShowDlg2() {
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() {
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.chartMap()
//
this.overviewInterval = setInterval(this.overviewClick, 5000);
//this.overviewInterval = setInterval(this.overviewClick, 5000);
//
this.majorInterval = setInterval(this.timer, 5000);
//
@ -527,29 +553,11 @@ export default {
doPrjProcess(n, text) {
this.prjProcessNav = n;
this.prjPrcessText = text;
if (n == 0) {
this.prjPrcessTotal = 100;
this.prjPrcessData = [
{ text: "正常推进项目", value: 13 },
{ text: "进度滞后项目", value: 22 },
]
}
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 },
]
}
this.prjPrcessTotal=this.getPrjCateCount(n);
let item=this.projectCategory.length>n?this.projectCategory[n]: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++;
},
//
onWarningInfoNav(n, text) {
@ -591,19 +599,67 @@ export default {
//
onClickoOverview(n) {
this.overview = n
if (this.overview == 0) {
this.overviewTotal = 65;
this.projectCategoryWidth=290;
this.overviewText = "项目数";
this.surveyUrlSb = 'images/survey_icon_1.png'
} else if (this.overview == 1) {
this.overviewTotal = 515.97;
this.projectCategoryWidth=210;
this.overviewText = "项目总投资";
this.surveyUrlSb = 'images/survey_icon_2.png'
} else {
this.overviewTotal = 134.86;
this.projectCategoryWidth=210;
this.overviewText = "项目年投资";
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() {

View File

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