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

View File

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

View File

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

View File

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