瀏覽代碼

再次提交

Lijy 3 年之前
父節點
當前提交
fd36f87ac5

+ 0 - 796
.history/fhKeeper/formulahousekeeper/timesheet/src/views/project/cost_20220111135722.vue

@@ -1,796 +0,0 @@
-<template>
-    <section>
-        <el-col :span="24" style="padding-bottom: 0px;text-align:center;margin-top:10px;position: fixed;top: 60px;left: 160px;z-index: 999;">
-            <el-date-picker v-show="user.timeType.fixMonthcost==0"
-            v-model="dateRange" :editable="false" 
-            format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
-            @change="getEchart" 
-            :clearable="true" 
-            range-separator="至"
-            type="daterange" 
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            ></el-date-picker>
-
-            <el-date-picker v-show="user.timeType.fixMonthcost==1"
-            v-model="dateRange" :editable="false" 
-            format="yyyy-MM" value-format="yyyy-MM" 
-            @change="getEchart" 
-            :clearable="false" 
-            type="month" 
-            ></el-date-picker>
-
-            <el-radio-group v-model="radio" @change="getEchart" style="margin-left:10px;">
-                <el-radio-button label="项目"></el-radio-button>
-                <el-radio-button label="部门"></el-radio-button>
-                <el-radio-button label="人员"></el-radio-button>
-                <el-radio-button :label="namess" v-if="jichu.customDegreeActive == 1"></el-radio-button>
-            </el-radio-group>
-        </el-col>
-        <!-- <div :style="'width:'+widthHtval+'rem;position: relative;'"> -->
-        <div :style="'width:'+widthHtval+'px;position: relative; height:'+containerHeight+'px;'">
-             <div id="container" :style="'height:'+containerHeight+'px;width:100%'"></div>
-        </div>
-        <div style="position:fixed;top:120px;right:150px;"><el-button @click="showExportDialog">报表导出</el-button></div>
-
-        <!--导出报表条件选择 -->
-        <el-dialog title="工时报表导出" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
-            <el-form ref="form3" :model="exportParam" >
-                <el-form-item prop="projectId" label="选择项目" v-if="radio != '人员'">
-                    <el-select v-model="exportParam.projectId" placeholder="全部项目"  clearable style="width:350px;" filterable="true">
-                        <el-option v-for="item in projectList"  :key="item.id" :label="item.projectName" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item prop="userIds" label="选择人员" v-if="radio == '人员'">
-                    <el-select v-model="exportParam.userIds" placeholder="全部人员" multiple="true"  clearable style="width:350px;" filterable="true">
-                        <el-option v-for="item in hasReportUserList"  :key="item.id" :label="item.name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item prop="projectId" :label="user.timeType.fixMonthcost==0?'日期范围':'选择月份'">
-                    <el-date-picker v-show="user.timeType.fixMonthcost==0"
-                        v-model="exportParam.dateRange" :editable="false" 
-                        format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
-                        :clearable="false" 
-                        range-separator="至"
-                        type="daterange" 
-                        start-placeholder="开始日期"
-                        end-placeholder="结束日期"
-                    ></el-date-picker>
-
-                    
-                    <el-date-picker v-show="user.timeType.fixMonthcost==1"
-                    v-model="dateRange" :editable="false" 
-                    format="yyyy-MM" value-format="yyyy-MM" 
-                    @change="getEchart" 
-                    :clearable="true" 
-                    type="month" 
-                    ></el-date-picker>
-                </el-form-item>
-                
-                <el-form-item label="选择人员" v-if="radio == '项目' || radio == '部门'">
-                    <el-select v-model="exportParam.userId"  placeholder="请选择人员" style="width: 350px" filterable="true">
-                        <span v-for="(item, index) in users" :key="index">
-                        <el-option :label="item.name" :value="item.id"></el-option>
-                        </span> 
-                    </el-select>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="exportProjectData" style="width:100%;" >导出</el-button>
-            </div>
-        </el-dialog>
-    </section>
-</template>
-
-<script>
-    import util from "../../common/js/util";
-    export default {
-        data() {
-            return {
-                hasReportUserList:[],
-                projectList:[],
-                exportParam:{projectId:null,dateRange:[],userId: null},
-                exportDialog:false,
-                dateRange:[],
-                user: JSON.parse(sessionStorage.getItem("user")),
-                radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
-                containerHeight: 0,    
-                myChart: null,
-                params: null,
-                widthHtval: document.body.clientWidth - 230,
-                users: [],
-                jichu: [],
-                namess: '',
-                timers: null, // 点击的时间
-                zhishin: 0
-            };
-        },
-        methods: {
-            jutishez() {
-                this.http.post('/time-type/getCompanyTimeSetting', {
-                    companyId: this.user.companyId,
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.jichu = res.data
-                        if(res.data.customDegreeActive == 1) {
-                            this.namess = res.data.customDegreeName
-                        }
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            getUsers() {
-                console.log(this.port.manage.list)
-                this.http.post(this.port.manage.list, {
-                        departmentId: -1,
-                        pageIndex: 1,
-                        pageSize: 99999
-                    },
-                    res => {
-                        if (res.code == "ok") {
-                            this.users = res.data.records;
-                        } else {
-                            this.$message({
-                            message: res.msg,
-                            type: "error"
-                            });
-                        }
-                    },
-                    error => {
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    });
-                },
-            
-            showExportDialog() {
-                this.exportDialog = true;
-                this.exportParam.dateRange = this.dateRange;
-                if (this.radio == '人员') {
-                    // this.exportParam.userIds = [];
-                }
-            },
-            //获取我的项目列表
-            getMyProjectList() {
-                this.http.post('/project/getProjectList', {
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.projectList = res.data;
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            exportProjectData() {
-                 var param = {};
-                 if (this.exportParam.dateRange != null) {
-                    param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
-                 }
-                 var url = "/project/exportTimeCost";
-                 var fileName = '项目工时成本统计.xls';
-                 if (this.radio == '人员' ) {
-                     console.log(this.exportParam.userIds);
-                     fileName = '人员工时成本统计.xls';
-                     url = '/department/exportUserStatistic';
-                     if (this.exportParam.userIds != null && this.exportParam.userIds.length > 0) {
-                         var ids = '';
-                        this.exportParam.userIds.forEach(u=>{
-                            ids += u+',';
-                        })
-                        param.userIds = ids;
-                     }
-                 } 
-                
-                if (this.exportParam.projectId != null) {
-                    param.projectId = this.exportParam.projectId;
-                }
-                if (this.exportParam.userId != null) {
-                    if(this.radio == '项目' || this.radio == '部门' || this.radio == '人员'){
-                        param.userId = this.exportParam.userId;
-                    }
-                }
-                this.http.post(url, param,
-                    res => {
-                        this.listLoading = false;
-                        if (res.code == "ok") {
-                            this.exportDialog = false;
-                            var aTag = document.createElement('a');
-                            aTag.download = fileName;
-                            aTag.href = res.data;
-                            aTag.click();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: "error"
-                            });
-                        }
-                    },
-                    error => {
-                        this.listLoading = false;
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    });
-            },
-            //获取人员成本统计列表
-            getUserCostList() {
-                this.listLoading = true;
-                this.http.post(this.port.project.userCost, {
-                    startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange, 
-                    endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange
-                },
-                res => {
-                    this.listLoading = false;
-                    var _this = this;
-                    this.hasReportUserList = [];
-                    if (res.code == "ok") {
-                        //工时总成本
-                        this.hasReportUserList = res.data.userList;
-                        var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
-                        var totalMoneyCost = res.data.totalCostMoney;
-                        if (list.length > 0) {
-                            var num = list.length==0?0:list[0].project.length;
-                            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 project = list[j].project , num = 0;
-                                    if(project.length != 0) {
-                                        for(var k in project) {
-                                            if(project[k].project == array[i]) {
-                                                dataList.push({
-                                                    "value": project[k].money,
-                                                    "cost": project[k].time,
-                                                })
-                                            } else {
-                                                num++;
-                                            }
-                                            if(k == project.length-1 && num != project.length-1) {
-                                                dataList.push({
-                                                    "value": 0,
-                                                    "cost": 0,
-                                                })
-                                            }
-                                        }
-                                    } else {
-                                        dataList.push({
-                                            "value": 0,
-                                            "cost": 0,
-                                        })
-                                    }
-                                }
-                                series.push({
-                                    name: array[i],
-                                    type: 'bar',
-                                    stack:'1',
-                                    barMaxWidth: 30,
-                                    data: dataList,
-                                })
-                            }
-                        } 
-                            
-                            
-                            var myChart = echarts.init(document.getElementById("container"));
-                            _this.myChart = myChart;
-                            var option = {
-                                //总成本
-                                title: {
-                                    text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
-                                    left:'left',
-                                },
-                                
-                                // 工具箱
-                                legend: {
-                                    x: 80,
-                                    y: 10,
-                                    data: yList,
-                                    show: true,
-                               top:"5%",//与上方的距离 可百分比% 可像素px
-                                },
-                                grid : {
-                                    top : 80,    //距离容器上边界40像素
-                                    bottom: 35   //距离容器下边界30像素
-                                },
-                                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;
-                                        var totalCost = 0;
-                                        var res = "";
-                                        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.value
-                                                    + "元 <br/>工作时长"+" : " + params[i].data.cost + "小时</br></div>";
-                                                totalTime += Number(params[i].data.cost);
-                                                totalCost += Number(params[i].data.value);
-                                            }
-                                        }
-                                        res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1)+'小时 '+totalCost.toFixed(2) + "元<br/>";
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value} (元)'
-                                    }
-                                }],
-                                series: series,
-                            };
-                            myChart.setOption(option,{notMerge:true});
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            yanjiu() {
-                console.log('触发')
-            },
-            getEchart(){
-                var that = this
-                that.timers = setTimeout(()=>{
-                    clearTimeout(that.timers)
-                    console.log(that.timers)
-                    that.jieliu()
-                },800);
-                // this.jieliu()
-            },
-            // 脱离出来的方法
-            jieliu() {
-                console.log('触发了')
-                sessionStorage.radio = this.radio;
-                var _this = this;
-                var param = {};
-                if (this.dateRange != null) {
-                    param = {startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange, 
-                    endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange};
-                    console.log(param);
-                }
-                var url = '';
-                if (this.radio=='项目') {
-                    url = this.port.project.listCost;
-                } else if (this.radio=='部门') {
-                    url = this.port.project.depCost;
-                } else if (this.radio=='人员') {
-                    this.getUserCostList();
-                    return;
-                } else if (this.radio == this.namess) {
-                    url = '/project/getDegreeCost'
-                }
-                this.http.post(url, param,
-                res => {
-                    if (res.code == "ok") {
-                        // 测试写的
-                            // var shujuy = res.data.costList
-                            // var arrsa = []
-                            // for(var i=0; i<30; i++) {
-                            //     arrsa.push(shujuy[0])
-                            // }
-                            // console.log(arrsa)
-                            // res.data.costList = arrsa
-                            for(var i in res.data.costList) {
-                                if(i>20) {
-                                    // this.widthHtval = +this.widthHtval + 2
-                                    this.widthHtval = +this.widthHtval + 40
-                                } else {
-                                    this.widthHtval = document.body.clientWidth - 230
-                                }
-                            }
-                            
-                        // 测试写的
-                        var xList = []
-                        var yList = []
-                        var list
-                        var totalMoneyCost
-                        if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
-                            list = res.data.costList
-                            totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
-                            for(var i in list) {
-                                if(this.radio=='项目' || this.radio == '人员') {
-                                    xList.push(this.radio=='项目'?list[i].project:list[i].name);
-                                    yList.push({
-                                        "value": list[i].costMoney.toFixed(2) || list[i].costMoney,
-                                        "id": list[i].id || i,
-                                        "cost": list[i].cost
-                                    });
-                                } else {
-                                    xList.push(list[i].departmentName);
-                                    yList.push({
-                                        "value": list[i].costMoney.toFixed(2) || list[i].costMoney,
-                                        "id": list[i].departmentId,
-                                        "cost": list[i].costTime
-                                    });
-                                }
-                            }
-                        } else {
-                            list = res.data
-                            var totalMoneyCost = 1
-                            for(var i in list) {
-                                console.log(list[i].name, list[i].costMoney, list[i].cost)
-                                xList.push(list[i].name);
-                                yList.push({
-                                    "value": list[i].costMoney,
-                                    "id": list[i].id || i,
-                                    "cost": list[i].cost
-                                });
-                            }
-                        }
-                        // var xList = [], yList = [], list = res.data.costList, 
-                        // totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
-                        // for(var i in list) {
-                        //     if(this.radio=='项目' || this.radio == '人员') {
-                        //         xList.push(this.radio=='项目'?list[i].project:list[i].name);
-                        //         yList.push({
-                        //             "value": list[i].costMoney.toFixed(2),
-                        //             "id": list[i].id || i,
-                        //             "cost": list[i].cost
-                        //         });
-                        //     } 
-                        //     // else if(this.radio=='研究'){
-                        //     //     xList.push(list[i].name)
-                        //     //     yList.push({
-                        //     //         "value": list[i].costMoney.toFixed(2),
-                        //     //         // "id": list[i].id,
-                        //     //         "id": i,
-                        //     //         "cost": list[i].cost
-                        //     //     })
-                        //     // } 
-                        //     else {
-                        //         xList.push(list[i].departmentName);
-                        //         yList.push({
-                        //             "value": list[i].costMoney.toFixed(2),
-                        //             "id": list[i].departmentId,
-                        //             "cost": list[i].costTime
-                        //         });
-                        //     }
-                        // }
-                        
-                        var myChart = echarts.init(document.getElementById("container"));
-                        myChart.resize({
-                            width: this.widthHtval
-                        })
-                        _this.myChart = myChart;
-                        // console.log(totalMoneyCost.toFixed(2), '看看', totalMoneyCost)
-                        // var chengbentongji = totalMoneyCost.toFixed(2) || totalMoneyCost
-                        if(totalMoneyCost) {
-                            this.zhishin = totalMoneyCost.toFixed(2)
-                        } 
-                        if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
-                            var option = {
-                                title: {
-                                    text: '工时成本总计' + this.zhishin + '元',
-                                    left:'left',
-                                },
-                                // 工具箱
-                                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 res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value 
-                                        + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
-                                        _this.params = params;
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value} (元)'
-                                    }
-                                }],
-                                series: [{
-                                    name: '工作成本(元)',
-                                    type: 'bar',
-                                    barMaxWidth: 30,
-                                    data: yList,
-                                }]
-                            };
-                        } else {
-                            var option = {
-                                title: {
-                                    text: '',
-                                    left:'left',
-                                },
-                                // 工具箱
-                                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 res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value 
-                                        + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
-                                        _this.params = params;
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value} (元)'
-                                    }
-                                }],
-                                series: [{
-                                    name: '工作成本(元)',
-                                    type: 'bar',
-                                    barMaxWidth: 30,
-                                    data: yList,
-                                }]
-                            };
-                        }
-                        // var option = {
-                        //     title: {
-                        //         text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
-                        //         left:'left',
-                        //     },
-                        //     // 工具箱
-                        //     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 res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value 
-                        //             + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
-                        //             _this.params = params;
-                        //             return res;
-                        //         }
-                        //     },
-                        //     xAxis: {
-                        //         data: xList,
-                        //         axisLabel: {
-                        //             interval:0,rotate:20
-                        //         }
-                        //     },
-                        //     yAxis: [{
-                        //         type : 'value',
-                        //         axisLabel: {
-                        //             formatter:'{value} (元)'
-                        //         }
-                        //     }],
-                        //     series: [{
-                        //         name: '工作成本(元)',
-                        //         type: 'bar',
-                        //         barMaxWidth: 30,
-                        //         data: yList,
-                        //     }]
-                        // };
-                        myChart.setOption(option,{notMerge: true});
-                        myChart.getZr().on('click', params => {
-                            const pointInPixel = [params.offsetX, params.offsetY];
-                            if (myChart.containPixel('grid', pointInPixel)) {
-                                console.log(_this.params)
-                                if(_this.radio=='项目') {
-                                    if (_this.dateRange != null) {
-                                        if (this.user.timeType.fixMonthcost == 0) {
-                                            _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                            +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
-                                        } else {
-                                            _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                            +"?startDate="+_this.dateRange+"&endDate="+_this.dateRange);
-                                        }
-                                    } else {
-                                        _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
-                                    }
-                                } else if (_this.radio=='部门') {
-                                    if (_this.dateRange != null) {
-                                        _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                            +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
-                                    } else {
-                                        _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name);
-                                    }
-                                    
-                                }
-                            }
-                        });
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            }
-        },
-        created() {
-        },
-        mounted() {
-            this.containerHeight = window.innerHeight - 140
-            const that = this;
-            window.onresize = function temp() {
-                this.containerHeight = window.innerHeight - 100
-            };
-            if (this.user.timeType.fixMonthcost == 0) {
-                if (this.$route.query.startDate != null) {
-                    this.dateRange = [this.$route.query.startDate, this.$route.query.endDate];
-                } else {
-                    //默认查看本月
-                    var now = new Date();
-                    var t = util.formatDate.format(now, 'yyyy-MM-dd');
-                    var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
-                    this.dateRange = [startStr,t];
-                }
-                this.exportParam.dateRange = this.dateRange;
-            } else if (this.user.timeType.fixMonthcost == 1) {
-                if (this.$route.query.startDate != null) {
-                    this.dateRange = this.$route.query.startDate;
-                } else {
-                    //默认查看本月
-                    var startStr = util.formatDate.format(new Date(), 'yyyy-MM');
-                    this.dateRange = startStr;
-                }
-                this.exportParam.dateRange = this.dateRange;
-            }
-            this.radio = '项目'
-            this.getEchart();
-            var _this = this;
-            window.addEventListener("resize", function() {
-                _this.myChart.resize();
-            });
-
-            this.getMyProjectList();
-            this.getUsers()
-            this.jutishez()
-        },
-    };
-</script>
-
-<style lang="scss" scoped>
-    #container {
-        // display: inline-block;
-        display: block;
-        position: absolute;
-        // width: 100% !important; 
-        margin-top: 60px;
-    } 
-</style>
-
-<style lang="scss">
-</style>

+ 0 - 796
.history/fhKeeper/formulahousekeeper/timesheet/src/views/project/cost_20220111143837.vue

@@ -1,796 +0,0 @@
-<template>
-    <section>
-        <el-col :span="24" style="padding-bottom: 0px;text-align:center;margin-top:10px;position: fixed;top: 60px;left: 160px;z-index: 999;">
-            <el-date-picker v-show="user.timeType.fixMonthcost==0"
-            v-model="dateRange" :editable="false" 
-            format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
-            @change="getEchart" 
-            :clearable="true" 
-            range-separator="至"
-            type="daterange" 
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            ></el-date-picker>
-
-            <el-date-picker v-show="user.timeType.fixMonthcost==1"
-            v-model="dateRange" :editable="false" 
-            format="yyyy-MM" value-format="yyyy-MM" 
-            @change="getEchart" 
-            :clearable="false" 
-            type="month" 
-            ></el-date-picker>
-
-            <el-radio-group v-model="radio" @change="getEchart" style="margin-left:10px;">
-                <el-radio-button label="项目"></el-radio-button>
-                <el-radio-button label="部门"></el-radio-button>
-                <el-radio-button label="人员"></el-radio-button>
-                <el-radio-button :label="namess" v-if="jichu.customDegreeActive == 1"></el-radio-button>
-            </el-radio-group>
-        </el-col>
-        <!-- <div :style="'width:'+widthHtval+'rem;position: relative;'"> -->
-        <div :style="'width:'+widthHtval+'px;position: relative; height:'+containerHeight+'px;'">
-             <div id="container" :style="'height:'+containerHeight+'px;width:100%'"></div>
-        </div>
-        <div style="position:fixed;top:120px;right:150px;"><el-button @click="showExportDialog">报表导出</el-button></div>
-
-        <!--导出报表条件选择 -->
-        <el-dialog title="工时报表导出" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
-            <el-form ref="form3" :model="exportParam" >
-                <el-form-item prop="projectId" label="选择项目" v-if="radio != '人员'">
-                    <el-select v-model="exportParam.projectId" placeholder="全部项目"  clearable style="width:350px;" filterable="true">
-                        <el-option v-for="item in projectList"  :key="item.id" :label="item.projectName" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item prop="userIds" label="选择人员" v-if="radio == '人员'">
-                    <el-select v-model="exportParam.userIds" placeholder="全部人员" multiple="true"  clearable style="width:350px;" filterable="true">
-                        <el-option v-for="item in hasReportUserList"  :key="item.id" :label="item.name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item prop="projectId" :label="user.timeType.fixMonthcost==0?'日期范围':'选择月份'">
-                    <el-date-picker v-show="user.timeType.fixMonthcost==0"
-                        v-model="exportParam.dateRange" :editable="false" 
-                        format="yyyy-MM-dd" value-format="yyyy-MM-dd" 
-                        :clearable="false" 
-                        range-separator="至"
-                        type="daterange" 
-                        start-placeholder="开始日期"
-                        end-placeholder="结束日期"
-                    ></el-date-picker>
-
-                    
-                    <el-date-picker v-show="user.timeType.fixMonthcost==1"
-                    v-model="dateRange" :editable="false" 
-                    format="yyyy-MM" value-format="yyyy-MM" 
-                    @change="getEchart" 
-                    :clearable="true" 
-                    type="month" 
-                    ></el-date-picker>
-                </el-form-item>
-                
-                <el-form-item label="选择人员" v-if="radio == '项目' || radio == '部门'">
-                    <el-select v-model="exportParam.userId"  placeholder="请选择人员" style="width: 350px" filterable="true">
-                        <span v-for="(item, index) in users" :key="index">
-                        <el-option :label="item.name" :value="item.id"></el-option>
-                        </span> 
-                    </el-select>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="exportProjectData" style="width:100%;" >导出</el-button>
-            </div>
-        </el-dialog>
-    </section>
-</template>
-
-<script>
-    import util from "../../common/js/util";
-    export default {
-        data() {
-            return {
-                hasReportUserList:[],
-                projectList:[],
-                exportParam:{projectId:null,dateRange:[],userId: null},
-                exportDialog:false,
-                dateRange:[],
-                user: JSON.parse(sessionStorage.getItem("user")),
-                radio: sessionStorage.radio!=null?sessionStorage.radio:'项目',
-                containerHeight: 0,    
-                myChart: null,
-                params: null,
-                widthHtval: document.body.clientWidth - 230,
-                users: [],
-                jichu: [],
-                namess: '',
-                timers: null, // 点击的时间
-                zhishin: 0
-            };
-        },
-        methods: {
-            jutishez() {
-                this.http.post('/time-type/getCompanyTimeSetting', {
-                    companyId: this.user.companyId,
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.jichu = res.data
-                        if(res.data.customDegreeActive == 1) {
-                            this.namess = res.data.customDegreeName
-                        }
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            getUsers() {
-                console.log(this.port.manage.list)
-                this.http.post(this.port.manage.list, {
-                        departmentId: -1,
-                        pageIndex: 1,
-                        pageSize: 99999
-                    },
-                    res => {
-                        if (res.code == "ok") {
-                            this.users = res.data.records;
-                        } else {
-                            this.$message({
-                            message: res.msg,
-                            type: "error"
-                            });
-                        }
-                    },
-                    error => {
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    });
-                },
-            
-            showExportDialog() {
-                this.exportDialog = true;
-                this.exportParam.dateRange = this.dateRange;
-                if (this.radio == '人员') {
-                    // this.exportParam.userIds = [];
-                }
-            },
-            //获取我的项目列表
-            getMyProjectList() {
-                this.http.post('/project/getProjectList', {
-                },
-                res => {
-                    if (res.code == "ok") {
-                        this.projectList = res.data;
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            exportProjectData() {
-                 var param = {};
-                 if (this.exportParam.dateRange != null) {
-                    param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
-                 }
-                 var url = "/project/exportTimeCost";
-                 var fileName = '项目工时成本统计.xls';
-                 if (this.radio == '人员' ) {
-                     console.log(this.exportParam.userIds);
-                     fileName = '人员工时成本统计.xls';
-                     url = '/department/exportUserStatistic';
-                     if (this.exportParam.userIds != null && this.exportParam.userIds.length > 0) {
-                         var ids = '';
-                        this.exportParam.userIds.forEach(u=>{
-                            ids += u+',';
-                        })
-                        param.userIds = ids;
-                     }
-                 } 
-                
-                if (this.exportParam.projectId != null) {
-                    param.projectId = this.exportParam.projectId;
-                }
-                if (this.exportParam.userId != null) {
-                    if(this.radio == '项目' || this.radio == '部门' || this.radio == '人员'){
-                        param.userId = this.exportParam.userId;
-                    }
-                }
-                this.http.post(url, param,
-                    res => {
-                        this.listLoading = false;
-                        if (res.code == "ok") {
-                            this.exportDialog = false;
-                            var aTag = document.createElement('a');
-                            aTag.download = fileName;
-                            aTag.href = res.data;
-                            aTag.click();
-                        } else {
-                            this.$message({
-                                message: res.msg,
-                                type: "error"
-                            });
-                        }
-                    },
-                    error => {
-                        this.listLoading = false;
-                        this.$message({
-                            message: error,
-                            type: "error"
-                        });
-                    });
-            },
-            //获取人员成本统计列表
-            getUserCostList() {
-                this.listLoading = true;
-                this.http.post(this.port.project.userCost, {
-                    startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange, 
-                    endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange
-                },
-                res => {
-                    this.listLoading = false;
-                    var _this = this;
-                    this.hasReportUserList = [];
-                    if (res.code == "ok") {
-                        //工时总成本
-                        this.hasReportUserList = res.data.userList;
-                        var xList = [] , yList = [] , list = res.data.list, array = [] , series = [];
-                        var totalMoneyCost = res.data.totalCostMoney;
-                        if (list.length > 0) {
-                            var num = list.length==0?0:list[0].project.length;
-                            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 project = list[j].project , num = 0;
-                                    if(project.length != 0) {
-                                        for(var k in project) {
-                                            if(project[k].project == array[i]) {
-                                                dataList.push({
-                                                    "value": project[k].money,
-                                                    "cost": project[k].time,
-                                                })
-                                            } else {
-                                                num++;
-                                            }
-                                            if(k == project.length-1 && num != project.length-1) {
-                                                dataList.push({
-                                                    "value": 0,
-                                                    "cost": 0,
-                                                })
-                                            }
-                                        }
-                                    } else {
-                                        dataList.push({
-                                            "value": 0,
-                                            "cost": 0,
-                                        })
-                                    }
-                                }
-                                series.push({
-                                    name: array[i],
-                                    type: 'bar',
-                                    stack:'1',
-                                    barMaxWidth: 30,
-                                    data: dataList,
-                                })
-                            }
-                        } 
-                            
-                            
-                            var myChart = echarts.init(document.getElementById("container"));
-                            _this.myChart = myChart;
-                            var option = {
-                                //总成本
-                                title: {
-                                    text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
-                                    left:'left',
-                                },
-                                
-                                // 工具箱
-                                legend: {
-                                    x: 80,
-                                    y: 10,
-                                    data: yList,
-                                    show: true,
-                               top:"5%",//与上方的距离 可百分比% 可像素px
-                                },
-                                grid : {
-                                    top : 80,    //距离容器上边界40像素
-                                    bottom: 35   //距离容器下边界30像素
-                                },
-                                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;
-                                        var totalCost = 0;
-                                        var res = "";
-                                        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.value
-                                                    + "元 <br/>工作时长"+" : " + params[i].data.cost + "小时</br></div>";
-                                                totalTime += Number(params[i].data.cost);
-                                                totalCost += Number(params[i].data.value);
-                                            }
-                                        }
-                                        res = res +'<br/>'+ params[0].name+ '<br/>总计: ' + totalTime.toFixed(1)+'小时 '+totalCost.toFixed(2) + "元<br/>";
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value} (元)'
-                                    }
-                                }],
-                                series: series,
-                            };
-                            myChart.setOption(option,{notMerge:true});
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            },
-            yanjiu() {
-                console.log('触发')
-            },
-            getEchart(){
-                var that = this
-                that.timers = setTimeout(()=>{
-                    clearTimeout(that.timers)
-                    console.log(that.timers)
-                    that.jieliu()
-                },800);
-                // this.jieliu()
-            },
-            // 脱离出来的方法
-            jieliu() {
-                console.log('触发了')
-                sessionStorage.radio = this.radio;
-                var _this = this;
-                var param = {};
-                if (this.dateRange != null) {
-                    param = {startDate:this.user.timeType.fixMonthcost==0?this.dateRange[0]:this.dateRange, 
-                    endDate: this.user.timeType.fixMonthcost==0?this.dateRange[1]:this.dateRange};
-                    console.log(param);
-                }
-                var url = '';
-                if (this.radio=='项目') {
-                    url = this.port.project.listCost;
-                } else if (this.radio=='部门') {
-                    url = this.port.project.depCost;
-                } else if (this.radio=='人员') {
-                    this.getUserCostList();
-                    return;
-                } else if (this.radio == this.namess) {
-                    url = '/project/getDegreeCost'
-                }
-                this.http.post(url, param,
-                res => {
-                    if (res.code == "ok") {
-                        // 测试写的
-                            // var shujuy = res.data.costList
-                            // var arrsa = []
-                            // for(var i=0; i<30; i++) {
-                            //     arrsa.push(shujuy[0])
-                            // }
-                            // console.log(arrsa)
-                            // res.data.costList = arrsa
-                            for(var i in res.data.costList) {
-                                if(i>20) {
-                                    // this.widthHtval = +this.widthHtval + 2
-                                    this.widthHtval = +this.widthHtval + 40
-                                } else {
-                                    this.widthHtval = document.body.clientWidth - 230
-                                }
-                            }
-                            
-                        // 测试写的
-                        var xList = []
-                        var yList = []
-                        var list
-                        var totalMoneyCost
-                        if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
-                            list = res.data.costList
-                            totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
-                            for(var i in list) {
-                                if(this.radio=='项目' || this.radio == '人员') {
-                                    xList.push(this.radio=='项目'?list[i].project:list[i].name);
-                                    yList.push({
-                                        "value": list[i].costMoney.toFixed(2) || list[i].costMoney,
-                                        "id": list[i].id || i,
-                                        "cost": list[i].cost
-                                    });
-                                } else {
-                                    xList.push(list[i].departmentName);
-                                    yList.push({
-                                        "value": list[i].costMoney.toFixed(2) || list[i].costMoney,
-                                        "id": list[i].departmentId,
-                                        "cost": list[i].costTime
-                                    });
-                                }
-                            }
-                        } else {
-                            list = res.data
-                            var totalMoneyCost = 1
-                            for(var i in list) {
-                                console.log(list[i].name, list[i].costMoney, list[i].cost)
-                                xList.push(list[i].name);
-                                yList.push({
-                                    "value": list[i].costMoney,
-                                    "id": list[i].id || i,
-                                    "cost": list[i].cost
-                                });
-                            }
-                        }
-                        // var xList = [], yList = [], list = res.data.costList, 
-                        // totalMoneyCost = ((this.radio=='项目' || this.radio=='人员')?res.data.totalMoneyCost:res.data.totalCostMoney);
-                        // for(var i in list) {
-                        //     if(this.radio=='项目' || this.radio == '人员') {
-                        //         xList.push(this.radio=='项目'?list[i].project:list[i].name);
-                        //         yList.push({
-                        //             "value": list[i].costMoney.toFixed(2),
-                        //             "id": list[i].id || i,
-                        //             "cost": list[i].cost
-                        //         });
-                        //     } 
-                        //     // else if(this.radio=='研究'){
-                        //     //     xList.push(list[i].name)
-                        //     //     yList.push({
-                        //     //         "value": list[i].costMoney.toFixed(2),
-                        //     //         // "id": list[i].id,
-                        //     //         "id": i,
-                        //     //         "cost": list[i].cost
-                        //     //     })
-                        //     // } 
-                        //     else {
-                        //         xList.push(list[i].departmentName);
-                        //         yList.push({
-                        //             "value": list[i].costMoney.toFixed(2),
-                        //             "id": list[i].departmentId,
-                        //             "cost": list[i].costTime
-                        //         });
-                        //     }
-                        // }
-                        
-                        var myChart = echarts.init(document.getElementById("container"));
-                        myChart.resize({
-                            width: this.widthHtval
-                        })
-                        _this.myChart = myChart;
-                        // console.log(totalMoneyCost.toFixed(2), '看看', totalMoneyCost)
-                        // var chengbentongji = totalMoneyCost.toFixed(2) || totalMoneyCost
-                        if(totalMoneyCost) {
-                            this.zhishin = totalMoneyCost.toFixed(2)
-                        } 
-                        if(this.radio == '项目' || this.radio == '人员' || this.radio=='部门') {
-                            var option = {
-                                title: {
-                                    text: '工时成本总计' + this.zhishin + '元',
-                                    left:'left',
-                                },
-                                // 工具箱
-                                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 res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value 
-                                        + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
-                                        _this.params = params;
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value} (元)'
-                                    }
-                                }],
-                                series: [{
-                                    name: '工作成本(元)',
-                                    type: 'bar',
-                                    barMaxWidth: 30,
-                                    data: yList,
-                                }]
-                            };
-                        } else {
-                            var option = {
-                                title: {
-                                    text: '',
-                                    left:'left',
-                                },
-                                // 工具箱
-                                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 res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value 
-                                        + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
-                                        _this.params = params;
-                                        return res;
-                                    }
-                                },
-                                xAxis: {
-                                    data: xList,
-                                    axisLabel: {
-                                        interval:0,rotate:20
-                                    }
-                                },
-                                yAxis: [{
-                                    type : 'value',
-                                    axisLabel: {
-                                        formatter:'{value} (元)'
-                                    }
-                                }],
-                                series: [{
-                                    name: '工作成本(元)',
-                                    type: 'bar',
-                                    barMaxWidth: 30,
-                                    data: yList,
-                                }]
-                            };
-                        }
-                        // var option = {
-                        //     title: {
-                        //         text: '工时成本总计' + totalMoneyCost.toFixed(2) + '元',
-                        //         left:'left',
-                        //     },
-                        //     // 工具箱
-                        //     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 res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value 
-                        //             + "元 <br/>工作时长"+" : " + params[0].data.cost + "小时";
-                        //             _this.params = params;
-                        //             return res;
-                        //         }
-                        //     },
-                        //     xAxis: {
-                        //         data: xList,
-                        //         axisLabel: {
-                        //             interval:0,rotate:20
-                        //         }
-                        //     },
-                        //     yAxis: [{
-                        //         type : 'value',
-                        //         axisLabel: {
-                        //             formatter:'{value} (元)'
-                        //         }
-                        //     }],
-                        //     series: [{
-                        //         name: '工作成本(元)',
-                        //         type: 'bar',
-                        //         barMaxWidth: 30,
-                        //         data: yList,
-                        //     }]
-                        // };
-                        myChart.setOption(option,{notMerge: true});
-                        myChart.getZr().on('click', params => {
-                            const pointInPixel = [params.offsetX, params.offsetY];
-                            if (myChart.containPixel('grid', pointInPixel)) {
-                                console.log(_this.params)
-                                if(_this.radio=='项目') {
-                                    if (_this.dateRange != null) {
-                                        if (this.user.timeType.fixMonthcost == 0) {
-                                            _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                            +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
-                                        } else {
-                                            _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                            +"?startDate="+_this.dateRange+"&endDate="+_this.dateRange);
-                                        }
-                                    } else {
-                                        _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
-                                    }
-                                } else if (_this.radio=='部门') {
-                                    if (_this.dateRange != null) {
-                                        _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name
-                                            +"?startDate="+_this.dateRange[0]+"&endDate="+_this.dateRange[1]);
-                                    } else {
-                                        _this.$router.push("/costDep/" + _this.params[0].data.id + "/" + _this.params[0].name);
-                                    }
-                                    
-                                }
-                            }
-                        });
-                    } else {
-                        this.$message({
-                            message: res.msg,
-                            type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-            }
-        },
-        created() {
-        },
-        mounted() {
-            this.containerHeight = window.innerHeight - 140
-            const that = this;
-            window.onresize = function temp() {
-                this.containerHeight = window.innerHeight - 100
-            };
-            if (this.user.timeType.fixMonthcost == 0) {
-                if (this.$route.query.startDate != null) {
-                    this.dateRange = [this.$route.query.startDate, this.$route.query.endDate];
-                } else {
-                    //默认查看本月
-                    var now = new Date();
-                    var t = util.formatDate.format(now, 'yyyy-MM-dd');
-                    var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
-                    this.dateRange = [startStr,t];
-                }
-                this.exportParam.dateRange = this.dateRange;
-            } else if (this.user.timeType.fixMonthcost == 1) {
-                if (this.$route.query.startDate != null) {
-                    this.dateRange = this.$route.query.startDate;
-                } else {
-                    //默认查看本月
-                    var startStr = util.formatDate.format(new Date(), 'yyyy-MM');
-                    this.dateRange = startStr;
-                }
-                this.exportParam.dateRange = this.dateRange;
-            }
-            this.radio = '项目'
-            this.getEchart();
-            var _this = this;
-            window.addEventListener("resize", function() {
-                _this.myChart.resize();
-            });
-
-            this.getMyProjectList();
-            this.getUsers()
-            this.jutishez()
-        },
-    };
-</script>
-
-<style lang="scss" scoped>
-    #container {
-        // display: inline-block;
-        display: block;
-        position: absolute;
-        // width: 100% !important; 
-        margin-top: 60px;
-    } 
-</style>
-
-<style lang="scss">
-</style>

+ 32 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -208,7 +208,7 @@
             </el-form-item>
             <!-- 单据编号 -->
             <el-form-item label="单据编号" >
-              <el-input v-model="code" size="small" placeholder="单据编号" clearable="true"></el-input>
+              <el-input v-model="code" size="small" placeholder="单据编号" clearable="true" style="width: 120px"></el-input>
             </el-form-item>
             <!-- 费用类型 -->
             <el-form-item label="费用类型">
@@ -228,7 +228,7 @@
                 range-separator="至"
                 start-placeholder="开始日期"
                 end-placeholder="结束日期"
-                style="width: 200px">
+                style="width: 280px">
               </el-date-picker>
             </el-form-item>
             <el-form-item>
@@ -238,7 +238,7 @@
         </div>
         <el-divider ></el-divider>
         <!--列表-->
-          <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;"  show-summary>
+          <el-table ref="tab" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" :summary-method="getSummaries" show-summary>
               <el-table-column prop="code" label="票据编号"></el-table-column>
               <el-table-column prop="totalAmount" label="金额(元)" ></el-table-column>
               <el-table-column prop="ownerName" label="报销人" ></el-table-column>
@@ -1127,6 +1127,35 @@ export default {
         // console.log(location.protocol, location.host)
         // console.log(location.protocol + '//' + location.host + imgs)
       },
+      // 合计
+      getSummaries(param) {
+        const { columns, data } = param;
+        const sums = [];
+        columns.forEach((column, index) => {
+          if (index === 0) {
+            sums[index] = '合计';
+            return;
+          }
+          const values = data.map(item => Number(item[column.property]));
+          if (!values.every(value => isNaN(value))) {
+            sums[index] = values.reduce((prev, curr) => {
+              const value = Number(curr);
+              if (!isNaN(value)) {
+                return prev + curr;
+              } else {
+                return prev;
+              }
+            }, 0);
+            sums[index] += ' 元';
+          } else {
+            sums[index] = 'N/A';
+          }
+        });
+
+        console.log(sums, 123)
+        this.$nextTick(()=>{ this.$refs.tab.doLayout()})
+        return sums;
+      }
   },
 };
 </script>

+ 88 - 88
fhKeeper/formulahousekeeper/timesheet_h5/package-lock.json

@@ -1728,59 +1728,6 @@
           "integrity": "sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U=",
           "dev": true
         },
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-          "dev": true,
-          "optional": true
-        },
-        "emojis-list": {
-          "version": "3.0.0",
-          "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
-          "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
-          "dev": true,
-          "optional": true
-        },
-        "has-flag": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
-          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
-          "dev": true,
-          "optional": true
-        },
-        "loader-utils": {
-          "version": "2.0.2",
-          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
-          "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^2.1.2"
-          }
-        },
         "minimist": {
           "version": "1.2.5",
           "resolved": "https://registry.npm.taobao.org/minimist/download/minimist-1.2.5.tgz",
@@ -1810,41 +1757,6 @@
           "requires": {
             "ansi-regex": "^5.0.0"
           }
-        },
-        "supports-color": {
-          "version": "7.2.0",
-          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "has-flag": "^4.0.0"
-          }
-        },
-        "vue-loader-v16": {
-          "version": "npm:vue-loader@16.8.3",
-          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
-          "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "chalk": "^4.1.0",
-            "hash-sum": "^2.0.0",
-            "loader-utils": "^2.0.0"
-          },
-          "dependencies": {
-            "chalk": {
-              "version": "4.1.2",
-              "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
-              "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
-              "dev": true,
-              "optional": true,
-              "requires": {
-                "ansi-styles": "^4.1.0",
-                "supports-color": "^7.1.0"
-              }
-            }
-          }
         }
       }
     },
@@ -12047,6 +11959,94 @@
         }
       }
     },
+    "vue-loader-v16": {
+      "version": "npm:vue-loader@16.8.3",
+      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
+      "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
+      "dev": true,
+      "optional": true,
+      "requires": {
+        "chalk": "^4.1.0",
+        "hash-sum": "^2.0.0",
+        "loader-utils": "^2.0.0"
+      },
+      "dependencies": {
+        "ansi-styles": {
+          "version": "4.3.0",
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "4.1.2",
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+          "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "color-convert": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "color-name": {
+          "version": "1.1.4",
+          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+          "dev": true,
+          "optional": true
+        },
+        "emojis-list": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
+          "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==",
+          "dev": true,
+          "optional": true
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+          "dev": true,
+          "optional": true
+        },
+        "loader-utils": {
+          "version": "2.0.2",
+          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz",
+          "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^2.1.2"
+          }
+        },
+        "supports-color": {
+          "version": "7.2.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        }
+      }
+    },
     "vue-router": {
       "version": "3.5.1",
       "resolved": "https://registry.npm.taobao.org/vue-router/download/vue-router-3.5.1.tgz?cache=0&sync_timestamp=1617697843139&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-router%2Fdownload%2Fvue-router-3.5.1.tgz",