diff --git a/package.json b/package.json index 12ee3958..f84a6c7b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "vue": "^3.3.4", "vue-codemirror": "^6.1.1", "vue-i18n": "^9.3.0", - "vue-router": "^4.2.4" + "vue-router": "^4.2.4", + "xlsx": "^0.18.5" }, "devDependencies": { "@types/file-saver": "^2.0.5", diff --git a/public/alarmHelp/20001.xlsx b/public/alarmHelp/20001.xlsx new file mode 100644 index 00000000..2daef158 Binary files /dev/null and b/public/alarmHelp/20001.xlsx differ diff --git a/public/alarmHelp/20002.xlsx b/public/alarmHelp/20002.xlsx new file mode 100644 index 00000000..8f5ff659 Binary files /dev/null and b/public/alarmHelp/20002.xlsx differ diff --git a/public/alarmHelp/20003.xlsx b/public/alarmHelp/20003.xlsx new file mode 100644 index 00000000..e0e69404 Binary files /dev/null and b/public/alarmHelp/20003.xlsx differ diff --git a/public/alarmHelp/20004.xlsx b/public/alarmHelp/20004.xlsx new file mode 100644 index 00000000..5ee567ff Binary files /dev/null and b/public/alarmHelp/20004.xlsx differ diff --git a/public/alarmHelp/20005.xlsx b/public/alarmHelp/20005.xlsx new file mode 100644 index 00000000..cdbaf1e3 Binary files /dev/null and b/public/alarmHelp/20005.xlsx differ diff --git a/public/alarmHelp/30001.xlsx b/public/alarmHelp/30001.xlsx new file mode 100644 index 00000000..f52b8573 Binary files /dev/null and b/public/alarmHelp/30001.xlsx differ diff --git a/public/alarmHelp/30002.xlsx b/public/alarmHelp/30002.xlsx new file mode 100644 index 00000000..e7d9b767 Binary files /dev/null and b/public/alarmHelp/30002.xlsx differ diff --git a/public/alarmHelp/30003.xlsx b/public/alarmHelp/30003.xlsx new file mode 100644 index 00000000..9232febf Binary files /dev/null and b/public/alarmHelp/30003.xlsx differ diff --git a/public/alarmHelp/30004.xlsx b/public/alarmHelp/30004.xlsx new file mode 100644 index 00000000..638a2513 Binary files /dev/null and b/public/alarmHelp/30004.xlsx differ diff --git a/public/alarmHelp/30005.xlsx b/public/alarmHelp/30005.xlsx new file mode 100644 index 00000000..cf01aa11 Binary files /dev/null and b/public/alarmHelp/30005.xlsx differ diff --git a/public/alarmHelp/30006.xlsx b/public/alarmHelp/30006.xlsx new file mode 100644 index 00000000..e3a1e35d Binary files /dev/null and b/public/alarmHelp/30006.xlsx differ diff --git a/public/alarmHelp/30007.xlsx b/public/alarmHelp/30007.xlsx new file mode 100644 index 00000000..3b001832 Binary files /dev/null and b/public/alarmHelp/30007.xlsx differ diff --git a/public/alarmHelp/30008.xlsx b/public/alarmHelp/30008.xlsx new file mode 100644 index 00000000..b58edb07 Binary files /dev/null and b/public/alarmHelp/30008.xlsx differ diff --git a/public/alarmHelp/40001.xlsx b/public/alarmHelp/40001.xlsx new file mode 100644 index 00000000..b4b176ee Binary files /dev/null and b/public/alarmHelp/40001.xlsx differ diff --git a/public/alarmHelp/40002.xlsx b/public/alarmHelp/40002.xlsx new file mode 100644 index 00000000..481b7126 Binary files /dev/null and b/public/alarmHelp/40002.xlsx differ diff --git a/src/api/faultManage/actAlarm.ts b/src/api/faultManage/actAlarm.ts new file mode 100644 index 00000000..1b2c3197 --- /dev/null +++ b/src/api/faultManage/actAlarm.ts @@ -0,0 +1,75 @@ +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'; + +/** + * 查询列表 + * @param query 查询参数 + * @returns object + */ +export async function listAct(query: Record) { + let filterData = ''; + let totalSQL = `select count(*) as total from alarm where alarm_status='1' ${filterData} `; + let rowsSQL = `select * from alarm where alarm_status='1' ${filterData}`; + + // 查询 + let querySQL = ''; + if (query.alarm_code) { + querySQL += ` and alarm_code = '${query.alarm_code}' `; + } + if (query.alarm_type) { + querySQL += ` and alarm_type = ${query.alarm_type} `; + } + if (query.pv_flag) { + querySQL += ` and pv_flag = ${query.pv_flag} `; + } + if (query.orig_severity) { + querySQL += ` and orig_severity in (${query.orig_severity} )`; + } + if (query.ne_id) { + querySQL += ` and ne_id like '%${query.ne_id}%' `; + } + if (query.ne_name) { + querySQL += ` and ne_name like '%${query.ne_name}%' `; + } + if (query.ne_type) { + querySQL += ` and ne_type like '%${query.ne_type}%' `; + } + + // 分页 + const pageNum = (query.pageNum - 1) * query.pageSize; + const limtSql = ` order by event_time desc limit ${pageNum},${query.pageSize} `; + + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/alarm`, + method: 'get', + params: { + SQL: totalSQL + querySQL, + rowsSQL: rowsSQL + querySQL + limtSql, + }, + }); + + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS) { + const data: DataList = { + total: 0, + rows: [], + code: result.code, + msg: result.msg, + }; + result.data.data.forEach((item: any) => { + const itemData = item['alarm']; + if (Array.isArray(itemData)) { + if (itemData.length === 1 && itemData[0]['total']) { + data.total = itemData[0]['total']; + } else { + data.rows = itemData.map(v => parseObjLineToHump(v)); + } + } + }); + return data; + } + return result; +} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index f93a11c7..bf1bc735 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -246,8 +246,9 @@ export default { delTaskTip: 'Are you sure to delete the data item with record number {num}?', }, }, - alarm: { - alarmAct: { + faultManage: { + activeAlarm: { + all:'All', neType: 'Alarm device type', neName: 'Alarm network element name', neId: 'Alarm network element identification', @@ -263,6 +264,22 @@ export default { exportAll: 'Export All', disPlayFilfter: 'Display Filters', autoConfirm: 'Automatic confirmation of configuration', + critical:'Critical', + major:'Major', + minor:'Minor', + warning:'Warning', + eventAlarm:'Event', + communicationAlarm:'CommunicationAlarm', + equipmentAlarm:'EquipmentAlarm', + processingFailure:'ProcessingFailure', + environmentalAlarm:'EnvironmentalAlarm', + qualityOfServiceAlarm:'QualityOfServiceAlarm', + alarmId:'alarm ID', + alarmTitle:'alarm Title', + clearUser:'clear User', + clearType:'clear Type', + ackState:'Alarm confirmation status', + ackUser:'Alarm confirmation user' }, }, monitor: { diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 1331d47c..b6f4c5da 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -246,8 +246,9 @@ export default { delTaskTip: '纭鍒犻櫎璁板綍缂栧彿涓 {num} 鐨勬暟鎹」?', }, }, - alarm: { - alarmAct: { + faultManage: { + activeAlarm: { + all:'鎵鏈', neType: '鍛婅璁惧绫诲瀷', neName: '鍛婅缃戝厓鍚嶇О', neId: '鍛婅缃戝厓鏍囪瘑', @@ -263,6 +264,22 @@ export default { exportAll: '瀵煎嚭鍏ㄩ儴', disPlayFilfter: '鏄剧ず杩囨护', autoConfirm: '鑷姩纭閰嶇疆', + critical:'涓ラ噸鍛婅', + major:'涓昏鍛婅', + minor:'娆¤鍛婅', + warning:'璀﹀憡鍛婅', + eventAlarm:'浜嬩欢鍛婅', + communicationAlarm:'閫氫俊鍛婅', + equipmentAlarm:'璁惧鍛婅', + processingFailure:'澶勭悊閿欒鍛婅', + environmentalAlarm:'鐜鍛婅', + qualityOfServiceAlarm:'鏈嶅姟璐ㄩ噺鍛婅', + alarmId:'鍛婅鍞竴鏍囪瘑', + alarmTitle:'鍛婅鍚嶇О', + clearUser:'鍛婅娓呴櫎鐢ㄦ埛', + clearType:'鍛婅娓呴櫎绫诲瀷', + ackState:'鍛婅纭鐘舵', + ackUser:'鍛婅纭鐢ㄦ埛' }, }, monitor: { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index c10a97dd..0ba26a19 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -27,6 +27,8 @@ type UserInfo = { email: string; /**鐢ㄦ埛鎬у埆 */ sex: string | undefined; + /**涓汉鍖栬缃 */ + profile: Record; }; /** @@ -56,6 +58,7 @@ const useUserStore = defineStore('user', { phonenumber: '', email: '', sex: undefined, + profile: {}, }), getters: { /** @@ -129,6 +132,19 @@ const useUserStore = defineStore('user', { this.phonenumber = user.phone; this.email = user.email; this.sex = user.gender; + // this.profile = JSON.parse(user.profile); + try { + this.profile = JSON.parse(user.profile); + } catch (error) { + console.log(error); + this.profile = { + critical: '#FF5722', + major: '#FFB800', + minor: '#393D49', + warning: '#009688', + event: '#1E9FFF', + }; + } // 楠岃瘉杩斿洖鐨剅oles鏄惁鏄竴涓潪绌烘暟缁 if (Array.isArray(roles) && roles.length > 0) { diff --git a/src/utils/execl-utils.ts b/src/utils/execl-utils.ts new file mode 100644 index 00000000..ab735e12 --- /dev/null +++ b/src/utils/execl-utils.ts @@ -0,0 +1,30 @@ +import { read, utils } from 'xlsx'; + +/** + * 字体图标文件-静态资源文件路径 + */ +const baseUrl = import.meta.env.VITE_HISTORY_BASE_URL; +export const scriptUrl = `${ + baseUrl.length === 1 && baseUrl.indexOf('/') === 0 + ? '' + : baseUrl.indexOf('/') === -1 + ? '/' + baseUrl + : baseUrl +}/alarmHelp`; + + + +/** + * 格式时间字符串 + * @param dateStr 时间字符串 + * @param formatStr 时间格式 默认YYYY-MM-DD HH:mm:ss + * @returns Date对象 + */ +export async function parseStrToDate(): Promise[]> { + + const f = await (await fetch(scriptUrl+"/20001.xlsx")).arrayBuffer(); + const wb = read(f);1 + const data = utils.sheet_to_json< Record>(wb.Sheets[wb.SheetNames[0]]); + console.log(data); + return data; + } \ No newline at end of file diff --git a/src/views/faultManage/active-alarm/index.vue b/src/views/faultManage/active-alarm/index.vue index 5c9c8794..d3f3151c 100644 --- a/src/views/faultManage/active-alarm/index.vue +++ b/src/views/faultManage/active-alarm/index.vue @@ -1,15 +1,18 @@ @@ -249,7 +378,7 @@ onMounted(() => { :body-style="{ marginBottom: '24px', paddingBottom: 0 }" > - + - + - + - + - - + @@ -304,50 +441,67 @@ onMounted(() => { - + - - + + - - + + - - + + + - - + + @@ -415,7 +569,7 @@ onMounted(() => { :scroll="{ x: true }" >