feat(bodyStructure): 实现身体部位管理页面国际化支持

- 将新增、删除、导出、刷新等按钮文本替换为国际化标签
- 将表格列标题如部位名称、拼音、五笔拼音等替换为国际化标签
- 将表单输入框占位符和标签替换为国际化标签
- 添加vue-i18n依赖并配置国际化函数
- 将验证规则中的提示消息替换为国际化消息
- 将操作成功提示消息替换为国际化消息
- 将页面标题如添加身体部位、编辑部位等替换为国际化标签
This commit is contained in:
2026-06-26 13:03:13 +08:00
parent 8f20634b46
commit 9650cc4d84

View File

@@ -11,12 +11,12 @@
icon="Plus" icon="Plus"
@click="handleAdd" @click="handleAdd"
> >
新增 {{ $t('common.add') }}
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-tooltip <el-tooltip
:content="selectRowIds.length == 0 ? '至少选择一条数据' : ''" :content="selectRowIds.length == 0 ? $t('common.selectAtLeastOne') : ''"
placement="top" placement="top"
:disabled="selectRowIds.length != 0" :disabled="selectRowIds.length != 0"
> >
@@ -27,7 +27,7 @@
:disabled="selectRowIds.length == 0" :disabled="selectRowIds.length == 0"
@click="handleDelete" @click="handleDelete"
> >
删除 {{ $t('common.delete') }}
</el-button> </el-button>
</el-tooltip> </el-tooltip>
</el-col> </el-col>
@@ -38,7 +38,7 @@
icon="Download" icon="Download"
@click="handleExport" @click="handleExport"
> >
导出 {{ $t('common.export') }}
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@@ -48,7 +48,7 @@
icon="Refresh" icon="Refresh"
@click="getPageList" @click="getPageList"
> >
刷新 {{ $t('common.refresh') }}
</el-button> </el-button>
</el-col> </el-col>
<right-toolbar <right-toolbar
@@ -68,27 +68,27 @@
width="55" width="55"
/> />
<vxe-column <vxe-column
title="部位名称" :title="$t('basic.bodyStructure.partName')"
align="left" align="left"
field="name" field="name"
/> />
<vxe-column <vxe-column
title="拼音" :title="$t('basic.bodyStructure.pinyin')"
align="left" align="left"
field="pyStr" field="pyStr"
/> />
<vxe-column <vxe-column
title="五笔拼音" :title="$t('basic.bodyStructure.wubiPinyin')"
align="left" align="left"
field="wbStr" field="wbStr"
/> />
<vxe-column <vxe-column
title="状态" :title="$t('common.status')"
align="center" align="center"
field="statusEnum_enumText" field="statusEnum_enumText"
/> />
<vxe-column <vxe-column
title="操作" :title="$t('common.operation')"
align="center" align="center"
> >
<template #default="scope"> <template #default="scope">
@@ -97,7 +97,7 @@
type="primary" type="primary"
@click="handelEdit(scope.row)" @click="handelEdit(scope.row)"
> >
编辑 {{ $t('common.edit') }}
</el-button> </el-button>
<el-button <el-button
v-if="scope.row.statusEnum == '2'" v-if="scope.row.statusEnum == '2'"
@@ -105,7 +105,7 @@
type="primary" type="primary"
@click="handleDisabled(scope.row.id)" @click="handleDisabled(scope.row.id)"
> >
停用 {{ $t('common.disabled') }}
</el-button> </el-button>
<el-button <el-button
v-else v-else
@@ -113,14 +113,14 @@
type="primary" type="primary"
@click="handelEnable(scope.row.id)" @click="handelEnable(scope.row.id)"
> >
启用 {{ $t('common.enabled') }}
</el-button> </el-button>
<el-button <el-button
link link
type="primary" type="primary"
@click="handleAddInferior(scope.row)" @click="handleAddInferior(scope.row)"
> >
添加下级 {{ $t('basic.bodyStructure.addChild') }}
</el-button> </el-button>
</template> </template>
</vxe-column> </vxe-column>
@@ -148,32 +148,32 @@
> >
<el-input <el-input
v-model="form.id" v-model="form.id"
placeholder="请输入部位编号" :placeholder="$t('basic.bodyStructure.placeholderPartNo')"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-show="false" v-show="false"
label="部位编号" :label="$t('basic.bodyStructure.partNo')"
prop="busNo" prop="busNo"
> >
<el-input <el-input
v-model="form.busNo" v-model="form.busNo"
placeholder="请输入部位编号" :placeholder="$t('basic.bodyStructure.placeholderPartNo')"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="部位名称" :label="$t('basic.bodyStructure.partName')"
prop="name" prop="name"
> >
<el-input <el-input
v-model="form.name" v-model="form.name"
placeholder="请输入部位名称" :placeholder="$t('basic.bodyStructure.placeholderPartName')"
/> />
</el-form-item> </el-form-item>
<el-col> <el-col>
<el-form-item <el-form-item
label="上级部位" :label="$t('basic.bodyStructure.parentPart')"
prop="busNoParent" prop="busNoParent"
> >
<el-tree-select <el-tree-select
@@ -194,10 +194,10 @@
type="primary" type="primary"
@click="submitForm" @click="submitForm"
> >
{{ $t('common.confirm') }}
</el-button> </el-button>
<el-button @click="cancel"> <el-button @click="cancel">
{{ $t('common.cancel') }}
</el-button> </el-button>
</div> </div>
</template> </template>
@@ -206,6 +206,7 @@
</template> </template>
<script setup name="BodyStructure"> <script setup name="BodyStructure">
import { useI18n } from 'vue-i18n'
import { import {
addBodyStructure, addBodyStructure,
deleteBodyStructure, deleteBodyStructure,
@@ -215,6 +216,7 @@ import {
updateBodyStructure, updateBodyStructure,
} from './components/api'; } from './components/api';
const { t } = useI18n()
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const loading = ref(true); const loading = ref(true);
const bodyStructure = ref([]); const bodyStructure = ref([]);
@@ -232,13 +234,13 @@ const bodyStructureRef = ref();
const selectRowIds = ref([]); const selectRowIds = ref([]);
const total = ref(0); const total = ref(0);
const title = ref(''); const title = ref('');
const rules = ref({ const rules = computed(() => ({
busNo: [{ required: false, message: '请输入部位编号', trigger: 'input' }], busNo: [{ required: false, message: t('basic.bodyStructure.placeholderPartNo'), trigger: 'input' }],
name: [ name: [
{ required: true, message: '请输入部位名称', trigger: 'change' }, { required: true, message: t('basic.bodyStructure.placeholderPartName'), trigger: 'change' },
{ min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'change' }, { min: 2, max: 20, message: t('basic.bodyStructure.lengthTip'), trigger: 'change' },
], ],
}); }));
getPageList(); getPageList();
@@ -257,7 +259,7 @@ function getPageList() {
} }
function handleAdd() { function handleAdd() {
title.value = '添加身体部位'; title.value = t('basic.bodyStructure.addPart');
open.value = true; open.value = true;
reset(); reset();
console.log(form.value); console.log(form.value);
@@ -266,7 +268,7 @@ function handleAdd() {
function handelEdit(row) { function handelEdit(row) {
console.log(row.busNo); console.log(row.busNo);
title.value = '编辑部位'; title.value = t('basic.bodyStructure.editPart');
open.value = true; open.value = true;
setTimeout(() => { setTimeout(() => {
form.value.id = row.id; form.value.id = row.id;
@@ -292,13 +294,13 @@ function submitForm() {
form.value.busNo = form.value.busNoParent; form.value.busNo = form.value.busNoParent;
} }
addBodyStructure(form.value).then((res) => { addBodyStructure(form.value).then((res) => {
proxy.$modal.msgSuccess('操作成功'); proxy.$modal.msgSuccess(t('common.message'));
open.value = false; open.value = false;
getPageList(); getPageList();
}); });
} else { } else {
updateBodyStructure(form.value).then((res) => { updateBodyStructure(form.value).then((res) => {
proxy.$modal.msgSuccess('操作成功'); proxy.$modal.msgSuccess(t('common.message'));
open.value = false; open.value = false;
getPageList(); getPageList();
}); });
@@ -309,7 +311,7 @@ function submitForm() {
// 添加下级 // 添加下级
function handleAddInferior(row) { function handleAddInferior(row) {
title.value = '添加下级'; title.value = t('basic.bodyStructure.addChild');
open.value = true; open.value = true;
form.value.busNoParent = row.busNo; form.value.busNoParent = row.busNo;
} }
@@ -318,15 +320,14 @@ function handleAddInferior(row) {
function handleDelete() { function handleDelete() {
loading.value = true; loading.value = true;
deleteBodyStructure(selectRowIds.value.join(',')).then((res) => { deleteBodyStructure(selectRowIds.value.join(',')).then((res) => {
proxy.$modal.msgSuccess('操作成功'); proxy.$modal.msgSuccess(t('common.message'));
loading.value = false;
getPageList(); getPageList();
}); });
} }
// 停用 // 停用
function handleDisabled(id) { function handleDisabled(id) {
disableBodyStructure(id).then((res) => { disableBodyStructure(id).then((res) => {
proxy.$modal.msgSuccess('操作成功'); proxy.$modal.msgSuccess(t('common.message'));
getPageList(); getPageList();
}); });
} }
@@ -334,7 +335,7 @@ function handleDisabled(id) {
// 启用 // 启用
function handelEnable(id) { function handelEnable(id) {
enableBodyStructure(id).then((res) => { enableBodyStructure(id).then((res) => {
proxy.$modal.msgSuccess('操作成功'); proxy.$modal.msgSuccess(t('common.message'));
getPageList(); getPageList();
}); });
} }