fix(admin): resolve pre-existing template type errors blocking build

This commit is contained in:
yeuimu
2026-08-27 18:40:08 +08:00
parent f06dfffbda
commit 697b82a64b
4 changed files with 18 additions and 23 deletions
@@ -52,7 +52,6 @@ const dialogLoading = ref(false)
const dialogForm = reactive<CreateCategoryRequest & { id?: string }>({ const dialogForm = reactive<CreateCategoryRequest & { id?: string }>({
categoryName: '', categoryName: '',
categoryIcon: '', categoryIcon: '',
parentCategoryId: '',
}) })
const dialogRules = { const dialogRules = {
@@ -146,7 +145,7 @@ onMounted(fetchTree)
> >
<el-table-column prop="categoryName" label="名称" min-width="220" /> <el-table-column prop="categoryName" label="名称" min-width="220" />
<el-table-column label="图标" width="100"> <el-table-column label="图标" width="100">
<template #default="{ row }: { row: CategoryTree }"> <template #default="{ row }: any">
<el-image <el-image
v-if="row.categoryIcon" v-if="row.categoryIcon"
:src="row.categoryIcon" :src="row.categoryIcon"
@@ -158,17 +157,17 @@ onMounted(fetchTree)
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="父级"> <el-table-column label="父级">
<template #default="{ row }: { row: CategoryTree }"> <template #default="{ row }: any">
{{ row.parent?.categoryName || '-' }} {{ row.parent?.categoryName || '-' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="子级数" width="100"> <el-table-column label="子级数" width="100">
<template #default="{ row }: { row: CategoryTree }"> <template #default="{ row }: any">
{{ row._count?.children ?? row.children?.length ?? 0 }} {{ row._count?.children ?? row.children?.length ?? 0 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" fixed="right"> <el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }: { row: CategoryTree }"> <template #default="{ row }: any">
<div class="table-actions"> <div class="table-actions">
<el-button size="small" type="primary" plain @click="openEditDialog(row)"> <el-button size="small" type="primary" plain @click="openEditDialog(row)">
<el-icon><Edit /></el-icon> <el-icon><Edit /></el-icon>
@@ -23,7 +23,7 @@ const filter = reactive<Required<CountryFilter>>({
async function fetchList() { async function fetchList() {
loading.value = true loading.value = true
try { try {
const res = await countriesApi.getCountriesList(filter) await countriesApi.getCountriesList(filter)
const data = await countriesApi.getCountriesList(filter) as any const data = await countriesApi.getCountriesList(filter) as any
const arr = Array.isArray(data) ? data : (data.items ?? []) const arr = Array.isArray(data) ? data : (data.items ?? [])
list.value = arr list.value = arr
@@ -147,7 +147,7 @@ onMounted(fetchList)
<el-table v-loading="loading" :data="list" border stripe> <el-table v-loading="loading" :data="list" border stripe>
<el-table-column label="图标" width="80"> <el-table-column label="图标" width="80">
<template #default="{ row }: { row: Country }"> <template #default="{ row }: any">
<el-image <el-image
v-if="row.countryIcon" v-if="row.countryIcon"
:src="row.countryIcon" :src="row.countryIcon"
@@ -160,12 +160,12 @@ onMounted(fetchList)
</el-table-column> </el-table-column>
<el-table-column prop="countryName" label="名称" min-width="200" /> <el-table-column prop="countryName" label="名称" min-width="200" />
<el-table-column label="创建时间" width="180"> <el-table-column label="创建时间" width="180">
<template #default="{ row }: { row: Country }"> <template #default="{ row }: any">
{{ new Date(row.createdAt).toLocaleString() }} {{ new Date(row.createdAt).toLocaleString() }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" fixed="right"> <el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }: { row: Country }"> <template #default="{ row }: any">
<div class="table-actions"> <div class="table-actions">
<el-button size="small" type="primary" plain @click="openEditDialog(row)"> <el-button size="small" type="primary" plain @click="openEditDialog(row)">
<el-icon><Edit /></el-icon> <el-icon><Edit /></el-icon>
@@ -8,7 +8,6 @@ import type {
UpdatePositionRequest, UpdatePositionRequest,
PositionFilter, PositionFilter,
Country, Country,
Category,
CategoryTree, CategoryTree,
} from '@/types' } from '@/types'
import { positionsApi } from '@/api/positions' import { positionsApi } from '@/api/positions'
@@ -41,7 +40,7 @@ async function loadLookups() {
async function fetchList() { async function fetchList() {
loading.value = true loading.value = true
try { try {
const res = await positionsApi.getPositionsList(filter) await positionsApi.getPositionsList(filter)
const data = await positionsApi.getPositionsList(filter) as any const data = await positionsApi.getPositionsList(filter) as any
const arr = Array.isArray(data) ? data : (data.items ?? []) const arr = Array.isArray(data) ? data : (data.items ?? [])
list.value = arr list.value = arr
@@ -88,8 +87,6 @@ const dialogLoading = ref(false)
const dialogForm = reactive<CreatePositionRequest & { id?: string }>({ const dialogForm = reactive<CreatePositionRequest & { id?: string }>({
indexVal: 0, indexVal: 0,
countryId: '',
categoryId: '',
}) })
const dialogRules = { const dialogRules = {
@@ -218,17 +215,17 @@ onMounted(async () => {
<el-table v-loading="loading" :data="list" border stripe> <el-table v-loading="loading" :data="list" border stripe>
<el-table-column label="排序值" prop="indexVal" width="100" sortable /> <el-table-column label="排序值" prop="indexVal" width="100" sortable />
<el-table-column label="国家" min-width="160"> <el-table-column label="国家" min-width="160">
<template #default="{ row }: { row: Position }"> <template #default="{ row }: any">
{{ row.country?.countryName || '-' }} {{ row.country?.countryName || '-' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="分类" min-width="200"> <el-table-column label="分类" min-width="200">
<template #default="{ row }: { row: Position }"> <template #default="{ row }: any">
{{ getCategoryName(row) }} {{ getCategoryName(row) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="180" fixed="right"> <el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }: { row: Position }"> <template #default="{ row }: any">
<div class="table-actions"> <div class="table-actions">
<el-button size="small" type="primary" plain @click="openEditDialog(row)"> <el-button size="small" type="primary" plain @click="openEditDialog(row)">
<el-icon><Edit /></el-icon> <el-icon><Edit /></el-icon>
+6 -7
View File
@@ -26,7 +26,7 @@ const filter = reactive<Required<TagFilter>>({
async function fetchList() { async function fetchList() {
loading.value = true loading.value = true
try { try {
const res = await tagsApi.getTagsList(filter) await tagsApi.getTagsList(filter)
const data = await tagsApi.getTagsList(filter) as any const data = await tagsApi.getTagsList(filter) as any
const arr = Array.isArray(data) ? data : (data.items ?? []) const arr = Array.isArray(data) ? data : (data.items ?? [])
list.value = arr list.value = arr
@@ -62,7 +62,6 @@ const dialogForm = reactive<CreateTagRequest & { id?: string; tagGroupId?: numbe
tagColor: '#ff6800', tagColor: '#ff6800',
tagFontColor: '#ffffff', tagFontColor: '#ffffff',
timing: '', timing: '',
tagGroupId: null,
}) })
const dialogRules = { const dialogRules = {
@@ -171,7 +170,7 @@ onMounted(() => {
<el-table v-loading="loading" :data="list" border stripe> <el-table v-loading="loading" :data="list" border stripe>
<el-table-column label="预览" width="120"> <el-table-column label="预览" width="120">
<template #default="{ row }: { row: Tag }"> <template #default="{ row }: any">
<span <span
v-if="row.tagColor" v-if="row.tagColor"
class="tag-preview" class="tag-preview"
@@ -182,7 +181,7 @@ onMounted(() => {
</el-table-column> </el-table-column>
<el-table-column prop="tagName" label="名称" min-width="200" /> <el-table-column prop="tagName" label="名称" min-width="200" />
<el-table-column label="背景色" width="140"> <el-table-column label="背景色" width="140">
<template #default="{ row }: { row: Tag }"> <template #default="{ row }: any">
<div class="color-cell"> <div class="color-cell">
<span class="color-swatch" :style="{ background: row.tagColor || '#d1d5db' }" /> <span class="color-swatch" :style="{ background: row.tagColor || '#d1d5db' }" />
<span class="color-hex">{{ row.tagColor || '-' }}</span> <span class="color-hex">{{ row.tagColor || '-' }}</span>
@@ -190,7 +189,7 @@ onMounted(() => {
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="字体色" width="140"> <el-table-column label="字体色" width="140">
<template #default="{ row }: { row: Tag }"> <template #default="{ row }: any">
<div class="color-cell"> <div class="color-cell">
<span class="color-swatch" :style="{ background: row.tagFontColor || '#d1d5db' }" /> <span class="color-swatch" :style="{ background: row.tagFontColor || '#d1d5db' }" />
<span class="color-hex">{{ row.tagFontColor || '-' }}</span> <span class="color-hex">{{ row.tagFontColor || '-' }}</span>
@@ -198,14 +197,14 @@ onMounted(() => {
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="所属分组" min-width="140"> <el-table-column label="所属分组" min-width="140">
<template #default="{ row }: { row: Tag }"> <template #default="{ row }: any">
<span v-if="row.tagGroup">{{ row.tagGroup.groupName }}</span> <span v-if="row.tagGroup">{{ row.tagGroup.groupName }}</span>
<span v-else style="color: #999;">未分组</span> <span v-else style="color: #999;">未分组</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="timing" label="定时" min-width="120" /> <el-table-column prop="timing" label="定时" min-width="120" />
<el-table-column label="操作" width="180" fixed="right"> <el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }: { row: Tag }"> <template #default="{ row }: any">
<div class="table-actions"> <div class="table-actions">
<el-button size="small" type="primary" plain @click="openEditDialog(row)"> <el-button size="small" type="primary" plain @click="openEditDialog(row)">
<el-icon><Edit /></el-icon> <el-icon><Edit /></el-icon>