From ae40c8581d79cbcee4b880799239de824c055d6a Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 31 Mar 2021 22:58:46 +0800 Subject: [PATCH] fix issue --- .../apps/account/management/commands/initdb.py | 18 ------------------ spug_web/src/pages/host/Group.js | 13 ++++++------- 2 files changed, 6 insertions(+), 25 deletions(-) delete mode 100644 spug_api/apps/account/management/commands/initdb.py diff --git a/spug_api/apps/account/management/commands/initdb.py b/spug_api/apps/account/management/commands/initdb.py deleted file mode 100644 index b5ec31b..0000000 --- a/spug_api/apps/account/management/commands/initdb.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug -# Copyright: (c) -# Released under the AGPL-3.0 License. -from django.core.management.base import BaseCommand -from django.core.management import execute_from_command_line -from django.conf import settings - - -class Command(BaseCommand): - help = '初始化数据库' - - def handle(self, *args, **options): - args = ['manage.py', 'makemigrations'] - apps = [x.split('.')[-1] for x in settings.INSTALLED_APPS if x.startswith('apps.')] - execute_from_command_line(args + apps) - execute_from_command_line(['manage.py', 'migrate']) - self.stdout.write(self.style.SUCCESS('初始化成功')) - self.stdout.write(self.style.WARNING('废弃警告,v3.0.0之后将会移除该命令,请使用 python manage.py updatedb 来代替!')) diff --git a/spug_web/src/pages/host/Group.js b/spug_web/src/pages/host/Group.js index 3c6b5d2..6b419bd 100644 --- a/spug_web/src/pages/host/Group.js +++ b/spug_web/src/pages/host/Group.js @@ -25,7 +25,6 @@ export default observer(function () { const [draggable, setDraggable] = useState(false); const [action, setAction] = useState(''); const [expands, setExpands] = useState([]); - const [treeData, setTreeData] = useState(); const [bakTreeData, setBakTreeData] = useState(); useEffect(() => { @@ -67,19 +66,19 @@ export default observer(function () { } function handleAddRoot() { - setBakTreeData(lds.cloneDeep(treeData)); + setBakTreeData(lds.cloneDeep(store.treeData)); const current = {key: 0, parent_id: 0, title: ''}; - treeData.unshift(current); - setTreeData(lds.cloneDeep(treeData)); + store.treeData.unshift(current); + store.treeData = lds.cloneDeep(store.treeData); store.group = current; setAction('edit') } function handleAdd() { - setBakTreeData(lds.cloneDeep(treeData)); + setBakTreeData(lds.cloneDeep(store.treeData)); const current = {key: 0, parent_id: store.group.key, title: ''}; store.group.children.unshift(current); - setTreeData(lds.cloneDeep(treeData)); + store.treeData = lds.cloneDeep(store.treeData); if (!expands.includes(store.group.key)) setExpands([store.group.key, ...expands]); store.group = current; setAction('edit') @@ -95,7 +94,7 @@ export default observer(function () { function handleBlur() { if (store.group.key === 0) { - setTreeData(bakTreeData) + store.treeData = bakTreeData } setAction('') }