完善了router表,前端缺席表格单页化
This commit is contained in:
parent
ba3d2ae9c9
commit
19cb07d9dd
|
@ -423,6 +423,7 @@
|
||||||
"version": "2.9.1",
|
"version": "2.9.1",
|
||||||
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.9.1.tgz",
|
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.9.1.tgz",
|
||||||
"integrity": "sha512-9Agqf/jt4Ugk7EZ6C5LME71sgkvauPCsnvJN12Xid2XVobjufxMGpRE4L7pS4luJMOmFAH3J0NgYEGZT5r+NDg==",
|
"integrity": "sha512-9Agqf/jt4Ugk7EZ6C5LME71sgkvauPCsnvJN12Xid2XVobjufxMGpRE4L7pS4luJMOmFAH3J0NgYEGZT5r+NDg==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.1",
|
"@ctrl/tinycolor": "^3.4.1",
|
||||||
"@element-plus/icons-vue": "^2.3.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',
|
path: '/studentUpdate',
|
||||||
name: '修改学生',
|
name: '修改学生',
|
||||||
component: StudentUpdate
|
component: StudentUpdate
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/absentRecord',
|
||||||
|
name: '缺寝记录',
|
||||||
|
component: AbsentRecord
|
||||||
}/* ,
|
}/* ,
|
||||||
{
|
{
|
||||||
path: '/buildingAdd',
|
path: '/buildingAdd',
|
||||||
|
|
|
@ -27,17 +27,17 @@
|
||||||
width="130">
|
width="130">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="buildingName"
|
prop="buildingId"
|
||||||
label="楼宇"
|
label="楼宇"
|
||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="dormitoryName"
|
prop="dormitoryId"
|
||||||
label="宿舍"
|
label="宿舍"
|
||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="studentName"
|
prop="studentId"
|
||||||
label="学生"
|
label="学生"
|
||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="dormitoryAdminName"
|
prop="dormitoryAdminId"
|
||||||
label="宿管"
|
label="宿管"
|
||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -57,34 +57,21 @@
|
||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</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>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableData: null,
|
tableData: [],
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 3,
|
|
||||||
total: null,
|
|
||||||
key: '',
|
key: '',
|
||||||
value: '',
|
value: '',
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
key: '',
|
key: '',
|
||||||
value: '',
|
value: ''
|
||||||
page: '',
|
|
||||||
size: 3
|
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
key: [
|
key: [
|
||||||
|
@ -95,44 +82,21 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm(formName) {
|
submitForm(formName) {
|
||||||
const _this = this
|
|
||||||
//让翻页复原
|
|
||||||
_this.currentPage=1
|
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const _this = this
|
axios.get('http://localhost:8080/system/absent/search', { params: this.ruleForm })
|
||||||
_this.ruleForm.page = _this.currentPage
|
.then(resp => {
|
||||||
axios.get('http://localhost:8080/absent/search',{params:_this.ruleForm}).then(function (resp) {
|
this.tableData = resp.data.data.data;
|
||||||
_this.tableData = resp.data.data.data
|
|
||||||
_this.total = resp.data.data.total
|
|
||||||
})
|
})
|
||||||
|
.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() {
|
created() {
|
||||||
const _this = this
|
axios.get('http://localhost:8080/system/absent/list')
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue