日期计算

This commit is contained in:
史宗金 2025-01-20 17:24:10 +08:00
parent 11a9d5db54
commit ef5f6da7e4
1 changed files with 15 additions and 4 deletions

View File

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