master
markma 3 years ago
parent b9606c77c0
commit 2b948c24a7

@ -13,6 +13,8 @@ import OuterHistory from "../views/OuterHistory";
import OuterAppForm from "../views/OuterAppForm";
import OuterAppDetail from "../views/OuterAppDetail";
import NoAuthority from "../views/NoAuthority";
import SetComment from "../views/SetComment"
import GetComment from "../views/GetComment"
Vue.use(VueRouter)
@ -42,6 +44,11 @@ const routes = [
path: "/user/student/:id/appForm",
name: "填写申请表单",
component: StudentAppForm
},
{
path: "/user/student/:id/setComment",
name: "匿名评论",
component: SetComment
}
]
},
@ -61,6 +68,11 @@ const routes = [
name: "处理批假申请",
component: TeacherApplication
},
{
path: "/user/teacher/:id/setComment",
name: "教师匿名评论",
component: SetComment
}
]
},
{
@ -83,6 +95,11 @@ const routes = [
path: "/user/outer/:id/appDetail/",
name: "外出申请详情",
component: OuterAppDetail
},
{
path: "/user/outer/:id/getComment",
name: "查看评论",
component: GetComment
}
]
},

@ -0,0 +1,127 @@
<template>
<div>
<el-table
ref="multipleTable"
:data="tableData"
:default-sort="{prop: 'date', order: 'descending'}"
border
stripe
style="width: 90%">
<el-table-column
type="selection">
</el-table-column>
<el-table-column
fixed
label="编号"
prop="id"
width="100">
</el-table-column>
<el-table-column
label="评论名称"
prop="comment_detail"
width="800">
</el-table-column>
<el-table-column>
<template slot-scope="scope">
<el-button size="small" type="danger" @click="deleteLD(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button type="danger" @click="allDeleteLD()"></el-button>
<el-button @click="toggleSelection()"></el-button>
</div>
<el-pagination
:page-size="pageSize"
:total="total"
background
layout="prev, pager, next"
@current-change="page">
</el-pagination>
</div>
</template>
<script>
export default {
name: "StudentHistory",
methods: {
page(currentPage) {
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/comment/findAllPaged/' + (currentPage) + '/10').then(function (resp) {
console.log(resp.data)
_this.tableData = resp.data
_this.pageSize = 10
})
axios.get('http://localhost:8181/comment/findAllNum').then(function (resp) {
_this.total = resp.data
})
},
deleteLD(id) {
const _this = this
axios.get('http://localhost:8181/comment/delete/' + id).then(function (resp) {
location.reload();
})
},
allDeleteLD() {
let arrLength = this.$refs.multipleTable.selection.length;
for (let i = 0; i < arrLength; i++) {
axios.get('http://localhost:8181/comment/delete/' + this.$refs.multipleTable.selection[i].id)
}
location.reload();
},
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
},
data() {
return {
pageSize: 20,
total: 11,
tableData: [{
id: 1,
comment_detail: '挺好的',
}]
}
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
let type = window.location.pathname.split('/')[2];
axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) {
if (resp.data != 'success') {
_this.$router.push("/NoAuthority")
} else {
let login_id = _this.$cookieStore.getCookie("login_id")
console.log(login_id)
if (login_id != id) {
_this.$router.push("/NoAuthority")
}
}
})
axios.get('http://localhost:8181/comment/findAllPaged/1/10').then(function (resp) {
console.log(resp.data)
_this.tableData = resp.data
_this.pageSize = 10
})
axios.get('http://localhost:8181/comment/findAllNum').then(function (resp) {
_this.total = resp.data
})
}
}
</script>
<style scoped>
</style>

@ -12,6 +12,7 @@
<el-menu router>
<el-menu-item index="history">外出批准历史</el-menu-item>
<el-menu-item index="appForm">处理外出申请</el-menu-item>
<el-menu-item index="getComment">查看评论</el-menu-item>
</el-menu>
</el-aside>

@ -0,0 +1,80 @@
<template>
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm" label-width="100px">
<h4>请在这里写下对本系统的匿名评论</h4>
<el-form-item label="评论" maxlength="255" prop="comment_detail">
<el-input v-model="ruleForm.comment_detail" :rows="10" maxlength="255" show-word-limit type="textarea"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')"></el-button>
<el-button @click="resetForm('ruleForm')"></el-button>
</el-form-item>
</el-form>
</template>
<script>
export default {
name: "StudentAppForm",
data() {
return {
ruleForm: {
userid: '',
comment_detail: '',
},
rules: {
comment_detail: [
{required: true, message: '评论不能为空', trigger: 'blur'}
],
}
};
},
methods: {
submitForm(formName) {
const _this = this
let id = window.location.pathname.split('/')[3];
this.$refs[formName].validate((valid) => {
if (valid) {
this.ruleForm.userid = id
axios.post('http://localhost:8181/comment/save', this.ruleForm).then(function (resp) {
if (resp.data == 'success') {
_this.$alert('保存成功', '消息', {
confirmButtonText: '确定',
callback: action => {
_this.$router.push('/user/student/' + id + '/history')
}
})
}
})
} else {
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
let type = window.location.pathname.split('/')[2];
axios.get('http://localhost:8181/user/checkUseridAndType/' + id + '/' + type).then(function (resp) {
if (resp.data != 'success') {
_this.$router.push("/NoAuthority")
} else {
let login_id = _this.$cookieStore.getCookie("login_id")
console.log(login_id)
if (login_id != id) {
_this.$router.push("/NoAuthority")
}
}
})
}
}
</script>
<style scoped>
</style>

@ -12,6 +12,7 @@
<el-menu-item index="history">外出历史</el-menu-item>
<el-menu-item index="application">申请记录</el-menu-item>
<el-menu-item index="appForm">填写申请表单</el-menu-item>
<el-menu-item index="setComment">匿名评论</el-menu-item>
</el-menu>
</el-aside>

@ -13,6 +13,7 @@
<el-menu router>
<el-menu-item index="history">批假历史</el-menu-item>
<el-menu-item index="application">处理批假申请</el-menu-item>
<el-menu-item index="setComment">匿名评论</el-menu-item>
</el-menu>
</el-aside>

Loading…
Cancel
Save