Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
658f7de3c0 | ||
|
|
c28b0e306d | ||
|
|
b1b039a897 | ||
|
|
1e23fe08e3 | ||
|
|
5fc036d12d | ||
|
|
610b1a66b6 |
72
.drone.yml
72
.drone.yml
@@ -5,8 +5,6 @@ platform:
|
|||||||
os: linux
|
os: linux
|
||||||
arch: arm64
|
arch: arm64
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
|
||||||
- name: build-package
|
- name: build-package
|
||||||
image: node:16.20.0
|
image: node:16.20.0
|
||||||
volumes:
|
volumes:
|
||||||
@@ -25,16 +23,17 @@ steps:
|
|||||||
- npm -v
|
- npm -v
|
||||||
- mkdir -p ./node_modules
|
- mkdir -p ./node_modules
|
||||||
- export NODE_MODULES_PATH=`pwd`/node_modules
|
- export NODE_MODULES_PATH=`pwd`/node_modules
|
||||||
# - npm config set registry https://registry.npmmirror.com
|
#- npm config set registry https://registry.npm.taobao.org
|
||||||
#- set NODE_OPTIONS=--openssl-legacy-provider
|
#- set NODE_OPTIONS=--openssl-legacy-provider
|
||||||
# - npm install
|
# - npm install
|
||||||
- npm run build
|
- npm run build
|
||||||
- ls /app/build/$DRONE_REPO_NAME/
|
- ls /app/build/$DRONE_REPO_NAME/
|
||||||
- echo $NODE_MODULES_PATH
|
- echo $NODE_MODULES_PATH
|
||||||
- cp -r dist /app/build/$DRONE_REPO_NAME
|
- cp -r dist /app/build/$DRONE_REPO_NAME
|
||||||
|
|
||||||
|
|
||||||
- name: build-docker-prod # 制作docker镜像
|
|
||||||
|
- name: build-docker # 制作docker镜像
|
||||||
image: docker # 使用官方docker镜像
|
image: docker # 使用官方docker镜像
|
||||||
volumes: # 将容器内目录挂载到宿主机
|
volumes: # 将容器内目录挂载到宿主机
|
||||||
- name: docker
|
- name: docker
|
||||||
@@ -56,9 +55,6 @@ steps:
|
|||||||
- sed -i 's/$REGISTRY_NAMESPACE/'"$REGISTRY_NAMESPACE"'/' 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_REPO_NAME/'"$DRONE_REPO_NAME"'/' deployment.yml
|
||||||
- sed -i 's/$DRONE_COMMIT/'"$DRONE_COMMIT"'/' 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
|
# docker登录,不能在脚本中登录,并且不能使用docker login -u -p
|
||||||
- echo $DOCKER_PASSWORD | docker login $REGISTRY --username $DOCKER_USERNAME --password-stdin
|
- echo $DOCKER_PASSWORD | docker login $REGISTRY --username $DOCKER_USERNAME --password-stdin
|
||||||
- chmod +x docker.sh
|
- chmod +x docker.sh
|
||||||
@@ -66,47 +62,9 @@ steps:
|
|||||||
- sh docker.sh
|
- sh docker.sh
|
||||||
# 执行完脚本删除本次制作的docker镜像,避免多次后当前runner空间不足
|
# 执行完脚本删除本次制作的docker镜像,避免多次后当前runner空间不足
|
||||||
- docker rmi -f $(docker images | grep $DRONE_REPO_NAME | awk '{print $3}')
|
- 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-prod # rancher运行
|
- name: drone-rancher # rancher运行
|
||||||
image: bitnami/kubectl:1.26.13-debian-11-r1
|
image: bitnami/kubectl:1.26.13-debian-11-r1
|
||||||
volumes: # 将容器内目录挂载到宿主机
|
volumes: # 将容器内目录挂载到宿主机
|
||||||
- name: config
|
- name: config
|
||||||
@@ -114,24 +72,6 @@ steps:
|
|||||||
commands: # 定义在Docker容器中执行的shell命令
|
commands: # 定义在Docker容器中执行的shell命令
|
||||||
# 将deployment中定义的变量替换为drone中的内置变量
|
# 将deployment中定义的变量替换为drone中的内置变量
|
||||||
- kubectl apply -f deployment.yml -n mosr --kubeconfig=/app/config/base-taishan-kubectl.yml
|
- 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:
|
volumes:
|
||||||
- name: cache
|
- name: cache
|
||||||
@@ -144,10 +84,8 @@ volumes:
|
|||||||
host:
|
host:
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
load:
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- prod
|
- prod
|
||||||
- dm
|
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -13,7 +13,7 @@
|
|||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"d3": "^7.8.5",
|
"d3": "^7.8.5",
|
||||||
"echarts": "^5.4.2",
|
"echarts": "^5.4.2",
|
||||||
"element-plus": "^2.6.0",
|
"element-plus": "^2.3.5",
|
||||||
"highlight.js": "9.18.5",
|
"highlight.js": "9.18.5",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"d3": "^7.8.5",
|
"d3": "^7.8.5",
|
||||||
"echarts": "^5.4.2",
|
"echarts": "^5.4.2",
|
||||||
"element-plus": "^2.6.0",
|
"element-plus": "^2.3.5",
|
||||||
"highlight.js": "9.18.5",
|
"highlight.js": "9.18.5",
|
||||||
"jquery": "^3.6.0",
|
"jquery": "^3.6.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
|
|||||||
@@ -14,14 +14,6 @@ export const getRoleOption = () => {
|
|||||||
method: "get"
|
method: "get"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTemRoleOption = () => {
|
|
||||||
return request({
|
|
||||||
url: '/admin/role/option/template',
|
|
||||||
method: "get"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//查询角色信息
|
//查询角色信息
|
||||||
export const getRoleDetail = (roleId) => {
|
export const getRoleDetail = (roleId) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -46,6 +46,15 @@ export const getUserDetail = (userId) => {
|
|||||||
method: "get"
|
method: "get"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 操作
|
||||||
|
export const operate = (data, type) => {
|
||||||
|
console.log(type ,'type');
|
||||||
|
if(data.userId && type !== '0') return editUser(data)
|
||||||
|
else if(type == '0') return editUserOA(data)
|
||||||
|
return addUser(data)
|
||||||
|
}
|
||||||
|
|
||||||
// 新增用户
|
// 新增用户
|
||||||
export const addUser = (data) => {
|
export const addUser = (data) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -63,6 +72,15 @@ export const editUser = (data) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改OA用户
|
||||||
|
export const editUserOA = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/admin/mosr/user/oa',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//删除用户信息
|
//删除用户信息
|
||||||
export const deleteUser = (userId) => {
|
export const deleteUser = (userId) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const props = defineProps({
|
|||||||
default: []
|
default: []
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [Number, String, Boolean],
|
type: [Number, String],
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
cacheKey: {
|
cacheKey: {
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ const filterConfig = computed(()=>{
|
|||||||
return arr.length >= 4 && showMore.value ? arr : arr.slice(0, 3)
|
return arr.length >= 4 && showMore.value ? arr : arr.slice(0, 3)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log(filterConfig.value, 'filterConfig');
|
||||||
|
|
||||||
// 搜索功能表单元素默认值
|
// 搜索功能表单元素默认值
|
||||||
const setDefaultFormValues = () => {
|
const setDefaultFormValues = () => {
|
||||||
filterConfig.value.forEach(item=>{
|
filterConfig.value.forEach(item=>{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import { isVNode } from 'vue'
|
|||||||
if(column && column?.formatter) {
|
if(column && column?.formatter) {
|
||||||
return column.formatter(row, column, value, $index) || '--'
|
return column.formatter(row, column, value, $index) || '--'
|
||||||
}
|
}
|
||||||
return value !== null && value !== undefined ? value.toString() : '--'
|
return value ? value.toString() : '--'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,8 @@ import Hamburger from './Hamburger.vue';
|
|||||||
import {useAuthStore} from '@/stores/userstore.js'
|
import {useAuthStore} from '@/stores/userstore.js'
|
||||||
import BellSocket from "./BellSocket.vue";
|
import BellSocket from "./BellSocket.vue";
|
||||||
import {getUserInfo} from "../../api/login";
|
import {getUserInfo} from "../../api/login";
|
||||||
import {usePermisstionStroe} from '@/stores/permisstion'
|
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const permisstionStore = usePermisstionStroe()
|
|
||||||
const userInfo = ref({})
|
const userInfo = ref({})
|
||||||
const visitedP = ref(false)
|
const visitedP = ref(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -60,7 +58,6 @@ const handleToAuth = () => {
|
|||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
visitedP.value = !visitedP.value
|
visitedP.value = !visitedP.value
|
||||||
authStore.userLogout()
|
authStore.userLogout()
|
||||||
permisstionStore.removeMenu()
|
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -188,8 +188,7 @@ router.beforeEach(async (to, form, next) => {
|
|||||||
next()
|
next()
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
} else {
|
} else {
|
||||||
sessionStorage.setItem('toView', JSON.stringify(to))
|
next({path: '/login'})
|
||||||
next({path: '/cas/login'})
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (to.path === '/login'|| to.path === '/cas/login') {
|
if (to.path === '/login'|| to.path === '/cas/login') {
|
||||||
|
|||||||
@@ -10,17 +10,7 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
|
|||||||
const asyncRouters = ref([])
|
const asyncRouters = ref([])
|
||||||
//定义是否加载路由变量
|
//定义是否加载路由变量
|
||||||
const isLoadRoutes = ref(false)
|
const isLoadRoutes = ref(false)
|
||||||
const menuList = ref([
|
const menuList = ref([])
|
||||||
{
|
|
||||||
name: 'home',
|
|
||||||
path: '/home',
|
|
||||||
icon: 'home',
|
|
||||||
title: '首页',
|
|
||||||
meta: {
|
|
||||||
breadcrumb: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
const setIsLoadRoutes = (status) => {
|
const setIsLoadRoutes = (status) => {
|
||||||
return isLoadRoutes.value = status
|
return isLoadRoutes.value = status
|
||||||
@@ -31,7 +21,7 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
|
|||||||
const sRouter = JSON.parse(JSON.stringify(res.data))
|
const sRouter = JSON.parse(JSON.stringify(res.data))
|
||||||
const mData = JSON.parse(JSON.stringify(res.data))
|
const mData = JSON.parse(JSON.stringify(res.data))
|
||||||
asyncRouters.value = formatAsyncRouters(sRouter)
|
asyncRouters.value = formatAsyncRouters(sRouter)
|
||||||
menuList.value = [...menuList.value, ...generateMenu(mData)]
|
menuList.value = generateMenu(mData)
|
||||||
addAsyncRouters(asyncRouters.value)
|
addAsyncRouters(asyncRouters.value)
|
||||||
isLoadRoutes.value = false
|
isLoadRoutes.value = false
|
||||||
} else {
|
} else {
|
||||||
@@ -106,18 +96,12 @@ export const usePermisstionStroe = defineStore('permisstion', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeMenu = () => {
|
|
||||||
menuList.value.length = 0
|
|
||||||
asyncRouters.value.length = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
asyncRouters,
|
asyncRouters,
|
||||||
menuList,
|
menuList,
|
||||||
isLoadRoutes,
|
isLoadRoutes,
|
||||||
setAsyncRouters,
|
setAsyncRouters,
|
||||||
setIsLoadRoutes,
|
setIsLoadRoutes
|
||||||
removeMenu
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { AxiosCanceler } from "./axiosCanceler";
|
import { AxiosCanceler } from "./axiosCanceler";
|
||||||
import { ElMessageBox, ElNotification } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { getToken, removeToken } from "./auth";
|
import { getToken, removeToken } from "./auth";
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type']='application/json'
|
axios.defaults.headers['Content-Type']='application/json'
|
||||||
@@ -48,45 +48,21 @@ serveice.interceptors.response.use(response=>{
|
|||||||
case 402:
|
case 402:
|
||||||
break;
|
break;
|
||||||
case 403:
|
case 403:
|
||||||
console.log(response)
|
ElMessage.warning('禁止访问')
|
||||||
ElNotification({
|
|
||||||
title: '系统提示',
|
|
||||||
message: response.data.msg,
|
|
||||||
type: 'warning'
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 404:
|
|
||||||
ElNotification({
|
|
||||||
title: '系统提示',
|
|
||||||
message: '不存在的地址',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 405:
|
|
||||||
ElNotification({
|
|
||||||
title: '系统提示',
|
|
||||||
message: '传输格式错误,请检查',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 511:
|
|
||||||
ElNotification({
|
|
||||||
title: '系统提示',
|
|
||||||
message: '禁止访问',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
removeToken()
|
removeToken()
|
||||||
window.location = '/forbidden'
|
window.location = '/forbidden'
|
||||||
break;
|
break;
|
||||||
|
case 404:
|
||||||
|
ElMessage.warning('不存在的地址')
|
||||||
|
break;
|
||||||
|
case 405:
|
||||||
|
ElMessage.warning('传输格式错误,请检查')
|
||||||
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
if (response.data){
|
if (response.data){
|
||||||
return response.data
|
return response.data
|
||||||
}else {
|
}else {
|
||||||
ElNotification({
|
ElMessage.error('系统未知错误')
|
||||||
title: '系统提示',
|
|
||||||
message: '系统未知错误',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,6 @@
|
|||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts'
|
||||||
import homeImage from "@/assets/home/home.png"
|
import homeImage from "@/assets/home/home.png"
|
||||||
import coffee from "@/assets/home/coffee.png"
|
import coffee from "@/assets/home/coffee.png"
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
const router = useRouter()
|
|
||||||
const list=ref([
|
const list=ref([
|
||||||
{
|
{
|
||||||
title: '在线用户量',
|
title: '在线用户量',
|
||||||
@@ -175,22 +172,8 @@ const init = () => {
|
|||||||
data.pieCharts = echarts.init(document.getElementById('pie3')).setOption(pieOption)
|
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(() => {
|
onMounted(() => {
|
||||||
init()
|
init()
|
||||||
redirectView()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import {User, Lock, Key} from '@element-plus/icons-vue'
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const loginForm = reactive({
|
const loginForm = reactive({
|
||||||
username: 'superAdmin',
|
username: 'admin',
|
||||||
password: '123456',
|
password: '123456',
|
||||||
code: '',
|
code: '',
|
||||||
uuid: ''
|
uuid: ''
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
@select="handleSelect"
|
@select="handleSelect"
|
||||||
v-tabh
|
v-tabh
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" fixed="left" />
|
<el-table-column type="selection" width="55"/>
|
||||||
<el-table-column label="序号" type="index" align="center" width="60"/>
|
<el-table-column label="序号" type="index" align="center" width="60"/>
|
||||||
<el-table-column prop="roleName" label="角色名称" align="center"/>
|
<el-table-column prop="roleName" label="角色名称" align="center"/>
|
||||||
<el-table-column prop="roleKey" label="角色标识符" align="center"/>
|
<el-table-column prop="roleKey" label="角色标识符" align="center"/>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" align="center" width="180px"/>
|
<el-table-column prop="createTime" label="创建时间" align="center" width="180px"/>
|
||||||
<el-table-column label="操作" align="center" fixed="right">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<popover-delete :name="scope.row.roleName" :type="'角色'" :btn-text="'取消授权'"
|
<popover-delete :name="scope.row.roleName" :type="'角色'" :btn-text="'取消授权'"
|
||||||
@delete="handleCancelAuthorization([scope.row.roleId])"/>
|
@delete="handleCancelAuthorization([scope.row.roleId])"/>
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
v-loading="dialogLoading"
|
v-loading="dialogLoading"
|
||||||
@select="handleDialogSelect"
|
@select="handleDialogSelect"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" fixed="left" />
|
<el-table-column type="selection" width="55"/>
|
||||||
<el-table-column label="序号" type="index" align="center" width="60"/>
|
<el-table-column label="序号" type="index" align="center" width="60"/>
|
||||||
<el-table-column prop="roleName" label="角色名称" align="center"/>
|
<el-table-column prop="roleName" label="角色名称" align="center"/>
|
||||||
<el-table-column prop="roleKey" label="角色标识符" align="center"/>
|
<el-table-column prop="roleKey" label="角色标识符" align="center"/>
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" align="center" width="180px"/>
|
<el-table-column prop="createTime" label="创建时间" align="center" width="180px"/>
|
||||||
<el-table-column label="操作" align="center" fixed="right">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" size="mini"
|
<el-button type="primary" size="mini"
|
||||||
@click="handleSubmit(scope.row.roleId)" link>添加
|
@click="handleSubmit(scope.row.roleId)" link>添加
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="table-header-btn">
|
<div class="table-header-btn">
|
||||||
<el-button type="primary" @click="handleAdd" :icon="Plus" v-perm="['admin:menu:add']">新增</el-button>
|
<el-button type="primary" @click="handleAdd" :icon="Plus">新增</el-button>
|
||||||
<el-button type="info" @click="handleExpand" :icon="Sort">{{ isExpand ? '全部收起' : '全部展开' }}</el-button>
|
<el-button type="info" @click="handleExpand" :icon="Sort">{{ isExpand ? '全部收起' : '全部展开' }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -42,13 +42,15 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间"/>
|
<el-table-column prop="createTime" label="创建时间"/>
|
||||||
<el-table-column label="操作" prop="operation" align="right">
|
<el-table-column label="操作" prop="operation">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" v-if="scope.row.menuType!=='B'" @click="handleAdd(scope.row)" link v-perm="['admin:menu:add']">新增
|
<el-button type="primary" v-if="scope.row.menuType!=='B'" size="mini" @click="handleAdd(scope.row)" link>新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" @click="handleEdit(scope.row.menuId)" link v-perm="['admin:menu:edit']">修改</el-button>
|
<div v-else style="display: inline-block">
|
||||||
<!-- <el-button type="primary" @click="handleAssignRoles(scope.row)" link>分配角色</el-button> -->
|
</div>
|
||||||
<popover-delete :name="scope.row.menuName" :type="'菜单'" @delete="handleDel(scope.row.menuId)" :perm="['admin:menu:del']" />
|
<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)"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|||||||
@@ -2,16 +2,7 @@
|
|||||||
<div v-loading="loading">
|
<div v-loading="loading">
|
||||||
<baseTitle title="角色信息录入"></baseTitle>
|
<baseTitle title="角色信息录入"></baseTitle>
|
||||||
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
|
<fvForm :schema="schame" @getInstance="getInstance" :rules="rules"></fvForm>
|
||||||
<div class="assign-menu-title" >
|
<baseTitle title="分配菜单"></baseTitle>
|
||||||
<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" />
|
<fvCheckbox :options="localData.checkOptions" v-model="localData.checkList" @change="checkBoxChange" />
|
||||||
<el-input v-model="localData.filterText" placeholder="请输入关键词" style="width: 400px;" />
|
<el-input v-model="localData.filterText" placeholder="请输入关键词" style="width: 400px;" />
|
||||||
<div class="menu-assign">
|
<div class="menu-assign">
|
||||||
@@ -20,7 +11,7 @@
|
|||||||
:data="localData.menuData"
|
:data="localData.menuData"
|
||||||
:filter-node-method="filterMenu"
|
:filter-node-method="filterMenu"
|
||||||
:props="localData.menuTreeProps"
|
:props="localData.menuTreeProps"
|
||||||
:check-strictly="!localData.checkStrictly"
|
:check-strictly="localData.checkStrictly"
|
||||||
show-checkbox
|
show-checkbox
|
||||||
node-key="menuId"
|
node-key="menuId"
|
||||||
@check-change="checkChange"
|
@check-change="checkChange"
|
||||||
@@ -39,7 +30,7 @@ import { useAuthStore } from '@/stores/userstore.js'
|
|||||||
import fvRadio from '@/fvcomponents/fvRadio/index.vue'
|
import fvRadio from '@/fvcomponents/fvRadio/index.vue'
|
||||||
import { ElLoading, ElNotification } from 'element-plus';
|
import { ElLoading, ElNotification } from 'element-plus';
|
||||||
import { getMenuList } from '@/api/system/menuman.js'
|
import { getMenuList } from '@/api/system/menuman.js'
|
||||||
import { getRoleDetail, operate, getTemRoleOption } from "@/api/role/role";
|
import { getRoleDetail, operate} from "@/api/role/role";
|
||||||
|
|
||||||
const tagsViewStore = useTagsView()
|
const tagsViewStore = useTagsView()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
@@ -59,7 +50,7 @@ const localData = reactive({
|
|||||||
label: 'menuName',
|
label: 'menuName',
|
||||||
children: 'children'
|
children: 'children'
|
||||||
},
|
},
|
||||||
checkStrictly: true,
|
checkStrictly: false,
|
||||||
checkList: ['3'],
|
checkList: ['3'],
|
||||||
checkOptions: [
|
checkOptions: [
|
||||||
{
|
{
|
||||||
@@ -74,9 +65,7 @@ const localData = reactive({
|
|||||||
label: '父子联动',
|
label: '父子联动',
|
||||||
value: '3'
|
value: '3'
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
tempRoleOpt: [],
|
|
||||||
tempRoleSelect: ''
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const schame = computed(()=>{
|
const schame = computed(()=>{
|
||||||
@@ -126,7 +115,7 @@ const schame = computed(()=>{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
return !authStore.roles.includes('superAdmin') ? arr.slice(0, arr.length - 1) : arr
|
return !authStore.roles.includes('superAdmin') ? arr.slice(-1) : arr
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
@@ -141,8 +130,6 @@ const getInstance = (e) => {
|
|||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
form.value.setValues({state: '1', template: false})
|
form.value.setValues({state: '1', template: false})
|
||||||
const res = await getTemRoleOption()
|
|
||||||
localData.tempRoleOpt = res.data
|
|
||||||
const { data } = await getMenuList()
|
const { data } = await getMenuList()
|
||||||
localData.menuData = data
|
localData.menuData = data
|
||||||
}
|
}
|
||||||
@@ -153,25 +140,12 @@ const getInfo = async () => {
|
|||||||
data.menuIds.forEach(key=>{
|
data.menuIds.forEach(key=>{
|
||||||
menuTree.value.setChecked(key, true, false)
|
menuTree.value.setChecked(key, true, false)
|
||||||
})
|
})
|
||||||
form.value.setValues(data)
|
if(route.query.isAdd) {
|
||||||
}
|
|
||||||
|
|
||||||
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.roleId
|
||||||
delete data.roleName
|
delete data.roleName
|
||||||
delete data.roleKey
|
delete data.roleKey
|
||||||
form.value.setValues(data)
|
|
||||||
loading.value = false
|
|
||||||
} catch (error) {
|
|
||||||
loading.value = false
|
|
||||||
}
|
}
|
||||||
|
form.value.setValues(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterMenu = (value, data) => {
|
const filterMenu = (value, data) => {
|
||||||
@@ -248,14 +222,6 @@ onMounted( async ()=>{
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.assign-menu-title {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
>div:first-child {
|
|
||||||
margin-right: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.menu-assign {
|
.menu-assign {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
max-height: 500px;
|
max-height: 500px;
|
||||||
|
|||||||
@@ -129,10 +129,17 @@ const tableConfig = reactive({
|
|||||||
prop: 'oper',
|
prop: 'oper',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
fixed: 'right',
|
|
||||||
showOverflowTooltip: false,
|
|
||||||
currentRender: ({row, index}) => {
|
currentRender: ({row, index}) => {
|
||||||
let btn = [{label: '修改', auth: auths.edit, func: ()=>handleEdit(row) , type: 'primary'}]
|
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(
|
btn.push(
|
||||||
{
|
{
|
||||||
label: '分配用户',
|
label: '分配用户',
|
||||||
@@ -214,6 +221,16 @@ const handleEdit = (row) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleUseTemp = (row) => {
|
||||||
|
router.push({
|
||||||
|
path: '/system/roleadd',
|
||||||
|
query: {
|
||||||
|
id: row.roleId,
|
||||||
|
isAdd: 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleAssign = (row) => {
|
const handleAssign = (row) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
import { addUser, editUser } from '@/api/user/user.js'
|
import { operate } from '@/api/user/user.js'
|
||||||
import { ElLoading, ElNotification } from 'element-plus';
|
import { ElLoading, ElNotification } from 'element-plus';
|
||||||
import { useTagsView } from '@/stores/tagsview.js'
|
import { useTagsView } from '@/stores/tagsview.js'
|
||||||
import { useAuthStore } from '@/stores/userstore.js'
|
import { useAuthStore } from '@/stores/userstore.js'
|
||||||
@@ -43,7 +43,8 @@ const schame = computed(()=>{
|
|||||||
clearable: true,
|
clearable: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
checkStrictly: true,
|
checkStrictly: true,
|
||||||
data: localData.subCompanyIdOpt
|
data: localData.subCompanyIdOpt,
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
change: async (val) => {
|
change: async (val) => {
|
||||||
@@ -61,7 +62,8 @@ const schame = computed(()=>{
|
|||||||
clearable: true,
|
clearable: true,
|
||||||
data: localData.departmentIdOpt,
|
data: localData.departmentIdOpt,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
checkStrictly: true
|
checkStrictly: true,
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -69,7 +71,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'userName',
|
prop: 'userName',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -77,7 +80,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'nickName',
|
prop: 'nickName',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -86,7 +90,7 @@ const schame = computed(()=>{
|
|||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入',
|
placeholder: '请输入',
|
||||||
type: 'password'
|
type: 'password',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -97,7 +101,8 @@ const schame = computed(()=>{
|
|||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
filterable: true,
|
filterable: true,
|
||||||
checkStrictly: true,
|
checkStrictly: true,
|
||||||
data: localData.jobOpt
|
data: localData.jobOpt,
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -116,7 +121,8 @@ const schame = computed(()=>{
|
|||||||
component: 'el-tree-select',
|
component: 'el-tree-select',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
data: cacheStore.getDict('user_sex')
|
data: cacheStore.getDict('user_sex'),
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -125,7 +131,8 @@ const schame = computed(()=>{
|
|||||||
component: 'el-tree-select',
|
component: 'el-tree-select',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请选择',
|
placeholder: '请选择',
|
||||||
data: cacheStore.getDict('normal_disable')
|
data: cacheStore.getDict('normal_disable'),
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -133,7 +140,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'mobile',
|
prop: 'mobile',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -141,7 +149,8 @@ const schame = computed(()=>{
|
|||||||
prop: 'email',
|
prop: 'email',
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入'
|
placeholder: '请输入',
|
||||||
|
disabled: route.query.userType == 0 ? true : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -198,30 +207,20 @@ const getInfo = async () => {
|
|||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const loading = ElLoading.service({fullscreen: true})
|
const loading = ElLoading.service({fullscreen: true})
|
||||||
try {
|
const { isValidate } = await form.value.validate()
|
||||||
const { isValidate } = await form.value.validate()
|
if(!isValidate) return Promise.reject()
|
||||||
if(!isValidate) return Promise.reject()
|
const values = form.value.getValues()
|
||||||
const values = form.value.getValues()
|
operate(values, route.query.userType).then(res=>{
|
||||||
let message
|
|
||||||
if(route.query.isAdd) {
|
|
||||||
const { code, msg } = await addUser(values)
|
|
||||||
code === 1000 ? message = msg : null
|
|
||||||
} else {
|
|
||||||
const { code, msg } = await editUser(values)
|
|
||||||
code === 1000 ? message = msg : null
|
|
||||||
}
|
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: route.query.isAdd ? '新增' : '编辑',
|
title: route.query.isAdd ? '新增' : '编辑',
|
||||||
message: message,
|
message: res.msg,
|
||||||
type: 'success'
|
type: res.code === 1000 ? 'success' : 'error'
|
||||||
})
|
})
|
||||||
loading.close()
|
loading.close()
|
||||||
tagsViewStore.delViewAndGoView('/system/user')
|
res.code === 1000 ? tagsViewStore.delViewAndGoView('/system/user') : null
|
||||||
} catch {
|
}).finally(()=>{
|
||||||
loading.close()
|
loading.close()
|
||||||
return Promise.reject()
|
})
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleBack = () => {
|
const handleBack = () => {
|
||||||
|
|||||||
@@ -119,14 +119,13 @@ const tableConfig = reactive({
|
|||||||
currentRender: ({row, index}) => {
|
currentRender: ({row, index}) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<el-button type="primary" link onClick={()=>handleEdit(row)}>编辑</el-button>
|
||||||
{
|
{
|
||||||
row.userType == 0 ?
|
row.userType != 0 ?
|
||||||
'--' :
|
<el-button type="danger" link onClick={()=>handleDel(row)}>删除</el-button> :
|
||||||
<div>
|
null
|
||||||
<el-button type="primary" link onClick={()=>handleEdit(row)}>编辑</el-button>
|
|
||||||
<el-button type="danger" link onClick={()=>handleDel(row)}>删除</el-button>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -171,7 +170,8 @@ const handleEdit = (row) => {
|
|||||||
router.push({
|
router.push({
|
||||||
path: '/system/useredit',
|
path: '/system/useredit',
|
||||||
query: {
|
query: {
|
||||||
id: row.userId
|
id: row.userId,
|
||||||
|
userType: row.userType
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default defineConfig({
|
|||||||
terserOptions: {
|
terserOptions: {
|
||||||
compress: {
|
compress: {
|
||||||
drop_console: false, // 生产环境移除log
|
drop_console: false, // 生产环境移除log
|
||||||
drop_debugger: true // 生产环境禁用debugger
|
drop_debugger: false // 生产环境禁用debugger
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user