优化了前端界面

This commit is contained in:
GitHub 2024-12-28 19:39:58 +08:00
parent 5959a7c395
commit f99885e7b6
3 changed files with 0 additions and 495 deletions

View File

@ -1,44 +0,0 @@
import request from '@/utils/request'
// 查询缺寝信息表列表
export function listAbsent(query) {
return request({
url: '/system/absent/list',
method: 'get',
params: query
})
}
// 查询缺寝信息表详细
export function getAbsent(id) {
return request({
url: '/system/absent/' + id,
method: 'get'
})
}
// 新增缺寝信息表
export function addAbsent(data) {
return request({
url: '/system/absent',
method: 'post',
data: data
})
}
// 修改缺寝信息表
export function updateAbsent(data) {
return request({
url: '/system/absent',
method: 'put',
data: data
})
}
// 删除缺寝信息表
export function delAbsent(id) {
return request({
url: '/system/absent/' + id,
method: 'delete'
})
}

View File

@ -1,374 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="building_id" prop="buildingId">
<el-input
v-model="queryParams.buildingId"
placeholder="请输入building_id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="dormitory_id" prop="dormitoryId">
<el-input
v-model="queryParams.dormitoryId"
placeholder="请输入dormitory_id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="student_id" prop="studentId">
<el-input
v-model="queryParams.studentId"
placeholder="请输入student_id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="dormitory_admin_id" prop="dormitoryAdminId">
<el-input
v-model="queryParams.dormitoryAdminId"
placeholder="请输入dormitory_admin_id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="create_date" prop="createDate">
<el-input
v-model="queryParams.createDate"
placeholder="请输入create_date"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="reason" prop="reason">
<el-input
v-model="queryParams.reason"
placeholder="请输入reason"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:absent:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:absent:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:absent:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['system:absent:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="absentList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="building_id" align="center" prop="buildingId" />
<el-table-column label="dormitory_id" align="center" prop="dormitoryId" />
<el-table-column label="student_id" align="center" prop="studentId" />
<el-table-column label="dormitory_admin_id" align="center" prop="dormitoryAdminId" />
<el-table-column label="create_date" align="center" prop="createDate" />
<el-table-column label="reason" align="center" prop="reason" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:absent:edit']">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:absent:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改缺寝信息表对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="absentRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="building_id" prop="buildingId">
<el-input v-model="form.buildingId" placeholder="请输入building_id" />
</el-form-item>
<el-form-item label="dormitory_id" prop="dormitoryId">
<el-input v-model="form.dormitoryId" placeholder="请输入dormitory_id" />
</el-form-item>
<el-form-item label="student_id" prop="studentId">
<el-input v-model="form.studentId" placeholder="请输入student_id" />
</el-form-item>
<el-form-item label="dormitory_admin_id" prop="dormitoryAdminId">
<el-input v-model="form.dormitoryAdminId" placeholder="请输入dormitory_admin_id" />
</el-form-item>
<el-form-item label="create_date" prop="createDate">
<el-input v-model="form.createDate" placeholder="请输入create_date" />
</el-form-item>
<el-form-item label="reason" prop="reason">
<el-input v-model="form.reason" placeholder="请输入reason" />
</el-form-item>
<el-divider content-position="center">学生表信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAddStudent">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="Delete" @click="handleDeleteStudent">删除</el-button>
</el-col>
</el-row>
<el-table :data="studentList" :row-class-name="rowStudentIndex" @selection-change="handleStudentSelectionChange" ref="student">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="number" prop="number" width="150">
<template #default="scope">
<el-input v-model="scope.row.number" placeholder="请输入number" />
</template>
</el-table-column>
<el-table-column label="gender" prop="gender" width="150">
<template #default="scope">
<el-input v-model="scope.row.gender" placeholder="请输入gender" />
</template>
</el-table-column>
<el-table-column label="dormitory_id" prop="dormitoryId" width="150">
<template #default="scope">
<el-input v-model="scope.row.dormitoryId" placeholder="请输入dormitory_id" />
</template>
</el-table-column>
<el-table-column label="state" prop="state" width="150">
<template #default="scope">
<el-input v-model="scope.row.state" placeholder="请输入state" />
</template>
</el-table-column>
<el-table-column label="create_date" prop="createDate" width="150">
<template #default="scope">
<el-input v-model="scope.row.createDate" placeholder="请输入create_date" />
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Absent">
import { listAbsent, getAbsent, delAbsent, addAbsent, updateAbsent } from "@/api/system/absent";
const { proxy } = getCurrentInstance();
const absentList = ref([]);
const studentList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const checkedStudent = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
buildingId: null,
dormitoryId: null,
studentId: null,
dormitoryAdminId: null,
createDate: null,
reason: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询缺寝信息表列表 */
function getList() {
loading.value = true;
listAbsent(queryParams.value).then(response => {
absentList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
id: null,
buildingId: null,
dormitoryId: null,
studentId: null,
dormitoryAdminId: null,
createDate: null,
reason: null
};
studentList.value = [];
proxy.resetForm("absentRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
//
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加缺寝信息表";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getAbsent(_id).then(response => {
form.value = response.data;
studentList.value = response.data.studentList;
open.value = true;
title.value = "修改缺寝信息表";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["absentRef"].validate(valid => {
if (valid) {
form.value.studentList = studentList.value;
if (form.value.id != null) {
updateAbsent(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addAbsent(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除缺寝信息表编号为"' + _ids + '"的数据项?').then(function() {
return delAbsent(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 学生表序号 */
function rowStudentIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
}
/** 学生表添加按钮操作 */
function handleAddStudent() {
let obj = {};
obj.number = "";
obj.gender = "";
obj.dormitoryId = "";
obj.state = "";
obj.createDate = "";
studentList.value.push(obj);
}
/** 学生表删除按钮操作 */
function handleDeleteStudent() {
if (checkedStudent.value.length == 0) {
proxy.$modal.msgError("请先选择要删除的学生表数据");
} else {
const students = studentList.value;
const checkedStudents = checkedStudent.value;
studentList.value = students.filter(function(item) {
return checkedStudents.indexOf(item.index) == -1
});
}
}
/** 复选框选中数据 */
function handleStudentSelectionChange(selection) {
checkedStudent.value = selection.map(item => item.index)
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('system/absent/export', {
...queryParams.value
}, `absent_${new Date().getTime()}.xlsx`)
}
getList();
</script>

View File

@ -120,44 +120,6 @@
<el-form-item label="telephone" prop="telephone">
<el-input v-model="form.telephone" placeholder="请输入telephone" />
</el-form-item>
<el-divider content-position="center">学生表信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="Plus" @click="handleAddStudent">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="Delete" @click="handleDeleteStudent">删除</el-button>
</el-col>
</el-row>
<el-table :data="studentList" :row-class-name="rowStudentIndex" @selection-change="handleStudentSelectionChange" ref="student">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="number" prop="number" width="150">
<template #default="scope">
<el-input v-model="scope.row.number" placeholder="请输入number" />
</template>
</el-table-column>
<el-table-column label="name" prop="name" width="150">
<template #default="scope">
<el-input v-model="scope.row.name" placeholder="请输入name" />
</template>
</el-table-column>
<el-table-column label="gender" prop="gender" width="150">
<template #default="scope">
<el-input v-model="scope.row.gender" placeholder="请输入gender" />
</template>
</el-table-column>
<el-table-column label="state" prop="state" width="150">
<template #default="scope">
<el-input v-model="scope.row.state" placeholder="请输入state" />
</template>
</el-table-column>
<el-table-column label="create_date" prop="createDate" width="150">
<template #default="scope">
<el-input v-model="scope.row.createDate" placeholder="请输入create_date" />
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
@ -175,12 +137,10 @@ import { listDormitory, getDormitory, delDormitory, addDormitory, updateDormitor
const { proxy } = getCurrentInstance();
const dormitoryList = ref([]);
const studentList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const checkedStudent = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
@ -229,7 +189,6 @@ function reset() {
availabe: null,
telephone: null
};
studentList.value = [];
proxy.resetForm("dormitoryRef");
}
@ -265,7 +224,6 @@ function handleUpdate(row) {
const _id = row.id || ids.value
getDormitory(_id).then(response => {
form.value = response.data;
studentList.value = response.data.studentList;
open.value = true;
title.value = "修改宿舍表";
});
@ -275,7 +233,6 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["dormitoryRef"].validate(valid => {
if (valid) {
form.value.studentList = studentList.value;
if (form.value.id != null) {
updateDormitory(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
@ -304,40 +261,6 @@ function handleDelete(row) {
}).catch(() => {});
}
/** 学生表序号 */
function rowStudentIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
}
/** 学生表添加按钮操作 */
function handleAddStudent() {
let obj = {};
obj.number = "";
obj.name = "";
obj.gender = "";
obj.state = "";
obj.createDate = "";
studentList.value.push(obj);
}
/** 学生表删除按钮操作 */
function handleDeleteStudent() {
if (checkedStudent.value.length == 0) {
proxy.$modal.msgError("请先选择要删除的学生表数据");
} else {
const students = studentList.value;
const checkedStudents = checkedStudent.value;
studentList.value = students.filter(function(item) {
return checkedStudents.indexOf(item.index) == -1
});
}
}
/** 复选框选中数据 */
function handleStudentSelectionChange(selection) {
checkedStudent.value = selection.map(item => item.index)
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('system/dormitory/export', {