diff --git a/backend/dvadmin/system/views/dictionary.py b/backend/dvadmin/system/views/dictionary.py
index d28ef06..0dcc47c 100644
--- a/backend/dvadmin/system/views/dictionary.py
+++ b/backend/dvadmin/system/views/dictionary.py
@@ -54,21 +54,17 @@ class DictionaryViewSet(CustomModelViewSet):
extra_filter_class = []
search_fields = ['label']
- def list(self,request):
- """懒加载"""
- params = request.query_params
+ def get_queryset(self):
+ params = self.request.query_params
parent = params.get('parent', None)
if params:
if parent:
queryset = self.queryset.filter(status=1, parent=parent)
else:
- queryset = self.queryset.filter(status=1)
+ queryset = self.queryset.filter(status=1, parent__isnull=True)
else:
queryset = self.queryset.filter(status=1, parent__isnull=True)
- queryset = self.filter_queryset(queryset)
- serializer = DictionarySerializer(queryset, many=True, request=request)
- data = serializer.data
- return SuccessResponse(data=data)
+ return queryset
class InitDictionaryViewSet(APIView):
diff --git a/web/src/views/system/dictionary/crud.tsx b/web/src/views/system/dictionary/crud.tsx
index 2d09912..e994f06 100644
--- a/web/src/views/system/dictionary/crud.tsx
+++ b/web/src/views/system/dictionary/crud.tsx
@@ -1,13 +1,13 @@
import * as api from './api';
import { dict, PageQuery, AddReq, DelReq, EditReq, CrudExpose, CrudOptions } from '@fast-crud/fast-crud';
import { dictionary } from '/@/utils/dictionary';
-import {ref} from 'vue';
+import {nextTick, ref} from 'vue';
interface CreateCrudOptionsTypes {
crudOptions: CrudOptions;
}
-export const createCrudOptions = function ({ crudExpose, subDictRef,showSub }: { crudExpose: CrudExpose; subDictRef: any,showSub:any }): CreateCrudOptionsTypes {
+export const createCrudOptions = function ({ crudExpose, subDictRef }: { crudExpose: CrudExpose; subDictRef: any }): CreateCrudOptionsTypes {
const pageRequest = async (query: PageQuery) => {
return await api.GetList(query);
};
@@ -42,10 +42,12 @@ export const createCrudOptions = function ({ crudExpose, subDictRef,showSub }: {
//@ts-ignore
click: (context: any) => {
const {row} = context
- console.log(subDictRef.value.crudBinding)
- // showSub.value = true
- subDictRef.value.currentRow = row
subDictRef.value.drawer = true;
+ nextTick(()=>{
+ subDictRef.value.setSearchFormData({ form: { parent: row.id } });
+ subDictRef.value.doRefresh();
+ })
+
},
},
diff --git a/web/src/views/system/dictionary/index.vue b/web/src/views/system/dictionary/index.vue
index dd0af7a..715bf35 100644
--- a/web/src/views/system/dictionary/index.vue
+++ b/web/src/views/system/dictionary/index.vue
@@ -1,7 +1,7 @@
-
+
@@ -14,10 +14,6 @@ import subDict from './subDict/index.vue';
//字典配置ref
const subDictRef = ref();
-
-const rowId: Ref = ref(0);
-
-defineExpose({ subDictRef, rowId });
// crud组件的ref
const crudRef = ref();
// crud 配置的ref
diff --git a/web/src/views/system/dictionary/subDict/crud.tsx b/web/src/views/system/dictionary/subDict/crud.tsx
index 1364a23..27828ab 100644
--- a/web/src/views/system/dictionary/subDict/crud.tsx
+++ b/web/src/views/system/dictionary/subDict/crud.tsx
@@ -7,7 +7,7 @@ interface CreateCrudOptionsTypes {
crudOptions: CrudOptions;
}
-export const createCrudOptions = function ({ crudExpose,currentRow }: { crudExpose: CrudExpose,currentRow:any }): CreateCrudOptionsTypes {
+export const createCrudOptions = function ({ crudExpose }: { crudExpose: CrudExpose }): CreateCrudOptionsTypes {
const pageRequest = async (query: PageQuery) => {
return await api.GetList(query);
};
diff --git a/web/src/views/system/dictionary/subDict/index.vue b/web/src/views/system/dictionary/subDict/index.vue
index 343af27..94bbeab 100644
--- a/web/src/views/system/dictionary/subDict/index.vue
+++ b/web/src/views/system/dictionary/subDict/index.vue
@@ -7,7 +7,7 @@