feat(sj_1.0.0): 不允许删除超级管理员,不允许修改超级管理员角色

This commit is contained in:
dhb52 2024-05-26 23:34:48 +08:00
parent aae0793af8
commit 78d9e4817c
2 changed files with 24 additions and 12 deletions

View File

@ -110,17 +110,23 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
<NButton type="primary" ghost size="small" text onClick={() => edit(row.id!)}> <NButton type="primary" ghost size="small" text onClick={() => edit(row.id!)}>
{$t('common.edit')} {$t('common.edit')}
</NButton> </NButton>
<n-divider vertical /> {row.id === '1' ? (
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}> <>
{{ <n-divider vertical />
default: () => $t('common.confirmDelete'), <NPopconfirm onPositiveClick={() => handleDelete(row.id!)}>
trigger: () => ( {{
<NButton type="error" text ghost size="small"> default: () => $t('common.confirmDelete'),
{$t('common.delete')} trigger: () => (
</NButton> <NButton type="error" text ghost size="small">
) {$t('common.delete')}
}} </NButton>
</NPopconfirm> )
}}
</NPopconfirm>
</>
) : (
''
)}
</div> </div>
) )
} }

View File

@ -208,7 +208,13 @@ function updatePermissions(p: OptionValue[]) {
<NFormItem :label="$t('page.userManager.role')" path="role"> <NFormItem :label="$t('page.userManager.role')" path="role">
<NRadioGroup v-model:value="model.role" name="role"> <NRadioGroup v-model:value="model.role" name="role">
<NSpace> <NSpace>
<NRadio v-for="item in roleRecordOptions" :key="item.value" :value="item.value" :label="$t(item.label)" /> <NRadio
v-for="item in roleRecordOptions"
:key="item.value"
:value="item.value"
:label="$t(item.label)"
:disabled="operateType === 'edit' && model.id == '1'"
/>
</NSpace> </NSpace>
</NRadioGroup> </NRadioGroup>
</NFormItem> </NFormItem>