日期计算
This commit is contained in:
parent
11a9d5db54
commit
ef5f6da7e4
|
|
@ -258,7 +258,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getPersonSelect, addEvection, getTravelPersonSelect } from '../../api/index.js'
|
||||
import { getPersonSelect, addEvection, getTravelPersonSelect, getDays } from '../../api/index.js'
|
||||
import RecordList from '../../pages/evection/recordList.vue'
|
||||
export default {
|
||||
components: {
|
||||
|
|
@ -384,9 +384,20 @@
|
|||
return
|
||||
}
|
||||
|
||||
// 计算出差时长(天数差)
|
||||
const duration = Math.round((end - start) / (1000 * 60 * 60 * 24))
|
||||
this.formData.leaveDuration = duration + 1
|
||||
let dateData = {
|
||||
startTime: startDate,
|
||||
endTime: endDate
|
||||
}
|
||||
if (startDate!=null && startDate!=='' && endDate!=null && endDate!=='') {
|
||||
getDays(dateData).then(response => {
|
||||
if (response.status === 200) {
|
||||
console.log(response)
|
||||
this.formData.leaveDuration=response.data
|
||||
} else {
|
||||
this.formData.leaveDuration=''
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onApprovalChange(e) {
|
||||
this.formData.isAgree = e.detail.value
|
||||
|
|
|
|||
Loading…
Reference in New Issue