提交 afa6208a authored 作者: 龙菲's avatar 龙菲

修改用户赋予角色时父子节点不关联

上级 1ac6aa12
...@@ -2,29 +2,13 @@ ...@@ -2,29 +2,13 @@
<span> <span>
<span v-for="(op, index) in operations" :key="index"> <span v-for="(op, index) in operations" :key="index">
<span v-if="op.type == 'delete'"> <span v-if="op.type == 'delete'">
<el-popconfirm <el-popconfirm :title="deleteTitle ? deleteTitle : '确定删除吗?'" @onConfirm="clickOperation(op)">
:title="deleteTitle ? deleteTitle : '确定删除吗?'" <el-button type="danger" size="mini" slot="reference" :icon="icons[op.type]" style="margin-right: 4px">
@onConfirm="clickOperation(op)" {{ op.title }}</el-button>
>
<el-button
type="danger"
size="mini"
slot="reference"
:icon="icons[op.type]"
style="margin-right: 4px"
>
{{ op.title }}</el-button
>
</el-popconfirm> </el-popconfirm>
</span> </span>
<el-button <el-button size="mini" :icon="icons[op.type]" @click="clickOperation(op)" type="primary" style="margin-right: 4px"
size="mini" v-else>{{ op.title }}
:icon="icons[op.type]"
@click="clickOperation(op)"
type="primary"
style="margin-right: 4px"
v-else
>{{ op.title }}
</el-button> </el-button>
</span> </span>
</span> </span>
...@@ -53,6 +37,8 @@ export default { ...@@ -53,6 +37,8 @@ export default {
download: "el-icon-download", download: "el-icon-download",
dataPermission: "el-icon-key", dataPermission: "el-icon-key",
editRole: "el-icon-user", editRole: "el-icon-user",
editPassword: 'el-icon-lock',
approval: 'el-icon-s-check',
}, },
}; };
}, },
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1669797548250" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1955" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M791.04 522.24c0 20.48-2.048 39.936-6.144 58.88 8.704 3.072 16.896 6.656 24.576 11.264 5.12-22.528 8.704-46.08 8.704-70.656 0-131.584-83.456-243.2-199.68-286.208-0.512 9.216-2.048 17.92-5.12 26.624 103.424 40.96 177.664 141.824 177.664 260.096z m-551.424 59.392c-4.096-18.944-6.144-38.912-6.144-58.88 0-118.272 74.24-219.648 178.176-260.096-2.56-8.704-4.608-17.408-5.12-26.624-116.736 43.008-199.68 154.624-199.68 286.208 0 24.064 3.072 47.616 8.704 70.144 7.168-4.608 15.36-8.192 24.064-10.752z m272.384-285.184c36.864 0 66.56-29.696 66.56-66.56s-29.696-66.56-66.56-66.56-66.56 29.696-66.56 66.56 29.696 66.56 66.56 66.56z m0-105.984c22.016 0 39.936 17.92 39.936 39.936s-17.92 39.936-39.936 39.936-39.936-17.92-39.936-39.936 17.92-39.936 39.936-39.936z m159.232 560.64c-45.056 31.232-99.84 50.176-159.232 50.176-59.392 0-114.176-18.432-159.232-50.176-6.144 6.656-12.288 13.312-19.968 18.432 50.176 36.864 112.128 58.368 179.2 58.368s129.024-22.016 179.2-58.368c-7.68-5.12-13.824-11.776-19.968-18.432z m-398.336-135.68c-36.864 0-66.56 29.696-66.56 66.56s29.696 66.56 66.56 66.56 66.56-29.696 66.56-66.56-29.696-66.56-66.56-66.56z m0 106.496c-22.016 0-39.936-17.92-39.936-39.936s17.92-39.936 39.936-39.936 39.936 17.92 39.936 39.936-17.92 39.936-39.936 39.936z m478.208-106.496c-36.864 0-66.56 29.696-66.56 66.56s29.696 66.56 66.56 66.56 66.56-29.696 66.56-66.56-29.696-66.56-66.56-66.56z m0 106.496c-22.016 0-39.936-17.92-39.936-39.936s17.92-39.936 39.936-39.936 39.936 17.92 39.936 39.936-17.92 39.936-39.936 39.936z" p-id="1956"></path></svg>
\ No newline at end of file
<template> <template>
<div class="navbar"> <div class="navbar">
<hamburger <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb class="breadcrumb-container" /> <breadcrumb class="breadcrumb-container" />
<div class="right-menu"> <div class="right-menu">
<el-dropdown class="avatar-container" trigger="click"> <el-dropdown class="avatar-container" trigger="click">
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img v-if="avatar" :src="avatar" class="user-avatar" /> <img v-if="avatar" :src="avatar" class="user-avatar" />
...@@ -38,22 +35,13 @@ ...@@ -38,22 +35,13 @@
</el-dropdown> </el-dropdown>
</div> </div>
<el-drawer <div class="username-container">欢迎你,{{ userInfo.nickName || userInfo.username }}</div>
:title="isUserInfo ? '个人资料' : '修改密码'"
:visible.sync="showDrawer" <el-drawer :title="isUserInfo ? '个人资料' : '修改密码'" :visible.sync="showDrawer" direction="rtl"
direction="rtl" :before-close="handleClose" append-to-body v-loading="loading">
:before-close="handleClose"
append-to-body
v-loading="loading"
>
<!-- <span>{{ isUserInfo ? "个人资料" : "修改密码" }}</span> --> <!-- <span>{{ isUserInfo ? "个人资料" : "修改密码" }}</span> -->
<el-form <el-form ref="userInfoForm" v-if="isUserInfo" :label-width="labelWidth" :rules="userInfoRules"
ref="userInfoForm" :model="userInfoForm">
v-if="isUserInfo"
:label-width="labelWidth"
:rules="userInfoRules"
:model="userInfoForm"
>
<el-form-item label="用户名" prop="username"> <el-form-item label="用户名" prop="username">
<span v-if="!isEditingUserInfo">{{ userInfo.username }}</span> <span v-if="!isEditingUserInfo">{{ userInfo.username }}</span>
<el-input v-else v-model="userInfoForm.username"></el-input> <el-input v-else v-model="userInfoForm.username"></el-input>
...@@ -68,23 +56,12 @@ ...@@ -68,23 +56,12 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click.native="handleSubmitUserInfo" icon="el-icon-circle-check">{{ <el-button type="primary" @click.native="handleSubmitUserInfo" icon="el-icon-circle-check">{{
isEditingUserInfo ? "保存" : "修改个人信息" isEditingUserInfo ? "保存" : "修改个人信息"
}}</el-button> }}</el-button>
<el-button <el-button type="primary" @click.native="handleCancelChangeUserInfo" v-if="isEditingUserInfo">取消</el-button>
type="primary"
@click.native="handleCancelChangeUserInfo"
v-if="isEditingUserInfo"
>取消</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-form <el-form ref="pwdForm" :model="pwdForm" :label-width="labelWidth" :rules="pwdRules" v-else>
ref="pwdForm"
:model="pwdForm"
:label-width="labelWidth"
:rules="pwdRules"
v-else
>
<el-form-item label="旧密码" prop="oldPwd"> <el-form-item label="旧密码" prop="oldPwd">
<el-input v-model="pwdForm.oldPwd" type="password"></el-input> <el-input v-model="pwdForm.oldPwd" type="password"></el-input>
</el-form-item> </el-form-item>
...@@ -95,12 +72,8 @@ ...@@ -95,12 +72,8 @@
<el-input v-model="pwdForm.checkPass" type="password"></el-input> <el-input v-model="pwdForm.checkPass" type="password"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-circle-check" @click.native="handleSubmitPwd" <el-button type="primary" icon="el-icon-circle-check" @click.native="handleSubmitPwd">保存</el-button>
>保存</el-button <el-button type="primary" @click.native="handleCancelChangePwd">取消</el-button>
>
<el-button type="primary" @click.native="handleCancelChangePwd"
>取消</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-drawer> </el-drawer>
...@@ -313,6 +286,13 @@ export default { ...@@ -313,6 +286,13 @@ export default {
float: left; float: left;
} }
.username-container {
float: right;
line-height: 50px;
padding: 0 16px;
font-size: 14px;
}
.right-menu { .right-menu {
float: right; float: right;
height: 100%; height: 100%;
...@@ -365,6 +345,7 @@ export default { ...@@ -365,6 +345,7 @@ export default {
} }
} }
} }
::v-deep .el-drawer__body { ::v-deep .el-drawer__body {
padding: 10px 60px 0 20px; padding: 10px 60px 0 20px;
} }
......
...@@ -58,9 +58,16 @@ router.afterEach((to, from) => { ...@@ -58,9 +58,16 @@ router.afterEach((to, from) => {
function gotoRouter(to, next) { function gotoRouter(to, next) {
getMenu() // 获取动态路由的方法 getMenu() // 获取动态路由的方法
.then(res => { .then(res => {
const asyncRouter = addRouter(res.data.menus); // 进行递归解析
// const asyncRouter = addRouter(res.data.menus); // 进行递归解析
// return asyncRouter;
//TODO:前端暂时写死
const asyncRouter = addRouter(); // 进行递归解析
return asyncRouter;
// store.dispatch("user/setroles", res.data.permit); // store.dispatch("user/setroles", res.data.permit);
return asyncRouter;
}) })
.then(asyncRouter => { .then(asyncRouter => {
// 后置添加404页面,防止刷新404 // 后置添加404页面,防止刷新404
......
...@@ -36,7 +36,7 @@ import Layout from '@/layout' ...@@ -36,7 +36,7 @@ import Layout from '@/layout'
* 静态路由 * 静态路由
*/ */
export const constantRoutes = [{ export const constantRoutes = [{
path: '/login', path: '/login',
component: () => import('@/views/login/index'), component: () => import('@/views/login/index'),
hidden: true hidden: true
...@@ -65,12 +65,12 @@ import Layout from '@/layout' ...@@ -65,12 +65,12 @@ import Layout from '@/layout'
}] }]
}, },
// 404 page must be placed at the end !!! // 404 page must be placed at the end !!!
// { // {
// path: '*', // path: '*',
// redirect: '/404', // redirect: '/404',
// hidden: true // hidden: true
// } // }
] ]
...@@ -89,68 +89,98 @@ export const asyncRouterMap = [ ...@@ -89,68 +89,98 @@ export const asyncRouterMap = [
}, },
redirect: '/culturalRelic', redirect: '/culturalRelic',
children: [{ children: [{
path: 'culturalRelic', path: 'culturalRelic',
name: 'CulturalRelic', name: 'CulturalRelic',
component: () => import('@/views/culturalRelic/index'), component: () => import('@/views/culturalRelic/index'),
meta: { meta: {
title: '文物管理', title: '文物管理',
icon: 'culturalRelic' icon: 'culturalRelic'
},
},
{
path: 'display',
name: 'Display',
component: () => import('@/views/display/index'),
meta: {
title: '展览管理',
icon: 'display'
}
},
// {
// path: 'boutique',
// name: 'Boutique',
// component: () => import('@/views/boutique/index'),
// meta: {
// title: '精品展管理',
// icon: 'boutique'
// }
// },
{
path: 'museum',
name: 'Museum',
component: () => import('@/views/museum/index'),
meta: {
title: '博物馆管理',
icon: 'museum'
}
}, },
{ },
path: 'virtual', {
name: 'Virtual', path: 'display',
component: () => import('@/views/virtual/index'), name: 'Display',
meta: { component: () => import('@/views/display/index'),
title: '虚拟展厅', meta: {
icon: 'virtual' title: '展览管理',
} icon: 'display'
}, }
{ },
path: 'literature', // {
name: 'Literature', // path: 'boutique',
component: () => import('@/views/literature/index'), // name: 'Boutique',
meta: { // component: () => import('@/views/boutique/index'),
title: '文献管理', // meta: {
icon: 'literature' // title: '精品展管理',
} // icon: 'boutique'
// }
// },
{
path: 'museum',
name: 'Museum',
component: () => import('@/views/museum/index'),
meta: {
title: '博物馆管理',
icon: 'museum'
}
},
{
path: 'virtual',
name: 'Virtual',
component: () => import('@/views/virtual/index'),
meta: {
title: '虚拟展厅',
icon: 'virtual'
}
},
{
path: 'literature',
name: 'Literature',
component: () => import('@/views/literature/index'),
meta: {
title: '文献管理',
icon: 'literature'
}
},
{
path: 'product',
name: 'Product',
component: () => import('@/views/product/index'),
meta: {
title: '文创产品管理',
icon: 'product'
}
},
{
path: 'approval',
name: 'Approval',
component: () => import('@/views/approval/culturalRelic'),
redirect: '/crApproval',
meta: {
title: '审批管理',
icon: 'product'
}, },
{ children: [
path: 'product', {
name: 'Product', path: 'crApproval',
component: () => import('@/views/product/index'), name: 'CrApproval',
meta: { component: () => import('@/views/approval/culturalRelic.vue'),
title: '文创产品管理', meta: {
icon: 'product' title: '文物',
icon: 'culturalRelic'
}
},
{
path: 'displayApproval',
name: 'DisplayApproval',
component: () => import('@/views/approval/display.vue'),
meta: {
title: '展览',
icon: 'display'
}
} }
} ]
}
] ]
}, },
{ {
...@@ -164,32 +194,32 @@ export const asyncRouterMap = [ ...@@ -164,32 +194,32 @@ export const asyncRouterMap = [
}, },
redirect: '/user', redirect: '/user',
children: [{ children: [{
path: 'user', path: 'user',
name: 'User', name: 'User',
component: () => import('@/views/user/index'), component: () => import('@/views/user/index'),
meta: { meta: {
title: '用户管理', title: '用户管理',
icon: 'user2' icon: 'user2'
} }
}, },
{ {
path: 'role', path: 'role',
name: 'Role', name: 'Role',
component: () => import('@/views/role/index'), component: () => import('@/views/role/index'),
meta: { meta: {
title: '角色管理', title: '角色管理',
icon: 'role' icon: 'role'
} }
}, },
{ {
path: 'log', path: 'log',
name: 'Log', name: 'Log',
component: () => import('@/views/log/index'), component: () => import('@/views/log/index'),
meta: { meta: {
title: '日志管理', title: '日志管理',
icon: 'log' icon: 'log'
} }
}, },
] ]
}, },
] ]
......
import Layout from '@/layout'
/** /**
* 生成路由 * 生成路由
* @param {Array} routerlist 格式化路由 * @param {Array} routerlist 格式化路由
* @returns * @returns
*/ */
export function addRouter(routerlist) { // export function addRouter(routerlist) {
const router = [] // const router = []
try { // try {
routerlist.forEach(e => { // routerlist.forEach(e => {
if (e.path && e.menuName && e.component) { // if (e.path && e.menuName && e.component) {
let e_new = { // let e_new = {
path: e.path, // path: e.path,
name: e.menuName, // name: e.menuName,
component: resolve => e.component === 'Layout' ? require([`@/layout`], resolve) : require([`@/views/${e.component}/index`], resolve) // component: resolve => e.component === Layout ? require([`@/layout`], resolve) : require([`@/views/${e.component}/index`], resolve)
} // }
if (e.children) { // if (e.children) {
const children = addRouter(e.children) // const children = addRouter(e.children)
// 保存权限 // // 保存权限
e_new = { ...e_new, children: children } // e_new = { ...e_new, children: children }
} // }
if (e.redirect) { // if (e.redirect) {
e_new = { ...e_new, redirect: e.redirect } // e_new = { ...e_new, redirect: e.redirect }
} // }
// if (e.generatemenu === 0) { // // if (e.generatemenu === 0) {
// e_new = { ...e_new, hidden: true } // // e_new = { ...e_new, hidden: true }
// } // // }
if (e.icon !== '' && e.menuLabel !== '') { // if (e.icon !== '' && e.menuLabel !== '') {
e_new = { ...e_new, meta: { title: e.menuLabel, icon: e.icon } } // e_new = { ...e_new, meta: { title: e.menuLabel, icon: e.icon } }
} else if (e.menuLabel !== '' && e.icon === '') { // } else if (e.menuLabel !== '' && e.icon === '') {
e_new = { ...e_new, meta: { title: e.menuLabel } } // e_new = { ...e_new, meta: { title: e.menuLabel } }
} // }
router.push(e_new) // router.push(e_new)
// }
// })
// } catch (error) {
// console.error(error)
// return []
// }
// return router
// }
/**
* 前端测试使用,暂时写死
*/
export function addRouter() {
const asyncRouterMap = [
{
path: '/business',
component: Layout,
name: 'Business',
hidden: false,
meta: {
title: '业务管理',
icon: 'yewu'
},
redirect: '/culturalRelic',
children: [{
path: 'culturalRelic',
name: 'CulturalRelic',
component: () => import('@/views/culturalRelic/index'),
meta: {
title: '文物管理',
icon: 'culturalRelic'
},
},
{
path: 'display',
name: 'Display',
component: () => import('@/views/display/index'),
meta: {
title: '展览管理',
icon: 'display'
}
},
// {
// path: 'boutique',
// name: 'Boutique',
// component: () => import('@/views/boutique/index'),
// meta: {
// title: '精品展管理',
// icon: 'boutique'
// }
// },
{
path: 'museum',
name: 'Museum',
component: () => import('@/views/museum/index'),
meta: {
title: '博物馆管理',
icon: 'museum'
}
},
{
path: 'virtual',
name: 'Virtual',
component: () => import('@/views/virtual/index'),
meta: {
title: '虚拟展厅',
icon: 'virtual'
}
},
{
path: 'literature',
name: 'Literature',
component: () => import('@/views/literature/index'),
meta: {
title: '文献管理',
icon: 'literature'
}
},
{
path: 'product',
name: 'Product',
component: () => import('@/views/product/index'),
meta: {
title: '文创产品管理',
icon: 'product'
}
},
{
path: 'approval',
name: 'Approval',
component: () => import('@/views/approval/index'),
redirect: '/crApproval',
meta: {
title: '审批管理',
icon: 'approval'
},
children: [
{
path: 'crApproval',
name: 'CrApproval',
component: () => import('@/views/approval/culturalRelic.vue'),
meta: {
title: '文物',
icon: 'culturalRelic'
}
},
{
path: 'displayApproval',
name: 'DisplayApproval',
component: () => import('@/views/approval/display.vue'),
meta: {
title: '展览',
icon: 'display'
}
}
]
} }
]
},
{
path: '/system',
component: Layout,
name: 'System',
hidden: false,
meta: {
title: '系统管理',
icon: 'xitong'
},
redirect: '/user',
children: [{
path: 'user',
name: 'User',
component: () => import('@/views/user/index'),
meta: {
title: '用户管理',
icon: 'user2'
}
},
{
path: 'role',
name: 'Role',
component: () => import('@/views/role/index'),
meta: {
title: '角色管理',
icon: 'role'
}
},
{
path: 'log',
name: 'Log',
component: () => import('@/views/log/index'),
meta: {
title: '日志管理',
icon: 'log'
}
},
]
},
]
}) return asyncRouterMap
} catch (error) {
console.error(error)
return []
}
return router
} }
\ No newline at end of file
export const title = [{
prop: "title",
label: "标题",
columnAlign: 'center',
width: 120,
showOverFlowToolTip: true,
},
{
prop: "keyword",
label: "关键词",
columnAlign: 'center',
showOverFlowToolTip: true,
},
{
prop: "type",
label: "展览类型",
columnAlign: 'center',
isDisplayType: true,
showOverFlowToolTip: true,
},
{
prop: "faceImageUrl",
label: "封面",
columnAlign: 'center',
isFaceImage: true,
width: 130
},
{
prop: "remark",
label: "备注",
columnAlign: 'center', showOverFlowToolTip: true,
},
{
prop: "status",
label: "状态",
columnAlign: 'center',
isStatus: true
},
]
export const operates = {
operate: true,
label: "操作",
width: "260px",
minwidth: "220px",
titleAlign: "center",
columnAlign: "center",
}
export const operations = [{
type: 'approval',
title: '审批'
}
]
差异被折叠。
差异被折叠。
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</el-form-item> </el-form-item>
<el-form-item label="菜单权限" :label-width="formLabelWidth"> <el-form-item label="菜单权限" :label-width="formLabelWidth">
<el-tree <el-tree
ref="tree" ref="menuPermisionTree"
:data="dialogForm.permissionRespNodes" :data="dialogForm.permissionRespNodes"
show-checkbox show-checkbox
:props="props" :props="props"
...@@ -189,10 +189,9 @@ export default { ...@@ -189,10 +189,9 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs.dialogForm.validate(async (valid) => { this.$refs.dialogForm.validate(async (valid) => {
if (valid) { if (valid) {
debugger
const { name, remark } = this.dialogForm; const { name, remark } = this.dialogForm;
let status = this.status ? 1 : 0; let status = this.status ? 1 : 0;
let permissions = this.$refs.tree.getCheckedKeys(); let permissions = this.$refs.menuPermisionTree.getCheckedKeys();
const params = { const params = {
name, name,
...@@ -230,7 +229,7 @@ export default { ...@@ -230,7 +229,7 @@ export default {
this.$refs.dialogForm.resetFields(); this.$refs.dialogForm.resetFields();
this.$emit("refresh"); this.$emit("refresh");
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.tree.setCheckedKeys([]); this.$refs.menuPermisionTree.setCheckedKeys([]);
}); });
this.allRole = []; this.allRole = [];
}, },
...@@ -261,7 +260,7 @@ export default { ...@@ -261,7 +260,7 @@ export default {
} }
setTimeout(() => { setTimeout(() => {
if (checkedIds.length > 0) { if (checkedIds.length > 0) {
this.$refs.tree.setCheckedKeys(checkedIds); this.$refs.menuPermisionTree.setCheckedKeys(checkedIds);
} }
}, 100); }, 100);
}, },
......
<template>
<el-dialog :visible="dialogVisible" width="30%" :before-close="handleClose" lock-scroll>
<el-form ref="pwdForm" :model="pwdForm" :label-width="labelWidth" :rules="pwdRules" class="form" size="small"
v-loading="loading">
<!-- <el-form-item label="旧密码" prop="oldPwd">
<el-input v-model="pwdForm.oldPwd" type="password"></el-input>
</el-form-item> -->
<el-form-item label="新密码" prop="password">
<el-input v-model="pwdForm.password" clearable type="text">
<el-button @click.native="handleClickReset" slot="append" icon="el-icon-refresh-left">重置为初始密码</el-button>
</el-input>
</el-form-item>
<!-- <el-form-item label="确认密码" prop="checkPass" >
<el-input v-model="pwdForm.checkPass" type="password" show-password></el-input>
</el-form-item> -->
<!-- <el-form-item>
<el-button type="primary" icon="el-icon-circle-check" @click.native="handleSubmitPwd">保存</el-button>
<el-button type="primary" @click.native="handleCancelChangePwd">取消</el-button>
</el-form-item> -->
</el-form>
<div class="buttons">
<el-button type="primary" icon="el-icon-circle-check" @click.native="handleSubmitPwd" size="small">保存
</el-button>
<el-button @click.native="handleCancelChangePwd" size="mini">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { upadateUser } from "@/api/user";
export default {
name: 'EditPassword',
props: {
visible: {
type: Boolean,
default: false,
},
id: {
type: String,
default: null,
},
},
watch: {
visible: {
handler: function (value) {
this.dialogVisible = value;
},
deep: true,
immediate: true,
},
},
data() {
var validatePass = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入新密码"));
} else {
var pattern =
/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\\W_!@#$%^&*`~()-+=]+$)(?![0-9\\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\\W_!@#$%^&*`~()-+=]{8,30}$/;
if (!pattern.test(value)) {
callback(
new Error(
"密码长度至少8位,至少含数字,大写字母,小写字母,特殊符其中三种"
)
);
}
// if (this.pwdForm.checkPass !== "") {
// this.$refs.pwdForm.validateField("checkPass");
// }
callback();
}
};
var validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.pwdForm.newPwd) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
dialogVisible: false,
labelWidth: "100px",
pwdForm: {
// oldPwd: "",
password: "",
// checkPass: "",
},
pwdRules: {
// oldPwd: [
// { trigger: "blur", required: true, message: "请输入当前密码" },
// ],
password: [{ validator: validatePass, trigger: "blur", required: true }],
// checkPass: [
// { validator: validatePass2, trigger: "blur", required: true },
// ],
},
loading: false
}
},
methods: {
handleSubmitPwd() {
this.$refs.pwdForm.validate(async (valid) => {
if (valid) {
this.loading = true
// const { newPwd, oldPwd } = this.pwdForm;
const params = {
// newPwd,
// oldPwd,
password: this.pwdForm.password,
id: this.id
};
// console.log(params);
// return
let res = await upadateUser(params);
if (res.code == "0") {
this.$message.success("修改成功!");
this.$emit("handleClose");
this.$refs.pwdForm.resetFields()
}
this.loading = false
}
this.loading = false
});
},
handleClickReset() {
this.pwdForm.password = 'qwe@1234'
},
handleCancelChangePwd() {
this.handleClose()
},
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
// done();
this.$emit("handleClose");
this.$refs.pwdForm.resetFields()
})
.catch((_) => { });
},
}
}
</script>
<style lang="scss" scoped>
.title {
display: flex;
margin-bottom: 16px;
.divider {
width: 8px;
border-left: 4px solid #409eff;
margin-right: 8px;
}
.label {
font-weight: bold;
}
}
.dialog-content {
padding: 0 32px;
// display: flex;
.basic-info {
flex: 1;
margin-right: 48px;
}
}
.dialog-footer {
margin-top: 20px;
display: flex;
justify-content: flex-end;
}
.form {
padding-right: 60px;
}
.buttons {
padding: 40px 60px 0;
display: flex;
justify-content: flex-end;
}
</style>
\ No newline at end of file
...@@ -15,12 +15,14 @@ ...@@ -15,12 +15,14 @@
<el-tree <el-tree
:data="allRole" :data="allRole"
show-checkbox show-checkbox
default-expand-all
node-key="id" node-key="id"
ref="myTree" ref="myTree"
highlight-current highlight-current
:props="{ label: 'name' }" :props="{ label: 'name' }"
:default-checked-keys="ownRoles" :default-checked-keys="ownRoles"
@check="roleParentTreeCheck"
check-strictly
default-expand-all
> >
</el-tree> </el-tree>
</div> </div>
...@@ -122,7 +124,8 @@ export default { ...@@ -122,7 +124,8 @@ export default {
}, },
async handleSubmit() { async handleSubmit() {
let ids = this.$refs.myTree.getCheckedKeys(true); // debugger
let ids = this.$refs.myTree.getCheckedKeys();
let params = ids; let params = ids;
let res = await updateUserOwnRoles(this.userId, params); let res = await updateUserOwnRoles(this.userId, params);
...@@ -139,6 +142,7 @@ export default { ...@@ -139,6 +142,7 @@ export default {
this.$emit("refresh"); this.$emit("refresh");
this.$emit("handleClose"); this.$emit("handleClose");
}, },
handleClose(done) { handleClose(done) {
this.$confirm("确认关闭?") this.$confirm("确认关闭?")
.then((_) => { .then((_) => {
...@@ -149,6 +153,12 @@ export default { ...@@ -149,6 +153,12 @@ export default {
}) })
.catch((_) => {}); .catch((_) => {});
}, },
roleParentTreeCheck(node, list) {
if (list.checkedKeys.length > 1) {
//单选实现
this.$refs.myTree.setCheckedKeys([node.id]);
}
},
}, },
}; };
</script> </script>
...@@ -168,7 +178,7 @@ export default { ...@@ -168,7 +178,7 @@ export default {
} }
.dialog-content { .dialog-content {
padding: 0 32px; padding: 0 32px;
display: flex; // display: flex;
.basic-info { .basic-info {
flex: 1; flex: 1;
margin-right: 48px; margin-right: 48px;
......
...@@ -347,10 +347,11 @@ export default { ...@@ -347,10 +347,11 @@ export default {
} }
.dialog-content { .dialog-content {
padding: 0 32px; padding: 0 32px;
display: flex; // display: flex;
.basic-info { .basic-info {
flex: 1; flex: 1;
margin-right: 48px; margin-right: 48px;
} }
} }
......
...@@ -44,20 +44,25 @@ export const title = [{ ...@@ -44,20 +44,25 @@ export const title = [{
export const operates = { export const operates = {
operate: true, operate: true,
label: "操作", label: "操作",
width: "300px", width: "400px",
titleAlign: "center", titleAlign: "center",
columnAlign: "center", columnAlign: "center",
} }
export const operations = [ export const operations = [
{ {
type: 'editRole', type:'editPassword',
title: '赋予角色' title: '修改密码'
}, },
{ {
type: 'edit', type: 'edit',
title: '编辑' title: '编辑'
}, },
{
type: 'editRole',
title: '赋予角色'
},
{ {
type: 'delete', type: 'delete',
title: '删除' title: '删除'
......
<template> <template>
<div class="users app-container"> <div class="users app-container">
<el-row :gutter="16"> <el-row :gutter="16">
<el-col :span="4"> <el-col :span="4" class="left-tree">
<el-tree <el-scrollbar style="height:100%;">
:data="treeData" <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" default-expand-all
:props="defaultProps" :expand-on-click-node="false"></el-tree>
@node-click="handleNodeClick" </el-scrollbar>
default-expand-all
:expand-on-click-node="false"
></el-tree>
</el-col> </el-col>
<el-col :span="20"> <el-col :span="20">
<div class="top-bar"> <div class="top-bar">
<SearchBar :config="searchConfig" @search="search" @reset="reset" /> <SearchBar :config="searchConfig" @search="search" @reset="reset" />
<el-button <el-button type="primary" @click.native="handleOperation({ type: 'add' })" icon="el-icon-plus">
type="primary" 新增</el-button>
@click.native="handleOperation({ type: 'add' })"
icon="el-icon-plus"
>
新增</el-button
>
</div> </div>
<TablePage <TablePage :data="list.records" :tableTitle="tableTitle" :operates="tableOperates">
:data="list.records"
:tableTitle="tableTitle"
:operates="tableOperates"
>
<template v-slot:status="data"> <template v-slot:status="data">
<el-popconfirm <el-popconfirm :title="getStatusTitle(data.scope.status)" @onConfirm="handleChangeStatus(data.scope)">
:title="getStatusTitle(data.scope.status)" <el-switch slot="reference" :value="Boolean(Number(data.scope.status))"></el-switch>
@onConfirm="handleChangeStatus(data.scope)"
>
<el-switch
slot="reference"
:value="Boolean(Number(data.scope.status))"
></el-switch>
</el-popconfirm> </el-popconfirm>
</template> </template>
<template v-slot:operates="scope"> <template v-slot:operates="scope">
<TableOperation <TableOperation :operations="tableOperations" :rawData="scope.scope.row" @handleOperation="handleOperation">
:operations="tableOperations"
:rawData="scope.scope.row"
@handleOperation="handleOperation"
>
</TableOperation> </TableOperation>
</template> </template>
</TablePage> </TablePage>
<el-pagination <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
@size-change="handleSizeChange" :current-page="Number(list.current)" :page-sizes="[10, 20, 40, 50]" :page-size="Number(list.size)"
@current-change="handleCurrentChange" layout="total, sizes, prev, pager, next, jumper" :total="Number(list.total)" class="pagination">
:current-page="Number(list.current)"
:page-sizes="[10, 20, 40, 50]"
:page-size="Number(list.size)"
layout="total, sizes, prev, pager, next, jumper"
:total="Number(list.total)"
class="pagination"
>
</el-pagination> </el-pagination>
</el-col> </el-col>
</el-row> </el-row>
<InfoEditDialog <InfoEditDialog :visible="dialogVisible" :form="form" :orgTreeData="treeData" @handleClose="handleClose"
:visible="dialogVisible" @refresh="loadListData" />
:form="form" <EditRole :visible="editRoleVisible" :roleData="currentRoleData" :id="currentId"
:orgTreeData="treeData" @handleClose="handleCloseEditRole" />
@handleClose="handleClose" <EditPassword :visible="editPasswordVisible" :id="currentId" @handleClose="handleCloseEditPassword" />
@refresh="loadListData"
/>
<EditRole
:visible="editRoleVisible"
:roleData="currentRoleData"
:id="currentId"
@handleClose="handleCloseEditRole"
/>
</div> </div>
</template> </template>
...@@ -90,6 +55,7 @@ import { ...@@ -90,6 +55,7 @@ import {
} from "@/api/user"; } from "@/api/user";
import InfoEditDialog from "./components/InfoEditDialog.vue"; import InfoEditDialog from "./components/InfoEditDialog.vue";
import EditRole from "./components/EditRole.vue"; import EditRole from "./components/EditRole.vue";
import EditPassword from "./components/EditPassword.vue";
export default { export default {
components: { components: {
...@@ -98,6 +64,7 @@ export default { ...@@ -98,6 +64,7 @@ export default {
SearchBar, SearchBar,
InfoEditDialog, InfoEditDialog,
EditRole, EditRole,
EditPassword
}, },
computed: { computed: {
tableTitle() { tableTitle() {
...@@ -157,6 +124,7 @@ export default { ...@@ -157,6 +124,7 @@ export default {
}, },
dialogVisible: false, dialogVisible: false,
editRoleVisible: false, editRoleVisible: false,
editPasswordVisible: false,
currentRoleData: {}, currentRoleData: {},
currentId: null, currentId: null,
}; };
...@@ -172,7 +140,7 @@ export default { ...@@ -172,7 +140,7 @@ export default {
if (res.code == 0) { if (res.code == 0) {
this.treeData = res.data[0].children; //去除默认顶级部门 this.treeData = res.data[0].children; //去除默认顶级部门
this.currentDeptNo = this.treeData[0].deptNo; this.currentDeptNo = this.treeData[0].deptNo;
this.loadListData(); this.loadListData();
} }
}, },
// 加载表格数据 // 加载表格数据
...@@ -244,6 +212,11 @@ export default { ...@@ -244,6 +212,11 @@ export default {
this.currentRoleData = roleRes.data; this.currentRoleData = roleRes.data;
this.currentId = row.id; this.currentId = row.id;
break; break;
case 'editPassword':
console.log('editPassword');
this.editPasswordVisible = true;
this.currentId = row.id;
break;
} }
}, },
...@@ -255,9 +228,14 @@ export default { ...@@ -255,9 +228,14 @@ export default {
}, },
handleCloseEditRole() { handleCloseEditRole() {
this.editRoleVisible = false; this.editRoleVisible = false;
this.currentRoleData ={}; this.currentRoleData = {};
this.currentId = null; this.currentId = null;
}, },
handleCloseEditPassword(){
this.editPasswordVisible = false;
this.currentId = null;
}
}, },
}; };
</script> </script>
...@@ -277,4 +255,12 @@ export default { ...@@ -277,4 +255,12 @@ export default {
.el-button { .el-button {
margin-bottom: 22px; margin-bottom: 22px;
} }
.left-tree {
height: calc(100vh - 130px);
}
::v-deep .el-scrollbar .el-scrollbar__wrap {
overflow-x: hidden;
}
</style> </style>
\ No newline at end of file
...@@ -42,17 +42,17 @@ module.exports = { ...@@ -42,17 +42,17 @@ module.exports = {
'/api': { '/api': {
// target: 'http://172.24.100.109:8080/', // target: 'http://172.24.100.109:8080/',
// target:'http://222.85.214.245:9603/api', // target:'http://222.85.214.245:9603/api',
// target:'http://192.168.1.230:9603/api', target:'http://192.168.1.230:9603/api',
target: 'http://114.115.157.218:9602/api',//生产 // target: 'http://114.115.157.218:9602/api',//生产
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/api': '' '^/api': ''
} }
}, },
'/files': { '/files': {
// target: 'http://192.168.1.230:9563/files', target: 'http://192.168.1.230:9604/files',
// target: 'http://222.85.214.245:9604/files', // target: 'http://222.85.214.245:9604/files',
target: 'http://114.115.157.218:9602/files',//生产 // target: 'http://114.115.157.218:9602/files',//生产
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
'^/files': '' '^/files': ''
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论