mirror of https://github.com/openspug/spug
fix issue
parent
95a76f133a
commit
ae40c8581d
|
@ -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 来代替!'))
|
|
|
@ -25,7 +25,6 @@ export default observer(function () {
|
||||||
const [draggable, setDraggable] = useState(false);
|
const [draggable, setDraggable] = useState(false);
|
||||||
const [action, setAction] = useState('');
|
const [action, setAction] = useState('');
|
||||||
const [expands, setExpands] = useState([]);
|
const [expands, setExpands] = useState([]);
|
||||||
const [treeData, setTreeData] = useState();
|
|
||||||
const [bakTreeData, setBakTreeData] = useState();
|
const [bakTreeData, setBakTreeData] = useState();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -67,19 +66,19 @@ export default observer(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAddRoot() {
|
function handleAddRoot() {
|
||||||
setBakTreeData(lds.cloneDeep(treeData));
|
setBakTreeData(lds.cloneDeep(store.treeData));
|
||||||
const current = {key: 0, parent_id: 0, title: ''};
|
const current = {key: 0, parent_id: 0, title: ''};
|
||||||
treeData.unshift(current);
|
store.treeData.unshift(current);
|
||||||
setTreeData(lds.cloneDeep(treeData));
|
store.treeData = lds.cloneDeep(store.treeData);
|
||||||
store.group = current;
|
store.group = current;
|
||||||
setAction('edit')
|
setAction('edit')
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
setBakTreeData(lds.cloneDeep(treeData));
|
setBakTreeData(lds.cloneDeep(store.treeData));
|
||||||
const current = {key: 0, parent_id: store.group.key, title: ''};
|
const current = {key: 0, parent_id: store.group.key, title: ''};
|
||||||
store.group.children.unshift(current);
|
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]);
|
if (!expands.includes(store.group.key)) setExpands([store.group.key, ...expands]);
|
||||||
store.group = current;
|
store.group = current;
|
||||||
setAction('edit')
|
setAction('edit')
|
||||||
|
@ -95,7 +94,7 @@ export default observer(function () {
|
||||||
|
|
||||||
function handleBlur() {
|
function handleBlur() {
|
||||||
if (store.group.key === 0) {
|
if (store.group.key === 0) {
|
||||||
setTreeData(bakTreeData)
|
store.treeData = bakTreeData
|
||||||
}
|
}
|
||||||
setAction('')
|
setAction('')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue