|
@@ -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>
|