接口逻辑调整
This commit is contained in:
parent
544f0f9139
commit
5cc8c5216f
@ -8,5 +8,5 @@ VITE_PUBLIC_PATH = /
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 多麦管理系统/开发环境
|
# 多麦管理系统/开发环境
|
||||||
# VITE_APP_BASE_API = 'http://192.168.0.192:8080/'
|
VITE_APP_BASE_API = 'http://192.168.0.93:6012/admin/'
|
||||||
VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
|
# VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
|
||||||
|
|||||||
12
index.html
12
index.html
@ -202,12 +202,12 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div id="loader-wrapper">
|
<!-- <div id="loader-wrapper"> -->
|
||||||
<div id="loader"></div>
|
<!-- <div id="loader"></div> -->
|
||||||
<div class="loader-section section-left"></div>
|
<!-- <div class="loader-section section-left"></div> -->
|
||||||
<div class="loader-section section-right"></div>
|
<!-- <div class="loader-section section-right"></div> -->
|
||||||
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
<!-- <div class="load_title">正在加载系统资源,请耐心等待</div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
</div>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="/src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 登录方法
|
// 登录方法
|
||||||
export function login(username, password, code, uuid) {
|
export function login(account, password) {
|
||||||
const data = {
|
const data = {
|
||||||
username,
|
account,
|
||||||
password,
|
password,
|
||||||
code,
|
|
||||||
uuid
|
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/login',
|
url: '/system/login',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false,
|
isToken: false,
|
||||||
repeatSubmit: false
|
repeatSubmit: false
|
||||||
@ -42,7 +40,7 @@ export function getInfo() {
|
|||||||
// 退出方法
|
// 退出方法
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return request({
|
return request({
|
||||||
url: '/logout',
|
url: '/system/logout',
|
||||||
method: 'post'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,16 +2,25 @@ import request from "@/utils/request";
|
|||||||
|
|
||||||
export function getApplyList(data) {
|
export function getApplyList(data) {
|
||||||
return request({
|
return request({
|
||||||
url: "/auto-apply/list-activity-admin",
|
url: "/activity/list",
|
||||||
method: "post",
|
method: "get",
|
||||||
params: data,
|
params: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setOrderSort(query) {
|
export function setOrderSort(query) {
|
||||||
return request({
|
return request({
|
||||||
url: "/auto-apply/set-order",
|
url: "/activity/updateSort",
|
||||||
method: "post",
|
method: "post",
|
||||||
params: query,
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
data: query,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export function setAutoApply(query) {
|
||||||
|
return request({
|
||||||
|
url: "/activity/changeEnableAutoApply",
|
||||||
|
method: "post",
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
data: query,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { parseStrEmpty } from "@/utils/ruoyi";
|
|||||||
// 查询用户列表
|
// 查询用户列表
|
||||||
export function listUser(query) {
|
export function listUser(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/list',
|
url: '/user/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
@ -58,14 +58,14 @@ export function resetUserPwd(userId, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
export function changeUserStatus(userId, status) {
|
export function changeUserStatus(id, status) {
|
||||||
const data = {
|
const data = {
|
||||||
userId,
|
id,
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/changeStatus',
|
url: '/user/changeStatus',
|
||||||
method: 'put',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,69 +1,72 @@
|
|||||||
import router from './router'
|
import router from "./router";
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from "element-plus";
|
||||||
import NProgress from 'nprogress'
|
import NProgress from "nprogress";
|
||||||
import 'nprogress/nprogress.css'
|
import "nprogress/nprogress.css";
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from "@/utils/auth";
|
||||||
import { isHttp, isPathMatch } from '@/utils/validate'
|
import { isHttp, isPathMatch } from "@/utils/validate";
|
||||||
import { isRelogin } from '@/utils/request'
|
import { isRelogin } from "@/utils/request";
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from "@/store/modules/user";
|
||||||
import useSettingsStore from '@/store/modules/settings'
|
import useSettingsStore from "@/store/modules/settings";
|
||||||
import usePermissionStore from '@/store/modules/permission'
|
import usePermissionStore from "@/store/modules/permission";
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false })
|
NProgress.configure({ showSpinner: false });
|
||||||
|
|
||||||
const whiteList = ['/login', '/register']
|
const whiteList = ["/login", "/register"];
|
||||||
|
|
||||||
const isWhiteList = (path) => {
|
const isWhiteList = (path) => {
|
||||||
return whiteList.some(pattern => isPathMatch(pattern, path))
|
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
||||||
}
|
};
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
NProgress.start()
|
NProgress.start();
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
to.meta.title && useSettingsStore().setTitle(to.meta.title)
|
to.meta.title && useSettingsStore().setTitle(to.meta.title);
|
||||||
/* has token*/
|
/* has token*/
|
||||||
if (to.path === '/login') {
|
if (to.path === "/login") {
|
||||||
next({ path: '/' })
|
next({ path: "/" });
|
||||||
NProgress.done()
|
NProgress.done();
|
||||||
} else if (isWhiteList(to.path)) {
|
} else if (isWhiteList(to.path)) {
|
||||||
next()
|
next();
|
||||||
} else {
|
} else {
|
||||||
if (useUserStore().roles.length === 0) {
|
if (useUserStore().roles.length === 0) {
|
||||||
isRelogin.show = true
|
// isRelogin.show = true;
|
||||||
// 判断当前用户是否已拉取完user_info信息
|
// // 判断当前用户是否已拉取完user_info信息
|
||||||
useUserStore().getInfo().then(() => {
|
// isRelogin.show = false;
|
||||||
isRelogin.show = false
|
usePermissionStore()
|
||||||
usePermissionStore().generateRoutes().then(accessRoutes => {
|
.generateRoutes()
|
||||||
|
.then((accessRoutes) => {
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
accessRoutes.forEach(route => {
|
accessRoutes.forEach((route) => {
|
||||||
if (!isHttp(route.path)) {
|
if (!isHttp(route.path)) {
|
||||||
router.addRoute(route) // 动态添加可访问路由表
|
router.addRoute(route); // 动态添加可访问路由表
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
// next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
|
||||||
})
|
next();
|
||||||
}).catch(err => {
|
});
|
||||||
useUserStore().logOut().then(() => {
|
|
||||||
ElMessage.error(err)
|
// }).catch(err => {
|
||||||
next({ path: '/' })
|
// useUserStore().logOut().then(() => {
|
||||||
})
|
// ElMessage.error(err)
|
||||||
})
|
// next({ path: '/' })
|
||||||
|
// })
|
||||||
|
// })
|
||||||
} else {
|
} else {
|
||||||
next()
|
next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有token
|
// 没有token
|
||||||
if (isWhiteList(to.path)) {
|
if (isWhiteList(to.path)) {
|
||||||
// 在免登录白名单,直接进入
|
// 在免登录白名单,直接进入
|
||||||
next()
|
next();
|
||||||
} else {
|
} else {
|
||||||
next(`/login`) // 否则全部重定向到登录页
|
next({ path: "/login" }); // 否则全部重定向到登录页
|
||||||
NProgress.done()
|
NProgress.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
NProgress.done()
|
NProgress.done();
|
||||||
})
|
});
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import InnerLink from '@/layout/components/InnerLink'
|
|||||||
|
|
||||||
// 匹配views里面所有的.vue文件
|
// 匹配views里面所有的.vue文件
|
||||||
const modules = import.meta.glob('./../../views/**/*.vue')
|
const modules = import.meta.glob('./../../views/**/*.vue')
|
||||||
|
const route2r = '[{"name":"System","path":"/system","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统管理","icon":"system","noCache":false,"link":null},"children":[{"name":"User","path":"user","hidden":false,"component":"system/user/index","meta":{"title":"用户管理","icon":"user","noCache":false,"link":null}},{"name":"Role","path":"role","hidden":false,"component":"system/role/index","meta":{"title":"角色管理","icon":"peoples","noCache":false,"link":null}},{"name":"Apply","path":"apply","hidden":false,"component":"system/apply/index","meta":{"title":"提报管理","icon":"excel","noCache":false,"link":null}},{"name":"Menu","path":"menu","hidden":false,"component":"system/menu/index","meta":{"title":"菜单管理","icon":"tree-table","noCache":false,"link":null}},{"name":"Dept","path":"dept","hidden":false,"component":"system/dept/index","meta":{"title":"部门管理","icon":"tree","noCache":false,"link":null}},{"name":"Post","path":"post","hidden":false,"component":"system/post/index","meta":{"title":"岗位管理","icon":"post","noCache":false,"link":null}},{"name":"Dict","path":"dict","hidden":false,"component":"system/dict/index","meta":{"title":"字典管理","icon":"dict","noCache":false,"link":null}},{"name":"Config","path":"config","hidden":false,"component":"system/config/index","meta":{"title":"参数设置","icon":"edit","noCache":false,"link":null}},{"name":"Notice","path":"notice","hidden":false,"component":"system/notice/index","meta":{"title":"通知公告","icon":"message","noCache":false,"link":null}},{"name":"Log","path":"log","hidden":false,"redirect":"noRedirect","component":"ParentView","alwaysShow":true,"meta":{"title":"日志管理","icon":"log","noCache":false,"link":null},"children":[{"name":"Operlog","path":"operlog","hidden":false,"component":"monitor/operlog/index","meta":{"title":"操作日志","icon":"form","noCache":false,"link":null}},{"name":"Logininfor","path":"logininfor","hidden":false,"component":"monitor/logininfor/index","meta":{"title":"登录日志","icon":"logininfor","noCache":false,"link":null}}]}]},{"name":"Monitor","path":"/monitor","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统监控","icon":"monitor","noCache":false,"link":null},"children":[{"name":"Online","path":"online","hidden":false,"component":"monitor/online/index","meta":{"title":"在线用户","icon":"online","noCache":false,"link":null}},{"name":"Job","path":"job","hidden":false,"component":"monitor/job/index","meta":{"title":"定时任务","icon":"job","noCache":false,"link":null}},{"name":"Druid","path":"druid","hidden":false,"component":"monitor/druid/index","meta":{"title":"数据监控","icon":"druid","noCache":false,"link":null}},{"name":"Server","path":"server","hidden":false,"component":"monitor/server/index","meta":{"title":"服务监控","icon":"server","noCache":false,"link":null}},{"name":"Cache","path":"cache","hidden":false,"component":"monitor/cache/index","meta":{"title":"缓存监控","icon":"redis","noCache":false,"link":null}},{"name":"CacheList","path":"cacheList","hidden":false,"component":"monitor/cache/list","meta":{"title":"缓存列表","icon":"redis-list","noCache":false,"link":null}}]},{"name":"Tool","path":"/tool","hidden":false,"redirect":"noRedirect","component":"Layout","alwaysShow":true,"meta":{"title":"系统工具","icon":"tool","noCache":false,"link":null},"children":[{"name":"Build","path":"build","hidden":false,"component":"tool/build/index","meta":{"title":"表单构建","icon":"build","noCache":false,"link":null}},{"name":"Gen","path":"gen","hidden":false,"component":"tool/gen/index","meta":{"title":"代码生成","icon":"code","noCache":false,"link":null}},{"name":"Swagger","path":"swagger","hidden":false,"component":"tool/swagger/index","meta":{"title":"系统接口","icon":"swagger","noCache":false,"link":null}}]}]'
|
||||||
|
const dwx = JSON.parse(route2r)
|
||||||
const usePermissionStore = defineStore(
|
const usePermissionStore = defineStore(
|
||||||
'permission',
|
'permission',
|
||||||
{
|
{
|
||||||
@ -35,10 +36,9 @@ const usePermissionStore = defineStore(
|
|||||||
generateRoutes(roles) {
|
generateRoutes(roles) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
// 向后端请求路由数据
|
// 向后端请求路由数据
|
||||||
getRouters().then(res => {
|
const sdata = JSON.parse(JSON.stringify(dwx))
|
||||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
const rdata = JSON.parse(JSON.stringify(dwx))
|
||||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
const defaultData = JSON.parse(JSON.stringify(dwx))
|
||||||
const defaultData = JSON.parse(JSON.stringify(res.data))
|
|
||||||
const sidebarRoutes = filterAsyncRouter(sdata)
|
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||||
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
||||||
const defaultRoutes = filterAsyncRouter(defaultData)
|
const defaultRoutes = filterAsyncRouter(defaultData)
|
||||||
@ -49,7 +49,7 @@ const usePermissionStore = defineStore(
|
|||||||
this.setDefaultRoutes(sidebarRoutes)
|
this.setDefaultRoutes(sidebarRoutes)
|
||||||
this.setTopbarRoutes(defaultRoutes)
|
this.setTopbarRoutes(defaultRoutes)
|
||||||
resolve(rewriteRoutes)
|
resolve(rewriteRoutes)
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,14 +17,13 @@ const useUserStore = defineStore(
|
|||||||
actions: {
|
actions: {
|
||||||
// 登录
|
// 登录
|
||||||
login(userInfo) {
|
login(userInfo) {
|
||||||
const username = userInfo.username.trim()
|
const username = userInfo.account
|
||||||
const password = userInfo.password
|
const password = userInfo.password
|
||||||
const code = userInfo.code
|
|
||||||
const uuid = userInfo.uuid
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
login(username, password, code, uuid).then(res => {
|
login(username, password).then(res => {
|
||||||
setToken(res.token)
|
console.log(res)
|
||||||
this.token = res.token
|
setToken(res.data.token)
|
||||||
|
this.token = res.data.token
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
reject(error)
|
||||||
@ -55,7 +54,7 @@ const useUserStore = defineStore(
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 退出系统
|
// // 退出系统
|
||||||
logOut() {
|
logOut() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logout(this.token).then(() => {
|
logout(this.token).then(() => {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ let downloadLoadingInstance;
|
|||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export let isRelogin = { show: false };
|
export let isRelogin = { show: false };
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
@ -27,8 +27,9 @@ service.interceptors.request.use(config => {
|
|||||||
// 是否需要防止数据重复提交
|
// 是否需要防止数据重复提交
|
||||||
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
||||||
if (getToken() && !isToken) {
|
if (getToken() && !isToken) {
|
||||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
}
|
}
|
||||||
|
|
||||||
// get请求映射params参数
|
// get请求映射params参数
|
||||||
if (config.method === 'get' && config.params) {
|
if (config.method === 'get' && config.params) {
|
||||||
let url = config.url + '?' + tansParams(config.params);
|
let url = config.url + '?' + tansParams(config.params);
|
||||||
|
|||||||
@ -224,5 +224,5 @@ export function getNormalPath(p) {
|
|||||||
|
|
||||||
// 验证是否为blob格式
|
// 验证是否为blob格式
|
||||||
export function blobValidate(data) {
|
export function blobValidate(data) {
|
||||||
return data.type !== 'application/json'
|
return data.type !== 'application/x-www-form-urlencoded'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,38 +5,20 @@
|
|||||||
<img src="@/assets/logo/logo2.png" style="width: 48px;height:48px;">
|
<img src="@/assets/logo/logo2.png" style="width: 48px;height:48px;">
|
||||||
<h2 class="title">{{ title }}</h2>
|
<h2 class="title">{{ title }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="account">
|
||||||
<el-input
|
<el-input v-model="loginForm.account" type="text" size="large" auto-complete="off" placeholder="账号">
|
||||||
v-model="loginForm.username"
|
|
||||||
type="text"
|
|
||||||
size="large"
|
|
||||||
auto-complete="off"
|
|
||||||
placeholder="账号"
|
|
||||||
>
|
|
||||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input
|
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
|
||||||
v-model="loginForm.password"
|
@keyup.enter="handleLogin">
|
||||||
type="password"
|
|
||||||
size="large"
|
|
||||||
auto-complete="off"
|
|
||||||
placeholder="密码"
|
|
||||||
@keyup.enter="handleLogin"
|
|
||||||
>
|
|
||||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||||
<el-form-item style="width:100%;">
|
<el-form-item style="width:100%;">
|
||||||
<el-button
|
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
|
||||||
:loading="loading"
|
|
||||||
size="large"
|
|
||||||
type="primary"
|
|
||||||
style="width:100%;"
|
|
||||||
@click.prevent="handleLogin"
|
|
||||||
>
|
|
||||||
<span v-if="!loading">登 录</span>
|
<span v-if="!loading">登 录</span>
|
||||||
<span v-else>登 录 中...</span>
|
<span v-else>登 录 中...</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -64,15 +46,13 @@ const router = useRouter();
|
|||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
const loginForm = ref({
|
const loginForm = ref({
|
||||||
username: "admin",
|
account: "",
|
||||||
password: "admin123",
|
password: "",
|
||||||
rememberMe: false,
|
rememberMe: false
|
||||||
code: "",
|
|
||||||
uuid: ""
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const loginRules = {
|
const loginRules = {
|
||||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
account: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,21 +62,22 @@ const register = ref(false);
|
|||||||
const redirect = ref(undefined);
|
const redirect = ref(undefined);
|
||||||
|
|
||||||
watch(route, (newRoute) => {
|
watch(route, (newRoute) => {
|
||||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||||
}, { immediate: true });
|
}, { immediate: true });
|
||||||
|
|
||||||
function handleLogin() {
|
function handleLogin() {
|
||||||
proxy.$refs.loginRef.validate(valid => {
|
proxy.$refs.loginRef.validate(valid => {
|
||||||
|
console.log(valid);
|
||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||||
if (loginForm.value.rememberMe) {
|
if (loginForm.value.rememberMe) {
|
||||||
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
Cookies.set("account", loginForm.value.account, { expires: 30 });
|
||||||
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
|
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
|
||||||
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
||||||
} else {
|
} else {
|
||||||
// 否则移除
|
// 否则移除
|
||||||
Cookies.remove("username");
|
Cookies.remove("account");
|
||||||
Cookies.remove("password");
|
Cookies.remove("password");
|
||||||
Cookies.remove("rememberMe");
|
Cookies.remove("rememberMe");
|
||||||
}
|
}
|
||||||
@ -119,11 +100,11 @@ function handleLogin() {
|
|||||||
|
|
||||||
|
|
||||||
function getCookie() {
|
function getCookie() {
|
||||||
const username = Cookies.get("username");
|
const account = Cookies.get("account");
|
||||||
const password = Cookies.get("password");
|
const password = Cookies.get("password");
|
||||||
const rememberMe = Cookies.get("rememberMe");
|
const rememberMe = Cookies.get("rememberMe");
|
||||||
loginForm.value = {
|
loginForm.value = {
|
||||||
username: username === undefined ? loginForm.value.username : username,
|
account: account === undefined ? loginForm.value.account : account,
|
||||||
password: password === undefined ? loginForm.value.password : decrypt(password),
|
password: password === undefined ? loginForm.value.password : decrypt(password),
|
||||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||||
};
|
};
|
||||||
@ -141,6 +122,7 @@ getCookie();
|
|||||||
background-image: url("../assets/images/loginbg.png");
|
background-image: url("../assets/images/loginbg.png");
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
// margin: 0px auto 30px auto;
|
// margin: 0px auto 30px auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -154,32 +136,39 @@ getCookie();
|
|||||||
width: 400px;
|
width: 400px;
|
||||||
padding: 25px 25px 5px 25px;
|
padding: 25px 25px 5px 25px;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
.el-input {
|
.el-input {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|
||||||
input {
|
input {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-icon {
|
.input-icon {
|
||||||
height: 39px;
|
height: 39px;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-tip {
|
.login-tip {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #bfbfbf;
|
color: #bfbfbf;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-code {
|
.login-code {
|
||||||
width: 33%;
|
width: 33%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
float: right;
|
float: right;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-login-footer {
|
.el-login-footer {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
@ -192,6 +181,7 @@ getCookie();
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-code-img {
|
.login-code-img {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ElMessageBox } from "element-plus";
|
import { ElMessageBox } from "element-plus";
|
||||||
import { getCodeImg, register } from "@/api/login";
|
import { register } from "@/api/login";
|
||||||
|
|
||||||
const title = import.meta.env.VITE_APP_TITLE;
|
const title = import.meta.env.VITE_APP_TITLE;
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@ -95,18 +95,25 @@
|
|||||||
<el-table v-loading="loading" :data="applyList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="applyList" @selection-change="handleSelectionChange">
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||||
<el-table-column label="活动ID" prop="activityId" />
|
<el-table-column label="活动ID" prop="activityId" />
|
||||||
<el-table-column label="活动名称" prop="activityName" :show-overflow-tooltip="true" />
|
<el-table-column label="活动名称" prop="activityName" :show-overflow-tooltip="true" width="320"/>
|
||||||
<el-table-column label="状态" prop="status" :show-overflow-tooltip="true">
|
<el-table-column label="状态" prop="actStatus" :show-overflow-tooltip="true">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag :type="scope.row.status === 3 ? 'success' : 'danger'">
|
<el-tag :type="scope.row.actStatus === 3 ? 'success' : 'danger'">
|
||||||
{{ scope.row.status === 3 ? '报名中' : '报名结束' }}
|
{{ scope.row.actStatus === 3 ? '报名中' : '报名结束' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="排序" prop="sortOrder">
|
<el-table-column label="排序" prop="sort" width="100"/>
|
||||||
|
<el-table-column label="自动提报" align="center" key="enableAutoApply">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span style="width:60px">{{ scope.row.sortOrder }}</span>
|
<el-switch v-model="scope.row.enableAutoApply" @change="handleStatusChange(scope.row)"></el-switch>
|
||||||
<el-button type="primary" link @click="handleEditSort(scope.row)" style="margin-left:20px;" :disabled="scope.row.status !== 3">编辑</el-button>
|
<!-- {{ scope.row.memberStatus }} -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" prop="sortOrder">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" link @click="handleEditSort(scope.row)" style="margin-left:20px;"
|
||||||
|
:disabled="scope.row.actStatus !== 3">编辑</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@ -133,7 +140,7 @@
|
|||||||
|
|
||||||
<script setup name="Role">
|
<script setup name="Role">
|
||||||
import { listRole } from "@/api/system/role";
|
import { listRole } from "@/api/system/role";
|
||||||
import { getApplyList, setOrderSort } from "@/api/system/apply";
|
import { getApplyList, setOrderSort, setAutoApply } from "@/api/system/apply";
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +166,17 @@ onMounted(() => {
|
|||||||
function getActivityListFn(params) {
|
function getActivityListFn(params) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getApplyList(params).then(res => {
|
getApplyList(params).then(res => {
|
||||||
applyList.value = res.data.list;
|
console.log(res);
|
||||||
|
applyList.value = res.data.records.map(item => {
|
||||||
|
item._isInit = true;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
// 数据加载完成后,延迟将_isInit设为false
|
||||||
|
setTimeout(() => {
|
||||||
|
applyList.value.forEach(item => {
|
||||||
|
item._isInit = false;
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
total.value = res.data.total;
|
total.value = res.data.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
@ -176,20 +193,39 @@ const newSortOrder = ref(0);
|
|||||||
|
|
||||||
function handleEditSort(row) {
|
function handleEditSort(row) {
|
||||||
currentSortItem.value = row;
|
currentSortItem.value = row;
|
||||||
newSortOrder.value = row.sortOrder;
|
newSortOrder.value = row.sort;
|
||||||
sortDialogVisible.value = true;
|
sortDialogVisible.value = true;
|
||||||
}
|
}
|
||||||
|
/** 自动提报状态修改 */
|
||||||
|
function handleStatusChange(row) {
|
||||||
|
if (row._isInit) return;
|
||||||
|
console.log('用户状态修改', row.id, row.memberStatus)
|
||||||
|
const params = {
|
||||||
|
activityId: row.activityId,
|
||||||
|
enableAutoApply: row.enableAutoApply
|
||||||
|
}
|
||||||
|
setAutoApply(params).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
proxy.$modal.msgSuccess('修改成功');
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('修改失败,请重试');
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('请求失败', error);
|
||||||
|
proxy.$modal.msgError('设置失败');
|
||||||
|
row.enableAutoApply = !row.enableAutoApply
|
||||||
|
});
|
||||||
|
};
|
||||||
function setOrderSortFn() {
|
function setOrderSortFn() {
|
||||||
const params = {
|
const params = {
|
||||||
id: currentSortItem.value.id,
|
activityId: currentSortItem.value.activityId,
|
||||||
order: newSortOrder.value
|
sort: newSortOrder.value
|
||||||
}
|
}
|
||||||
setOrderSort(params).then(res => {
|
setOrderSort(params).then(res => {
|
||||||
// 更新本地列表中的排序值
|
// 更新本地列表中的排序值
|
||||||
const index = applyList.value.findIndex(item => item.id === currentSortItem.value.id);
|
const index = applyList.value.findIndex(item => item.activityId === currentSortItem.value.activityId);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
applyList.value[index].sortOrder = newSortOrder.value;
|
applyList.value[index].sort = newSortOrder.value;
|
||||||
}
|
}
|
||||||
sortDialogVisible.value = false;
|
sortDialogVisible.value = false;
|
||||||
proxy.$modal.msgSuccess('修改成功');
|
proxy.$modal.msgSuccess('修改成功');
|
||||||
|
|||||||
@ -17,19 +17,23 @@
|
|||||||
<pane size="84">
|
<pane size="84">
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="团长名称" prop="userName">
|
<el-form-item label="团长名称" prop="nickname">
|
||||||
<el-input v-model="queryParams.userName" placeholder="请输入团长名称" clearable style="width: 240px" @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.nickname" placeholder="请输入团长名称" clearable style="width: 240px"
|
||||||
|
@keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机号码" prop="phonenumber">
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable style="width: 240px" @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable style="width: 240px"
|
||||||
|
@keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
||||||
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" style="width: 308px">
|
<el-form-item label="创建时间" style="width: 308px">
|
||||||
<el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
<el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||||
|
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
@ -39,38 +43,41 @@
|
|||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:user:add']">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']">修改</el-button>
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
|
v-hasPermi="['system:user:edit']">修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']">删除</el-button>
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
|
v-hasPermi="['system:user:remove']">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="info" plain icon="Upload" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button>
|
<el-button type="info" plain icon="Upload" @click="handleImport"
|
||||||
|
v-hasPermi="['system:user:import']">导入</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:user:export']">导出</el-button>
|
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||||
|
v-hasPermi="['system:user:export']">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="filteredUserList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="100" align="center" />
|
||||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
<el-table-column label="用户编号" align="center" key="id" prop="id" width="100" v-if="columns[0].visible" />
|
||||||
<el-table-column label="账号名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
<el-table-column label="团长" align="center" key="nickname" prop="nickname" v-if="columns[2].visible"
|
||||||
<el-table-column label="团长" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
:show-overflow-tooltip="true" />
|
||||||
<!-- <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> -->
|
<!-- <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> -->
|
||||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
<el-table-column label="手机号码" align="center" key="phone" prop="phone" v-if="columns[4].visible"
|
||||||
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
width="120" />
|
||||||
|
<el-table-column label="状态" align="center" key="memberStatus" v-if="columns[5].visible">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch v-model="scope.row.memberStatus" :active-value="0" :inactive-value="1"
|
||||||
v-model="scope.row.status"
|
@change="handleStatusChange(scope.row)"></el-switch>
|
||||||
active-value="0"
|
<!-- {{ scope.row.memberStatus }} -->
|
||||||
inactive-value="1"
|
|
||||||
@change="handleStatusChange(scope.row)"
|
|
||||||
></el-switch>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="240">
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="240">
|
||||||
@ -81,21 +88,26 @@
|
|||||||
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:user:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']"></el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:user:remove']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']"></el-button>
|
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)"
|
||||||
|
v-hasPermi="['system:user:resetPwd']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)"
|
||||||
|
v-hasPermi="['system:user:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
</el-col>
|
</el-col>
|
||||||
</pane>
|
</pane>
|
||||||
</splitpanes>
|
</splitpanes>
|
||||||
@ -112,7 +124,9 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="归属部门" prop="deptId">
|
<el-form-item label="归属部门" prop="deptId">
|
||||||
<el-tree-select v-model="form.deptId" :data="enabledDeptOptions" :props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择归属部门" check-strictly />
|
<el-tree-select v-model="form.deptId" :data="enabledDeptOptions"
|
||||||
|
:props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择归属部门"
|
||||||
|
check-strictly />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -144,14 +158,16 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="用户性别">
|
<el-form-item label="用户性别">
|
||||||
<el-select v-model="form.sex" placeholder="请选择">
|
<el-select v-model="form.sex" placeholder="请选择">
|
||||||
<el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
<el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label }}</el-radio>
|
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label
|
||||||
|
}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -160,14 +176,16 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="岗位">
|
<el-form-item label="岗位">
|
||||||
<el-select v-model="form.postIds" multiple placeholder="请选择">
|
<el-select v-model="form.postIds" multiple placeholder="请选择">
|
||||||
<el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId" :disabled="item.status == 1"></el-option>
|
<el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId"
|
||||||
|
:disabled="item.status == 1"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="角色">
|
<el-form-item label="角色">
|
||||||
<el-select v-model="form.roleIds" multiple placeholder="请选择">
|
<el-select v-model="form.roleIds" multiple placeholder="请选择">
|
||||||
<el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" :disabled="item.status == 1"></el-option>
|
<el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId"
|
||||||
|
:disabled="item.status == 1"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -190,7 +208,9 @@
|
|||||||
|
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
||||||
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||||
|
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||||
|
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
@ -199,7 +219,8 @@
|
|||||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
||||||
</div>
|
</div>
|
||||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
|
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
||||||
|
@click="importTemplate">下载模板</el-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
@ -272,10 +293,11 @@ const data = reactive({
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
userName: undefined,
|
colonelName: undefined,
|
||||||
phonenumber: undefined,
|
phone: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
deptId: undefined
|
startDate: undefined,
|
||||||
|
endDate: undefined
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||||
@ -289,9 +311,13 @@ const data = reactive({
|
|||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
//过滤部分ID
|
//过滤部分ID
|
||||||
const filteredUserList = computed(() => {
|
// const filteredUserList = computed(() => {
|
||||||
return userList.value.filter(item => item.userId !== 1&&item.userId !== 150);
|
// const list = userList.value.forEach(item => {
|
||||||
});
|
// item._originStatus = item.memberStatus;
|
||||||
|
// });
|
||||||
|
// console.log('过滤', list)
|
||||||
|
// return list
|
||||||
|
// });
|
||||||
|
|
||||||
/** 通过条件过滤节点 */
|
/** 通过条件过滤节点 */
|
||||||
const filterNode = (value, data) => {
|
const filterNode = (value, data) => {
|
||||||
@ -300,27 +326,36 @@ const filterNode = (value, data) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 根据名称筛选部门树 */
|
/** 根据名称筛选部门树 */
|
||||||
watch(deptName, val => {
|
// watch(deptName, val => {
|
||||||
proxy.$refs["deptTreeRef"].filter(val);
|
// proxy.$refs["deptTreeRef"].filter(val);
|
||||||
});
|
// });
|
||||||
|
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
userList.value = res.rows;
|
userList.value = res.data.records.map(item => {
|
||||||
total.value = res.total;
|
item._isInit = true;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
// 数据加载完成后,延迟将_isInit设为false
|
||||||
|
setTimeout(() => {
|
||||||
|
userList.value.forEach(item => {
|
||||||
|
item._isInit = false;
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
total.value = res.data.total;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 查询部门下拉树结构 */
|
// /** 查询部门下拉树结构 */
|
||||||
function getDeptTree() {
|
// function getDeptTree() {
|
||||||
deptTreeSelect().then(response => {
|
// deptTreeSelect().then(response => {
|
||||||
deptOptions.value = response.data;
|
// deptOptions.value = response.data;
|
||||||
enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
// enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
/** 过滤禁用的部门 */
|
/** 过滤禁用的部门 */
|
||||||
function filterDisabledDept(deptList) {
|
function filterDisabledDept(deptList) {
|
||||||
@ -364,25 +399,27 @@ function handleDelete(row) {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download("system/user/export", {
|
proxy.download("system/user/export", {
|
||||||
...queryParams.value,
|
...queryParams.value,
|
||||||
},`user_${new Date().getTime()}.xlsx`);
|
}, `user_${new Date().getTime()}.xlsx`);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 用户状态修改 */
|
/** 用户状态修改 */
|
||||||
function handleStatusChange(row) {
|
function handleStatusChange(row) {
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
if(row._isInit) return;
|
||||||
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
console.log('用户状态修改', row.id, row.memberStatus)
|
||||||
return changeUserStatus(row.userId, row.status);
|
let text = row.memberStatus === 0 ? "启用" : "停用";
|
||||||
|
proxy.$modal.confirm('确认要"' + text + '""' + row.nickname + '"用户吗?').then(function () {
|
||||||
|
return changeUserStatus(row.id, row.memberStatus);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
proxy.$modal.msgSuccess(text + "成功");
|
proxy.$modal.msgSuccess(text + "成功");
|
||||||
}).catch(function () {
|
}).catch(function () {
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
row.memberStatus = row.memberStatus === 0 ? 1 : 0;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -408,7 +445,7 @@ function handleAuthRole(row) {
|
|||||||
|
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
function handleResetPwd(row) {
|
function handleResetPwd(row) {
|
||||||
proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
proxy.$prompt('请输入"' + row.nickname + '"的新密码', "提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
@ -423,7 +460,7 @@ function handleResetPwd(row) {
|
|||||||
resetUserPwd(row.userId, value).then(response => {
|
resetUserPwd(row.userId, value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||||
});
|
});
|
||||||
}).catch(() => {});
|
}).catch(() => { });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 选择条数 */
|
/** 选择条数 */
|
||||||
@ -538,6 +575,6 @@ function submitForm() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
getDeptTree();
|
// getDeptTree();
|
||||||
getList();
|
getList();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user