zhanghua
2024-12-20 320e75460d2f5e517c902b87fcc5c4d220472f6f
src/views/student/index.vue
@@ -8,9 +8,14 @@
        </el-tabs>
        <div style="display: flex; justify-content: space-between">
            <!-- <el-button type="primary" size="small" @click="showCreate">新建学员</el-button> -->
            <el-button type="primary" size="small" @click="handleExport"
                >导出学员</el-button
            >
            <div>
                <el-button type="primary" size="small" @click="handleExport"
                    >导出学员</el-button
                >
                <el-button type="primary" size="small" @click="handleImport"
                    >导入学员</el-button
                >
            </div>
            <div style="width: 500px">
                <!-- <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期"
        end-placeholder="结束日期" value-format="yyyy-MM-dd" style="margin-right: 10px">
@@ -119,14 +124,18 @@
            >
            </el-pagination>
        </div>
        <StudentCreate ref="studentCreate" />
        <el-dialog :visible.sync="dialogVisible" width="560px" title="导入学员">
            <UploadStudent
                v-if="dialogVisible"
                @load-success="reloadData"
            ></UploadStudent>
        </el-dialog>
    </div>
</template>
<script>
import { getData, getRenew, getExpire, getDeleted, handleExport } from "@/api/student";
import StudentCreate from "./components/create.vue";
import { getData, getRenew, getExpire, getDeleted } from "@/api/student";
import UploadStudent from "./components/upload-student.vue";
export default {
    filters: {
@@ -140,7 +149,7 @@
        },
    },
    components: {
        StudentCreate,
        UploadStudent,
    },
    data() {
        return {
@@ -162,6 +171,7 @@
                    },
                },
            },
            dialogVisible: false,
        };
    },
    created() {
@@ -188,16 +198,33 @@
    },
    methods: {
        handleExport() {
            this.download('exportPlayer?orgId=' + JSON.parse(localStorage.getItem("user")).staffs[0].org.id, {
            }, `导出_${new Date().getTime()}.xlsx`)
            this.download(
                "exportPlayer?orgId=" +
                JSON.parse(localStorage.getItem("selectStaff")).org.id,
                {},
                `导出_${new Date().getTime()}.xlsx`
            );
        },
        handleExport2() {
            if (this.dateRange.length == 0) {
                this.$message.warning("请选择日期范围");
                return;
            }
            this.download('exportReport?startDate=' + this.dateRange[0] + '&endDate=' + this.dateRange[1], {
            }, `导出_${new Date().getTime()}.xlsx`)
            this.download(
                "exportReport?startDate=" +
                this.dateRange[0] +
                "&endDate=" +
                this.dateRange[1],
                {},
                `导出_${new Date().getTime()}.xlsx`
            );
        },
        handleImport() {
            this.dialogVisible = true;
        },
        reloadData() {
            this.dialogVisible = false;
            this.fetchData();
        },
        fetchData() {
            this.listLoading = true;
@@ -205,7 +232,7 @@
                this.list = response.data.findPlayerByStaff.ls;
                this.total = response.data.findPlayerByStaff.pageOut.total;
                this.listLoading = false;
            })
            });
        },
        handleSizeChange(val) {
            this.data.pageIn.size = val;
@@ -216,7 +243,7 @@
            this.handleClick();
        },
        handleClick(tab, event) {
            this.data.staffId = JSON.parse(localStorage.getItem("selectStaff")).id
            this.data.staffId = JSON.parse(localStorage.getItem("selectStaff")).id;
            if (this.activeName == "pendingFees") {
                this.listLoading = true;
                getRenew(this.data).then((response) => {
@@ -259,6 +286,7 @@
        showCreate() {
            this.$refs.studentCreate.showDialog();
        },
    },
};
</script>