完善了router表,前端缺席表格单页化
This commit is contained in:
parent
ba3d2ae9c9
commit
19cb07d9dd
|
@ -423,6 +423,7 @@
|
|||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.9.1.tgz",
|
||||
"integrity": "sha512-9Agqf/jt4Ugk7EZ6C5LME71sgkvauPCsnvJN12Xid2XVobjufxMGpRE4L7pS4luJMOmFAH3J0NgYEGZT5r+NDg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ctrl/tinycolor": "^3.4.1",
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
|
@ -64,6 +64,11 @@ const routes = [
|
|||
path: '/studentUpdate',
|
||||
name: '修改学生',
|
||||
component: StudentUpdate
|
||||
},
|
||||
{
|
||||
path: '/absentRecord',
|
||||
name: '缺寝记录',
|
||||
component: AbsentRecord
|
||||
}/* ,
|
||||
{
|
||||
path: '/buildingAdd',
|
||||
|
|
|
@ -27,17 +27,17 @@
|
|||
width="130">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="buildingName"
|
||||
prop="buildingId"
|
||||
label="楼宇"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="dormitoryName"
|
||||
prop="dormitoryId"
|
||||
label="宿舍"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="studentName"
|
||||
prop="studentId"
|
||||
label="学生"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
|
@ -47,7 +47,7 @@
|
|||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="dormitoryAdminName"
|
||||
prop="dormitoryAdminId"
|
||||
label="宿管"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
|
@ -57,34 +57,21 @@
|
|||
width="180">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="margin-top: 20px;float: right"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
:current-page.sync="currentPage"
|
||||
@current-change="page">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableData: null,
|
||||
currentPage: 1,
|
||||
pageSize: 3,
|
||||
total: null,
|
||||
tableData: [],
|
||||
key: '',
|
||||
value: '',
|
||||
ruleForm: {
|
||||
key: '',
|
||||
value: '',
|
||||
page: '',
|
||||
size: 3
|
||||
value: ''
|
||||
},
|
||||
rules: {
|
||||
key: [
|
||||
|
@ -95,44 +82,21 @@
|
|||
},
|
||||
methods: {
|
||||
submitForm(formName) {
|
||||
const _this = this
|
||||
//让翻页复原
|
||||
_this.currentPage=1
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
const _this = this
|
||||
_this.ruleForm.page = _this.currentPage
|
||||
axios.get('http://localhost:8080/absent/search',{params:_this.ruleForm}).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
axios.get('http://localhost:8080/system/absent/search', { params: this.ruleForm })
|
||||
.then(resp => {
|
||||
this.tableData = resp.data.data.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching data:', error);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
page(currentPage){
|
||||
const _this = this
|
||||
if(_this.ruleForm.value == ''){
|
||||
axios.get('http://localhost:8080/absent/list/'+currentPage+'/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
})
|
||||
} else {
|
||||
_this.ruleForm.page = _this.currentPage
|
||||
axios.get('http://localhost:8080/absent/search',{params:_this.ruleForm}).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const _this = this
|
||||
axios.get('http://localhost:8080/absent/list/1/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
})
|
||||
axios.get('http://localhost:8080/system/absent/list')
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue