|
@@ -68,7 +68,7 @@
|
|
|
</van-cell-group>
|
|
|
</van-form>
|
|
|
</card>
|
|
|
- <card title="详情信息">
|
|
|
+ <card title="请假时间信息">
|
|
|
<template #right>
|
|
|
<button class="add_btn" @click="popupShow = true">新增</button>
|
|
|
</template>
|
|
@@ -90,17 +90,19 @@
|
|
|
</card>
|
|
|
</flow-form>
|
|
|
<van-popup class="detail-popup" v-model:show="popupShow" position="bottom">
|
|
|
- <h4 class="title">详细信息新增</h4>
|
|
|
+ <h4 class="title">新增请假时间</h4>
|
|
|
<van-cell-group inset>
|
|
|
<date-time-range
|
|
|
label="起始时间"
|
|
|
v-model="detailData.startTime"
|
|
|
placeholder="请选择起始时间"
|
|
|
+ @change="startTimeChange"
|
|
|
/>
|
|
|
<date-time-range
|
|
|
label="截止时间"
|
|
|
v-model="detailData.endTime"
|
|
|
placeholder="请选择截止时间"
|
|
|
+ @change="endTimeChange"
|
|
|
/>
|
|
|
<van-field
|
|
|
v-model="detailData.bz1"
|
|
@@ -128,6 +130,7 @@ import DateTimeRange from '@/components/dateTimeRange.vue';
|
|
|
import FlowForm from '@/components/flowForm.vue';
|
|
|
import Card from '@/components/card.vue';
|
|
|
import CardCell from '@/components/cardCell.vue';
|
|
|
+import { showSuccessToast, showFailToast } from 'vant';
|
|
|
|
|
|
const popupShow = ref<boolean>(false)
|
|
|
const route = useRoute();
|
|
@@ -235,7 +238,7 @@ const initFormData= async () => {
|
|
|
}
|
|
|
|
|
|
/** 细节数据保存 */
|
|
|
-const saveHandle = () => {
|
|
|
+const saveHandle = async () => {
|
|
|
detailData.value.leaveId = formData.value.id
|
|
|
formData.value.leaveTimeCreateList.push(detailData.value)
|
|
|
detailData.value = {
|
|
@@ -244,6 +247,32 @@ const saveHandle = () => {
|
|
|
endTime: '',
|
|
|
bz1: ''
|
|
|
}
|
|
|
+ const prarms: Object[] = []
|
|
|
+ formData.value.leaveTimeCreateList.forEach((x:any)=>{
|
|
|
+ const startTime = Date.parse(x.startTime)
|
|
|
+ const endTime = Date.parse(x.endTime)
|
|
|
+ const obj = new Object({
|
|
|
+ startTime: startTime,
|
|
|
+ endTime: endTime
|
|
|
+ })
|
|
|
+ prarms.push(obj)
|
|
|
+ })
|
|
|
+ const result = await reqest.post(`/business/Leave/getLeaveDays`,prarms)
|
|
|
+ if(result.data){
|
|
|
+ const totalMin = result.data;
|
|
|
+ const totalHours = totalMin / 60;
|
|
|
+ const totalDays = Math.floor(totalHours/7.5);
|
|
|
+ const subHours = totalHours%7.5;
|
|
|
+ let leaveDaysText = '';
|
|
|
+ if(totalDays>0){
|
|
|
+ leaveDaysText += totalDays + '天'
|
|
|
+ }
|
|
|
+ if(subHours>0){
|
|
|
+ leaveDaysText += subHours + '小时'
|
|
|
+ }
|
|
|
+ formData.value.leaveDays = leaveDaysText
|
|
|
+ formData.value.leaveHours = totalHours
|
|
|
+ }
|
|
|
popupShow.value=false
|
|
|
}
|
|
|
|
|
@@ -258,6 +287,20 @@ const detailView = (index:number,item:any) =>{
|
|
|
const detailDelte = (index:number) =>{
|
|
|
formData.value.leaveTimeCreateList.splice(index,1)
|
|
|
}
|
|
|
+/** 起始时间变化事件 */
|
|
|
+const startTimeChange = (value:string) =>{
|
|
|
+ if(Date.parse(value)>Date.parse(detailData.value.endTime)){
|
|
|
+ showFailToast('起始时间不能大于开始时间!')
|
|
|
+ detailData.value.startTime=''
|
|
|
+ }
|
|
|
+}
|
|
|
+/** 截止时间变化事件 */
|
|
|
+const endTimeChange = (value:string) =>{
|
|
|
+ if(Date.parse(value)<Date.parse(detailData.value.startTime)){
|
|
|
+ showFailToast('截止时间不能小于开始时间!')
|
|
|
+ detailData.value.endTime=''
|
|
|
+ }
|
|
|
+}
|
|
|
/** 初始化 */
|
|
|
onMounted(() => {
|
|
|
initFormData()
|