| | |
| | | <el-button type="primary" @click="addAttendanceRecord">æ°å¢è®°å½</el-button> |
| | | </div> |
| | | </template> |
| | | <el-table :data="attendanceData" style="width: 100%"> |
| | | <el-table :data="attendanceData" style="width: 100%" :loading="tableLoading"> |
| | | <el-table-column prop="date" label="æ¥æ" /> |
| | | <el-table-column prop="checkIn" label="ç¾å°æ¶é´" /> |
| | | <el-table-column prop="checkOut" label="ç¾éæ¶é´" /> |
| | |
| | | <el-table-column label="æä½" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" @click="editAttendanceRecord(scope.row)">ç¼è¾</el-button> |
| | | <el-button size="small" type="danger" @click="deleteAttendanceRecord(scope.$index)">å é¤</el-button> |
| | | <el-button size="small" type="danger" @click="deleteAttendanceRecord(scope.row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>èªèµåæ¥è¯¢</span> |
| | | <el-date-picker v-model="salaryMonth" type="month" placeholder="éæ©æä»½" /> |
| | | <el-date-picker v-model="payDateStr" type="month" placeholder="éæ©æä»½" value-format="YYYY-MM" format="YYYY-MM" @change="changMonth"/> |
| | | </div> |
| | | </template> |
| | | <el-table :data="salaryData" style="width: 100%"> |
| | | <el-table-column prop="month" label="æä»½" /> |
| | | <el-table-column prop="payDate" label="æä»½" /> |
| | | <el-table-column prop="basicSalary" label="åºæ¬å·¥èµ" /> |
| | | <el-table-column prop="bonus" label="å¥é" /> |
| | | <el-table-column prop="deduction" label="æ£æ¬¾" /> |
| | | <el-table-column prop="total" label="å®åå·¥èµ" /> |
| | | <el-table-column prop="actualWages" label="å®åå·¥èµ" /> |
| | | <el-table-column prop="status" label="ç¶æ" > |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.status === '已忾' ? 'success' : 'warning'"> |
| | |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>åæç³è¯·ç®¡ç</span> |
| | | <el-button type="primary" @click="showLeaveDialog = true">ç³è¯·åæ</el-button> |
| | | <el-button type="primary" @click="openLeaveForm">ç³è¯·åæ</el-button> |
| | | </div> |
| | | </template> |
| | | <el-table :data="leaveData" style="width: 100%"> |
| | |
| | | <el-table-column label="æä½" width="150"> |
| | | <template #default="scope"> |
| | | <el-button size="small" @click="editLeaveRecord(scope.row)">ç¼è¾</el-button> |
| | | <el-button size="small" type="danger" @click="deleteLeaveRecord(scope.$index)">å é¤</el-button> |
| | | <el-button size="small" type="danger" @click="deleteLeaveRecord(scope.row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <template #header> |
| | | <div class="card-header"> |
| | | <span>个人信æ¯ç»´æ¤</span> |
| | | <el-button type="primary" @click="editProfile = true">ç¼è¾ä¿¡æ¯</el-button> |
| | | <el-button type="primary" @click="editProfileForm">ç¼è¾ä¿¡æ¯</el-button> |
| | | </div> |
| | | </template> |
| | | <el-descriptions :column="2" border> |
| | |
| | | <el-descriptions-item label="å
¥èæ¥æ">{{ profile.hireDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="èç³»çµè¯">{{ profile.phone }}</el-descriptions-item> |
| | | <el-descriptions-item label="é®ç®±">{{ profile.email }}</el-descriptions-item> |
| | | <el-descriptions-item label="å°å">{{ profile.address }}</el-descriptions-item> |
| | | <el-descriptions-item label="å°å">{{ profile.adress }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | </el-card> |
| | | </div> |
| | | |
| | | <!-- åæç³è¯·å¼¹çª --> |
| | | <el-dialog v-model="showLeaveDialog" title="ç³è¯·åæ" width="500px"> |
| | | <el-dialog v-model="showLeaveDialog" :title="leaveOperationType === 'add' ? 'ç³è¯·åæ' : 'ç¼è¾åæ'" width="500px"> |
| | | <el-form :model="leaveForm" label-width="100px"> |
| | | <el-form-item label="åæç±»å"> |
| | | <el-select v-model="leaveForm.type" placeholder="è¯·éæ©åæç±»å"> |
| | |
| | | <el-form-item label="ç³è¯·åå "> |
| | | <el-input v-model="leaveForm.reason" type="textarea" rows="3" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="审æ¹ç¶æ"> |
| | | <el-select v-model="leaveForm.status" placeholder="è¯·éæ©å®¡æ¹ç¶æ"> |
| | | <el-option label="审æ¹ä¸" value="审æ¹ä¸" /> |
| | | <el-option label="å·²éè¿" value="å·²éè¿" /> |
| | | <el-option label="å·²æç»" value="å·²æç»" /> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="showLeaveDialog = false">åæ¶</el-button> |
| | |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- æ°å¢èå¤è®°å½å¼¹çª --> |
| | | <el-dialog v-model="showAttendanceDialog" title="æ°å¢èå¤è®°å½" width="500px"> |
| | | <!-- æ°å¢-ç¼è¾èå¤è®°å½å¼¹çª --> |
| | | <el-dialog v-model="showAttendanceDialog" :title="operationType === 'add' ? 'æ°å¢èå¤è®°å½' : 'ç¼è¾èå¤è®°å½'" width="500px"> |
| | | <el-form :model="attendanceForm" :rules="attendanceRules" ref="attendanceFormRef" label-width="100px"> |
| | | <el-form-item label="æ¥æ" prop="date"> |
| | | <el-date-picker v-model="attendanceForm.date" type="date" placeholder="éæ©æ¥æ" /> |
| | | <el-date-picker v-model="attendanceForm.date" type="date" value-format="YYYY-MM-DD" format="YYYY-MM-DD" placeholder="éæ©æ¥æ" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¾å°æ¶é´" prop="checkIn"> |
| | | <el-time-picker v-model="attendanceForm.checkIn" placeholder="éæ©ç¾å°æ¶é´" format="HH:mm" value-format="HH:mm" /> |
| | |
| | | <el-input v-model="profileForm.email" /> |
| | | </el-form-item> |
| | | <el-form-item label="å°å"> |
| | | <el-input v-model="profileForm.address" type="textarea" rows="2" /> |
| | | <el-input v-model="profileForm.adress" type="textarea" rows="2" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, watch } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import { ref, reactive, watch, onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { |
| | | Calendar, |
| | | Money, |
| | | Clock, |
| | | User |
| | | } from '@element-plus/icons-vue' |
| | | import { personalAttendanceRecordsListPage, personalAttendanceRecordsAdd, personalAttendanceRecordsUpdate, personalAttendanceRecordsDelete, holidayApplicationListPage, holidayApplicationAdd, holidayApplicationUpdate, holidayApplicationDelete } from '@/api/personnelManagement/selfService' |
| | | import { compensationListPage, compensationAdd, compensationUpdate, compensationDelete } from '@/api/personnelManagement/payrollManagement' |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | import { getUserProfile } from '@/api/system/user.js' |
| | | import {staffJoinUpdate, staffJoinListPage} from "@/api/personnelManagement/onboarding.js"; |
| | | import { fa, id } from 'element-plus/es/locales.mjs' |
| | | |
| | | const tableLoading = ref(false) |
| | | // å页忰 |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0 |
| | | }) |
| | | |
| | | // å½åè§å¾ |
| | | const currentView = ref('attendance') |
| | |
| | | ] |
| | | |
| | | // è夿°æ® |
| | | const attendanceData = ref([ |
| | | { date: '2024-01-15', checkIn: '09:00', checkOut: '18:00', workHours: '9å°æ¶', status: 'æ£å¸¸' }, |
| | | { date: '2024-01-16', checkIn: '08:55', checkOut: '18:05', workHours: '9å°æ¶10å', status: 'æ£å¸¸' }, |
| | | { date: '2024-01-17', checkIn: '09:15', checkOut: '18:00', workHours: '8å°æ¶45å', status: 'è¿å°' } |
| | | ]) |
| | | const attendanceData = ref([]) |
| | | |
| | | // èªèµæ°æ® |
| | | const salaryData = ref([ |
| | | { month: '2024-01', basicSalary: 8000, bonus: 1000, deduction: 200, total: 8800, status: '已忾' }, |
| | | { month: '2023-12', basicSalary: 8000, bonus: 800, deduction: 150, total: 8650, status: '已忾' } |
| | | ]) |
| | | const salaryData = ref([]) |
| | | |
| | | |
| | | // åææ°æ® |
| | | const leaveData = ref([ |
| | | { type: 'å¹´å', startDate: '2024-02-01', endDate: '2024-02-03', days: 3, reason: 'æ¥èåå®¶', status: 'å·²éè¿' }, |
| | | { type: 'ç
å', startDate: '2024-01-20', endDate: '2024-01-21', days: 2, reason: 'æååç§', status: '审æ¹ä¸' } |
| | | ]) |
| | | |
| | | const leaveData = ref([]) |
| | | |
| | | const currentUser = ref() |
| | | const user= ref() |
| | | // ä¸ªäººä¿¡æ¯ |
| | | const profile = ref({ |
| | | name: 'å¼ æµ·æ´', |
| | | employeeId: 'EMP001', |
| | | department: 'ææ¯é¨', |
| | | position: '软件工ç¨å¸', |
| | | hireDate: '2023-03-01', |
| | | phone: '13800138000', |
| | | email: 'zhangsan@company.com', |
| | | address: 'åäº¬å¸æé³åºxxxè¡éxxxå·' |
| | | }) |
| | | id: '', |
| | | name: '', |
| | | employeeId: '', |
| | | department: '', |
| | | position: '', |
| | | hireDate: '', |
| | | phone: '', |
| | | email: '', |
| | | adress: '' |
| | | }) |
| | | |
| | | // å¼¹çªæ§å¶ |
| | | const showLeaveDialog = ref(false) |
| | | const editProfile = ref(false) |
| | | const salaryMonth = ref('') |
| | | const payDateStr = ref('') |
| | | |
| | | // è¡¨åæ°æ® |
| | | const leaveForm = reactive({ |
| | | id: '', |
| | | type: '', |
| | | startDate: '', |
| | | endDate: '', |
| | | reason: '' |
| | | days: 0, |
| | | reason: '', |
| | | status: '' |
| | | }) |
| | | |
| | | const profileForm = reactive({ |
| | | name: '', |
| | | phone: '', |
| | | email: '', |
| | | address: '' |
| | | name: "", |
| | | email: "", |
| | | adress: "", |
| | | phone: "", |
| | | }) |
| | | const joinForm = reactive({ |
| | | id: "", |
| | | staffNo: "", |
| | | staffName: "", |
| | | email: "", |
| | | adress: "", |
| | | sex: "", |
| | | nativePlace: "", |
| | | postJob: "", |
| | | firstStudy: "", |
| | | profession: "", |
| | | identityCard: "", |
| | | age: 0, |
| | | phone: "", |
| | | emergencyContact: "", |
| | | emergencyContactPhone: "", |
| | | contractTerm: 0, |
| | | contractStartTime: "", |
| | | contractEndTime: "", |
| | | staffState: 1, |
| | | }) |
| | | |
| | | // æ°å¢èå¤è®°å½ï¼å¼¹çªä¸è¡¨å |
| | | const operationType = ref('add') |
| | | const leaveOperationType = ref('add') |
| | | const showAttendanceDialog = ref(false) |
| | | const attendanceFormRef = ref(null) |
| | | const attendanceForm = reactive({ |
| | | id: '', |
| | | date: '', |
| | | checkIn: '', |
| | | checkOut: '', |
| | | workHours: '', |
| | | status: 'æ£å¸¸' |
| | | }) |
| | | const attendanceRules = { |
| | |
| | | |
| | | // æ°å¢èå¤è®°å½ï¼æå¼å¼¹çªå¹¶é¢å¡«é»è®¤å¼ï¼ |
| | | const addAttendanceRecord = () => { |
| | | operationType.value = 'add' |
| | | attendanceForm.date = new Date().toISOString().split('T')[0] |
| | | attendanceForm.checkIn = '09:00' |
| | | attendanceForm.checkOut = '18:00' |
| | |
| | | return m === 0 ? `${h}å°æ¶` : `${h}å°æ¶${m}å` |
| | | } |
| | | |
| | | // æäº¤æ°å¢èå¤è®°å½ |
| | | // ç¼è¾èå¤è®°å½ |
| | | const editAttendanceRecord = (row) => { |
| | | operationType.value = 'edit' |
| | | Object.assign(attendanceForm, row) |
| | | showAttendanceDialog.value = true |
| | | } |
| | | // æäº¤æ°å¢-ç¼è¾èå¤è®°å½ |
| | | const submitAttendance = () => { |
| | | if (!attendanceFormRef.value) return |
| | | attendanceFormRef.value.validate((valid) => { |
| | | if (!valid) return |
| | | // if (!attendanceFormRef.value) return |
| | | const workHours = computeWorkHours(attendanceForm.checkIn, attendanceForm.checkOut) |
| | | const newRecord = { |
| | | date: attendanceForm.date, |
| | |
| | | workHours, |
| | | status: attendanceForm.status |
| | | } |
| | | attendanceData.value.unshift(newRecord) |
| | | showAttendanceDialog.value = false |
| | | // é置表å |
| | | attendanceForm.date = '' |
| | | attendanceForm.checkIn = '' |
| | | attendanceForm.checkOut = '' |
| | | attendanceForm.status = 'æ£å¸¸' |
| | | ElMessage.success('èå¤è®°å½æ·»å æå') |
| | | if (operationType.value === 'add') { |
| | | personalAttendanceRecordsAdd(newRecord) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('èå¤è®°å½æ·»å æå') |
| | | getPersonalAttendanceRecordsList() |
| | | showAttendanceDialog.value = false |
| | | // é置表å |
| | | attendanceForm.date = '' |
| | | attendanceForm.checkIn = '' |
| | | attendanceForm.checkOut = '' |
| | | attendanceForm.status = 'æ£å¸¸' |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('èå¤è®°å½æ·»å 失败') |
| | | }) |
| | | }else{ |
| | | attendanceForm.workHours = computeWorkHours(attendanceForm.checkIn, attendanceForm.checkOut) |
| | | personalAttendanceRecordsUpdate(attendanceForm) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('èå¤è®°å½æ´æ°æå') |
| | | getPersonalAttendanceRecordsList() |
| | | showAttendanceDialog.value = false |
| | | // é置表å |
| | | attendanceForm.date = '' |
| | | attendanceForm.checkIn = '' |
| | | attendanceForm.checkOut = '' |
| | | attendanceForm.status = 'æ£å¸¸' |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('èå¤è®°å½æ´æ°å¤±è´¥') |
| | | }) |
| | | } |
| | | // attendanceFormRef.value.validate((valid) => { |
| | | // if (!valid) return |
| | | |
| | | |
| | | // }) |
| | | } |
| | | // å é¤èå¤è®°å½ |
| | | const deleteAttendanceRecord = (row) => { |
| | | |
| | | ElMessageBox.confirm('ç¡®å®å é¤è¯¥èå¤è®°å½åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | personalAttendanceRecordsDelete(row.id) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('èå¤è®°å½å 餿å') |
| | | getPersonalAttendanceRecordsList() |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('èå¤è®°å½å é¤å¤±è´¥') |
| | | }) |
| | | }).catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | // ç¼è¾èå¤è®°å½ |
| | | const editAttendanceRecord = (row) => { |
| | | ElMessage.info('ç¼è¾åè½å¼åä¸...') |
| | | // ç³è¯·åæ |
| | | const openLeaveForm = () => { |
| | | leaveOperationType.value = 'add' |
| | | showLeaveDialog.value = true |
| | | // leaveForm.type = '' |
| | | // leaveForm.startDate = '' |
| | | // leaveForm.endDate = '' |
| | | // leaveForm.days = 0 |
| | | // leaveForm.reason = '' |
| | | // leaveForm.status = 'warning' |
| | | } |
| | | |
| | | // å é¤èå¤è®°å½ |
| | | const deleteAttendanceRecord = (index) => { |
| | | attendanceData.value.splice(index, 1) |
| | | ElMessage.success('èå¤è®°å½å 餿å') |
| | | } |
| | | |
| | | // ç¼è¾åæè®°å½ |
| | | const editLeaveRecord = (row) => { |
| | | ElMessage.info('ç¼è¾åè½å¼åä¸...') |
| | | leaveOperationType.value = 'edit' |
| | | showLeaveDialog.value = true |
| | | Object.assign(leaveForm, row) |
| | | // ElMessage.info('ç¼è¾åè½å¼åä¸...') |
| | | } |
| | | |
| | | // å é¤åæè®°å½ |
| | | const deleteLeaveRecord = (index) => { |
| | | leaveData.value.splice(index, 1) |
| | | ElMessage.success('åæè®°å½å 餿å') |
| | | const deleteLeaveRecord = (row) => { |
| | | ElMessageBox.confirm('ç¡®å®å é¤è¯¥åæè®°å½åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | holidayApplicationDelete(row.id) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('åæè®°å½å 餿å') |
| | | getHolidayApplicationList() |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('åæè®°å½å é¤å¤±è´¥') |
| | | }) |
| | | }).catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | //计ç®åæå¤©æ° |
| | | const calculateDays = () => { |
| | | try { |
| | | if (leaveForm.startDate && leaveForm.endDate) { |
| | | const start = new Date(leaveForm.startDate) |
| | | const end = new Date(leaveForm.endDate) |
| | | leaveForm.startDate = start.toISOString().split('T')[0] |
| | | leaveForm.endDate = end.toISOString().split('T')[0] |
| | | |
| | | if (isNaN(start.getTime()) || isNaN(end.getTime())) { |
| | | console.warn('æ æçæ¥ææ ¼å¼') |
| | | return |
| | | } |
| | | |
| | | const diffTime = Math.abs(end - start) |
| | | const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1 |
| | | leaveForm.days = diffDays |
| | | } |
| | | } catch (error) { |
| | | console.error('计ç®å¤©æ°å¤±è´¥:', error) |
| | | } |
| | | } |
| | | |
| | | // æäº¤åæç³è¯· |
| | | const submitLeaveApplication = () => { |
| | | if (!leaveForm.type || !leaveForm.startDate || !leaveForm.endDate || !leaveForm.reason) { |
| | | ElMessage.warning('请填å宿´ä¿¡æ¯') |
| | | return |
| | | } |
| | | |
| | | const newLeave = { |
| | | if (leaveOperationType.value === 'add') { |
| | | if (!leaveForm.type || !leaveForm.startDate || !leaveForm.endDate || !leaveForm.reason) { |
| | | ElMessage.warning('请填å宿´ä¿¡æ¯') |
| | | return |
| | | } |
| | | calculateDays() |
| | | const newLeave = { |
| | | type: leaveForm.type, |
| | | startDate: leaveForm.startDate, |
| | | endDate: leaveForm.endDate, |
| | | days: 3, // ç®åè®¡ç® |
| | | days: leaveForm.days, // ç®åè®¡ç® |
| | | reason: leaveForm.reason, |
| | | status: '审æ¹ä¸' |
| | | } |
| | | |
| | | holidayApplicationAdd(newLeave) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('åæç³è¯·æäº¤æå') |
| | | getHolidayApplicationList() |
| | | showLeaveDialog.value = false |
| | | // é置表å |
| | | Object.keys(leaveForm).forEach(key => { |
| | | leaveForm[key] = '' |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('åæç³è¯·æäº¤å¤±è´¥') |
| | | }) |
| | | }else{ |
| | | calculateDays() |
| | | holidayApplicationUpdate(leaveForm) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('åæç³è¯·æ´æ°æå') |
| | | getHolidayApplicationList() |
| | | showLeaveDialog.value = false |
| | | // é置表å |
| | | Object.keys(leaveForm).forEach(key => { |
| | | leaveForm[key] = '' |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('åæç³è¯·æ´æ°å¤±è´¥') |
| | | }) |
| | | } |
| | | |
| | | leaveData.value.unshift(newLeave) |
| | | showLeaveDialog.value = false |
| | | |
| | | // é置表å |
| | | Object.keys(leaveForm).forEach(key => { |
| | | leaveForm[key] = '' |
| | | } |
| | | |
| | | // è·åä¸ªäººä¿¡æ¯ |
| | | const getProfile = () => { |
| | | tableLoading.value = true; |
| | | getUserProfile().then(res => { |
| | | if (res.code === 200) { |
| | | currentUser.value = res.data |
| | | // console.log("----",currentUser.value) |
| | | //å¾å°äººåå表 |
| | | staffJoinListPage({staffState: 1}).then(res => { |
| | | //çéåºåcurrentUserååç人å |
| | | // let tableData = res.data.records |
| | | user.value = res.data.records.find(item => item.staffName === currentUser.value.userName) |
| | | // console.log("++++",user.value) |
| | | if(user.value){ |
| | | profile.value.id=user.value.id |
| | | profile.value.name=user.value.staffName |
| | | profile.value.employeeId=user.value.staffNo |
| | | profile.value.phone=user.value.phone |
| | | profile.value.email=currentUser.value.email |
| | | profile.value.adress=user.value.adress |
| | | profile.value.position=user.value.postJob |
| | | profile.value.hireDate=user.value.createTime |
| | | profile.value.department=currentUser.value.deptNames |
| | | } |
| | | // console.log(profile.value) |
| | | // tableLoading.value = false; |
| | | }).catch(err => {}) |
| | | } |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | ElMessage.error('è·å个人信æ¯å¤±è´¥') |
| | | }) |
| | | |
| | | ElMessage.success('åæç³è¯·æäº¤æå') |
| | | } |
| | | |
| | | // ä¿åä¸ªäººä¿¡æ¯ |
| | | const saveProfile = () => { |
| | | Object.assign(profile.value, profileForm) |
| | | editProfile.value = false |
| | | ElMessage.success('个人信æ¯ä¿åæå') |
| | | } |
| | | const saveProfile = async () => { |
| | | tableLoading.value = true; |
| | | try { |
| | | const userRes = await getUserProfile(); |
| | | if (userRes.code === 200) { |
| | | currentUser.value = userRes.data; |
| | | const staffListRes = await staffJoinListPage({ staffState: 1 }); |
| | | user.value = staffListRes.data.records.find(item => item.staffName === currentUser.value.userName); |
| | | // console.log("++++", user.value); |
| | | |
| | | // åå§å个人信æ¯è¡¨å |
| | | const initProfileForm = () => { |
| | | Object.assign(joinForm, user.value); |
| | | joinForm.staffName = profileForm.name; |
| | | joinForm.phone = profileForm.phone; |
| | | joinForm.email = profileForm.email; |
| | | joinForm.adress = profileForm.adress; |
| | | console.log(joinForm) |
| | | // è°ç¨æ´æ°ä¸ªäººä¿¡æ¯çæ¥å£ |
| | | staffJoinUpdate(joinForm).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('个人信æ¯ä¿åæå'); |
| | | getProfile(); |
| | | editProfile.value = false; |
| | | } |
| | | }).catch(err => { |
| | | ElMessage.error('个人信æ¯ä¿å失败'); |
| | | }) |
| | | } |
| | | } catch (err) { |
| | | ElMessage.error('è·å个人信æ¯å¤±è´¥'); |
| | | } finally { |
| | | tableLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // ç¼è¾ä¸ªäººä¿¡æ¯ |
| | | const editProfileForm = () => { |
| | | editProfile.value = true; |
| | | Object.assign(profileForm, { |
| | | name: profile.value.name, |
| | | phone: profile.value.phone, |
| | | email: profile.value.email, |
| | | address: profile.value.address |
| | | adress: profile.value.adress, |
| | | }); |
| | | }; |
| | | |
| | | //æä»½æ¹å |
| | | const changMonth = () => { |
| | | getCompensationList() |
| | | } |
| | | //è·åèå¤è®°å½å表 |
| | | const getPersonalAttendanceRecordsList = async () => { |
| | | tableLoading.value = true |
| | | personalAttendanceRecordsListPage(page) |
| | | .then(res => { |
| | | |
| | | attendanceData.value = res.data.records |
| | | page.value.total = res.data.total; |
| | | tableLoading.value = false; |
| | | |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | //èªèµåæ¥è¯¢ |
| | | const getCompensationList = async () => { |
| | | tableLoading.value = true |
| | | compensationListPage({...page,payDateStr:payDateStr.value}) |
| | | .then(res => { |
| | | salaryData.value = res.data.records |
| | | //è¿æ»¤åºå½åæä»½çæ£æ¬¾å计 |
| | | salaryData.value.forEach(item => { |
| | | item.deduction =0 + item.deductionAbsenteeism+item.sickLeaveDeductions+item.deductionPersonalLeave+item.forgetClockDeduct, |
| | | item.bonus=0, |
| | | item.status='已忾' |
| | | }) |
| | | |
| | | // çå¬ç¼è¾ä¸ªäººä¿¡æ¯å¼¹çª |
| | | watch(editProfile, (val) => { |
| | | if (val) { |
| | | initProfileForm() |
| | | } |
| | | page.value.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | //è·ååæç³è¯·å表 |
| | | const getHolidayApplicationList = async () => { |
| | | tableLoading.value = true |
| | | holidayApplicationListPage(page) |
| | | .then(res => { |
| | | leaveData.value = res.data.records |
| | | page.value.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }).catch(err => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | onMounted(() => { |
| | | // åå§å |
| | | getPersonalAttendanceRecordsList() |
| | | getCompensationList() |
| | | getHolidayApplicationList() |
| | | getProfile() |
| | | }) |
| | | </script> |
| | | |