取消
@@ -81,7 +84,8 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
const defaultOrg = {
id: null,
name: '',
- pid: null
+ pid: null,
+ sort:1
}
export default {
components: { Treeselect },
@@ -155,10 +159,7 @@ export default {
.then(async() => {
await deleteOrg(scope.row.id)
this.getList()
- this.$message({
- type: 'success',
- message: '成功删除!'
- })
+ this.$message.success('成功')
})
.catch(err => {
console.error(err)
@@ -172,12 +173,7 @@ export default {
updateOrg(this.org.id, this.org).then(() => {
this.getList()
this.dialogVisible = false
- this.$notify({
- title: '成功',
- message: '编辑成功',
- type: 'success',
- duration: 2000
- })
+ this.$message.success('成功')
})
} else {
createOrg(this.org).then(res => {
@@ -185,12 +181,7 @@ export default {
// this.tableData.unshift(this.org)
this.getList()
this.dialogVisible = false
- this.$notify({
- title: '成功',
- message: '新增成功',
- type: 'success',
- duration: 2000
- })
+ this.$message.success('成功')
})
}
} else {
diff --git a/client/src/views/system/perm.vue b/client/src/views/system/perm.vue
index ce17537..450c1aa 100644
--- a/client/src/views/system/perm.vue
+++ b/client/src/views/system/perm.vue
@@ -167,10 +167,7 @@ export default {
.then(async() => {
await deletePerm(scope.row.id)
this.getList()
- this.$message({
- type: 'success',
- message: '成功删除!'
- })
+ this.$message.success('成功')
})
.catch(err => {
console.error(err)
@@ -184,12 +181,7 @@ export default {
updatePerm(this.perm.id, this.perm).then(() => {
this.getList()
this.dialogVisible = false
- this.$notify({
- title: '成功',
- message: '编辑成功',
- type: 'success',
- duration: 2000
- })
+ this.$message.success('成功')
})
} else {
createPerm(this.perm).then(res => {
@@ -197,12 +189,7 @@ export default {
// this.tableData.unshift(this.perm)
this.getList()
this.dialogVisible = false
- this.$notify({
- title: '成功',
- message: '新增成功',
- type: 'success',
- duration: 2000
- })
+ this.$message.success('成功')
})
}
} else {
diff --git a/client/src/views/system/role.vue b/client/src/views/system/role.vue
index 016bf24..edc23fe 100644
--- a/client/src/views/system/role.vue
+++ b/client/src/views/system/role.vue
@@ -218,10 +218,7 @@ export default {
.then(async() => {
await deleteRole(row.id)
this.tableData.splice($index, 1)
- this.$message({
- type: 'success',
- message: '成功删除!'
- })
+ this.$message.success('成功')
})
.catch(err => {
console.error(err)
@@ -254,15 +251,7 @@ export default {
const { desc, name } = this.role
this.dialogVisible = false
- this.$notify({
- title: '成功',
- dangerouslyUseHTMLString: true,
- message: `
-
角色名: ${name}
-
角色描述: ${desc}
- `,
- type: 'success'
- })
+ this.$message.success('成功')
}
}
}
diff --git a/client/src/views/system/user.vue b/client/src/views/system/user.vue
index c690684..dbbdc44 100644
--- a/client/src/views/system/user.vue
+++ b/client/src/views/system/user.vue
@@ -329,10 +329,7 @@ export default {
.then(async () => {
await deleteUser(scope.row.id);
this.userList.splice(scope.row.index, 1);
- this.$message({
- type: "success",
- message: "成功删除!"
- });
+ this.$message.success('成功')
})
.catch(err => {
console.error(err);
@@ -347,12 +344,7 @@ export default {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
- this.$notify({
- title: "成功",
- message: "编辑成功",
- type: "success",
- duration: 2000
- });
+ this.$message.success('成功')
}
});
} else {
@@ -360,12 +352,7 @@ export default {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
- this.$notify({
- title: "成功",
- message: "新增成功",
- type: "success",
- duration: 2000
- });
+ this.$message.success('成功')
}
});
}
diff --git a/server/apps/system/migrations/0005_organization_sort.py b/server/apps/system/migrations/0005_organization_sort.py
new file mode 100644
index 0000000..c8d37f5
--- /dev/null
+++ b/server/apps/system/migrations/0005_organization_sort.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.0.7 on 2020-09-25 06:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('system', '0004_message'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='organization',
+ name='sort',
+ field=models.IntegerField(default=1, verbose_name='排序'),
+ ),
+ ]
diff --git a/server/apps/system/models.py b/server/apps/system/models.py
index accc014..8f7ab35 100644
--- a/server/apps/system/models.py
+++ b/server/apps/system/models.py
@@ -64,7 +64,7 @@ class Organization(SoftModel):
choices=organization_type_choices, default='部门')
pid = models.ForeignKey('self', null=True, blank=True,
on_delete=models.SET_NULL, verbose_name='父')
-
+ sort = models.IntegerField('排序', default=1)
class Meta:
verbose_name = '组织架构'
verbose_name_plural = verbose_name
diff --git a/server/apps/system/views.py b/server/apps/system/views.py
index 0be077b..8b33a33 100644
--- a/server/apps/system/views.py
+++ b/server/apps/system/views.py
@@ -166,7 +166,7 @@ class PermissionViewSet(ModelViewSet):
pagination_class = None
search_fields = ['name']
ordering_fields = ['sort']
- ordering = 'id'
+ ordering = 'sort'
class OrganizationViewSet(ModelViewSet):
@@ -178,9 +178,9 @@ class OrganizationViewSet(ModelViewSet):
queryset = Organization.objects.all()
serializer_class = OrganizationSerializer
pagination_class = None
- search_fields = ['^name', '^method']
- ordering_fields = ['id']
- ordering = 'id'
+ search_fields = ['name']
+ ordering_fields = ['sort']
+ ordering = ['sort', 'pk']
class RoleViewSet(ModelViewSet):