From 9aae2af6f3937a7d99ec619b51f457002cef969f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 03 十一月 2025 14:29:37 +0800
Subject: [PATCH] 档案管理-添加导出功能

---
 src/views/personnelManagement/scheduling/index.vue |   42 +++++++++++++++++++++++++++++++++++++-----
 1 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/src/views/personnelManagement/scheduling/index.vue b/src/views/personnelManagement/scheduling/index.vue
index 35ceac6..251dbe9 100644
--- a/src/views/personnelManagement/scheduling/index.vue
+++ b/src/views/personnelManagement/scheduling/index.vue
@@ -37,6 +37,10 @@
             <el-icon><Refresh/></el-icon>
             閲嶇疆
           </el-button>
+          <el-button @click="handleExport">
+            <el-icon><Download/></el-icon>
+            瀵煎嚭
+          </el-button>
           <el-button type="primary" @click="openScheduleDialog('add')">
           <el-icon><Plus/></el-icon>
           鏂板鎺掔彮
@@ -106,6 +110,13 @@
           </template>
         </el-table-column>
       </el-table>
+        <pagination
+            v-if="tableCount > 0"
+            :total="tableCount"
+            :page="filterForm.current"
+            :limit="filterForm.size"
+            @pagination="paginationChange"
+        />
     </div>
 
     <!-- 鎵归噺鎿嶄綔 -->
@@ -237,14 +248,18 @@
 </template>
 
 <script setup>
-import {ref, reactive, computed, onMounted} from 'vue'
+import {ref, reactive, computed, onMounted, getCurrentInstance} from 'vue'
 import {ElMessage, ElMessageBox} from 'element-plus'
 import {useDict} from "@/utils/dict.js"
 import {Plus, Download, Search, Refresh} from '@element-plus/icons-vue'
 import {save, del, delByIds, listPage} from "@/api/personnelManagement/scheduling.js"
 import {getStaffOnJob} from "@/api/personnelManagement/onboarding.js";
 import dayjs from "dayjs";
+import pagination from "@/components/PIMTable/Pagination.vue";
 
+const { proxy } = getCurrentInstance();
+
+const tableCount = ref(0)
 // 鍝嶅簲寮忔暟鎹�
 const scheduleDialog = ref(false)
 const dialogType = ref('add')
@@ -255,7 +270,9 @@
 const filterForm = reactive({
   staffName: '',
   shiftType: '',
-  dateRange: []
+  dateRange: [],
+  current:1,
+  size: 10
 })
 
 // 鎺掔彮琛ㄥ崟
@@ -304,7 +321,11 @@
     personList.value = res.data
   })
 };
-
+const paginationChange = (obj) => {
+  filterForm.current = obj.page;
+  filterForm.size = obj.limit;
+  handleFilter();
+};
 
 const handleSelectStaff = (val) => {
   let obj = personList.value.find(item => item.id === val)
@@ -328,14 +349,14 @@
 const handleFilter = async () => {
   tableLoading.value = true
   let searchForm = {
-    staffName: filterForm.staffName,
-    shiftType: filterForm.shiftType,
+    ...filterForm,
     ...(filterForm.dateRange.length > 0 && {
       startDate: filterForm.dateRange[0],
       endDate: filterForm.dateRange[1],
     })
   }
   let resp = await listPage(searchForm)
+  tableCount.value = resp.data.total
   scheduleList.value = resp.data.records.map(it => {
     return {
       ...it,
@@ -467,6 +488,17 @@
   selectedRows.value = selection
 }
 
+// 瀵煎嚭
+const handleExport = () => {
+  let searchForm = {
+    ...filterForm,
+    ...(filterForm.dateRange.length > 0 && {
+      startDate: filterForm.dateRange[0],
+      endDate: filterForm.dateRange[1],
+    })
+  }
+  proxy.download('/staff/staffScheduling/export', {}, '浜哄憳鎺掔彮.xlsx')
+}
 
 // 鐢熷懡鍛ㄦ湡
 onMounted(() => {

--
Gitblit v1.9.3