爬大哥的是否分配字段

This commit is contained in:
2025-10-16 13:50:51 +08:00
parent d3334b11cf
commit 528efc81f9

View File

@@ -154,7 +154,9 @@
<el-table-column label="该数据所属的账号id" align="center" prop="ownerId" />
<el-table-column :label="t('newHosts.isAssigned')" align="center" prop="isAssigned">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INT_TRUE_FLASE" :value="scope.row.isAssigned" />
<el-tag size="small" :type="scope.row.isAssigned == 1 ? 'success' : 'info'">
{{ dictLabelI18n(DICT_TYPE.INT_TRUE_FLASE, scope.row.isAssigned) || '-' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
@@ -204,7 +206,25 @@ import { BigBrotherApi, BigBrotherVO } from '@/api/server/bigbrother'
import { getAllocation, getSimpleUserList } from '@/api/system/user'
import { useCache } from '@/hooks/web/useCache'
import BigBrotherForm from './BigBrotherForm.vue'
import { useDictStore } from '@/store/modules/dict' // 如果你项目里有字典 store
const dictStore = useDictStore?.() // 有就用;没有的话把 dictStore 相关行删掉
// 统一用字符串比较,自动识别并翻译 i18n key
function dictLabelI18n(type: string, val: any) {
const v = val == null ? '' : String(val)
// 优先从 store 取若没有就从你现有的工具取getIntDictOptions / getStrDictOptions
const opts =
(dictStore?.getDictOptions?.(type) as any[]) ||
getIntDictOptions(type) ||
getStrDictOptions(type) ||
[]
const hit = opts.find(o => String(o.value) === v)
const label = hit?.label ?? ''
// 形如 a.b 或包含点号的,大概率是 i18n key则用 t() 翻
return label && label.includes('.') ? t(label) : label
}
const { wsCache } = useCache()
/** 大哥数据 列表 */
defineOptions({ name: 'BigBrother' })