refactor: 移除佣金比例字段,将developer统一为admin

This commit is contained in:
2026-05-01 08:08:11 +08:00
parent c5d1dc4b04
commit 4ed00f29e2
235 changed files with 9082 additions and 8952 deletions
@@ -4,7 +4,7 @@ import type { Composer } from 'vue-i18n'
import { Download, File, List, MoreHorizontal, Pencil, Power, PowerOff, Trash2 } from 'lucide-vue-next'
import { h } from 'vue'
import type { CloudVariable } from '@/pages/developer/cloud-variables/data/schema'
import type { CloudVariable } from '@/pages/admin/cloud-variables/data/schema'
import { Copy } from '@/components/sva-ui/copy'
import Badge from '@/components/ui/badge/Badge.vue'
@@ -26,7 +26,7 @@ export function getColumns(actions: {
return [
{
accessorKey: 'key',
header: () => t('developer.cloudVariables.columns.key'),
header: () => t('admin.cloudVariables.columns.key'),
cell: ({ row }) => {
const key = row.getValue('key') as string
if (!key)
@@ -39,7 +39,7 @@ export function getColumns(actions: {
},
{
accessorKey: 'default_value',
header: () => t('developer.cloudVariables.columns.defaultValue'),
header: () => t('admin.cloudVariables.columns.defaultValue'),
cell: ({ row }) => {
const value = row.getValue('default_value') as string
const varType = row.original.var_type
@@ -57,36 +57,36 @@ export function getColumns(actions: {
},
{
accessorKey: 'scope',
header: () => t('developer.cloudVariables.columns.scope'),
header: () => t('admin.cloudVariables.columns.scope'),
cell: ({ row }) => {
const scope = row.getValue('scope') as string
if (scope === 'app') {
return h(Badge, { variant: 'default' }, () => t('developer.cloudVariables.appScope'))
return h(Badge, { variant: 'default' }, () => t('admin.cloudVariables.appScope'))
}
return h(Badge, { variant: 'secondary' }, () => t('developer.cloudVariables.userScope'))
return h(Badge, { variant: 'secondary' }, () => t('admin.cloudVariables.userScope'))
},
},
{
accessorKey: 'write_permission',
header: () => t('developer.cloudVariables.create.writePermission'),
header: () => t('admin.cloudVariables.create.writePermission'),
cell: ({ row }) => {
const permission = row.getValue('write_permission') as string
if (permission === 'user') {
return h(Badge, { variant: 'outline', class: 'bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-300' }, () => t('developer.cloudVariables.create.userWritable'))
return h(Badge, { variant: 'outline', class: 'bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-300' }, () => t('admin.cloudVariables.create.userWritable'))
}
return h(Badge, { variant: 'outline' }, () => t('developer.cloudVariables.create.developerOnly'))
return h(Badge, { variant: 'outline' }, () => t('admin.cloudVariables.create.developerOnly'))
},
},
{
accessorKey: 'var_type',
header: () => t('developer.cloudVariables.columns.type'),
header: () => t('admin.cloudVariables.columns.type'),
cell: ({ row }) => {
const type = row.getValue('var_type') as string
const typeMap: Record<string, string> = {
integer: t('developer.cloudVariables.types.integer'),
decimal: t('developer.cloudVariables.types.decimal'),
string: t('developer.cloudVariables.types.string'),
binary: t('developer.cloudVariables.types.binary'),
integer: t('admin.cloudVariables.types.integer'),
decimal: t('admin.cloudVariables.types.decimal'),
string: t('admin.cloudVariables.types.string'),
binary: t('admin.cloudVariables.types.binary'),
stream: '记录',
}
return h(Badge, { variant: 'outline' }, () => typeMap[type || 'string'] || type || 'string')
@@ -94,7 +94,7 @@ export function getColumns(actions: {
},
{
accessorKey: 'description',
header: () => t('developer.cloudVariables.columns.description'),
header: () => t('admin.cloudVariables.columns.description'),
cell: ({ row }) => {
const description = row.getValue('description') as string
if (!description)
@@ -104,13 +104,13 @@ export function getColumns(actions: {
},
{
accessorKey: 'application_name',
header: () => t('developer.cloudVariables.columns.application'),
header: () => t('admin.cloudVariables.columns.application'),
cell: ({ row }) => {
const appName = row.getValue('application_name') as string
if (!appName) {
const appId = row.original.app_id
if (!appId)
return h(Badge, { variant: 'outline' }, () => t('developer.cloudVariables.notLinked'))
return h(Badge, { variant: 'outline' }, () => t('admin.cloudVariables.notLinked'))
return '-'
}
return h(Badge, { variant: 'outline' }, () => appName)
@@ -118,16 +118,16 @@ export function getColumns(actions: {
},
{
accessorKey: 'status',
header: () => t('developer.cloudVariables.columns.status'),
header: () => t('admin.cloudVariables.columns.status'),
cell: ({ row }) => {
const status = row.getValue('status') as string
const isActive = status === 'active'
return h(Badge, { variant: isActive ? 'default' : 'destructive' }, () => isActive ? t('developer.cloudVariables.statusActive') : t('developer.cloudVariables.statusInactive'))
return h(Badge, { variant: isActive ? 'default' : 'destructive' }, () => isActive ? t('admin.cloudVariables.statusActive') : t('admin.cloudVariables.statusInactive'))
},
},
{
accessorKey: 'created_at',
header: () => t('developer.cloudVariables.columns.createdAt'),
header: () => t('admin.cloudVariables.columns.createdAt'),
cell: ({ row }) => {
const createdAt = row.getValue('created_at')
if (!createdAt)
@@ -183,7 +183,7 @@ export function getColumns(actions: {
items.push(
h(DropdownMenuItem, { onClick: () => actions.onEdit(variable) }, () => [
h(Pencil, { class: 'mr-2 h-4 w-4' }),
t('developer.cloudVariables.edit'),
t('admin.cloudVariables.edit'),
]),
)
@@ -199,11 +199,11 @@ export function getColumns(actions: {
items.push(
h(DropdownMenuItem, { onClick: () => actions.onToggleStatus(variable) }, () => [
variable.status === 'active' ? h(PowerOff, { class: 'mr-2 h-4 w-4' }) : h(Power, { class: 'mr-2 h-4 w-4' }),
variable.status === 'active' ? t('developer.cloudVariables.disable') : t('developer.cloudVariables.enable'),
variable.status === 'active' ? t('admin.cloudVariables.disable') : t('admin.cloudVariables.enable'),
]),
h(DropdownMenuItem, { class: 'text-destructive', onClick: () => actions.onDelete(variable) }, () => [
h(Trash2, { class: 'mr-2 h-4 w-4' }),
t('developer.cloudVariables.delete'),
t('admin.cloudVariables.delete'),
]),
)