Переглянути джерело

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 рік тому
батько
коміт
b8373b35bc

+ 36 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -557,7 +557,7 @@
                             // console.log('人员返回', this.allListData);
                             this.gtff()
                         }
-                    } else {
+                    } else { 
                         this.$message({
                         message: res.msg + '里面',
                         type: "error"
@@ -606,7 +606,26 @@
                     for(var i in array) {
                         yList.push(array[i]);
                         var dataList = [];
-                        // console.log('for 2 1');
+                        let nameObj = {}
+                        list.forEach(item => {
+                            let moneyTol = 0;
+                            let timeTol = 0;
+                            item.project.forEach((project, index) => {
+                                moneyTol += +project.money;
+                                timeTol += +project.time;
+                            });
+                            // 假设每个 item.project 都至少有一个元素
+                            if (item.project.length > 0) {
+                                const lastProject = item.project[item.project.length - 1];
+                                nameObj[item.name] = {moneyTol: moneyTol, timeTol: timeTol}
+                                lastProject.moneyTol = moneyTol;
+                                lastProject.timeTol = timeTol;
+                            }
+                        });
+
+
+                        console.log('==================>', list, nameObj);
+
                         for(var j in list) {
                             var project = list[j].project , num = 0;
                             if(project.length != 0) {
@@ -623,6 +642,10 @@
                                             item.cost = project[k].time
                                             // totalHours += parseFloat(project[k].time);
                                         }
+                                        if(project[k].moneyTol) {
+                                            item.moneyTol = project[k].moneyTol
+                                            item.timeTol = project[k].timeTol
+                                        }
                                         dataList.push(item)
                                         
                                     } else {
@@ -644,20 +667,28 @@
                                 })
                             }
                         }
+                        // console.log(array[i], dataList, array, '《==============看看数据')
+                        let cerName = array[array.length - 1] // 最后一个项目
+                        let yAxisValue = this.yAxisValue
                         series.push({
                             name: array[i],
                             type: 'bar',
-                            stack:'1',
+                            stack: '1',
                             barMaxWidth: 30,
                             data: dataList,
                             label: {
                                 normal: {
                                     show: true,
                                     position: 'top',
-                                    formatter: `{c} ${this.yAxisValue==0 ? '元' : '小时'}`,
+                                    formatter: function(params) {
+                                        const { seriesName, data, name} = params
+                                        const unit = yAxisValue == 0 ? '元' : '小时';
+                                        const totalValue = yAxisValue == 0 ? nameObj[name].moneyTol : nameObj[name].timeTol;
+                                        return seriesName === cerName ? `${totalValue ? totalValue.toFixed(0) : 0} ${unit}` : '';
+                                    }
                                 }
                             }
-                        })
+                        });
                     }
                     }
                     

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -36,6 +36,7 @@
                         <p ><span class="heavyTxt">{{ $t('other.taskGroup') }}</span>
                             <i class="el-icon-plus pull-right" style="color:#666;margin-right:10px;" @click="createGroup" v-if="projectCreatorId == user.id || projectInchargerId == user.id || permissions.projectManagement || isManageDept"></i>
                         </p>
+                        <p style="color: #303133" v-if="user.companyId == '936'">如需修改,请先联系管理员</p>
                         <el-menu :default-active="defaultGroupId" ref="defaultMenu"  class="el-menu-vertical-demo" @select="groupChange" style="border-right:none;">
                             <el-menu-item :index="item.id" v-for="item in groupList" :key="item.id"  class="group_style">
                                 <div slot="title">
@@ -43,7 +44,7 @@
                                 <div style="display: inline-block;">
                                     <el-tooltip effect="dark" :content="item.name" placement="top" v-if="item.name.length > 12">
                                         <span class="taskGroupClass">{{item.name}}</span>
-                                    </el-tooltip>
+                                    </el-tooltip> 
                                     <span class="taskGroupClass" v-else>{{item.name}}</span>
                                 </div>
                                 <!-- <el-button size="mini" @click="test(item)">test</el-button> -->