fix(dict): fixed system dictionary data's sync error

pull/60/head
Angelo 2022-05-25 17:30:05 +08:00
parent 231437fae1
commit a0ba964478
5 changed files with 35 additions and 21 deletions

View File

@ -321,6 +321,11 @@ class SystemConfig(CoreModel):
super().save(force_insert, force_update, using, update_fields) super().save(force_insert, force_update, using, update_fields)
dispatch.refresh_system_config() # 有更新则刷新系统配置 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): class LoginLog(CoreModel):
LOGIN_TYPE_CHOICES = ( LOGIN_TYPE_CHOICES = (

View File

@ -7,6 +7,7 @@ export const crudOptions = (vm) => {
}, },
options: { options: {
tableType: 'vxe-table', tableType: 'vxe-table',
stripe: false,
rowKey: true, // 必须设置true or false rowKey: true, // 必须设置true or false
rowId: 'id', rowId: 'id',
height: '100%', // 表格高度100%, 使用toolbar必须设置 height: '100%', // 表格高度100%, 使用toolbar必须设置

View File

@ -1,15 +1,12 @@
<!--
* @创建文件时间: 2021-06-01 22:41:21
* @Auther: 猿小天
* @最后修改人: 猿小天
* @最后修改时间: 2021-08-09 20:27:09
* 联系Qq:1638245306
* @文件介绍: 字典管理
-->
<template> <template>
<d2-container :class="{ 'page-compact': crud.pageOptions.compact }"> <d2-container :class="{ 'page-compact': crud.pageOptions.compact }">
<!-- <template slot="header">测试页面1</template>--> <!-- <template slot="header">测试页面1</template>-->
<d2-crud-x ref="d2Crud" v-bind="_crudProps" v-on="_crudListeners" @dictionaryConfigure="dictionaryConfigure"> <d2-crud-x
ref="d2Crud"
v-bind="_crudProps"
v-on="_crudListeners"
@dictionaryConfigure="dictionaryConfigure"
>
<div slot="header"> <div slot="header">
<crud-search <crud-search
ref="search" ref="search"
@ -30,14 +27,18 @@
/> />
</div> </div>
</d2-crud-x> </d2-crud-x>
<el-drawer <el-drawer :visible.sync="drawer" :size="700">
:visible.sync="drawer" <div slot="title">
:size="700"> <span>字典列表</span>
<div slot="title"> <el-tag size="small" style="margin-left: 10px">{{
<span>字典列表</span> dictionaryRow.label
<el-tag size="small" style="margin-left: 10px">{{dictionaryRow.label}}</el-tag> }}</el-tag>
</div> </div>
<sub-dictionary style="margin-top: 80px;margin-left: 10px" :dictionaryRow="dictionaryRow"></sub-dictionary> <sub-dictionary
style="margin-top: 80px; margin-left: 10px"
:dictionaryRow="dictionaryRow"
>
</sub-dictionary>
</el-drawer> </el-drawer>
</d2-container> </d2-container>
</template> </template>
@ -80,6 +81,10 @@ export default {
dictionaryConfigure (scope) { dictionaryConfigure (scope) {
this.drawer = true this.drawer = true
this.dictionaryRow = scope.row this.dictionaryRow = scope.row
},
doAfterRowChange (row) {
this.doRefresh({ from: 'afterRowChange' })
this.$store.dispatch('d2admin/dictionary/load')
} }
} }
} }

View File

@ -44,8 +44,7 @@ export default {
} }
}, },
data () { data () {
return { return {}
}
}, },
methods: { methods: {
getCrudOptions () { getCrudOptions () {
@ -70,6 +69,10 @@ export default {
}, },
delRequest (row) { delRequest (row) {
return api.DelObj(row.id) return api.DelObj(row.id)
},
doAfterRowChange (row) {
this.doRefresh({ from: 'afterRowChange' })
this.$store.dispatch('d2admin/dictionary/load')
} }
} }
} }

View File

@ -170,7 +170,7 @@ export const crudOptions = (vm) => {
} }
} }
}, },
width: 180, minWidth: 180,
type: 'input', type: 'input',
form: { form: {
rules: [ // 表单校验规则 rules: [ // 表单校验规则
@ -389,7 +389,7 @@ export const crudOptions = (vm) => {
search: { search: {
disabled: false disabled: false
}, },
width: 50, width: 60,
type: 'radio', type: 'radio',
dict: { dict: {
data: vm.dictionary('button_whether_bool') data: vm.dictionary('button_whether_bool')