Commit db760ce2 authored by “yiyousong”'s avatar “yiyousong”

feat: 添加登录页,优化分页组件

parent 50274f62
<template>
<div class="pagination" v-if="total">
<el-pagination
background
:background="background"
:layout="layout"
:pager-count="5"
:total="total"
:current-page="page"
:page-size="Size"
:current-page="current"
:page-size="PageSize"
:page-sizes="pageSizes"
v-bind="$attrs"
@current-change="changePagination"
@size-change="changeSize"
v-on="$listeners"
>
</el-pagination>
</div>
......@@ -25,12 +26,12 @@ export default {
type: Number,
default: 0,
},
size: {
pageSize: {
required: true,
type: Number,
default: 10,
},
current: {
page: {
required: true,
type: Number,
default: 1,
......@@ -43,42 +44,44 @@ export default {
type: Array,
default: () => [10, 20, 30, 40, 50, 100, 200],
},
background: {
type: Boolean,
default: true,
},
},
data() {
return {};
},
computed: {
Size: {
PageSize: {
get() {
return this.size;
return this.pageSize;
},
set(value) {
this.$emit("update:size", value);
this.$emit("update:pageSize", value);
},
},
page: {
current: {
get() {
return this.current;
return this.page;
},
set(value) {
this.$emit("update:current", value);
this.$emit("update:page", value);
},
},
},
methods: {
changePagination(cur) {
this.page = cur;
if (this.$listeners.get) {
this.$listeners.get();
this.current = cur;
if (this.$listeners.change) {
this.$listeners.change();
}
this.$emit("currentChange", cur);
},
changeSize(size) {
this.Size = size;
if (this.$listeners.get) {
this.$listeners.get();
this.PageSize = size;
if (this.$listeners.change) {
this.$listeners.change();
}
this.$emit("sizeChange", size);
},
},
};
......
......@@ -3,7 +3,6 @@
<el-table
ref="MyTable"
v-loading="loading"
:border="isBorder"
:data="data"
style="width: 100%"
:size="size"
......@@ -42,10 +41,7 @@ export default {
type: String,
default: "",
},
border: {
type: Boolean,
default: false,
},
data: {
type: Array,
default: () => [],
......@@ -70,11 +66,7 @@ export default {
deep: true,
},
},
computed: {
isBorder() {
return !!this.border;
},
},
computed: {},
methods: {
clearSelection() {
this.$refs.MyTable.clearSelection();
......
......@@ -61,7 +61,7 @@ export default {
},
data() {
return {
systemName: process.env.VUE_APP_sysName,
systemName: process.env.VUE_APP_systemName,
portal: process.env.VUE_APP_API_portal_URL + "/#",
};
},
......
......@@ -18,10 +18,10 @@
</div>
<Pagination
:total="hallSearch.total"
:current.sync="hallSearch.page"
:size.sync="hallSearch.size"
:page.sync="hallSearch.page"
:pageSize.sync="hallSearch.size"
layout="total,prev,pager,next,jumper"
@get="getHallEva"
@change="getHallEva"
></Pagination>
</div>
<div class="table-item">
......@@ -44,10 +44,10 @@
</div>
<Pagination
:total="pjOptionSearch.total"
:current.sync="pjOptionSearch.page"
:size.sync="pjOptionSearch.size"
:page.sync="pjOptionSearch.page"
:pageSize.sync="pjOptionSearch.size"
layout="total,prev,pager,next,jumper"
@get="getPjOptionEva"
@change="getPjOptionEva"
></Pagination>
</div>
<div class="table-item">
......@@ -70,10 +70,10 @@
</div>
<Pagination
:total="deptSearch.total"
:current.sync="deptSearch.page"
:size.sync="deptSearch.size"
:page.sync="deptSearch.page"
:pageSize.sync="deptSearch.size"
layout="total,prev,pager,next,jumper"
@get="getDeptEva"
@change="getDeptEva"
></Pagination>
</div>
<div class="table-item">
......@@ -96,10 +96,10 @@
</div>
<Pagination
:total="windowSearch.total"
:current.sync="windowSearch.page"
:size.sync="windowSearch.size"
:page.sync="windowSearch.page"
:pageSize.sync="windowSearch.size"
layout="total,prev,pager,next,jumper"
@get="getWindowEva"
@change="getWindowEva"
></Pagination>
</div>
</div>
......
......@@ -18,10 +18,10 @@
</div>
<Pagination
:total="hallSearch.total"
:current.sync="hallSearch.page"
:size.sync="hallSearch.size"
:page.sync="hallSearch.page"
:pageSize.sync="hallSearch.size"
layout="total,prev,pager,next,jumper"
@get="getHallQueue"
@change="getHallQueue"
></Pagination>
</div>
<div class="table-item">
......@@ -44,10 +44,10 @@
</div>
<Pagination
:total="businessSearch.total"
:current.sync="businessSearch.page"
:size.sync="businessSearch.size"
:page.sync="businessSearch.page"
:pageSize.sync="businessSearch.size"
layout="total,prev,pager,next,jumper"
@get="getBusinessQueue"
@change="getBusinessQueue"
></Pagination>
</div>
<div class="table-item">
......@@ -70,10 +70,10 @@
</div>
<Pagination
:total="deptSearch.total"
:current.sync="deptSearch.page"
:size.sync="deptSearch.size"
:page.sync="deptSearch.page"
:pageSize.sync="deptSearch.size"
layout="total,prev,pager,next,jumper"
@get="getDeptQueue"
@change="getDeptQueue"
></Pagination>
</div>
<div class="table-item">
......@@ -96,10 +96,10 @@
</div>
<Pagination
:total="windowSearch.total"
:current.sync="windowSearch.page"
:size.sync="windowSearch.size"
:page.sync="windowSearch.page"
:pageSize.sync="windowSearch.size"
layout="total,prev,pager,next,jumper"
@get="getWindowQueue"
@change="getWindowQueue"
></Pagination>
</div>
</div>
......
......@@ -30,9 +30,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getEvaStatList"
:page.sync="page"
:pageSize.sync="size"
@change="getEvaStatList"
></Pagination>
</div>
<!-- <el-empty
......@@ -64,7 +64,6 @@ export default {
page: 1,
size: 10,
total: 0,
current: 1,
tableData: [],
column: [
{
......@@ -80,7 +79,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -150,7 +149,7 @@ export default {
getData() {},
async evaStatList(form = {}) {
let res = await getEvaStatList({
page: this.current,
page: this.page,
size: this.size,
siteId: this.siteId,
...this.searchForm,
......@@ -214,7 +213,7 @@ export default {
this.searchForm.sectionNameList = deptName ? [deptName] : [];
this.searchForm.windowFromnumList = windowNum ? [windowNum] : [];
this.current = 1;
this.page = 1;
this.getEvaStatList();
},
......
......@@ -30,9 +30,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getQueueStatList"
:page.sync="page"
:pageSize.sync="size"
@change="getQueueStatList"
></Pagination>
</div>
<!-- <el-empty
......@@ -65,7 +65,6 @@ export default {
page: 1,
size: 10,
total: 0,
current: 1,
tableData: [],
column: [
{
......@@ -81,7 +80,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -154,7 +153,7 @@ export default {
getData() {},
async queueStatList(form = {}) {
let res = await getQueueStatList({
page: this.current,
page: this.page,
size: this.size,
siteId: this.siteId,
...this.searchForm,
......@@ -214,7 +213,7 @@ export default {
this.searchForm.sectionNameList = deptName ? [deptName] : [];
this.searchForm.windowFromnumList = windowNum ? [windowNum] : [];
this.current = 1;
this.page = 1;
this.getQueueStatList();
},
// 导出表格
......
<!-- 登录页面 -->
<template>
<div>登录页</div>
<div class="page page-login flex h-full w-full items-center justify-center">
<div class="flex min-w-[450px] flex-col justify-center bg-white p-[25px]">
<h1 class="mb-4 text-center text-[24px] font-[500]">{{ systemName }}</h1>
<el-form
class="w-full"
ref="form"
:model="form"
:rules="rules"
hide-required-asterisk
>
<el-form-item l prop="loginName">
<el-input
clearable
prefix-icon="el-icon-user"
placeholder="请输入用户名"
v-model="form.loginName"
>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
clearable
prefix-icon="el-icon-lock"
placeholder="请输入密码"
show-password
v-model="form.password"
type="password"
@keyup.enter="onSubmit"
></el-input>
</el-form-item>
<el-form-item prop="securityCode">
<div class="code flex gap-2">
<el-input
clearable
placeholder="请输入验证码"
v-model="form.securityCode"
@keyup.enter="onSubmit"
></el-input>
<div
class="code-box h-[40px] cursor-pointer overflow-hidden rounded-[4px]"
>
<img
class="h-full w-full"
:src="securityUrl"
@click="createCode"
/>
</div>
</div>
</el-form-item>
<el-form-item>
<div>
<el-button
class="w-full"
type="primary"
native-type="submit"
:loading="loading"
@click="onSubmit"
>登录</el-button
>
</div>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {};
import storage from "@/utils/storage";
import { mapMutations } from "vuex";
import { getHomeData } from "@/api/home";
import { generateRoutes, filterBtn } from "@/utils";
import { calcMenu } from "@/router";
import { login } from "@/api/login";
export default {
name: "login",
data() {
return {
api: process.env.VUE_APP_API_BASE_URL,
securityUrl: "",
systemName: process.env.VUE_APP_systemName,
originData: [],
loading: false,
redirect: this.$route.query.redirect || "/",
form: {
loginName: "",
password: "",
securityCode: "",
},
rules: {
loginName: [
{ required: true, message: "请输入用户名", trigger: "blur" },
],
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
securityCode: [
{ required: true, message: "请输入验证码", trigger: "blur" },
],
},
};
},
created() {
this.createCode();
},
methods: {
...mapMutations("user", [
"SET_token",
"SET_sysName",
"SET_sysLogo",
"SET_path",
"SET_userInfo",
"SET_permissions",
"SET_routes",
"SET_menusList",
]),
// 获取验证码
createCode() {
// 加时间戳印记用于刷新gif
let mark = new Date().getTime();
// this.form.mark = mark;
this.securityUrl =
this.api + "/zwfw/securitycode/createCode" + `?mark=${mark}`;
},
onSubmit() {
this.$refs.form.validate(async (valid) => {
if (valid) {
this.loading = true;
let res = await login(this.form);
if (res.data.code == 1) {
let {
token,
user: { id, loginName, siteIds },
} = res.data.data;
let form = {
token,
userInfo: {
id,
name: loginName,
},
};
if (siteIds) {
let siteid = siteIds.split(",")[0];
form.siteid = siteid;
}
await this.getToken(form);
}
this.loading = false;
}
});
},
// 获取token
async getToken(info) {
let { token, userInfo, siteid } = info;
if (token && userInfo) {
this.SET_userInfo(userInfo);
this.SET_token(token);
storage.set(2, "siteId", siteid);
// storage.set(2, "siteName", siteName);
await this.getIndixData();
} else {
this.$message.warning("登录失败,请稍后再试");
}
},
// 获取菜单列表
async getIndixData() {
let res = await getHomeData();
if (res.data.code == 1) {
let { menuList } = res.data.data;
// 过滤掉按钮
let menus = filterBtn(menuList, false);
let routes = generateRoutes(menus);
// this.SET_routes(routes);
this.SET_menusList(menus);
this.setBtnPermissions(menuList);
calcMenu();
if (routes.length) {
let path = routes[0].path;
this.$router.push(path);
} else {
this.$message.warning("暂无权限,请联系管理员!");
}
}
},
// 添加按钮权限字符
setBtnPermissions(menuList) {
let btnPermissions = filterBtn(menuList)
.filter((v) => v.perms)
.map((v) => v.perms);
this.SET_permissions(btnPermissions);
},
},
};
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
.page-login {
background-image: linear-gradient(45deg, #333, #111);
background-size: 40px 40px;
.code-box {
border: 1px solid #dcdfe6;
}
}
</style>
......@@ -168,9 +168,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:page.sync="page"
:size.sync="size"
@get="getEvaluateList"
@change="getEvaluateList"
></Pagination>
</div>
<!-- 详情 -->
......@@ -207,7 +207,7 @@ export default {
exportLoading: false,
searchType,
size: 10,
current: 1,
page: 1,
total: 0,
searchForm: {
type: "windowFromnum",
......@@ -246,7 +246,7 @@ export default {
align: "center",
fixed: "left",
index: (index) => {
return index + 1 + (this.current - 1) * this.size;
return index + 1 + (this.page - 1) * this.size;
},
},
{
......@@ -406,7 +406,7 @@ export default {
// 获取站点
getSite(data) {
if (JSON.stringify(data) !== "{}") {
this.current = 1;
this.page = 1;
this.size = 10;
if (data.type == "site") {
this.searchForm.siteId = data.id;
......@@ -428,7 +428,7 @@ export default {
// 获取数据函数
async getData(form = {}) {
let obj = {
page: this.current,
page: this.page,
size: this.size,
pjTimeStart: this.searchForm.time[0],
pjTimeEnd: this.searchForm.time[1],
......@@ -500,7 +500,7 @@ export default {
this.selectionRows = rows;
},
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getSite(this.curTreeData);
},
......
......@@ -139,9 +139,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getQueueList"
:page.sync="page"
:pageSize.sync="size"
@change="getQueueList"
></Pagination>
</div>
<!-- 详情 -->
......@@ -180,7 +180,7 @@ export default {
exportLoading: false,
total: 0,
size: 10,
current: 1,
page: 1,
selectionRow: [],
searchForm: {
type: "business",
......@@ -214,7 +214,7 @@ export default {
align: "center",
fixed: "left",
index: (index) => {
return index + 1 + (this.current - 1) * this.size;
return index + 1 + (this.page - 1) * this.size;
},
},
{
......@@ -390,7 +390,7 @@ export default {
// 获取站点
getSite(data) {
if (JSON.stringify(data) !== "{}") {
this.current = 1;
this.page = 1;
this.size = 10;
if (data.type == "site") {
this.searchForm.siteId = data.id;
......@@ -412,7 +412,7 @@ export default {
// 获取数据函数
async getData(form = {}) {
let obj = {
page: this.current,
page: this.page,
size: this.size,
taketimeStart: this.searchForm.time[0],
taketimeEnd: this.searchForm.time[1],
......@@ -480,7 +480,7 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getSite(this.curTreeData);
},
......
......@@ -56,9 +56,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getAccessList"
:page.sync="page"
:pageSize.sync="size"
@change="getAccessList"
></Pagination>
<!-- 新增 -->
<AddAccess
......@@ -103,7 +103,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -230,7 +230,7 @@ export default {
areaName: "",
},
tableData: [],
current: 1,
page: 1,
size: 10,
total: 0,
loading: false,
......@@ -252,15 +252,15 @@ export default {
async getAccessList() {
this.loading = true;
let res = await getAccessList({
page: this.current,
page: this.page,
size: this.size,
areaName: `%${this.searchForm.areaName}%`,
});
this.loading = false;
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getAccessList();
}
this.tableData = data;
......@@ -279,13 +279,13 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getAccessList();
},
// 重置
handleReset() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.$resetForm("searchForm");
this.getAccessList();
......
......@@ -48,9 +48,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getSystemList"
:page.sync="page"
:pageSize.sync="size"
@change="getSystemList"
></Pagination>
<!-- 新增 -->
<AddAreaSystem
......@@ -87,7 +87,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -148,7 +148,7 @@ export default {
systemName: "",
},
tableData: [],
current: 1,
page: 1,
size: 10,
total: 0,
loading: false,
......@@ -167,15 +167,15 @@ export default {
async getSystemList() {
this.loading = true;
let res = await getSystemList({
page: this.current,
page: this.page,
size: this.size,
systemName: `%${this.searchForm.systemName}%`,
});
this.loading = false;
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getSystemList();
}
this.tableData = data;
......@@ -194,13 +194,13 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getSystemList();
},
// 重置
handleReset() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.$resetForm("searchForm");
this.getSystemList();
......
......@@ -53,10 +53,10 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
:page.sync="page"
:pageSize.sync="size"
layout="total,prev,pager,next"
@get="getMenuList"
@change="getMenuList"
></Pagination>
<AddMenu
ref="AddMenu"
......@@ -100,7 +100,7 @@ export default {
// width: "55",
// align: "center",
// index: (index) => {
// return (this.current - 1) * this.size + index + 1;
// return (this.page - 1) * this.size + index + 1;
// },
// },
// {
......@@ -213,7 +213,7 @@ export default {
},
tableData: [],
menuList: [],
current: 1,
page: 1,
size: 10000,
total: 0,
loading: false,
......@@ -239,15 +239,15 @@ export default {
},
];
let res = await getMenuList({
page: this.current,
page: this.page,
size: this.size,
name: `%${this.searchForm.name}%`,
});
this.loading = false;
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getMenuList();
}
this.menuList = [...this.menuList, ...buildTree(data)];
......@@ -267,13 +267,13 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getMenuList();
},
// 重置
handleReset() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.$resetForm("searchForm");
this.getMenuList();
......
......@@ -66,9 +66,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getParamList"
:page.sync="page"
:pageSize.sync="size"
@change="getParamList"
></Pagination>
<!-- 新增参数 -->
<AddParameter
......@@ -106,7 +106,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -185,7 +185,7 @@ export default {
keyword: "",
},
tableData: [],
current: 1,
page: 1,
size: 10,
total: 0,
loading: false,
......@@ -200,7 +200,6 @@ export default {
},
computed: {},
methods: {
// 系统事项列表
async getParamList() {
this.loading = true;
let form = {};
......@@ -211,15 +210,15 @@ export default {
form.secondOrganize = value;
}
let res = await getParamList({
page: this.current,
page: this.page,
size: this.size,
...form,
});
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
this.dict = dict;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getParamList();
}
this.tableData = data;
......@@ -239,13 +238,13 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getParamList();
},
// 重置
handleReset() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.$resetForm("searchForm");
this.getParamList();
......
......@@ -70,9 +70,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getResourceList"
:page.sync="page"
:pageSize.sync="size"
@change="getResourceList"
></Pagination>
<!-- 新增 -->
<AddResource
......@@ -113,7 +113,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -184,7 +184,7 @@ export default {
},
total: 0,
size: 10,
current: 1,
page: 1,
tableData: [],
selectionRows: [],
dict: {},
......@@ -198,7 +198,7 @@ export default {
async getResourceList() {
this.loading = true;
let res = await getResourceList({
page: this.current,
page: this.page,
size: this.size,
...this.searchForm,
name: `%${this.searchForm.name}%`,
......@@ -206,8 +206,8 @@ export default {
this.loading = false;
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getResourceList();
}
this.total = total;
......@@ -232,11 +232,11 @@ export default {
this.handleDel(ids);
},
handleSearch() {
this.current = 1;
this.page = 1;
this.getResourceList();
},
handleReset() {
this.current = 1;
this.page = 1;
this.$resetForm("searchForm");
this.$clearSelection("MyTable");
this.getResourceList();
......
......@@ -56,9 +56,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getRoleList"
:page.sync="page"
:pageSize.sync="size"
@change="getRoleList"
></Pagination>
<!-- 新增 -->
<AddRole
......@@ -112,7 +112,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
{
......@@ -178,7 +178,7 @@ export default {
},
tableData: [],
menuTree: [], // 菜单树
current: 1,
page: 1,
size: 10,
total: 0,
loading: false,
......@@ -211,15 +211,15 @@ export default {
async getRoleList() {
this.loading = true;
let res = await getRoleList({
page: this.current,
page: this.page,
size: this.size,
name: `%${this.searchForm.name}%`,
});
this.loading = false;
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getRoleList();
}
this.tableData = data;
......@@ -238,13 +238,13 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getRoleList();
},
// 重置
handleReset() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.$resetForm("searchForm");
this.getRoleList();
......
......@@ -31,9 +31,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getlogsList"
:page.sync="page"
:pageSize.sync="size"
@change="getlogsList"
></Pagination>
</div>
</template>
......@@ -54,7 +54,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -94,7 +94,7 @@ export default {
],
searchVal: "",
tableData: [],
current: 1,
page: 1,
size: 10,
total: 10,
loading: false,
......@@ -111,15 +111,15 @@ export default {
async getlogsList() {
this.loading = true;
let res = await getlogsList({
page: this.current,
page: this.page,
size: this.size,
requestUrl: `%${this.searchVal}%`,
});
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
this.dict = dict;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getlogsList();
}
this.tableData = data;
......@@ -130,14 +130,14 @@ export default {
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getlogsList();
},
// 重置
handleReset() {
this.searchVal = "";
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getlogsList();
},
......
......@@ -48,9 +48,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getTaskList"
:page.sync="page"
:pageSize.sync="size"
@change="getTaskList"
></Pagination>
<!-- 新增参数 -->
<AddTask
......@@ -88,7 +88,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
......@@ -170,7 +170,7 @@ export default {
],
searchVal: "",
tableData: [],
current: 1,
page: 1,
size: 10,
total: 10,
loading: false,
......@@ -189,15 +189,15 @@ export default {
async getTaskList() {
this.loading = true;
let res = await getTaskList({
page: this.current,
page: this.page,
size: this.size,
name: `%${this.searchVal}%`,
});
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
this.dict = dict;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getTaskList();
}
this.tableData = data;
......@@ -217,14 +217,14 @@ export default {
},
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getTaskList();
},
// 重置
handleReset() {
this.searchVal = "";
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getTaskList();
},
......
......@@ -51,9 +51,9 @@
</div>
<Pagination
:total="total"
:current.sync="current"
:size.sync="size"
@get="getUserList"
:page.sync="page"
:pageSize.sync="size"
@change="getUserList"
></Pagination>
<!-- 分配角色 -->
......@@ -89,7 +89,7 @@ export default {
width: "55",
align: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
return (this.page - 1) * this.size + index + 1;
},
},
{
......@@ -169,7 +169,7 @@ export default {
keyword: "",
},
tableData: [],
current: 1,
page: 1,
size: 10,
total: 0,
loading: false,
......@@ -192,15 +192,15 @@ export default {
let value = `%${this.searchForm.keyword}%`;
obj[this.searchForm.type] = value;
let res = await getUserList({
page: this.current,
page: this.page,
size: this.size,
...obj,
});
this.loading = false;
if (res.data.code == 1) {
let { data, total, dict } = res.data.data;
if (!data.length && this.current > 1) {
this.current -= 1;
if (!data.length && this.page > 1) {
this.page -= 1;
this.getUserList();
}
this.tableData = data;
......@@ -211,13 +211,13 @@ export default {
// 搜索
handleSearch() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.getUserList();
},
// 重置
handleReset() {
this.current = 1;
this.page = 1;
this.$clearSelection("MyTable");
this.$resetForm("searchForm");
this.getUserList();
......
......@@ -247,7 +247,7 @@ router.beforeEach((to, from, next) => {
if (islogin) {
next();
} else {
if (to.path === "/sso") {
if (to.path === "/sso" || to.path === "/login") {
next();
} else {
location.href = process.env.VUE_APP_API_portal_URL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment