全局中文化

This commit is contained in:
Cheng Zhou
2026-01-12 11:14:04 +08:00
parent 9021c7fe2b
commit 1338fa7e2b
103 changed files with 2443 additions and 1533 deletions
+12 -8
View File
@@ -1,23 +1,23 @@
<template>
<el-card class="panel">
<div class="header">
<span>分类</span>
<span>{{ TEXT.common.labels.category }}</span>
<div v-if="canMaintain">
<PermissionAction action="faq.edit">
<el-button type="primary" size="small" @click="openForm()">新建</el-button>
<el-button type="primary" size="small" @click="openForm()">{{ TEXT.modules.knowledgeMedicalConsult.newCategory }}</el-button>
</PermissionAction>
</div>
</div>
<el-menu :default-active="activeCategory" @select="onSelect" class="menu">
<el-menu-item index="">全部</el-menu-item>
<el-menu-item index="">{{ TEXT.common.labels.all }}</el-menu-item>
<el-menu-item v-for="c in sortedCategories" :key="c.id" :index="c.id">
<span class="name" :title="c.name">{{ c.name }}</span>
<div v-if="canEdit(c) || canDelete" class="actions">
<PermissionAction v-if="canEdit(c)" action="faq.edit">
<el-button type="text" size="small" @click.stop="openForm(c)">编辑</el-button>
<el-button type="text" size="small" @click.stop="openForm(c)">{{ TEXT.common.actions.edit }}</el-button>
</PermissionAction>
<PermissionAction v-if="canDelete" action="faq.edit">
<el-button type="text" size="small" class="danger" @click.stop="onDelete(c)">删除</el-button>
<el-button type="text" size="small" class="danger" @click.stop="onDelete(c)">{{ TEXT.common.actions.delete }}</el-button>
</PermissionAction>
</div>
</el-menu-item>
@@ -36,6 +36,7 @@ import { useAuthStore } from "../store/auth";
import { useStudyStore } from "../store/study";
import PermissionAction from "./PermissionAction.vue";
import { usePermission } from "../utils/permission";
import { TEXT } from "../locales";
const props = defineProps<{
categories: FaqCategory[];
@@ -76,14 +77,17 @@ const openForm = (cat?: FaqCategory) => {
};
const onDelete = async (cat: FaqCategory) => {
const ok = await ElMessageBox.confirm(`确认删除分类「${cat.name}」?`, "提示").catch(() => null);
const ok = await ElMessageBox.confirm(
TEXT.modules.knowledgeMedicalConsult.confirmDeleteCategory.replace("{name}", cat.name),
TEXT.common.labels.tips
).catch(() => null);
if (!ok) return;
try {
await deleteFaqCategory(cat.id);
ElMessage.success("删除成功");
ElMessage.success(TEXT.common.messages.deleteSuccess);
emit("refresh");
} catch (e: any) {
ElMessage.error(e?.response?.data?.message || "删除失败");
ElMessage.error(e?.response?.data?.message || TEXT.common.messages.deleteFailed);
}
};
</script>