fix: MML管理文件类型判断

This commit is contained in:
TsMask
2024-03-04 17:58:00 +08:00
parent bd13b70a88
commit 49fa7bdec8
5 changed files with 99 additions and 27 deletions

View File

@@ -1666,7 +1666,9 @@ export default {
requireIpv6: "{display} Not a legitimate IPV6 address.",
requireEnum: "{display} is not a reasonable enumeration value.",
requireBool: "{display} is not a reasonable boolean value.",
requireFile: "{display} is not a value that matches the parameter file type.",
cmdQuickEntry: "Command Quick Entry",
cmdQuickEntryHelp: "Line feed (Shift + Enter), Execute (Enter)",
cmdParamPanel: "Parameter Panel",
clearForm: "Reset",
clearLog: "Clear Logs",

View File

@@ -1666,7 +1666,9 @@ export default {
requireIpv6: "{display} 不是合法的IPV6地址",
requireEnum: "{display} 不是合理的枚举值",
requireBool: "{display} 不是合理的布尔类型的值",
requireFile: "{display} 不是符合参数文件类型的值",
cmdQuickEntry: "命令快速输入",
cmdQuickEntryHelp: "换行(Shift + Enter) 执行发送(Enter)",
cmdParamPanel: "参数面板",
clearForm: "重置",
clearLog: "清除日志",

View File

@@ -314,6 +314,15 @@ function ruleVerification(
}
}
break;
case 'file':
if (filter) {
const arr: string[] = filter.split(',');
const itemArr = arr.filter(item => value.endsWith(item));
if (itemArr.length === 0) {
return [false, t('views.mmlManage.requireFile', { display })];
}
}
break;
default:
console.warn(t('views.mmlManage.requireUn', { display }), type);
@@ -642,7 +651,10 @@ onMounted(() => {
:validate-on-rule-change="false"
:validateTrigger="[]"
>
<a-form-item :label="t('views.mmlManage.cmdQuickEntry')">
<a-form-item
:label="t('views.mmlManage.cmdQuickEntry')"
:help="t('views.mmlManage.cmdQuickEntryHelp')"
>
<!-- 非UPF通用4100 -->
<a-auto-complete
v-if="state.neType[0] !== 'UPF'"

View File

@@ -18,7 +18,7 @@ let neOptions = ref<Record<string, any>[]>([]);
/**对象信息状态类型 */
type StateType = {
/**网元ID */
neId: string;
neId: string | undefined;
/**命令数据 tree */
mmlTreeData: any[];
/**命令选中 */
@@ -37,7 +37,7 @@ type StateType = {
/**对象信息状态 */
let state: StateType = reactive({
neId: '',
neId: undefined,
mmlTreeData: [],
mmlSelect: {
title: '',
@@ -108,6 +108,13 @@ function fnSendMML() {
if (state.from.sendLoading) {
return;
}
if (!state.neId) {
message.warning({
content: t('views.mmlManage.udmOpesrate.noOMC'),
duration: 5,
});
return;
}
let cmdArr: string[] = [];
const operation = state.mmlSelect.operation;
@@ -196,13 +203,21 @@ function fnSendMML() {
/**上传变更 */
function fnUpload(up: UploadRequestOption, name: string) {
const neId = state.neId;
if (!neId) {
message.warning({
content: t('views.mmlManage.udmOpesrate.noOMC'),
duration: 5,
});
return;
}
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.mmlManage.uploadFileTip'),
onOk() {
const hide = message.loading(t('common.loading'), 0);
state.from.uploadLoading = true;
uploadFileToNE('OMC', state.neId, up.file as File, 5)
uploadFileToNE('OMC', neId, up.file as File, 5)
.then(res => {
// 文件转存
if (res.code === RESULT_CODE_SUCCESS) {
@@ -308,6 +323,15 @@ function ruleVerification(
}
}
break;
case 'file':
if (filter) {
const arr: string[] = filter.split(',');
const itemArr = arr.filter(item => value.endsWith(item));
if (itemArr.length === 0) {
return [false, t('views.mmlManage.requireFile', { display })];
}
}
break;
default:
console.warn(t('views.mmlManage.requireUn', { display }), type);
@@ -486,15 +510,16 @@ onMounted(() => {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
let arr: Record<string, any>[] = [];
res.data.forEach(i => {
if (i.neType === 'OMC') {
arr.push({ value: i.neId, label: i.neName });
}
});
neOptions.value = arr;
if (arr.length > 0) {
state.neId = arr[0].value;
// 获取可用OMC
const omcArr = useNeInfoStore().getNeSelectOtions.find(
item => item.value === 'OMC'
);
if (omcArr) {
neOptions.value = omcArr.children;
}
// 是否有可选项
if (neOptions.value.length > 0) {
state.neId = neOptions.value[0].value;
// 获取列表数据
fnGetList();
}
@@ -588,7 +613,10 @@ onMounted(() => {
:validate-on-rule-change="false"
:validateTrigger="[]"
>
<a-form-item :label="t('views.mmlManage.cmdQuickEntry')">
<a-form-item
:label="t('views.mmlManage.cmdQuickEntry')"
:help="t('views.mmlManage.cmdQuickEntryHelp')"
>
<a-auto-complete
v-model:value="state.autoCompleteValue"
:dropdown-match-select-width="500"

View File

@@ -18,7 +18,7 @@ let neOptions = ref<Record<string, any>[]>([]);
/**对象信息状态类型 */
type StateType = {
/**网元ID */
neId: string;
neId: string | undefined;
/**命令数据 tree */
mmlTreeData: any[];
/**命令选中 */
@@ -37,7 +37,7 @@ type StateType = {
/**对象信息状态 */
let state: StateType = reactive({
neId: '',
neId: undefined,
mmlTreeData: [],
mmlSelect: {
title: '',
@@ -108,6 +108,13 @@ function fnSendMML() {
if (state.from.sendLoading) {
return;
}
if (!state.neId) {
message.warning({
content: t('views.mmlManage.udmOpesrate.noUDM'),
duration: 5,
});
return;
}
let cmdArr: string[] = [];
const operation = state.mmlSelect.operation;
@@ -196,13 +203,21 @@ function fnSendMML() {
/**上传变更 */
function fnUpload(up: UploadRequestOption, name: string) {
const neId = state.neId;
if (!neId) {
message.warning({
content: t('views.mmlManage.udmOpesrate.noUDM'),
duration: 5,
});
return;
}
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.mmlManage.uploadFileTip'),
onOk() {
const hide = message.loading(t('common.loading'), 0);
state.from.uploadLoading = true;
uploadFileToNE('UDM', state.neId, up.file as File, 5)
uploadFileToNE('UDM', neId, up.file as File, 5)
.then(res => {
// 文件转存
if (res.code === RESULT_CODE_SUCCESS) {
@@ -308,6 +323,15 @@ function ruleVerification(
}
}
break;
case 'file':
if (filter) {
const arr: string[] = filter.split(',');
const itemArr = arr.filter(item => value.endsWith(item));
if (itemArr.length === 0) {
return [false, t('views.mmlManage.requireFile', { display })];
}
}
break;
default:
console.warn(t('views.mmlManage.requireUn', { display }), type);
@@ -486,15 +510,16 @@ onMounted(() => {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
let arr: Record<string, any>[] = [];
res.data.forEach(i => {
if (i.neType === 'UDM') {
arr.push({ value: i.neId, label: i.neName });
}
});
neOptions.value = arr;
if (arr.length > 0) {
state.neId = arr[0].value;
// 获取可用UDM
const udmArr = useNeInfoStore().getNeSelectOtions.find(
item => item.value === 'UDM'
);
if (udmArr) {
neOptions.value = udmArr.children;
}
// 是否有可选项
if (neOptions.value.length > 0) {
state.neId = neOptions.value[0].value;
// 获取列表数据
fnGetList();
} else {
@@ -593,7 +618,10 @@ onMounted(() => {
:validate-on-rule-change="false"
:validateTrigger="[]"
>
<a-form-item :label="t('views.mmlManage.cmdQuickEntry')">
<a-form-item
:label="t('views.mmlManage.cmdQuickEntry')"
:help="t('views.mmlManage.cmdQuickEntryHelp')"
>
<a-auto-complete
v-model:value="state.autoCompleteValue"
:dropdown-match-select-width="500"