From d264fc8d172da088aa71ce2d1e94b21ddb75d662 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 10 二月 2026 11:21:36 +0800
Subject: [PATCH] 打卡签到:修改部门选项,导出
---
src/views/personnelManagement/attendanceCheckin/index.vue | 127 +++++++++++++++++++++++++++---------------
1 files changed, 82 insertions(+), 45 deletions(-)
diff --git a/src/views/personnelManagement/attendanceCheckin/index.vue b/src/views/personnelManagement/attendanceCheckin/index.vue
index b65f9a5..4d12f30 100644
--- a/src/views/personnelManagement/attendanceCheckin/index.vue
+++ b/src/views/personnelManagement/attendanceCheckin/index.vue
@@ -50,44 +50,47 @@
</el-descriptions>
</el-card>
- <!-- 鏌ヨ鏉′欢锛堢鐞嗗憳鑰冨嫟鏃ユ姤锛� -->
- <div class="search_form">
- <div>
- <span class="search_title">閮ㄩ棬锛�</span>
- <el-select
- v-model="searchForm.deptId"
- placeholder="璇烽�夋嫨閮ㄩ棬"
- style="width: 180px"
- clearable
- >
- <el-option
- v-for="item in deptOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
+ <div class="attendance-operation">
+ <!-- 鏌ヨ鏉′欢锛堢鐞嗗憳鑰冨嫟鏃ユ姤锛� -->
+ <el-form :model="searchForm" :inline="true" class="search-form">
+ <el-form-item label="閮ㄩ棬锛�" prop="deptId">
+ <el-tree-select
+ v-model="searchForm.deptId"
+ :data="deptOptions"
+ :props="{ value: 'id', label: 'label', children: 'children' }"
+ value-key="id"
+ placeholder="璇烽�夋嫨閮ㄩ棬"
+ check-strictly
+ style="width: 200px"
/>
- </el-select>
+ </el-form-item>
- <span class="search_title ml10">鏃ユ湡锛�</span>
- <el-date-picker
- v-model="searchForm.date"
- type="date"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- placeholder="璇烽�夋嫨鏃ユ湡"
- clearable
- />
+ <el-form-item label="鏃ユ湡锛�" prop="date">
+ <el-date-picker
+ v-model="searchForm.date"
+ type="date"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ clearable
+ />
+ </el-form-item>
- <el-button type="primary" @click="fetchData" style="margin-left: 10px">
- 鎼滅储
- </el-button>
- <el-button @click="resetSearch">閲嶇疆</el-button>
- </div>
- <div>
- <el-button icon="Download" @click="handleExport">
- 瀵煎嚭鑰冨嫟鏃ユ姤
- </el-button>
- </div>
+ <el-form-item>
+ <el-button type="primary" @click="fetchData">
+ <el-icon><Search /></el-icon>
+ 鎼滅储
+ </el-button>
+ <el-button @click="resetSearch">
+ <el-icon><Refresh /></el-icon>
+ 閲嶇疆
+ </el-button>
+ </el-form-item>
+ </el-form>
+
+ <el-button icon="Download" @click="handleExport">
+ 瀵煎嚭鑰冨嫟鏃ユ姤
+ </el-button>
</div>
<!-- 鑰冨嫟鏃ユ姤琛ㄦ牸 -->
@@ -174,13 +177,16 @@
<script setup>
import { ref, reactive, computed, onMounted, onBeforeUnmount } from "vue";
-import { ElMessage } from "element-plus";
+import {ElMessage, ElMessageBox} from "element-plus";
import {
createPersonalAttendanceRecord,
findPersonalAttendanceRecords, findTodayPersonalAttendanceRecord
} from "@/api/personnelManagement/personalAttendanceRecords.js";
import Pagination from "@/components/Pagination/index.vue";
+import {deptTreeSelect} from "@/api/system/user.js";
+import {Refresh, Search} from "@element-plus/icons-vue";
+const { proxy } = getCurrentInstance()
const tableLoading = ref(false)
// 鍒嗛〉鍙傛暟
const page = reactive({
@@ -192,12 +198,7 @@
const todayRecord = ref({})
// 閮ㄩ棬閫夐」
-const deptOptions = [
- { label: "鐢熶骇涓�閮�", value: "鐢熶骇涓�閮�" },
- { label: "鐢熶骇浜岄儴", value: "鐢熶骇浜岄儴" },
- { label: "璁惧缁存姢閮�", value: "璁惧缁存姢閮�" },
- { label: "璐ㄦ閮�", value: "璐ㄦ閮�" },
-];
+const deptOptions = ref([])
// 鏌ヨ琛ㄥ崟
const searchForm = reactive({
@@ -261,10 +262,31 @@
return "";
};
+// 鏌ヨ閮ㄩ棬鍒楄〃
+const fetchDeptOptions = () => {
+ deptTreeSelect().then(response => {
+ deptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
+ })
+}
+
+/** 杩囨护绂佺敤鐨勯儴闂� */
+function filterDisabledDept(deptList) {
+ return deptList.filter(dept => {
+ if (dept.disabled) {
+ return false
+ }
+ if (dept.children && dept.children.length) {
+ dept.children = filterDisabledDept(dept.children)
+ }
+ return true
+ })
+}
+
+
// 鏌ヨ
const fetchData = () => {
tableLoading.value = true
- findPersonalAttendanceRecords({...page, searchForm}).then((res) => {
+ findPersonalAttendanceRecords({...page, ...searchForm}).then((res) => {
tableData.value = res.data.records;
page.value.total = res.data.total;
}).finally(() => {
@@ -291,9 +313,18 @@
fetchData();
};
-// 瀵煎嚭锛堟紨绀猴級
const handleExport = () => {
- ElMessage.success("褰撳墠涓烘紨绀洪〉闈紝瀵煎嚭鍔熻兘鏈鎺ュ疄闄呮帴鍙�");
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/personalAttendanceRecords/export", {}, "鑰冨嫟璁板綍.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
};
// 鎵撳崱
@@ -316,6 +347,7 @@
searchForm.date = `${Y}-${M}-${D}`;
fetchData();
fetchTodayData()
+ fetchDeptOptions();
});
onBeforeUnmount(() => {
@@ -371,5 +403,10 @@
::v-deep(.row-abnormal) {
background-color: #fff5f5;
}
+
+.attendance-operation {
+ display: flex;
+ justify-content: space-between;
+}
</style>
--
Gitblit v1.9.3