增加了H5用的管理

This commit is contained in:
abu 2024-05-05 22:37:38 +08:00
parent 5ec5b3afbd
commit e1d4137bfc
14 changed files with 2147 additions and 83 deletions

View File

@ -4,7 +4,7 @@ import router from '@/router'
import qs from 'qs' import qs from 'qs'
import merge from 'lodash/merge' import merge from 'lodash/merge'
import { clearLoginInfo } from '@/utils' import { clearLoginInfo } from '@/utils'
const baseUrl = '/wx' // const baseUrl = '/wx'
const http = axios.create({ const http = axios.create({
timeout: 1000 * 30, timeout: 1000 * 30,
@ -43,7 +43,8 @@ http.interceptors.response.use(response => {
*/ */
http.adornUrl = (actionName) => { http.adornUrl = (actionName) => {
// 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截! // 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截!
return baseUrl + actionName // return baseUrl + actionName
return actionName
} }
/** /**

View File

@ -0,0 +1,185 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<!-- <el-form-item v-if="!dataForm.id ? true : false" label="身份码" prop="userId">-->
<!-- <el-input v-model="dataForm.userId" placeholder="登录帐号"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="用户名" >
<el-input v-model="dataForm.userName" placeholder="用户名"></el-input>
</el-form-item>
<el-form-item label="工号" >
<el-input v-model="dataForm.workNumber" placeholder="工号"></el-input>
</el-form-item>
<el-form-item label="职务" >
<el-input v-model="dataForm.duty" placeholder="职务"></el-input>
</el-form-item>
<el-form-item label="部门" >
<el-input v-model="dataForm.department" placeholder="部门"></el-input>
</el-form-item>
<el-form-item label="岗位" >
<el-input v-model="dataForm.job" placeholder="岗位"></el-input>
</el-form-item>
<!-- <el-form-item v-if="!dataForm.id ? true : false" label="身份">-->
<!-- <el-select v-model="dataForm.identity" placeholder="身份">-->
<!-- <el-option v-for="(name,key) in identityes" :key="key+1" :value="key+1" :label="name"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="所属组">
<el-select v-model="dataForm.groupId" placeholder="所属组">
<el-option v-for="item in groupIdes" :key="item.id" :value="item.id" :label="item.name">{{item.name}}</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="状态" size="mini" prop="status">-->
<!-- <el-radio-group v-model="dataForm.status">-->
<!-- <el-radio :label="1">禁用</el-radio>-->
<!-- <el-radio :label="0">正常</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import {is8Number} from '@/utils/validate'
import myRequest from "@/views/modules/h5/myRequest";
export default {
data() {
var validateuserId = (rule, value, callback) => {
if (!is8Number(value)) {
callback(new Error('请输入8位身份码(数字)'))
} else {
callback()
}
}
var validatePassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('密码不能为空'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userName: '',
groupId: '',
userId: '',
workNumber:'',
// major_id,
duty:'',
department:'',
job:''
},
identityes: ['管理员', '研究生', '本校老师', '外校老师'],
groupIdes: [],
dataRule: {
userName: [
{required: true, message: '用户名不能为空', trigger: 'blur'}
],
password: [
{validator: validatePassword, trigger: 'blur'}
],
userId: [
{required: true, message: '身份码不能为空', trigger: 'blur'},
{validator: validateuserId, trigger: 'blur'}
]
}
}
},
methods: {
init(id) {
myRequest.getGroupList2(this).then(res => {
this.groupIdes = res.data.list
})
if (id==undefined){
this.dataForm.userId = ''
this.dataForm.userName = ''
this.dataForm.groupId = ''
this.dataForm.workNumber = ''
this.dataForm.duty = ''
this.dataForm.department = ''
this.dataForm.job = ''
}
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 200 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
console.log('this.dataForm.id', this.dataForm.id)
this.$http({
url: this.$http.adornUrl(`/admin/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.dataForm.userName = data.user.userName
this.dataForm.groupId = data.user.groupId
this.dataForm.userId = data.user.userId
this.dataForm.workNumber = data.user.workNumber
this.dataForm.duty = data.user.duty
this.dataForm.department = data.user.department
this.dataForm.job = data.user.job
}
})
}
})
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/admin/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id':this.dataForm.id,
'userName': this.dataForm.userName,
'groupId': this.dataForm.groupId,
'userId': this.dataForm.userId,
'workNumber': this.dataForm.workNumber,
'duty': this.dataForm.duty,
'department': this.dataForm.department,
'job': this.dataForm.job,
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@ -1,19 +1,213 @@
<script>
export default {
name: "admin"
}
</script>
<template> <template>
<div> <div class="mod-user">
<h1>管理员管理</h1> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<h1>管理员管理</h1> <el-form-item>
<h1>管理员管理</h1> <el-input v-model="dataForm.userName" placeholder="用户身份码" clearable></el-input>
<h1>管理员管理</h1> </el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<!-- <el-button v-if="isAuth('adm:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<el-button v-if="isAuth('adm:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除
</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="80" label="ID">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="100" label="用户身份码">
</el-table-column>
<el-table-column prop="userName" header-align="center" align="center" label="用户名">
</el-table-column>
<el-table-column prop="workNumber" header-align="center" align="center" label="工号">
</el-table-column>
<el-table-column prop="duty" header-align="center" align="center" label="职务">
</el-table-column>
<el-table-column prop="department" header-align="center" align="center" label="部门">
</el-table-column>
<el-table-column prop="job" header-align="center" align="center" label="岗位">
</el-table-column>
<!-- <el-table-column prop="mobile" header-align="center" align="center" label="手机号">-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="identity" header-align="center" align="center" label="身份">-->
<!-- <template slot-scope="scope">-->
<!-- {{ isIdentity(scope.row.identity) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
</div> <el-table-column
header-align="center"
align="center"
prop="groupId"
label="所属分组"
:filters="groupIdes"
:filter-method="filterTag"
filter-placement="bottom-end">
<template slot-scope="scope">
{{ getgroups(scope.row.groupId) }}
</template>
</el-table-column>
<!-- <el-table-column prop="status" header-align="center" align="center" label="状态">-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag v-if="scope.row.status === 1" size="small" type="danger">禁用</el-tag>-->
<!-- <el-tag v-else size="small">正常</el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('adm:user:update')" type="text" size="small"
@click="addOrUpdateHandle(scope.row.id)">修改
</el-button>
<el-button v-if="isAuth('adm:user:delete')" type="text" size="small"
@click="deleteHandle(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[5,10, 20, 50, 100]" :page-size="pageSize" :total="totalCount"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template> </template>
<style scoped> <script>
import AddOrUpdate from './admin-add-or-update.vue'
import myRequest from "@/views/modules/h5/myRequest";
</style> export default {
data() {
return {
dataForm: {
userName: ''
},
temp:0,
dataList: [],
pageIndex: 1,
pageSize: 5,
totalCount: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
groupIdes: [],
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
this.groupIdes=[]
//
myRequest.getGroupList(this)
},
computed: {},
methods: {
//
filterTag(value, row) {
return row.groupId === value;
},
getgroups(id) {
try {
let groupIdes = this.groupIdes
return groupIdes[id - 1].text
}catch (e) {
// console.log(e)
return "未分组"
}
},
isIdentity(identity) {
switch (identity) {
case 1:
return '管理员'
case 2:
return '研究生'
case 3:
return '本校老师'
case 4:
return '外校老师'
}
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/admin/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'userId': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 200) {
this.dataList = data.page.list
this.totalCount = data.page.totalCount
} else {
this.dataList = []
this.totalCount = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle(userid) {
var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id)
this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/admin/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
}
}
}
</script>

View File

@ -0,0 +1,168 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-form-item label="宿舍信息" prop="dormitory">
<el-input v-model="dataForm.dormitory" placeholder="宿舍信息"></el-input>
</el-form-item>
<el-form-item label-width="100" label="宿舍类型" size="mini" prop="dormitoryType">
<el-radio-group v-model="dataForm.dormitoryType">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="宿舍人数" prop="dormitoryNum">
<el-input v-model="dataForm.dormitoryNum" placeholder="宿舍人数"></el-input>
</el-form-item>
<el-form-item label-width="100" label="宿舍是否已满" size="mini" prop="dormitoryStatus">
<el-radio-group v-model="dataForm.dormitoryStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="所属组">-->
<!-- <el-select v-model="dataForm.groupId" placeholder="所属组">-->
<!-- <el-option v-for="item in groupIdes" :key="item.id" :value="item.id" :label="item.name">{{item.name}}</el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label-width="100" label="是否第一次阅卷" size="mini" prop="status">-->
<!-- <el-radio-group v-model="dataForm.status">-->
<!-- <el-radio :label="1"></el-radio>-->
<!-- <el-radio :label="0"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import {is8Number,isMobile} from '@/utils/validate'
import myRequest from "@/views/modules/h5/myRequest";
export default {
data() {
var validateuserId = (rule, value, callback) => {
if (!is8Number(value)) {
callback(new Error('请输入8位身份码(数字)'))
} else {
callback()
}
}
var validatisPhone = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式不正确'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
dormitory:'',
dormitoryNum:'',
dormitoryType:0,
dormitoryStatus:0,
},
identityes: ['管理员', '研究生', '本校老师', '外校老师'],
groupIdes: [],
dataRule: {
userName: [
{required: true, message: '学生名不能为空', trigger: 'blur'}
],
userId: [
{required: true, message: '身份码不能为空', trigger: 'blur'},
{validator: validateuserId, trigger: 'blur'}
],
studentId: [
{required: true, message: '学生学号不能为空', trigger: 'blur'},
],
phone:[
{required: true, message: '手机号不能为空', trigger: 'blur'},
{validator: validatisPhone, trigger: 'blur'}
]
}
}
},
methods: {
init(id) {
myRequest.getGroupList2(this).then(res => {
this.groupIdes = res.data.list
})
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 200 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
console.log('this.dataForm.id', this.dataForm.id)
this.$http({
url: this.$http.adornUrl(`/excel/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.dataForm.dormitoryType = parseInt(data.user.dormitoryType);
this.dataForm.dormitory = data.user.dormitory
this.dataForm.dormitoryNum = data.user.dormitoryNum
this.dataForm.dormitoryStatus = parseInt(data.user.dormitoryStatus);
}
})
}
})
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/excel/${!this.dataForm.id ? 'backsave' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id':this.dataForm.id,
'dormitory': this.dataForm.dormitory,
'dormitoryType': this.dataForm.dormitoryType,
'dormitoryNum': this.dataForm.dormitoryNum,
'dormitoryStatus': this.dataForm.dormitoryStatus,
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@ -1,15 +1,271 @@
<script>
export default {
name: "hostel"
}
</script>
<template> <template>
<div><h1> <div class="mod-user">
宿舍管理
</h1></div> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<!-- <el-form-item>-->
<!-- <el-input v-model="dataForm.userName" placeholder="用户身份码" clearable></el-input>-->
<!-- </el-form-item>-->
<el-form-item>
<!-- <el-button @click="getDataList()">查询</el-button>-->
<el-button v-if="isAuth('h5:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('h5:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除
</el-button>
<a href="/static/web/a.xlsx" download="宿舍信息模板">
<el-button type="primary" style="margin: 0 10px">下载Excel模板</el-button>
</a>
<el-upload
style="float: right;margin-left: 5px"
class="upload-demo"
ref="upload"
action="/excel/upload"
:on-preview="handlePreview"
:on-success="uploadSuccess"
:on-error="uploadError"
:before-upload="beforeUpload"
:on-remove="handleRemove"
:file-list="fileList"
accept=".xls,.xlsx"
:auto-upload="false"
:limit="1"
>
<el-button slot="trigger" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" type="success" @click="submitUpload">
上传到服务器
</el-button>
<div slot="tip" class="el-upload__tip">只能上传excel文件</div>
</el-upload>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="80" label="ID">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="dormitory" header-align="center" align="center" width="100" label="宿舍信息">
</el-table-column>
<el-table-column prop="dormitoryType" header-align="center" align="center" label="宿舍类型(男/女)">
<template slot-scope="scope">
<el-tag v-if="scope.row.dormitoryType === '1'" size="small" type="success"></el-tag>
<el-tag v-else size="small"></el-tag>
</template>
</el-table-column>
<el-table-column prop="dormitoryNum" header-align="center" align="center" label="宿舍人数">
</el-table-column>
<el-table-column prop="dormitoryStatus" header-align="center" align="center" label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.dormitoryStatus === '1'" size="small" type="danger">已满</el-tag>
<el-tag v-else size="small">没满</el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('h5:user:update')" type="text" size="small"
@click="addOrUpdateHandle(scope.row.id)">修改
</el-button>
<el-button v-if="isAuth('h5:user:delete')" type="text" size="small"
@click="deleteHandle(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[5,10, 20, 50, 100]" :page-size="pageSize" :total="totalCount"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template> </template>
<style scoped> <script>
import AddOrUpdate from './hostel-add-or-update'
import myRequest from "@/views/modules/h5/myRequest";
</style> export default {
data() {
return {
dataForm: {
userName: ''
},
temp: 0,
dataList: [],
pageIndex: 1,
pageSize: 5,
totalCount: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
groupIdes: [],
fileList: [],
loading: null
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
//
// myRequest.getGroupList(this)
},
computed: {},
methods: {
//
filterTag(value, row) {
return row.groupId === value;
},
getgroups(id) {
try {
let groupIdes = this.groupIdes
return groupIdes[id - 1].text
} catch (e) {
// console.log(e)
return "未分组"
}
},
isIdentity(identity) {
switch (identity) {
case 1:
return '管理员'
case 2:
return '研究生'
case 3:
return '本校老师'
case 4:
return '外校老师'
}
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/excel/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'userId': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 200) {
this.dataList = data.page.list
this.totalCount = data.page.totalCount
} else {
this.dataList = []
this.totalCount = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle(userid) {
var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id)
this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/excel/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
},
//
submitUpload() {
if (this.$refs.upload.uploadFiles.length==0){
this.$message({
message: '请选择Excel文件',
type: 'error',
duration: 1500,
onClose: () => this.getDataList()
})
return;
}
this.$refs.upload.submit();
this.loading= this.$loading({
lock: true,
text: '文件上传中请耐心等待。。。',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
uploadSuccess(){
this.loading.close();
this.$refs.upload.clearFiles()
this.$message({
message: '上传成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
},
uploadError(){
this.$refs.upload.clearFiles()
this.$message({
message: '上传失败',
type: 'error',
duration: 1500,
onClose: () => this.getDataList()
})
},
beforeUpload(file){
// console.log(file)
}
}
}
</script>

View File

@ -0,0 +1,166 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<!-- <el-form-item label="身份码" prop="userId">-->
<!-- <el-input v-model="dataForm.userId" placeholder="登录帐号"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="姓名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="学生姓名"></el-input>
</el-form-item>
<el-form-item label="工号" prop="studentId">
<el-input v-model="dataForm.teacherId" placeholder="工号"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="dataForm.phone" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="所属组">
<el-select v-model="dataForm.groupId" placeholder="所属组">
<el-option v-for="item in groupIdes" :key="item.id" :value="item.id" :label="item.name">{{item.name}}</el-option>
</el-select>
</el-form-item>
<el-form-item label-width="100" label="是否第一次阅卷" size="mini" prop="status">
<el-radio-group v-model="dataForm.status">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import {is8Number,isMobile} from '@/utils/validate'
import myRequest from "@/views/modules/h5/myRequest";
export default {
data() {
var validateuserId = (rule, value, callback) => {
if (!is8Number(value)) {
callback(new Error('请输入8位身份码(数字)'))
} else {
callback()
}
}
var validatisPhone = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式不正确'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userId: '',
userName: '',
teacherId: '',
phone: '',
groupId: '',
status: 0
},
identityes: ['管理员', '研究生', '本校老师', '外校老师'],
groupIdes: [],
dataRule: {
userName: [
{required: true, message: '教师姓名不能为空', trigger: 'blur'}
],
userId: [
{required: true, message: '身份码不能为空', trigger: 'blur'},
{validator: validateuserId, trigger: 'blur'}
],
teacherId: [
{required: true, message: '教师工号不能为空', trigger: 'blur'},
],
phone:[
{required: true, message: '手机号不能为空', trigger: 'blur'},
{validator: validatisPhone, trigger: 'blur'}
]
}
}
},
methods: {
init(id) {
myRequest.getGroupList2(this).then(res => {
this.groupIdes = res.data.list
})
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 200 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
console.log('this.dataForm.id', this.dataForm.id)
this.$http({
url: this.$http.adornUrl(`/teach/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.dataForm.userName = data.user.userName
this.dataForm.groupId = data.user.groupId
this.dataForm.teacherId = data.user.teacherId
this.dataForm.userId = data.user.userId
this.dataForm.status = data.user.status
this.dataForm.phone = data.user.phone
}
})
}
})
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/teach/${!this.dataForm.id ? 'backsave' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id':this.dataForm.id,
'userName': this.dataForm.userName,
'groupId': this.dataForm.groupId,
'teacherId': this.dataForm.teacherId,
'userId': this.dataForm.userId,
'status': this.dataForm.status,
'phone': this.dataForm.phone,
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@ -1,15 +1,198 @@
<script>
export default {
name: "localTeacher"
}
</script>
<template> <template>
<div> <div class="mod-user">
<h1>本校老师管理</h1> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
</div> <el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户身份码" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<el-button v-if="isAuth('teach:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除
</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="80" label="ID">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="100" label="用户身份码">
</el-table-column>
<el-table-column prop="userName" header-align="center" align="center" label="姓名">
</el-table-column>
<el-table-column prop="teacherId" header-align="center" align="center" label="工号">
</el-table-column>
<el-table-column prop="phone" header-align="center" align="center" label="手机号">
</el-table-column>
<!-- <el-table-column prop="mobile" header-align="center" align="center" label="手机号">-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="identity" header-align="center" align="center" label="身份">-->
<!-- <template slot-scope="scope">-->
<!-- {{ isIdentity(scope.row.identity) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
header-align="center"
align="center"
prop="groupId"
label="所属分组"
:filters="groupIdes"
:filter-method="filterTag"
filter-placement="bottom-end">
<template slot-scope="scope">
{{ getgroups(scope.row.groupId) }}
</template>
</el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="是否第一次阅卷">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 1" size="small" type="danger"></el-tag>
<el-tag v-else size="small"></el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('teach:user:update')" type="text" size="small"
@click="addOrUpdateHandle(scope.row.id)">修改
</el-button>
<el-button v-if="isAuth('teach:user:delete')" type="text" size="small"
@click="deleteHandle(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[5,10, 20, 50, 100]" :page-size="pageSize" :total="totalCount"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template> </template>
<style scoped> <script>
import AddOrUpdate from './localTeacher-add-or-update'
import {isAuth} from "@/utils";
import myRequest from "@/views/modules/h5/myRequest";
export default {
data() {
return {
dataForm: {
userName: ''
},
temp:0,
dataList: [],
pageIndex: 1,
pageSize: 5,
totalCount: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
groupIdes: [],
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
this.groupIdes=[]
//
myRequest.getGroupList(this)
},
computed: {},
methods: {
// isAuth,
//
filterTag(value, row) {
return row.groupId === value;
},
getgroups(id) {
try {
let groupIdes = this.groupIdes
return groupIdes[id - 1].text
}catch (e) {
// console.log(e)
return "未分组"
}
</style> },
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/teach/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'userId': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 200) {
this.dataList = data.page.list
this.totalCount = data.page.totalCount
} else {
this.dataList = []
this.totalCount = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle(userid) {
var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id)
this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/teach/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
}
}
}
</script>

View File

@ -0,0 +1,27 @@
export default {
getGroupList(_this,) {
_this.$http({
url: _this.$http.adornUrl('/group/list'),
method: 'get',
params: _this.$http.adornParams()
}).then(res => {
res.data.list.forEach(item => {
_this.groupIdes.push({
text: item.name,
id: item.id,
value: item.id
})
})
})
},
getGroupList2(_this) {
return(
_this.$http({
url: _this.$http.adornUrl('/group/list'),
method: 'get',
params: _this.$http.adornParams()
}))
}
}

View File

@ -0,0 +1,166 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<!-- <el-form-item label="身份码" prop="userId">-->
<!-- <el-input v-model="dataForm.userId" placeholder="登录帐号"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="学生名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="学生姓名"></el-input>
</el-form-item>
<el-form-item label="学号" prop="studentId">
<el-input v-model="dataForm.studentId" placeholder="学号"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="dataForm.phone" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="所属组">
<el-select v-model="dataForm.groupId" placeholder="所属组">
<el-option v-for="item in groupIdes" :key="item.id" :value="item.id" :label="item.name">{{item.name}}</el-option>
</el-select>
</el-form-item>
<el-form-item label-width="100" label="是否第一次阅卷" size="mini" prop="status">
<el-radio-group v-model="dataForm.status">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import {is8Number,isMobile} from '@/utils/validate'
import myRequest from "@/views/modules/h5/myRequest";
export default {
data() {
var validateuserId = (rule, value, callback) => {
if (!is8Number(value)) {
callback(new Error('请输入8位身份码(数字)'))
} else {
callback()
}
}
var validatisPhone = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式不正确'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userId: '',
userName: '',
studentId: '',
phone: '',
groupId: '',
status: 0
},
identityes: ['管理员', '研究生', '本校老师', '外校老师'],
groupIdes: [],
dataRule: {
userName: [
{required: true, message: '学生名不能为空', trigger: 'blur'}
],
userId: [
{required: true, message: '身份码不能为空', trigger: 'blur'},
{validator: validateuserId, trigger: 'blur'}
],
studentId: [
{required: true, message: '学生学号不能为空', trigger: 'blur'},
],
phone:[
{required: true, message: '手机号不能为空', trigger: 'blur'},
{validator: validatisPhone, trigger: 'blur'}
]
}
}
},
methods: {
init(id) {
myRequest.getGroupList2(this).then(res => {
this.groupIdes = res.data.list
})
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 200 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
console.log('this.dataForm.id', this.dataForm.id)
this.$http({
url: this.$http.adornUrl(`/stu/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.dataForm.userName = data.user.userName
this.dataForm.groupId = data.user.groupId
this.dataForm.studentId = data.user.studentId
this.dataForm.userId = data.user.userId
this.dataForm.status = data.user.status
this.dataForm.phone = data.user.phone
}
})
}
})
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/stu/${!this.dataForm.id ? 'backsave' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id':this.dataForm.id,
'userName': this.dataForm.userName,
'groupId': this.dataForm.groupId,
'studentId': this.dataForm.studentId,
'userId': this.dataForm.userId,
'status': this.dataForm.status,
'phone': this.dataForm.phone,
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@ -1,13 +1,199 @@
<script>
export default {
name: "student"
}
</script>
<template> <template>
<h1>学生管理</h1> <div class="mod-user">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户身份码" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<el-button v-if="isAuth('stu:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除
</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="80" label="ID">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="100" label="用户身份码">
</el-table-column>
<el-table-column prop="userName" header-align="center" align="center" label="学生名">
</el-table-column>
<el-table-column prop="studentId" header-align="center" align="center" label="学号">
</el-table-column>
<el-table-column prop="phone" header-align="center" align="center" label="手机号">
</el-table-column>
<!-- <el-table-column prop="mobile" header-align="center" align="center" label="手机号">-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="identity" header-align="center" align="center" label="身份">-->
<!-- <template slot-scope="scope">-->
<!-- {{ isIdentity(scope.row.identity) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
header-align="center"
align="center"
prop="groupId"
label="所属分组"
:filters="groupIdes"
:filter-method="filterTag"
filter-placement="bottom-end">
<template slot-scope="scope">
{{ getgroups(scope.row.groupId) }}
</template>
</el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="是否第一次阅卷">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 1" size="small" ></el-tag>
<el-tag v-else size="small" type="danger"></el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('stu:user:update')" type="text" size="small"
@click="addOrUpdateHandle(scope.row.id)">修改
</el-button>
<el-button v-if="isAuth('stu:user:delete')" type="text" size="small"
@click="deleteHandle(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[5,10, 20, 50, 100]" :page-size="pageSize" :total="totalCount"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template> </template>
<style scoped> <script>
import AddOrUpdate from './student-add-or-update'
import {isAuth} from "@/utils";
import myRequest from "@/views/modules/h5/myRequest";
</style> export default {
data() {
return {
dataForm: {
userName: ''
},
temp:0,
dataList: [],
pageIndex: 1,
pageSize: 5,
totalCount: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
groupIdes: [],
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
this.groupIdes=[]
//
myRequest.getGroupList(this)
},
computed: {},
methods: {
// isAuth,
//
filterTag(value, row) {
return row.groupId === value;
},
getgroups(id) {
try {
let groupIdes = this.groupIdes
return groupIdes[id - 1].text
}catch (e) {
// console.log(e)
return "未分组"
}
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/stu/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'userId': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 200) {
this.dataList = data.page.list
this.totalCount = data.page.totalCount
} else {
this.dataList = []
this.totalCount = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle(userid) {
var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id)
this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/stu/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
}
}
}
</script>

View File

@ -2,26 +2,26 @@
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible"> <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px"> label-width="80px">
<el-form-item label="身份码" prop="userId"> <el-form-item v-if="!dataForm.id ? true : false" label="身份码" prop="userId">
<el-input v-model="dataForm.userId" placeholder="登录帐号"></el-input> <el-input v-model="dataForm.userId" placeholder="登录帐号"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="用户名" prop="userName"> <el-form-item label="用户名" >
<el-input v-model="dataForm.userName" placeholder="用户名"></el-input> <el-input v-model="dataForm.userName" placeholder="用户名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="身份"> <el-form-item v-if="!dataForm.id ? true : false" label="身份">
<el-select v-model="dataForm.identity" placeholder="身份"> <el-select v-model="dataForm.identity" placeholder="身份">
<el-option v-for="(name,key) in identityes" :key="key+1" :value="key+1" :label="name"></el-option> <el-option v-for="(name,key) in identityes" :key="key+1" :value="key+1" :label="name"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属组"> <el-form-item label="所属组">
<el-select v-model="dataForm.groupId" placeholder="所属组"> <el-select v-model="dataForm.groupId" placeholder="所属组">
<el-option v-for="(name,key) in groupIdes" :key="key+1" :value="key+1" :label="name"></el-option> <el-option v-for="item in groupIdes" :key="item.id" :value="item.id" :label="item.name">{{item.name}}</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态" size="mini" prop="status"> <el-form-item label="状态" size="mini" prop="status">
<el-radio-group v-model="dataForm.status"> <el-radio-group v-model="dataForm.status">
<el-radio :label="1">禁用</el-radio> <el-radio :label="0">禁用</el-radio>
<el-radio :label="0">正常</el-radio> <el-radio :label="1">正常</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -34,6 +34,7 @@
<script> <script>
import {is8Number} from '@/utils/validate' import {is8Number} from '@/utils/validate'
import myRequest from "@/views/modules/h5/myRequest";
export default { export default {
data() { data() {
@ -64,7 +65,7 @@ export default {
status: 0 status: 0
}, },
identityes: ['管理员', '研究生', '本校老师', '外校老师'], identityes: ['管理员', '研究生', '本校老师', '外校老师'],
groupIdes: ['第一组', '第二组', '第三组', '第四三组'], groupIdes: [],
dataRule: { dataRule: {
userName: [ userName: [
{required: true, message: '用户名不能为空', trigger: 'blur'} {required: true, message: '用户名不能为空', trigger: 'blur'}
@ -81,6 +82,16 @@ export default {
}, },
methods: { methods: {
init(id) { init(id) {
myRequest.getGroupList2(this).then(res => {
this.groupIdes = res.data.list
})
if (id==undefined){
this.dataForm.userId = ''
this.dataForm.userName = ''
this.dataForm.groupId = ''
this.dataForm.identity = ''
this.dataForm.status = 0
}
this.dataForm.id = id || 0 this.dataForm.id = id || 0
this.$http({ this.$http({
url: this.$http.adornUrl('/sys/role/select'), url: this.$http.adornUrl('/sys/role/select'),

View File

@ -47,7 +47,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="状态"> <el-table-column prop="status" header-align="center" align="center" label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.status === 1" size="small" type="danger">禁用</el-tag> <el-tag v-if="scope.row.status === 0" size="small" type="danger">禁用</el-tag>
<el-tag v-else size="small">正常</el-tag> <el-tag v-else size="small">正常</el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -73,6 +73,7 @@
<script> <script>
import AddOrUpdate from './user-add-or-update' import AddOrUpdate from './user-add-or-update'
import myRequest from "@/views/modules/h5/myRequest";
export default { export default {
data() { data() {
@ -88,23 +89,7 @@ export default {
dataListLoading: false, dataListLoading: false,
dataListSelections: [], dataListSelections: [],
addOrUpdateVisible: false, addOrUpdateVisible: false,
groupIdes: [{ groupIdes: [],
text: '第一组',
id: 1,
value: 1
}, {
text: '第二组',
id: 2,
value: 2
}, {
text: '第三组',
id: 3,
value: 3,
}, {
text: '第四三组',
id: 4,
value: 4,
}],
} }
}, },
components: { components: {
@ -112,6 +97,9 @@ export default {
}, },
activated() { activated() {
this.getDataList() this.getDataList()
this.groupIdes=[]
//
myRequest.getGroupList(this)
}, },
computed: {}, computed: {},
methods: { methods: {
@ -120,8 +108,14 @@ export default {
return row.groupId === value; return row.groupId === value;
}, },
getgroups(id) { getgroups(id) {
let groupIdes = this.groupIdes try {
return groupIdes[id - 1].text let groupIdes = this.groupIdes
return groupIdes[id - 1].text
}catch (e) {
// console.log(e)
return "未分组"
}
}, },
isIdentity(identity) { isIdentity(identity) {
switch (identity) { switch (identity) {

View File

@ -0,0 +1,250 @@
<template>
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="80px">
<!-- <el-form-item label="身份码" prop="userId">-->
<!-- <el-input v-model="dataForm.userId" placeholder="登录帐号"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="用户名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="外校教师名"></el-input>
</el-form-item>
<el-form-item label="身份证号">
<el-input v-model="dataForm.identityId" placeholder="身份证号码"></el-input>
</el-form-item>
<el-form-item label="手机号">
<el-input v-model="dataForm.phone" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="职称">
<el-select v-model="dataForm.jobTitle" placeholder="职称">
<el-option v-for="(item,index) in columns" :key="index" :value="item.text" :label="item.text"></el-option>
</el-select>
</el-form-item>
<el-form-item label="职务">
<el-input v-model="dataForm.office" placeholder="职务"></el-input>
</el-form-item>
<el-form-item label="单位名称">
<el-input v-model="dataForm.workName" placeholder="工作单位"></el-input>
</el-form-item>
<el-form-item label="单位电话">
<el-input v-model="dataForm.workPhone" placeholder="工作单位电话"></el-input>
</el-form-item>
<el-form-item label="银行卡号">
<el-input v-model="dataForm.pyCard" placeholder="银行卡号"></el-input>
</el-form-item>
<el-form-item label="开户地区">
<el-input v-model="dataForm.bankAddress" placeholder="请输入开户所在地(北京,哈尔滨)"></el-input>
</el-form-item>
<el-form-item label="开户行">
<el-input v-model="dataForm.bankName" placeholder="请输入开户行名称"></el-input>
</el-form-item>
<el-form-item label="车牌号">
<el-input v-model="dataForm.carNumber" placeholder="请输入车牌号"></el-input>
</el-form-item>
<el-form-item label="宿舍信息">
<el-input v-model="dataForm.dormitory" placeholder="请输入宿舍信息"></el-input>
</el-form-item>
<el-form-item label="所属组">
<el-select v-model="dataForm.groupId" placeholder="所属组">
<el-option v-for="item in groupIdes" :key="item.id" :value="item.id" :label="item.name">
{{ item.name }}
</el-option>
</el-select>
</el-form-item>
<el-form-item label-width="100" label="是否住宿" size="mini" prop="dormitoryStatus">
<el-radio-group v-model="dataForm.dormitoryStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label-width="100" label="车是否入校" size="mini" prop="carStatus">
<el-radio-group v-model="dataForm.carStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label-width="100" label="是否第一次阅卷" size="mini" prop="status">-->
<!-- <el-radio-group v-model="dataForm.status">-->
<!-- <el-radio :label="1"></el-radio>-->
<!-- <el-radio :label="0"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import {is8Number, isMobile} from '@/utils/validate'
import myRequest from "@/views/modules/h5/myRequest";
export default {
data() {
var validateuserId = (rule, value, callback) => {
if (!is8Number(value)) {
callback(new Error('请输入8位身份码(数字)'))
} else {
callback()
}
}
var validatisPhone = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式不正确'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userId: '',
userName: '',
studentId: '',
phone: '',
groupId: '',
status: 0,
identityId: '',
jobTitle: '',
office: '',
workName: '',
workPhone: '',
pyCard: '',
carNumber: '',
carStatus: 0,
dormitory: '',
dormitoryStatus: 0,
bankAddress: '',
bankName: ''
},
identityes: ['管理员', '研究生', '本校老师', '外校老师'],
columns: [
{text: '教师1', value: '教师1'},
{text: '教师2', value: '教师2'},
{text: '教师2', value: '教师2'},
{text: '教师3', value: '教师3'},
{text: '教师4', value: '教师4'},
],
groupIdes: [],
dataRule: {
userName: [
{required: true, message: '学生名不能为空', trigger: 'blur'}
],
userId: [
{required: true, message: '身份码不能为空', trigger: 'blur'},
{validator: validateuserId, trigger: 'blur'}
],
studentId: [
{required: true, message: '学生学号不能为空', trigger: 'blur'},
],
phone: [
{required: true, message: '手机号不能为空', trigger: 'blur'},
{validator: validatisPhone, trigger: 'blur'}
]
}
}
},
methods: {
init(id) {
myRequest.getGroupList2(this).then(res => {
this.groupIdes = res.data.list
})
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 200 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
console.log('this.dataForm.id', this.dataForm.id)
this.$http({
url: this.$http.adornUrl(`/wai/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.dataForm.userName = data.user.userName
this.dataForm.groupId = data.user.groupId
this.dataForm.userId = data.user.userId
this.dataForm.phone = data.user.phone
this.dataForm.jobTitle = data.user.jobTitle
this.dataForm.office = data.user.office
this.dataForm.workName = data.user.workName
this.dataForm.workPhone = data.user.workPhone
this.dataForm.pyCard = data.user.pyCard
this.dataForm.carNumber = data.user.carNumber
this.dataForm.carStatus = data.user.carStatus
this.dataForm.dormitory = data.user.dormitory
this.dataForm.dormitoryStatus = data.user.dormitoryStatus
this.dataForm.bankAddress = data.user.bankAddress
this.dataForm.bankName = data.user.bankName
this.dataForm.identityId = data.user.identityId
this.dataForm.status = data.user.status
}
})
}
})
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/wai/${!this.dataForm.id ? 'backsave' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id,
'userName': this.dataForm.userName,
'groupId': this.dataForm.groupId,
'userId': this.dataForm.userId,
'phone': this.dataForm.phone,
'jobTitle': this.dataForm.jobTitle,
'office': this.dataForm.office,
'workName': this.dataForm.workName,
'workPhone': this.dataForm.workPhone,
'pyCard': this.dataForm.pyCard,
'carNumber': this.dataForm.carNumber,
'carStatus': this.dataForm.carStatus,
'dormitory': this.dataForm.dormitory,
'dormitoryStatus': this.dataForm.dormitoryStatus,
'bankAddress': this.dataForm.bankAddress,
'bankName': this.dataForm.bankName,
'identityId': this.dataForm.identityId,
'status': this.dataForm.status
})
}).then(({data}) => {
console.log(data)
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@ -1,15 +1,292 @@
<template>
<div class="mod-user">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户身份码" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<!-- <el-button v-if="isAuth('stu:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>-->
<el-button v-if="isAuth('wai:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除
</el-button>
<el-button type="success" v-if="isAuth('wai:user:start')" plain @click="randomAssigned()">随机分配宿舍</el-button>
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
style="width: 100%;">
<!--下来展开-->
<el-table-column type="expand" label="详细">
<template slot-scope="props">
<el-form label-position="left" inline class="demo-table-expand">
<el-form-item label="身份证号">
<span>{{ props.row.identityId }}</span>
</el-form-item>
<el-form-item label="银行卡号">
<span>{{ props.row.pyCard }}</span>
</el-form-item>
<el-form-item label="工作单位">
<span>{{ props.row.workName }}</span>
</el-form-item>
<el-form-item label="开户所在地">
<span>{{ props.row.bankAddress }}</span>
</el-form-item>
<el-form-item label="单位电话">
<span>{{ props.row.workPhone }}</span>
</el-form-item>
<el-form-item label="开户行">
<span>{{ props.row.bankName }}</span>
</el-form-item>
<el-form-item label="宿舍信息">
<span>{{ props.row.dormitory }}</span>
</el-form-item>
<el-form-item label="车牌号">
<span>{{ props.row.carNumber }}</span>
</el-form-item>
<!-- <el-form-item label="是否第一次阅卷">-->
<!-- <span>{{ props.row.carNumber }}</span>-->
<!-- </el-form-item>-->
</el-form>
</template>
</el-table-column>
<el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column>
<el-table-column header-align="center" align="center" width="80" label="ID">
<template slot-scope="scope">
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="userId" header-align="center" align="center" width="100" label="用户身份码">
</el-table-column>
<el-table-column prop="userName" header-align="center" align="center" label="姓名">
</el-table-column>
<el-table-column prop="phone" header-align="center" align="center" label="手机号">
</el-table-column>
<el-table-column prop="jobTitle" header-align="center" align="center" label="职称">
</el-table-column>
<el-table-column prop="office" header-align="center" align="center" label="职务">
</el-table-column>
<!-- <el-table-column prop="mobile" header-align="center" align="center" label="手机号">-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="identity" header-align="center" align="center" label="身份">-->
<!-- <template slot-scope="scope">-->
<!-- {{ isIdentity(scope.row.identity) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
header-align="center"
align="center"
width="89"
prop="groupId"
label="所属分组"
:filters="groupIdes"
:filter-method="filterTag"
filter-placement="bottom-end">
<template slot-scope="scope">
{{ getgroups(scope.row.groupId) }}
</template>
</el-table-column>
<el-table-column prop="DormitoryStatus" header-align="center" align="center" label="住宿">
<template slot-scope="scope">
<el-tag v-if="scope.row.dormitoryStatus === 1" size="small" ></el-tag>
<el-tag v-else size="small" type="danger"></el-tag>
</template>
</el-table-column>
<el-table-column prop="carStatus" header-align="center" align="center" label="车入校">
<template slot-scope="scope">
<el-tag v-if="scope.row.carStatus === 1" size="small" ></el-tag>
<el-tag v-else size="small" type="danger"></el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('wai:user:update')" type="text" size="small"
@click="addOrUpdateHandle(scope.row.id)">修改
</el-button>
<el-button v-if="isAuth('wai:user:delete')" type="text" size="small"
@click="deleteHandle(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[5,10, 20, 50, 100]" :page-size="pageSize" :total="totalCount"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script> <script>
import AddOrUpdate from './wai-add-or-update'
import {isAuth} from "@/utils";
import myRequest from "@/views/modules/h5/myRequest";
export default { export default {
name: "waiTeacher" data() {
return {
dataForm: {
userName: ''
},
temp: 0,
dataList: [],
pageIndex: 1,
pageSize: 5,
totalCount: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
groupIdes: [],
}
},
components: {
AddOrUpdate
},
activated() {
this.getDataList()
this.groupIdes=[]
//
myRequest.getGroupList(this)
},
computed: {},
methods: {
// isAuth,
//
filterTag(value, row) {
return row.groupId === value;
},
getgroups(id) {
try {
let groupIdes = this.groupIdes
return groupIdes[id - 1].text
} catch (e) {
// console.log(e)
return "未分组"
}
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/wai/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'userId': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 200) {
this.dataList = data.page.list
this.totalCount = data.page.totalCount
} else {
this.dataList = []
this.totalCount = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle(userid) {
var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id)
this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/wai/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
},
/**
* 随机分配宿舍
* @constructor
*/
randomAssigned(){
this.$http({
url: this.$http.adornUrl('/wai/start'),
method: 'get',
}).then(({data}) => {
if (data && data.code === 200) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => this.getDataList()
})
} else {
this.$message.error(data.msg)
}
})
}
}
} }
</script> </script>
<template> <style>
<div> .demo-table-expand {
<h1>外校老师管理</h1> font-size: 0;
</div> margin-left: 15px;
</template> }
.demo-table-expand label {
<style scoped> width: 90px;
color: #99a9bf;
}
.demo-table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
width: 50%;
}
</style> </style>