Browse Source

修改请假管理Bug

Lijy 3 years ago
parent
commit
2d2e9a0db6

+ 34 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -22,6 +22,7 @@
               <el-menu-item index="1-4"><p @click="ssl(3)">项目收支平衡表</p></el-menu-item>
               <el-menu-item index="1-5" v-if="user.company.packageCustomer == 1"><p @click="ssl(4)">客户项目利润表</p></el-menu-item>
               <el-menu-item index="1-6"><p @click="ssl(5)">项目阶段工时表</p></el-menu-item>
+              <!-- <el-menu-item index="1-7"><p @click="ssl(6)">加班情况统计</p></el-menu-item> -->
             </el-submenu>
           </el-menu>
       </el-col>
@@ -269,6 +270,11 @@
                  
                 </el-table-column>
             </el-table>
+
+            <!-- 项目加班情况统计报表 -->
+            <div v-if="ins == 6">
+              <el-table></el-table>
+            </div>
         <!--工具条-->
         <el-col :span="24" class="toolbar">
             <el-pagination
@@ -460,6 +466,8 @@ export default {
                     this.getCustomerProjectInAndOut();
                 } else if (this.ins == 5) {
                     this.getProjectStages();
+                } else if (this.ins == 6) {
+                    this.overTime()
                 }
             },
       exportExcel() {
@@ -565,6 +573,32 @@ export default {
             });
         });
     },
+    overTime() {
+      this.listLoading = true;
+      this.http.post('/project/getOvertimeList', {
+                    projectId: '',
+                    startDate: '2021-12-01',
+                    endDate: '2021-12-13',
+                    pageIndex: this.page,
+                    pageSize: this.size,
+                    },
+        res => {
+            if (res.code == "ok") {
+                console.log(res, '打印出来的数据')
+            } else {
+                this.$message({
+                message: res.msg,
+                type: "error"
+                });
+            }
+        },
+        error => {
+            this.$message({
+                message: error,
+                type: "error"
+            });
+        });
+    },
     getAllProjectCost() {
       this.listLoading = true;
       this.http.post('/project/getAllProjectCost', {

+ 6 - 6
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -24,14 +24,14 @@
           <el-submenu index="2" v-if="user.role != 0">
             <template slot="title">
               <i class="iconfont firerock-iconbaoxiaodan"></i>
-              <span>{{user.role == 0?"我的报销单据":"报销单据列表"}}</span>
+              <span>{{user.role == 0?"我的报销凭证":"报销凭证列表"}}</span>
             </template>
             <el-menu-item index="2-1" ><p @click="bills(false)" >单据列表</p></el-menu-item>
             <el-menu-item index="2-2" ><p @click="bills(true)">单据审核</p></el-menu-item>
           </el-submenu>
             <el-menu-item index="3" @select="bills" @click="bills(false)" v-if="user.role == 0">
               <i class="iconfont firerock-iconbaoxiaodan"></i>
-              <span slot="title">{{user.role == 0?"我的报销单据":"报销单据列表"}}</span>
+              <span slot="title">{{user.role == 0?"我的报销凭证":"报销凭证列表"}}</span>
             </el-menu-item>
           </el-menu>
            <!-- <el-menu
@@ -44,7 +44,7 @@
           style="width:100%">
             <el-menu-item index="2" @select="bills">
               <i class="iconfont firerock-iconbaoxiaodan"></i>
-              <span slot="title">报销单据列表</span>
+              <span slot="title">报销凭证列表</span>
             </el-menu-item>
           </el-menu> -->
       </el-col>
@@ -276,7 +276,7 @@
       </div>
   </div>
     <!-- 我的单据报销展示 -->
-      <el-dialog title="报销单据详情" :visible.sync="dialog" width="1000px">
+      <el-dialog title="报销凭证详情" :visible.sync="dialog" width="1000px">
         <!-- 内容主体 -->
         <div class="informant"><!--  报销人 -->
           <el-form :model="ParticularsList" label-width="80px">
@@ -382,7 +382,7 @@
                 <span v-else>{{scope.row.remark}}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="pic" label="报销单据" width="300">
+            <el-table-column prop="pic" label="报销凭证" width="300">
               <template slot-scope="scope">
                 <div v-if="!flg">
                   <div @click="abl(scope.$index)" style="height: 35px;overflow: hidden;">
@@ -1221,7 +1221,7 @@ export default {
   width: 190px;
 }
 
-/* 我的报销单据 */
+/* 我的报销凭证 */
 .search {
   position: relative;
   top: 20px;

+ 89 - 17
fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

@@ -44,7 +44,7 @@
   <div class="contents">
     <div v-if="!displayTable" class="headine" ref="headine">
       <h3 ref="headHe" style="padding-left: 220px">{{shuz[ins]}}</h3>
-      <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits('addFormRules')" size="mini">提交</el-button></p>
+      <!-- <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits('addFormRules')" size="mini">提交</el-button></p> -->
     </div>
     <!-- 上面部分 -->
     <div v-if="!displayTable && apk == false" class="tops">
@@ -63,7 +63,7 @@
                 </el-form-item>
                 <!-- 电话 -->
                 <el-form-item label="电话" prop="tel">
-                    <el-input v-model="addForm.tel" style="width: 250px" placeholder="请输入手机号"></el-input>
+                    <el-input ref="ipts" v-model="addForm.tel" placeholder="请输入手机号" style="width: 250px"></el-input>
                 </el-form-item>
                 <!-- 单选 -->
                 <el-form-item>
@@ -87,13 +87,15 @@
                     </el-col>
                 </el-form-item>
                 <!-- 请假天数 -->
-                <el-form-item :label="flg ? '请假天数' : '请假时长'" style="margin-right: 500px">
+                <el-form-item :label="flg ? '请假天数' : '请假时长'" prop="timeDays" style="margin-right: 500px">
                    <!-- {{flg ? addForm.timeDays : addForm.timeHours}}{{flg ? '天' : '小时'}} -->
-                   <div v-if="flg">{{addForm.timeDays}} 天</div>
+                   <!-- <div v-if="flg">{{addForm.timeDays}} 天</div> -->
+                   <div v-if="flg"> <el-input v-model="addForm.timeDays" @blur="inputs()" @input="addForm.timeDays=addForm.timeDays.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> 天</div>
                    <div v-else>
-                     <el-select  v-model="addForm.timeHours" placeholder="请假时长" @change="chanSele()">
+                     <!-- <el-select  v-model="addForm.timeHours" placeholder="请假时长" @change="chanSele()">
                         <el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
-                      </el-select>小时
+                      </el-select>小时 -->
+                      <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeDays=addForm.timeDays.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> 小时
                    </div>
                 </el-form-item>
                 <!-- 备注 -->
@@ -101,6 +103,10 @@
                     <el-input type="textarea" v-model="addForm.remark" :rows="5" style="width: 50%"></el-input>
                 </el-form-item>
             </el-form>
+
+            <div>
+              <p style="margin-left: 75px"><el-button type="primary" @click="submits('addFormRules')" size="mini">提交</el-button></p>
+            </div>
         </div>
     </div>
 
@@ -206,7 +212,7 @@
             </div>
           </div>
           <div style="margin-top: 30px">
-            <el-table v-loading="loading" :data="statisticalList" height="100%" style="width: 100%">
+            <el-table v-loading="loading" :data="statisticalList" height="780px" style="width: 100%">
               <el-table-column prop="ownerName" label="姓名" width="300">
                 <template slot-scope="scope">
                     <div v-if="scope.row.ownerName">
@@ -237,6 +243,7 @@
 </template>
 
 <script>
+import { config } from 'dingtalk-jsapi';
 export default {
   name: "expense",
   components: {},
@@ -255,10 +262,22 @@ export default {
             }
         }
     };
+    var checks = (rule, value, callback) => {
+      if (!value) {
+            return callback(new Error('请假天数不能为空'));
+        } else {
+            if (value > this.timeChoose) {
+              return callback(new Error('不能超过当前选择的日期'));
+            } else {
+              callback();
+            }
+        }
+    };
     return {
       addFormRules: {
         ownerId: [{ required: true, message: "请选择报销人", trigger: "blur" }],
-        tel: [{required: true, validator: checkTel, trigger: 'blur'}]
+        tel: [{required: true, validator: checkTel, trigger: 'blur'}],
+        timeDays: [{required: true, validator: checks, trigger: 'blur'}]
       },
       user: JSON.parse(sessionStorage.getItem("user")),
       shuz: ['事假填报', '病假填报', '年假填报', '产假填报'],
@@ -270,7 +289,8 @@ export default {
         timeDays: 1,
         leaveType: 0,
         // indate: this.getCurrentTime(),
-        timeHours: '8'
+        timeHours: '8',
+        tel: ''
       },
       displayTable: false,
       users: [], // 人员信息
@@ -300,10 +320,11 @@ export default {
       total:0,
       apk: false,
       keyword: '',
-      statData: this.getCurrentTime(),
+      statData: this.getCurrentTimes(),
       endData: this.getCurrentTime(),
       statisticalList: [],
-      loading: false
+      loading: false,
+      timeChoose: 1,
     };
   },
   computed: {},
@@ -471,8 +492,6 @@ export default {
         });
     },
     selts() {
-      console.log(this.addForm.ownerId)
-      console.log(this.users)
       for(var i in this.users) {
         if(this.users[i].id == this.addForm.ownerId) {
           this.addForm.tel = this.users[i].phone
@@ -499,7 +518,9 @@ export default {
     },
     // 计算日期
     datas() {
-        this.addForm.timeDays = this.DateDiff(this.addForm.startDate, this.addForm.endDate)
+        // this.addForm.timeDays = this.DateDiff(this.addForm.startDate, this.addForm.endDate)
+        this.addForm.timeDays = this.countWorkDay(this.addForm.startDate, this.addForm.endDate)
+        this.timeChoose = this.addForm.timeDays
         this.addForm.timeHours = this.addForm.timeDays * 8
     },
     datasss() {
@@ -515,6 +536,23 @@ export default {
        iDays  =  parseInt(Math.abs(oDate1  -  oDate2)  /  1000  /  60  /  60  /24)
        return  iDays + 1
     },
+    stringToDate(dateString){
+        dateString = dateString.split('-');
+        return new Date(dateString[0], dateString[1] - 1, dateString[2]);
+    },
+    countWorkDay(date1, date2){
+        date1 = this.stringToDate(date1);
+        date2 = this.stringToDate(date2);
+        var delta = (date2 - date1) / (1000 * 60 * 60 * 24) + 1; // 计算出总时间
+        var weeks = 0;
+        for(var i = 0; i < delta; i++){
+            if(date1.getDay() == 0 || date1.getDay() == 6) weeks ++;  // 若为周六或周天则加1
+            date1 = date1.valueOf();
+            date1 += 1000 * 60 * 60 * 24;
+            date1 = new Date(date1);
+        }
+        return delta - weeks;
+    },
     // 时间
     getTadeTime() {
         var time = new Date();
@@ -526,7 +564,15 @@ export default {
       let yy = new Date().getFullYear();
       let mm = new Date().getMonth()+1;
       let dd = new Date().getDate();
-      _this.gettime = yy+'-'+mm+'-'+dd;
+      _this.gettime = yy +'-'+ mm +'-'+ dd;
+       return  _this.gettime
+    },
+    getCurrentTimes() {
+        var _this = this;
+      let yy = new Date().getFullYear();
+      let mm = new Date().getMonth()+1;
+      let dd = new Date().getDate();
+      _this.gettime = yy+'-'+mm+'-'+'01';
        return  _this.gettime
     },
     chanSele() {
@@ -536,7 +582,7 @@ export default {
       this.size = val;
       this.bills()
     },
-    handleCurrentChange(val){
+    handleCurrentChange(val) {
       console.log(val, 1, '1')
       this.page =  val;
       this.bills()
@@ -566,7 +612,33 @@ export default {
                 type: "error"
             });
         });
-    }
+    },
+    //
+    inputs() {
+      var str = this.addForm.timeDays + ''
+      if(str.indexOf('.') != '-1') {
+        var s = str.split('.')[0]
+        var st = str.split('.')[1]
+        var sts = st.split('')
+        this.addForm.timeDays = s + '.' + sts[0]
+      }
+    },
+    inputss() {
+      if(this.addForm.timeHours < 0) {
+        this.addForm.timeHours = 1
+      } else if(this.addForm.timeHours > 8) {
+        this.addForm.timeHours = 8
+      } else {
+        var str = this.addForm.timeHours
+        console.log(str)
+        if(str.indexOf('.') != '-1') {
+        var s = str.split('.')[0]
+        var st = str.split('.')[1]
+        var sts = st.split('')
+        this.addForm.timeHours = s + '.' + sts[0]
+      }
+      }
+    },
   }
 };
 </script>