Lijy 3 سال پیش
والد
کامیت
a539f67180

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet/config/index.js

@@ -4,8 +4,8 @@ var path = require('path')
 // var ip = '192.168.2.36'
 
  
-// var ip = '47.100.37.243'
-var ip = '192.168.2.105'
+var ip = '47.100.37.243'
+// var ip = '192.168.2.105'
 
 // var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
 

+ 69 - 12
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -466,10 +466,16 @@
                      <el-button @click="handleGetPrevWeek()">上周</el-button>
                      <el-button @click="getCurrentWeek()">本周</el-button>
                      <el-button @click="handleGetNextvWeek()">下周</el-button>
+                     <el-button @click="newDates()">新增日期</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">
+                <el-table :data="zhoData" style="width: 100%" v-loading="zhoLoading">
+                    <el-table-column fixed="left" prop="zhoDataTime" label="日期" width="160">
+                        <template slot-scope="scope">
+                            {{scope.row.zhoDataTime}}({{scope.row.zhoDataTime | zhoData}})
+                        </template>
+                    </el-table-column>
+                    <!-- <el-table-column align="center" v-for="(item, index) in projectList" :key="item.id" :label="item.projectName" width="200"> -->
+                    <el-table-column align="center" v-for="(item, index) in projectList" :key="item.id" :label="item.projectName" width="200" v-if="index < changdu">
                         <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">
@@ -480,7 +486,7 @@
                                     </div>
                                     <div class="zhoFel" v-if="reportTimeType.type == 1">
                                         <p>选择时长</p>
-                                        <el-select v-model="scope.row[item.projectName].workingTime" style="width: 355px;" placeholder="请选择工作时长" @change="zhoXuan(scope.row[item.projectName], scope.$index, index)">
+                                        <el-select clearable v-model="scope.row[item.projectName].workingTime" style="width: 355px;" placeholder="请选择工作时长" @change="zhoXuan(scope.row[item.projectName], scope.$index, index)">
                                             <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
                                         </el-select>
                                     </div>
@@ -494,7 +500,7 @@
                                     </div>
                                     <div class="zhoFel">
                                         <p>工作事项</p>
-                                        <el-input type="textarea" v-model="scope.row[item.projectName].con" placeholder="请输入工作事项" style="width: 355px"></el-input>
+                                        <el-input type="textarea" v-model="scope.row[item.projectName].con" placeholder="请输入工作事项" style="width: 355px" clearable></el-input>
                                     </div>
                                 </div>
                                 <div v-if="reportTimeType.multiWorktime == 0" slot="reference">
@@ -511,11 +517,11 @@
                             </el-popover>
                         </template>
                     </el-table-column>
-                    <el-table-column fixed="right" prop="he" label="合计" width="120">
+                    <el-table-column fixed="right" prop="he" label="合计(h)" 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>
+                                <el-button size="mini" icon="el-icon-delete" circle @click="zhoBtn(scope.$index)"></el-button>
                             </div>
                         </template>
                     </el-table-column>
@@ -916,7 +922,8 @@
                 zhoData: [],
                 zhoRqi: [],
                 btnZho: false,
-                zhoLoading: false
+                zhoLoading: false,
+                changdu: 6
             };
         },
         filters: {
@@ -927,6 +934,12 @@
                 }
                 var zhi = +value + 0
                 return zhi.toFixed(1)
+            },
+            // zhoData
+            zhoData(value) {
+                var dateArray = value.split("-");
+                var date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
+                return "周" + "日一二三四五六".charAt(date.getDay());
             }
         },
         methods: {
@@ -2440,9 +2453,9 @@
                 const currentDate = new Date()
                 const week = currentDate.getDay()
                 const millisecond = 1000 * 60 * 60 * 24
-                const minusDay = week != 0 ? week - 1 : 6
+                const minusDay = week != 0 ? week - 1 : 4
                 const monday = new Date(currentDate.getTime() - minusDay * millisecond)
-                const sunday = new Date(monday.getTime() + 6 * millisecond)
+                const sunday = new Date(monday.getTime() + 4 * millisecond)
                 var stat = this.dealdate(monday)
                 var end = this.dealdate(sunday)
                 this.zhoRqi = [stat, end]
@@ -2475,7 +2488,8 @@
                     lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
                 }`
                 var stat = this.dealdate(startDate)
-                var end = this.dealdate(endDate)
+                var ends = this.dealdate(endDate)
+                var end = this.dateChange(-2, ends)
                 this.zhoRqi = [stat, end]
                 this.zhoRqis()
                 this.jiazai()
@@ -2509,11 +2523,50 @@
                     lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
                 }`
                 var stat = this.dealdate(startDate)
-                var end = this.dealdate(endDate)
+                var ends = this.dealdate(endDate)
+
+                var end = this.dateChange(-2, ends)
                 this.zhoRqi = [stat, end]
                 this.zhoRqis()
                 this.jiazai()
             },
+            // 新增日期
+            newDates() {
+                console.log(this.zhoRqi, '看卡')
+                this.zhoRqi[1] = this.dateChange(1, this.zhoRqi[1])
+                console.log(this.zhoRqi[1])
+                var obj = {}
+                obj.zhoDataTime = this.zhoRqi[1]
+                obj.he = 0
+                for(var j in this.projectList) {
+                    var xinzhi = this.projectList[j].projectName 
+                    obj[xinzhi] = {}
+                    obj[xinzhi].time = ''
+                    obj[xinzhi].con = ''
+                    obj[xinzhi].progress = 0
+                    obj[xinzhi].workingTime = 0
+                }
+                this.zhoData.push(obj)
+            },
+            // 减去时间
+            dateChange(num = 1,date = false) {
+              if (!date) {
+                date = new Date();//没有传入值时,默认是当前日期
+                date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
+              }
+              date += " 00:00:00";//设置为当天凌晨12点
+              date = Date.parse(new Date(date))/1000;//转换为时间戳
+              date += (86400) * num;//修改后的时间戳
+              var newDate = new Date(parseInt(date) * 1000);//转换为时间
+                var nian = newDate.getFullYear()
+                var yue = ''
+                var ri = ''
+                var yues = (newDate.getMonth() + 1)
+                var ris = newDate.getDate()
+                yues > 9 ? yue = yues : yue = '0' + yues
+                ris > 9 ? ri = ris : ri = '0' + ris
+                return nian +'-'+yue+'-'+ri
+            },
             // 加载动画 
             jiazai() {
                 this.zhoLoading = true
@@ -2532,10 +2585,14 @@
             },
             // 按周填报
             fillInReportss() {
+                window.addEventListener('scroll', this.handleScroll, true)
                 this.jiazai()
                 this.diasZho = true
                 this.getCurrentWeek()
             },
+            handleScroll() {
+                this.changdu = this.projectList.length + 1
+            },
             // 自动选择时间点的事件
             zhoTimes(item, i, ims, event) {
                 var iss = i