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