系统管理修改

This commit is contained in:
jingna 2025-06-18 15:50:20 +08:00
parent e847424c1a
commit 8b8bec4c77
15 changed files with 87 additions and 65 deletions

View File

@ -102,7 +102,7 @@ const routes:any = [
{
path: '/Permission',
name: 'Permission',
component: () => import('@/views/system/permissionset/index.vue'),
component: () => import('@/views/system/manage/index.vue'),
meta: {
title: '权限管理',
requiresAuth: true

View File

@ -25,7 +25,7 @@ onMounted(()=>{
<img src="@/assets/system/u594.png" alt="">
</div>
<img src="@/assets/system/logosmall.png" alt="" style="margin-left: 10px;">
<div class="header-title">{{projectInfo.name }} - {{ projectInfo.typename }}</div>
<div class="header-title">系统管理</div>
</div>
</div>
</template>

View File

@ -3,9 +3,9 @@ import Header from './header.vue'
// import { findApplicationById } from "@/api/application/application";
import { useRoute, useRouter } from 'vue-router'
import { computed,reactive, ref, shallowRef, nextTick, watch, onMounted } from 'vue'
import Organization from '@/views/system/permissionset/organization/index.vue'
import Role from '@/views/system/permissionset/role/index.vue'
import User from '@/views/system/permissionset/user/index.vue'
import Organization from '@/views/system/manage/organization/index.vue'
import Role from '@/views/system/manage/role/index.vue'
import User from '@/views/system/manage/user/index.vue'
const projectInfo:any =ref({})
const route = useRoute()
const router = useRouter()

View File

@ -1,7 +1,5 @@
<script lang="ts" setup>
import { ref, onMounted} from 'vue'
import icon_permission_del_white from '@/assets/svg/permission_del_white.svg'
import icon_permission_edit_white from '@/assets/svg/permission_edit_white.svg'
import icon_permission_edit_blue from '@/assets/svg/permission_edit_blue.svg'
import icon_permission_del_blue from '@/assets/svg/permission_del_blue.svg'
import permission_table_edit_blue from '@/assets/svg/permission_table_edit_blue.svg'
@ -12,7 +10,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { Delete } from '@element-plus/icons-vue'
import { ElTable,ElTree } from 'element-plus'
import { getOrganizations,addOrganization,setIsValid,updateOrganizationById,
deleteById,getOrganizationById } from '@/api/data-visualization/permission/organization'
deleteById,getOrganizationById } from '@/api/data-visualization/manage/organization'
import { re } from 'mathjs'
const props = defineProps({
applicationId:String
})
@ -49,7 +48,7 @@ const deptrules = ref({
{ required: true, message: '请输入名称', trigger: 'blur' },
],
})
const handleMouseEnter = (node) => {
const handleMouseEnter = (node:any) => {
hoverNodeId.value = node.key;
};
const handleMouseLeave = () => {
@ -57,31 +56,52 @@ const handleMouseLeave = () => {
};
const submitForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.validate((valid) => {
formEl.validate((valid:any) => {
if (valid) {
if(preventcombo.value){
return
}
preventcombo.value = true
if(ruleForm.value.id !== ''){
updateOrganizationById(ruleForm.value).then(res => {
ElMessage({
type: 'success',
message: '修改成功',
})
dialogVisible.value = false
preventcombo.value = false
gettree()
updateOrganizationById(ruleForm.value).then((res:any) => {
if(res &&res.data.code === '0'){
ElMessage({
type: 'success',
message: '修改成功',
})
gettree()
dialogVisible.value = false
preventcombo.value = false
}else{
ElMessage({
type: 'error',
message: '修改失败',
})
dialogVisible.value = false
preventcombo.value = false
return
}
})
}else{
addOrganization(ruleForm.value).then(res => {
ElMessage({
type: 'success',
message: '新增成功',
})
dialogVisible.value = false
preventcombo.value = false
gettree()
addOrganization(ruleForm.value).then((res:any) => {
if(res && res.data.code === '0'){
ElMessage({
type: 'success',
message: '新增成功',
})
gettree()
dialogVisible.value = false
preventcombo.value = false
}else{
ElMessage({
type: 'error',
message: '新增失败',
})
dialogVisible.value = false
preventcombo.value = false
return
}
})
}
} else {
@ -96,7 +116,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
}
const deptsubmitForm = (formEl: FormInstance | undefined) => {
if (!formEl) return
formEl.validate((valid) => {
formEl.validate((valid:any) => {
if (valid) {
if(preventcombo.value){
return
@ -181,7 +201,7 @@ function getdept(id:any){
orgName:''
}
console.log(params,'params')
getOrganizations(params).then(res => {
getOrganizations(params).then((res:any) => {
tableData.value = res.data
tableloading.value = false
if(currentNodeId.value != null){
@ -197,7 +217,7 @@ function querydept(){
parentid:currentNodeId.value,
orgName:queryorgname.value
}
getOrganizations(params).then(res => {
getOrganizations(params).then((res:any) => {
tableData.value = res.data
tableloading.value = false
if(currentNodeId.value != null){
@ -236,7 +256,7 @@ function deltree(data:any){
type: 'warning',
}
).then(() => {
deleteById(data.id).then(res => {
deleteById(data.id).then((res:any) => {
ElMessage({
type: 'success',
message: '删除成功',
@ -256,7 +276,7 @@ function setisValid(row:any){
id:row.id,
isvaild:row.isvaild
}
setIsValid(params).then(res => {
setIsValid(params).then((res:any) => {
console.log(res,'res')
if(res.code == '0'){
getdept(currentNodeId.value)
@ -282,7 +302,7 @@ function deltable(row:any){
type: 'warning',
}
).then(() => {
deleteById(row.id).then(res => {
deleteById(row.id).then((res:any) => {
ElMessage({
type: 'success',
message: '删除成功',
@ -305,11 +325,11 @@ function deltables(){
}
)
.then(() => {
const arr = []
multipleSelection.value.forEach(e => {
const arr:any = []
multipleSelection.value.forEach((e:any) => {
arr.push(e.id)
});
deleteById(arr.join()).then(res => {
deleteById(arr.join()).then((res:any) => {
ElMessage({
type: 'success',
message: '删除成功',
@ -403,7 +423,7 @@ function formatDateTime(dateArray:any){
<div class="organization-rightbox">
<div class="querybox">
<div>
<el-input v-model="queryorgname" placeholder="请输入部门名称" style="width: 200px;margin-right: 10px;" />
<el-input v-model="queryorgname" placeholder="请输入部门名称" clearable style="width: 200px;margin-right: 10px;" />
<el-button type="primary" style="min-width: 50px;" @click="querydept">搜索</el-button>
</div>
<div>

View File

@ -8,7 +8,7 @@ import type { FormInstance } from 'element-plus'
import { Delete } from '@element-plus/icons-vue'
import { ElTable,ElTree,ElMessage, ElMessageBox } from 'element-plus'
import { listRole,addRole,updateRole,setIsValid,deleteRoleById,deleteRoleByIds,
permissionAssignment,setMenuByRoleId } from '@/api/data-visualization/permission/role'
permissionAssignment,setMenuByRoleId } from '@/api/data-visualization/manage/role'
const props = defineProps({
applicationId:String
})
@ -55,7 +55,7 @@ const submitForm = (formEl: FormInstance | undefined) => {
}
preventcombo.value = true
if(ruleForm.value.id !== ''){
updateRole(ruleForm.value).then(res => {
updateRole(ruleForm.value).then((res:any) => {
ElMessage({
type: 'success',
message: '修改成功',
@ -66,7 +66,7 @@ const submitForm = (formEl: FormInstance | undefined) => {
gettable()
})
}else{
addRole(ruleForm.value).then(res => {
addRole(ruleForm.value).then((res:any) => {
ElMessage({
type: 'success',
message: '新增成功',
@ -102,7 +102,7 @@ function permissionset(row:any){
roleId: row.id,
appId: props.applicationId,
}
permissionAssignment(params).then(res => {
permissionAssignment(params).then((res:any) => {
treeData.value = res.data
let ids: any = []
menuChange(res.data, ids)
@ -119,7 +119,7 @@ function gettable(){
appId: props.applicationId,
rolename:''
}
listRole(params).then(res => {
listRole(params).then((res:any) => {
tableData.value = res.data
tableloading.value = false
})
@ -130,7 +130,7 @@ function querytable(){
appId: props.applicationId,
rolename:queryrolename.value
}
listRole(params).then(res => {
listRole(params).then((res:any) => {
tableData.value = res.data
tableloading.value = false
})
@ -150,7 +150,7 @@ function deltable(row:any){
type: 'warning',
}
).then(() => {
deleteRoleById(row.id).then(res => {
deleteRoleById(row.id).then((res:any) => {
if(res.code == '0'){
gettable()
ElMessage({
@ -174,11 +174,11 @@ function deltables(){
type: 'warning',
}
).then(() => {
const arr = []
multipleSelection.value.forEach(e => {
const arr:any = []
multipleSelection.value.forEach((e:any) => {
arr.push(e.id)
});
deleteRoleByIds(arr.join()).then(res => {
deleteRoleByIds(arr.join()).then((res:any) => {
if(res.data.code == '0'){
gettable()
ElMessage({
@ -222,7 +222,7 @@ function setisValid(row:any){
id:row.id,
isvaild:row.isvaild
}
setIsValid(params).then(res => {
setIsValid(params).then((res:any) => {
if(res.code == '0'){
gettable()
ElMessage.success('设置成功')
@ -240,7 +240,7 @@ function consfigsubmit(){
id: currenttableid.value,
menuIds: Passparameter.value.join(',')
}
setMenuByRoleId(params).then(res => {
setMenuByRoleId(params).then((res:any) => {
if(res.code == '0'){
gettable()
ElMessage.success('设置成功')
@ -269,7 +269,7 @@ function menuChange(data: any, ids: any) {
<div class="organization-box">
<div class="querybox">
<div>
<el-input v-model="queryrolename" placeholder="请输入角色名称" style="width: 200px;margin-right: 10px;" />
<el-input v-model="queryrolename" clearable placeholder="请输入角色名称" style="width: 200px;margin-right: 10px;" />
<el-button type="primary" style="min-width: 50px;" @click="querytable">搜索</el-button>
</div>
<div>

View File

@ -8,9 +8,9 @@ import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Delete } from '@element-plus/icons-vue'
import { ElTable,ElTree } from 'element-plus'
import { getOrganizationById } from '@/api/data-visualization/permission/organization'
import { getOrganizationById } from '@/api/data-visualization/manage/organization'
import { queryUsers,addUser,updateUser,setStatus,deleteUserById,deleteUserByIds,
resetPassword } from '@/api/data-visualization/permission/user'
resetPassword } from '@/api/data-visualization/manage/user'
const props = defineProps({
applicationId:String
})
@ -59,7 +59,7 @@ const submitForm = (formEl: FormInstance | undefined) => {
}
preventcombo.value = true
if(ruleForm.value.id !== ''){
updateUser(ruleForm.value).then(res => {
updateUser(ruleForm.value).then((res:any) => {
ElMessage({
type: 'success',
message: '修改成功',
@ -69,7 +69,7 @@ const submitForm = (formEl: FormInstance | undefined) => {
getuserinfo()
})
}else{
addUser(ruleForm.value).then(res => {
addUser(ruleForm.value).then((res:any) => {
ElMessage({
type: 'success',
message: '新增成功',
@ -98,15 +98,17 @@ onMounted(() => {
})
function gettree(){
treeloading.value = true
getOrganizationById(props.applicationId).then(res => {
if(res.data.data.length>0){
getOrganizationById(props.applicationId).then((res:any) => {
if(res.data.data && res.data.data.length>0){
treeData.value = gettreeData(res.data.data)
}else{
treeData.value= []
}
treeloading.value = false
})
}
function gettreeData(orglist:any) {
const res = {};
const res:any = {};
for (const row of orglist) {
// parentid
const parentid = row.parentid || "0";
@ -137,7 +139,7 @@ function getuserinfo(){
current:1,
size:10
}
queryUsers(params).then(res => {
queryUsers(params).then((res:any) => {
tableData.value = res.data.data.records
total.value = Number(res.data.data.total)
tableloading.value = false
@ -152,7 +154,7 @@ function queryuserinfo(){
current:currentPage.value,
size:pageSize.value
}
queryUsers(params).then(res => {
queryUsers(params).then((res:any) => {
tableData.value = res.data.data.records
total.value = Number(res.data.data.total)
tableloading.value = false
@ -183,7 +185,7 @@ function deltable(row:any){
type: 'warning',
}
).then(() => {
deleteUserById(row.id).then(res => {
deleteUserById(row.id).then((res:any) => {
ElMessage({
type: 'success',
message: '删除成功',
@ -205,11 +207,11 @@ function deltables(){
}
)
.then(() => {
const arr = []
multipleSelection.value.forEach(e => {
const arr:any = []
multipleSelection.value.forEach((e:any) => {
arr.push(e.id)
});
deleteUserByIds(arr.join()).then(res => {
deleteUserByIds(arr.join()).then((res:any) => {
ElMessage({
type: 'success',
message: '删除成功',
@ -269,7 +271,7 @@ function setisValid(row:any){
id:row.id,
status:row.status
}
setStatus(params).then(res => {
setStatus(params).then((res:any) => {
if(res.code == '0'){
getuserinfo()
ElMessage.success('设置成功')
@ -289,7 +291,7 @@ function resetclick(row:any){
}
)
.then(() => {
resetPassword(row.id).then(res => {
resetPassword(row.id).then((res:any) => {
if(res.data.code == '0'){
ElMessage.success('重置成功')
}else{
@ -312,7 +314,7 @@ function resetclick(row:any){
<div class="organization-rightbox">
<div class="querybox">
<div>
<el-input v-model="querynickname" placeholder="请输入用户名称" style="width: 200px;margin-right: 10px;" />
<el-input v-model="querynickname" clearable placeholder="请输入用户名称" style="width: 200px;margin-right: 10px;" />
<el-button type="primary" style="min-width: 50px;" @click="queryuserinfo">搜索</el-button>
</div>
<div>