refactor:优化后台规则管理细节

This commit is contained in:
妙码生花 2024-03-02 22:07:19 +08:00
parent da3e29700c
commit c30e5e9bfe
4 changed files with 18 additions and 2 deletions

View File

@ -14,7 +14,7 @@
<Table ref="tableRef" :pagination="false" />
<!-- 表单 -->
<PopupForm ref="formRef" />
<PopupForm ref="formRef" :key="baTable.table.extend!.popupFormKey" />
</div>
</template>
@ -30,6 +30,7 @@ import { useI18n } from 'vue-i18n'
import { cloneDeep } from 'lodash-es'
import { getArrayKey } from '/@/utils/common'
import { useAdminInfo } from '/@/stores/adminInfo'
import { uuid } from '/@/utils/random'
defineOptions({
name: 'auth/group',
@ -61,6 +62,9 @@ const baTable: baTableClass = new baTableClass(
{ label: t('Create time'), prop: 'create_time', align: 'center', width: '160', render: 'datetime' },
{ label: t('Operate'), align: 'center', width: '130', render: 'buttons', buttons: defaultOptButtons(['edit', 'delete']) },
],
extend: {
popupFormKey: uuid(),
},
},
{
defaultItems: {
@ -119,6 +123,9 @@ const baTable: baTableClass = new baTableClass(
onTableDblclick: ({ row }) => {
return baTable.table.extend!['adminGroup'].indexOf(row.id) === -1
},
toggleForm() {
baTable.table.extend!.popupFormKey = uuid()
},
},
{
getIndex: ({ res }) => {

View File

@ -57,6 +57,7 @@
node-key="id"
:props="{ children: 'children', label: 'title', class: treeNodeClass }"
:data="state.menuRules"
class="w100"
/>
</el-form-item>
<FormItem

View File

@ -13,7 +13,7 @@
<Table ref="tableRef" />
<!-- 表单 -->
<PopupForm ref="formRef" />
<PopupForm ref="formRef" :key="baTable.table.extend!.popupFormKey" />
</div>
</template>
@ -27,6 +27,7 @@ import { defaultOptButtons } from '/@/components/table'
import { baTableApi } from '/@/api/common'
import { useI18n } from 'vue-i18n'
import { cloneDeep } from 'lodash-es'
import { uuid } from '/@/utils/random'
defineOptions({
name: 'user/group',
@ -62,6 +63,9 @@ const baTable = new baTableClass(
},
],
dblClickNotEditColumn: [undefined],
extend: {
popupFormKey: uuid(),
},
},
{
defaultItems: {
@ -115,6 +119,9 @@ const baTable = new baTableClass(
}
return false
},
toggleForm() {
baTable.table.extend!.popupFormKey = uuid()
},
}
)

View File

@ -45,6 +45,7 @@
node-key="id"
:props="{ children: 'children', label: 'title', class: treeNodeClass }"
:data="state.menuRules"
class="w100"
/>
</el-form-item>
<FormItem