From a0ba9644781aaa2159b3a3dae9fd3d5b7859e2d6 Mon Sep 17 00:00:00 2001 From: Angelo Date: Wed, 25 May 2022 17:30:05 +0800 Subject: [PATCH] fix(dict): fixed system dictionary data's sync error --- backend/dvadmin/system/models.py | 5 +++ web/src/views/system/dept/crud.js | 1 + web/src/views/system/dictionary/index.vue | 39 +++++++++++-------- .../system/dictionary/subDictionary/index.vue | 7 +++- web/src/views/system/menu/crud.js | 4 +- 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/backend/dvadmin/system/models.py b/backend/dvadmin/system/models.py index b54ac27..a162bb1 100644 --- a/backend/dvadmin/system/models.py +++ b/backend/dvadmin/system/models.py @@ -320,6 +320,11 @@ class SystemConfig(CoreModel): def save(self, force_insert=False, force_update=False, using=None, update_fields=None): super().save(force_insert, force_update, using, update_fields) dispatch.refresh_system_config() # 有更新则刷新系统配置 + + def delete(self, using=None, keep_parents=False): + res = super().delete(using, keep_parents) + dispatch.refresh_dictionary() + return res class LoginLog(CoreModel): diff --git a/web/src/views/system/dept/crud.js b/web/src/views/system/dept/crud.js index 232386c..7357049 100644 --- a/web/src/views/system/dept/crud.js +++ b/web/src/views/system/dept/crud.js @@ -7,6 +7,7 @@ export const crudOptions = (vm) => { }, options: { tableType: 'vxe-table', + stripe: false, rowKey: true, // 必须设置,true or false rowId: 'id', height: '100%', // 表格高度100%, 使用toolbar必须设置 diff --git a/web/src/views/system/dictionary/index.vue b/web/src/views/system/dictionary/index.vue index 59872b6..8054851 100644 --- a/web/src/views/system/dictionary/index.vue +++ b/web/src/views/system/dictionary/index.vue @@ -1,15 +1,12 @@ - @@ -80,6 +81,10 @@ export default { dictionaryConfigure (scope) { this.drawer = true this.dictionaryRow = scope.row + }, + doAfterRowChange (row) { + this.doRefresh({ from: 'afterRowChange' }) + this.$store.dispatch('d2admin/dictionary/load') } } } diff --git a/web/src/views/system/dictionary/subDictionary/index.vue b/web/src/views/system/dictionary/subDictionary/index.vue index 649c068..684cd6b 100644 --- a/web/src/views/system/dictionary/subDictionary/index.vue +++ b/web/src/views/system/dictionary/subDictionary/index.vue @@ -44,8 +44,7 @@ export default { } }, data () { - return { - } + return {} }, methods: { getCrudOptions () { @@ -70,6 +69,10 @@ export default { }, delRequest (row) { return api.DelObj(row.id) + }, + doAfterRowChange (row) { + this.doRefresh({ from: 'afterRowChange' }) + this.$store.dispatch('d2admin/dictionary/load') } } } diff --git a/web/src/views/system/menu/crud.js b/web/src/views/system/menu/crud.js index 956c58b..2bbe558 100644 --- a/web/src/views/system/menu/crud.js +++ b/web/src/views/system/menu/crud.js @@ -170,7 +170,7 @@ export const crudOptions = (vm) => { } } }, - width: 180, + minWidth: 180, type: 'input', form: { rules: [ // 表单校验规则 @@ -389,7 +389,7 @@ export const crudOptions = (vm) => { search: { disabled: false }, - width: 50, + width: 60, type: 'radio', dict: { data: vm.dictionary('button_whether_bool')