爬大哥的是否分配字段
This commit is contained in:
@@ -154,7 +154,9 @@
|
|||||||
<el-table-column label="该数据所属的账号id" align="center" prop="ownerId" />
|
<el-table-column label="该数据所属的账号id" align="center" prop="ownerId" />
|
||||||
<el-table-column :label="t('newHosts.isAssigned')" align="center" prop="isAssigned">
|
<el-table-column :label="t('newHosts.isAssigned')" align="center" prop="isAssigned">
|
||||||
<template #default="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
|
<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 { getAllocation, getSimpleUserList } from '@/api/system/user'
|
||||||
import { useCache } from '@/hooks/web/useCache'
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
import BigBrotherForm from './BigBrotherForm.vue'
|
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()
|
const { wsCache } = useCache()
|
||||||
/** 大哥数据 列表 */
|
/** 大哥数据 列表 */
|
||||||
defineOptions({ name: 'BigBrother' })
|
defineOptions({ name: 'BigBrother' })
|
||||||
|
|||||||
Reference in New Issue
Block a user