完成学生模块的删除和启动的router配置
This commit is contained in:
parent
b1eea22b78
commit
ba3d2ae9c9
|
@ -27,7 +27,7 @@ const routes = [
|
|||
{
|
||||
path: '/systemAdmin',
|
||||
name: '系统管理员',
|
||||
component: SystemAdmin,
|
||||
component: SystemAdmin ,
|
||||
redirect: '/dormitoryAdminAdd',
|
||||
children:[
|
||||
{
|
||||
|
@ -35,11 +35,16 @@ const routes = [
|
|||
name: '宿管管理',
|
||||
component: DormitoryAdminManager
|
||||
},
|
||||
{
|
||||
path:'/',
|
||||
redirect:'/login',
|
||||
hidden:true
|
||||
},
|
||||
{
|
||||
path: '/dormitoryAdminAdd',
|
||||
name: '添加宿舍',
|
||||
component: DormitoryAdminAdd
|
||||
}/* ,
|
||||
} ,
|
||||
{
|
||||
path: '/dormitoryAdminUpdate',
|
||||
name: '修改宿舍',
|
||||
|
@ -59,7 +64,7 @@ const routes = [
|
|||
path: '/studentUpdate',
|
||||
name: '修改学生',
|
||||
component: StudentUpdate
|
||||
},
|
||||
}/* ,
|
||||
{
|
||||
path: '/buildingAdd',
|
||||
name: '添加楼宇',
|
||||
|
|
|
@ -12,10 +12,8 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="性别">
|
||||
<div style="width: 170px;height: 30px;">
|
||||
<template>
|
||||
<el-radio v-model="ruleForm.gender" label="男">男</el-radio>
|
||||
<el-radio v-model="ruleForm.gender" label="女">女</el-radio>
|
||||
</template>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="telephone">
|
||||
|
@ -64,8 +62,9 @@
|
|||
const _this = this
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
axios.post('http://localhost:8080/dormitoryAdmin/save',_this.ruleForm).then(function (resp) {
|
||||
if(resp.data.code == 0){
|
||||
axios.post('http://localhost:8080/system/dormitoryAdmin/add',_this.ruleForm).then(function (resp) {
|
||||
console.log(resp)
|
||||
if(resp.data.code == 200){
|
||||
_this.$alert(_this.ruleForm.username+'添加成功', '', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div style="margin-top: 60px;margin-left:80px;border: 0px solid red;" >
|
||||
<el-form style="margin-left: -40px" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
||||
<div style="margin-top: 60px;margin-left:-14px;border: 0px solid red;" >
|
||||
<!-- <el-form style="margin-left: -40px" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
||||
<el-form-item label="字段:" prop="key">
|
||||
<el-select v-model="ruleForm.key" style="width: 160px;float: left" placeholder="请选择字段">
|
||||
<el-option label="宿管账号" value="username"></el-option>
|
||||
|
@ -15,12 +15,26 @@
|
|||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
--><el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" style="display: flex; flex-direction: column;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-form-item label="字段:" prop="key" style="margin-right: 20px;">
|
||||
<el-select v-model="ruleForm.key" placeholder="请选择字段" style="width: 160px;">
|
||||
<el-option label="宿管账号" value="username"></el-option>
|
||||
<el-option label="宿管姓名" value="name"></el-option>
|
||||
<el-option label="宿管电话" value="telephone"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="值:" style="margin-left: auto;">
|
||||
<el-input v-model="ruleForm.value" placeholder="请输入关键字" style="width: 160px;"></el-input>
|
||||
<el-button type="primary" icon="el-icon-search" @click="submitForm('ruleForm')" style="margin-left: 10px;">搜索</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%;position: relative;top:-30px">
|
||||
style="width: 100%;position: relative;top:30px">
|
||||
<el-table-column
|
||||
fixed
|
||||
prop="id"
|
||||
|
@ -52,7 +66,7 @@
|
|||
label="联系电话"
|
||||
width="160">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<!-- <el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
@ -61,17 +75,32 @@
|
|||
size="mini"
|
||||
type="danger"
|
||||
@click="del(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作" #default="scope">
|
||||
<el-button size="mini" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="del(scope.row)">删除</el-button>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="margin-top: 20px;float: right"
|
||||
<!-- <el-pagination style="margin-top: 50px;float: right"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
:current-page.sync="currentPage"
|
||||
@current-change="page">
|
||||
</el-pagination>
|
||||
</el-pagination> -->
|
||||
<div>
|
||||
<el-pagination
|
||||
style="margin-top: 50px; float: right;"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
v-model:current-page="currentPage"
|
||||
@current-change="page"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
@ -109,9 +138,9 @@
|
|||
if (valid) {
|
||||
const _this = this
|
||||
_this.ruleForm.page = _this.currentPage
|
||||
axios.get('http://localhost:8080/dormitoryAdmin/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/dormitoryAdmin/search',{params:_this.ruleForm}).then(function (resp) {
|
||||
_this.tableData = resp.data.content
|
||||
_this.total = resp.data.totalElements
|
||||
})
|
||||
}
|
||||
});
|
||||
|
@ -119,15 +148,16 @@
|
|||
page(currentPage){
|
||||
const _this = this
|
||||
if(_this.ruleForm.value == ''){
|
||||
axios.get('http://localhost:8080/dormitoryAdmin/list/'+currentPage+'/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
axios.get('http://localhost:8080/system/dormitoryAdmin/list/'+currentPage+'/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.content
|
||||
_this.total = resp.data.totalElements
|
||||
})
|
||||
} else {
|
||||
_this.ruleForm.page = _this.currentPage
|
||||
axios.get('http://localhost:8080/dormitoryAdmin/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/dormitoryAdmin/search',{params:_this.ruleForm}).then(function (resp) {
|
||||
_this.tableData = resp.data.content
|
||||
_this.total = resp.data.totalElements
|
||||
console.log(resp.data)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -141,8 +171,8 @@
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
axios.delete('http://localhost:8080/dormitoryAdmin/deleteById/'+row.id).then(function (resp) {
|
||||
if(resp.data.code==0){
|
||||
axios.delete('http://localhost:8080/system/dormitoryAdmin/'+row.id).then(function (resp) {
|
||||
if(resp.data.code==200){
|
||||
_this.$alert('【'+row.username+'】已删除', '', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
@ -153,12 +183,13 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
const _this = this
|
||||
axios.get('http://localhost:8080/dormitoryAdmin/list/1/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
axios.get('http://127.0.0.1:8080/system/dormitoryAdmin/list/1/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.content
|
||||
_this.total = resp.data.totalElements
|
||||
console.log(resp.data)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="性别">
|
||||
<div style="width: 170px;height: 30px;">
|
||||
<template>
|
||||
<!-- <template> -->
|
||||
<el-radio v-model="ruleForm.gender" label="男">男</el-radio>
|
||||
<el-radio v-model="ruleForm.gender" label="女">女</el-radio>
|
||||
</template>
|
||||
<!-- </template> -->
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="telephone">
|
||||
|
@ -67,8 +67,9 @@
|
|||
const _this = this
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
axios.put('http://localhost:8080/dormitoryAdmin/update',_this.ruleForm).then(function (resp) {
|
||||
if(resp.data.code == 0){
|
||||
axios.put('http://localhost:8080/system/dormitoryAdmin/update',_this.ruleForm).then(function (resp) {
|
||||
console.log(resp.data);
|
||||
if(resp.data.code == 200){
|
||||
_this.$alert(_this.ruleForm.username+'修改成功', '', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
@ -86,8 +87,9 @@
|
|||
},
|
||||
created() {
|
||||
const _this = this
|
||||
axios.get('http://localhost:8080/dormitoryAdmin/findById/'+_this.$route.query.id).then(function (resp) {
|
||||
_this.ruleForm = resp.data.data
|
||||
axios.get('http://localhost:8080/system/dormitoryAdmin/findById/'+_this.$route.query.id).then(function (resp) {
|
||||
_this.ruleForm = resp.data.data
|
||||
console.log(resp.data.data)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
this.logining = true
|
||||
let _this = this
|
||||
if(_this.type == 'dormitoryAdmin'){
|
||||
axios.get('http://localhost:8080/dormitoryAdmin/login', {params:_this.ruleForm}).then(function (resp) {
|
||||
axios.get('http://localhost:8080/system/dormitoryAdmin/login', {params:_this.ruleForm}).then(function (resp) {
|
||||
console.log(resp)
|
||||
|
||||
_this.logining = false
|
||||
_this.logining = false
|
||||
if(resp.data.code == -1){
|
||||
_this.$alert('用户名不存在', '提示', {
|
||||
confirmButtonText: '确定'
|
||||
|
@ -45,13 +45,13 @@
|
|||
_this.$alert('宿舍管理员登录成功!','提示',{
|
||||
confirmButtonText:'确定'
|
||||
})
|
||||
localStorage.setItem('dormitoryAdmin', JSON.stringify(resp.data.data));
|
||||
_this.$router.replace({path: '/dormitoryAdmin'})
|
||||
/* localStorage.setItem('dormitoryAdmin', JSON.stringify(resp.data.data));
|
||||
_this.$router.replace({path: '/dormitoryAdmin'}) */
|
||||
}
|
||||
})
|
||||
}
|
||||
if(_this.type == 'systemAdmin'){
|
||||
axios.get('http://localhost:8080/systemAdmin/login', {params:_this.ruleForm}).then(function (resp) {
|
||||
axios.get('http://localhost:8080/system/systemAdmin/login', {params:_this.ruleForm}).then(function (resp) {
|
||||
_this.logining = false
|
||||
if(resp.data.code == -1){
|
||||
_this.$alert('用户名不存在', '提示', {
|
||||
|
@ -73,7 +73,7 @@
|
|||
_this.$router.replace({path: '/systemAdmin'})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<div style="width: 170px;height: 30px;">
|
||||
<template>
|
||||
<!-- <template> -->
|
||||
<el-radio v-model="ruleForm.gender" label="男">男</el-radio>
|
||||
<el-radio v-model="ruleForm.gender" label="女">女</el-radio>
|
||||
</template>
|
||||
<!-- </template> -->
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="宿舍" prop="dormitoryId">
|
||||
|
@ -63,8 +63,8 @@
|
|||
const _this = this
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
axios.post('http://localhost:8080/student/save',_this.ruleForm).then(function (resp) {
|
||||
if(resp.data.code == 0){
|
||||
axios.post('http://localhost:8080/system/student/save',_this.ruleForm).then(function (resp) {
|
||||
if(resp.data.code == 200){
|
||||
_this.$alert(_this.ruleForm.name+'添加成功', '', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
@ -82,7 +82,7 @@
|
|||
},
|
||||
created() {
|
||||
const _this = this
|
||||
axios.get('http://localhost:8080/dormitory/availableList').then(function (resp) {
|
||||
axios.get('http://localhost:8080/system/dormitory/available').then(function (resp) {
|
||||
_this.dormitoryList = resp.data.data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div style="margin-top: 60px;margin-left:80px;border: 0px solid red;" >
|
||||
<el-form style="margin-left: -40px" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
||||
<div style="margin-top: 60px;margin-left:-14px;border: 0px solid red;" >
|
||||
<!-- <el-form style="margin-left: -40px" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
||||
<el-form-item label="字段:" prop="key">
|
||||
<el-select v-model="ruleForm.key" style="width: 160px;float: left" placeholder="请选择字段">
|
||||
<el-option label="学号" value="number"></el-option>
|
||||
|
@ -13,13 +13,26 @@
|
|||
<el-button type="primary" icon="el-icon-search" style="position: relative;left: 10px;" @click="submitForm('ruleForm')">搜索</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
</el-form> -->
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" style="display: flex; flex-direction: column;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-form-item label="字段:" prop="key" style="margin-right: 20px;">
|
||||
<el-select v-model="ruleForm.key" placeholder="请选择字段" style="width: 160px;">
|
||||
<el-option label="学号" value="number"></el-option>
|
||||
<el-option label="姓名" value="name"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="值:" style="margin-left: auto;">
|
||||
<el-input v-model="ruleForm.value" placeholder="请输入关键字" style="width: 160px;"></el-input>
|
||||
<el-button type="primary" icon="el-icon-search" @click="submitForm('ruleForm')" style="margin-left: 10px;">搜索</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%;position: relative;top:-30px">
|
||||
style="width: 100%;position: relative;top:30px">
|
||||
<el-table-column
|
||||
fixed
|
||||
prop="id"
|
||||
|
@ -56,7 +69,7 @@
|
|||
label="入住时间"
|
||||
width="130">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<!-- <el-table-column label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
@ -66,16 +79,22 @@
|
|||
type="danger"
|
||||
@click="del(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="操作" #default="scope">
|
||||
<el-button size="mini" @click="edit(scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="del(scope.row)">删除</el-button>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination style="margin-top: 20px;float: right"
|
||||
<div>
|
||||
<el-pagination style="margin-top: 50px;float: right"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
:current-page.sync="currentPage"
|
||||
@current-change="page">
|
||||
</el-pagination>
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
@ -147,8 +166,8 @@
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
axios.delete('http://localhost:8080/student/deleteById/'+row.id).then(function (resp) {
|
||||
if(resp.data.code==0){
|
||||
axios.delete('http://127.0.0.1:8080/system/student/'+row.id).then(function (resp) {
|
||||
if(resp.data.code==200){
|
||||
_this.$alert('【'+row.name+'】已删除', '', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
|
@ -161,10 +180,10 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
const _this = this
|
||||
axios.get('http://localhost:8080/student/list/1/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.data.data
|
||||
_this.total = resp.data.data.total
|
||||
const _this = this
|
||||
axios.get('http://localhost:8080/system/student/list/1/'+_this.pageSize).then(function (resp) {
|
||||
_this.tableData = resp.data.content
|
||||
_this.total = resp.data.totalElements
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-container class="home_container">
|
||||
<el-header class="home_header">
|
||||
<div class="home_title">DORMS宿舍管理系统-系统管理员</div>
|
||||
<div class="home_title">宿舍管理系统-系统管理员</div>
|
||||
<div class="home_userinfoContainer">
|
||||
<!-- <el-dropdown>
|
||||
<span class="el-dropdown-link home_userinfo">
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
<el-menu>
|
||||
<el-sub-menu index="2">
|
||||
<template #title>{{admin.name}}</template>
|
||||
<template #title><el-icon style="width: 1em;height: 1em;"><Platform /></el-icon>{{admin.name}}</template>
|
||||
<el-menu-item index="2-1" @click.native="logout">退出登录</el-menu-item>
|
||||
</el-sub-menu>
|
||||
</el-menu>
|
||||
|
@ -123,7 +123,7 @@
|
|||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
export default{
|
||||
export default{
|
||||
methods: {
|
||||
logout(){
|
||||
let _this = this;
|
||||
|
@ -146,7 +146,7 @@
|
|||
let admin = JSON.parse(window.localStorage.getItem('systemAdmin'))
|
||||
this.admin = admin
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.home_container {
|
||||
|
|
Loading…
Reference in New Issue