瀏覽代碼

修复请假模块已知问题

Lijy 3 年之前
父節點
當前提交
0d06008129

+ 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.17'
+// var ip = '47.100.37.243'
+var ip = '192.168.2.17'
 
 // var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
 // for (var i in ifaces) {

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

@@ -92,10 +92,7 @@
                    <!-- <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-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
-                      </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> 小时
+                      <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeHours=addForm.timeHours.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> 小时
                    </div>
                 </el-form-item>
                 <!-- 备注 -->
@@ -150,9 +147,9 @@
             </div>
           </div>
             <el-table v-loading="loading" :data="tableData" style="width: 100%" height="90%">
-                <el-table-column prop="ownerName" label="请假人" width="180"></el-table-column>
-                <el-table-column prop="tel" label="电话" width="180"></el-table-column>
-                <el-table-column prop="leaveType" label="请假类型" width="180">
+                <el-table-column prop="ownerName" label="请假人" width="120"></el-table-column>
+                <el-table-column prop="tel" label="电话" width="120"></el-table-column>
+                <el-table-column prop="leaveType" label="请假类型" width="120">
                   <template slot-scope="scope">
                     <div v-if="scope.row.leaveType == 0">事假</div>
                     <div v-if="scope.row.leaveType == 1">病假</div>
@@ -160,8 +157,8 @@
                     <div v-if="scope.row.leaveType == 3">产假</div>
                   </template>
                 </el-table-column>
-                <el-table-column prop="startDate" label="请假开始时间" width="180"></el-table-column>
-                <el-table-column prop="endDate" label="请假结束时间" width="180"></el-table-column>
+                <el-table-column prop="startDate" label="请假开始时间" width="150"></el-table-column>
+                <el-table-column prop="endDate" label="请假结束时间" width="150"></el-table-column>
                 <el-table-column label="请假天数" width="120">
                   <template slot-scope="scope">
                     <div>{{scope.row.timeDays}}天</div>
@@ -329,10 +326,7 @@
            <!-- <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-option v-for="(item, index) in options" :key="index" :label="item" :value="item"></el-option>
-              </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> 小时
+              <el-input v-model="addForm.timeHours" @blur="inputss()" @input="addForm.timeHours=addForm.timeHours.replace(/[^\d.]/g,'')" style="width: 100px; margin-right: 20px;"></el-input> 小时
            </div>
         </el-form-item>
         <!-- 备注 -->
@@ -374,7 +368,7 @@ export default {
             return callback(new Error('请假天数不能为空'));
         } else {
             if (value > this.timeChoose) {
-              return callback(new Error('不能超过当前选择日期'));
+              return callback(new Error('超过当前选择日期的天数'));
             } else {
               callback();
             }
@@ -382,7 +376,7 @@ export default {
     };
     return {
       addFormRules: {
-        ownerId: [{ required: true, message: "请选择报销人", trigger: "blur" }],
+        ownerId: [{ required: true, message: "请选择请假人", trigger: "blur" }],
         tel: [{required: true, validator: checkTel, trigger: 'blur'}],
         timeDays: [{required: true, validator: checks, trigger: 'blur'}]
       },
@@ -395,8 +389,9 @@ export default {
         endDate: this.getCurrentTime(),
         timeDays: 1,
         leaveType: 0,
+        ownerId: '',
         // indate: this.getCurrentTime(),
-        timeHours: '8',
+        timeHours: 8,
         tel: '',
         remark: ''
       },
@@ -656,6 +651,8 @@ export default {
         });
     },
     submits(){
+      console.log(this.addForm)
+      // return
         this.$refs.addForm.validate(valid => {
           if (valid) {
             this.http.post('/leave-sheet/add', this.addForm,
@@ -672,7 +669,7 @@ export default {
                     this.addForm.leaveType = 0
                     this.addForm.timeHours = 8
                     this.addForm.remark = ''
-
+                    this.flg = true
                 } else {
                     this.$message({
                       message: res.msg,
@@ -699,7 +696,6 @@ export default {
       }
     },
     chanRadio() {
-      console.log(1234)
       console.log(this.addForm.timeType)
         if(this.addForm.timeType == '0') {
             this.flg = true
@@ -713,7 +709,8 @@ export default {
             this.addForm.startDate = this.getCurrentTime()
             this.addForm.endDate = this.getCurrentTime()
             this.addForm.timeType = '1'
-            this.addForm.timeHours = '1'
+            this.addForm.timeHours = 1,
+            this.addForm.timeDays = 1
         }
     },
     // 计算日期
@@ -827,20 +824,23 @@ export default {
       }
     },
     inputss() {
-      if(this.addForm.timeHours < 0) {
+      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]
-      }
+        if(this.addForm.timeHours.indexOf('.') != '-1') {
+          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]
+          }
+        }
       }
+      console.log(this.addForm)
     },
     deletes(e) {
       this.$confirm("确认要删除吗?", "提示", {