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 }} - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -