✨多语言新增导入、删除
This commit is contained in:
parent
c379a8300c
commit
a5a4a42a96
@ -8,7 +8,7 @@ export function listCommonLang(query) {
|
||||
return request({
|
||||
url: 'system/CommonLang/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
params: query
|
||||
})
|
||||
}
|
||||
/**
|
||||
@ -18,7 +18,7 @@ export function listCommonLang(query) {
|
||||
export function listLangByLocale(locale) {
|
||||
return request({
|
||||
url: 'system/CommonLang/list/' + locale,
|
||||
method: 'get',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ export function addCommonLang(data) {
|
||||
return request({
|
||||
url: 'system/CommonLang',
|
||||
method: 'post',
|
||||
data: data,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ export function updateCommonLang(data) {
|
||||
return request({
|
||||
url: 'system/CommonLang',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@ -67,7 +67,6 @@ export function getCommonLangByKey(key) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除多语言配置
|
||||
* @param {主键} pid
|
||||
@ -79,6 +78,18 @@ export function delCommonLang(pid) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除多语言配置
|
||||
* @param {key} langkey
|
||||
*/
|
||||
export function delCommonLangByKey(langkey) {
|
||||
return request({
|
||||
url: 'system/CommonLang/ByKey',
|
||||
method: 'delete',
|
||||
params: { langkey }
|
||||
})
|
||||
}
|
||||
|
||||
// 导出多语言配置
|
||||
export function exportCommonLang(query) {
|
||||
return request({
|
||||
@ -86,4 +97,4 @@ export function exportCommonLang(query) {
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,23 @@
|
||||
{{ $t('btn.delete') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown trigger="click" v-hasPermi="['business:commonlang:import']">
|
||||
<el-button type="primary" plain icon="Upload">
|
||||
{{ $t('btn.import') }}<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="upload">
|
||||
<importData
|
||||
templateUrl="system/CommonLang/importTemplate"
|
||||
importUrl="/system/CommonLang/importData"
|
||||
@success="handleFileSuccess"></importData>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['system:lang:export']">{{ $t('btn.export') }}</el-button>
|
||||
</el-col>
|
||||
@ -115,19 +132,14 @@
|
||||
<el-button v-hasPermi="['system:lang:edit']" text size="small" icon="edit" title="编辑" @click="handleUpdateP(scope.row)">
|
||||
{{ $t('btn.edit') }}
|
||||
</el-button>
|
||||
<!-- <el-button v-hasPermi="['system:lang:delete']" type="danger" icon="delete" title="删除" @click="handleDeleteP(scope.row)"></el-button> -->
|
||||
<el-button v-hasPermi="['system:lang:delete']" text type="danger" icon="delete" title="删除" @click="handleDeleteByKey(scope.row)">
|
||||
{{ $t('btn.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-if="total > 0"
|
||||
class="mt10"
|
||||
background
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
<pagination class="mt10" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改多语言配置对话框 -->
|
||||
<el-dialog :title="title" :lock-scroll="false" v-model="open" width="550px">
|
||||
@ -174,8 +186,17 @@
|
||||
</template>
|
||||
|
||||
<script setup name="commonlang">
|
||||
import { listCommonLang, delCommonLang, updateCommonLang, getCommonLang, exportCommonLang, getCommonLangByKey } from '@/api/system/commonlang.js'
|
||||
import {
|
||||
listCommonLang,
|
||||
delCommonLang,
|
||||
updateCommonLang,
|
||||
getCommonLang,
|
||||
exportCommonLang,
|
||||
getCommonLangByKey,
|
||||
delCommonLangByKey
|
||||
} from '@/api/system/commonlang.js'
|
||||
import { isEmpty } from '@/utils/ruoyi.js'
|
||||
import importData from '@/components/ImportData'
|
||||
const { proxy } = getCurrentInstance()
|
||||
// 选中id数组数组
|
||||
const ids = ref([])
|
||||
@ -313,6 +334,18 @@ function handleDelete(row) {
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
function handleDeleteByKey(row) {
|
||||
proxy
|
||||
.$confirm('是否确认删除key为"' + row.langKey + '"的数据项?')
|
||||
.then(function () {
|
||||
return delCommonLangByKey(row.langKey)
|
||||
})
|
||||
.then(() => {
|
||||
handleQuery()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
}
|
||||
|
||||
// 修改按钮操作
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
@ -413,6 +446,19 @@ function sortChange(column) {
|
||||
|
||||
handleQuery()
|
||||
}
|
||||
// 导入数据成功处理
|
||||
const handleFileSuccess = (response) => {
|
||||
const { item1, item2 } = response.data
|
||||
var error = ''
|
||||
item2.forEach((item) => {
|
||||
error += item.storageMessage + ','
|
||||
})
|
||||
proxy.$alert(item1 + '<p>' + error + '</p>', '导入结果', {
|
||||
dangerouslyUseHTMLString: true
|
||||
})
|
||||
getList()
|
||||
}
|
||||
|
||||
handleQuery()
|
||||
reset()
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user