优化去除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) dept_name = serializers.CharField(source='dept.name', read_only=True)
role_info = DynamicSerializerMethodField() role_info = DynamicSerializerMethodField()
dept_name_all = serializers.SerializerMethodField()
class Meta: class Meta:
model = Users model = Users
@ -43,11 +42,6 @@ class UserSerializer(CustomModelSerializer):
"post": {"required": False}, "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): def get_role_info(self, instance, parsed_query):
roles = instance.role.all() roles = instance.role.all()
# You can do what ever you want in here # You can do what ever you want in here

View File

@ -2,7 +2,7 @@ import { request } from '@/api/service'
import util from '@/libs/util' import util from '@/libs/util'
export const crudOptions = (vm) => { 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 { return {
pageOptions: { pageOptions: {
compact: true compact: true
@ -10,7 +10,7 @@ export const crudOptions = (vm) => {
options: { options: {
height: '100%', height: '100%',
// tableType: 'vxe-table', // tableType: 'vxe-table',
//rowKey: true, // rowKey: true,
rowId: 'id' rowId: 'id'
}, },
selectionRow: { selectionRow: {