Skip to content

Commit 86b9a50

Browse files
Tylerloggitee-org
authored andcommitted
!58 合并develop分支代码到master
- 修复自定义权限返回bug - 修复插件注册bug - 解决使用docker时,无日志打印bug - 其他bug修复
2 parents 34a8b8b + 46e5c81 commit 86b9a50

File tree

11 files changed

+45
-31
lines changed

11 files changed

+45
-31
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
- 社区:[戳我](https://bbs.django-vue-admin.com)👩‍👦‍👦
3838

39-
- QQ群号:812482043 <a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=fOdnHhC8DJlRHGYSnyhoB8P5rgogA6Vs&jump_from=webapi"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="django-vue-admin交流01群" title="django-vue-admin交流01群"></a>
39+
- QQ群号:687252418 点击链接加入群聊【dvadmin-Pro交流】:https://jq.qq.com/?_wv=1027&k=VSKYgRNn
4040

4141
- 二维码
4242

@@ -60,8 +60,8 @@ github地址:[https://github.com/dvadmin-pro/django-vue-admin-pro](https://git
6060
6. 🧑‍🍳操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
6161
7. 🧑‍🔧字典管理:对系统中经常使用的一些较为固定的数据进行维护。
6262
9. 📁附件管理:管理所有上传的和导出的文件和图片。
63-
10. 🦄~~定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。~~
64-
11. 🛒~~应用商店:通过插件化自定义需要使用的功能,即插即用~~
63+
10. 🦄定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。~~
64+
11. 🛒应用商店:通过插件化自定义需要使用的功能,即插即用~~
6565

6666

6767

backend/dvadmin/system/initialize.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def init_menu(self):
7878
{"id": "97b8fd88-0510-4db7-8d53-983a04843c4c", "name": "字典管理", "sort": 1, "web_path": "/dictionary",
7979
"icon": "clock-o", "parent_id": "54f769b0-3dff-416c-8102-e55ec44827cc", "component": "system/dictionary",
8080
"component_name": "dictionary"},
81-
{"id": "97b8fd88-0510-4db7-8d53-983a04844c4c", "name": "地区管理", "sort": 6, "web_path": "/area",
82-
"icon": "area-chart", "parent_id": "54f769b0-3dff-416c-8102-e55ec44827cc", "component": "system/area",
83-
"component_name": "dictionary"},
81+
{"id": "97b8fd88-0510-4db7-8d53-983a04844c4c", "name": "地区管理", "sort": 6, "web_path": "/areas",
82+
"icon": "area-chart", "parent_id": "54f769b0-3dff-416c-8102-e55ec44827cc", "component": "system/areas",
83+
"component_name": "areas"},
8484
{"id": "805390f3-a6e6-411e-9798-eebd34b76204", "name": "附件管理", "sort": 7, "web_path": "",
8585
"icon": "envelope", "parent_id": "54f769b0-3dff-416c-8102-e55ec44827cc", },
8686
{"id": "ac956a17-87d3-4b61-8f72-44a97b9fbcd1", "name": "图片管理", "sort": 1, "web_path": "/img",
@@ -103,8 +103,6 @@ def init_menu_button(self):
103103
"name": "编辑", "value": "Update", "api": "/api/system/button/{id}/", "method": 2},
104104
{"id": "04896a47-0f3a-4e2f-a111-bfe15f9e31c5", "menu_id": "56c3f341-4f46-4b04-9cfc-c8a14701707e",
105105
"name": "编辑", "value": "Update", "api": "/api/system/menu/{id}/", "method": 2},
106-
{"id": "0d931efc-2f80-418f-b4a0-5251f0a88f69", "menu_id": "4ba07859-8b73-4524-a1a6-bbff36d98337",
107-
"name": "新增", "value": "Create", "api": "/api/system/operation_log/", "method": 1},
108106
{"id": "10610c56-cec2-4774-9468-e1c763e59e70", "menu_id": "4236eb70-1558-43a0-9cf2-037230c547f9",
109107
"name": "新增", "value": "Create", "api": "/api/system/dept/", "method": 1},
110108
{"id": "140166e2-471e-455e-9dcd-05cebbbab95d", "menu_id": "15c9ebc5-d12f-470a-a560-938a7dc57570",
@@ -155,8 +153,6 @@ def init_menu_button(self):
155153
"name": "删除", "value": "Delete", "api": "/api/system/user/{id}/", "method": 3},
156154
{"id": "d22c0176-96e0-48b3-b81e-13443f306af5", "menu_id": "15c9ebc5-d12f-470a-a560-938a7dc57570",
157155
"name": "编辑", "value": "Update", "api": "/api/system/role/{id}/", "method": 2},
158-
{"id": "e6b93920-2236-46ec-841b-cff6f63ce788", "menu_id": "4ba07859-8b73-4524-a1a6-bbff36d98337",
159-
"name": "编辑", "value": "Update", "api": "/api/system/operation_log/{id}/", "method": 2},
160156
{"id": "fcbe4cec-cc2d-436d-92ba-023f8c9ad31c", "menu_id": "56c3f341-4f46-4b04-9cfc-c8a14701707e",
161157
"name": "单例", "value": "Retrieve", "api": "/api/system/menu/{id}/", "method": 0},
162158
{"id": "1a0c96cf-09a6-43b4-b08a-0c5b6e2f7bb8", "menu_id": "a607e820-36e5-45c0-aabf-85a8e4e2c7ac",
@@ -201,6 +197,16 @@ def init_menu_button(self):
201197
"name": "单例", "value": "Retrieve", "api": "/api/system/img/{id}/", "method": 0},
202198
{"id": "0e4e34d0-02bb-40f4-a9fd-621490ccb045", "menu_id": "28723f68-e470-493a-bbe7-7b759fe26674",
203199
"name": "删除", "value": "Delete", "api": "/api/system/img/{id}/", "method": 3},
200+
{"id": "0e4e34d0-03bb-40f4-a9fd-621490ccb041", "menu_id": "97b8fd88-0510-4db7-8d53-983a04844c4c",
201+
"name": "编辑", "value": "Update", "api": "/api/system/areas/{id}/", "method": 2},
202+
{"id": "0e4e34d0-04bb-40f4-a9fd-621490ccb042", "menu_id": "97b8fd88-0510-4db7-8d53-983a04844c4c",
203+
"name": "查询", "value": "Search", "api": "/api/system/areas/", "method": 0},
204+
{"id": "0e4e34d0-05bb-40f4-a9fd-621490ccb043", "menu_id": "97b8fd88-0510-4db7-8d53-983a04844c4c",
205+
"name": "新增", "value": "Create", "api": "/api/system/areas/", "method": 1},
206+
{"id": "0e4e34d0-06bb-40f4-a9fd-621490ccb044", "menu_id": "97b8fd88-0510-4db7-8d53-983a04844c4c",
207+
"name": "单例", "value": "Retrieve", "api": "/api/system/areas/{id}/", "method": 0},
208+
{"id": "0e4e34d0-07bb-40f4-a9fd-621490ccb045", "menu_id": "97b8fd88-0510-4db7-8d53-983a04844c4c",
209+
"name": "删除", "value": "Delete", "api": "/api/system/areas/{id}/", "method": 3},
204210
]
205211
self.save(MenuButton, self.menu_button_data, "菜单权限表")
206212

backend/dvadmin/system/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Users(AbstractUser, CoreModel):
2626
help_text="性别")
2727
post = models.ManyToManyField(to='Post', verbose_name='关联岗位', db_constraint=False, help_text="关联岗位")
2828
role = models.ManyToManyField(to='Role', verbose_name='关联角色', db_constraint=False, help_text="关联角色")
29-
dept = models.ForeignKey(to='Dept', verbose_name='所属部门', on_delete=models.CASCADE, db_constraint=False, null=True,
29+
dept = models.ForeignKey(to='Dept', verbose_name='所属部门', on_delete=models.PROTECT, db_constraint=False, null=True,
3030
blank=True, help_text="关联部门")
3131

3232
def set_password(self, raw_password):

backend/dvadmin/system/views/user.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ class UserViewSet(CustomModelViewSet):
9090
serializer_class = UserSerializer
9191
create_serializer_class = UserCreateSerializer
9292
update_serializer_class = UserUpdateSerializer
93-
permission_classes = []
93+
filter_fields = ['username','name','gender','is_active','dept']
94+
search_fields = ['username','name','gender','dept__name','role__name']
9495

9596
def user_info(self, request):
9697
"""获取当前用户信息"""

backend/dvadmin/utils/filters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def filter_queryset(self, request, queryset, view):
8282
dataScope_list = list(set(dataScope_list))
8383

8484
# 4. 只为仅本人数据权限时只返回过滤本人数据,并且部门为自己本部门(考虑到用户会变部门,只能看当前用户所在的部门数据)
85-
if dataScope_list == 0:
85+
if 0 in dataScope_list:
8686
return queryset.filter(creator=request.user, dept_belong_id=user_dept_id)
8787

8888
# 5. 自定数据权限 获取部门,根据部门过滤

backend/dvadmin/utils/permission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ def has_permission(self, request, view):
5959
valid = ValidationApi(api, item.get('permission__api'))
6060
if valid and (method == item.get('permission__method')):
6161
return True
62-
return True
62+
return False

backend/dvadmin/utils/serializers.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ def save(self, **kwargs):
5151

5252
def create(self, validated_data):
5353
if self.request:
54-
if self.modifier_field_id in self.fields.fields:
55-
validated_data[self.modifier_field_id] = self.get_request_user_id()
56-
if self.creator_field_id in self.fields.fields:
57-
validated_data[self.creator_field_id] = self.request.user
58-
if self.dept_belong_id_field_name in self.fields.fields and validated_data.get(
59-
self.dept_belong_id_field_name, None):
60-
validated_data[self.dept_belong_id_field_name] = getattr(self.request.user, 'dept_id', None)
54+
if str(self.request.user) != "AnonymousUser":
55+
if self.modifier_field_id in self.fields.fields:
56+
validated_data[self.modifier_field_id] = self.get_request_user_id()
57+
if self.creator_field_id in self.fields.fields:
58+
validated_data[self.creator_field_id] = self.request.user
59+
print( validated_data[self.creator_field_id])
60+
if self.dept_belong_id_field_name in self.fields.fields and not validated_data.get(
61+
self.dept_belong_id_field_name, None):
62+
validated_data[self.dept_belong_id_field_name] = getattr(self.request.user, 'dept_id', None)
6163
return super().create(validated_data)
6264

6365
def update(self, instance, validated_data):

backend/plugins/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_all_plugins():
2222
plugins_dict.update(dict(sorted(json.load(doc).items(), key=lambda x: x[1]['priority'], reverse=True)))
2323
else:
2424
print("未找到前端插件配置文件,请检查...")
25-
if os.path.exists(PLUGINS_WEB_YAML_PATH):
25+
if os.path.exists(PLUGINS_BACKEND_YAML_PATH):
2626
with open(PLUGINS_BACKEND_YAML_PATH, 'r', encoding='utf-8') as doc:
2727
# 进行排序
2828
plugins_dict.update(dict(sorted(json.load(doc).items(), key=lambda x: x[1]['priority'], reverse=True)))

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ services:
5252
depends_on:
5353
- dvadmin-pro-mysql
5454
environment:
55-
- DATABASE_HOST=dvadmin-pro-mysql
55+
PYTHONUNBUFFERED: 1
56+
DATABASE_HOST: dvadmin-pro-mysql
57+
TZ: Asia/Shanghai
5658
volumes:
5759
- ./backend:/backend
5860
- ./logs/log:/var/log
@@ -76,7 +78,9 @@ services:
7678
# depends_on:
7779
# - dvadmin-pro-mysql
7880
# environment:
79-
# - DATABASE_HOST=dvadmin-pro-mysql
81+
# PYTHONUNBUFFERED: 1
82+
# DATABASE_HOST: dvadmin-pro-mysql
83+
# TZ: Asia/Shanghai
8084
# volumes:
8185
# - ./backend:/backend
8286
# - ./logs/log:/var/log

web/src/api/service.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { get } from 'lodash'
44
import util from '@/libs/util'
55
import { dataNotFound, errorCreate, errorLog } from './tools'
66
import router from '@/router'
7-
7+
import qs from 'qs'
88
/**
99
* @description 创建请求实例
1010
*/
1111
axios.defaults.retry = 1
1212
axios.defaults.retryDelay = 1000
1313

14-
export function getErrorMessage (msg) {
14+
export function getErrorMessage(msg) {
1515
if (typeof msg === 'string') {
1616
return msg
1717
}
@@ -35,11 +35,12 @@ export function getErrorMessage (msg) {
3535
}
3636
return msg
3737
}
38-
function createService () {
38+
function createService() {
3939
// 创建一个 axios 实例
4040
const service = axios.create({
4141
baseURL: process.env.VUE_APP_API_URL,
42-
timeout: 20000
42+
timeout: 20000,
43+
paramsSerializer: (params) => qs.stringify(params, { indices: false }),
4344
})
4445
// 请求拦截
4546
service.interceptors.request.use(
@@ -173,7 +174,7 @@ function createService () {
173174
* @description 创建请求方法
174175
* @param {Object} service axios 实例
175176
*/
176-
function createRequestFunction (service) {
177+
function createRequestFunction(service) {
177178
// 校验是否为租户模式。租户模式把域名替换成 域名 加端口
178179
return function (config) {
179180
const token = util.cookies.get('token')

0 commit comments

Comments
 (0)