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', fold: 'Fold',
}, },
rowId: 'ID', rowId: 'ID',
createTime: 'Create Time',
updateTime: 'Update Time',
operate: 'Operation', operate: 'Operation',
operateOk: 'Operation Successful!', operateOk: 'Operation Successful!',
operateErr: 'Operation Failed!', operateErr: 'Operation Failed!',
copyText: "Copy",
copyOk: 'Copy Successful!',
units: { units: {
second: 'Second', second: 'Second',
minute: 'Minute', minute: 'Minute',
@@ -576,6 +580,13 @@ export default {
}, },
}, },
ne: { ne: {
common: {
neType: 'NE Type',
neId: 'NE ID',
serialNum: 'Serial Num',
expiryDate: 'Expiry Date',
remark: 'Remark',
},
neInfo: { neInfo: {
version: "Version", version: "Version",
serialNum: 'Serial Number', serialNum: 'Serial Number',
@@ -642,6 +653,19 @@ export default {
rollbackTipEmpty: "There is currently no rollback available", rollbackTipEmpty: "There is currently no rollback available",
rollbackTipEqual: 'The current version is the same as the previous version', 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: { neUser: {
auth: { auth: {

View File

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

View File

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

View File

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

View File

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