优化去除dept_name_all

v2.x
李强 2023-03-28 21:52:46 +08:00
parent 87ac505183
commit 9ff0d19c0d
2 changed files with 3 additions and 9 deletions

View File

@ -33,7 +33,6 @@ class UserSerializer(CustomModelSerializer):
"""
dept_name = serializers.CharField(source='dept.name', read_only=True)
role_info = DynamicSerializerMethodField()
dept_name_all = serializers.SerializerMethodField()
class Meta:
model = Users
@ -43,11 +42,6 @@ class UserSerializer(CustomModelSerializer):
"post": {"required": False},
}
def get_dept_name_all(self, instance):
dept_name_all = recursion(instance.dept, "parent", "name")
dept_name_all.reverse()
return "/".join(dept_name_all)
def get_role_info(self, instance, parsed_query):
roles = instance.role.all()
# You can do what ever you want in here

View File

@ -2,15 +2,15 @@ import { request } from '@/api/service'
import util from '@/libs/util'
export const crudOptions = (vm) => {
util.filterParams(vm, ['dept_name', 'role_info{name}', 'dept_name_all'])
// util.filterParams(vm, ['dept_name', 'role_info{name}', 'dept_name_all'])
return {
pageOptions: {
compact: true
},
options: {
height: '100%',
// tableType: 'vxe-table',
//rowKey: true,
// tableType: 'vxe-table',
// rowKey: true,
rowId: 'id'
},
selectionRow: {