优化所有弹窗、导出和提交等待的用户体验

修复第二页只有一条数据如果删除页面显示无数据,分页那里显示选中的第一页的bug
修复分页页数成小数的bug
优化所有添加删除dialog点击model不会关闭
pull/82/head
王欣健 4 years ago
parent 1c2134bf27
commit 9005eb74ab

@ -334,8 +334,8 @@ export default {
getList() {
this.loading = true;
listJob(this.queryParams).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.jobList = response.rows;

@ -219,8 +219,8 @@ export default {
getList() {
this.loading = true;
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.jobLogList = response.rows;

@ -90,8 +90,8 @@ export default {
getList() {
this.loading = true;
list(this.queryParams).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.list = response.rows;

@ -149,7 +149,7 @@
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-form-item label="参数名称" prop="configName">
<el-input v-model="form.configName" placeholder="请输入参数名称" />
@ -254,8 +254,8 @@ export default {
getList() {
this.loading = true;
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.configList = response.rows;

@ -84,7 +84,7 @@
</el-table>
<!-- 添加或修改部门对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">

@ -133,7 +133,7 @@
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典类型">
<el-input v-model="form.dictType" :disabled="true" />
@ -291,8 +291,8 @@ export default {
getList() {
this.loading = true;
listData(this.queryParams).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.dataList = response.rows;

@ -164,7 +164,7 @@
/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典名称" prop="dictName">
<el-input v-model="form.dictName" placeholder="请输入字典名称" />
@ -263,8 +263,8 @@ export default {
getList() {
this.loading = true;
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.typeList = response.rows;

@ -160,8 +160,8 @@ export default {
getList() {
this.loading = true;
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.list = response.rows;

@ -88,7 +88,7 @@
</el-table>
<!-- 添加或修改菜单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">

@ -129,7 +129,7 @@
/>
<!-- 添加或修改公告对话框 -->
<el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="780px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
@ -248,8 +248,8 @@ export default {
getList() {
this.loading = true;
listNotice(this.queryParams).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.noticeList = response.rows;

@ -241,8 +241,8 @@ export default {
getList() {
this.loading = true;
list(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.list = response.rows;

@ -123,7 +123,7 @@
/>
<!-- 添加或修改岗位对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-form-item label="岗位名称" prop="postName">
<el-input v-model="form.postName" placeholder="请输入岗位名称" />
@ -224,8 +224,8 @@ export default {
getList() {
this.loading = true;
listPost(this.queryParams).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.postList = response.rows;

@ -149,8 +149,8 @@ export default {
getList() {
this.loading = true;
allocatedUserList(this.queryParams).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.userList = response.rows;

@ -163,7 +163,7 @@
/>
<!-- 添加或修改角色配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-form-item label="角色名称" prop="roleName">
<el-input v-model="form.roleName" placeholder="请输入角色名称" />
@ -209,7 +209,7 @@
</el-dialog>
<!-- 分配角色数据权限对话框 -->
<el-dialog :title="title" :visible.sync="openDataScope" width="500px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="openDataScope" width="500px" append-to-body>
<el-form v-loading="dialogLoading" :model="form" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="form.roleName" :disabled="true" />

@ -1,6 +1,6 @@
<template>
<!-- 授权用户 -->
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-dialog title="选择用户" :close-on-click-modal="false" :close-on-click-modal="false" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" v-loading="dialogLoading" ref="queryForm" :inline="true">
<el-form-item label="用户名称" prop="userName">
<el-input
@ -115,8 +115,8 @@ export default {
//
getList() {
unallocatedUserList(this.queryParams).then(res => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.userList = res.rows;

@ -208,7 +208,7 @@
</el-row>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" v-loading="dialogLoading" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
@ -495,8 +495,8 @@ export default {
getList() {
this.loading = true;
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.userList = response.rows;

@ -1,172 +1,172 @@
<template>
<div>
<div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog()">
<el-row>
<el-col :xs="24" :md="12" :style="{height: '350px'}">
<vue-cropper
ref="cropper"
:img="options.img"
:info="true"
:autoCrop="options.autoCrop"
:autoCropWidth="options.autoCropWidth"
:autoCropHeight="options.autoCropHeight"
:fixedBox="options.fixedBox"
@realTime="realTime"
v-if="visible"
/>
</el-col>
<el-col :xs="24" :md="12" :style="{height: '350px'}">
<div class="avatar-upload-preview">
<img :src="previews.url" :style="previews.img" />
</div>
</el-col>
</el-row>
<br />
<el-row>
<el-col :lg="2" :md="2">
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button size="small">
选择
<i class="el-icon-upload el-icon--right"></i>
</el-button>
</el-upload>
</el-col>
<el-col :lg="{span: 1, offset: 2}" :md="2">
<el-button icon="el-icon-plus" size="small" @click="changeScale(1)"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-minus" size="small" @click="changeScale(-1)"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-refresh-left" size="small" @click="rotateLeft()"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-refresh-right" size="small" @click="rotateRight()"></el-button>
</el-col>
<el-col :lg="{span: 2, offset: 6}" :md="2">
<el-button type="primary" size="small" @click="uploadImg()"> </el-button>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import store from "@/store";
import { VueCropper } from "vue-cropper";
import { uploadAvatar } from "@/api/system/user";
export default {
components: { VueCropper },
props: {
user: {
type: Object
}
},
data() {
return {
//
open: false,
// cropper
visible: false,
//
title: "修改头像",
options: {
img: store.getters.avatar, //
autoCrop: true, //
autoCropWidth: 200, //
autoCropHeight: 200, //
fixedBox: true //
},
previews: {}
};
},
methods: {
//
editCropper() {
this.open = true;
},
//
modalOpened() {
this.visible = true;
},
//
requestUpload() {
},
//
rotateLeft() {
this.$refs.cropper.rotateLeft();
},
//
rotateRight() {
this.$refs.cropper.rotateRight();
},
//
changeScale(num) {
num = num || 1;
this.$refs.cropper.changeScale(num);
},
//
beforeUpload(file) {
if (file.type.indexOf("image/") == -1) {
this.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。");
} else {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
this.options.img = reader.result;
};
}
},
//
uploadImg() {
this.$refs.cropper.getCropBlob(data => {
let formData = new FormData();
formData.append("avatarfile", data);
uploadAvatar(formData).then(response => {
this.open = false;
this.options.img = response.imgUrl;
store.commit('SET_AVATAR', this.options.img);
this.msgSuccess("修改成功");
this.visible = false;
});
});
},
//
realTime(data) {
this.previews = data;
},
//
closeDialog() {
this.options.img = store.getters.avatar
this.visible = false;
}
}
};
</script>
<style scoped lang="scss">
.user-info-head {
position: relative;
display: inline-block;
height: 120px;
}
.user-info-head:hover:after {
content: '+';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
color: #eee;
background: rgba(0, 0, 0, 0.5);
font-size: 24px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
cursor: pointer;
line-height: 110px;
border-radius: 50%;
}
</style>
<template>
<div>
<div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog()">
<el-row>
<el-col :xs="24" :md="12" :style="{height: '350px'}">
<vue-cropper
ref="cropper"
:img="options.img"
:info="true"
:autoCrop="options.autoCrop"
:autoCropWidth="options.autoCropWidth"
:autoCropHeight="options.autoCropHeight"
:fixedBox="options.fixedBox"
@realTime="realTime"
v-if="visible"
/>
</el-col>
<el-col :xs="24" :md="12" :style="{height: '350px'}">
<div class="avatar-upload-preview">
<img :src="previews.url" :style="previews.img" />
</div>
</el-col>
</el-row>
<br />
<el-row>
<el-col :lg="2" :md="2">
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button size="small">
选择
<i class="el-icon-upload el-icon--right"></i>
</el-button>
</el-upload>
</el-col>
<el-col :lg="{span: 1, offset: 2}" :md="2">
<el-button icon="el-icon-plus" size="small" @click="changeScale(1)"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-minus" size="small" @click="changeScale(-1)"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-refresh-left" size="small" @click="rotateLeft()"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-refresh-right" size="small" @click="rotateRight()"></el-button>
</el-col>
<el-col :lg="{span: 2, offset: 6}" :md="2">
<el-button type="primary" size="small" @click="uploadImg()"> </el-button>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import store from "@/store";
import { VueCropper } from "vue-cropper";
import { uploadAvatar } from "@/api/system/user";
export default {
components: { VueCropper },
props: {
user: {
type: Object
}
},
data() {
return {
//
open: false,
// cropper
visible: false,
//
title: "修改头像",
options: {
img: store.getters.avatar, //
autoCrop: true, //
autoCropWidth: 200, //
autoCropHeight: 200, //
fixedBox: true //
},
previews: {}
};
},
methods: {
//
editCropper() {
this.open = true;
},
//
modalOpened() {
this.visible = true;
},
//
requestUpload() {
},
//
rotateLeft() {
this.$refs.cropper.rotateLeft();
},
//
rotateRight() {
this.$refs.cropper.rotateRight();
},
//
changeScale(num) {
num = num || 1;
this.$refs.cropper.changeScale(num);
},
//
beforeUpload(file) {
if (file.type.indexOf("image/") == -1) {
this.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。");
} else {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
this.options.img = reader.result;
};
}
},
//
uploadImg() {
this.$refs.cropper.getCropBlob(data => {
let formData = new FormData();
formData.append("avatarfile", data);
uploadAvatar(formData).then(response => {
this.open = false;
this.options.img = response.imgUrl;
store.commit('SET_AVATAR', this.options.img);
this.msgSuccess("修改成功");
this.visible = false;
});
});
},
//
realTime(data) {
this.previews = data;
},
//
closeDialog() {
this.options.img = store.getters.avatar
this.visible = false;
}
}
};
</script>
<style scoped lang="scss">
.user-info-head {
position: relative;
display: inline-block;
height: 120px;
}
.user-info-head:hover:after {
content: '+';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
color: #eee;
background: rgba(0, 0, 0, 0.5);
font-size: 24px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
cursor: pointer;
line-height: 110px;
border-radius: 50%;
}
</style>

@ -246,8 +246,8 @@ export default {
getList() {
this.loading = true;
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
let currentPageNum = response.total / this.queryParams.pageSize;
if(this.queryParams.pageNum > currentPageNum){
let currentPageNum = response.total % this.queryParams.pageSize > 0 ? parseInt(response.total / this.queryParams.pageSize) + 1 : (response.total / this.queryParams.pageSize);
if(currentPageNum !== 0 && currentPageNum !== 0 && this.queryParams.pageNum > currentPageNum){
this.queryParams.pageNum = currentPageNum;
}
this.tableList = response.rows;

Loading…
Cancel
Save