markma 4 years ago
commit 74c395a530

23
.gitignore vendored

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

@ -0,0 +1,19 @@
# leave_manager
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn serve
```
### Compiles and minifies for production
```
yarn build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

10801
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,31 @@
{
"name": "leave_manager",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"core-js": "^3.6.5",
"element-ui": "^2.15.6",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"axios": "^0.18.0",
"vue-cli-plugin-axios": "^0.0.4",
"vue-cli-plugin-element": "^1.0.1",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -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>

@ -0,0 +1,5 @@
<template>
<div id="app">
<router-view></router-view>
</div>
</template>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

@ -0,0 +1,59 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

@ -0,0 +1,14 @@
import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')

@ -0,0 +1,61 @@
"use strict";
import Vue from 'vue';
import axios from "axios";
// Full config: https://github.com/axios/axios#request-config
// axios.defaults.baseURL = process.env.baseURL || process.env.apiUrl || '';
// axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
let config = {
// baseURL: process.env.baseURL || process.env.apiUrl || ""
// timeout: 60 * 1000, // Timeout
// withCredentials: true, // Check cross-site Access-Control
};
const _axios = axios.create(config);
_axios.interceptors.request.use(
function(config) {
// Do something before request is sent
return config;
},
function(error) {
// Do something with request error
return Promise.reject(error);
}
);
// Add a response interceptor
_axios.interceptors.response.use(
function(response) {
// Do something with response data
return response;
},
function(error) {
// Do something with response error
return Promise.reject(error);
}
);
Plugin.install = function(Vue, options) {
Vue.axios = _axios;
window.axios = _axios;
Object.defineProperties(Vue.prototype, {
axios: {
get() {
return _axios;
}
},
$axios: {
get() {
return _axios;
}
},
});
};
Vue.use(Plugin)
export default Plugin;

@ -0,0 +1,5 @@
import Vue from 'vue'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Element)

@ -0,0 +1,69 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'
import StudentUserIndex from '../views/StudentUserIndex'
import StudentHistory from '../views/StudentHistory'
import StudentApplication from '../views/StudentApplication'
import StudentAppForm from '../views/StudentAppForm'
import TeacherUserIndex from "../views/TeacherUserIndex";
import TeacherApplication from "../views/TeacherApplication";
import TeacherHistory from "../views/TeacherHistory";
Vue.use(VueRouter)
const routes = [
{
path: "/",
name: "主页面",
component: Login
},
{
path: '/user/student/:id',
name: '学生用户主界面',
component: StudentUserIndex,
redirect:"/user/student/:id/history",
children:[
{
path: "/user/student/:id/history",
name: "外出历史",
component: StudentHistory
},
{
path: "/user/student/:id/application",
name: "申请记录",
component: StudentApplication
},
{
path: "/user/student/:id/appForm",
name: "填写申请表单",
component: StudentAppForm
}
]
},
{
path: '/user/teacher/:id',
name: '教师用户主界面',
component: TeacherUserIndex,
redirect:"/user/teacher/:id/history",
children:[
{
path: "/user/teacher/:id/history",
name: "批假历史",
component: TeacherHistory
},
{
path: "/user/teacher/:id/application",
name: "处理批假申请",
component: TeacherApplication
},
]
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router

@ -0,0 +1,15 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
modules: {
}
})

@ -0,0 +1,71 @@
<template>
<el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="账号" prop="username">
<el-input v-model="ruleForm.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input type="password" v-model="ruleForm.password" autocomplete="off"></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 {
data() {
return {
ruleForm: {
username: '',
password: '',
},
rules: {
username: [
{required: true, message: '请输入账号', trigger: 'blur'}
],
password: [
{required: true, message: '请输入密码', trigger: 'blur'}
],
}
};
},
methods: {
submitForm(formName) {
const _this = this
this.$refs[formName].validate((valid) => {
if (valid) {
axios.get('http://localhost:8181/user/findAndCheck/' + this.ruleForm.username + '/' + this.ruleForm.password, this.ruleForm).then(function (resp) {
if (resp.data == 'error:wrong username') {
_this.$alert('用户名错误')
} else if (resp.data == 'error:wrong password') {
_this.$alert('密码错误')
} else {
const id = resp.data.split(' ')[0];
const type = resp.data.split(' ')[1];
_this.$alert('登录成功!', '登录消息', {
confirmButtonText: '确定',
callback: action => {
_this.$router.push('/user/' + type + '/' + id)
}
})
}
})
} else {
return false;
}
}
);
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,98 @@
<template>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<span class="demonstration">离开时间</span>
<el-date-picker
v-model="ruleForm.leave_time"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间">
</el-date-picker>
<span class="demonstration">返回时间</span>
<el-date-picker
v-model="ruleForm.back_time"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间">
</el-date-picker>
<el-form-item label="外出地点" prop="place">
<el-input v-model="ruleForm.place"></el-input>
</el-form-item>
<el-form-item label="外出理由" prop="reason">
<el-input v-model="ruleForm.reason"></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: '',
leave_time: '',
back_time: '',
place: '',
reason: '',
type: '审核中'
},
rules: {
leave_time: [
{required: true, message: '请输入起始时间', trigger: 'blur'}
],
back_time: [
{required: true, message: '请输入结束时间', trigger: 'blur'},
],
place: [
{required: true, message: '请输入目的地址', trigger: 'blur'}
],
reason: [
{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/leaveDetail/save', this.ruleForm).then(function (resp) {
if (resp.data == 'success') {
_this.$alert('保存成功', '消息', {
confirmButtonText: '确定',
callback: action => {
_this.$router.push('/user/student/' + id + '/history')
}
})
}
else if(resp.data == 'time failed'){
_this.$alert('时间错误', '消息', {
confirmButtonText: '确定',
})
}
})
}
else {
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
}
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,102 @@
<template>
<div>
<el-table
:data="tableData"
border
style="width: 90%">
<el-table-column
fixed
prop="id"
label="编号"
width="100">
</el-table-column>
<el-table-column
prop="leave_time"
label="出发时间"
width="200">
</el-table-column>
<el-table-column
prop="back_time"
label="返回时间"
width="200">
</el-table-column>
<el-table-column
prop="place"
label="地点"
width="200">
</el-table-column>
<el-table-column
prop="reason"
label="外出原因"
width="200">
</el-table-column>
<el-table-column
prop="type"
label="状态"
width="120">
</el-table-column>
</el-table>
<el-pagination
background
layout="prev, pager, next"
:page-size="pageSize"
:total="total"
@current-change="page">
</el-pagination>
</div>
</template>
<script>
export default {
name: "StudentApplication",
methods:{
page(currentPage){
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/leaveDetail/findByNotType/已过期/'+id+'/'+(currentPage)+'/6').then(function(resp){
console.log(resp)
_this.tableData = resp.data
_this.pageSize = 6
_this.total = resp.data.length
})
}
},
data() {
return {
pageSize: 6,
total: 11,
tableData: [{
id: 1,
leave_time: '2021-12-20 16:59:15',
back_time: '2222-12-21 17:28:59',
place: '万家丽',
reason: '见导师',
type: '已过期'
}]
}
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/leaveDetail/findByNotType/已过期/'+id+'/1/6').then(function(resp){
/*
_this.id = resp.data.id
_this.leave_time = resp.data.leave_time
_this.back_time = resp.data.back_time
_this.place = resp.data.place
_this.reason = resp.data.reason
_this.type = resp.data.type
console.log(resp)
*/
console.log(resp.data)
_this.tableData = resp.data
_this.pageSize = 6
_this.total = resp.data.length
})
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,103 @@
<template>
<div>
<el-table
:data="tableData"
border
style="width: 90%">
<el-table-column
fixed
prop="id"
label="编号"
width="100">
</el-table-column>
<el-table-column
prop="leave_time"
label="出发时间"
width="200">
</el-table-column>
<el-table-column
prop="back_time"
label="返回时间"
width="200">
</el-table-column>
<el-table-column
prop="place"
label="地点"
width="200">
</el-table-column>
<el-table-column
prop="reason"
label="外出原因"
width="200">
</el-table-column>
<el-table-column
prop="type"
label="状态"
width="120">
</el-table-column>
</el-table>
<el-pagination
background
layout="prev, pager, next"
:page-size="pageSize"
:total="total"
@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/leaveDetail/findByType/已过期/'+id+'/'+(currentPage)+'/6').then(function(resp){
console.log(resp)
_this.tableData = resp.data
_this.pageSize = 6
_this.total = resp.data.length
})
}
},
data() {
return {
pageSize: 6,
total: 11,
tableData: [{
id: 1,
leave_time: '2021-12-20 16:59:15',
back_time: '2222-12-21 17:28:59',
place: '万家丽',
reason: '见导师',
type: '已过期'
}]
}
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/leaveDetail/findByType/已过期/'+id+'/1/6').then(function(resp){
/*
_this.id = resp.data.id
_this.leave_time = resp.data.leave_time
_this.back_time = resp.data.back_time
_this.place = resp.data.place
_this.reason = resp.data.reason
_this.type = resp.data.type
console.log(resp)
*/
console.log(resp.data)
_this.tableData = resp.data
_this.pageSize = 6
_this.total = resp.data.length
})
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,51 @@
<template>
<div>
<h4>姓名{{information.name}} 编号{{information.school_id}}</h4>
<el-container style="height: 500px; border: 1px solid #eee">
<el-aside width="200px" style="background-color: rgb(238, 241, 246)">
<el-menu router >
<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>
</el-aside>
<el-main>
<router-view></router-view>
</el-main>
</el-container>
</div>
</template>
<script>
export default {
name: "StudentUserIndex",
data(){
return {
information: [
{
id: 1,
school_id: '123',
name: '张三'
}
]
}
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/userDetail/findById/'+id).then(function (resp){
_this.information = resp.data
})
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: "TeacherApplication"
}
</script>
<style scoped>
</style>

@ -0,0 +1,103 @@
<template>
<div>
<el-table
:data="tableData"
border
style="width: 90%">
<el-table-column
fixed
prop="id"
label="编号"
width="100">
</el-table-column>
<el-table-column
prop="leave_time"
label="出发时间"
width="200">
</el-table-column>
<el-table-column
prop="back_time"
label="返回时间"
width="200">
</el-table-column>
<el-table-column
prop="place"
label="地点"
width="200">
</el-table-column>
<el-table-column
prop="reason"
label="外出原因"
width="200">
</el-table-column>
<el-table-column
prop="type"
label="状态"
width="120">
</el-table-column>
</el-table>
<el-pagination
background
layout="prev, pager, next"
:page-size="pageSize"
:total="total"
@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/leaveDetail/findByNotTypeNoID/审核中/'+(currentPage)+'/6').then(function(resp){
console.log(resp)
_this.tableData = resp.data
_this.pageSize = 6
_this.total = resp.data.length
})
}
},
data() {
return {
pageSize: 6,
total: 11,
tableData: [{
id: 1,
leave_time: '2021-12-20 16:59:15',
back_time: '2222-12-21 17:28:59',
place: '万家丽',
reason: '见导师',
type: '已过期'
}]
}
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/leaveDetail/findByNotTypeNoID/审核中/1/6').then(function(resp){
/*
_this.id = resp.data.id
_this.leave_time = resp.data.leave_time
_this.back_time = resp.data.back_time
_this.place = resp.data.place
_this.reason = resp.data.reason
_this.type = resp.data.type
console.log(resp)
*/
console.log(resp.data)
_this.tableData = resp.data
_this.pageSize = 6
_this.total = resp.data.length
})
}
}
</script>
<style scoped>
</style>

@ -0,0 +1,50 @@
<template>
<div>
<h4>姓名{{information.name}} 编号{{information.school_id}}</h4>
<el-container style="height: 500px; border: 1px solid #eee">
<el-aside width="200px" style="background-color: rgb(238, 241, 246)">
<el-menu router >
<el-menu-item index="history">批假历史</el-menu-item>
<el-menu-item index="application">处理批假申请</el-menu-item>
</el-menu>
</el-aside>
<el-main>
<router-view></router-view>
</el-main>
</el-container>
</div>
</template>
<script>
export default {
name: "StudentUserIndex",
data(){
return {
information: [
{
id: 1,
school_id: '123',
name: '张三'
}
]
}
},
created() {
const _this = this
let id = window.location.pathname.split('/')[3];
axios.get('http://localhost:8181/userDetail/findById/'+id).then(function (resp){
_this.information = resp.data
})
}
}
</script>
<style scoped>
</style>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save