feat(F006-W3xC): 5 个新 view (P1 基础设置全部)

- P1.1 /other/goodunit 商品单位 (走 /other/goodunit/list 真 API, 112 行真数据, 6 字段)
- P1.2 /other/textconfig 常量配置 (后端 500, 走 el-result 占位)
- P1.3 /other/categoryGood 平台分类 (后端 404, 走 el-result 占位)
- P1.4 /other/label 标签管理 (后端 404, 走 el-result 占位)
- P1.5 /other/supplierBrand 品牌管理 (后端 404, 走 el-result 占位)

P1 推进模式: 1 view 真数据 (goodunit 走 list 数组 API) + 4 view 占位页 (后端未实现走 el-result)
This commit is contained in:
Sisyphus 2026-07-04 21:42:34 +08:00
parent 78360d1d6e
commit 5af0d4adb3
6 changed files with 386 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<script setup lang="ts">
/**
* F006 平台分类 (categoryGood) - W3.x C P1
* 后端端点 404 占位
*/
import { onMounted, ref } from 'vue'
import { httpGet } from '@/utils/request'
const status = ref<'checking' | '404' | '200' | 'error'>('checking')
const errorMsg = ref('')
onMounted(async () => {
try {
const r: any = await httpGet('/other/categoryGood/page', { page: 1, limit: 1 })
if (r?.code === 0) status.value = '200'
else { status.value = 'error'; errorMsg.value = r?.msg || '未知错误' }
} catch (e: any) {
if (e?.response?.status === 404 || e?.message?.includes('404')) {
status.value = '404'
errorMsg.value = '后端 API 未实现 (/other/categoryGood/page 返回 404)'
} else {
status.value = 'error'
errorMsg.value = e?.message || '请求失败'
}
}
})
</script>
<template>
<div class="rr-page">
<div class="rr-page-header">
<h2 class="rr-page-title">平台分类 (categoryGood)</h2>
<p class="rr-page-sub">占位页 - 后端接口未实现</p>
</div>
<div class="rr-card rr-status-card">
<el-result
:icon="status === '200' ? 'success' : 'warning'"
:title="status === '200' ? 'API 已就绪' : '后端 API 未实现'"
:sub-title="status === '200' ? '平台分类 (categoryGood) 数据接口已通, 可正常加载' : (errorMsg || '请联系后端实现 /other/categoryGood/page 接口')"
>
<template #extra>
<el-tag v-if="status === 'checking'" type="info">检测中...</el-tag>
<el-tag v-else-if="status === '404'" type="warning">404 Not Found</el-tag>
<el-tag v-else-if="status === '200'" type="success">200 OK</el-tag>
<el-tag v-else type="danger">Error</el-tag>
</template>
</el-result>
</div>
</div>
</template>
<style scoped lang="scss">
.rr-page { max-width: 1400px; }
.rr-page-header { margin-bottom: 20px; }
.rr-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; }
.rr-page-sub { color: var(--ink-3); font-size: 13px; }
.rr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 20px; }
</style>

View File

@ -0,0 +1,122 @@
<script setup lang="ts">
/**
* F006 商品单位 - W3.x C P1.1
* 走 /other/goodunit/list 真 API (返 data: [...] 数组, 共 112 行)
* 字段: id/name/type/supplierId/enterpriseId/createTime
*/
import { onMounted, ref, computed } from 'vue'
import { httpGet } from '@/utils/request'
import DataTable from '@/components/DataTable/DataTable.vue'
interface GoodUnit {
id: string
name: string
type: number | null
supplierId: string | null
enterpriseId: string | null
createTime: string
raw: any
}
const list = ref<GoodUnit[]>([])
const loading = ref(false)
const error = ref<string | null>(null)
const filterKw = ref('')
const TYPE_MAP: Record<number, string> = {
1: '系统',
2: '自定义'
}
async function load() {
loading.value = true
error.value = null
try {
const data: any = await httpGet<GoodUnit[]>('/other/goodunit/list')
list.value = (Array.isArray(data) ? data : []).map((it: any) => ({
id: String(it.id),
name: it.name || '--',
type: it.type ?? null,
supplierId: it.supplierId,
enterpriseId: it.enterpriseId,
createTime: it.createTime || '--',
raw: it
}))
} catch (e: any) {
error.value = e?.msg || e?.message || '加载失败'
list.value = []
} finally {
loading.value = false
}
}
const filtered = computed(() => {
const kw = filterKw.value.trim().toLowerCase()
if (!kw) return list.value
return list.value.filter(it => it.name.toLowerCase().includes(kw))
})
function fmtTime(s?: string | null) {
if (!s) return '--'
return s
}
onMounted(load)
</script>
<template>
<div class="rr-page">
<div class="rr-page-header">
<h2 class="rr-page-title">商品单位</h2>
<p class="rr-page-sub">商品计量单位管理(共 {{ list.length }} 个, 筛选后 {{ filtered.length }} 个)</p>
</div>
<div class="rr-filters">
<el-input v-model="filterKw" placeholder="按名称筛选" clearable class="rr-filter-input" size="default" />
</div>
<div class="rr-card">
<DataTable
:columns="[
{ prop: 'id', label: 'ID', width: 80 },
{ prop: 'name', label: '单位名称', minWidth: 200 },
{ prop: 'type', label: '类型', width: 100, slot: 'type' },
{ prop: 'supplierId', label: '供应商ID', width: 120 },
{ prop: 'enterpriseId', label: '企业ID', width: 120 },
{ prop: 'createTime', label: '创建时间', width: 180, slot: 'createTime' }
]"
:data="filtered"
:loading="loading"
:total="filtered.length"
:page="1"
:limit="filtered.length || 1"
:show-pagination="list.length > 20"
:error="error"
empty-text="暂无单位"
borderless
row-key="id"
>
<template #type="{ row }">
<el-tag v-if="row.type !== null" :type="row.type === 1 ? 'primary' : 'info'" size="small" effect="light">
{{ TYPE_MAP[row.type] || `类型${row.type}` }}
</el-tag>
<span v-else>--</span>
</template>
<template #createTime="{ row }">
<span class="rr-time">{{ fmtTime(row.createTime) }}</span>
</template>
</DataTable>
</div>
</div>
</template>
<style scoped lang="scss">
.rr-page { max-width: 1400px; }
.rr-page-header { margin-bottom: 16px; }
.rr-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; }
.rr-page-sub { color: var(--ink-3); font-size: 13px; }
.rr-filters { margin-bottom: 16px; display: flex; gap: 8px; }
.rr-filter-input { width: 280px; }
.rr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.rr-time { font-family: 'SF Mono', Menlo, monospace; font-size: 12px; color: var(--ink-2); }
</style>

View File

@ -0,0 +1,58 @@
<script setup lang="ts">
/**
* F006 标签管理 (label) - W3.x C P1
* 后端端点 404 占位
*/
import { onMounted, ref } from 'vue'
import { httpGet } from '@/utils/request'
const status = ref<'checking' | '404' | '200' | 'error'>('checking')
const errorMsg = ref('')
onMounted(async () => {
try {
const r: any = await httpGet('/other/label/page', { page: 1, limit: 1 })
if (r?.code === 0) status.value = '200'
else { status.value = 'error'; errorMsg.value = r?.msg || '未知错误' }
} catch (e: any) {
if (e?.response?.status === 404 || e?.message?.includes('404')) {
status.value = '404'
errorMsg.value = '后端 API 未实现 (/other/label/page 返回 404)'
} else {
status.value = 'error'
errorMsg.value = e?.message || '请求失败'
}
}
})
</script>
<template>
<div class="rr-page">
<div class="rr-page-header">
<h2 class="rr-page-title">标签管理 (label)</h2>
<p class="rr-page-sub">占位页 - 后端接口未实现</p>
</div>
<div class="rr-card rr-status-card">
<el-result
:icon="status === '200' ? 'success' : 'warning'"
:title="status === '200' ? 'API 已就绪' : '后端 API 未实现'"
:sub-title="status === '200' ? '标签管理 (label) 数据接口已通, 可正常加载' : (errorMsg || '请联系后端实现 /other/label/page 接口')"
>
<template #extra>
<el-tag v-if="status === 'checking'" type="info">检测中...</el-tag>
<el-tag v-else-if="status === '404'" type="warning">404 Not Found</el-tag>
<el-tag v-else-if="status === '200'" type="success">200 OK</el-tag>
<el-tag v-else type="danger">Error</el-tag>
</template>
</el-result>
</div>
</div>
</template>
<style scoped lang="scss">
.rr-page { max-width: 1400px; }
.rr-page-header { margin-bottom: 20px; }
.rr-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; }
.rr-page-sub { color: var(--ink-3); font-size: 13px; }
.rr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 20px; }
</style>

View File

@ -0,0 +1,58 @@
<script setup lang="ts">
/**
* F006 品牌管理 (supplierBrand) - W3.x C P1
* 后端端点 404 占位
*/
import { onMounted, ref } from 'vue'
import { httpGet } from '@/utils/request'
const status = ref<'checking' | '404' | '200' | 'error'>('checking')
const errorMsg = ref('')
onMounted(async () => {
try {
const r: any = await httpGet('/other/supplierBrand/page', { page: 1, limit: 1 })
if (r?.code === 0) status.value = '200'
else { status.value = 'error'; errorMsg.value = r?.msg || '未知错误' }
} catch (e: any) {
if (e?.response?.status === 404 || e?.message?.includes('404')) {
status.value = '404'
errorMsg.value = '后端 API 未实现 (/other/supplierBrand/page 返回 404)'
} else {
status.value = 'error'
errorMsg.value = e?.message || '请求失败'
}
}
})
</script>
<template>
<div class="rr-page">
<div class="rr-page-header">
<h2 class="rr-page-title">品牌管理 (supplierBrand)</h2>
<p class="rr-page-sub">占位页 - 后端接口未实现</p>
</div>
<div class="rr-card rr-status-card">
<el-result
:icon="status === '200' ? 'success' : 'warning'"
:title="status === '200' ? 'API 已就绪' : '后端 API 未实现'"
:sub-title="status === '200' ? '品牌管理 (supplierBrand) 数据接口已通, 可正常加载' : (errorMsg || '请联系后端实现 /other/supplierBrand/page 接口')"
>
<template #extra>
<el-tag v-if="status === 'checking'" type="info">检测中...</el-tag>
<el-tag v-else-if="status === '404'" type="warning">404 Not Found</el-tag>
<el-tag v-else-if="status === '200'" type="success">200 OK</el-tag>
<el-tag v-else type="danger">Error</el-tag>
</template>
</el-result>
</div>
</div>
</template>
<style scoped lang="scss">
.rr-page { max-width: 1400px; }
.rr-page-header { margin-bottom: 20px; }
.rr-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; }
.rr-page-sub { color: var(--ink-3); font-size: 13px; }
.rr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 20px; }
</style>

View File

@ -0,0 +1,58 @@
<script setup lang="ts">
/**
* F006 常量配置 (textconfig) - W3.x C P1
* 后端端点 404 占位
*/
import { onMounted, ref } from 'vue'
import { httpGet } from '@/utils/request'
const status = ref<'checking' | '404' | '200' | 'error'>('checking')
const errorMsg = ref('')
onMounted(async () => {
try {
const r: any = await httpGet('/other/textconfig/page', { page: 1, limit: 1 })
if (r?.code === 0) status.value = '200'
else { status.value = 'error'; errorMsg.value = r?.msg || '未知错误' }
} catch (e: any) {
if (e?.response?.status === 404 || e?.message?.includes('404')) {
status.value = '404'
errorMsg.value = '后端 API 未实现 (/other/textconfig/page 返回 404)'
} else {
status.value = 'error'
errorMsg.value = e?.message || '请求失败'
}
}
})
</script>
<template>
<div class="rr-page">
<div class="rr-page-header">
<h2 class="rr-page-title">常量配置 (textconfig)</h2>
<p class="rr-page-sub">占位页 - 后端接口未实现</p>
</div>
<div class="rr-card rr-status-card">
<el-result
:icon="status === '200' ? 'success' : 'warning'"
:title="status === '200' ? 'API 已就绪' : '后端 API 未实现'"
:sub-title="status === '200' ? '常量配置 (textconfig) 数据接口已通, 可正常加载' : (errorMsg || '请联系后端实现 /other/textconfig/page 接口')"
>
<template #extra>
<el-tag v-if="status === 'checking'" type="info">检测中...</el-tag>
<el-tag v-else-if="status === '404'" type="warning">404 Not Found</el-tag>
<el-tag v-else-if="status === '200'" type="success">200 OK</el-tag>
<el-tag v-else type="danger">Error</el-tag>
</template>
</el-result>
</div>
</div>
</template>
<style scoped lang="scss">
.rr-page { max-width: 1400px; }
.rr-page-header { margin-bottom: 20px; }
.rr-page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 4px; }
.rr-page-sub { color: var(--ink-3); font-size: 13px; }
.rr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 20px; }
</style>

View File

@ -245,6 +245,38 @@ const routes: RouteRecordRaw[] = [
component: () => import('@/modules/sys/region/RegionListView.vue'), component: () => import('@/modules/sys/region/RegionListView.vue'),
meta: { title: '行政区域' } meta: { title: '行政区域' }
}, },
// W3.x C P1.1-5: 基础设置 5 个 (textconfig/categoryGood/label/supplierBrand/goodunit)
// goodunit 走真数据 API, 其它 4 个后端未实现走占位
{
path: '/other/goodunit',
name: 'GoodunitList',
component: () => import('@/modules/other/goodunit/GoodunitListView.vue'),
meta: { title: '商品单位' }
},
{
path: '/other/textconfig',
name: 'TextconfigList',
component: () => import('@/modules/other/textconfig/TextconfigListView.vue'),
meta: { title: '常量配置' }
},
{
path: '/other/categoryGood',
name: 'CategoryGoodList',
component: () => import('@/modules/other/categoryGood/CategoryGoodListView.vue'),
meta: { title: '平台分类' }
},
{
path: '/other/label',
name: 'LabelList',
component: () => import('@/modules/other/label/LabelListView.vue'),
meta: { title: '标签管理' }
},
{
path: '/other/supplierBrand',
name: 'SupplierBrandList',
component: () => import('@/modules/other/supplierBrand/SupplierBrandListView.vue'),
meta: { title: '品牌管理' }
},
// W3.1 通用通配占位 — 覆盖菜单 70 个 url(两层路径,如 /admin/user/finance/recharge) // W3.1 通用通配占位 — 覆盖菜单 70 个 url(两层路径,如 /admin/user/finance/recharge)
// 注意:必须放在具体路由后面,否则会拦截 /inquiry /login // 注意:必须放在具体路由后面,否则会拦截 /inquiry /login