From c07afd1671f6a3444bdb1f9652662d8e49958c99 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 10 九月 2024 11:14:25 +0800
Subject: [PATCH] 班级考勤报表导出
---
src/views/home/index.vue | 4 +-
src/views/class/index.vue | 91 ++++++++++++++++++++++++---------------------
src/router/index.js | 13 ++++++
3 files changed, 64 insertions(+), 44 deletions(-)
diff --git a/src/router/index.js b/src/router/index.js
index 0361468..787d80d 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -95,6 +95,19 @@
},
],
},
+ {
+ path: "/",
+ component: Layout,
+ redirect: "/class",
+ children: [
+ {
+ path: "/class",
+ name: "Class",
+ component: () => import("@/views/class/index"),
+ meta: { title: "鐝骇", icon: "table" },
+ },
+ ],
+ },
// {
// path: "/educational",
// component: Layout,
diff --git a/src/views/class/index.vue b/src/views/class/index.vue
index 11fdb70..b3aeb84 100644
--- a/src/views/class/index.vue
+++ b/src/views/class/index.vue
@@ -6,34 +6,19 @@
</el-tabs>
<div style="display: flex; flex-direction: row-reverse">
<div style="width: 300px">
- <el-input
- placeholder="鎸夌彮绾у悕绉版悳绱�"
- v-model="data.keyword"
- class="input-with-select"
- size="small"
- >
- <el-button
- slot="append"
- icon="el-icon-search"
- @click="fetchData"
- ></el-button>
+ <el-input placeholder="鎸夌彮绾у悕绉版悳绱�" v-model="data.keyword" class="input-with-select" size="small">
+ <el-button slot="append" icon="el-icon-search" @click="fetchData"></el-button>
</el-input>
</div>
</div>
<div style="height: calc(100vh - 248px)">
- <el-table
- v-loading="listLoading"
- :data="list"
- element-loading-text="Loading"
- fit
- v-if="activeName == 'all'"
- height="100%"
- >
+ <el-table v-loading="listLoading" :data="list" element-loading-text="Loading" fit v-if="activeName == 'all'"
+ height="100%">
<el-table-column label="鐝骇鍚嶇О">
<template slot-scope="scope">
<el-link type="primary" :underline="false">{{
- scope.row.team.name
- }}</el-link>
+ scope.row.team.name
+ }}</el-link>
</template>
</el-table-column>
<el-table-column label="鐝骇浜烘暟" width="200">
@@ -41,23 +26,23 @@
</el-table-column>
<el-table-column label="璇惧寘/浼氬憳鍗�" width="200">
<template slot-scope="scope">{{
- scope.row.team.voucher.name
- }}</template>
+ scope.row.team.voucher.name
+ }}</template>
</el-table-column>
<el-table-column label="鏁欏笀" width="">
<template slot-scope="scope">{{
- concatenateArray(scope.row.team.sessionStaffs)
- }}</template>
+ concatenateArray(scope.row.team.sessionStaffs)
+ }}</template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔" width="200">
+ <template slot-scope="scope">
+ <el-button type="text" @click="handleExport(scope.row)">
+ 瀵煎嚭
+ </el-button>
+ </template>
</el-table-column>
</el-table>
- <el-table
- v-loading="listLoading"
- :data="list"
- element-loading-text="Loading"
- fit
- height="100%"
- v-else
- >
+ <el-table v-loading="listLoading" :data="list" element-loading-text="Loading" fit height="100%" v-else>
<el-table-column label="鐝骇鍚嶇О">
<template slot-scope="scope">{{ scope.row.name }} </template>
</el-table-column>
@@ -72,17 +57,23 @@
</el-table>
</div>
<div>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="data.pageIn.index + 1"
- :page-sizes="[10, 20, 30, 40]"
- :page-size="data.pageIn.size"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+ :current-page="data.pageIn.index + 1" :page-sizes="[10, 20, 30, 40]" :page-size="data.pageIn.size"
+ layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
+ <el-dialog title="瀵煎嚭" :visible.sync="dialogVisible" width="50%">
+ <el-form ref="form" :model="form" label-width="180px">
+ <el-form-item label="鏃ユ湡鑼冨洿">
+ <el-date-picker v-model="form.dateRange" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡" value-format="yyyy-MM-dd"></el-date-picker>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="confirmExport">瀵� 鍑�</el-button>
+ </div>
+ </el-dialog>
</div>
</template>
@@ -102,6 +93,12 @@
},
data() {
return {
+ dialogVisible: false,
+ form: {
+ dateRange: [],
+ teamId: "",
+ name: "",
+ },
list: null,
listLoading: true,
activeName: "all",
@@ -126,6 +123,16 @@
this.fetchData();
},
methods: {
+ handleExport(row) {
+ this.form.dateRange = [];
+ this.form.teamId = row.team.id;
+ this.form.name = row.team.name;
+ this.dialogVisible = true;
+ },
+ confirmExport() {
+ this.download('exportSignIn?teamId=' + this.form.teamId + '&startTime=' + this.form.dateRange[0] + '&endTime=' + this.form.dateRange[1], {
+ }, `${this.form.name}涓婅绛惧埌琛�.xlsx`)
+ },
handleSizeChange(val) {
this.data.pageIn.size = val;
this.fetchData("pageIn");
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 4268322..60024ea 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -48,9 +48,9 @@
methods: {
getUserDate() {
login({
- code: "021dbA000NZ9LS1gKd400jYDAX1dbA0L",
+ code: "041C8oFa14gC8I0FDRHa1cw5ae1C8oFj",
}).then((res) => {
- localStorage.setItem("user", JSON.stringify(res.data));
+ localStorage.setItem("user", JSON.stringify(res));
});
},
},
--
Gitblit v1.8.0