Skip to content

fix: 修改用户管理数据回显权限问题, 修改组织管理查询问题 #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/FormItem/OrgList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const handleData = (arr) => {
}
if(props.disabledData?.includes(i.id)){
i.disabled = true
} else {
i.disabled = false
}
return i
})
Expand Down
36 changes: 17 additions & 19 deletions src/components/FormItem/RoleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ const props = defineProps({
const dataMap = new Map()

const _treeData = computed(() => {
const arr = (treeData?.value || []).map((item)=>{
return {
name: item.groupName,
id: item.groupId,
disabled: true,
children: item.roles?.map((i)=>{
dataMap.set(i.id, i);
return {
name:i.name,
id:i.id,
disabled: props.disabledData.includes(i.id)
}
}) || []
}
})
const _arr = props.extraData.filter(i => {
return !dataMap.get(i.id)
}).map(item => {
Expand All @@ -40,32 +55,15 @@ const _treeData = computed(() => {
disabled: true
}
})
return [...treeData?.value || [], ..._arr]
return [...arr, ..._arr]
})

const { data: treeData, run } = useRequest(getRoleList, {
defaultParams: {
paging: false,
sorts: [{ name: 'createTime', order: 'desc' }]
},
defaultValue: [],
onSuccess(resp) {
return resp.result.map((item)=>{
return {
name: item.groupName,
id: item.groupId,
disabled: true,
children: item.roles?.map((i)=>{
dataMap.set(i.id, i);
return {
name:i.name,
id:i.id,
disabled: props.disabledData.includes(i.id)
}
}) || []
}
})
}
defaultValue: []
})
const myValue = ref()
const _extraData = computed(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ImageUpload from "./Upload/Image/ImageUpload.vue";
import CardBox from './CardBox/index.vue';
import Search from './Search'
import AMapComponent from './AMapComponent/AMap.vue'
import PathSimplifier from './AMapComponent/PathSimplifier.vue'
import { BasicLayoutPage, BlankLayoutPage, FullPage } from '@/layout'
import ProUpload from './Upload/index.vue'
import Player from './Player/index.vue'
Expand All @@ -24,6 +25,7 @@ export default {
.component('BlankLayoutPage', BlankLayoutPage)
.component('FullPage', FullPage)
.component('AMapComponent', AMapComponent)
.component('PathSimplifier', PathSimplifier)
.component('ProUpload', ProUpload)
.component('Player', Player)
.component('BatchDropdown', BatchDropdown)
Expand Down
9 changes: 8 additions & 1 deletion src/views/system/Department/components/LeftTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
<a-tree
v-if="treeData.length > 0"
:tree-data="treeData"
v-model:selected-keys="selectedKeys"
:selected-keys="selectedKeys"
v-model:expandedKeys="expandedKeys"
:fieldNames="{ key: 'id' }"
@select="onSelect"
>
<template #title="{ name, data }">
<div class="department-tree-item-content">
Expand Down Expand Up @@ -231,6 +232,12 @@ const openDialog = (row: any = {}) => {
visible.value = true
}

const onSelect = (val: string[]) => {
if(val.length){
selectedKeys.value = val
}
}

watch(
() => selectedKeys.value,
(n) => {
Expand Down
4 changes: 4 additions & 0 deletions src/views/system/Department/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import LeftTree from './components/LeftTree.vue'
import User from './user/index.vue';
import Position from './positions/index.vue';
import {getModulesComponents, isNoCommunity} from "@/utils";
import {useRouteQuery} from "@vueuse/router";

const activeKey = ref<'product' | 'device' | 'user'>('product');

Expand All @@ -49,6 +50,9 @@ const openDeviceBind = () => {

const onChange = (id: string) => {
departmentId.value = id
if(!id){

}
}

const onChangeTabs = (id) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<InputFile
v-else-if="getType(item) === 'file'"
v-model:value="modelRef[item.id]"
@change="(dt) => onChange(dt, item)"
/>
<a-input
v-else-if="getType(item) === 'link'"
Expand Down Expand Up @@ -74,6 +75,7 @@ const props = defineProps({
const formRef = ref();

const modelRef = reactive({});
const fileNames = reactive({});

watchEffect(() => {
Object.assign(modelRef, props?.value);
Expand All @@ -83,6 +85,15 @@ const getType = (item: any) => {
return item.expands?.businessType || item.type;
};

const onChange = (dt: any, item: any) => {
if(item.type === 'file'){
const __key = item.id.replace('location', 'name')
if(__key){
fileNames[__key] = dt?.name
}
}
}

const checkValue = (_rule: any, value: any, item: any) => {
const type = item.expands?.businessType || item?.type;
if (type === 'file') {
Expand Down Expand Up @@ -134,7 +145,7 @@ const onSave = () =>
formRef.value
?.validate()
.then((_data: any) => {
resolve(_data);
resolve({..._data, ...fileNames});
})
.catch(() => {
reject(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const props = defineProps({
value: {
type: String,
default: '',
},
}
});

const emit = defineEmits(['update:value']);
const emit = defineEmits(['update:value', 'change']);
const url = ref(props.value || undefined);
const loading = ref<boolean>(false);

Expand All @@ -59,6 +59,7 @@ const handleChange = (info: any) => {
loading.value = false;
const result = info.file.response?.result.accessUrl;
emit('update:value', result);
emit('change', {name: info.file.response?.result?.name, url: result});
}
};

Expand All @@ -76,6 +77,7 @@ const handleBeforeUpload = (file: any) => {

const onChange = (e: any) => {
emit('update:value', e.target.value);
emit('change', {name: '', url: e.target.value});
};

watch(() => props.value, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/views/system/User/components/EditUserDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const handleData = (data: string[], newData: string[], key: string) => {

const onChange = (value: string[]) => {
const arr = (value || []).map(i => {
return positionsMap.get(i)
return positionsMap.get(i) || i
})

const roles = map(flatten(map(arr, 'roles')), 'id').filter(i => i);
Expand Down