diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index caaa78ad..d14dfb0e 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -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", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 8fc27625..aef08a04 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -1666,7 +1666,9 @@ export default { requireIpv6: "{display} 不是合法的IPV6地址", requireEnum: "{display} 不是合理的枚举值", requireBool: "{display} 不是合理的布尔类型的值", + requireFile: "{display} 不是符合参数文件类型的值", cmdQuickEntry: "命令快速输入", + cmdQuickEntryHelp: "换行(Shift + Enter) 执行发送(Enter)", cmdParamPanel: "参数面板", clearForm: "重置", clearLog: "清除日志", diff --git a/src/views/mmlManage/neOperate/index.vue b/src/views/mmlManage/neOperate/index.vue index 95d84d01..31c053ea 100644 --- a/src/views/mmlManage/neOperate/index.vue +++ b/src/views/mmlManage/neOperate/index.vue @@ -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="[]" > - + []>([]); /**对象信息状态类型 */ 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[] = []; - 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="[]" > - + []>([]); /**对象信息状态类型 */ 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[] = []; - 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="[]" > - +