28 Commits
uesr ... role

Author SHA1 Message Date
lilinyuan
d2521765be Merge branch 'role' of http://git.feashow.cn/clay/mosr-web into role 2024-05-09 15:29:05 +08:00
lilinyuan
5c1b66b03d feat: 新增sidermenu首页项 2024-05-09 15:29:00 +08:00
clay
29ea0d5fe4 feat : 测试sso单点登录之后的重定向路径 2024-04-29 10:03:46 +08:00
lilinyuan
8c1d2eeabe feat: 新增登录重定向之前被拦截的页面 2024-04-29 09:58:18 +08:00
lilinyuan
24dfaac98a fix: 按钮逻辑 2024-04-01 15:30:56 +08:00
lilinyuan
b5acea2e47 fix: 调整菜单权限按钮 2024-04-01 15:02:09 +08:00
lilinyuan
39bc3011dd fix: 去掉操作列悬浮 2024-04-01 14:36:02 +08:00
lilinyuan
6e42dd43f7 fix: 组件调整 2024-04-01 14:28:08 +08:00
lilinyuan
1b10b9aa2b fix: 角色管理调整 2024-04-01 14:27:52 +08:00
lilinyuan
8964cbe4bd fix: 注释install 2024-04-01 13:58:03 +08:00
lilinyuan
de971d224e fix: 修改依赖源地址 2024-04-01 13:48:34 +08:00
lilinyuan
5977480404 fix: 修改依赖源 2024-04-01 13:41:23 +08:00
lilinyuan
9123149565 feat: up dependencies 2024-04-01 11:23:51 +08:00
lilinyuan
f1e1def32c feat: up dependencies 2024-04-01 11:20:55 +08:00
lilinyuan
e787128011 feat: up 2024-04-01 11:00:10 +08:00
lilinyuan
90f6bd344e fix: 再试一次 2024-04-01 10:20:32 +08:00
lilinyuan
ffc5600b9b fix: 使用原始ui库 2024-04-01 10:13:53 +08:00
lilinyuan
fbae33730d fix: 添加调试log 2024-04-01 09:52:01 +08:00
lilinyuan
64c735eb74 fix: 菜单分配父子联动 2024-03-31 00:36:08 +08:00
lilinyuan
ed0a5e1a7d fix: 同步退出登录后再登录不同权限账号时菜单不更新问题 2024-03-31 00:23:31 +08:00
lilinyuan
7e0a065944 fix: 修复角色分配菜单父子关联不生效的问题 2024-03-31 00:12:35 +08:00
lilinyuan
2282f1c834 fix: 生产环境禁用debugger 2024-03-29 17:14:04 +08:00
lilinyuan
e418b588f6 fix: 修改request提示 2024-03-29 15:41:21 +08:00
lilinyuan
a5a2e099a2 fix: 修改请求报错提示 2024-03-29 15:34:34 +08:00
lilinyuan
19822a539c fix: 修改tablecol显示bug 2024-03-29 15:34:17 +08:00
lilinyuan
0fc918b576 fix: 修复role新增编辑bug 2024-03-29 14:31:45 +08:00
lilinyuan
4c17bf7f6a fix: 修改默认用户名为super 2024-03-29 14:15:23 +08:00
lilinyuan
878940c34b fix: 固定role列表操作列 2024-03-29 14:15:04 +08:00
18 changed files with 207 additions and 63 deletions

View File

@@ -5,6 +5,8 @@ platform:
os: linux
arch: arm64
steps:
- name: build-package
image: node:16.20.0
volumes:
@@ -23,17 +25,16 @@ steps:
- npm -v
- mkdir -p ./node_modules
- export NODE_MODULES_PATH=`pwd`/node_modules
#- npm config set registry https://registry.npm.taobao.org
# - npm config set registry https://registry.npmmirror.com
#- set NODE_OPTIONS=--openssl-legacy-provider
# - npm install
# - npm install
- npm run build
- ls /app/build/$DRONE_REPO_NAME/
- echo $NODE_MODULES_PATH
- cp -r dist /app/build/$DRONE_REPO_NAME
- name: build-docker # 制作docker镜像
- name: build-docker-prod # 制作docker镜像
image: docker # 使用官方docker镜像
volumes: # 将容器内目录挂载到宿主机
- name: docker
@@ -55,6 +56,9 @@ steps:
- sed -i 's/$REGISTRY_NAMESPACE/'"$REGISTRY_NAMESPACE"'/' deployment.yml
- sed -i 's/$DRONE_REPO_NAME/'"$DRONE_REPO_NAME"'/' deployment.yml
- sed -i 's/$DRONE_COMMIT/'"$DRONE_COMMIT"'/' deployment.yml
- sed -i 's/$PORTS_NAME/'"dasdafas"'/' deployment.yml
- sed -i 's/$PORTS_PORT/'"8081"'/' deployment.yml
- sed -i 's/$PROFILES/'"mosr"'/' nginx.conf
# docker登录,不能在脚本中登录,并且不能使用docker login -u -p
- echo $DOCKER_PASSWORD | docker login $REGISTRY --username $DOCKER_USERNAME --password-stdin
- chmod +x docker.sh
@@ -62,9 +66,47 @@ steps:
- sh docker.sh
# 执行完脚本删除本次制作的docker镜像,避免多次后当前runner空间不足
- docker rmi -f $(docker images | grep $DRONE_REPO_NAME | awk '{print $3}')
when:
branch:
- prod
- name: build-docker-dm # 制作docker镜像
image: docker # 使用官方docker镜像
volumes: # 将容器内目录挂载到宿主机
- name: docker
path: /var/run/docker.sock # 挂载宿主机的docker
- name: config
path: /config
environment: # 获取到密文的docker用户名和密码
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
REGISTRY:
from_secret: registry
REGISTRY_NAMESPACE:
from_secret: registry_namespace
commands: # 定义在Docker容器中执行的shell命令
- cat Dockerfile
- sed -i 's/$REGISTRY/'"$REGISTRY"'/' deployment.yml
- sed -i 's/$REGISTRY_NAMESPACE/'"$REGISTRY_NAMESPACE"'/' deployment.yml
- sed -i 's/$DRONE_REPO_NAME/'"$DRONE_REPO_NAME"'/' deployment.yml
- sed -i 's/$DRONE_COMMIT/'"$DRONE_COMMIT"'/' deployment.yml
- sed -i 's/$PORTS_NAME/'"dasdafas"'/' deployment.yml
- sed -i 's/$PORTS_PORT/'"8082"'/' deployment.yml
- sed -i 's/$PROFILES/'"mosr-dm"'/' nginx.conf
# docker登录,不能在脚本中登录,并且不能使用docker login -u -p
- echo $DOCKER_PASSWORD | docker login $REGISTRY --username $DOCKER_USERNAME --password-stdin
- chmod +x docker.sh
- cat docker.sh
- sh docker.sh
# 执行完脚本删除本次制作的docker镜像,避免多次后当前runner空间不足
- docker rmi -f $(docker images | grep $DRONE_REPO_NAME | awk '{print $3}')
when:
branch:
- dm
- name: drone-rancher # rancher运行
- name: drone-rancher-prod # rancher运行
image: bitnami/kubectl:1.26.13-debian-11-r1
volumes: # 将容器内目录挂载到宿主机
- name: config
@@ -72,6 +114,24 @@ steps:
commands: # 定义在Docker容器中执行的shell命令
# 将deployment中定义的变量替换为drone中的内置变量
- kubectl apply -f deployment.yml -n mosr --kubeconfig=/app/config/base-taishan-kubectl.yml
when:
branch:
- prod
- name: drone-rancher-dm # rancher运行
image: bitnami/kubectl:1.26.13-debian-11-r1
volumes: # 将容器内目录挂载到宿主机
- name: config
path: /app/config # 将kubectl 配置文件挂载出来
commands: # 定义在Docker容器中执行的shell命令
# 将deployment中定义的变量替换为drone中的内置变量
- kubectl apply -f deployment.yml -n mosr-dm --kubeconfig=/app/config/base-taishan-kubectl.yml
when:
branch:
- dm
volumes:
- name: cache
@@ -84,8 +144,10 @@ volumes:
host:
path: /var/run/docker.sock
load:
trigger:
branch:
- prod
- dm
event:
- push

2
package-lock.json generated
View File

@@ -13,7 +13,7 @@
"axios": "^1.4.0",
"d3": "^7.8.5",
"echarts": "^5.4.2",
"element-plus": "^2.3.5",
"element-plus": "^2.6.0",
"highlight.js": "9.18.5",
"jquery": "^3.6.0",
"js-cookie": "^3.0.5",

View File

@@ -13,7 +13,7 @@
"axios": "^1.4.0",
"d3": "^7.8.5",
"echarts": "^5.4.2",
"element-plus": "^2.3.5",
"element-plus": "^2.6.0",
"highlight.js": "9.18.5",
"jquery": "^3.6.0",
"js-cookie": "^3.0.5",

View File

@@ -14,6 +14,14 @@ export const getRoleOption = () => {
method: "get"
});
};
export const getTemRoleOption = () => {
return request({
url: '/admin/role/option/template',
method: "get"
});
};
//查询角色信息
export const getRoleDetail = (roleId) => {
return request({

View File

@@ -15,7 +15,7 @@ const props = defineProps({
default: []
},
modelValue: {
type: [Number, String],
type: [Number, String, Boolean],
default: ''
},
cacheKey: {

View File

@@ -65,8 +65,6 @@ const filterConfig = computed(()=>{
return arr.length >= 4 && showMore.value ? arr : arr.slice(0, 3)
})
console.log(filterConfig.value, 'filterConfig');
// 搜索功能表单元素默认值
const setDefaultFormValues = () => {
filterConfig.value.forEach(item=>{

View File

@@ -49,7 +49,7 @@ import { isVNode } from 'vue'
if(column && column?.formatter) {
return column.formatter(row, column, value, $index) || '--'
}
return value ? value.toString() : '--'
return value !== null && value !== undefined ? value.toString() : '--'
}
</script>

View File

@@ -27,8 +27,10 @@ import Hamburger from './Hamburger.vue';
import {useAuthStore} from '@/stores/userstore.js'
import BellSocket from "./BellSocket.vue";
import {getUserInfo} from "../../api/login";
import {usePermisstionStroe} from '@/stores/permisstion'
const authStore = useAuthStore()
const permisstionStore = usePermisstionStroe()
const userInfo = ref({})
const visitedP = ref(false)
const router = useRouter()
@@ -58,6 +60,7 @@ const handleToAuth = () => {
const handleLogout = () => {
visitedP.value = !visitedP.value
authStore.userLogout()
permisstionStore.removeMenu()
router.push('/login')
}
</script>

View File

@@ -188,7 +188,8 @@ router.beforeEach(async (to, form, next) => {
next()
NProgress.done()
} else {
next({path: '/login'})
sessionStorage.setItem('toView', JSON.stringify(to))
next({path: '/cas/login'})
}
} else {
if (to.path === '/login'|| to.path === '/cas/login') {

View File

@@ -10,7 +10,17 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
const asyncRouters = ref([])
//定义是否加载路由变量
const isLoadRoutes = ref(false)
const menuList = ref([])
const menuList = ref([
{
name: 'home',
path: '/home',
icon: 'home',
title: '首页',
meta: {
breadcrumb: true
}
}
])
const setIsLoadRoutes = (status) => {
return isLoadRoutes.value = status
@@ -21,7 +31,7 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
const sRouter = JSON.parse(JSON.stringify(res.data))
const mData = JSON.parse(JSON.stringify(res.data))
asyncRouters.value = formatAsyncRouters(sRouter)
menuList.value = generateMenu(mData)
menuList.value = [...menuList.value, ...generateMenu(mData)]
addAsyncRouters(asyncRouters.value)
isLoadRoutes.value = false
} else {
@@ -96,12 +106,18 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
}
}
const removeMenu = () => {
menuList.value.length = 0
asyncRouters.value.length = 0
}
return {
asyncRouters,
menuList,
isLoadRoutes,
setAsyncRouters,
setIsLoadRoutes
setIsLoadRoutes,
removeMenu
}
})

View File

@@ -1,6 +1,6 @@
import axios from "axios";
import { AxiosCanceler } from "./axiosCanceler";
import { ElMessage, ElMessageBox } from "element-plus";
import { ElMessageBox, ElNotification } from "element-plus";
import { getToken, removeToken } from "./auth";
axios.defaults.headers['Content-Type']='application/json'
@@ -48,21 +48,45 @@ serveice.interceptors.response.use(response=>{
case 402:
break;
case 403:
ElMessage.warning('禁止访问')
removeToken()
window.location = '/forbidden'
console.log(response)
ElNotification({
title: '系统提示',
message: response.data.msg,
type: 'warning'
})
break;
case 404:
ElMessage.warning('不存在的地址')
ElNotification({
title: '系统提示',
message: '不存在的地址',
type: 'error'
})
break;
case 405:
ElMessage.warning('传输格式错误,请检查')
ElNotification({
title: '系统提示',
message: '传输格式错误,请检查',
type: 'error'
})
break;
case 511:
ElNotification({
title: '系统提示',
message: '禁止访问',
type: 'error'
})
removeToken()
window.location = '/forbidden'
break;
case 500:
if (response.data){
return response.data
}else {
ElMessage.error('系统未知错误')
ElNotification({
title: '系统提示',
message: '系统未知错误',
type: 'error'
})
break;
}
}

View File

@@ -51,6 +51,9 @@
import * as echarts from 'echarts'
import homeImage from "@/assets/home/home.png"
import coffee from "@/assets/home/coffee.png"
import { useRouter } from 'vue-router';
const router = useRouter()
const list=ref([
{
title: '在线用户量',
@@ -172,8 +175,22 @@ const init = () => {
data.pieCharts = echarts.init(document.getElementById('pie3')).setOption(pieOption)
}
const redirectView = () => {
const toView = sessionStorage.getItem('toView')
console.log(toView, 'toView');
toView ?
router.push({
path: JSON.parse(toView).path,
query: {
...JSON.parse(toView).query
}
}) :
null
}
onMounted(() => {
init()
redirectView()
})
window.addEventListener('resize', () => {

View File

@@ -37,7 +37,7 @@ import {User, Lock, Key} from '@element-plus/icons-vue'
const router = useRouter()
const authStore = useAuthStore()
const loginForm = reactive({
username: 'admin',
username: 'superAdmin',
password: '123456',
code: '',
uuid: ''

View File

@@ -39,7 +39,7 @@
@select="handleSelect"
v-tabh
>
<el-table-column type="selection" width="55"/>
<el-table-column type="selection" width="55" fixed="left" />
<el-table-column label="序号" type="index" align="center" width="60"/>
<el-table-column prop="roleName" label="角色名称" align="center"/>
<el-table-column prop="roleKey" label="角色标识符" align="center"/>
@@ -59,7 +59,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center" width="180px"/>
<el-table-column label="操作" align="center">
<el-table-column label="操作" align="center" fixed="right">
<template #default="scope">
<popover-delete :name="scope.row.roleName" :type="'角色'" :btn-text="'取消授权'"
@delete="handleCancelAuthorization([scope.row.roleId])"/>
@@ -98,7 +98,7 @@
v-loading="dialogLoading"
@select="handleDialogSelect"
>
<el-table-column type="selection" width="55"/>
<el-table-column type="selection" width="55" fixed="left" />
<el-table-column label="序号" type="index" align="center" width="60"/>
<el-table-column prop="roleName" label="角色名称" align="center"/>
<el-table-column prop="roleKey" label="角色标识符" align="center"/>
@@ -117,7 +117,7 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center" width="180px"/>
<el-table-column label="操作" align="center">
<el-table-column label="操作" align="center" fixed="right">
<template #default="scope">
<el-button type="primary" size="mini"
@click="handleSubmit(scope.row.roleId)" link>添加

View File

@@ -16,7 +16,7 @@
</el-form-item>
</el-form>
<div class="table-header-btn">
<el-button type="primary" @click="handleAdd" :icon="Plus">新增</el-button>
<el-button type="primary" @click="handleAdd" :icon="Plus" v-perm="['admin:menu:add']">新增</el-button>
<el-button type="info" @click="handleExpand" :icon="Sort">{{ isExpand ? '全部收起' : '全部展开' }}</el-button>
</div>
@@ -42,15 +42,13 @@
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间"/>
<el-table-column label="操作" prop="operation">
<el-table-column label="操作" prop="operation" align="right">
<template #default="scope">
<el-button type="primary" v-if="scope.row.menuType!=='B'" size="mini" @click="handleAdd(scope.row)" link>新增
<el-button type="primary" v-if="scope.row.menuType!=='B'" @click="handleAdd(scope.row)" link v-perm="['admin:menu:add']">新增
</el-button>
<div v-else style="display: inline-block">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<el-button type="primary" size="mini" @click="handleEdit(scope.row.menuId)" link>修改</el-button>
<el-button type="primary" size="mini" @click="handleAssignRoles(scope.row)" link>分配角色</el-button>
<popover-delete :name="scope.row.menuName" :type="'菜单'" @delete="handleDel(scope.row.menuId)"/>
<el-button type="primary" @click="handleEdit(scope.row.menuId)" link v-perm="['admin:menu:edit']">修改</el-button>
<!-- <el-button type="primary" @click="handleAssignRoles(scope.row)" link>分配角色</el-button> -->
<popover-delete :name="scope.row.menuName" :type="'菜单'" @delete="handleDel(scope.row.menuId)" :perm="['admin:menu:del']" />
</template>
</el-table-column>
</el-table>

View File

@@ -2,7 +2,16 @@
<div v-loading="loading">
<baseTitle title="角色信息录入"></baseTitle>
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
<baseTitle title="分配菜单"></baseTitle>
<div class="assign-menu-title" >
<baseTitle title="分配菜单"></baseTitle>
<fvSelect
:options="localData.tempRoleOpt"
v-model="localData.tempRoleSelect"
style="width: 200px;"
placeholder="请选择模版角色"
@change="roleTempChange"
/>
</div>
<fvCheckbox :options="localData.checkOptions" v-model="localData.checkList" @change="checkBoxChange" />
<el-input v-model="localData.filterText" placeholder="请输入关键词" style="width: 400px;" />
<div class="menu-assign">
@@ -11,7 +20,7 @@
:data="localData.menuData"
:filter-node-method="filterMenu"
:props="localData.menuTreeProps"
:check-strictly="localData.checkStrictly"
:check-strictly="!localData.checkStrictly"
show-checkbox
node-key="menuId"
@check-change="checkChange"
@@ -30,7 +39,7 @@ import { useAuthStore } from '@/stores/userstore.js'
import fvRadio from '@/fvcomponents/fvRadio/index.vue'
import { ElLoading, ElNotification } from 'element-plus';
import { getMenuList } from '@/api/system/menuman.js'
import { getRoleDetail, operate} from "@/api/role/role";
import { getRoleDetail, operate, getTemRoleOption } from "@/api/role/role";
const tagsViewStore = useTagsView()
const authStore = useAuthStore()
@@ -50,7 +59,7 @@ const localData = reactive({
label: 'menuName',
children: 'children'
},
checkStrictly: false,
checkStrictly: true,
checkList: ['3'],
checkOptions: [
{
@@ -65,7 +74,9 @@ const localData = reactive({
label: '父子联动',
value: '3'
},
]
],
tempRoleOpt: [],
tempRoleSelect: ''
})
const schame = computed(()=>{
@@ -115,7 +126,7 @@ const schame = computed(()=>{
}
},
]
return !authStore.roles.includes('superAdmin') ? arr.slice(-1) : arr
return !authStore.roles.includes('superAdmin') ? arr.slice(0, arr.length - 1) : arr
})
const rules = reactive({
@@ -130,6 +141,8 @@ const getInstance = (e) => {
const init = async () => {
form.value.setValues({state: '1', template: false})
const res = await getTemRoleOption()
localData.tempRoleOpt = res.data
const { data } = await getMenuList()
localData.menuData = data
}
@@ -140,12 +153,25 @@ const getInfo = async () => {
data.menuIds.forEach(key=>{
menuTree.value.setChecked(key, true, false)
})
if(route.query.isAdd) {
form.value.setValues(data)
}
const roleTempChange = async (val) => {
try {
loading.value = true
const { data } = await getRoleDetail(val.value)
data.menuIds.forEach(key=>{
menuTree.value.setChecked(key, true, false)
})
delete data.roleId
delete data.roleName
delete data.roleKey
form.value.setValues(data)
loading.value = false
} catch (error) {
loading.value = false
}
form.value.setValues(data)
}
const filterMenu = (value, data) => {
@@ -222,6 +248,14 @@ onMounted( async ()=>{
</script>
<style lang="scss" scoped>
.assign-menu-title {
display: flex;
justify-content: flex-start;
align-items: center;
>div:first-child {
margin-right: 15px;
}
}
.menu-assign {
width: 400px;
max-height: 500px;

View File

@@ -129,17 +129,10 @@ const tableConfig = reactive({
prop: 'oper',
label: '操作',
align: 'right',
fixed: 'right',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = [{label: '修改', auth: auths.edit, func: ()=>handleEdit(row) , type: 'primary'}]
row.template ?
btn.push(
{
label: '使用模版',
auth: auths.edit,
func: ()=>handleUseTemp(row),
type: 'primary'
}
) :
btn.push(
{
label: '分配用户',
@@ -221,16 +214,6 @@ const handleEdit = (row) => {
})
}
const handleUseTemp = (row) => {
router.push({
path: '/system/roleadd',
query: {
id: row.roleId,
isAdd: 1
}
})
}
const handleAssign = (row) => {
}

View File

@@ -59,7 +59,7 @@ export default defineConfig({
terserOptions: {
compress: {
drop_console: false, // 生产环境移除log
drop_debugger: false // 生产环境禁用debugger
drop_debugger: true // 生产环境禁用debugger
}
}
},