diff --git a/public/alarmHelp/all.xlsx b/public/alarmHelp/all.xlsx new file mode 100644 index 00000000..7c653f30 Binary files /dev/null and b/public/alarmHelp/all.xlsx differ diff --git a/src/api/faultManage/actAlarm.ts b/src/api/faultManage/actAlarm.ts index 1b2c3197..60859fe1 100644 --- a/src/api/faultManage/actAlarm.ts +++ b/src/api/faultManage/actAlarm.ts @@ -2,7 +2,9 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { request } from '@/plugins/http-fetch'; import { parseObjLineToHump } from '@/utils/parse-utils'; import { toRaw } from '@vue/reactivity'; - +import { stringify } from 'querystring'; +import { parseDateToStr } from '@/utils/date-utils'; +import useUserStore from '@/store/modules/user'; /** * ²éѯÁбí * @param query ²éѯ²ÎÊý @@ -73,3 +75,63 @@ export async function listAct(query: Record) { } return result; } + +/** + * ȷÈϸ澯ÐÅϢ + * @param data ¼øȨ¶ÔÏó + * @returns object + */ +export function updateConfirm(data: Record) { + var time = new Date(); + const userName = useUserStore().userName; + let finalData = { + alarm: { + ack_time: parseDateToStr(time), + ack_user: userName, + ack_state: '1', + }, + }; + + return request({ + url: `/databaseManagement/v1/update/omc_db/alarm?WHERE=id='${data.id}'`, + method: 'put', + data: finalData, + }); +} + +/** + * ȡÏûȷÈϸ澯 + * @param data ¼øȨ¶ÔÏó + * @returns object + */ +export function cancelConfirm(data: (string | number)[]) { + var time = new Date(); + const userName = useUserStore().userName; + let finalData = { + alarm: { + ack_time: parseDateToStr(time), + ack_user: '', + ack_state: '0', + }, + }; + + return request({ + url: `/databaseManagement/v1/update/omc_db/alarm?WHERE=id in(${data.join( + ',' + )})`, + method: 'put', + data: finalData, + }); +} + +/** + * Êֹ¤ͬ²½ + * @param data ¼øȨ¶ÔÏó + * @returns object + */ +export function listSync() { + return request({ + url: `/faultManagement/v1/elementType/all/objectType/alarms)`, + method: 'get', + }); +} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index bf1bc735..0b36934e 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -258,6 +258,7 @@ export default { pvFlag: 'Virtualization Identity', alarmType: 'Alarm Type', confirm: 'Confirm', + updateConfirm: 'Cancel Confirmation', handSync: 'Manual synchronization', clear: 'Clear', mySelf: 'Personalization', @@ -279,7 +280,21 @@ export default { clearUser:'clear User', clearType:'clear Type', ackState:'Alarm confirmation status', - ackUser:'Alarm confirmation user' + ackUser:'Alarm confirmation user', + alarmSeq:'Alarm sequence number', + objectName:'Location object', + locationInfo:'Alarm positioning information', + province:'Network Element Service Province', + addInfo:'Alarm auxiliary information', + specificProblemId:'Alarm issue reason ID', + specificProblem:'Reason for alarm problem', + clearTime:'Alarm clearing time', + alarmStatus:'Alarm status', + ackTime:'Alarm confirmation time', + ackError:'Please do not confirm again', + syncMyself:'Manual synchronization', + realTitle:'Alarm Title', + objectNf:'Applicable network elements', }, }, monitor: { diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index b6f4c5da..056abc7e 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -258,6 +258,7 @@ export default { pvFlag: '虚拟化标识', alarmType: '告警类型', confirm: '确认', + updateConfirm: '取消确认', handSync: '手动同步', clear: '清除', mySelf: '个性化设置', @@ -279,7 +280,21 @@ export default { clearUser:'告警清除用户', clearType:'告警清除类型', ackState:'告警确认状态', - ackUser:'告警确认用户' + ackUser:'告警确认用户', + alarmSeq:'告警流水编号', + objectName:'定位对象', + locationInfo:'告警定位信息', + province:'网元服务省份', + addInfo:'告警辅助信息', + specificProblemId:'告警问题原因ID', + specificProblem:'告警问题原因', + clearTime:'告警清除时间', + alarmStatus:'告警状态', + ackTime:'告警确认时间', + ackError:'请勿重复确认', + syncMyself:'手工同步', + realTitle:'告警标题', + objectNf:'适用网元', }, }, monitor: { diff --git a/src/utils/execl-utils.ts b/src/utils/execl-utils.ts index 2358e4b1..009f02b3 100644 --- a/src/utils/execl-utils.ts +++ b/src/utils/execl-utils.ts @@ -20,7 +20,11 @@ export const xlsxUrl = `${ * }); */ export async function readLoalXlsx(id: string): Promise[]> { - const fileBolb = await (await fetch(`${xlsxUrl}/${id}.xlsx`)).arrayBuffer(); + let fileBolb = await (await fetch(`${xlsxUrl}/${id}.xlsx`)).arrayBuffer(); + console.log(fileBolb.byteLength) + if(!fileBolb.byteLength){ + fileBolb = await (await fetch(`${xlsxUrl}/all.xlsx`)).arrayBuffer(); + } return readSheet(fileBolb, 0); } diff --git a/src/views/faultManage/active-alarm/index.vue b/src/views/faultManage/active-alarm/index.vue index d3f3151c..99a98e74 100644 --- a/src/views/faultManage/active-alarm/index.vue +++ b/src/views/faultManage/active-alarm/index.vue @@ -3,25 +3,27 @@ import { useRoute } from 'vue-router'; import dayjs, { Dayjs } from 'dayjs'; import { reactive, ref, onMounted, toRaw } from 'vue'; import { PageContainer } from '@ant-design-vue/pro-layout'; -import { message } from 'ant-design-vue/lib'; +import { message, Modal } from 'ant-design-vue/lib'; import { SizeType } from 'ant-design-vue/lib/config-provider'; import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; import { ColumnsType } from 'ant-design-vue/lib/table'; import useUserStore from '@/store/modules/user'; -import { listAct } from '@/api/faultManage/actAlarm'; +import { + listAct, + updateConfirm, + cancelConfirm, + listSync, +} from '@/api/faultManage/actAlarm'; import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; -import { parseStrToDate } from '@/utils/execl-utils'; +import { readLoalXlsx } from '@/utils/execl-utils'; const { t } = useI18n(); const route = useRoute(); /**路由标题 */ let title = ref((route.meta.title as string) ?? '标题'); -/**网元参数 */ -let neOtions = ref[]>([]); - /**查询参数 */ let queryParams = reactive({ /**告警设备类型 */ @@ -82,6 +84,15 @@ let tableState: TabeStateType = reactive({ selectedRowKeys: [], }); +/**帮助文档表格状态 */ +let alarmTableState: TabeStateType = reactive({ + loading: false, + size: 'middle', + seached: true, + data: [], + selectedRowKeys: [], +}); + /**表格字段列 */ let tableColumns: ColumnsType = [ { @@ -157,7 +168,7 @@ let tableColumns: ColumnsType = [ }, { title: t('views.faultManage.activeAlarm.pvFlag'), - dataIndex: 'alarm_id', + dataIndex: 'pvFlag', align: 'center', }, { @@ -187,6 +198,76 @@ let tableColumns: ColumnsType = [ }, ]; +/**帮助文档表格字段列 */ +let alarmTableColumns: ColumnsType = [ + { + title: t('views.faultManage.activeAlarm.alarmTitle'), + dataIndex: '告警名称', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.locationInfo'), + dataIndex: '告警定位信息', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.addInfo'), + dataIndex: '告警帮助信息', + align: 'center', + + }, + { + title: t('views.faultManage.activeAlarm.alarmType'), + dataIndex: '告警类型', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.origLevel'), + dataIndex: '告警级别', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.alarmCode'), + dataIndex: '告警编号', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.specificProblem'), + dataIndex: '告警问题原因', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.clearType'), + dataIndex: '清除类型', + align: 'center', + }, + { + title: t('views.faultManage.activeAlarm.realTitle'), + dataIndex: '英文标题', + align: 'center', + }, + + { + title: t('views.faultManage.activeAlarm.objectNf'), + dataIndex: '适用网元', + align: 'center', + }, +]; + +/**告警帮助文档 */ +let pronInfo: any = reactive({ + 告警名称: '', + 告警定位信息: '', + 告警帮助信息: '', + 告警类型: '', + 告警级别: '', + 告警编号: '', + 告警问题原因: '', + 清除类型: '', + 英文标题: '', + 适用网元: '', +}); + /**表格分页器参数 */ let tablePagination = reactive({ /**当前页数 */ @@ -283,7 +364,7 @@ let modalState: ModalStateType = reactive({ from: { alarmId: '', alarmSeq: '', - neId:'', + neId: '', neName: '', neType: '', alarmCode: '', @@ -313,26 +394,144 @@ let modalState: ModalStateType = reactive({ * @param row 单行记录信息 */ function fnModalVisibleByVive(row: Record) { - - console.log(toRaw(row)) - return false; - const imsiIdx = row.imsi.lastIndexOf('-'); - if (imsiIdx != -1) { - row.imsi = row.imsi.substring(imsiIdx + 1); - } - const msisdnIdx = row.msisdn.lastIndexOf('-'); - if (msisdnIdx != -1) { - row.msisdn = row.msisdn.substring(msisdnIdx + 1); - } modalState.from = Object.assign(modalState.from, row); - modalState.title = `${row.imsi} 记录信息`; + modalState.title = `查看${row.alarmId} 记录信息`; modalState.visibleByView = true; } -function fnModalVisibleBy() { - parseStrToDate(); +/**抽屉 网元详细信息 */ +const visible = ref(false); +const closeDrawer = () => { + visible.value = false; +}; +/**抽屉 告警帮助文档详细信息 */ +function fnModalVisibleBy(code: string) { + const result = readLoalXlsx(code); + + result + .then(res => { + console.log(res); + if (!res.length) { + visible.value = false; + } + alarmTableState.data = res; + visible.value = true; + + tableState.loading = false; + }) + .catch(error => console.log(error)); } +/** + * 对话框弹出确认执行 确认查阅函数 + */ +function fnModalOk() { + modalState.confirmLoading = true; + const from = toRaw(modalState.from); + if (from.ackState) { + message.error({ + content: t('views.faultManage.activeAlarm.ackError'), + duration: 3, + }); + modalState.visibleByView = false; + return false; + } + const result = updateConfirm(from); + const hide = message.loading({ content: t('common.loading') }); + result + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { msg: modalState.title }), + duration: 3, + }); + modalState.visibleByView = false; + fnGetList(); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + hide(); + modalState.confirmLoading = false; + }); +} + +/**表格状态 */ +const state = reactive<{ + selectedRowKeys: (string | number)[]; + selectedRow: Record; + loading: boolean; +}>({ + selectedRowKeys: [], // Check here to configure the default column + selectedRow: {}, + loading: false, +}); + +/**监听多选 */ +const onSelectChange = ( + keys: (string | number)[], + record: Record +) => { + state.selectedRowKeys = keys; + state.selectedRow = record; +}; + +/** + * 选中行后的取消确认 + */ +function fnCancelConfirm() { + Modal.confirm({ + title: 'Tip', + content: `确认是否取消确认告警?`, + onOk() { + const hide = message.loading('请稍等...', 0); + cancelConfirm(state.selectedRowKeys).then(res => { + hide(); + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `取消确认告警成功`, + duration: 2, + }); + fnGetList(); + } else { + message.error({ + content: `${res.msg}`, + duration: 2, + }); + } + }); + }, + }); +} + +/** + * 手工同步 + */ +function fnSync() { + const hide = message.loading('请稍等...', 0); + listSync().then(res => { + hide(); + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `手工同步成功`, + duration: 2, + }); + console.log(toRaw(res)); + return false; + tablePagination.total = res.total; + tableState.data = res.rows; + } else { + message.error({ + content: `${res.msg}`, + duration: 2, + }); + } + }); +} /** * 对话框弹出关闭执行函数 @@ -350,8 +549,8 @@ function fnGetList() { listAct(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { // 取消勾选 - if (tableState.selectedRowKeys.length > 0) { - tableState.selectedRowKeys = []; + if (state.selectedRowKeys.length > 0) { + state.selectedRowKeys = []; } tablePagination.total = res.total; tableState.data = res.rows; @@ -510,7 +709,27 @@ onMounted(() => { - + +
+ + + + + +
+ { :loading="tableState.loading" :data-source="tableState.data" :size="tableState.size" + :row-selection="{ + selectedRowKeys: state.selectedRowKeys, + onChange: onSelectChange, + }" :pagination="tablePagination" :scroll="{ x: true }" > @@ -584,9 +864,11 @@ onMounted(() => { - + @@ -598,62 +880,348 @@ onMounted(() => { - + - - - {{ modalState.from.imsi }} + + + + - - - {{ modalState.from.msisdn }} - - - - - {{ modalState.from.ratType }} + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - {{ v.ipv4 }} - {{ v.ipv6 }} - {{ v.tai }} - - {{ v.sstSD }} + + + + + + + + + + + + + + + + + + + + + - - {{ v.upfN3IP }} - - - {{ v.ranN3IP }} - - - {{ v.activeTime }} - - - {{ v.pduSessionID }} - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -