fix(F006): industry page status label 停用→禁用 (align with legacy backend wording)
This commit is contained in:
parent
2cdf5b2ee5
commit
660cf2acfc
@ -43,13 +43,13 @@ const LIST = ref<Category[]>([])
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const search = reactive({ name: '' })
|
const search = reactive({ name: '' })
|
||||||
|
|
||||||
// 状态胶囊 (全局 --st-* 变量: 0=正常绿 / 1=停用红)
|
// 状态胶囊 (全局 --st-* 变量: 0=正常绿 / 1=禁用红)
|
||||||
const LEVEL_MAP: Record<number, string> = { 1: '一级', 2: '二级', 3: '三级' }
|
const LEVEL_MAP: Record<number, string> = { 1: '一级', 2: '二级', 3: '三级' }
|
||||||
function levelLabel(l: number): string { return LEVEL_MAP[l] || `Lv$l` }
|
function levelLabel(l: number): string { return LEVEL_MAP[l] || `Lv$l` }
|
||||||
|
|
||||||
const STATUS_META: Record<number, { label: string; color: string; bg: string }> = {
|
const STATUS_META: Record<number, { label: string; color: string; bg: string }> = {
|
||||||
0: { label: '正常', color: 'var(--st-ok-fg)', bg: 'var(--st-ok-bg)' },
|
0: { label: '正常', color: 'var(--st-ok-fg)', bg: 'var(--st-ok-bg)' },
|
||||||
1: { label: '停用', color: 'var(--st-err-fg)', bg: 'var(--st-err-bg)' }
|
1: { label: '禁用', color: 'var(--st-err-fg)', bg: 'var(--st-err-bg)' }
|
||||||
}
|
}
|
||||||
function fmtDate(d: string | null | undefined): string {
|
function fmtDate(d: string | null | undefined): string {
|
||||||
if (!d) return '--'
|
if (!d) return '--'
|
||||||
@ -72,7 +72,7 @@ function filterTree(nodes: Category[], kw: string): Category[] {
|
|||||||
}
|
}
|
||||||
const displayList = computed(() => filterTree(LIST.value, search.name.trim()))
|
const displayList = computed(() => filterTree(LIST.value, search.name.trim()))
|
||||||
|
|
||||||
// 统计: 顶数 / 1级分类数 / 最深层级 / 已停用数
|
// 统计: 顶数 / 1级分类数 / 最深层级 / 已禁用数
|
||||||
const stats = computed(() => {
|
const stats = computed(() => {
|
||||||
const total = LIST.value.length
|
const total = LIST.value.length
|
||||||
const roots = LIST.value.length
|
const roots = LIST.value.length
|
||||||
@ -90,7 +90,7 @@ const stats = computed(() => {
|
|||||||
{ label: '分类总数', value: total, icon: 'Files', color: 'var(--brand)' },
|
{ label: '分类总数', value: total, icon: 'Files', color: 'var(--brand)' },
|
||||||
{ label: '一级分类', value: roots, icon: 'FolderOpened', color: 'var(--green)' },
|
{ label: '一级分类', value: roots, icon: 'FolderOpened', color: 'var(--green)' },
|
||||||
{ label: '最大层级', value: 'Lv' + maxDepth, icon: 'Histogram', color: 'var(--amber)' },
|
{ label: '最大层级', value: 'Lv' + maxDepth, icon: 'Histogram', color: 'var(--amber)' },
|
||||||
{ label: '已停用', value: disabled, icon: 'CircleClose', color: 'var(--red)' }
|
{ label: '已禁用', value: disabled, icon: 'CircleClose', color: 'var(--red)' }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -174,10 +174,10 @@ async function onSubmitEdit() {
|
|||||||
// ========== 启用/禁用 ==========
|
// ========== 启用/禁用 ==========
|
||||||
async function toggleStatus(row: Category) {
|
async function toggleStatus(row: Category) {
|
||||||
const disabling = row.status === 0
|
const disabling = row.status === 0
|
||||||
try { await ElMessageBox.confirm(`${disabling ? '停用' : '启用'}「${row.name}」?${disabling ? '停用后该分类将不对外展示' : ''}`, '操作确认', { type: 'warning' }) } catch { return }
|
try { await ElMessageBox.confirm(`${disabling ? '禁用' : '启用'}「${row.name}」?${disabling ? '禁用后该分类将不对外展示' : ''}`, '操作确认', { type: 'warning' }) } catch { return }
|
||||||
try {
|
try {
|
||||||
await httpPost(`/other/category/enabled?id=${row.id}`)
|
await httpPost(`/other/category/enabled?id=${row.id}`)
|
||||||
ElMessage.success(disabling ? '已停用' : '已启用')
|
ElMessage.success(disabling ? '已禁用' : '已启用')
|
||||||
load()
|
load()
|
||||||
} catch (e: any) { ElMessage.error(e?.msg || e?.message || '操作失败') }
|
} catch (e: any) { ElMessage.error(e?.msg || e?.message || '操作失败') }
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ onMounted(load)
|
|||||||
:actions="[
|
:actions="[
|
||||||
{ label: '添加子级', type: 'primary', when: (r: any) => (r.level || 1) < 5, onClick: onAdd },
|
{ label: '添加子级', type: 'primary', when: (r: any) => (r.level || 1) < 5, onClick: onAdd },
|
||||||
{ label: '编辑', type: 'primary', onClick: onEdit },
|
{ label: '编辑', type: 'primary', onClick: onEdit },
|
||||||
{ label: (r: any) => r.status === 0 ? '停用' : '启用', type: (r: any) => r.status === 0 ? 'warning' : 'success', onClick: toggleStatus },
|
{ label: (r: any) => r.status === 0 ? '禁用' : '启用', type: (r: any) => r.status === 0 ? 'warning' : 'success', onClick: toggleStatus },
|
||||||
{ label: '删除', type: 'danger', divided: true, onClick: onDelete }
|
{ label: '删除', type: 'danger', divided: true, onClick: onDelete }
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
@ -294,7 +294,7 @@ onMounted(load)
|
|||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="editForm.status">
|
<el-radio-group v-model="editForm.status">
|
||||||
<el-radio :value="0">正常</el-radio>
|
<el-radio :value="0">正常</el-radio>
|
||||||
<el-radio :value="1">停用</el-radio>
|
<el-radio :value="1">禁用</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user