Files
JayuCloud/JY-Salon-Front/src/views/LeaveManagementView.vue
T
2026-06-29 23:26:43 +08:00

43 lines
1.4 KiB
Vue

<template>
<MobileShell title="请假管理">
<section class="card form-card">
<div class="field"><label class="required">请假日期</label><input v-model="form.workDate" type="date" /></div>
<div class="field"><label>原因</label><input v-model.trim="form.reason" placeholder="请输入请假原因" /></div>
</section>
<button class="primary-btn section" type="button" :disabled="saving" @click="saveLeave">{{ saving ? '保存中...' : '保存请假' }}</button>
</MobileShell>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import MobileShell from '@/components/MobileShell.vue'
import { managerEmployeesApi } from '@/api/managerEmployees'
import { formatDate } from '@/utils/date'
import { useToastStore } from '@/stores/toast'
const route = useRoute()
const toast = useToastStore()
const saving = ref(false)
const form = reactive({ workDate: formatDate(new Date()), reason: '' })
const saveLeave = async (): Promise<void> => {
if (!form.workDate) {
toast.error('请选择日期后保存')
return
}
saving.value = true
try {
await managerEmployeesApi.saveScheduleException({
artistId: String(route.params.id),
workDate: form.workDate,
status: 0,
reason: form.reason
})
toast.success('请假已保存')
} finally {
saving.value = false
}
}
</script>