日期计算

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> </template>
<script> <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' import RecordList from '../../pages/evection/recordList.vue'
export default { export default {
components: { components: {
@ -384,9 +384,20 @@
return return
} }
// let dateData = {
const duration = Math.round((end - start) / (1000 * 60 * 60 * 24)) startTime: startDate,
this.formData.leaveDuration = duration + 1 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) { onApprovalChange(e) {
this.formData.isAgree = e.detail.value this.formData.isAgree = e.detail.value