fix: 网元授权多语言翻译

This commit is contained in:
TsMask
2024-05-17 15:18:01 +08:00
parent 531cd6d03d
commit 85ae7dc5ea
5 changed files with 120 additions and 73 deletions

View File

@@ -53,9 +53,13 @@ export default {
fold: 'Fold',
},
rowId: 'ID',
createTime: 'Create Time',
updateTime: 'Update Time',
operate: 'Operation',
operateOk: 'Operation Successful!',
operateErr: 'Operation Failed!',
copyText: "Copy",
copyOk: 'Copy Successful!',
units: {
second: 'Second',
minute: 'Minute',
@@ -576,6 +580,13 @@ export default {
},
},
ne: {
common: {
neType: 'NE Type',
neId: 'NE ID',
serialNum: 'Serial Num',
expiryDate: 'Expiry Date',
remark: 'Remark',
},
neInfo: {
version: "Version",
serialNum: 'Serial Number',
@@ -642,6 +653,19 @@ export default {
rollbackTipEmpty: "There is currently no rollback available",
rollbackTipEqual: 'The current version is the same as the previous version',
},
neLicense: {
status: "License Status",
change: "Change License",
reload: "Refresh Info",
reloadTip: "Confirmed to refresh the [{txt}] license information?",
reloadBatch: "Batch Refresh",
reloadBatchTip: "Do you do an information refresh on checked records?",
updateTtile: "Update License",
downCodeTop: "Confirmed to save the license activation code to a file?",
activationRequestCode: "License Activation Code",
licensePath: "License File",
licensePathTip: "Please upload license file",
},
},
neUser: {
auth: {

View File

@@ -53,9 +53,13 @@ export default {
fold: '折叠',
},
rowId: '编号',
createTime: '创建时间',
updateTime: '更新时间',
operate: '操作',
operateOk: '操作成功!',
operateErr: '操作失败!',
copyText: "复制",
copyOk: '复制成功!',
units: {
second: '秒',
minute: '分钟',
@@ -576,6 +580,13 @@ export default {
},
},
ne: {
common: {
neType: '网元类型',
neId: '网元内部标识',
serialNum: '序列号',
expiryDate: '许可证到期时间',
remark: '备注',
},
neInfo: {
version: "网元版本",
serialNum: '序列号',
@@ -642,6 +653,19 @@ export default {
rollbackTipEmpty: "目前没有可用的回滚",
rollbackTipEqual: '当前版本与之前版本相同',
},
neLicense: {
status: "许可证状态",
change: "变更许可证",
reload: "刷新信息",
reloadTip: "确认要刷新【{txt}】许可证信息吗?",
reloadBatch: "批量刷新",
reloadBatchTip: "对勾选的记录进行信息刷新吗?",
updateTtile: "更新许可证",
downCodeTop: "确认要将许可激活码保存到文件吗?",
activationRequestCode: "许可激活码",
licensePath: "许可证文件",
licensePathTip: "请上传许可证文件",
},
},
neUser: {
auth: {

View File

@@ -80,22 +80,10 @@ let modalState: ModalStateType = reactive({
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
neType: [
{
required: true,
message: 'Please input NE Type',
},
],
neId: [
{
required: true,
message: 'Please input NE ID',
},
],
licensePath: [
{
required: true,
message: 'Please upload file',
message: t('views.ne.neLicense.licensePathTip'),
},
],
})
@@ -155,12 +143,14 @@ function fnModalCancel() {
function fnBeforeUploadFile(file: FileType) {
if (modalState.confirmLoading) return false;
if (!file.name.endsWith('.ini')) {
message.error('只支持上传文件格式 .ini', 3);
const msg = `${t('components.UploadModal.onlyAllow')} .ini`;
message.error(msg, 3);
return Upload.LIST_IGNORE;
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('文件必须小于2MB', 3);
const isLt3M = file.size / 1024 / 1024 < 3;
if (!isLt3M) {
const msg = `${t('components.UploadModal.allowFilter')} 3MB`;
message.error(msg, 3);
return Upload.LIST_IGNORE;
}
return true;
@@ -200,7 +190,7 @@ function fnCopyCode() {
const code = modalState.from.activationRequestCode;
if (!code) return;
copy(code).then(() => {
message.success('copy success', 3);
message.success(t('common.copyOk'), 3);
});
}
@@ -210,7 +200,7 @@ function fnDownCode() {
if (!activationRequestCode) return;
Modal.confirm({
title: t('common.tipTitle'),
content: 'Confirm to download the Code as a file for saving?',
content: t('views.ne.neLicense.downCodeTop'),
onOk() {
const blob = new Blob([activationRequestCode], {
type: 'text/plain',
@@ -231,7 +221,7 @@ function fnModalVisibleById(id: string) {
if (res.code === RESULT_CODE_SUCCESS) {
Object.assign(modalState.from, res.data);
modalState.from.licensePath = '';
modalState.title = 'Update License';
modalState.title = t('views.ne.neLicense.updateTtile');
modalState.visibleByEdit = true;
} else {
message.error(res.msg, 3);
@@ -255,7 +245,7 @@ function fnModalVisibleByTypeAndId(neType: string, neId: string) {
if (res.code === RESULT_CODE_SUCCESS) {
Object.assign(modalState.from, res.data);
modalState.from.licensePath = '';
modalState.title = 'Update License';
modalState.title = t('views.ne.neLicense.updateTtile');
modalState.visibleByEdit = true;
} else {
message.error(res.msg, 3);
@@ -303,23 +293,29 @@ onMounted(() => {});
:label-col="{ span: 6 }"
:labelWrap="true"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label="t('views.configManage.license.neType')"
:label-col="{ span: 12 }"
:label="t('views.ne.common.neType')"
name="neType"
v-bind="modalStateFrom.validateInfos.neType"
>
<a-input v-model:value="modalState.from.neType" :disabled="true" />
{{ modalState.from.neType }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label="t('views.configManage.license.neId')"
:label-col="{ span: 12 }"
:label="t('views.ne.common.neId')"
name="neId"
v-bind="modalStateFrom.validateInfos.neId"
>
<a-input v-model:value="modalState.from.neId" :disabled="true" />
{{ modalState.from.neId }}
</a-form-item>
</a-col>
</a-row>
<a-form-item
label="ActivationRequestCode"
:label="t('views.ne.neLicense.activationRequestCode')"
name="activationRequestCode"
v-bind="modalStateFrom.validateInfos.activationRequestCode"
>
@@ -329,12 +325,12 @@ onMounted(() => {});
:disabled="true"
style="width: calc(100% - 64px)"
/>
<a-tooltip title="Copy">
<a-tooltip :title="t('common.copyText')" placement="topRight">
<a-button type="default" @click="fnCopyCode()">
<template #icon><CopyOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip title="Download">
<a-tooltip :title="t('common.downloadText')" placement="topRight">
<a-button type="primary" @click="fnDownCode()">
<template #icon><DownloadOutlined /></template>
</a-button>
@@ -343,7 +339,7 @@ onMounted(() => {});
</a-form-item>
<a-form-item
:label="t('views.configManage.license.updateFile')"
:label="t('views.ne.neLicense.licensePath')"
name="file"
v-bind="modalStateFrom.validateInfos.licensePath"
>
@@ -376,7 +372,7 @@ onMounted(() => {});
<a-switch v-model:checked="modalState.from.reload"> </a-switch>
</a-form-item>
<a-form-item label="Remark" name="remark">
<a-form-item :label="t('views.ne.common.remark')" name="remark">
<a-textarea
v-model:value="modalState.from.remark"
:maxlength="200"

View File

@@ -29,8 +29,8 @@ let queryParams = reactive({
neType: undefined,
/**网元ID */
neId: '',
/**过期时间 */
expiryDate: '',
/**序列号 */
serialNum: '',
/**当前页数 */
pageNum: 1,
/**每页条数 */
@@ -42,7 +42,7 @@ function fnQueryReset() {
queryParams = Object.assign(queryParams, {
neType: undefined,
neId: '',
expiryDate: '',
serialNum: '',
pageNum: 1,
pageSize: 20,
});
@@ -83,48 +83,48 @@ let tableColumns = ref<TableColumnsType>([
width: 100,
},
{
title: 'neType',
title: t('views.ne.common.neType'),
dataIndex: 'neType',
align: 'left',
width: 100,
},
{
title: 'neId',
title: t('views.ne.common.neId'),
dataIndex: 'neId',
align: 'left',
width: 100,
},
{
title: 'status',
title: t('views.ne.neLicense.status'),
dataIndex: 'status',
key: 'status',
align: 'left',
width: 100,
width: 120,
},
{
title: 'serialNum',
title: t('views.ne.common.serialNum'),
dataIndex: 'serialNum',
align: 'left',
width: 100,
},
{
title: 'expiryDate',
title: t('views.ne.common.expiryDate'),
dataIndex: 'expiryDate',
align: 'left',
width: 100,
width: 120,
},
{
title: 'remark',
title: t('views.ne.common.remark'),
dataIndex: 'remark',
key: 'remark',
align: 'left',
width: 150,
resizable: true,
minWidth: 100,
maxWidth: 200,
maxWidth: 300,
},
{
title: 'updateTime',
title: t('common.updateTime'),
dataIndex: 'updateTime',
align: 'center',
customRender(opt) {
@@ -249,12 +249,14 @@ function fnModalCancel() {
modalState.licenseId = '';
}
/**刷新网元授权信息 */
function fnRecordRefresh(row: Record<string, any>) {
/**刷新网元授权状态 */
function fnRecordState(row: Record<string, any>) {
if (modalState.confirmLoading) return;
Modal.confirm({
title: t('common.tipTitle'),
content: 'Refresh Ne License info?',
content: t('views.ne.neLicense.reloadTip', {
txt: `${row.neType} ${row.neId}`,
}),
onOk() {
modalState.confirmLoading = true;
const hide = message.loading(t('common.loading'), 0);
@@ -270,9 +272,7 @@ function fnRecordRefresh(row: Record<string, any>) {
);
} else {
row.status = '0';
row.serialNum = '-';
row.expiryDate = '-';
message.success(
message.warning(
`${row.neType} ${row.neId} ${dictStatus.value[0].label}`,
3
);
@@ -286,12 +286,12 @@ function fnRecordRefresh(row: Record<string, any>) {
});
}
/**勾选刷新网元状态 */
function fnRecordState() {
/**刷新网元授权状态 勾选 */
function fnRecordStateBatch() {
if (modalState.confirmLoading) return;
Modal.confirm({
title: t('common.tipTitle'),
content: `check refresh license state?`,
content: t('views.ne.neLicense.reloadBatchTip'),
onOk: async () => {
modalState.confirmLoading = true;
const hide = message.loading(t('common.loading'), 0);
@@ -309,6 +309,8 @@ function fnRecordState() {
row.status = '1';
row.serialNum = res.data.sn;
row.expiryDate = res.data.expire;
} else {
row.status = '0';
}
tableState.selectedRowKeys = [];
}
@@ -355,7 +357,7 @@ 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="neType" name="neId ">
<a-form-item :label="t('views.ne.common.neType')" name="neType ">
<a-auto-complete
v-model:value="queryParams.neType"
:options="NE_TYPE_LIST.map(v => ({ value: v }))"
@@ -365,7 +367,7 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="neId" name="neId">
<a-form-item :label="t('views.ne.common.neId')" name="neId">
<a-input
v-model:value="queryParams.neId"
:allow-clear="true"
@@ -374,9 +376,12 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="expiryDate" name="expiryDate">
<a-form-item
:label="t('views.ne.common.serialNum')"
name="serialNum"
>
<a-input
v-model:value="queryParams.expiryDate"
v-model:value="queryParams.serialNum"
:allow-clear="true"
:placeholder="t('common.inputPlease')"
></a-input>
@@ -408,10 +413,10 @@ onMounted(() => {
type="default"
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordState()"
@click.prevent="fnRecordStateBatch()"
>
<template #icon><SecurityScanOutlined /></template>
Refresh Status
{{ t('views.ne.neLicense.reloadBatch') }}
</a-button>
</a-space>
</template>
@@ -503,7 +508,7 @@ onMounted(() => {
<template v-if="column.key === 'id'">
<a-space :size="8" align="center">
<a-tooltip placement="topRight">
<template #title>Change License</template>
<template #title>{{ t('views.ne.neLicense.change') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.id)"
@@ -512,8 +517,8 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip placement="topRight">
<template #title>Refresh Info</template>
<a-button type="link" @click.prevent="fnRecordRefresh(record)">
<template #title>{{ t('views.ne.neLicense.reload') }}</template>
<a-button type="link" @click.prevent="fnRecordState(record)">
<template #icon><SecurityScanOutlined /> </template>
</a-button>
</a-tooltip>

View File

@@ -136,8 +136,6 @@ function fnRecordState() {
row.expiryDate = res.data.expire;
} else {
row.status = '0';
row.serialNum = '-';
row.expiryDate = '-';
}
}
message.success(t('common.operateOk'), 3);