| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865 |
- <template>
- <div class="content-box">
- <div class="left">
- <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
- <span class="cameratxt">学生住宿信息</span>
- </div>
- <div class="scroll">
- <div class="middle">
- <div class="filter">
- <div class="condition">
- <span>校区名称 :</span>
- <el-select
- clearable
- @change="schoolChange"
- v-model="searchInput.schoolId"
- placeholder="请选择校区名称"
- >
- <el-option
- v-for="i in schoolData"
- :key="i.id"
- :label="i.school"
- :value="i.id"
- />
- </el-select>
- </div>
- <div class="condition">
- <span>楼栋名称 :</span>
- <el-select
- clearable
- v-model="searchInput.buildId"
- placeholder="请选择楼栋名称"
- @change="buildChange"
- >
- <el-option
- v-for="i in buildData"
- :key="i.id"
- :label="i.build"
- :value="i.id"
- />
- </el-select>
- </div>
- <div class="condition">
- <span>寝室号 :</span>
- <el-select
- v-model="searchInput.dormitoryId"
- placeholder="请选择寝室号"
- clearable
- >
- <el-option
- v-for="i in dormitoryData"
- :key="i.id"
- :label="i.dormitory"
- :value="i.id"
- />
- </el-select>
- </div>
- <div class="condition">
- <span>所属学院 :</span>
- <el-select
- @change="collegeChange"
- v-model="searchInput.collegeId"
- placeholder="请选择所属学院"
- clearable
- >
- <el-option
- v-for="i in collegeData"
- :key="i.id"
- :label="i.name"
- :value="i.id"
- />
- </el-select>
- </div>
- <div class="condition">
- <span>专业 :</span>
- <el-select
- @change="majorChange"
- clearable
- v-model="searchInput.majorId"
- placeholder="请选择专业"
- >
- <el-option
- v-for="i in majorData"
- :key="i.id"
- :label="i.name"
- :value="i.id"
- />
- </el-select>
- </div>
- <div class="condition">
- <span>所属班级 :</span>
- <el-select
- clearable
- v-model="searchInput.classstrId"
- placeholder="请选择所属班级"
- >
- <el-option
- v-for="i in classstrData"
- :key="i.id"
- :label="i.name"
- :value="i.id"
- />
- </el-select>
- </div>
- <div class="condition">
- <span>学生姓名 :</span>
- <el-input
- clearable
- v-model.trim="searchInput.name"
- class="w-50 m-2"
- placeholder="请输入学生姓名"
- style="width: 180px"
- />
- </div>
- <div class="condition">
- <span>年份 :</span>
- <el-select
- clearable
- v-model="searchInput.yearId"
- placeholder="请选择年份"
- >
- <el-option
- v-for="i in yearData"
- :key="i.id"
- :label="i.name"
- :value="i.id"
- />
- </el-select>
- </div>
- <el-button
- style="margin-left: 20px"
- color="rgba(38, 151, 255, 1)"
- type="primary"
- class="search"
- @click="searchBtn"
- ><span>查询</span></el-button
- >
- <el-button @click="resetBtn" plain color="rgba(43, 153, 255, 1)"
- >重置</el-button
- >
- </div>
- <!-- 按钮列表 -->
- <div class="gongneng">
- <el-button
- v-if="store.BtnRole('studentAccommodationSetting1')"
- type="primary"
- style="margin-left: 0"
- color="rgba(48, 201, 191, 1)"
- @click="buildExportbtn"
- >导出</el-button
- >
- </div>
- </div>
- <div class="footer" v-loading="loading">
- <el-table
- :row-class-name="tableRowClassName"
- :data="tableData.list"
- @selection-change="handleSelectionChange"
- style="width: 100%"
- :header-cell-style="{
- background: 'rgba(240, 243, 247, 1)',
- height: '50px',
- border: 0,
- }"
- >
- <el-table-column
- width="80"
- align="center"
- label="序号"
- type="index"
- index="1"
- />
- <el-table-column
- align="center"
- prop="cardNum"
- width="200"
- label="录取号"
- />
- <el-table-column
- align="center"
- prop="name"
- width="120"
- label="学生姓名"
- />
- <el-table-column
- align="center"
- prop="school"
- width="120"
- label="校区名称"
- />
- <el-table-column
- align="center"
- prop="build"
- width="140"
- label="楼栋名称"
- />
- <el-table-column
- align="center"
- prop="dormitory"
- width="120"
- label="寝室号"
- />
- <el-table-column align="center" prop="number" label="床位号" />
- <el-table-column align="center" prop="sex" width="100" label="性别" />
- <el-table-column
- align="center"
- prop="college"
- width="160"
- label="所属学院"
- />
- <el-table-column align="center" prop="major" width="220" label="专业">
- </el-table-column>
- <el-table-column
- align="center"
- prop="classstr"
- width="220"
- label="所属班级"
- />
- <el-table-column
- align="center"
- prop="instructor"
- width="120"
- label="辅导员"
- />
- </el-table>
- <!-- 分页组件 -->
- <div class="pageSize">
- <span></span>
- <el-pagination
- background
- :current-page="currentPage"
- :page-size="pageSize"
- :page-sizes="[10, 20, 30, 40]"
- layout="total,sizes, prev, pager, next, jumper, slot"
- :total="total"
- @size-change="handleSizeChange"
- @update:current-page="handleCurrentChange"
- />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import {
- ref,
- watch,
- reactive,
- nextTick,
- onBeforeMount,
- onUnmounted,
- } from "vue";
- import { useRouter } from "vue-router";
- import { ElMessage, ElMessageBox } from "element-plus";
- import { dayjs } from "element-plus";
- import lodash from "lodash";
- import { https } from "@/utils/request"; // 绝对路径
- import { storeToRefs } from "pinia";
- import { useCounterStore } from "@/stores/index";
- const router = useRouter();
- const store = useCounterStore();
- // 为避免解构时失去响应性
- const { name, age, isCollapse, realAge, collegeRole } = storeToRefs(store);
- // 表格数据
- const loading = ref(false);
- const tableData = reactive({
- list: [],
- });
- const dialongTitle = ref("新增账号"); // 弹窗标题
- const searchInput = reactive({
- schoolId: null,
- buildId: null,
- dormitoryId: null,
- name: null,
- majorId: null,
- collegeId: null,
- classstrId: null,
- yearId: null,
- }); // 搜索按钮数据
- const currentPage = ref(1); // 当前页
- const pageSize = ref(10);
- const total = ref(); // 当前总数
- const selectIds = ref([]);
- const addDialogVisible = ref(false); // 控制添加账号弹窗
- // 表单数据
- const formSize = ref("default");
- const ruleFormRef = ref();
- const ruleForm = reactive({
- school: "男", //校区名称
- build: "1", //楼栋名称
- dormitory: "", //宿舍名称
- sex: "", //床位性别
- college: "",
- major: "",
- classstr: "",
- number: "", //床位号
- isCheck: "",
- cardNum: "",
- name: "",
- remark: "",
- id: "",
- });
- // 表单验证
- const rules = reactive({
- school: [{ required: true, message: "校区名称不能为空", trigger: "blur" }],
- build: [{ required: true, message: "楼栋名称不能为空", trigger: "blur" }],
- dormitory: [{ required: true, message: "寝室号不能为空", trigger: "blur" }],
- sex: [{ required: true, message: "床位性别不能为空", trigger: "blur" }],
- // college: [{ required: true, message: "所属学院不能为空", trigger: "blur" }],
- // major: [{ required: true, message: "专业不能为空", trigger: "blur" }],
- // classstr: [{ required: true, message: "所属班级不能为空", trigger: "blur" }],
- number: [{ required: true, message: "床位号不能为空", trigger: "blur" }],
- });
- // 校区数据
- const schoolData = ref([]);
- // 楼栋数据
- const buildData = ref([]);
- // 寝室号数据
- const dormitoryData = ref([]);
- // 学院
- const collegeData = ref([]);
- // 专业
- const majorData = ref([]);
- // 班级
- const classstrData = ref([]);
- // 年份
- const yearData = ref([]);
- const schoolList = async () => {
- let res = await https.get("/welcome/api/welcome-build/schoolGroup", "params");
- console.log(res, "校区数据");
- if (res.code == 200) {
- schoolData.value = res.data;
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- const buildList = async (flag) => {
- let params = {
- schoolId: searchInput.schoolId,
- accountId: sessionStorage.getItem("accountId"),
- };
- let res = await https.get(
- // "/welcome/api/welcome-build/buildGroup",
- "/welcome/api/welcome-dormitory/saveBedBuildGroup",
- "params",
- params,
- );
- console.log(res, "楼栋数据");
- if (res.code == 200) {
- buildData.value = res.data;
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- const dormitoryList = async (flag) => {
- let params = {
- schoolId: searchInput.schoolId,
- buildId: searchInput.buildId,
- };
- let res = await https.get(
- "/welcome/api/welcome-dormitory/dormitoryGroup",
- "params",
- params,
- );
- console.log(res, "寝室号数据");
- if (res.code == 200) {
- dormitoryData.value = res.data;
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- const collegeList = async () => {
- collegeData.value = collegeRole.value;
- // let res = await https.get("/welcome/api/welcomeOrg/getColleges", "params");
- // console.log(res, "学院数据");
- // if (res.code == 200) {
- // collegeData.value = res.data;
- // } else {
- // ElMessage({
- // type: "error",
- // showClose: true,
- // message: res.message,
- // center: true,
- // });
- // }
- };
- const majorList = async (flag) => {
- let params = {
- collegeId: searchInput.collegeId,
- };
- let res = await https.get(
- "/welcome/api/welcomeOrg/getMajors",
- "params",
- params,
- );
- console.log(res, "专业数据");
- if (res.code == 200) {
- majorData.value = res.data;
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- const classstrList = async (flag) => {
- let params = {
- majorId: searchInput.majorId,
- };
- let res = await https.get(
- "/welcome/api/welcomeOrg/getClasss",
- "params",
- params,
- );
- console.log(res, "班级数据");
- if (res.code == 200) {
- classstrData.value = res.data;
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- const yearList = async () => {
- let res = await https.get("/welcome/api/systemSetting/yearDatas", "params");
- console.log(res, "年份数据");
- if (res.code == 200) {
- yearData.value = res.data;
- } else {
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- const schoolChange = async (val) => {
- console.log(val);
- searchInput.buildId = null;
- searchInput.dormitoryId = null;
- if (!val) {
- buildData.value = null;
- dormitoryData.value = null;
- return;
- } else {
- buildData.value = null;
- dormitoryData.value = null;
- }
- buildList();
- };
- const buildChange = async (val) => {
- searchInput.dormitoryId = null;
- if (!val) {
- dormitoryData.value = null;
- return;
- } else {
- dormitoryData.value = null;
- }
- dormitoryList();
- };
- const collegeChange = async (val) => {
- console.log(val);
- searchInput.majorId = null;
- searchInput.classstrId = null;
- if (!val) {
- majorData.value = null;
- classstrData.value = null;
- return;
- } else {
- majorData.value = null;
- classstrData.value = null;
- }
- majorList();
- };
- const majorChange = async (val) => {
- console.log(val);
- searchInput.classstrId = null;
- if (!val) {
- classstrData.value = null;
- return;
- } else {
- classstrData.value = null;
- }
- classstrList();
- };
- // 获取账户列表
- const getList = async () => {
- loading.value = true;
- let params = {
- accountId: sessionStorage.getItem("accountId"),
- currentPage: currentPage.value, // 当前页
- pageCount: pageSize.value, // 一页数据条数
- schoolId: searchInput.schoolId,
- buildId: searchInput.buildId,
- dormitoryId: searchInput.dormitoryId,
- collegeId: searchInput.collegeId,
- majorId: searchInput.majorId,
- classstrId: searchInput.classstrId,
- name: searchInput.name,
- yearId: searchInput.yearId,
- };
- let res = await https.get(
- "/welcome/api/welcomeBed/studentAccommodationPage",
- "params",
- params,
- );
- console.log(res, "床位信息");
- if (res.code == 200) {
- tableData.list = res.data.list;
- total.value = res.data.totalCount;
- loading.value = false;
- } else {
- loading.value = false;
- ElMessage({
- type: "error",
- showClose: true,
- message: res.message,
- center: true,
- });
- }
- };
- // 搜索功能
- const searchBtn = lodash.debounce(async () => {
- getList();
- }, 300);
- const resetBtn = lodash.debounce(async () => {
- searchInput.schoolId = null;
- searchInput.buildId = null;
- buildData.value = [];
- searchInput.dormitoryId = null;
- dormitoryData.value = [];
- searchInput.name = null;
- searchInput.collegeId = null;
- searchInput.majorId = null;
- majorData.value = [];
- searchInput.classstrId = null;
- classstrData.value = [];
- searchInput.yearId=null
- getList();
- }, 300);
- // 多选框功能
- const handleSelectionChange = (val) => {
- console.log(val);
- selectIds.value = val.map((i) => i.id);
- };
- // 表格斑马纹颜色修改
- const tableRowClassName = ({ row, rowIndex }) => {
- if (rowIndex % 2 === 0) {
- return "even";
- } else if (rowIndex % 2 !== 0) {
- return "odd";
- }
- return "";
- };
- // 每页显示条数
- const handleSizeChange = (value) => {
- console.log(value, "每页显示条数");
- pageSize.value = value;
- getList();
- };
- // 分页
- const handleCurrentChange = (value) => {
- // console.log(value);
- currentPage.value = value;
- getList();
- };
- // 楼栋导出
- const buildExportbtn = async () => {
- let params = {
- accountId: sessionStorage.getItem("accountId"),
- schoolId: searchInput.schoolId,
- buildId: searchInput.buildId,
- dormitoryId: searchInput.dormitoryId,
- name: searchInput.name,
- collegeId: searchInput.collegeId,
- majorId: searchInput.majorId,
- classstrId: searchInput.classstrId,
- yearId: searchInput.yearId,
- };
- let res = await https.getBlob(
- "/welcome/api/welcomeBed/studentAccommodationListExport",
- "params",
- params,
- );
- console.log(res, "学生住宿信息");
- let name = `学生住宿信息`;
- var content = res;
- var datas = new Blob([content]);
- var downloadUrl = window.URL.createObjectURL(datas);
- var anchor = document.createElement("a");
- anchor.href = downloadUrl;
- anchor.download = name + ".xlsx";
- anchor.click();
- window.URL.revokeObjectURL(datas);
- ElMessage({
- type: "success",
- showClose: true,
- message: "导出成功",
- center: true,
- });
- };
- onBeforeMount(() => {
- getList();
- schoolList();
- collegeList();
- yearList()
- });
- onUnmounted(() => {
- // document.removeEventListener("keyup", Enters);
- });
- </script>
- <style scoped lang="scss">
- .content-box {
- width: calc(100% - 40px);
- height: calc(100% - 105px);
- margin: 20px auto;
- background-color: #fff;
- color: #000;
- display: flex;
- flex-direction: column;
- .svg {
- width: 22px;
- height: 22px;
- }
- .left {
- width: calc(100% - 60px);
- height: 60px;
- margin: 0 auto;
- display: flex;
- align-items: center;
- border-bottom: 1px solid #ccc;
- color: #000;
- font-size: 18px;
- font-weight: 600;
- .camera {
- margin-right: 15px;
- color: #4392f7;
- }
- }
- .scroll {
- width: calc(100% - 60px);
- height: calc(100% - 61px);
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- .middle {
- width: calc(100%);
- color: #000;
- .filter {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- .search {
- margin-left: 0 !important;
- color: #fff;
- }
- .condition {
- display: flex;
- align-items: center;
- margin: 10px 30px 10px 0;
- :deep(.el-input .el-input__inner) {
- font-size: 14px;
- }
- .el-select {
- width: 220px;
- }
- span {
- margin: 0 10px 0 0;
- }
- }
- }
- .gongneng {
- margin: 10px 0;
- .el-button {
- color: #fff;
- margin-right: 15px;
- }
- }
- }
- .footer {
- width: calc(100%);
- flex: 1;
- margin: 0 auto;
- overflow: auto;
- .el-table--fit {
- height: calc(100% - 60px);
- :deep(.el-table__header-wrapper) {
- background-color: #000;
- font-size: 15px;
- color: #000;
- .cell {
- color: #000;
- }
- }
- :deep(.el-table__row) {
- height: 50px;
- font-size: 15px;
- color: #000;
- }
- :deep(.el-table__row td) {
- padding: 0;
- border: 0;
- }
- .el-button--primary {
- margin-left: 5px;
- }
- :deep(.el-table__body .even) {
- background-color: #fff;
- }
- :deep(.el-table__body .odd) {
- background-color: rgba(240, 243, 247, 1);
- }
- :deep(.options) {
- display: flex;
- justify-content: center;
- align-items: center;
- .open {
- color: #2697ff;
- cursor: pointer;
- margin: 0 15px 0 0;
- }
- .edit {
- margin: 0 15px 0 0;
- color: rgba(0, 186, 173, 1);
- cursor: pointer;
- }
- .delete {
- color: rgba(212, 48, 48, 1);
- cursor: pointer;
- }
- }
- }
- .pageSize {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 0 30px;
- height: 60px;
- span {
- color: #000;
- }
- .el-pagination {
- // width: 1600px;
- :deep(.el-pagination__total) {
- color: #000;
- }
- :deep(.el-pagination__goto) {
- color: #000;
- }
- :deep(.el-pagination__classifier) {
- color: #000;
- }
- :deep(.el-input__wrapper) {
- border: 1px solid rgba(0, 0, 0, 1);
- border-radius: 5px;
- box-shadow: none;
- }
- :deep(.el-pager li) {
- margin: 0 5px;
- border: 1px solid rgba(0, 0, 0, 1);
- border-radius: 5px;
- background-color: transparent;
- }
- :deep(.el-pager li.is-active) {
- // background-color: rgba(0, 97, 255, 0.8);
- border: 1px solid rgba(0, 97, 255, 1);
- color: rgba(0, 97, 255, 1);
- }
- :deep(.btn-prev) {
- margin-right: 5px;
- border: 1px solid rgba(0, 0, 0, 1);
- border-radius: 5px;
- background-color: transparent;
- }
- :deep(.btn-next) {
- margin-left: 5px;
- border: 1px solid rgba(0, 0, 0, 1);
- border-radius: 5px;
- background-color: transparent;
- }
- }
- }
- }
- }
- // 添加员工弹窗样式
- :deep(.addStaff) {
- .el-dialog__body {
- padding: 20px 20px 10px 20px;
- .el-input {
- width: 400px;
- .el-input__suffix-inner {
- color: rgba(61, 81, 232, 1);
- }
- }
- .el-select {
- width: 400px;
- }
- .el-tree {
- width: 400px;
- }
- }
- }
- }
- </style>
|