|
@@ -4,8 +4,8 @@
|
|
<el-col :span="6" >
|
|
<el-col :span="6" >
|
|
<div ><span style="color:#999;">图表Y轴: </span>
|
|
<div ><span style="color:#999;">图表Y轴: </span>
|
|
<el-radio-group v-model="yAxisValue" @change="onYAxisChange">
|
|
<el-radio-group v-model="yAxisValue" @change="onYAxisChange">
|
|
- <el-radio-button label="0">显示成本</el-radio-button>
|
|
|
|
- <el-radio-button label="1">显示工时</el-radio-button>
|
|
|
|
|
|
+ <el-radio-button label="0" v-if="permissions.countAllCost || permissions.countResCost">显示成本</el-radio-button>
|
|
|
|
+ <el-radio-button label="1" v-if="permissions.countAllWorkTime || permissions.countResWorkTime">显示工时</el-radio-button>
|
|
</el-radio-group></div>
|
|
</el-radio-group></div>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="14" style="display: flex;flex-wrap: wrap;">
|
|
<el-col :span="14" style="display: flex;flex-wrap: wrap;">
|
|
@@ -149,6 +149,7 @@
|
|
exportDialog:false,
|
|
exportDialog:false,
|
|
dateRange:[],
|
|
dateRange:[],
|
|
user: JSON.parse(sessionStorage.getItem("user")),
|
|
user: JSON.parse(sessionStorage.getItem("user")),
|
|
|
|
+ permissions: JSON.parse(sessionStorage.getItem("permissions")),
|
|
radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
|
|
radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
|
|
containerHeight: 0,
|
|
containerHeight: 0,
|
|
myChart: null,
|
|
myChart: null,
|
|
@@ -548,12 +549,18 @@
|
|
if(project.length != 0) {
|
|
if(project.length != 0) {
|
|
for(var k in project) {
|
|
for(var k in project) {
|
|
if(project[k].project == array[i]) {
|
|
if(project[k].project == array[i]) {
|
|
- dataList.push({
|
|
|
|
|
|
+ let item = {
|
|
"value": this.yAxisValue==0?project[k].money:project[k].time,
|
|
"value": this.yAxisValue==0?project[k].money:project[k].time,
|
|
- "cost": project[k].time,
|
|
|
|
- "money":project[k].money
|
|
|
|
- })
|
|
|
|
- totalHours += parseFloat(project[k].time);
|
|
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllCost || this.permissions.countResCost){
|
|
|
|
+ item.money = project[k].money
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllWorkTime || this.permissions.countResWorkTime){
|
|
|
|
+ item.cost = project[k].time
|
|
|
|
+ totalHours += parseFloat(project[k].time);
|
|
|
|
+ }
|
|
|
|
+ dataList.push(item)
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
num++;
|
|
num++;
|
|
}
|
|
}
|
|
@@ -595,7 +602,10 @@
|
|
var option = {
|
|
var option = {
|
|
//总成本
|
|
//总成本
|
|
title: {
|
|
title: {
|
|
- text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元, 时长'+totalHours+'小时',
|
|
|
|
|
|
+ // text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元, 时长'+totalHours+'小时',
|
|
|
|
+ text: '工时成本总计:' +
|
|
|
|
+ ((this.permissions.countAllCost || this.permissions.countResCost) ? '成本' + totalMoneyCost.toFixed(2) + '元,' : '') +
|
|
|
|
+ ((this.permissions.countAllWorkTime || this.permissions.countResWorkTime) ? '时长' + totalHours + '小时' : ''),
|
|
left:'left',
|
|
left:'left',
|
|
},
|
|
},
|
|
// 工具箱
|
|
// 工具箱
|
|
@@ -642,13 +652,17 @@
|
|
for(var i in params) {
|
|
for(var i in params) {
|
|
if (params[i].data.value > 0) {
|
|
if (params[i].data.value > 0) {
|
|
res += "<div style='margin-top:3px;font-size:12px;'><font color='#ddd'>项目名称:" + params[i].seriesName
|
|
res += "<div style='margin-top:3px;font-size:12px;'><font color='#ddd'>项目名称:" + params[i].seriesName
|
|
- + "</font><br/>工作成本 : " + params[i].data.money
|
|
|
|
- + "元 <br/>工作时长"+" : " + params[i].data.cost + "小时</br></div>";
|
|
|
|
|
|
+ + "</font><br/>" +
|
|
|
|
+ ((_this.permissions.countAllCost || _this.permissions.countResCost) ? "工作成本 : " + params[i].data.money + "元<br/>" : '') +
|
|
|
|
+ ((_this.permissions.countAllWorkTime || _this.permissions.countResWorkTime) ? "工作时长 : " + params[i].data.cost + "小时</br>" : '') + "</div>";
|
|
totalTime += Number(params[i].data.cost);
|
|
totalTime += Number(params[i].data.cost);
|
|
totalCost += Number(params[i].data.money);
|
|
totalCost += Number(params[i].data.money);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1)+'小时 '+totalCost.toFixed(2) + "元<br/>";
|
|
|
|
|
|
+ res = res +'<br/>'+ params[0].name+ '<br/>总计: ' +
|
|
|
|
+ ((_this.permissions.countAllWorkTime || _this.permissions.countResWorkTime) ? totalTime.toFixed(1) + '小时 ' : '') +
|
|
|
|
+ ((_this.permissions.countAllCost || _this.permissions.countResCost) ? totalCost.toFixed(2) + "元" : '') +
|
|
|
|
+ "<br/>";
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -679,9 +693,9 @@
|
|
that.jieliu()
|
|
that.jieliu()
|
|
// },100);
|
|
// },100);
|
|
// this.jieliu()
|
|
// this.jieliu()
|
|
- if(this.radio == '项目分类'){
|
|
|
|
- this.getCategoryList()
|
|
|
|
- }
|
|
|
|
|
|
+ // if(this.radio == '项目分类'){
|
|
|
|
+ // this.getCategoryList()
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
getCategoryList(){
|
|
getCategoryList(){
|
|
this.http.post('/project-category/list',{},
|
|
this.http.post('/project-category/list',{},
|
|
@@ -722,13 +736,14 @@
|
|
if (this.dateRange != null) {
|
|
if (this.dateRange != null) {
|
|
param = {startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange,
|
|
param = {startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange,
|
|
endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange};
|
|
endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange};
|
|
- console.log(param);
|
|
|
|
|
|
+ // console.log(param);
|
|
}
|
|
}
|
|
var url = '';
|
|
var url = '';
|
|
if (this.radio=='项目') {
|
|
if (this.radio=='项目') {
|
|
url = this.port.project.listCost;
|
|
url = this.port.project.listCost;
|
|
} else if (this.radio=='项目分类') {
|
|
} else if (this.radio=='项目分类') {
|
|
url = '/project/getTimeCostByCategory';
|
|
url = '/project/getTimeCostByCategory';
|
|
|
|
+
|
|
// param.parentDeptId = this.parentDeptId;
|
|
// param.parentDeptId = this.parentDeptId;
|
|
// param.userId = this.user.id
|
|
// param.userId = this.user.id
|
|
} else if (this.radio=='部门') {
|
|
} else if (this.radio=='部门') {
|
|
@@ -760,56 +775,81 @@
|
|
var totalHours = 0.0;
|
|
var totalHours = 0.0;
|
|
if(this.radio == '项目' || this.radio == '项目分类' || this.radio=='部门') {
|
|
if(this.radio == '项目' || this.radio == '项目分类' || this.radio=='部门') {
|
|
list = res.data.costList
|
|
list = res.data.costList
|
|
- totalMoneyCost = ((this.radio=='项目')?res.data.totalMoneyCost:res.data.totalCostMoney);
|
|
|
|
|
|
+ totalMoneyCost = ((this.radio=='项目' || this.radio == '项目分类')?res.data.totalMoneyCost:res.data.totalCostMoney);
|
|
|
|
+
|
|
for(var i in list) {
|
|
for(var i in list) {
|
|
if(this.radio=='项目') {
|
|
if(this.radio=='项目') {
|
|
xList.push(list[i].project);
|
|
xList.push(list[i].project);
|
|
- yList.push({
|
|
|
|
|
|
+ let item = {
|
|
"value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
|
|
"value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
|
|
"id": list[i].id || i,
|
|
"id": list[i].id || i,
|
|
- "cost": list[i].cost,
|
|
|
|
- "money":list[i].costMoney.toFixed(2)
|
|
|
|
- });
|
|
|
|
- totalHours += parseFloat(list[i].cost);
|
|
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllCost || this.permissions.countResCost){
|
|
|
|
+ item.money = list[i].costMoney.toFixed(2)
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllWorkTime || this.permissions.countResWorkTime){
|
|
|
|
+ item.cost = list[i].cost
|
|
|
|
+ totalHours += parseFloat(list[i].cost);
|
|
|
|
+ }
|
|
|
|
+ yList.push(item);
|
|
|
|
+
|
|
} else if(this.radio == '部门'){
|
|
} else if(this.radio == '部门'){
|
|
xList.push(list[i].departmentName);
|
|
xList.push(list[i].departmentName);
|
|
- yList.push({
|
|
|
|
- "value": this.yAxisValue==0? list[i].costMoney.toFixed(2) || list[i].costMoney: list[i].costTime.toFixed(1),
|
|
|
|
|
|
+ let item = {
|
|
|
|
+ "value": this.yAxisValue==0 ? list[i].costMoney.toFixed(2) || list[i].costMoney: list[i].costTime.toFixed(1),
|
|
"id": list[i].departmentId,
|
|
"id": list[i].departmentId,
|
|
- "cost": list[i].costTime,
|
|
|
|
- "hasSubDept": list[i].hasSubDept,
|
|
|
|
- "money":list[i].costMoney.toFixed(2)
|
|
|
|
- });
|
|
|
|
- totalHours += parseFloat(list[i].costTime);
|
|
|
|
|
|
+ "hasSubDept": list[i].hasSubDept
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllCost || this.permissions.countResCost){
|
|
|
|
+ item.money = list[i].costMoney.toFixed(2)
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllWorkTime || this.permissions.countResWorkTime){
|
|
|
|
+ item.cost = list[i].costTime
|
|
|
|
+ totalHours += parseFloat(list[i].costTime);
|
|
|
|
+ }
|
|
|
|
+ yList.push(item);
|
|
|
|
+
|
|
}else {
|
|
}else {
|
|
xList.push(list[i].categoryName);
|
|
xList.push(list[i].categoryName);
|
|
- yList.push({
|
|
|
|
|
|
+ let item = {
|
|
"value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
|
|
"value": this.yAxisValue==0?list[i].costMoney.toFixed(2) || list[i].costMoney:list[i].cost.toFixed(1),
|
|
"id": list[i].id || i,
|
|
"id": list[i].id || i,
|
|
- "cost": list[i].cost,
|
|
|
|
- "money":list[i].costMoney.toFixed(2)
|
|
|
|
- });
|
|
|
|
- totalHours += parseFloat(list[i].cost);
|
|
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllCost || this.permissions.countResCost){
|
|
|
|
+ item.money = list[i].costMoney.toFixed(2)
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllWorkTime || this.permissions.countResWorkTime){
|
|
|
|
+ item.cost = list[i].cost
|
|
|
|
+ totalHours += parseFloat(list[i].cost);
|
|
|
|
+ }
|
|
|
|
+ yList.push(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
list = res.data
|
|
list = res.data
|
|
- var totalMoneyCost = 0;
|
|
|
|
|
|
+
|
|
for(var i in list) {
|
|
for(var i in list) {
|
|
- console.log(list[i].name, list[i].costMoney, list[i].cost)
|
|
|
|
|
|
+ // console.log(list[i].name, list[i].costMoney, list[i].cost)
|
|
xList.push(list[i].name);
|
|
xList.push(list[i].name);
|
|
- yList.push({
|
|
|
|
|
|
+ let item = {
|
|
"value": this.yAxisValue==0?list[i].costMoney:list[i].cost,
|
|
"value": this.yAxisValue==0?list[i].costMoney:list[i].cost,
|
|
"id": list[i].id || i,
|
|
"id": list[i].id || i,
|
|
- "cost": list[i].cost,
|
|
|
|
- "money":list[i].costMoney.toFixed(2)
|
|
|
|
- });
|
|
|
|
- totalHours += parseFloat(list[i].cost);
|
|
|
|
- totalMoneyCost += parseFloat(list[i].costMoney);
|
|
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllCost || this.permissions.countResCost){
|
|
|
|
+ item.money = list[i].costMoney.toFixed(2)
|
|
|
|
+ totalMoneyCost += parseFloat(list[i].costMoney);
|
|
|
|
+ }
|
|
|
|
+ if(this.permissions.countAllWorkTime || this.permissions.countResWorkTime){
|
|
|
|
+ item.cost = list[i].cost
|
|
|
|
+ totalHours += parseFloat(list[i].cost);
|
|
|
|
+ }
|
|
|
|
+ yList.push(item);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
totalHours = totalHours.toFixed(1);
|
|
totalHours = totalHours.toFixed(1);
|
|
|
|
|
|
|
|
+
|
|
var myChart = echarts.init(document.getElementById("container"));
|
|
var myChart = echarts.init(document.getElementById("container"));
|
|
myChart.resize({
|
|
myChart.resize({
|
|
width: this.widthHtval
|
|
width: this.widthHtval
|
|
@@ -820,10 +860,11 @@
|
|
if(totalMoneyCost) {
|
|
if(totalMoneyCost) {
|
|
this.zhishin = totalMoneyCost.toFixed(2)
|
|
this.zhishin = totalMoneyCost.toFixed(2)
|
|
}
|
|
}
|
|
- if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
|
|
|
|
|
|
+
|
|
|
|
+ if(this.radio == '项目' || this.radio == '人员' || this.radio == '项目分类' || this.radio=='部门') {
|
|
var option = {
|
|
var option = {
|
|
title: {
|
|
title: {
|
|
- text: '工时成本总计' + this.zhishin + '元, 时长'+totalHours+'小时',
|
|
|
|
|
|
+ text: '工时成本总计:' + ((this.permissions.countAllCost || this.permissions.countResCost) ? '成本' + this.zhishin + '元,' : '') + ((this.permissions.countAllWorkTime || this.permissions.countResWorkTime) ? '时长' + totalHours + '小时' : ''),
|
|
left:'left',
|
|
left:'left',
|
|
},
|
|
},
|
|
// 工具箱
|
|
// 工具箱
|
|
@@ -836,9 +877,13 @@
|
|
tooltip:{
|
|
tooltip:{
|
|
trigger:'axis',
|
|
trigger:'axis',
|
|
formatter: function (params,ticket,callback) {
|
|
formatter: function (params,ticket,callback) {
|
|
- var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.money
|
|
|
|
- + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
|
|
|
|
- _this.params = params;
|
|
|
|
|
|
+ // var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.money
|
|
|
|
+ // + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
|
|
|
|
+ // _this.params = params;
|
|
|
|
+ var res = params[0].name + "<br/>" +
|
|
|
|
+ ((_this.permissions.countAllCost || _this.permissions.countResCost) ? "工作成本"+" : " + params[0].data.money
|
|
|
|
+ + "元 <br/>" : '') +
|
|
|
|
+ ((_this.permissions.countAllWorkTime || _this.permissions.countResWorkTime) ? "工作时长"+" : " + params[0].data.cost + "小时" : '');
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -864,7 +909,8 @@
|
|
} else {
|
|
} else {
|
|
var option = {
|
|
var option = {
|
|
title: {
|
|
title: {
|
|
- text: '工时成本总计' + this.zhishin + '元, 时长'+totalHours+'小时',
|
|
|
|
|
|
+ // text: '工时成本总计' + this.zhishin + '元, 时长'+totalHours+'小时',
|
|
|
|
+ text: '工时成本总计:' + ((this.permissions.countAllCost || this.permissions.countResCost) ? '成本' + this.zhishin + '元,' : '') + ((this.permissions.countAllWorkTime || this.permissions.countResWorkTime) ? '时长' + totalHours + '小时' : ''),
|
|
left:'left',
|
|
left:'left',
|
|
},
|
|
},
|
|
// 工具箱
|
|
// 工具箱
|
|
@@ -877,8 +923,10 @@
|
|
tooltip:{
|
|
tooltip:{
|
|
trigger:'axis',
|
|
trigger:'axis',
|
|
formatter: function (params,ticket,callback) {
|
|
formatter: function (params,ticket,callback) {
|
|
- var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.money
|
|
|
|
- + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
|
|
|
|
|
|
+ var res = params[0].name + "<br/>" +
|
|
|
|
+ ((_this.permissions.countAllCost || _this.permissions.countResCost) ? "工作成本"+" : " + params[0].data.money
|
|
|
|
+ + "元 <br/>" : '') +
|
|
|
|
+ ((_this.permissions.countAllWorkTime || _this.permissions.countResWorkTime) ? "工作时长"+" : " + params[0].data.cost + "小时" : '');
|
|
_this.params = params;
|
|
_this.params = params;
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -985,6 +1033,11 @@
|
|
this.containerHeight = window.innerHeight - 130
|
|
this.containerHeight = window.innerHeight - 130
|
|
// this.containerHeight = window.innerHeight - 200
|
|
// this.containerHeight = window.innerHeight - 200
|
|
};
|
|
};
|
|
|
|
+ if(this.permissions.countAllCost || this.permissions.countResCost){
|
|
|
|
+ this.yAxisValue = '0'
|
|
|
|
+ }else{
|
|
|
|
+ this.yAxisValue = '1'
|
|
|
|
+ }
|
|
if (this.user.timeType.fixMonthcost == 0) {
|
|
if (this.user.timeType.fixMonthcost == 0) {
|
|
if (this.$route.query.startDate != null) {
|
|
if (this.$route.query.startDate != null) {
|
|
this.dateRange = [this.$route.query.startDate, this.$route.query.endDate];
|
|
this.dateRange = [this.$route.query.startDate, this.$route.query.endDate];
|