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', loginPwd:'Login password',
updateSure:'Do you want to update existing data', updateSure:'Do you want to update existing data',
downloadObj:'Download Tpl', 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: { setting: {
charMaxLen: 'bit character length', charMaxLen: 'bit character length',

View File

@@ -11,7 +11,7 @@ export default {
ipnutPlease: '请输入', ipnutPlease: '请输入',
selectPlease: '请选择', selectPlease: '请选择',
tipTitle: '提示', tipTitle: '提示',
msgSuccess: '{msg}成功 ', msgSuccess: '{msg} 成功',
errorFields: '请正确填写 {num} 处必填信息!', errorFields: '请正确填写 {num} 处必填信息!',
tablePaginationTotal: '总共 {total} 条', tablePaginationTotal: '总共 {total} 条',
zebraL:'表格斑马纹', zebraL:'表格斑马纹',
@@ -598,6 +598,33 @@ export default {
loginPwd:'登入密码', loginPwd:'登入密码',
updateSure:'是否更新已经存在的数据', updateSure:'是否更新已经存在的数据',
downloadObj:'下载模板', 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: { setting: {
charMaxLen: '位字符长度', charMaxLen: '位字符长度',

View File

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

View File

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