接口逻辑调整
This commit is contained in:
parent
544f0f9139
commit
5cc8c5216f
@ -8,5 +8,5 @@ VITE_PUBLIC_PATH = /
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 多麦管理系统/开发环境
|
||||
# VITE_APP_BASE_API = 'http://192.168.0.192:8080/'
|
||||
VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
|
||||
VITE_APP_BASE_API = 'http://192.168.0.93:6012/admin/'
|
||||
# VITE_APP_BASE_API = 'https://www.saas.duomailianmeng.com/srv'
|
||||
|
||||
12
index.html
12
index.html
@ -202,12 +202,12 @@
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="loader-wrapper">
|
||||
<div id="loader"></div>
|
||||
<div class="loader-section section-left"></div>
|
||||
<div class="loader-section section-right"></div>
|
||||
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
||||
</div>
|
||||
<!-- <div id="loader-wrapper"> -->
|
||||
<!-- <div id="loader"></div> -->
|
||||
<!-- <div class="loader-section section-left"></div> -->
|
||||
<!-- <div class="loader-section section-right"></div> -->
|
||||
<!-- <div class="load_title">正在加载系统资源,请耐心等待</div> -->
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 登录方法
|
||||
export function login(username, password, code, uuid) {
|
||||
export function login(account, password) {
|
||||
const data = {
|
||||
username,
|
||||
account,
|
||||
password,
|
||||
code,
|
||||
uuid
|
||||
}
|
||||
return request({
|
||||
url: '/login',
|
||||
url: '/system/login',
|
||||
headers: {
|
||||
isToken: false,
|
||||
repeatSubmit: false
|
||||
@ -42,7 +40,7 @@ export function getInfo() {
|
||||
// 退出方法
|
||||
export function logout() {
|
||||
return request({
|
||||
url: '/logout',
|
||||
method: 'post'
|
||||
url: '/system/logout',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@ -2,16 +2,25 @@ import request from "@/utils/request";
|
||||
|
||||
export function getApplyList(data) {
|
||||
return request({
|
||||
url: "/auto-apply/list-activity-admin",
|
||||
method: "post",
|
||||
url: "/activity/list",
|
||||
method: "get",
|
||||
params: data,
|
||||
});
|
||||
}
|
||||
|
||||
export function setOrderSort(query) {
|
||||
return request({
|
||||
url: "/auto-apply/set-order",
|
||||
url: "/activity/updateSort",
|
||||
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) {
|
||||
return request({
|
||||
url: '/system/user/list',
|
||||
url: '/user/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -58,14 +58,14 @@ export function resetUserPwd(userId, password) {
|
||||
}
|
||||
|
||||
// 用户状态修改
|
||||
export function changeUserStatus(userId, status) {
|
||||
export function changeUserStatus(id, status) {
|
||||
const data = {
|
||||
userId,
|
||||
id,
|
||||
status
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/changeStatus',
|
||||
method: 'put',
|
||||
url: '/user/changeStatus',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@ -1,69 +1,72 @@
|
||||
import router from './router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import NProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { isHttp, isPathMatch } from '@/utils/validate'
|
||||
import { isRelogin } from '@/utils/request'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import usePermissionStore from '@/store/modules/permission'
|
||||
import router from "./router";
|
||||
import { ElMessage } from "element-plus";
|
||||
import NProgress from "nprogress";
|
||||
import "nprogress/nprogress.css";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { isHttp, isPathMatch } from "@/utils/validate";
|
||||
import { isRelogin } from "@/utils/request";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
import useSettingsStore from "@/store/modules/settings";
|
||||
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) => {
|
||||
return whiteList.some(pattern => isPathMatch(pattern, path))
|
||||
}
|
||||
return whiteList.some((pattern) => isPathMatch(pattern, path));
|
||||
};
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
NProgress.start();
|
||||
if (getToken()) {
|
||||
to.meta.title && useSettingsStore().setTitle(to.meta.title)
|
||||
to.meta.title && useSettingsStore().setTitle(to.meta.title);
|
||||
/* has token*/
|
||||
if (to.path === '/login') {
|
||||
next({ path: '/' })
|
||||
NProgress.done()
|
||||
if (to.path === "/login") {
|
||||
next({ path: "/" });
|
||||
NProgress.done();
|
||||
} else if (isWhiteList(to.path)) {
|
||||
next()
|
||||
next();
|
||||
} else {
|
||||
if (useUserStore().roles.length === 0) {
|
||||
isRelogin.show = true
|
||||
// 判断当前用户是否已拉取完user_info信息
|
||||
useUserStore().getInfo().then(() => {
|
||||
isRelogin.show = false
|
||||
usePermissionStore().generateRoutes().then(accessRoutes => {
|
||||
// isRelogin.show = true;
|
||||
// // 判断当前用户是否已拉取完user_info信息
|
||||
// isRelogin.show = false;
|
||||
usePermissionStore()
|
||||
.generateRoutes()
|
||||
.then((accessRoutes) => {
|
||||
// 根据roles权限生成可访问的路由表
|
||||
accessRoutes.forEach(route => {
|
||||
accessRoutes.forEach((route) => {
|
||||
if (!isHttp(route.path)) {
|
||||
router.addRoute(route) // 动态添加可访问路由表
|
||||
router.addRoute(route); // 动态添加可访问路由表
|
||||
}
|
||||
})
|
||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||
})
|
||||
}).catch(err => {
|
||||
useUserStore().logOut().then(() => {
|
||||
ElMessage.error(err)
|
||||
next({ path: '/' })
|
||||
})
|
||||
})
|
||||
});
|
||||
// next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
|
||||
next();
|
||||
});
|
||||
|
||||
// }).catch(err => {
|
||||
// useUserStore().logOut().then(() => {
|
||||
// ElMessage.error(err)
|
||||
// next({ path: '/' })
|
||||
// })
|
||||
// })
|
||||
} else {
|
||||
next()
|
||||
next();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 没有token
|
||||
if (isWhiteList(to.path)) {
|
||||
// 在免登录白名单,直接进入
|
||||
next()
|
||||
next();
|
||||
} else {
|
||||
next(`/login`) // 否则全部重定向到登录页
|
||||
NProgress.done()
|
||||
next({ path: "/login" }); // 否则全部重定向到登录页
|
||||
NProgress.done();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
NProgress.done()
|
||||
})
|
||||
NProgress.done();
|
||||
});
|
||||
|
||||
@ -7,7 +7,8 @@ import InnerLink from '@/layout/components/InnerLink'
|
||||
|
||||
// 匹配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(
|
||||
'permission',
|
||||
{
|
||||
@ -35,10 +36,9 @@ const usePermissionStore = defineStore(
|
||||
generateRoutes(roles) {
|
||||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||
const defaultData = JSON.parse(JSON.stringify(res.data))
|
||||
const sdata = JSON.parse(JSON.stringify(dwx))
|
||||
const rdata = JSON.parse(JSON.stringify(dwx))
|
||||
const defaultData = JSON.parse(JSON.stringify(dwx))
|
||||
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
||||
const defaultRoutes = filterAsyncRouter(defaultData)
|
||||
@ -49,7 +49,7 @@ const usePermissionStore = defineStore(
|
||||
this.setDefaultRoutes(sidebarRoutes)
|
||||
this.setTopbarRoutes(defaultRoutes)
|
||||
resolve(rewriteRoutes)
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,14 +17,13 @@ const useUserStore = defineStore(
|
||||
actions: {
|
||||
// 登录
|
||||
login(userInfo) {
|
||||
const username = userInfo.username.trim()
|
||||
const username = userInfo.account
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
setToken(res.token)
|
||||
this.token = res.token
|
||||
login(username, password).then(res => {
|
||||
console.log(res)
|
||||
setToken(res.data.token)
|
||||
this.token = res.data.token
|
||||
resolve()
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
@ -55,7 +54,7 @@ const useUserStore = defineStore(
|
||||
})
|
||||
})
|
||||
},
|
||||
// 退出系统
|
||||
// // 退出系统
|
||||
logOut() {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(this.token).then(() => {
|
||||
|
||||
@ -11,7 +11,7 @@ let downloadLoadingInstance;
|
||||
// 是否显示重新登录
|
||||
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实例
|
||||
const service = axios.create({
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
@ -27,8 +27,9 @@ service.interceptors.request.use(config => {
|
||||
// 是否需要防止数据重复提交
|
||||
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
|
||||
// get请求映射params参数
|
||||
if (config.method === 'get' && config.params) {
|
||||
let url = config.url + '?' + tansParams(config.params);
|
||||
|
||||
@ -224,5 +224,5 @@ export function getNormalPath(p) {
|
||||
|
||||
// 验证是否为blob格式
|
||||
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;">
|
||||
<h2 class="title">{{ title }}</h2>
|
||||
</div>
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="账号"
|
||||
>
|
||||
<el-form-item prop="account">
|
||||
<el-input v-model="loginForm.account" type="text" size="large" auto-complete="off" placeholder="账号">
|
||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<el-input v-model="loginForm.password" 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>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button
|
||||
:loading="loading"
|
||||
size="large"
|
||||
type="primary"
|
||||
style="width:100%;"
|
||||
@click.prevent="handleLogin"
|
||||
>
|
||||
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
@ -64,15 +46,13 @@ const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const loginForm = ref({
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
account: "",
|
||||
password: "",
|
||||
rememberMe: false
|
||||
});
|
||||
|
||||
const loginRules = {
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
account: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
};
|
||||
|
||||
@ -82,21 +62,22 @@ const register = ref(false);
|
||||
const redirect = ref(undefined);
|
||||
|
||||
watch(route, (newRoute) => {
|
||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||
}, { immediate: true });
|
||||
|
||||
function handleLogin() {
|
||||
proxy.$refs.loginRef.validate(valid => {
|
||||
console.log(valid);
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||
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("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
||||
} else {
|
||||
// 否则移除
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("account");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
@ -119,11 +100,11 @@ function handleLogin() {
|
||||
|
||||
|
||||
function getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const account = Cookies.get("account");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get("rememberMe");
|
||||
loginForm.value = {
|
||||
username: username === undefined ? loginForm.value.username : username,
|
||||
account: account === undefined ? loginForm.value.account : account,
|
||||
password: password === undefined ? loginForm.value.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
@ -141,6 +122,7 @@ getCookie();
|
||||
background-image: url("../assets/images/loginbg.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.title {
|
||||
// margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
@ -154,32 +136,39 @@ getCookie();
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
|
||||
.el-input {
|
||||
height: 40px;
|
||||
|
||||
input {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 40px;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
@ -192,6 +181,7 @@ getCookie();
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.login-code-img {
|
||||
height: 40px;
|
||||
padding-left: 12px;
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
|
||||
<script setup>
|
||||
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 router = useRouter();
|
||||
|
||||
@ -95,18 +95,25 @@
|
||||
<el-table v-loading="loading" :data="applyList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
<el-table-column label="活动ID" prop="activityId" />
|
||||
<el-table-column label="活动名称" prop="activityName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="状态" prop="status" :show-overflow-tooltip="true">
|
||||
<el-table-column label="活动名称" prop="activityName" :show-overflow-tooltip="true" width="320"/>
|
||||
<el-table-column label="状态" prop="actStatus" :show-overflow-tooltip="true">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === 3 ? 'success' : 'danger'">
|
||||
{{ scope.row.status === 3 ? '报名中' : '报名结束' }}
|
||||
<el-tag :type="scope.row.actStatus === 3 ? 'success' : 'danger'">
|
||||
{{ scope.row.actStatus === 3 ? '报名中' : '报名结束' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</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">
|
||||
<span style="width:60px">{{ scope.row.sortOrder }}</span>
|
||||
<el-button type="primary" link @click="handleEditSort(scope.row)" style="margin-left:20px;" :disabled="scope.row.status !== 3">编辑</el-button>
|
||||
<el-switch v-model="scope.row.enableAutoApply" @change="handleStatusChange(scope.row)"></el-switch>
|
||||
<!-- {{ 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>
|
||||
</el-table-column>
|
||||
|
||||
@ -133,7 +140,7 @@
|
||||
|
||||
<script setup name="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";
|
||||
|
||||
|
||||
@ -159,7 +166,17 @@ onMounted(() => {
|
||||
function getActivityListFn(params) {
|
||||
loading.value = true;
|
||||
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;
|
||||
loading.value = false;
|
||||
});
|
||||
@ -176,20 +193,39 @@ const newSortOrder = ref(0);
|
||||
|
||||
function handleEditSort(row) {
|
||||
currentSortItem.value = row;
|
||||
newSortOrder.value = row.sortOrder;
|
||||
newSortOrder.value = row.sort;
|
||||
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() {
|
||||
const params = {
|
||||
id: currentSortItem.value.id,
|
||||
order: newSortOrder.value
|
||||
activityId: currentSortItem.value.activityId,
|
||||
sort: newSortOrder.value
|
||||
}
|
||||
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) {
|
||||
applyList.value[index].sortOrder = newSortOrder.value;
|
||||
applyList.value[index].sort = newSortOrder.value;
|
||||
}
|
||||
sortDialogVisible.value = false;
|
||||
proxy.$modal.msgSuccess('修改成功');
|
||||
|
||||
@ -17,19 +17,23 @@
|
||||
<pane size="84">
|
||||
<el-col>
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="团长名称" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入团长名称" clearable style="width: 240px" @keyup.enter="handleQuery" />
|
||||
<el-form-item label="团长名称" prop="nickname">
|
||||
<el-input v-model="queryParams.nickname" placeholder="请输入团长名称" clearable style="width: 240px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<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 label="状态" prop="status">
|
||||
<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-form-item>
|
||||
<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-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
@ -39,38 +43,41 @@
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<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 :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 :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 :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 :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>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="filteredUserList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" 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" :show-overflow-tooltip="true" />
|
||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="100" align="center" />
|
||||
<el-table-column label="用户编号" align="center" key="id" prop="id" width="100" v-if="columns[0].visible" />
|
||||
<el-table-column label="团长" align="center" key="nickname" prop="nickname" v-if="columns[2].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="status" v-if="columns[5].visible">
|
||||
<el-table-column label="手机号码" align="center" key="phone" prop="phone" v-if="columns[4].visible"
|
||||
width="120" />
|
||||
<el-table-column label="状态" align="center" key="memberStatus" v-if="columns[5].visible">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
active-value="0"
|
||||
inactive-value="1"
|
||||
@change="handleStatusChange(scope.row)"
|
||||
></el-switch>
|
||||
<el-switch v-model="scope.row.memberStatus" :active-value="0" :inactive-value="1"
|
||||
@change="handleStatusChange(scope.row)"></el-switch>
|
||||
<!-- {{ scope.row.memberStatus }} -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
<template #default="scope">
|
||||
<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 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 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 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
@ -112,7 +124,9 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<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-col>
|
||||
</el-row>
|
||||
@ -144,14 +158,16 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户性别">
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
@ -160,14 +176,16 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item label="岗位">
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="角色">
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
@ -190,7 +208,9 @@
|
||||
|
||||
<!-- 用户导入对话框 -->
|
||||
<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>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<template #tip>
|
||||
@ -199,7 +219,8 @@
|
||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
||||
</div>
|
||||
<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>
|
||||
</template>
|
||||
</el-upload>
|
||||
@ -272,10 +293,11 @@ const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userName: undefined,
|
||||
phonenumber: undefined,
|
||||
colonelName: undefined,
|
||||
phone: undefined,
|
||||
status: undefined,
|
||||
deptId: undefined
|
||||
startDate: undefined,
|
||||
endDate: undefined
|
||||
},
|
||||
rules: {
|
||||
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);
|
||||
|
||||
//过滤部分ID
|
||||
const filteredUserList = computed(() => {
|
||||
return userList.value.filter(item => item.userId !== 1&&item.userId !== 150);
|
||||
});
|
||||
// const filteredUserList = computed(() => {
|
||||
// const list = userList.value.forEach(item => {
|
||||
// item._originStatus = item.memberStatus;
|
||||
// });
|
||||
// console.log('过滤', list)
|
||||
// return list
|
||||
// });
|
||||
|
||||
/** 通过条件过滤节点 */
|
||||
const filterNode = (value, data) => {
|
||||
@ -300,27 +326,36 @@ const filterNode = (value, data) => {
|
||||
};
|
||||
|
||||
/** 根据名称筛选部门树 */
|
||||
watch(deptName, val => {
|
||||
proxy.$refs["deptTreeRef"].filter(val);
|
||||
});
|
||||
// watch(deptName, val => {
|
||||
// proxy.$refs["deptTreeRef"].filter(val);
|
||||
// });
|
||||
|
||||
/** 查询用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
||||
loading.value = false;
|
||||
userList.value = res.rows;
|
||||
total.value = res.total;
|
||||
userList.value = res.data.records.map(item => {
|
||||
item._isInit = true;
|
||||
return item;
|
||||
});
|
||||
// 数据加载完成后,延迟将_isInit设为false
|
||||
setTimeout(() => {
|
||||
userList.value.forEach(item => {
|
||||
item._isInit = false;
|
||||
});
|
||||
}, 0);
|
||||
total.value = res.data.total;
|
||||
});
|
||||
};
|
||||
|
||||
/** 查询部门下拉树结构 */
|
||||
function getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
deptOptions.value = response.data;
|
||||
enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
||||
});
|
||||
};
|
||||
// /** 查询部门下拉树结构 */
|
||||
// function getDeptTree() {
|
||||
// deptTreeSelect().then(response => {
|
||||
// deptOptions.value = response.data;
|
||||
// enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
||||
// });
|
||||
// };
|
||||
|
||||
/** 过滤禁用的部门 */
|
||||
function filterDisabledDept(deptList) {
|
||||
@ -364,25 +399,27 @@ function handleDelete(row) {
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch(() => { });
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/user/export", {
|
||||
...queryParams.value,
|
||||
},`user_${new Date().getTime()}.xlsx`);
|
||||
}, `user_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
|
||||
/** 用户状态修改 */
|
||||
function handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
||||
return changeUserStatus(row.userId, row.status);
|
||||
if(row._isInit) return;
|
||||
console.log('用户状态修改', row.id, row.memberStatus)
|
||||
let text = row.memberStatus === 0 ? "启用" : "停用";
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + row.nickname + '"用户吗?').then(function () {
|
||||
return changeUserStatus(row.id, row.memberStatus);
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess(text + "成功");
|
||||
}).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) {
|
||||
proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||
proxy.$prompt('请输入"' + row.nickname + '"的新密码', "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
closeOnClickModal: false,
|
||||
@ -423,7 +460,7 @@ function handleResetPwd(row) {
|
||||
resetUserPwd(row.userId, value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||
});
|
||||
}).catch(() => {});
|
||||
}).catch(() => { });
|
||||
};
|
||||
|
||||
/** 选择条数 */
|
||||
@ -538,6 +575,6 @@ function submitForm() {
|
||||
});
|
||||
};
|
||||
|
||||
getDeptTree();
|
||||
// getDeptTree();
|
||||
getList();
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user