Browse Source

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper into master

seyason 2 years ago
parent
commit
fab70624fb

+ 3 - 3
fhKeeper/formulahousekeeper/timesheet/src/components/select.vue

@@ -208,7 +208,7 @@ export default {
                 if(!this.multiSelect) {
                     if(this.optionsOId) {
                         for(let i in this.options) {
-                            if(this.options[i].auditorId == this.optionsOId || this.options[i].id == this.optionsOId) {
+                            if(this.options[i].userId == this.optionsOId || this.options[i].auditorId == this.optionsOId || this.options[i].id == this.optionsOId) {
                                 this.selectName = this.options[i].name || this.options[i].auditorName
                             }
                         }
@@ -219,7 +219,7 @@ export default {
                 if(this.multiSelect) {
                     for(var i in this.options) {
                         for(var j in this.optionsOId) {
-                            if(this.options[i].auditorId == this.optionsOId[j] || this.options[i].id == this.optionsOId[j]) {
+                            if(this.options[i].userId == this.optionsOId || this.options[i].auditorId == this.optionsOId[j] || this.options[i].id == this.optionsOId[j]) {
                                 this.multiSelectList.push(this.options[i])
                                 this.options[i].flg = true
                             }
@@ -259,7 +259,7 @@ export default {
             if(!this.multiSelect) {
                 this.optionsOId = JSON.parse(JSON.stringify(this.subjectId))
                 for(let i in this.options) {
-                    if(this.options[i].auditorId == this.optionsOId || this.options[i].id == this.optionsOId) {
+                    if(this.options[i].userId == this.optionsOId || this.options[i].auditorId == this.optionsOId || this.options[i].id == this.optionsOId) {
                         this.selectName = this.options[i].auditorName || this.options[i].name 
                     }
                 }

+ 174 - 131
fhKeeper/formulahousekeeper/timesheet/src/views/project/detailDep.vue

@@ -138,139 +138,21 @@
                                     this.widthHtval = document.body.clientWidth - 230
                                 }
                             }
-                        // 
-                        var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
-                        if (list.length > 0) {
-                            this.cost = res.data.totalCostMoney;
-                            for(var i in list) {
-                                xList.push(list[i].name);
-                                var pro = list[i].project;
-                                for(var j in pro) {
-                                    if(array.indexOf(pro[j].project) == -1) {
-                                        array.push(pro[j].project)
-                                    }
-                                }
-                            }
-
-                            for(var i in array) {
-                                yList.push(array[i]);
-                                var dataList = [];
-                                for(var j in list) {
-                                    var curUser = list[j];
-                                    var project = list[j].project;
-                                    if(project.length != 0) {
-                                        //找到当前用户对应的项目
-                                        var findProject = project.filter(p=>p.project == array[i]);
-                                        if (findProject.length > 0) {
-                                            dataList.push({
-                                                    "value": this.yAxisValue==0?findProject[0].money:findProject[0].time,
-                                                    "cost": findProject[0].time,
-                                                    "money": findProject[0].money
-                                                })
-                                        } else {
-                                            dataList.push({
-                                                    "value": 0,
-                                                    "cost": 0,
-                                                    "money": 0,
-                                                })
-                                        }
-                                    } else {
-                                        dataList.push({
-                                            "value": 0,
-                                            "cost": 0,
-                                            "money": 0
-                                        })
-                                    }
+                            if(this.user.userNameNeedTranslate == '1') {
+                                let dealWithList = []
+                                let list = res.data.list
+                                for(var i in list) {
+                                    let obj = {}
+                                    obj.type = 'userName'
+                                    obj.id = list[i].name
+                                    dealWithList.push(obj)
                                 }
-
-                                series.push({
-                                    name: array[i],
-                                    type: 'bar',
-                                    stack:'1',
-                                    barMaxWidth: 30,
-                                    data: dataList,
-                                })
+                                this.dealWithTranslationPlone(dealWithList, res)
+                            } else {
+                                this.renderingDiagram(res)
                             }
-
-                            var myChart = echarts.init(document.getElementById("container"));
-                            // 设置宽度
-                            myChart.resize({
-                                width: this.widthHtval
-                            })
-                            _this.myChart = myChart;
-                            var option = {
-                                // 工具箱
-                                legend: {
-                                    x: 80,
-                                    y: 10,
-                                    data: yList
-                                },
-                                grid : {
-                                    top : 80,    //距离容器上边界40像素
-                                    bottom: 35,   //距离容器下边界30像素
-                                    left: 150,
-                                    right: 150
-                                },
-                                toolbox: {
-                                    show: true,
-                                    feature:{
-                                        saveAsImage:{
-                                            show:true
-                                        },
-                                        restore:{
-                                            show:true
-                                        },
-                                        dataView:{
-                                            show:true
-                                        },
-                                        dataZoom:{
-                                            show:true
-                                        },
-                                        magicType:{
-                                            type:['line','bar']
-                                        }
-                                    }
-                                },
-                                tooltip:{
-                                    trigger:'axis',
-                                    formatter: function (params,ticket,callback) {
-                                        
-                                        var totalTime = 0.0;
-                                        for(var i in params) {
-                                            totalTime += parseFloat(params[i].data.cost)
-                                        }
-                                        var res = params[0].name + " 工时 : " + totalTime.toFixed(1)+"小时<br/>";
-                                        for(var i in params) {
-                                            if (params[i].data.value > 0) {
-                                                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>";
-                                            }
-                                        }
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:this.yAxisValue==0?'{value} (元)':'{value}(小时)'
-                                    }
-                                }],
-                                series: series,
-                            };
-                            myChart.setOption(option, {notMerge: true});
-                        } else {
-                            this.$message({
-                                message: "暂无数据",
-                                type: "error"
-                                });
-                        }
+                        // 
+                        
                     } else {
                         this.$message({
                         message: res.msg,
@@ -286,6 +168,167 @@
                     });
                 });
             },
+            dealWithTranslationPlone(items, obj) {
+                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 obj.data.list) {
+                        if(result.items[i]) {  
+                            obj.data.list[i].name = result.items[i].data
+                        }
+                    }
+                    this.renderingDiagram(obj)
+                }
+                myFunOne()
+            },
+            // 渲染图表
+            renderingDiagram (res) {
+                var _this = this;
+                var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
+                if (list.length > 0) {
+                    this.cost = res.data.totalCostMoney;
+                    for(var i in list) {
+                        xList.push(list[i].name);
+                        var pro = list[i].project;
+                        for(var j in pro) {
+                            if(array.indexOf(pro[j].project) == -1) {
+                                array.push(pro[j].project)
+                            }
+                        }
+                    }
+                    for(var i in array) {
+                        yList.push(array[i]);
+                        var dataList = [];
+                        for(var j in list) {
+                            var curUser = list[j];
+                            var project = list[j].project;
+                            if(project.length != 0) {
+                                //找到当前用户对应的项目
+                                var findProject = project.filter(p=>p.project == array[i]);
+                                if (findProject.length > 0) {
+                                    dataList.push({
+                                            "value": this.yAxisValue==0?findProject[0].money:findProject[0].time,
+                                            "cost": findProject[0].time,
+                                            "money": findProject[0].money
+                                        })
+                                } else {
+                                    dataList.push({
+                                            "value": 0,
+                                            "cost": 0,
+                                            "money": 0,
+                                        })
+                                }
+                            } else {
+                                dataList.push({
+                                    "value": 0,
+                                    "cost": 0,
+                                    "money": 0
+                                })
+                            }
+                        }
+                        series.push({
+                            name: array[i],
+                            type: 'bar',
+                            stack:'1',
+                            barMaxWidth: 30,
+                            data: dataList,
+                        })
+                    }
+                    var myChart = echarts.init(document.getElementById("container"));
+                    // 设置宽度
+                    myChart.resize({
+                        width: this.widthHtval
+                    })
+                    _this.myChart = myChart;
+                    var option = {
+                        // 工具箱
+                        legend: {
+                            x: 80,
+                            y: 10,
+                            data: yList
+                        },
+                        grid : {
+                            top : 80,    //距离容器上边界40像素
+                            bottom: 35,   //距离容器下边界30像素
+                            left: 150,
+                            right: 150
+                        },
+                        toolbox: {
+                            show: true,
+                            feature:{
+                                saveAsImage:{
+                                    show:true
+                                },
+                                restore:{
+                                    show:true
+                                },
+                                dataView:{
+                                    show:true
+                                },
+                                dataZoom:{
+                                    show:true
+                                },
+                                magicType:{
+                                    type:['line','bar']
+                                }
+                            }
+                        },
+                        tooltip:{
+                            trigger:'axis',
+                            formatter: function (params,ticket,callback) {
+                                
+                                var totalTime = 0.0;
+                                for(var i in params) {
+                                    totalTime += parseFloat(params[i].data.cost)
+                                }
+                                var res
+                                if(_this.user.userNameNeedTranslate != 1) {
+                                    res = params[0].name + " 工时 : " + totalTime.toFixed(1)+"小时<br/>";
+                                } else {
+                                    res = " 工时 : " + totalTime.toFixed(1)+"小时<br/>";
+                                }
+                                
+                                for(var i in params) {
+                                    if (params[i].data.value > 0) {
+                                        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>";
+                                    }
+                                }
+                                return res;
+                            }
+                        },
+                        xAxis: {
+                            data: xList,
+                            axisLabel: {
+                                interval:0,rotate:20
+                            }
+                        },
+                        yAxis: [{
+                            type : 'value',
+                            axisLabel: {
+                                formatter:this.yAxisValue==0?'{value} (元)':'{value}(小时)'
+                            }
+                        }],
+                        series: series,
+                    };
+                    myChart.setOption(option, {notMerge: true});
+                } else {
+                    this.$message({
+                        message: "暂无数据",
+                        type: "error"
+                        });
+                }
+            },
             // 左右滚动
             scrollFunction () {
                 this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div

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

@@ -504,7 +504,7 @@
                     <el-option v-for="item in noReportUserList" :label="item.name" :key="item.id" :value="item.userId"></el-option>
                 </el-select>
 
-                <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="noReportUserList" :subjectId="chosenNoReportUserIds" :distinction="'2'" :size="'mini'"></selectCat>
+                <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="noReportUserList" :subjectId="chosenNoReportUserIds" :distinction="'2'" :size="'small'"></selectCat>
 
                 <el-button @click="averageCost" >{{ $t('Automaticallocation') }}</el-button>
             </div>

+ 10 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -1668,6 +1668,7 @@
      // 引入自定义级联组件
     import vueCascader from "@/components/cascader.vue"
     
+    import { mapMutations } from 'vuex'
     let _that = this
     export default {
         mixins: [dragMixin],
@@ -1923,7 +1924,7 @@
                 weeklyFilledTimeDate: null,
                 leaveAllNum: 0,
 
-                dataLoading: true
+                dataLoading: false
             };
         },
         watch: {
@@ -2010,11 +2011,16 @@
             }
 
             const that = this
-            setTimeout(()=>{
-                that.dataLoading = false
-            }, 1000)
+            if(this.user.userNameNeedTranslate == 1) {
+                that.dataLoading = that.$store.state.dataLoading
+                this.upDataLoading()
+                setTimeout(()=>{
+                    that.dataLoading = that.$store.state.dataLoading
+                }, 1000)
+            }
         },
         methods: {
+            ...mapMutations(['upDataLoading']),
             test(){
                 console.log('test',this.workForm.domains);
             },

+ 13 - 1
fhKeeper/formulahousekeeper/timesheet/src/vuex/store.js

@@ -8,7 +8,9 @@ Vue.use(Vuex)
 // 应用初始状态
 const state = {
     count: 10,
-    isDing: false
+    isDing: false,
+    dataLoading: true, // 需要转译的情况下日报页面显示加载
+    timer: null
 }
 
 // 定义所需的 mutations
@@ -21,6 +23,16 @@ const mutations = {
     },
     isDingFun(state){
         state.isDing = true
+    },
+    upDataLoading(state) {
+        setTimeout(()=>{
+            state.dataLoading = false
+            console.log(state.dataLoading, '看看他的值')
+        }, 1000)
+        // state.timer = setTimeout(()=>{
+        //     clearTimeout(state.timer)
+        //     state.dataLoading = false
+        // }, 1800000)
     }
 }