Forráskód Böngészése

新镇按周填报

Lijy 3 éve
szülő
commit
12f870cbae

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -119,6 +119,7 @@ router.beforeEach((to, from, next) => {
                     } else {
                         var modules = userModules.filter(u=>u.role == user.role)[0].modules;
                         if ((user.role == 0 || user.role == 5) && user.leader) {
+                            // if (user.role == 5 && user.leader) {
                             modules.push(2, "项目报告审核");
                         }
                         if (user.role == 6 && user.timeType.needDeptAudit == 1) {

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

@@ -11,7 +11,8 @@
             <el-col :span="4">
                 <div class="tools" @click.prevent="collapse" style="position: relative;">
                     <i class="fa fa-align-justify"></i>
-                    <span style="position: absolute;width: 200px;left: 60px;">{{user.companyName}}</span>
+                    <!-- <span style="position: absolute;width: 200px;left: 60px;">{{user.companyName}}</span> -->
+                    <span style="position: absolute;width: 200px;left: 60px;">南京火石闪信科技有限公司</span>
                 </div>
             </el-col>
             <el-col :span="10" class="userinfo">

+ 381 - 27
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -1,5 +1,5 @@
 <template>
-    <section>
+    <section v-loading="zhoLoading">
         <!--列表-->
         <div>
             <el-card class="box-card daily" shadow="never">
@@ -72,6 +72,7 @@
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,0)">填写日报</el-link>
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,0)">代填日报</el-link>
                             <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,1)">批量填报</el-link>
+                            <el-link v-if="reportTimeType.type == 2" type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReportss()">按周填报</el-link>
                             <el-link type="primary" v-if="user.role==1||user.role==2||user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="imports()">工时导入</el-link>
                             
                             <!-- <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,1)">批量代填</el-link> -->
@@ -456,6 +457,71 @@
             </span>
         </el-dialog>
 
+        <!-- 按周填报 -->
+        <el-dialog title="按周填报" :visible.sync="diasZho" width="60%" :close-on-click-modal="false" @closed="guanbi()">
+            <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
+                <el-form-item label="工作日期" prop="createDate">
+                     <el-date-picker v-model="zhoRqi" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="zhoRqis()" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="margin-right: 18px"></el-date-picker>
+                     <el-button @click="handleGetPrevWeek()">上周</el-button>
+                     <el-button @click="getCurrentWeek()">本周</el-button>
+                     <el-button @click="handleGetNextvWeek()">下周</el-button>
+                </el-form-item>
+                <el-table :data="zhoData" style="width: 100%" v-loading="zhoLoading" >
+                    <el-table-column fixed="left" prop="zhoDataTime" label="日期" width="120"> </el-table-column>
+                    <el-table-column align="center" v-for="(item, index) in projectList" :key="item.id" :label="item.projectName" width="200">
+                        <template slot-scope="scope">
+                            <!-- <el-input v-model="scope.row[item.projectName]" style="width:120px;" @input="zhoZhi(scope.row, scope.$index)"></el-input> -->
+                            <el-popover placement="top" width="450" trigger="click">
+                                <div>
+                                    <div class="zhoFel">
+                                        <p>选择时间</p>
+                                        <el-time-picker
+                                            style="width: 355px"
+                                            is-range
+                                            v-model="scope.row[item.projectName].time"
+                                            format="HH:mm"
+                                            value-format="HH:mm"
+                                            range-separator="至"
+                                            start-placeholder="开始时间"
+                                            end-placeholder="结束时间"
+                                            placeholder="选择时间范围"
+                                            @change="zhoTimes(scope.row[item.projectName], scope.$index, index)">
+                                        </el-time-picker>
+                                    </div>
+                                    <div class="zhoFel">
+                                        <p>工作事项</p>
+                                        <el-input type="textarea" v-model="scope.row[item.projectName].con" placeholder="请输入工作事项" style="width: 355px"></el-input>
+                                    </div>
+                                </div>
+                                <el-button v-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != ''" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
+                                <el-button v-else type="text" slot="reference">请填写</el-button>
+                            </el-popover>
+                        </template>
+                    </el-table-column>
+                    <el-table-column fixed="right" prop="he" label="合计" width="120">
+                        <template slot-scope="scope">
+                            <div class="zhiss">
+                                <p>{{scope.row.he}}</p>
+                                <el-button size="mini" type="danger" icon="el-icon-delete" circle @click="zhoBtn(scope.$index)"></el-button>
+                            </div>
+                        </template>
+                    </el-table-column>
+                </el-table>
+            </el-form>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="diasZho = false">取 消</el-button>
+                <el-button type="primary" @click="zhoAdd()">提 交</el-button>
+            </span>
+        </el-dialog>
+        <!-- 选择时间 -->
+        <el-dialog title="时间选择" :visible.sync="btnZho" width="30%" :before-close="handleClose">
+            <span>这是一段信息</span>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="btnZho = false">取 消</el-button>
+                <el-button type="primary" @click="btnZho = false">确 定</el-button>
+            </span>
+        </el-dialog>
+
         <!-- 批量日报审核 -->
         <el-dialog title="批量日报审核" :visible.sync="approveDialogVisible" width="500px" >
             <el-checkbox v-model="isAllSelect" label="全选" style="margin-left:24px;" @change="selectAll" v-if="reportNames.length > 0"></el-checkbox>
@@ -831,7 +897,13 @@
                 weiduList: [],
                 yonghuUser: [],
                 dateAr: [],
-                batchSubFillDialog: false
+                batchSubFillDialog: false,
+                isSubstiS: false,
+                diasZho: false,
+                zhoData: [],
+                zhoRqi: [],
+                btnZho: false,
+                zhoLoading: false
             };
         },
         methods: {
@@ -846,7 +918,6 @@
                         var filePath = res.data;
                         const a = document.createElement('a'); // 创建a标签
                         var data = filePath.split("/");
-                        console.log(filePath+',  '+data);
                         a.setAttribute('download', data[data.length-1]);// download属性
                         a.setAttribute('href', filePath);// href链接
                         a.click(); //自执行点击事件
@@ -883,7 +954,6 @@
                         total += parseFloat(item[key]);
                     }
                 }
-                console.log(total);
                 item.totalFillTime = total;
             },
             //提交批量代填的数据
@@ -924,7 +994,6 @@
                         this.checkinLoading = false;
                         this.checkinList = res.data.list;
                         this.projectColumns = res.data.projects;
-                        console.log(res.data);
                         // 自定义表格会导致表格错乱,需重新计算表格
                         this.$nextTick(()=>{
                             this.$refs.tab.doLayout()
@@ -1032,7 +1101,6 @@
                 res => {
                     if (res.code == "ok") {
                         this.yonghuUser = res.data
-                        console.log(this.yonghuUser)
                     } 
                 },
                 error => {
@@ -1044,8 +1112,6 @@
                 );
             },
             iptBlur(i) {
-                console.log(i)
-                // console.log(this.workForm.createDate)
                 if(this.isBatch == 0) {
                     return
                 }
@@ -1058,7 +1124,6 @@
                 },
                 res => {
                     if (res.code == "ok") {
-                        // console.log(res, '出来的数据')
                         this.jsDay = res.data
                         this.chuji(i)
                     } 
@@ -1073,20 +1138,16 @@
 
                 var sl = this.workForm.domains
                 this.chuji(i)
-                // console.log(this.workForm, '看看')
             },
             chuji(i) {
-                console.log(12345, i)
                 if(i == 0) {
                     this.seleChn(1)
                 } else if(i == 1) {
                     this.seleChn(0)
                 } else if(i == 2) {
                     if(this.workForm.domains[0].multiWorktime > 0) {
-                        console.log('触发上面的')
                         this.iptChangs()
                     } else {
-                        console.log('触发下面的')
                         this.iptChang()
                     }
                 } else if(i == 3) {
@@ -1094,7 +1155,6 @@
                 }
             },
             seleChn(e) {
-                console.log('出发了', e)
                 if(e == 1) {
                     for(var i in this.workForm.domains) {
                         if(this.workForm.domains[i].timeType == 0) {
@@ -1136,7 +1196,6 @@
                 this.jsTime = quanbu
             },
             iptChangs() {
-                console.log(this.workForm)
                 var sl = this.workForm.domains
                 var quanbu = 0 
                 var zhi = ''
@@ -1160,7 +1219,6 @@
                 this.jsTime = quanbu
             },
             removeTimeItem(item, index) {
-                // console.log(1234)
                 item.worktimeList.splice(index, 1);
                 this.iptChangs()
             },
@@ -1237,7 +1295,6 @@
                     res => {
                         if (res.code == "ok") {
                             this.monthWorkData = res.data.list;
-                            // console.log('获取到数据:'+this.monthWorkData[0].name+', daytime='+this.reportTimeType.allday);
                             this.$forceUpdate();
                         } 
                     },
@@ -1504,7 +1561,6 @@
             },
             // 获取维度数据
             dimension(domain, index) {
-                console.log(domain)
                 if(domain.projectId == '') {
                     return
                 }
@@ -2207,7 +2263,6 @@
                         var list = res.data;
                         this.report = list;
                         if(list.report.length != 0) {
-                            console.log('执行上面')
                             var arr = [];
                             this.canEdit = false;
                             for(var i in list.report) {
@@ -2259,7 +2314,6 @@
                                 userNames:null,
                                 userId:null,
                             }
-                            console.log(this.workForm, '数据')
                         } else {
                             this.workForm = {
                                 createDate: this.workForm.createDate,
@@ -2297,7 +2351,6 @@
                 this.falsss = false
             },
             // wuduLists(id) {
-            //     console.log(id)
             //     this.http.post('/project/getDegreeList',{ 
             //         projectId: id,
             //     },
@@ -2356,7 +2409,305 @@
                 this.dialogVisible = true;
                 
             },
+            // 获取本周
+            getCurrentWeek() {
+                const currentDate = new Date()
+                const week = currentDate.getDay()
+                const millisecond = 1000 * 60 * 60 * 24
+                const minusDay = week != 0 ? week - 1 : 6
+                const monday = new Date(currentDate.getTime() - minusDay * millisecond)
+                const sunday = new Date(monday.getTime() + 6 * millisecond)
+                var stat = this.dealdate(monday)
+                var end = this.dealdate(sunday)
+                this.zhoRqi = [stat, end]
+                this.zhoRqis()
+                this.jiazai()
+            },
+            // 获取上周
+            handleGetPrevWeek() {
+                const Time = new Date(this.zhoRqi[0])
+                let weekNum = Time.getDay() 
+                weekNum = weekNum == 0 ? 7 : weekNum
+                let lastDate = new Date(Time.getTime() - weekNum * 24 * 60 * 60 * 1000)
+                let fitstDate = new Date(
+                    Time.getTime() - (weekNum + 6) * 24 * 60 * 60 * 1000
+                )
+                let startDate = `${fitstDate.getFullYear()}-${
+                    fitstDate.getMonth() + 1 < 10
+                    ? '0' + (fitstDate.getMonth() + 1)
+                    : fitstDate.getMonth() + 1
+                }-${
+                    fitstDate.getDate() < 10
+                    ? '0' + fitstDate.getDate()
+                    : fitstDate.getDate()
+                }`
+                let endDate = `${lastDate.getFullYear()}-${
+                    lastDate.getMonth() + 1 < 10
+                    ? '0' + (lastDate.getMonth() + 1)
+                    : lastDate.getMonth() + 1
+                }-${
+                    lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
+                }`
+                var stat = this.dealdate(startDate)
+                var end = this.dealdate(endDate)
+                this.zhoRqi = [stat, end]
+                this.zhoRqis()
+                this.jiazai()
+            },
+            // 获取下周
+            handleGetNextvWeek() {
+                const Time = new Date(this.zhoRqi[1])
+                let weekNum = Time.getDay()
+                weekNum = weekNum == 0 ? 7 : weekNum
+
+                let fitstDate = new Date(
+                    Time.getTime() + (7 - weekNum + 1) * 24 * 60 * 60 * 1000
+                )
+                let lastDate = new Date(
+                    Time.getTime() + (7 - weekNum + 7) * 24 * 60 * 60 * 1000
+                )
+                let startDate = `${fitstDate.getFullYear()}-${
+                    fitstDate.getMonth() + 1 < 10
+                    ? '0' + (fitstDate.getMonth() + 1)
+                    : fitstDate.getMonth() + 1
+                }-${
+                    fitstDate.getDate() < 10
+                    ? '0' + fitstDate.getDate()
+                    : fitstDate.getDate()
+                }`
+                let endDate = `${lastDate.getFullYear()}-${
+                    lastDate.getMonth() + 1 < 10
+                    ? '0' + (lastDate.getMonth() + 1)
+                    : lastDate.getMonth() + 1
+                }-${
+                    lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
+                }`
+                var stat = this.dealdate(startDate)
+                var end = this.dealdate(endDate)
+                this.zhoRqi = [stat, end]
+                this.zhoRqis()
+                this.jiazai()
+            },
+            // 加载动画 
+            jiazai() {
+                this.zhoLoading = true
+                var that = this
+                setTimeout(() =>{
+                    that.zhoLoading = false
+                },1000);
+            },
+            // 转时间格式
+            dealdate(date) {
+                const dt = new Date(date)
+                const y = dt.getFullYear()
+                const m = (dt.getMonth() + 1 + '').padStart(2, '0')
+                const d = (dt.getDate() + '').padStart(2, '0')
+                return `${y}-${m}-${d}`
+            },
+            // 按周填报
+            fillInReportss() {
+                this.jiazai()
+                this.diasZho = true
+                this.getCurrentWeek()
+            },
+            zhoTimes(item, i, ims, event) {
+                var iss = i
+                if(item.time == null) {
+                    return
+                } else {
+                    var zhi = this.zhoData[iss]
+                    var he = 0
+                    for(var i in zhi) {
+                        if(zhi[i].time && zhi[i].time.length > 0  && i != 'zhoDataTime' && i != 'he') {
+                            var date2 = '2021/12/12 ' + zhi[i].time[1] +':00'
+                            var date1 = '2021/12/12 ' + zhi[i].time[0] +':00'
+                            var date3 = new Date(date2).getTime() - new Date(date1).getTime();
+                            var leave1=date3%(24*3600*1000)
+                            var hours=Math.floor(leave1/(3600*1000))
+                            var leave2=leave1%(3600*1000)
+                            var minutes=Math.floor(leave2/(60*1000))
+                            var shi = hours+'.'+ minutes
+                            he += +shi
+                        }
+                    }
+                    zhi.he = he + 'h'
+                }
+                
+            },
+            zhoRqis() {
+                this.zhoData = []
+                if(this.zhoRqi) { 
+                    var stime = this.zhoRqi[0]
+                    var etime = this.zhoRqi[1]
+                    var zhi = this.getdiffdate(stime, etime)
+                    var arrst = []
+                    for(var i in zhi) {
+                        var obj = {}
+                        obj.zhoDataTime = zhi[i]
+                        obj.he = 0
+                        for(var j in this.projectList) {
+                            var xinzhi = this.projectList[j].projectName 
+                            obj[xinzhi] = {}
+                            obj[xinzhi].time = ''
+                            obj[xinzhi].con = ''
+                        }
+                        arrst.push(obj)
+                    }
+                    this.zhoData = arrst
+                }
+            },
+            zhoZhi(res, i) {
+                var zhi = 0
+                for(var i in res) {
+                    if(i != 'zhoDataTime' && i != 'he') {
+                        zhi += +res[i]
+                    }
+                }
+                res.he = zhi
+            },
+            zhoBtn(i) {
+                // this.zhoData.split(i, 1)
+                var arr = this.zhoData
+                arr.splice(i, 1)
+            },
+            // 提交按周填报
+            zhoAdd() {
+                var zhi = this.zhoData
+                for(var i in zhi) {
+                    this.dateAr = []
+                    var alp = []
+                    var zhis = zhi[i]
+                    for(var j in zhis) {
+                        if(j != 'zhoDataTime' && j != 'he' && zhis[j].time != null && zhis[j].time != 'null' && zhis[j].time != '') {
+                            let objs = {}
+                            objs.s = zhis[j].time[0]
+                            objs.e = zhis[j].time[1]
+                            alp.push(objs)
+                        }
+                    }
+                    this.dateAr = alp
+                    if(this.dateAr.length > 0) {
+                        let trus = this.fns()
+                        if(!trus) {
+                            this.$message({
+                                message: '填写的时间段重叠',
+                                type: 'error'
+                            })
+                            return false
+                        }
+                    } else {
+                        this.$message({
+                            message: '请填写时间',
+                            type: 'error'
+                        })
+                        return false
+                    }
+                }
+                var submits = []
+                    let formData = new FormData();
+                for (var i in this.zhoData) {
+                    var zhoD = this.zhoData[i]
+                    var flgs = false
+                    for(var j in zhoD) {     
+                        if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
+                            flgs = true
+                            formData.append("degreeId", "-1");
+                            formData.append("id", '-1');
+                            for(var s in this.projectList) {
+                                if(j == this.projectList[s].projectName) {
+                                    formData.append("projectId", this.projectList[s].id);
+                                }
+                            }
+                            formData.append("subProjectId", '0');
+                            formData.append("taskId", 0);
+                            formData.append("reportTimeType", 2);
+                            formData.append("endTime", '');
+                            formData.append("startTime", '');
+                            formData.append("multiWorktime", 1);
+                            var lix = []
+                            var objjs = {}
+                            objjs.startTime = zhoD[j].time[0]
+                            objjs.endTime = zhoD[j].time[1]
+                            objjs.content = zhoD[j].con
+                            lix.push(objjs)
+                            var zhiZhi = JSON.stringify(lix)
+                            zhiZhi = zhiZhi.replace(/,/g,"@");
+                            formData.append("content", zhiZhi)
+                            formData.append("isOvertime", 0)
+                            formData.append("professionProgress", "[]")
+                            formData.append("stage", "");
+                            formData.append("createDate",zhoD.zhoDataTime)
 
+                        }
+                    }
+                }
+                    this.http.uploadFile( this.port.report.editPort, formData,
+                        res => {
+                            this.listLoading = false;
+                            if (res.code == "ok") {
+                                this.$message({
+                                    message: "填报成功",
+                                    type: "success"
+                                });
+                                this.diasZho = false
+                                this.zhoData = []
+                                this.zhoRqi = ''
+                                this.getReportList();
+                                this.getDepartment();
+                            } else {
+                                this.$message({
+                                    message: res.msg,
+                                    type: "error"
+                                });
+                            }
+                        },
+                        error => {
+                            this.listLoading = false;
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
+                        });
+                // 关闭弹窗 并 清空
+                // this.diasZho = false
+                // this.zhoData = []
+                // this.zhoRqi = ''
+            },
+            ChangeHourMinutestr (str) {
+                if (str !== "0" && str !== "" && str !== null) {
+                    return ((Math.floor(str / 60)).toString().length < 2 ? "0" + (Math.floor(str / 60)).toString() : 
+                    (Math.floor(str / 60)).toString()) + ":" + ((str % 60).toString().length < 2 ? "0" + (str % 60).toString() : (str % 60).toString());
+                } else {
+                    return "";
+                }
+            },
+            // 得到两个日期中间的日期
+            getdiffdate(stime,etime){
+                //初始化日期列表,数组
+                var diffdate = new Array();
+                var i=0;
+                //开始日期小于等于结束日期,并循环
+                while(stime<=etime){
+                    diffdate[i] = stime;
+                    
+                    //获取开始日期时间戳
+                    var stime_ts = new Date(stime).getTime();
+                    
+                    //增加一天时间戳后的日期
+                    var next_date = stime_ts + (24*60*60*1000);
+                    
+                    //拼接年月日,这里的月份会返回(0-11),所以要+1
+                    var next_dates_y = new Date(next_date).getFullYear()+'-';
+                    var next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
+                    var next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
+            
+                    stime = next_dates_y+next_dates_m+next_dates_d;
+                    
+                    //增加数组key
+                    i++;
+                }
+                return diffdate;
+            },
             // 添加模块
             addDomain(i) {
                 var leftProgress = 10;
@@ -2482,7 +2833,6 @@
                                 }
                             }
                             this.dateAr = alp
-                            console.log(this.dateAr, '123456')
                             if(this.dateAr.length > 0) {
                                 let trus = this.fns()
                                 if(!trus) {
@@ -2641,7 +2991,6 @@
                                 }
                                 let m = JSON.stringify(this.workForm.domains[i].worktimeList);
                                 m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
-                                console.log(m);
                                 formData.append("content", m);
                             } else {
                                 if (this.workForm.domains[i].content == null || this.workForm.domains[i].content == '') {
@@ -2695,11 +3044,8 @@
                                 formData.append("stage", "");
                             }
                         }
-                        // console.log(formData, '看看数据')
                         // formData.forEach((value, key) => {
-                        //     console.log("%s=%s", key, value);
                         //     })
-                        // console.log(this.workForm, '这里是数据')
                         // return
                         this.http.uploadFile( this.port.report.editPort, formData,
                         res => {
@@ -2736,7 +3082,6 @@
             },
             // 判断是展示那个工时导入
             imports() {
-                console.log(this.user.timeType.syncCorpwxTime)
                 if(this.user.timeType.syncCorpwxTime == 0) {
                     this.importDialog = true
                 } else {
@@ -2999,4 +3344,13 @@
         display: inline-block;
         width: 380px;
     }
+    .zhiss {
+        display: flex;
+        justify-content: space-around;
+        align-items: center;
+    }
+    .zhoFel {
+        display: flex;
+        justify-content: space-between;
+    }
 </style>

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -92,6 +92,7 @@
                     });
                 } 
             } else if (this.user.role == 1 || this.user.role == 2 || this.user.role == 5){
+            // } else if (this.user.role == 1 || this.user.role == 2){
                 if (this.user.company.packageEngineering == 1) {
                     this.routers.push(
                     {