From febbfe17f1ae201e62b9f23c7f29671251348e38 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 26 九月 2025 16:55:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
src/views/personnelManagement/selfService/index.vue | 486 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 383 insertions(+), 103 deletions(-)
diff --git a/src/views/personnelManagement/selfService/index.vue b/src/views/personnelManagement/selfService/index.vue
index 1f4fbea..926229a 100644
--- a/src/views/personnelManagement/selfService/index.vue
+++ b/src/views/personnelManagement/selfService/index.vue
@@ -26,7 +26,7 @@
<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="绛鹃��鏃堕棿" />
@@ -41,7 +41,7 @@
<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>
@@ -52,15 +52,15 @@
<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="鎵f" />
- <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'">
@@ -76,7 +76,7 @@
<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%">
@@ -95,7 +95,7 @@
<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>
@@ -106,7 +106,7 @@
<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>
@@ -117,13 +117,13 @@
<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="璇烽�夋嫨鍋囨湡绫诲瀷">
@@ -142,6 +142,13 @@
<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>
@@ -149,11 +156,11 @@
</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" />
@@ -189,7 +196,7 @@
<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>
@@ -201,14 +208,29 @@
</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')
@@ -222,63 +244,84 @@
]
// 鑰冨嫟鏁版嵁
-const attendanceData = ref([
- { date: '2024-01-15', checkIn: '09:00', checkOut: '18:00', workHours: '9灏忔椂', status: '姝e父' },
- { date: '2024-01-16', checkIn: '08:55', checkOut: '18:05', workHours: '9灏忔椂10鍒�', status: '姝e父' },
- { 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: '姝e父'
})
const attendanceRules = {
@@ -305,6 +348,7 @@
// 鏂板鑰冨嫟璁板綍锛堟墦寮�寮圭獥骞堕濉粯璁ゅ�硷級
const addAttendanceRecord = () => {
+ operationType.value = 'add'
attendanceForm.date = new Date().toISOString().split('T')[0]
attendanceForm.checkIn = '09:00'
attendanceForm.checkOut = '18:00'
@@ -324,11 +368,15 @@
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,
@@ -337,88 +385,320 @@
workHours,
status: attendanceForm.status
}
- attendanceData.value.unshift(newRecord)
- showAttendanceDialog.value = false
- // 閲嶇疆琛ㄥ崟
- attendanceForm.date = ''
- attendanceForm.checkIn = ''
- attendanceForm.checkOut = ''
- attendanceForm.status = '姝e父'
- 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 = '姝e父'
+ }
+ }).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 = '姝e父'
+ }
+ }).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 => {
+ //绛涢�夊嚭鍜宑urrentUser鍚屽悕鐨勪汉鍛�
+ // 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
+ //杩囨护鍑哄綋鍓嶆湀浠界殑鎵f鍚堣
+ 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>
--
Gitblit v1.9.3