|
|
|
@ -29,7 +29,7 @@ |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="chineseSimplified" label="原文(中文)" width="180px" > |
|
|
|
<el-table-column prop="chineseSimplified" label="原文(中文)" width="180px"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-tooltip :content="scope.row.chineseSimplified" placement="top" |
|
|
|
v-if="scope.row.chineseSimplified && scope.row.chineseSimplified.length > 20"> |
|
|
|
@ -49,7 +49,8 @@ |
|
|
|
</el-tooltip> |
|
|
|
<span v-else>{{ scope.row.english }}</span> |
|
|
|
</div> |
|
|
|
<el-tag :type="scope.row.english ? 'success' : 'info'" size="small" style="margin-left: 8px;"> |
|
|
|
<el-tag :type="scope.row.english ? 'success' : 'info'" size="small" |
|
|
|
style="margin-left: 8px;"> |
|
|
|
{{ scope.row.english ? '已翻译' : '未翻译' }} |
|
|
|
</el-tag> |
|
|
|
</div> |
|
|
|
@ -83,7 +84,8 @@ |
|
|
|
</el-tooltip> |
|
|
|
<span v-else>{{ scope.row.chineseTraditional }}</span> |
|
|
|
</div> |
|
|
|
<el-tag :type="scope.row.chineseTraditional ? 'success' : 'info'" size="small" style="margin-left: 8px;"> |
|
|
|
<el-tag :type="scope.row.chineseTraditional ? 'success' : 'info'" size="small" |
|
|
|
style="margin-left: 8px;"> |
|
|
|
{{ scope.row.chineseTraditional ? '已翻译' : '未翻译' }} |
|
|
|
</el-tag> |
|
|
|
</div> |
|
|
|
@ -117,7 +119,8 @@ |
|
|
|
</el-tooltip> |
|
|
|
<span v-else>{{ scope.row.vietnamese }}</span> |
|
|
|
</div> |
|
|
|
<el-tag :type="scope.row.vietnamese ? 'success' : 'info'" size="small" style="margin-left: 8px;"> |
|
|
|
<el-tag :type="scope.row.vietnamese ? 'success' : 'info'" size="small" |
|
|
|
style="margin-left: 8px;"> |
|
|
|
{{ scope.row.vietnamese ? '已翻译' : '未翻译' }} |
|
|
|
</el-tag> |
|
|
|
</div> |
|
|
|
@ -151,40 +154,34 @@ |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<!-- 确认删除对话框 --> |
|
|
|
<ConfirmDialog |
|
|
|
v-model="showDeleteDialog" |
|
|
|
message="删除该翻译记录!" |
|
|
|
@confirm="handleDeleteConfirm" |
|
|
|
@cancel="handleDeleteCancel" |
|
|
|
@close="handleDeleteClose" |
|
|
|
/> |
|
|
|
<ConfirmDialog v-model="showDeleteDialog" message="删除该翻译记录!" @confirm="handleDeleteConfirm" |
|
|
|
@cancel="handleDeleteCancel" @close="handleDeleteClose" /> |
|
|
|
|
|
|
|
<!-- 编辑对话框 --> |
|
|
|
<el-dialog v-model="showEditDialog" :title="editForm.id ? '编辑翻译' : '新增翻译'" width="30vw" draggable> |
|
|
|
<el-form :model="editForm" label-width="120px"> |
|
|
|
<el-form-item label="原文(中文):"> |
|
|
|
<el-input v-model="editForm.chineseSimplified" placeholder="请输入原文内容" show-word-limit /> |
|
|
|
<el-input v-model="editForm.chineseSimplified" placeholder="请输入原文内容" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="英文:"> |
|
|
|
<el-input v-model="editForm.english" placeholder="请输入英文翻译" show-word-limit /> |
|
|
|
<el-input v-model="editForm.english" placeholder="请输入英文翻译" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="泰语:"> |
|
|
|
<el-input v-model="editForm.thai" placeholder="请输入泰语翻译" show-word-limit /> |
|
|
|
<el-input v-model="editForm.thai" placeholder="请输入泰语翻译" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="繁体中文:"> |
|
|
|
<el-input v-model="editForm.chineseTraditional" placeholder="请输入繁体中文翻译" |
|
|
|
show-word-limit /> |
|
|
|
<el-input v-model="editForm.chineseTraditional" placeholder="请输入繁体中文翻译" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="马来语:"> |
|
|
|
<el-input v-model="editForm.malay" placeholder="请输入马来语翻译" show-word-limit /> |
|
|
|
<el-input v-model="editForm.malay" placeholder="请输入马来语翻译" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="越南语:"> |
|
|
|
<el-input v-model="editForm.vietnamese" placeholder="请输入越南语翻译" show-word-limit /> |
|
|
|
<el-input v-model="editForm.vietnamese" placeholder="请输入越南语翻译" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
@ -222,6 +219,11 @@ import API from "@/util/http.js" |
|
|
|
import moment from 'moment' |
|
|
|
import { UploadFilled } from '@element-plus/icons-vue' |
|
|
|
import ConfirmDialog from '@/components/dialogs/ConfirmDialog.vue' |
|
|
|
// 引入AdminStore |
|
|
|
import { useAdminStore } from '@/store/index.js'; |
|
|
|
import { storeToRefs } from "pinia"; |
|
|
|
const adminStore = useAdminStore(); |
|
|
|
const { adminData } = storeToRefs(adminStore); |
|
|
|
|
|
|
|
// 响应式数据 |
|
|
|
const tableData = ref([]) |
|
|
|
@ -334,9 +336,33 @@ const handleAdd = () => { |
|
|
|
showEditDialog.value = true |
|
|
|
} |
|
|
|
|
|
|
|
const getMenuTree = async function () { |
|
|
|
// 获取菜单树 |
|
|
|
try { |
|
|
|
const result = await request({ |
|
|
|
url: '/menu/tree', |
|
|
|
data: { |
|
|
|
id: adminData.value.roleId, |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
if (result.code === 200) { |
|
|
|
adminStore.setMenuTree(result.data) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result.data // 直接返回接口响应数据 |
|
|
|
} catch (error) { |
|
|
|
console.error('菜单数据请求失败:', error) |
|
|
|
// return { code: 500, msg: '获取菜单失败' } |
|
|
|
ElMessage.error('网络异常') |
|
|
|
adminStore.clearState() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 保存翻译 |
|
|
|
const handleSave = async () => { |
|
|
|
// 原文必填校验 |
|
|
|
// 原文必填校验 |
|
|
|
if (!editForm.value.chineseSimplified || editForm.value.chineseSimplified.trim() === '') { |
|
|
|
ElMessage.error('原文为必填项') |
|
|
|
return |
|
|
|
@ -373,6 +399,8 @@ const handleSave = async () => { |
|
|
|
console.error('保存失败:', error) |
|
|
|
ElMessage.error('保存失败') |
|
|
|
} |
|
|
|
// 点击保存后,刷新菜单树 |
|
|
|
await getMenuTree() |
|
|
|
} |
|
|
|
|
|
|
|
// 删除翻译 - 打开确认对话框 |
|
|
|
@ -400,6 +428,8 @@ const handleDeleteConfirm = async () => { |
|
|
|
showDeleteDialog.value = false |
|
|
|
currentDeleteRow.value = null |
|
|
|
} |
|
|
|
// 点击删除后,刷新菜单树 |
|
|
|
await getMenuTree() |
|
|
|
} |
|
|
|
|
|
|
|
// 取消删除 |
|
|
|
@ -502,7 +532,7 @@ onMounted(() => { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
gap: 4px; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -512,6 +542,7 @@ onMounted(() => { |
|
|
|
align-items: center; |
|
|
|
gap: 4px; |
|
|
|
margin-bottom: 1vh; |
|
|
|
|
|
|
|
.add-item-export { |
|
|
|
background-color: #5870FF; |
|
|
|
color: white; |
|
|
|
|