fix issue

pull/330/head
vapao 2021-03-31 22:58:46 +08:00
parent 95a76f133a
commit ae40c8581d
2 changed files with 6 additions and 25 deletions

View File

@ -1,18 +0,0 @@
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
# Copyright: (c) <spug.dev@gmail.com>
# 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 来代替!'))

View File

@ -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('')
}