124 lines
5.3 KiB
Vue
124 lines
5.3 KiB
Vue
<template>
|
||
<div class="ai-catalog-page">
|
||
<el-card class="!border-none" shadow="never">
|
||
<div class="summary">
|
||
<div class="summary-item">
|
||
<div class="summary-value success">{{ counts.open ?? 0 }}</div>
|
||
<div class="summary-label">已开放</div>
|
||
</div>
|
||
<div class="summary-item">
|
||
<div class="summary-value warning">{{ counts.pending ?? 0 }}</div>
|
||
<div class="summary-label">待整改</div>
|
||
</div>
|
||
<div class="summary-item">
|
||
<div class="summary-value">{{ counts.excluded ?? 0 }}</div>
|
||
<div class="summary-label">不开放</div>
|
||
</div>
|
||
</div>
|
||
<el-form :inline="true" class="mt-3">
|
||
<el-form-item label="状态">
|
||
<el-select v-model="queryParams.status" clearable placeholder="全部" class="w-[120px]" @change="resetPage">
|
||
<el-option label="已开放" value="open" />
|
||
<el-option label="待整改" value="pending" />
|
||
<el-option label="不开放" value="excluded" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="业务分组">
|
||
<el-select v-model="queryParams.domain" clearable filterable placeholder="全部" class="w-[180px]" @change="resetPage">
|
||
<el-option v-for="d in domains" :key="d" :label="d" :value="d" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="关键词">
|
||
<el-input v-model="queryParams.keyword" placeholder="名称或资源标识" clearable class="w-[200px]" @keyup.enter="resetPage" @clear="resetPage" />
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||
<el-button @click="resetParams">重置</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
<div class="page-hint">
|
||
后台每个只读接口都是一个“数据资源”。已开放的资源由 AI 以调用账号自己的权限和数据范围执行原有接口;
|
||
待整改的资源写明了原因(如缺少逐条权限校验、会调用外部接口、权限点未登记),整改或审核通过后开放。
|
||
</div>
|
||
</el-card>
|
||
|
||
<el-card class="!border-none mt-3" shadow="never">
|
||
<el-table :data="pager.lists" v-loading="pager.loading" size="default" stripe>
|
||
<el-table-column label="资源" min-width="220">
|
||
<template #default="{ row }">
|
||
<div>{{ row.name }}</div>
|
||
<div class="cell-sub">{{ row.resource }}</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="业务分组" width="150" prop="domain" />
|
||
<el-table-column label="类型" width="80">
|
||
<template #default="{ row }">{{ KIND[row.kind] || row.kind }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="状态" width="90" align="center">
|
||
<template #default="{ row }">
|
||
<el-tag :type="STATUS[row.status]?.type" size="small">{{ STATUS[row.status]?.label || row.status }}</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="原因" min-width="260" prop="reason" />
|
||
<el-table-column label="已审核" width="80" align="center">
|
||
<template #default="{ row }">{{ row.reviewed ? '是' : '自动' }}</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div class="flex justify-end mt-4">
|
||
<pagination v-model="pager" @change="getLists" />
|
||
</div>
|
||
</el-card>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts" name="aiMcpCatalog">
|
||
import { aiCatalogLists } from '@/api/ai_mcp'
|
||
import { usePaging } from '@/hooks/usePaging'
|
||
import { computed, onMounted, reactive } from 'vue'
|
||
|
||
const KIND: Record<string, string> = { list: '列表', detail: '详情', report: '统计', other: '其他', write: '写操作' }
|
||
const STATUS: Record<string, { label: string; type: 'success' | 'warning' | 'info' }> = {
|
||
open: { label: '已开放', type: 'success' },
|
||
pending: { label: '待整改', type: 'warning' },
|
||
excluded: { label: '不开放', type: 'info' }
|
||
}
|
||
const queryParams = reactive({ status: '', domain: '', keyword: '' })
|
||
|
||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||
fetchFun: aiCatalogLists,
|
||
params: queryParams,
|
||
size: 50
|
||
})
|
||
|
||
const counts = computed<Record<string, number>>(() => pager.extend?.counts || {})
|
||
const domains = computed<string[]>(() => pager.extend?.domains || [])
|
||
|
||
onMounted(() => getLists())
|
||
</script>
|
||
|
||
<style scoped>
|
||
.summary {
|
||
display: flex;
|
||
gap: 48px;
|
||
}
|
||
.summary-value {
|
||
font-size: 26px;
|
||
font-weight: 600;
|
||
}
|
||
.summary-value.success {
|
||
color: var(--el-color-success);
|
||
}
|
||
.summary-value.warning {
|
||
color: var(--el-color-warning);
|
||
}
|
||
.summary-label,
|
||
.page-hint,
|
||
.cell-sub {
|
||
color: var(--el-text-color-secondary);
|
||
font-size: 13px;
|
||
}
|
||
.page-hint {
|
||
line-height: 1.6;
|
||
}
|
||
</style>
|