✨多语言新增导入、删除
This commit is contained in:
parent
c379a8300c
commit
a5a4a42a96
@ -8,7 +8,7 @@ export function listCommonLang(query) {
|
|||||||
return request({
|
return request({
|
||||||
url: 'system/CommonLang/list',
|
url: 'system/CommonLang/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query,
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -18,7 +18,7 @@ export function listCommonLang(query) {
|
|||||||
export function listLangByLocale(locale) {
|
export function listLangByLocale(locale) {
|
||||||
return request({
|
return request({
|
||||||
url: 'system/CommonLang/list/' + locale,
|
url: 'system/CommonLang/list/' + locale,
|
||||||
method: 'get',
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ export function addCommonLang(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: 'system/CommonLang',
|
url: 'system/CommonLang',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ export function updateCommonLang(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: 'system/CommonLang',
|
url: 'system/CommonLang',
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
data: data,
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,6 @@ export function getCommonLangByKey(key) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除多语言配置
|
* 删除多语言配置
|
||||||
* @param {主键} pid
|
* @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) {
|
export function exportCommonLang(query) {
|
||||||
return request({
|
return request({
|
||||||
@ -86,4 +97,4 @@ export function exportCommonLang(query) {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,6 +58,23 @@
|
|||||||
{{ $t('btn.delete') }}
|
{{ $t('btn.delete') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</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-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['system:lang:export']">{{ $t('btn.export') }}</el-button>
|
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['system:lang:export']">{{ $t('btn.export') }}</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -115,19 +132,14 @@
|
|||||||
<el-button v-hasPermi="['system:lang:edit']" text size="small" icon="edit" title="编辑" @click="handleUpdateP(scope.row)">
|
<el-button v-hasPermi="['system:lang:edit']" text size="small" icon="edit" title="编辑" @click="handleUpdateP(scope.row)">
|
||||||
{{ $t('btn.edit') }}
|
{{ $t('btn.edit') }}
|
||||||
</el-button>
|
</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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination class="mt10" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
v-if="total > 0"
|
|
||||||
class="mt10"
|
|
||||||
background
|
|
||||||
: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">
|
<el-dialog :title="title" :lock-scroll="false" v-model="open" width="550px">
|
||||||
@ -174,8 +186,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="commonlang">
|
<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 { isEmpty } from '@/utils/ruoyi.js'
|
||||||
|
import importData from '@/components/ImportData'
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
// 选中id数组数组
|
// 选中id数组数组
|
||||||
const ids = ref([])
|
const ids = ref([])
|
||||||
@ -313,6 +334,18 @@ function handleDelete(row) {
|
|||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDeleteByKey(row) {
|
||||||
|
proxy
|
||||||
|
.$confirm('是否确认删除key为"' + row.langKey + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
|
return delCommonLangByKey(row.langKey)
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
handleQuery()
|
||||||
|
proxy.$modal.msgSuccess('删除成功')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 修改按钮操作
|
// 修改按钮操作
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset()
|
reset()
|
||||||
@ -413,6 +446,19 @@ function sortChange(column) {
|
|||||||
|
|
||||||
handleQuery()
|
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()
|
handleQuery()
|
||||||
reset()
|
reset()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user