---新增参数配置,字典配置国家化

This commit is contained in:
lai
2023-11-11 16:31:42 +08:00
parent cca9973b28
commit 7a93768fd0
8 changed files with 582 additions and 290 deletions

View File

@@ -75,7 +75,7 @@ function fnTabActiveTopTag(key: string | number) {
}
} else {
message.warning({
content: `暂无配置项数据`,
content: t('views.configManage.configParam.dataNull'),
duration: 3,
});
}
@@ -94,7 +94,7 @@ function fnGetParamConfigTopTab() {
const neType = neTypeSelect.value[0];
if (!neType) {
message.warning({
content: `请选择网元类型`,
content: t('views.configManage.softwareManage.neTypePlease'),
duration: 3,
});
return;
@@ -110,7 +110,7 @@ function fnGetParamConfigTopTab() {
}
} else {
message.warning({
content: `暂无配置项数据`,
content: t('views.configManage.configParam.dataNull'),
duration: 3,
});
}
@@ -226,7 +226,9 @@ function listEditOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${from['display']} 属性值修改成功`,
content:
`${from['display']} ` +
t('views.configManage.configParam.editSuss'),
duration: 3,
});
// 改变表格数据
@@ -238,7 +240,7 @@ function listEditOk() {
}
} else {
message.warning({
content: `属性值修改失败`,
content: t('views.configManage.configParam.editFail'),
duration: 3,
});
}
@@ -246,7 +248,7 @@ function listEditOk() {
.catch(err => {
console.error(err);
message.error({
content: `非法操作属性值`,
content: t('views.configManage.configParam.unable'),
duration: 3,
});
})
@@ -315,7 +317,9 @@ function arrayEditOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `Index 为 ${from['index']['value']} 记录修改成功`,
content:
`Index : ${from['index']['value']} ` +
t('views.configManage.configParam.editSuss'),
duration: 3,
});
// 改变表格数据
@@ -328,7 +332,7 @@ function arrayEditOk() {
}
} else {
message.warning({
content: `记录修改失败`,
content: t('views.configManage.configParam.editFail'),
duration: 3,
});
}
@@ -336,7 +340,7 @@ function arrayEditOk() {
.catch(err => {
console.error(err);
message.error({
content: `非法操作记录参数`,
content: t('views.configManage.configParam.unable'),
duration: 3,
});
})
@@ -354,7 +358,9 @@ function arrayDelete(row: Record<string, any>) {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除Index为 【${from['index']['value']}】 的数据项?`,
content: t('views.configManage.configParam.delSure', {
value: from['index']['value'],
}),
onOk() {
const hide = message.loading({ content: t('common.loading') });
delParamConfigInfo({
@@ -366,7 +372,7 @@ function arrayDelete(row: Record<string, any>) {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('common.msgSuccess', { msg: t('common.deleteText') }),
duration: 2,
});
} else {
@@ -510,13 +516,15 @@ function arrayAddOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `Index 为 ${from['index']['value']} 记录新增成功`,
content:
`Index : ${from['index']['value']} ` +
t('views.configManage.configParam.addSuss'),
duration: 3,
});
} else {
tableState.arrayData.pop();
message.warning({
content: `新增失败`,
content: t('views.configManage.configParam.addFail'),
duration: 3,
});
}
@@ -524,7 +532,7 @@ function arrayAddOk() {
.catch(err => {
console.error(err);
message.error({
content: `非法操作记录参数`,
content: t('views.configManage.configParam.unable'),
duration: 3,
});
})
@@ -670,13 +678,15 @@ function arrayChildEditOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `Index 为 ${from['index']['value']} 记录修改成功`,
content:
`Index : ${from['index']['value']} ` +
t('views.configManage.configParam.editSuss'),
duration: 3,
});
fnTabActiveTopTag('#');
} else {
message.warning({
content: `记录修改失败`,
content: t('views.configManage.configParam.editFail'),
duration: 3,
});
}
@@ -684,7 +694,7 @@ function arrayChildEditOk() {
.catch(err => {
console.error(err);
message.error({
content: `非法操作记录参数`,
content: t('views.configManage.configParam.unable'),
duration: 3,
});
})
@@ -702,7 +712,10 @@ function arrayChildDelete(row: Record<string, any>) {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除${tableState.arrayChildTitle} Index 为 【${from['index']['value']}】 的数据项?`,
content: t('views.configManage.configParam.unable', {
arrayChildTitle: tableState.arrayChildTitle,
value: from['index']['value'],
}),
onOk() {
const hide = message.loading({ content: t('common.loading') });
delParamConfigInfo({
@@ -714,7 +727,7 @@ function arrayChildDelete(row: Record<string, any>) {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('common.msgSuccess', { msg: t('common.deleteText') }),
duration: 2,
});
} else {
@@ -858,14 +871,16 @@ function arrayChildAddOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `Index 为 ${from['index']['value']} 记录新增成功`,
content:
`Index :${from['index']['value']} ` +
t('views.configManage.configParam.addSuss'),
duration: 3,
});
fnTabActiveTopTag('#');
} else {
tableState.arrayChildData.pop();
message.warning({
content: `新增失败`,
content: t('views.configManage.configParam.addFail'),
duration: 3,
});
}
@@ -873,7 +888,7 @@ function arrayChildAddOk() {
.catch(err => {
console.error(err);
message.error({
content: `非法操作记录参数`,
content: t('views.configManage.configParam.unable'),
duration: 3,
});
})
@@ -910,18 +925,29 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
const maxInt = parseInt(filterArr[1]);
const valueInt = parseInt(value);
if (valueInt < minInt || valueInt > maxInt) {
return [false, `${display} 参数值不在合理范围 ${filter}`];
return [
false,
`${display} ${t(
'views.configManage.configParam.parUnable'
)} ${filter}`,
];
}
}
break;
case 'ipv4':
if (!regExpIPv4.test(value)) {
return [false, `${display} 不是合法的IPV4地址`];
return [
false,
`${display} ${t('views.configManage.configParam.ipv4Tip')}`,
];
}
break;
case 'ipv6':
if (!regExpIPv6.test(value)) {
return [false, `${display} 不是合法的IPV6地址`];
return [
false,
`${display} ${t('views.configManage.configParam.ipv6Tip')}`,
];
}
break;
case 'enum':
@@ -934,7 +960,10 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
}
if (!Object.keys(filterJson).includes(`${value}`)) {
return [false, `${display} 不是合理的枚举值`];
return [
false,
`${display} ${t('views.configManage.configParam.enumTip')}`,
];
}
}
break;
@@ -948,7 +977,10 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
}
if (!Object.values(filterJson).includes(`${value}`)) {
return [false, `${display} 不是合理的布尔类型的值`];
return [
false,
`${display} ${t('views.configManage.configParam.boolTip')}`,
];
}
}
break;
@@ -960,7 +992,10 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
'^\\S{' + filterArr[0] + ',' + filterArr[1] + '}$'
);
if (!rule.test(value)) {
return [false, `${display} 参数值不合理`];
return [
false,
`${display} ${t('views.configManage.configParam.parUnable')}`,
];
}
} catch (error) {
console.error(error);
@@ -973,7 +1008,10 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
try {
let regex = new RegExp(filter);
if (!regex.test(value)) {
return [false, `${display} 参数值不合理`];
return [
false,
`${display} ${t('views.configManage.configParam.parUnable')}`,
];
}
} catch (error) {
console.error(error);
@@ -982,7 +1020,10 @@ function ruleVerification(row: Record<string, any>): (string | boolean)[] {
break;
default:
return [false, `${display} 输入值是未知类型`];
return [
false,
`${display} ${t('views.configManage.configParam.default')}`,
];
}
return result;
}
@@ -1000,12 +1041,12 @@ function fnNeReload() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `网元重新加载完成`,
content: t('views.configManage.configParam.reloadSuss'),
duration: 3,
});
} else {
message.error({
content: `网元重新加载失败`,
content: t('views.configManage.configParam.reloadFail'),
duration: 3,
});
}
@@ -1038,7 +1079,7 @@ onMounted(() => {
}
} else {
message.warning({
content: `暂无网元列表数据`,
content: t('views.configManage.configParam.neNUll'),
duration: 2,
});
}
@@ -1056,12 +1097,14 @@ onMounted(() => {
<a-form name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item :label="t('views.traceManage.task.neType')" name="neTypeSelect">
<a-form-item
:label="t('views.traceManage.task.neType')"
name="neTypeSelect"
>
<a-cascader
v-model:value="neTypeSelect"
:options="neCascaderOtions"
:allow-clear="false"
placeholder="请选择网元"
@change="fnGetParamConfigTopTab"
/>
</a-form-item>
@@ -1089,7 +1132,6 @@ onMounted(() => {
<a-space :size="8" align="center" v-if="false">
<a-popconfirm
placement="topLeft"
title="网元配置重新载入"
:ok-text="t('common.ok')"
:cancel-text="t('common.cancel')"
:disabled="neReloadLoading"
@@ -1097,7 +1139,7 @@ onMounted(() => {
>
<a-button type="dashed" danger :loading="neReloadLoading">
<template #icon><SyncOutlined /></template>
重新载入
{{ t('views.configManage.configParam.reload') }}
</a-button>
</a-popconfirm>
</a-space>
@@ -1188,7 +1230,7 @@ onMounted(() => {
<a-space :size="16" align="center">
<a-popconfirm
title="确认更新该属性值吗?"
:title="t('views.configManage.configParam.editSure')"
placement="top"
@confirm="listEditOk()"
>
@@ -1253,14 +1295,18 @@ onMounted(() => {
"
>
<a-tooltip>
<template #title>提交</template>
<template #title>{{
t('views.configManage.configParam.post')
}}</template>
<a-popconfirm
v-if="
tableState.arrayNewIndex === text[column.key]?.value
"
:title="`确认提交新增 Index 为 【${
text[column.key]?.value
}】 的记录吗?`"
:title="
t('views.configManage.configParam.addSure', {
value: text[column.key]?.value,
})
"
placement="left"
@confirm="arrayAddOk()"
>
@@ -1268,9 +1314,11 @@ onMounted(() => {
</a-popconfirm>
<a-popconfirm
v-else
:title="`确认提交更新 Index 为 【${
text[column.key]?.value
}】 的记录吗?`"
:title="
t('views.configManage.configParam.arraryEdit', {
value: text[column.key]?.value,
})
"
placement="left"
@confirm="arrayEditOk()"
>
@@ -1280,7 +1328,7 @@ onMounted(() => {
</a-popconfirm>
</a-tooltip>
<a-tooltip>
<template #title>取消</template>
<template #title>{{ t('common.cancel') }}</template>
<a-button
type="text"
class="editable-cell__icon-edit"
@@ -1372,7 +1420,8 @@ onMounted(() => {
@click.prevent="arrayChildExpand(record['index'], text)"
v-else-if="Array.isArray(text.array)"
>
详情
{{ t('common.viewText') }}
</a-button>
<div v-else class="editable-cell__text-wrapper">
{{ `${text.value}` }}
@@ -1416,15 +1465,17 @@ onMounted(() => {
"
>
<a-tooltip>
<template #title>提交</template>
<template #title>{{t('views.configManage.configParam.post')}}</template>
<a-popconfirm
v-if="
tableState.arrayChildNewIndex ===
text[column.key]?.value
"
:title="`确认提交新增 Index 为 【${
text[column.key]?.value
}】 的记录吗?`"
:title="
t('views.configManage.configParam.addSure', {
value: text[column.key]?.value,
})
"
placement="left"
@confirm="arrayChildAddOk()"
>
@@ -1432,9 +1483,11 @@ onMounted(() => {
</a-popconfirm>
<a-popconfirm
v-else
:title="`确认提交更新 Index 为 【${
text[column.key]?.value
}】 的记录吗?`"
:title="
t('views.configManage.configParam.arraryEdit', {
value: text[column.key]?.value,
})
"
placement="left"
@confirm="arrayChildEditOk()"
>
@@ -1447,7 +1500,7 @@ onMounted(() => {
</a-popconfirm>
</a-tooltip>
<a-tooltip>
<template #title>取消</template>
<template #title> {{ t('common.cancel') }} </template>
<a-button
type="text"
class="editable-cell__icon-edit"
@@ -1556,7 +1609,7 @@ onMounted(() => {
"
v-else-if="Array.isArray(text.array)"
>
详情
{{ t('common.viewText') }}
</a-button>
<div v-else class="editable-cell__text-wrapper">
{{ `${text.value}` }}