|
@@ -4,23 +4,23 @@
|
|
|
<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
|
|
|
<el-form :inline="true">
|
|
|
<el-form-item>
|
|
|
- <el-button type="text" @click="backToList" icon="el-icon-back" class="back">返回</el-button>
|
|
|
+ <el-button type="text" @click="backToList" icon="el-icon-back" class="back">{{ $t('fan-hui') }}</el-button>
|
|
|
</el-form-item>
|
|
|
<el-form-item class="divLine"></el-form-item>
|
|
|
<el-form-item>
|
|
|
<span class="workName">{{detailName}}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item style="float:right;">
|
|
|
- <span style="font-size:18px;">项目成本:<span style="color:#20a0ff;">{{cost.toFixed(2)}}元</span></span>
|
|
|
+ <span style="font-size:18px;">{{ $t('xiang-mu-cheng-ben') }}:<span style="color:#20a0ff;">{{cost.toFixed(2)}}{{ $t('yuan') }}</span></span>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
<el-col :span="24" style="margin-top:10px;padding-bottom: 0px;text-align:center;">
|
|
|
<el-radio-group v-model="radio" @change="getList">
|
|
|
- <el-radio-button label="人员"></el-radio-button>
|
|
|
- <el-radio-button label="任务分组" v-if="user.company.packageProject != 0"></el-radio-button>
|
|
|
- <el-radio-button label="子项目" v-if="user.timeType.mainProjectState != '1'"></el-radio-button>
|
|
|
- <el-radio-button label="阶段" v-if="user.company.packageProject != 0"></el-radio-button>
|
|
|
+ <el-radio-button :label="$t('ren-yuan')"></el-radio-button>
|
|
|
+ <el-radio-button :label="$t('other.taskGroup')" v-if="user.company.packageProject != 0"></el-radio-button>
|
|
|
+ <el-radio-button :label="$t('lable.subproject')" v-if="user.timeType.mainProjectState != '1'"></el-radio-button>
|
|
|
+ <el-radio-button :label="$t('jie-duan')" v-if="user.company.packageProject != 0"></el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</el-col>
|
|
|
<div id="clearfix" :style="'overflow-x: auto;width:100%;padding-bottom: 0px; position: relative; height:'+containerHeight+'px;'">
|
|
@@ -40,7 +40,7 @@
|
|
|
endDate: null,
|
|
|
detailId: this.$route.params.id,
|
|
|
detailName: this.$route.params.name,
|
|
|
- radio:"人员",
|
|
|
+ radio:this.$t('ren-yuan'),
|
|
|
user: JSON.parse(sessionStorage.getItem("user")),
|
|
|
|
|
|
cost: 0,
|
|
@@ -64,11 +64,11 @@
|
|
|
getList() {
|
|
|
this.listLoading = true;
|
|
|
var url = "";
|
|
|
- if (this.radio=='人员') {
|
|
|
+ if (this.radio==this.$t('ren-yuan')) {
|
|
|
url = this.port.project.projectCost;
|
|
|
- } else if (this.radio=='任务分组') {
|
|
|
+ } else if (this.radio==this.$t('other.taskGroup')) {
|
|
|
url = '/project/getCostByGroup';
|
|
|
- } else if (this.radio=='子项目') {
|
|
|
+ } else if (this.radio==this.$t('lable.subproject')) {
|
|
|
url = '/sub-project/getTimeCost';
|
|
|
} else {
|
|
|
url = "/project/getCostInStage";
|
|
@@ -91,83 +91,19 @@
|
|
|
this.listLoading = false;
|
|
|
var _this = this;
|
|
|
if (res.code == "ok") {
|
|
|
- var xList = [],yList = [] , list = res.data.costList;
|
|
|
- this.cost = res.data.totalMoneyCost;
|
|
|
- for(var i in list) {
|
|
|
- if(this.radio == '任务分组'){
|
|
|
- xList.push(list[i].GroupName);
|
|
|
- }else{
|
|
|
- xList.push(list[i].name);
|
|
|
+ if(this.user.userNameNeedTranslate == 1 && this.radio == this.$t('ren-yuan')) {
|
|
|
+ let arr = []
|
|
|
+ for(var i in res.data.costList) {
|
|
|
+ let obj = {}
|
|
|
+ obj.type = 'userName'
|
|
|
+ obj.id = res.data.costList[i].name
|
|
|
+ arr.push(obj)
|
|
|
}
|
|
|
- yList.push({
|
|
|
- "value": this.yAxisValue==0?list[i].costMoney:list[i].cost,
|
|
|
- "cost": list[i].cost,
|
|
|
- "money": list[i].costMoney,
|
|
|
- });
|
|
|
+ this.dealWithTranslation(arr, res.data.costList, res.data.totalMoneyCost)
|
|
|
+ // this.pullAway(res.data.costList, res.data.totalMoneyCost)
|
|
|
+ } else {
|
|
|
+ this.pullAway(res.data.costList, res.data.totalMoneyCost)
|
|
|
}
|
|
|
-
|
|
|
- var myChart = echarts.init(document.getElementById("container"));
|
|
|
- // 设置宽度
|
|
|
- myChart.resize({
|
|
|
- width: this.widthHtval
|
|
|
- })
|
|
|
- _this.myChart = myChart;
|
|
|
- var option = {
|
|
|
- // 工具箱
|
|
|
- toolbox: {
|
|
|
- show: true,
|
|
|
- feature:{
|
|
|
- saveAsImage:{
|
|
|
- show:true
|
|
|
- },
|
|
|
- restore:{
|
|
|
- show:true
|
|
|
- },
|
|
|
- dataView:{
|
|
|
- show:true
|
|
|
- },
|
|
|
- dataZoom:{
|
|
|
- show:true
|
|
|
- },
|
|
|
- magicType:{
|
|
|
- type:['line','bar']
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- grid : {
|
|
|
- top : 80, //距离容器上边界40像素
|
|
|
- bottom: 100, //距离容器下边界30像素
|
|
|
- left: 150,
|
|
|
- right: 150
|
|
|
- },
|
|
|
- tooltip:{
|
|
|
- trigger:'axis',
|
|
|
- formatter: function (params,ticket,callback) {
|
|
|
- var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.money
|
|
|
- + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
|
|
|
- return res;
|
|
|
- }
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- data: xList,
|
|
|
- axisLabel: {
|
|
|
- interval:0,rotate:20
|
|
|
- }
|
|
|
- },
|
|
|
- yAxis: [{
|
|
|
- type : 'value',
|
|
|
- axisLabel: {
|
|
|
- formatter:this.yAxisValue==0?'{value} (元)':'{value}(小时)'
|
|
|
- }
|
|
|
- }],
|
|
|
- series: [{
|
|
|
- name: this.yAxisValue==0?'工作成本(元)':'工作时长(小时)',
|
|
|
- type: 'bar',
|
|
|
- barMaxWidth: 30,
|
|
|
- data: yList,
|
|
|
- }]
|
|
|
- };
|
|
|
- myChart.setOption(option,{notMerge: true});
|
|
|
} else {
|
|
|
this.$message({
|
|
|
message: res.msg,
|
|
@@ -182,6 +118,118 @@
|
|
|
type: "error"
|
|
|
});
|
|
|
});
|
|
|
+ },
|
|
|
+ dealWithTranslation(items, dataArr, cosess) {
|
|
|
+ if (WWOpenData.initCanvas) {
|
|
|
+ WWOpenData.initCanvas()
|
|
|
+ }
|
|
|
+ const myFunOne = async () => {
|
|
|
+ const result = await new Promise((resolve, reject) => {
|
|
|
+ if(WWOpenData.prefetch) {
|
|
|
+ WWOpenData.prefetch({ items }, (err, data) => {
|
|
|
+ if (err) { return reject(err) }
|
|
|
+ resolve(data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ for(var i in dataArr) {
|
|
|
+ dataArr[i].name = result.items[i].data
|
|
|
+ }
|
|
|
+ this.pullAway(dataArr, cosess)
|
|
|
+ }
|
|
|
+
|
|
|
+ myFunOne()
|
|
|
+ },
|
|
|
+ // 抽离出来的方法
|
|
|
+ pullAway(datalist, cosess) {
|
|
|
+ // var xList = [],yList = [] , list = res.data.costList;
|
|
|
+ var _this = this;
|
|
|
+ var xList = [],yList = [] , list = datalist;
|
|
|
+ // this.cost = res.data.totalMoneyCost;
|
|
|
+ this.cost = cosess;
|
|
|
+ for(var i in list) {
|
|
|
+ if(this.radio == this.$t('other.taskGroup')){
|
|
|
+ xList.push(list[i].GroupName);
|
|
|
+ }else{
|
|
|
+ xList.push(list[i].name);
|
|
|
+ }
|
|
|
+ yList.push({
|
|
|
+ "value": this.yAxisValue==0?list[i].costMoney:list[i].cost,
|
|
|
+ "cost": list[i].cost,
|
|
|
+ "money": list[i].costMoney,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ var myChart = echarts.init(document.getElementById("container"));
|
|
|
+ // 设置宽度
|
|
|
+ myChart.resize({
|
|
|
+ width: this.widthHtval
|
|
|
+ })
|
|
|
+ _this.myChart = myChart;
|
|
|
+ var option = {
|
|
|
+ // 工具箱
|
|
|
+ toolbox: {
|
|
|
+ show: true,
|
|
|
+ feature:{
|
|
|
+ saveAsImage:{
|
|
|
+ show:true
|
|
|
+ },
|
|
|
+ restore:{
|
|
|
+ show:true
|
|
|
+ },
|
|
|
+ dataView:{
|
|
|
+ show:true
|
|
|
+ },
|
|
|
+ dataZoom:{
|
|
|
+ show:true
|
|
|
+ },
|
|
|
+ magicType:{
|
|
|
+ type:['line','bar']
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ grid : {
|
|
|
+ top : 80, //距离容器上边界40像素
|
|
|
+ bottom: 100, //距离容器下边界30像素
|
|
|
+ left: 150,
|
|
|
+ right: 150
|
|
|
+ },
|
|
|
+ tooltip:{
|
|
|
+ trigger:'axis',
|
|
|
+ formatter: function (params,ticket,callback) {
|
|
|
+ var res
|
|
|
+ if(_this.user.userNameNeedTranslate == 1 && _this.radio == _this.$t('ren-yuan')) {
|
|
|
+ res = '' + "<br/>"+_this.$t('workcost')+" : " + params[0].data.money
|
|
|
+ + _this.$t('yuan')+"<br/>"+_this.$t('screening.workTime')+" : " + params[0].data.cost + _this.$t('time.hour');
|
|
|
+ } else {
|
|
|
+ res = params[0].name + "<br/>"+_this.$t('workcost')+" : " + params[0].data.money
|
|
|
+ + _this.$t('yuan')+"<br/>"+_this.$t('screening.workTime')+" : " + params[0].data.cost + _this.$t('time.hour');
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ data: xList,
|
|
|
+ axisLabel: {
|
|
|
+ interval:0,rotate:20
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: [{
|
|
|
+ type : 'value',
|
|
|
+ axisLabel: {
|
|
|
+ formatter:this.yAxisValue==0?'{value} (元)':'{value}(小时)'
|
|
|
+ }
|
|
|
+ }],
|
|
|
+ series: [{
|
|
|
+ name: this.yAxisValue==0?_this.$t('workcost')+'('+_this.$t('yuan')+')':_this.$t('screening.workTime')+'('+_this.$t('time.hour')+')',
|
|
|
+ type: 'bar',
|
|
|
+ barMaxWidth: 30,
|
|
|
+ data: yList,
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ myChart.setOption(option,{notMerge: true});
|
|
|
},
|
|
|
// 左右滚动
|
|
|
scrollFunction () {
|