功能变化:
1..优化部门管理相关接口;
This commit is contained in:
@@ -167,19 +167,13 @@
|
|||||||
"method": 0
|
"method": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "查询所有",
|
"name": "获取所有部门",
|
||||||
"value": "dept:SearchAll",
|
"value": "dept:SearchAll",
|
||||||
"api": "/api/system/dept/all_dept/",
|
"api": "/api/system/dept/all_dept/",
|
||||||
"method": 0
|
"method": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "懒加载查询所有",
|
"name": "部门顶部信息",
|
||||||
"value": "dept:LazySearchAll",
|
|
||||||
"api": "/api/system/dept/dept_lazy_tree/",
|
|
||||||
"method": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "头信息",
|
|
||||||
"value": "dept:HeaderInfo",
|
"value": "dept:HeaderInfo",
|
||||||
"api": "/api/system/dept/dept_info/",
|
"api": "/api/system/dept/dept_info/",
|
||||||
"method": 0
|
"method": 0
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from rest_framework.decorators import action
|
|||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
|
||||||
from dvadmin.system.models import Dept, RoleMenuButtonPermission, Users
|
from dvadmin.system.models import Dept, RoleMenuButtonPermission, Users
|
||||||
|
from dvadmin.utils.filters import DataLevelPermissionsFilter
|
||||||
from dvadmin.utils.json_response import DetailResponse, SuccessResponse, ErrorResponse
|
from dvadmin.utils.json_response import DetailResponse, SuccessResponse, ErrorResponse
|
||||||
from dvadmin.utils.serializers import CustomModelSerializer
|
from dvadmin.utils.serializers import CustomModelSerializer
|
||||||
from dvadmin.utils.viewset import CustomModelViewSet
|
from dvadmin.utils.viewset import CustomModelViewSet
|
||||||
@@ -125,17 +126,6 @@ class DeptViewSet(CustomModelViewSet):
|
|||||||
return SuccessResponse(data=data)
|
return SuccessResponse(data=data)
|
||||||
|
|
||||||
@action(methods=["GET"], detail=False, permission_classes=[IsAuthenticated])
|
@action(methods=["GET"], detail=False, permission_classes=[IsAuthenticated])
|
||||||
def dept_lazy_tree(self, request, *args, **kwargs):
|
|
||||||
parent = self.request.query_params.get('parent')
|
|
||||||
is_superuser = request.user.is_superuser
|
|
||||||
if is_superuser:
|
|
||||||
queryset = Dept.objects.values('id', 'name', 'parent')
|
|
||||||
else:
|
|
||||||
queryset = Dept.objects.values('id', 'name', 'parent')
|
|
||||||
queryset = self.filter_queryset(queryset)
|
|
||||||
return DetailResponse(data=queryset, msg="获取成功")
|
|
||||||
|
|
||||||
@action(methods=["GET"], detail=False, permission_classes=[IsAuthenticated], extra_filter_class=[])
|
|
||||||
def all_dept(self, request, *args, **kwargs):
|
def all_dept(self, request, *args, **kwargs):
|
||||||
queryset = self.filter_queryset(self.get_queryset())
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
data = queryset.filter(status=True).order_by('sort').values('name', 'id', 'parent')
|
data = queryset.filter(status=True).order_by('sort').values('name', 'id', 'parent')
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ class UserUpdateSerializer(CustomModelSerializer):
|
|||||||
"""
|
"""
|
||||||
更改激活状态
|
更改激活状态
|
||||||
"""
|
"""
|
||||||
print(111, value)
|
|
||||||
if value:
|
if value:
|
||||||
self.initial_data["login_error_count"] = 0
|
self.initial_data["login_error_count"] = 0
|
||||||
return value
|
return value
|
||||||
@@ -407,11 +406,11 @@ class UserViewSet(CustomModelViewSet):
|
|||||||
queryset = self.filter_queryset(self.get_queryset())
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
else:
|
else:
|
||||||
queryset = self.filter_queryset(self.get_queryset())
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
print(queryset.values('id','name','dept__id'))
|
# print(queryset.values('id','name','dept__id'))
|
||||||
page = self.paginate_queryset(queryset)
|
page = self.paginate_queryset(queryset)
|
||||||
if page is not None:
|
if page is not None:
|
||||||
serializer = self.get_serializer(page, many=True, request=request)
|
serializer = self.get_serializer(page, many=True, request=request)
|
||||||
print(serializer.data)
|
# print(serializer.data)
|
||||||
return self.get_paginated_response(serializer.data)
|
return self.get_paginated_response(serializer.data)
|
||||||
serializer = self.get_serializer(queryset, many=True, request=request)
|
serializer = self.get_serializer(queryset, many=True, request=request)
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
import axios from 'axios'
|
|
||||||
|
|
||||||
import VFormDesigner from '@/components/form-designer/index.vue'
|
|
||||||
import VFormRender from '@/components/form-render/index.vue'
|
|
||||||
|
|
||||||
import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js'
|
|
||||||
import {registerIcon} from '@/utils/el-icons'
|
|
||||||
import 'virtual:svg-icons-register'
|
|
||||||
import '@/iconfont/iconfont.css'
|
|
||||||
|
|
||||||
import ContainerWidgets from '@/components/form-designer/form-widget/container-widget/index'
|
|
||||||
import ContainerItems from '@/components/form-render/container-item/index'
|
|
||||||
|
|
||||||
import { addDirective } from '@/utils/directive'
|
|
||||||
import { installI18n } from '@/utils/i18n'
|
|
||||||
import { loadExtension } from '@/extension/extension-loader'
|
|
||||||
|
|
||||||
|
|
||||||
VFormDesigner.install = function (app) {
|
|
||||||
addDirective(app)
|
|
||||||
installI18n(app)
|
|
||||||
loadExtension(app)
|
|
||||||
|
|
||||||
app.use(ContainerWidgets)
|
|
||||||
app.use(ContainerItems)
|
|
||||||
|
|
||||||
registerIcon(app)
|
|
||||||
app.component('draggable', Draggable)
|
|
||||||
app.component(VFormDesigner.name, VFormDesigner)
|
|
||||||
}
|
|
||||||
|
|
||||||
VFormRender.install = function (app) {
|
|
||||||
installI18n(app)
|
|
||||||
loadExtension(app)
|
|
||||||
|
|
||||||
app.use(ContainerItems)
|
|
||||||
|
|
||||||
registerIcon(app)
|
|
||||||
app.component(VFormRender.name, VFormRender)
|
|
||||||
}
|
|
||||||
|
|
||||||
const components = [
|
|
||||||
VFormDesigner,
|
|
||||||
VFormRender
|
|
||||||
]
|
|
||||||
|
|
||||||
const install = (app) => {
|
|
||||||
addDirective(app)
|
|
||||||
installI18n(app)
|
|
||||||
loadExtension(app)
|
|
||||||
|
|
||||||
app.use(ContainerWidgets)
|
|
||||||
app.use(ContainerItems)
|
|
||||||
|
|
||||||
registerIcon(app)
|
|
||||||
app.component('draggable', Draggable)
|
|
||||||
|
|
||||||
components.forEach(component => {
|
|
||||||
app.component(component.name, component)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.axios = axios
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.Vue) { /* script<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ֵaxios<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
||||||
//window.axios = axios
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
install,
|
|
||||||
VFormDesigner,
|
|
||||||
VFormRender
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
import DVAFormDesigner from './components/DVAFormDesigner.vue'
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>浽һ<E6B5BD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
const components = [
|
|
||||||
DVAFormDesigner
|
|
||||||
]
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD> install <20><><EFBFBD><EFBFBD>
|
|
||||||
const install = function (Vue) {
|
|
||||||
|
|
||||||
if (install.installed) return
|
|
||||||
install.installed = true
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>ע<EFBFBD><D7A2>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
components.map(component => {
|
|
||||||
Vue.component(component.name, component) //component.name <20>˴<EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>vue<75>ļ<EFBFBD><C4BC>е<EFBFBD> name <20><><EFBFBD><EFBFBD>
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.Vue) {
|
|
||||||
install(window.Vue)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD>һ<EFBFBD><D2BB> install <20><><EFBFBD><EFBFBD>
|
|
||||||
install,
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|
||||||
...components
|
|
||||||
}
|
|
||||||
@@ -98,7 +98,6 @@ const getData = () => {
|
|||||||
const result = XEUtils.toArrayTree(responseData, {
|
const result = XEUtils.toArrayTree(responseData, {
|
||||||
parentKey: 'parent',
|
parentKey: 'parent',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
strict: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
data.value = result;
|
data.value = result;
|
||||||
|
|||||||
Reference in New Issue
Block a user