style: 参数配置管理多语言

This commit is contained in:
TsMask
2023-11-10 15:48:41 +08:00
parent 973534a6ab
commit e5481638f5
4 changed files with 160 additions and 61 deletions

View File

@@ -598,6 +598,33 @@ export default {
loginPwd:'Login password',
updateSure:'Do you want to update existing data',
downloadObj:'Download Tpl',
importTitle:'User Import',
importOk: 'Successfully read and download imported templates',
tipRowErr: "Failed to get user information",
viewInfoErr: "Errors in user records",
},
config: {
configName: "Config Name",
configNamePlease: 'Please input the Config Name correctly',
configKey: "Config Key",
configKeyPlease: 'Please enter the Config Key correctly',
configType: "Config Type",
configValue: "Config Value",
configValuePlease: 'Please enter the Config Value correctly',
remark: "Config description",
createTime: "CreateTime",
refreshCache: "Refresh Cache",
viewInfo: "Config Info",
viewInfoErr: "Failed to get Config Info",
addInfo: "Adding Parameter Configuration",
editInfo: "Modify the Config Info",
tipRowErr: "There is an error in the Config Info record",
delTip: "Confirm deleting the data item with parameter number [{num}] ?",
delOk: "Deleted successfully",
exportTip: "Confirm exporting xlsx table files based on search criteria?",
exportOk: "Completed export",
refreshCacheTip: "Are you sure you want to refresh the parameter configuration cache?",
refreshCacheOk: "Refresh Cache Successful",
},
setting: {
charMaxLen: 'bit character length',

View File

@@ -598,6 +598,33 @@ export default {
loginPwd:'登入密码',
updateSure:'是否更新已经存在的数据',
downloadObj:'下载模板',
importTitle:'用户导入',
importOk: '成功读取并下载导入模板',
tipRowErr: "获取用户信息失败",
viewInfoErr: "用户记录存在错误",
},
config: {
configName: "参数名称",
configNamePlease: '请正确输入参数名称',
configKey: "参数键名",
configKeyPlease: '请正确输入参数键名',
configType: "系统内置",
configValue: "参数键值",
configValuePlease: '请正确输入参数键值',
remark: "参数说明",
createTime: "创建时间",
refreshCache: "刷新缓存",
viewInfo: "参数配置信息",
viewInfoErr: "获取参数配置信息失败",
addInfo: "添加参数配置",
editInfo: "修改参数配置",
tipRowErr: "参数配置记录存在错误",
delTip: "确认删除参数编号为 【{num}】 的数据项?",
delOk: "删除成功",
exportTip: "确认根据搜索条件导出xlsx表格文件吗?",
exportOk: "已完成导出",
refreshCacheTip: "确定要刷新参数配置缓存吗?",
refreshCacheOk: "刷新缓存成功",
},
setting: {
charMaxLen: '位字符长度',

View File

@@ -97,33 +97,33 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '参数编号',
title: t('common.rowId'),
dataIndex: 'configId',
align: 'center',
},
{
title: '参数名称',
title: t('views.system.config.configName'),
dataIndex: 'configName',
align: 'center',
},
{
title: '参数键名',
title: t('views.system.config.configKey'),
dataIndex: 'configKey',
align: 'center',
},
{
title: '参数键值',
title: t('views.system.config.configValue'),
dataIndex: 'configValue',
align: 'center',
},
{
title: '系统内置',
title: t('views.system.config.configType'),
dataIndex: 'configType',
key: 'configType',
align: 'center',
},
{
title: '创建时间',
title: t('views.system.config.createTime'),
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
@@ -132,7 +132,7 @@ let tableColumns: ColumnsType = [
},
},
{
title: '操作',
title: t('common.operate'),
key: 'configId',
align: 'center',
},
@@ -156,7 +156,8 @@ let tablePagination = reactive({
showSizeChanger: true,
/**数据总数 */
total: 0,
showTotal: (total: number) => `总共 ${total}`,
showTotal: (total: number) =>
t('common.tablePaginationTotal', { total: total }),
onChange: (page: number, pageSize: number) => {
tablePagination.current = page;
tablePagination.pageSize = pageSize;
@@ -216,13 +217,28 @@ const modalStateFrom = Form.useForm(
modalState.from,
reactive({
configName: [
{ required: true, min: 1, max: 50, message: '请正确输入参数名称' },
{
required: true,
min: 1,
max: 50,
message: t('views.system.config.configNamePlease'),
},
],
configKey: [
{ required: true, min: 1, max: 50, message: '请正确输入参数键名' },
{
required: true,
min: 1,
max: 50,
message: t('views.system.config.configKeyPlease'),
},
],
configValue: [
{ required: true, min: 1, max: 250, message: '请正确输入参数键值' },
{
required: true,
min: 1,
max: 250,
message: t('views.system.config.configValuePlease'),
},
],
})
);
@@ -233,16 +249,16 @@ const modalStateFrom = Form.useForm(
*/
function fnModalVisibleByVive(configId: string | number) {
if (!configId) {
message.error(`参数配置记录存在错误`, 2);
message.error(t('views.system.config.tipRowErr'), 2);
return;
}
getConfig(configId).then(res => {
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '参数配置信息';
modalState.title = t('views.system.config.viewInfo');
modalState.visibleByView = true;
} else {
message.error(`获取参数配置信息失败`, 2);
message.error(t('views.system.config.viewInfoErr'), 2);
}
});
}
@@ -254,7 +270,7 @@ function fnModalVisibleByVive(configId: string | number) {
function fnModalVisibleByEdit(configId?: string | number) {
if (!configId) {
modalStateFrom.resetFields();
modalState.title = '添加参数配置';
modalState.title = t('views.system.config.addInfo');
modalState.visibleByEdit = true;
} else {
if (modalState.confirmLoading) return;
@@ -265,10 +281,10 @@ function fnModalVisibleByEdit(configId?: string | number) {
hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改参数配置';
modalState.title = t('views.system.config.editInfo');
modalState.visibleByEdit = true;
} else {
message.error(`获取参数配置信息失败`, 2);
message.error(t('views.system.config.viewInfoErr'), 2);
}
});
}
@@ -291,7 +307,7 @@ function fnModalOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${modalState.title}成功`,
content: t('common.msgSuccess', { msg: modalState.title }),
key,
duration: 2,
});
@@ -311,7 +327,7 @@ function fnModalOk() {
});
})
.catch(e => {
message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2);
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
});
}
@@ -335,14 +351,14 @@ function fnRecordDelete(configId: string = '0') {
}
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除参数编号为 【${configId}】 的数据项?`,
content: t('views.system.config.delTip', { num: configId }),
onOk() {
const key = 'delConfig';
message.loading({ content: t('common.loading'), key });
delConfig(configId).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('views.system.config.delOk'),
key,
duration: 2,
});
@@ -363,14 +379,14 @@ function fnRecordDelete(configId: string = '0') {
function fnExportList() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认根据搜索条件导出xlsx表格文件吗?`,
content: t('views.system.config.exportTip'),
onOk() {
const key = 'exportConfig';
message.loading({ content: t('common.loading'), key });
exportConfig(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
content: t('views.system.config.exportOk'),
key,
duration: 2,
});
@@ -393,14 +409,14 @@ function fnExportList() {
function fnRefreshCache() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确定要刷新参数配置缓存吗?`,
content: t('views.system.config.refreshCacheTip'),
onOk() {
const key = 'refreshCache';
message.loading({ content: t('common.loading'), key });
refreshCache().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `刷新缓存成功`,
content: t('views.system.config.refreshCacheOk'),
key,
duration: 2,
});
@@ -461,25 +477,34 @@ onMounted(() => {
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="参数名称" name="configName">
<a-form-item
:label="t('views.system.config.configName')"
name="configName"
>
<a-input
v-model:value="queryParams.configName"
allow-clear
:placeholder="t('common.ipnutPlease')"
:placeholder="t('views.system.config.configNamePlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="参数键名" name="configKey">
<a-form-item
:label="t('views.system.config.configKey')"
name="configKey"
>
<a-input
v-model:value="queryParams.configKey"
allow-clear
:placeholder="t('common.ipnutPlease')"
:placeholder="t('views.system.config.configKeyPlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="4" :md="12" :xs="24">
<a-form-item label="系统内置" name="configType">
<a-form-item
:label="t('views.system.config.configType')"
name="configType"
>
<a-select
v-model:value="queryParams.configType"
allow-clear
@@ -490,7 +515,10 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="创建时间" name="queryRangePicker">
<a-form-item
:label="t('views.system.config.createTime')"
name="queryRangePicker"
>
<a-range-picker
v-model:value="queryRangePicker"
allow-clear
@@ -547,7 +575,7 @@ onMounted(() => {
v-perms:has="['system:config:remove']"
>
<template #icon><SyncOutlined /></template>
刷新缓存
{{ t('views.system.config.refreshCache') }}
</a-button>
<a-button
type="dashed"
@@ -638,7 +666,7 @@ onMounted(() => {
<template v-if="column.key === 'configId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>查看详情</template>
<template #title>{{ t('common.viewText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByVive(record.configId)"
@@ -648,7 +676,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>编辑</template>
<template #title>{{ t('common.editText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.configId)"
@@ -658,7 +686,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>删除</template>
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.configId)"
@@ -683,12 +711,18 @@ onMounted(() => {
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="参数名称" name="configName">
<a-form-item
:label="t('views.system.config.configName')"
name="configName"
>
{{ modalState.from.configName }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="系统内置" name="configType">
<a-form-item
:label="t('views.system.config.configType')"
name="configType"
>
<DictTag
:options="dict.sysYesNo"
:value="modalState.from.configType"
@@ -698,22 +732,30 @@ onMounted(() => {
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="参数键名" name="configKey">
<a-form-item
:label="t('views.system.config.configKey')"
name="configKey"
>
{{ modalState.from.configKey }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="参数键值" name="configValue">
<a-form-item
:label="t('views.system.config.configValue')"
name="configValue"
>
{{ modalState.from.configValue }}
</a-form-item>
</a-col>
</a-row>
<a-form-item label="参数说明" name="remark">
<a-form-item :label="t('views.system.config.remark')" name="remark">
{{ modalState.from.remark }}
</a-form-item>
</a-form>
<template #footer>
<a-button key="cancel" @click="fnModalCancel">关闭</a-button>
<a-button key="cancel" @click="fnModalCancel">
{{ t('common.close') }}
</a-button>
</template>
</a-modal>
@@ -732,23 +774,26 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="参数名称"
:label="t('views.system.config.configName')"
name="configName"
v-bind="modalStateFrom.validateInfos.configName"
>
<a-input
v-model:value="modalState.from.configName"
allow-clear
placeholder="请输入参数名称"
:placeholder="t('views.system.config.configNamePlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="系统内置" name="configType">
<a-form-item
:label="t('views.system.config.configType')"
name="configType"
>
<a-select
v-model:value="modalState.from.configType"
default-value="N"
placeholder="系统内置"
:placeholder="t('common.selectPlease')"
:options="dict.sysYesNo"
>
</a-select>
@@ -759,39 +804,39 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="参数键名"
:label="t('views.system.config.configKey')"
name="configKey"
v-bind="modalStateFrom.validateInfos.configKey"
>
<a-input
v-model:value="modalState.from.configKey"
allow-clear
placeholder="请输入参数名称"
:placeholder="t('views.system.config.configKeyPlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="参数键值"
:label="t('views.system.config.configValue')"
name="configValue"
v-bind="modalStateFrom.validateInfos.configValue"
>
<a-input
v-model:value="modalState.from.configValue"
allow-clear
placeholder="请输入参数键值"
:placeholder="t('views.system.config.configValuePlease')"
></a-input>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="参数说明" name="remark">
<a-form-item :label="t('views.system.config.remark')" name="remark">
<a-textarea
v-model:value="modalState.from.remark"
:auto-size="{ minRows: 4, maxRows: 6 }"
:maxlength="450"
:show-count="true"
placeholder="请输入参数说明"
:placeholder="t('common.ipnutPlease')"
/>
</a-form-item>
</a-form>

View File

@@ -318,7 +318,7 @@ const modalStateFrom = Form.useForm(
*/
function fnModalVisibleByVive(userId: string | number) {
if (!userId) {
message.error(`用户记录存在错误`, 2);
message.error(t('views.system.user.viewInfoErr'), 2);
return;
}
if (modalState.confirmLoading) return;
@@ -349,7 +349,7 @@ function fnModalVisibleByVive(userId: string | number) {
modalState.title = t('views.system.user.userInfo');
modalState.visibleByView = true;
} else {
message.error('获取用户信息失败', 2);
message.error(t('views.system.user.tipRowErr'), 2);
}
});
}
@@ -389,7 +389,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
t('common.addText') + t('views.system.user.userInfo');
modalState.visibleByEdit = true;
} else {
message.error('获取用户信息失败', 2);
message.error(t('views.system.user.tipRowErr'), 2);
}
});
} else {
@@ -420,7 +420,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
t('common.editText') + t('views.system.user.userInfo');
modalState.visibleByEdit = true;
} else {
message.error(`获取用户信息失败`, 2);
message.error(t('views.system.user.tipRowErr'), 2);
}
});
}
@@ -659,7 +659,7 @@ type ModalUploadImportStateType = {
/**对话框表格信息导入对象信息状态 */
let uploadImportState: ModalUploadImportStateType = reactive({
visible: false,
title: '用户导入',
title: t('views.system.user.importTitle'),
loading: false,
updateSupport: false,
msg: '',
@@ -707,7 +707,7 @@ function fnModalUploadImportExportTemplate() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `成功读取并下载导入模板`,
content: t('views.system.user.importOk'),
duration: 2,
});
saveAs(res.data, `user_template_${Date.now()}.xlsx`);
@@ -1060,9 +1060,9 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>{{
t('views.system.user.resetPwd')
}}</template>
<template #title>
{{ t('views.system.user.resetPwd') }}
</template>
<a-button
type="link"
@click.prevent="fnRecordResetPwd(record)"