swq 2 years ago
parent 7cbb23f2d5
commit 6b67a75cd5

@ -0,0 +1,216 @@
<!DOCTYPE html>
<html>
<head>
<!-- 页面meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>心理测评系统</title>
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<!-- 引入样式 -->
<link rel="stylesheet" href="../plugins/elementui/index.css">
<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/style.css">
</head>
<body class="hold-transition">
<div id="app">
<div class="content-header">
<h1>用户模块<small>测试</small></h1>
<el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>用户模块</el-breadcrumb-item>
<el-breadcrumb-item>测试</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="app-container">
<div class="box">
<div style="width: 80%;margin: 0 auto">
<div v-for="item in dataList">
<h3><span>{{item.xuhao}}:</span>{{item.them}}<span style="margin-left: 10px">分数:{{item.fen}}分</span></h3>
<el-radio-group v-model="item.da">
<el-radio :label="item.one">A:{{item.one}}</el-radio>
<el-radio :label="item.two">B:{{item.two}}</el-radio>
<el-radio :label="item.three">C:{{item.three}}</el-radio>
<el-radio :label="item.four">D:{{item.four}}</el-radio>
</el-radio-group>
<hr>
</div>
<el-button type="primary" @click="handleAdd()">提交</el-button>
</div>
</div>
</div>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
var vue = new Vue({
el: '#app',
data:{
pagination: {//分页相关模型数据
currentPage: 1,//当前页码
pageSize:10,//每页显示的记录数
total:0,//总记录数
queryString:""//查询条件
},
dataList: [],//当前页要展示的分页列表数据
formData: {},//表单数据
dialogFormVisible: false,//增加表单是否可见
dialogFormVisible4Edit:false,//编辑表单是否可见
rules: {//校验规则
xuhao: [{ required: true, message: '题号为必填项', trigger: 'blur' }],
them: [{ required: true, message: '题目为必填项', trigger: 'blur' }],
one:[{ required: true, message: '选项A为必填项', trigger: 'blur' }],
two:[{ required: true, message: '选项B为必填项', trigger: 'blur' }],
three:[{ required: true, message: '选项C为必填项', trigger: 'blur' }],
four:[{ required: true, message: '选项D为必填项', trigger: 'blur' }],
ok:[{ required: true, message: '正确答案为必填项', trigger: 'blur' }],
},
options: [{
value: 1,
label: '用户'
},
{
value: 0,
label: '管理员'
}]
},
//钩子函数VUE对象初始化完成后自动执行
created(){
this.findPage();
},
methods:{
//编辑
handleEdit() {
//表单校验
this.$refs['dataEditForm'].validate((valid)=>{
if(valid){
//表单校验通过,发送请求
axios.put("/timu/Update",this.formData).then((response)=> {
this.dialogFormVisible4Edit = false;
this.$message({
message: "修改成功",
type: 'success'
});
}).finally(()=> {
//重新发送请求查询分页数据
this.findPage();
});
}else{
//表单校验失败
this.$message.error("表单数据校验失败");
return false;
}
});
},
//添加
handleAdd () {
let ji=0;
let userId=localStorage.getItem("userId");
this.dataList.forEach(function (e) {
if(e.da==null)
{
ji++;
}
});
if(ji>0)
{
this.$message.error("还存在未填写的题目");
}
else
{
this.dataList.forEach(function (e) {
e.userId=userId;
})
//表单数据校验通过发送ajax请求将表单数据提交到后台
axios.post("/ut/Save",this.dataList).then((response)=> {
//隐藏新增窗口
this.dialogFormVisible = false;
this.$message({
message: "答题成功",
type: 'success'
});
}).finally(()=> {
this.dataList.forEach(function (e) {
e.da=null;
})
});
}
},
// 重置表单
resetForm() {
this.formData = {};
},
// 弹出添加窗口
handleCreate() {
this.resetForm();
this.dialogFormVisible = true;
},
// 弹出编辑窗口
handleUpdate(row) {
//发送请求获取检查项信息
axios.get("/timu/findById/" + row.id).then((res)=>{
//设置编辑窗口属性dialogFormVisible4Edit为true表示显示
this.dialogFormVisible4Edit = true;
//为模型数据设置值基于VUE双向数据绑定回显到页面
this.formData = res.data;
});
},
//切换页码
handleCurrentChange(currentPage) {
//currentPage为切换后的页码
this.pagination.currentPage = currentPage;
this.findPage();
},
//切换每页显示条数
handleSizeChange(pageSize){
this.pagination.pageSize =pageSize;
this.findPage();
},
// 删除
handleDelete(row) {
//alert(row.id);
this.$confirm("确认删除吗?","提示",{type:'warning'}).then(()=>{
//点击确定按钮时只需此处代码
//alert('用户点击的是确定按钮');
axios.delete("/timu/Delete/" + row.id).then((res)=> {
this.$message({
message: "删除成功",
type: 'success'
});
//调用分页,获取最新分页数据
this.findPage();
});
});
},
//分页查询
findPage() {
axios.get("/timu/selectAll").then((response)=> {
this.dataList = response.data;
});
},
}
})
</script>
</html>

@ -0,0 +1,15 @@
package com.service;
import com.domain.fenduan;
import com.untils.PageResult;
import java.util.List;
public interface fenduanService {
public int insert(fenduan fenduan);
public int delete(int id);
public int edit(fenduan fenduan);
public fenduan findById(int id);
public List<fenduan> selectAll();
}

@ -0,0 +1,582 @@
html,body {
/* overflow-y: scroll; */
margin: 0;
}
a {
color: #3c8dbc;
text-decoration:none;
}
/* new style */
.skin-purple .main-sidebar {
background: #fff;
}
.skin-purple .main-header .logo:hover {
background: #0abdfe;
}
.skin-purple .main-header .navbar .sidebar-toggle:hover {
/* background: #0abdfe; */
}
.skin-purple .main-header {
min-height: 70px;
padding: 0;
}
.skin-purple .main-header .logo {
height: 50px;
/* background: #0abdfe; */
float: left;
padding: 20px 0 0 15px;
/* width: 230px; */
}
.skin-purple .main-header .navbar {
height: 70px;
background: linear-gradient(to right, #0abdfe, #67f0e0);
/* margin-left: 230px; */
}
.winfo{margin-left: 230px;}
.skin-purple .main-header .sidebar-toggle {
display: inline-block;
padding: 24px 15px;
color: #fff;
}
.skin-purple .main-sidebar {
padding-top: 75px;
}
.sidebar-menu > li {
line-height: 1.8
}
.skin-purple .sidebar-menu > li > a {
font-size: 16px;
color: #666
}
.skin-purple .sidebar-menu>li:hover>a,
.skin-purple .sidebar-menu>li.active>a {
background: transparent;
color: #666;
border-left-color: transparent
}
.skin-purple .treeview-menu>li>a:hover {
color: #fff
}
.skin-purple .sidebar-menu>li>.treeview-menu {
background: #fff;
}
.sidebar-menu .treeview-menu > li > a {
font-size: 16px;
padding-left: 35px;
color: #999
}
.sidebar-menu .treeview-menu > li:hover {
background: #0abdfe;
}
@media (min-width: 768px) {
.skin-purple .navbar-nav>li>a
{
padding-top: 25px;
padding-bottom: 25px;
}
}
.modal-body .nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover {
color: #0abdfe
}
.modal-body .nav-tabs>li>a {
color: #555
}
.bg-olive {
background-color: #0abdfe !important;
}
.dataTable .btn[class*='bg-']:hover {
box-shadow: none
}
.btn-primary {
background: #0abdfe;
border-color: #0abdfe;
}
.box-body .nav>li>a {
color: #666
}
.box-body .nav>li.active>a {
color: #0abdfe;
}
/* tab 1*/
.double {
line-height: 58px;
}
.title .glyphicon{
padding: 3px;
font-size: 13px;
border-radius: 8px;
color: #fff;
}
.data span.arrowup {
color: #d88918;
}
.data span.arrowdown {
color: #6bb10a;
}
.item-blue .glyphicon{
background-color: #39a9ea;
}
.item-green {
line-height: 58px;
}
.item-green .glyphicon{
background-color: #6bb10a;
line-height: 12px;
}
.item-orange .glyphicon{
background-color:#d88918;
}
.item-red .glyphicon{
background-color: #f14f4f;
}
.chart .chart-box {
margin: 10px;
}
/* 数据表格label */
.content-wrapper .data-type {
/*width: 90%;*/
margin: 10px 5px;
border:1px solid #d4d4d4;
border-radius: 2px;
}
.data-type .title,
.data-type .data {
padding: 3px 12px;
border-top: 1px solid #d4d4d4;
overflow: hidden;
height: 42px;
}
.data-type .title {
line-height: 34px;
border-right: 1px solid #d4d4d4;
}
.data-type .data:last-child{
border-right: 0;
}
.data-type .title{
text-align: center;
background: #ececec;
}
.data-type .data .line{
vertical-align: middle;
overflow: hidden;
padding-bottom: 10px;
padding-top: 10px;
}
/* label行高度 */
.data-type .data > label {
line-height:36px;
}
.data-type .data > .form-group {
line-height:36px;
}
.data-type .data.text {
line-height:36px;
}
/* label行分隔符 */
.data-type .data.border-right {
border-right: 1px solid #d4d4d4;
}
/* 表格双倍高度 */
.data-type .title.rowHeight2x,
.data-type .data.rowHeight2x {
height:84px;
}
.data-type .title.rowHeight2x ,
.data-type .data.rowHeight2x.text {
line-height:78px;
}
/*.data-type .data.rowHeight2x > label {
line-height:78px;
}*/
.data-type .title.editer,
.data-type .data.editer {
height:320px;
}
.data-type .title.editer {
line-height:300px;
}
/*清除parding*/
.padding-clear {
padding-right: 0px;
padding-left: 0px;
}
/* 文件上传 */
/*a upload */
.a-upload {
padding: 4px 10px;
height: 35px;
line-height: 25px;
position: relative;
cursor: pointer;
color: #888;
background: #fafafa;
border: 1px solid #ddd;
border-radius: 4px;
overflow: hidden;
display: inline-block;
*display: inline;
*zoom: 1
}
.a-upload input {
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0;
filter: alpha(opacity=0);
cursor: pointer
}
.a-upload:hover {
color: #444;
background: #eee;
border-color: #ccc;
text-decoration: none
}
/* 医疗 */
.search-box {
display: inline-block
}
.input-sm {
height: 32px;
}
.btn-create {
margin-left: 10px;
background-color: #0abdfe;
border-color: #0abdfe;
color: #fff;
}
.btn-create:hover,
.btn-create:active,
.btn-create:focus
{
color: #fff;
}
.pagination {
margin: 0
}
.medical-modal {
position:absolute;
top:0%;
left:0%;
display:none;
background:rgba(0,0,0,0.3);
width:100%;
height:100%;
position:fixed;
z-index:9999
}
.medical-modal .content {
position: absolute;
left: 35%;
top: 25%;
border-radius: 8px;
width: 30%;
height: 40%;
background-color: #fff;
}
.pageitems, .jump {
margin-left: 15px;
display: inline-block;
}
.jumppage {
width: 30px;
text-align: center
}
@media (min-width: 768px) {
.subscribe .modal-dialog {
width: 900px;
margin: 30px auto;
}
}
.checklist {
margin-top: 10px;
}
.checklist .input-group {
margin-bottom: 10px;
}
.modal-page {
margin-top: 20px;
font-size: 12px;
}
.modal-page .form-control {
font-size: 12px;
padding: 0;
height: 26px;
}
.table-check {
margin: 0;
display: inline-block;
margin-right: 4px;
}
.daterange {
margin:10px 10px 0;
}
.daterange .input-group .form-control {
width: 20%;
}
.chart-title {
font-size: 16px;
font-weight: normal;
text-align: center;
}
.diaocha {
line-height: 2
}
.diaocha h5{
color: #f98d45;
background: #f5f7f9;
line-height: 2;
padding-left: 15px;
}
.diaocha div {
padding: 0 20px;
border-bottom: 1px solid #dce1e7;
}
.diaocha div h5 {
color: #555;
background: transparent;
padding-left: 0;
}
.diaocha label {
font-weight: normal;
}
.diaocha .form-group {
margin-left: 0;
margin-right: 0;
}
.diaocha .options label {
margin-right: 10px;
}
.tizhi button{
margin-right: 15px;
}
.innerform {
margin-top: 20px;
}
.fa-search {
cursor: pointer
}
.line {
margin-top: 10px;
}
input[type=radio]:focus {
outline: none
}
input[type="radio"]{
appearance: none;
-webkit-appearance: none;
outline: none;
display:none
}
label input[type="radio"] {
content: "\a0";
display: inline-block;
vertical-align: middle;
font-size: 16px;
width: 15px;
height: 15px;
margin-right: .4em;
border-radius: 50%;
border: 1px solid #c7c6c6;
line-height: 1;
margin-top: -1px;
}
label input[type="radio"]:checked {
border: 3px solid #0abdfe;
}
.right-menu {
float: right;
padding: 18px 30px 0 0;
color: #fff;
}
.el-dropdown{color: #fff;}
.avatar-wrapper img{width: 30px;height: 30px;border-radius: 15px;vertical-align: middle}
.el-popper[x-placement^=bottom]{margin-top: 30px;}
.el-dropdown-menu__item--divided{margin: 0;border:0 none;border-bottom: 1px solid #ebeef5}
.help{
padding: 0 10px;
}
.help .fa{ margin-right: 5px;}
.el-main{
background: #ecf0f5;
}
.el-menu{border: 0 none;}
.main{
height: 100vh;
min-width: 800px;
min-height: 600px;
overflow: hidden;
}
.main aside{
overflow: visible;
height: 100%;
}
.main aside.isClossTab{
width: 100%;
height: 60px;
cursor: pointer;
font-size: 25px;
text-align: center;
line-height: 60px;
font-weight: bold;
border-right: 1px solid #807c7c;
box-sizing: border-box;
}
.main aside .menu{
width: 100%;
border-right:0;
}
.el-menu .fa{
vertical-align: middle;
margin-right: 5px;
width: 24px;
text-align: center;
font-size: 18px;
}
.el-menu-item a{
color: #303133
}
.el-menu-item:hover,.el-menu-item.is-active {
color: #fff;
background: #0abdfe;
}
.el-menu-item:hover a,.el-menu-item.is-active a{
color: #fff;
}
.el-submenu__title:hover{background: none;}
.main-footer {
background: #fff;
padding: 15px 0;
color: #444;
}
/* title */
.content-header {
position: relative;
padding: 15px 15px 0 15px;
/* margin-top: 70px; */
}
.content-header > h1 {
margin: 0;
font-size: 24px;
font-weight: normal;
}
.content-header > h1 > small {
font-size: 15px;
display: inline-block;
padding-left: 4px;
font-weight: 300;
}
.content-header > .breadcrumb {
float: right;
background: transparent;
margin-top: 0;
margin-bottom: 0;
font-size: 12px;
padding: 7px 5px;
position: absolute;
top: 20px;
right: 10px;
border-radius: 2px;
}
/* */
.app-container{
background: #fff;
margin: 15px 30px 15px 15px;
}
.pagiantion{
text-align: right;
padding: 15px;
}
.box {
position: relative;
border-radius: 3px;
background: #ffffff;
border-top: 3px solid #3c8dbc;
padding: 10px;
margin-bottom: 20px;
width: 100%;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.filter-container{
padding:10px 0 15px 0;
}
.main-container{margin-top: 70px;}
.filter-container .el-button,.filter-container .el-input__inner{
padding: 0 15px;
height: 34px;
line-height: 34px;
}
.el-aside{overflow: hidden;}
.el-submenu .el-menu-item a{
display: block;
height: 50px;
}
.el-menu--collapse .el-submenu__icon-arrow{ display: none}
/* .el-container{position: relative;} */
/* foot */
.el-footer{
position: absolute;
left: 180px;
right: 0px;
bottom: -80px;
}
.boxMain .el-upload--text{
position:static;
}
.boxMain >div{
display: inline-block;
}
.excelTitle{
text-align: center;
overflow: hidden;
line-height: 40px;
}
.excelTitle .el-button{
float: left;
}
.excelTime{
padding: 10px 0;
text-align: right;
}
.exceTable{
width: 100%;
border-right: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
font-size: 14px;
color: #333;
}
.exceTable tr,.exceTable td{
border-left: 1px solid #e6e6e6;
border-top: 1px solid #e6e6e6;
height: 40px;
line-height: 40px;
padding: 0 10px;
}
.exceTable .headBody{
text-align: center;
font-weight: 700;
font-size: 14px;
}
.tabletrBg{
background: #fcfcfc;
text-align: right;
}
.textCenter{
text-align: center
}
.checkScrol{
height: 277px;
overflow-y:scroll; ;
}

@ -0,0 +1,15 @@
package com.service;
import com.domain.timu;
import com.untils.PageResult;
import java.util.List;
public interface timuService {
public PageResult SelectPage(timu timu, int size, int current);
public int insert(timu timu);
public int delete(int id);
public int edit(timu timu);
public timu findById(int id);
public List<timu> selectAll();
}

@ -0,0 +1,334 @@
<!DOCTYPE html>
<html>
<head>
<!-- 页面meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>火车票销售系统</title>
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<!-- 引入样式 -->
<link rel="stylesheet" href="../plugins/elementui/index.css">
<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/style.css">
</head>
<body class="hold-transition">
<div id="app">
<div class="content-header">
<h1>管理员模块<small>用户管理</small></h1>
<el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>管理员模块</el-breadcrumb-item>
<el-breadcrumb-item>用户管理</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="app-container">
<div class="box">
<div class="filter-container">
<el-input placeholder="用户名" v-model="pagination.queryString" style="width: 200px;" class="filter-item"></el-input>
<el-button @click="findPage()" class="dalfBut">查询</el-button>
<el-button type="primary" class="butT" @click="handleCreate()">新建</el-button>
</div>
<el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row>
<el-table-column type="index" align="center" label="序号"></el-table-column>
<el-table-column prop="username" label="用户名" align="center"></el-table-column>
<el-table-column prop="password" label="密码" align="center"></el-table-column>
<el-table-column label="角色" align="center">
<template slot-scope="scope">
<span>{{ scope.row.type == '0' ? '管理员' : '用户'}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination
class="pagiantion"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pagination.currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pagination.pageSize"
layout="total, sizes,prev, pager, next, jumper"
:total="pagination.total">
</el-pagination>
</div>
<!-- 新增标签弹层 -->
<div class="add-form">
<el-dialog title="新增用户" :visible.sync="dialogFormVisible">
<el-form ref="dataAddForm" :model="formData" :rules="rules" label-position="right" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="用户名" prop="username">
<el-input v-model="formData.username"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密码" prop="password">
<el-input v-model="formData.password"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="角色" prop="type">
<el-select v-model="formData.type" placeholder="请选择角色">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="handleAdd()">确定</el-button>
</div>
</el-dialog>
</div>
<!-- 编辑标签弹层 -->
<div class="add-form">
<el-dialog title="编辑用户" :visible.sync="dialogFormVisible4Edit">
<el-form ref="dataEditForm" :model="formData" :rules="rules" label-position="right" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="用户名" prop="username">
<el-input v-model="formData.username"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密码" prop="password">
<el-input v-model="formData.password"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="角色" prop="type">
<el-select v-model="formData.type" placeholder="请选择角色">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible4Edit = false">取消</el-button>
<el-button type="primary" @click="handleEdit()">确定</el-button>
</div>
</el-dialog>
</div>
</div>
</div>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
var vue = new Vue({
el: '#app',
data:{
pagination: {//分页相关模型数据
currentPage: 1,//当前页码
pageSize:10,//每页显示的记录数
total:0,//总记录数
queryString:""//查询条件
},
dataList: [],//当前页要展示的分页列表数据
formData: {},//表单数据
dialogFormVisible: false,//增加表单是否可见
dialogFormVisible4Edit:false,//编辑表单是否可见
rules: {//校验规则
username: [{ required: true, message: '用户名为必填项', trigger: 'blur' }],
password: [{ required: true, message: '密码为必填项', trigger: 'blur' }],
type:[{ required: true, message: '角色为必选项', trigger: 'blur' }],
idCard:[{ required: true, message: '身份证号必填项', trigger: 'blur' }]
},
options: [{
value: 1,
label: '用户'
},
{
value: 0,
label: '管理员'
}]
},
//钩子函数VUE对象初始化完成后自动执行
created(){
this.findPage();
},
methods:{
//编辑
handleEdit() {
//表单校验
this.$refs['dataEditForm'].validate((valid)=>{
if(valid){
//表单校验通过,发送请求
axios.put("/user/Update",this.formData).then((response)=> {
this.dialogFormVisible4Edit = false;
this.$message({
message: "修改成功",
type: 'success'
});
}).finally(()=> {
//重新发送请求查询分页数据
this.findPage();
});
}else{
//表单校验失败
this.$message.error("表单数据校验失败");
return false;
}
});
},
//添加
handleAdd () {
//校验表单输入项是否合法
this.$refs['dataAddForm'].validate((valid) => {
if (valid) {
this.formData.status="拉黑";
//表单数据校验通过发送ajax请求将表单数据提交到后台
axios.post("/user/Save",this.formData).then((response)=> {
//隐藏新增窗口
this.dialogFormVisible = false;
this.$message({
message: "添加成功",
type: 'success'
});
}).finally(()=> {
this.findPage();
});
} else {
this.$message.error("表单数据校验失败");
return false;
}
});
},
// 重置表单
resetForm() {
this.formData = {};
},
// 弹出添加窗口
handleCreate() {
this.resetForm();
this.dialogFormVisible = true;
},
// 弹出编辑窗口
handleUpdate(row) {
//发送请求获取检查项信息
axios.get("/user/findById/" + row.id).then((res)=>{
//设置编辑窗口属性dialogFormVisible4Edit为true表示显示
this.dialogFormVisible4Edit = true;
//为模型数据设置值基于VUE双向数据绑定回显到页面
this.formData = res.data;
});
},
//切换页码
handleCurrentChange(currentPage) {
//currentPage为切换后的页码
this.pagination.currentPage = currentPage;
this.findPage();
},
//切换每页显示条数
handleSizeChange(pageSize){
this.pagination.pageSize =pageSize;
this.findPage();
},
// 删除
handleDelete(row) {
//alert(row.id);
this.$confirm("确认删除吗?","提示",{type:'warning'}).then(()=>{
//点击确定按钮时只需此处代码
//alert('用户点击的是确定按钮');
axios.delete("/user/Delete/" + row.id).then((res)=> {
this.$message({
message: "删除成功",
type: 'success'
});
//调用分页,获取最新分页数据
this.findPage();
});
});
},
//分页查询
findPage() {
//分页参数
// var param = {
// // currentPage:this.pagination.currentPage,//页码
// // pageSize:this.pagination.pageSize,//每页显示的记录数
// username:this.pagination.queryString//查询条件
// };
param="?username="+this.pagination.queryString;//查询条件
//请求后台
axios.get("/user/SelectPage/"+this.pagination.pageSize+"/"+this.pagination.currentPage+param).then((response)=> {
this.dataList = response.data.rows;
this.dataList.forEach(function (e) {
e.h="拉黑";
})
this.pagination.total = response.data.total;
});
},
c(row)
{
axios.get("/user/findById/" + row.id).then((res)=>{
this.formData=res.data;
if(this.formData.status=="拉黑")
{
this.formData.status="已拉黑"
}
else
{
this.formData.status="拉黑"
}
axios.put("/user/Update",this.formData).then((response)=> {
}).finally(()=> {
//重新发送请求查询分页数据
this.findPage();
});
});
}
}
})
</script>
</html>

@ -0,0 +1,18 @@
package com.service;
import com.domain.user;
import com.untils.PageResult;
import java.util.List;
public interface userService {
public PageResult SelectPage(user user, int size, int current);
public PageResult SelectPageStudent(user user, int size, int current);
public int insert(user user);
public int delete(int id);
public int edit(user user);
public user findById(int id);
public user login(user user);
public user selectByUserName(String username);
public List<user> selectAllByStudent();
}

@ -0,0 +1,22 @@
package com.service;
import com.domain.all;
import com.domain.ut;
import com.untils.PageResult;
import java.util.List;
public interface utService {
public PageResult SelectPage(ut ut, int size, int current);
public int insert(ut ut);
public int delete(int id);
public int edit(ut ut);
public ut findById(int id);
public List<all> selectAll(int userId);
public List<all> selectAll1();
public List<ut> selectDetails(String biaoshi);
}

@ -0,0 +1,150 @@
package com.service.Imple;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dao.UserDao;
import com.domain.all;
import com.domain.fenduan;
import com.domain.ut;
import com.domain.ut;
import com.service.utService;
import com.untils.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service
public class utServiceImple implements utService {
@Autowired
private com.dao.utDao utDao;
@Autowired
private com.dao.fenduanDao fenduanDao;
@Autowired
private UserDao userDao;
@Override
public PageResult SelectPage(ut ut, int size, int current) {
try
{
IPage page=new Page(current,size);
QueryWrapper<ut> queryWrapper = new QueryWrapper<ut>();
queryWrapper.like("them",ut.getThem());
queryWrapper.orderByAsc("xuhao");
page=utDao.selectPage(page, queryWrapper);
while(true)
{
if(page.getRecords().size()==0&&current>=1)
{
page=new Page(current--,size);
page=utDao.selectPage(page, queryWrapper);
}
else
{
break;
}
}
return new PageResult(page.getTotal(),page.getRecords());
}
catch (Exception e)
{
return null;
}
}
@Override
public int insert(ut ut) {
int i=55;
if((!ut.getDa().equals(ut.getOk())))
{
ut.setFen(0);
}
return utDao.insert(ut);
}
@Override
public int delete(int id) {
return utDao.deleteById(id);
}
@Override
public int edit(ut ut) {
return utDao.updateById(ut);
}
@Override
public ut findById(int id) {
return utDao.selectById(id);
}
@Override
public List<all> selectAll(int userId) {
QueryWrapper<ut> queryWrapper = new QueryWrapper<ut>();
queryWrapper.eq("userId",userId);
queryWrapper.select("sum(fen) as fen,biaoshi");
queryWrapper.groupBy("biaoshi");
List<Map<String, Object>> list=utDao.selectMaps(queryWrapper);
List<all> list1=new ArrayList<>();
for (Map item:list)
{
all a=new all(userId,item.get("biaoshi").toString(),Double.parseDouble(item.get("fen").toString()));
double fen=Double.parseDouble(item.get("fen").toString());
QueryWrapper<fenduan> queryWrapper1 = new QueryWrapper<fenduan>();
queryWrapper1.ge("end",fen).le("start",fen);
fenduan f=fenduanDao.selectOne(queryWrapper1);
a.setGuo(f.getGuo());
list1.add(a);
}
return list1;
}
@Override
public List<ut> selectDetails(String biaoshi) {
QueryWrapper<ut> queryWrapper = new QueryWrapper<ut>();
queryWrapper.eq("biaoshi",biaoshi);
return utDao.selectList(queryWrapper);
}
@Override
public List<all> selectAll1() {
QueryWrapper<ut> queryWrapper = new QueryWrapper<ut>();
queryWrapper.select("sum(fen) as fen,userId,biaoshi");
queryWrapper.groupBy("userId").groupBy("biaoshi");
List<Map<String, Object>> list=utDao.selectMaps(queryWrapper);
List<all> list1=new ArrayList<>();
for (Map item:list)
{
all a=new all(Integer.parseInt(item.get("userId").toString()),item.get("biaoshi").toString(),Double.parseDouble(item.get("fen").toString()));
double fen=Double.parseDouble(item.get("fen").toString());
QueryWrapper<fenduan> queryWrapper1 = new QueryWrapper<fenduan>();
queryWrapper1.ge("end",fen).le("start",fen);
fenduan f=fenduanDao.selectOne(queryWrapper1);
a.setGuo(f.getGuo());
String username= userDao.selectById(item.get("userId").toString()).getUsername();
a.setUsername(username);
list1.add(a);
}
return list1;
}
}
Loading…
Cancel
Save