front/src/views/system/dataPerm/components/SecretPermPanel.vue
zzh 99f7ddf73c feat(rbac): 数据权限三页左右分栏与右侧详情壳优化
新增 RbacDetailShell、DataPermPanel 五维配置、权限模板/角色管理右侧 Tab 与卡片布局,并补充 i18n。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 16:44:46 +08:00

95 lines
2.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="secret-perm-panel">
<div class="panel-toolbar">
<a-button type="primary" size="small" @click="addRow">
<template #icon><icon-plus /></template>
添加密级
</a-button>
<span class="hint">行级过滤 + 字段脱敏;无配置时默认公开+内部</span>
</div>
<a-table :data="modelValue" :pagination="false" size="small" row-key="_key">
<template #columns>
<a-table-column title="密级" :width="140">
<template #cell="{ record }">
<a-select v-model="record.secretLevel" :options="secretLevelOptions" />
</template>
</a-table-column>
<a-table-column title="适用模块">
<template #cell="{ record }">
<a-select
v-model="record.dataResourceCode"
:options="resourceOptions"
placeholder="全局"
allow-clear
/>
</template>
</a-table-column>
<a-table-column title="过期时间" :width="180">
<template #cell="{ record }">
<a-date-picker
v-model="record.expireTime"
show-time
format="YYYY-MM-DD HH:mm:ss"
value-format="YYYY-MM-DDTHH:mm:ss[Z]"
placeholder="永久"
allow-clear
style="width: 100%"
/>
</template>
</a-table-column>
<a-table-column title="操作" :width="70" align="center">
<template #cell="{ rowIndex }">
<a-button type="text" status="danger" size="mini" @click="removeRow(rowIndex)">删除</a-button>
</template>
</a-table-column>
</template>
</a-table>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { IconPlus } from '@arco-design/web-vue/es/icon'
import type { SecretPermItem } from '@/api/rbac/data-perm'
type Row = SecretPermItem & { _key: string }
const props = defineProps<{
modelValue: Row[]
secretLevelOptions: { value: number; label: string }[]
dataResources: { code: string; name: string }[]
}>()
const emit = defineEmits<{ 'update:modelValue': [Row[]] }>()
const resourceOptions = computed(() =>
props.dataResources.map((r) => ({ value: r.code, label: r.name }))
)
function addRow() {
emit('update:modelValue', [
...props.modelValue,
{ _key: `secret-${Date.now()}`, secretLevel: 2, dataResourceCode: null, expireTime: null },
])
}
function removeRow(index: number) {
const next = [...props.modelValue]
next.splice(index, 1)
emit('update:modelValue', next)
}
</script>
<style scoped>
.panel-toolbar {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
}
.hint {
color: var(--color-text-3);
font-size: 12px;
}
</style>