diff --git a/nezha-fronted/src/assets/css/main.css b/nezha-fronted/src/assets/css/main.css index f1153c45f..58291f8cf 100644 --- a/nezha-fronted/src/assets/css/main.css +++ b/nezha-fronted/src/assets/css/main.css @@ -12,6 +12,31 @@ html { .content-box { height: 100%; } +/*通用*/ +.margin-l-5 { + margin-left: 5px !important; +} +.margin-r-5 { + margin-right: 5px !important; +} +.margin-t-5 { + margin-top: 5px !important; +} +.margin-b-5 { + margin-bottom: 5px !important; +} +.margin-l-10 { + margin-left: 10px !important; +} +.margin-r-10 { + margin-right: 10px !important; +} +.margin-t-10 { + margin-top: 10px !important; +} +.margin-b-10 { + margin-bottom: 10px !important; +} /*侧滑文字*/ .el-form-item .el-form-item__label{ font-size: 10px; @@ -27,6 +52,126 @@ html { width: 90%; } +/* begin--左侧列表*/ +.content-left { + float: left; + width: 322px; + height: 100%; + background-color: #eeeeee; + border-right: 1px solid #dadada; + padding: 0 12px 0 11px; + box-sizing: border-box; + font-size: 14px; +} +.sidebar-title { + padding: 20px 0 0 15px; + color: #5e5e5e; +} +.sidebar-info { + margin-top: 27px; + border: 1px solid #cacaca; + border-radius: 6px; + height: calc(90vh - 55px); + width: 100%; +} +.sidebar-info-top { + border-radius: 6px 6px 0 0; +} +.sidebar-info-item { +height: 39px; +line-height: 39px; +padding: 0 8px 0 32px; +border-bottom: 1px solid #cacaca; +cursor: pointer; +color: #5e5e5e; +} +.sidebar-info-item-active { +background-color: #5e5e5e; +color: white; +} +.sidebar-info-foot { + border-radius: 6px 6px 0 0; +} +/* end--左侧列表*/ + +/* begin--右侧内容*/ + /* begin--顶部工具栏*/ +.top-tools { + padding: 22px 0 13px 0; +} +.top-tools .el-button--mini { + padding-top: 6px; + padding-bottom: 6px; +} +.top-tools .top-tool { + float: left; +} +.top-tools .top-tool-right { + float: right; +} +.top-tools .top-tool-search { + width: 220px; +} +.top-tools .el-button-group { + float: left; +} +.top-tools .top-tool-btn { + border-radius: 5px; + width: 100px; +} +.top-tools .top-tool-btn:focus, .top-tools .top-tool-btn:hover { + color: #606266; + background-color: white; +} +.top-tools .top-tool-btn-active { + color: white; + background-color: #656565; +} +.top-tools .top-tool-btn-active:focus, .top-tools .top-tool-btn-active:hover { + color: white; + background-color: #656565; +} +.top-tools .top-tool-btn-txt { + font-size: 14px; +} + /* end--顶部工具栏*/ + /* start--内容*/ +.content-right>.el-table{ + border-radius: 4px; + border: 1px solid #D7D7D7; + margin-top: 30px; +} +.content-right { + height: calc(100% - 131px); + margin-left: 322px; + padding: 0 15px 0 25px; +} + /* end--内容*/ + /* start--分页*/ +.pagination { + padding-top: 18px; + text-align: center; +} + /* end--分页*/ + /* begin--右弹框滑入滑出动画*/ +@keyframes slide-in-from-right { + from {right: -800px} + to {right: 0} +} +@keyframes slide-out-to-right { + from {right: 0} + to {right: -800px} +} +.right-box-enter-active { + animation: slide-in-from-right 0.4s; +} +.right-box-leave-active { + animation: slide-out-to-right 0.4s; +} + /* end--右弹框滑入滑出动画*/ +/* end--右侧内容*/ + +/* start--自定义可编辑的el-select下拉框样式*/ .config-dropdown { width: 550px; } @@ -53,3 +198,4 @@ html { .config-dropdown-error-message { color: #F98D9A; } +/* end--自定义可编辑的el-select下拉框样式*/ diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index 932d0931b..fb2893d07 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -29,13 +29,13 @@ - {{$t('overall.alarm')}} + {{$t('overall.alert')}} - {{$t('alarm.alarmList')}} + {{$t('alert.alertList')}} - {{$t('alarm.alarmConfig')}} + {{$t('alert.alertConfig')}} diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 8ca1c7fcf..8396fba6c 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -3,7 +3,7 @@ const cn = { overall: { dashboard: '仪表盘', project: '工程', - alarm: "告警", + alert: "告警", asset: '资产', config: '设置', create: '新增', @@ -12,7 +12,9 @@ const cn = { esc: '取消', cancel: '取消', save: '保存', - search: '搜索' + search: '搜索', + add: '新增', + option: "操作" }, asset: { tableTitle: { @@ -22,7 +24,7 @@ const cn = { ip: 'IP', assetState: '资产状态', module: 'Module', - alarm: 'Alarm', + alert: 'alert', dataCenter: '数据中心', cabinet: '机柜', model: '型号', @@ -36,7 +38,7 @@ const cn = { projectName: '项目名称', moduleName: 'Module Name', endPoint: 'EndPoint', - alarm: 'Alarm', + alert: 'alert', }, }, config: { @@ -62,11 +64,12 @@ const cn = { editProm: "修改Prometheus Server" }, }, - alarm: { - alarmList: "告警列表", - alarmConfig: "告警设置", + alert: { + alert: "告警", + alertList: "告警列表", + alertConfig: "告警设置", list: { - alarmName: "告警名称", + alertName: "告警名称", linkedId: "关联ID", severity: "告警级别", type: "类型", @@ -78,13 +81,26 @@ const cn = { charts: "图表", //表内容 - projectAlarm: "Project Alarm", - moduleAlarm: "Module Alarm", - deviceAlarm: "Device Alarm", + projectalert: "Project Alert", + modulealert: "Module Alert", + devicealert: "Device Alert", pending: "Pending", expired: "Expired" } }, + project: { + endpoint: { + endpoint: "Endpoint", + endpointId: "Endpoint ID", + host: "Host", + port: "Port", + param: "Param", + path: "Path", + asset: "Asset", + lastUpdate: "Last Update", + }, + metrics: "Metrics", + }, ...zhLocale } diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index dc122dd34..575f2beeb 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -3,7 +3,7 @@ const en = { overall:{ dashboard:'dashboard', project:'project', - alarm: "alarm", + alert: "alert", asset:'asset', config:'config', create: 'Create', @@ -12,7 +12,9 @@ const en = { esc: 'Esc', cancel: 'Cancel', save: 'Save', - search: 'Search' + search: 'Search', + add: "Add", + option: "Option" }, asset:{ tableTitle: { @@ -22,7 +24,7 @@ const en = { ip: 'IP', assetState: '资产状态', module: 'Module', - alarm: 'Alarm', + alert: 'alert', dataCenter: '数据中心', cabinet: '机柜', model: '型号', @@ -36,11 +38,13 @@ const en = { projectName: '项目名称', moduleName: 'Module Name', endPoint: 'EndPoint', - alarm: 'Alarm', + alert: 'alert', }, }, config: { + config: "Config", account: { + accountList: "Account List", //列表表头 account: "Account", language: "Language", @@ -56,16 +60,18 @@ const en = { notCurrentlySupport: 'Not currently supported' }, promServer: { + promServerList: "Prometheus Server", //侧滑框 promId: "Prometheus Server ID", createProm: "Create Prometheus Server", editProm: "Edit Prometheus Server" }, }, - alarm: { - alarmList: "Alarm List", - alarmConfig: "Alarm Config", - alarmName: "Alarm Name", + alert: { + alert: "Alert", + alertList: "Alert List", + alertConfig: "Alert Config", + alertName: "Alert Name", severity: "Severity", description: "Desc", summary: "Summary", @@ -79,9 +85,9 @@ const en = { charts: "Charts", //表内容 - projectAlarm: "Project Alarm", - moduleAlarm: "Module Alarm", - deviceAlarm: "Device Alarm", + projectalert: "Project Alert", + modulealert: "Module Alert", + devicealert: "Device Alert", pending: "Pending", expired: "Expired" }, @@ -91,11 +97,26 @@ const en = { expr: "Expr", for: "For", option: "Option", - alarmConfig: "Alarm Config", - createAlarmConfig: "Create Alarm Config", - editAlarmConfig: "Edit Alarm Config", + alertConfig: "Alert Config", + createalertConfig: "Create Alert Config", + editalertConfig: "Edit Alert Config", } }, + project: { + endpoint: { + createEndpoint: "Create Endpoint", + editEndpoint: "Edit Endpoint", + endpoint: "Endpoint", + endpointId: "Endpoint ID", + host: "Host", + port: "Port", + param: "Param", + path: "Path", + asset: "Asset", + lastUpdate: "Last Update", + }, + metrics: "Metrics" + }, ...enLocale } diff --git a/nezha-fronted/src/components/common/pagination.vue b/nezha-fronted/src/components/common/pagination.vue index 18e59c76e..bc6052c46 100644 --- a/nezha-fronted/src/components/common/pagination.vue +++ b/nezha-fronted/src/components/common/pagination.vue @@ -55,10 +55,4 @@ export default { diff --git a/nezha-fronted/src/components/page/alarm/config.vue b/nezha-fronted/src/components/page/alert/config.vue similarity index 84% rename from nezha-fronted/src/components/page/alarm/config.vue rename to nezha-fronted/src/components/page/alert/config.vue index 210b33078..be95615e6 100644 --- a/nezha-fronted/src/components/page/alarm/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -2,43 +2,6 @@ .account { height: 100%; } - .content-left { - float: left; - width: 370px; - height: 100%; - } - .sidebar-title { - padding-left: 30px; - padding-top: 20px; - } - - .sidebar-info { - margin-top: 20px; - border: 1px solid #acacac; - border-radius: 8px; - height: calc(90vh - 55px); - width: calc(100% - 30px); - } - - .sidebar-info-header { - background: #acacac; - text-align: center; - line-height: 50px; - border-top-left-radius: 8px; - border-top-right-radius: 8px; - height: 60px; - width: 100%; - } - - .sidebar-info-footer { - padding-top: 15px; - padding-left: 15px; - } - .account-list { - height: calc(100% - 131px); - margin-left: 370px; - padding: 0 15px 0 0; - } .account-list-option { cursor: pointer; display: inline-block; @@ -56,11 +19,6 @@ .account-list-option .el-icon-view:hover { color: #409EFF; } - .account-list-search { - float: right; - width: 220px; - margin: 15px 0; - } /* begin--右侧弹框*/ .right-box { position: fixed; @@ -182,41 +140,29 @@ } /* end--右侧弹框--底部按钮*/ /* end--右侧弹框*/ - - /* begin--右弹框滑入滑出动画*/ - @keyframes slide-in-from-right { - from {right: -800px} - to {right: 0} - } - @keyframes slide-out-to-right { - from {right: 0} - to {right: -800px} - } - .right-box-enter-active { - animation: slide-in-from-right 0.4s; - } - .right-box-leave-active { - animation: slide-out-to-right 0.4s; - } - /* end--右弹框滑入滑出动画*/ - - Config - - - + {{$t('alert.alert')}} + + {{$t('alert.alertList')}} + {{$t('alert.alertConfig')}} - - + + + + + {{$t('overall.add')}} + + + - {{scope.row[item.prop]}} @@ -291,7 +222,7 @@ - {{$t('alarm.config.name')}} + {{$t('alert.config.name')}} - {{$t('alarm.config.expr')}} + {{$t('alert.config.expr')}} - {{$t('alarm.config.for')}} + {{$t('alert.config.for')}} - {{$t('alarm.severity')}} + {{$t('alert.severity')}} - {{$t('alarm.summary')}} + {{$t('alert.summary')}} - {{$t('alarm.description')}} + {{$t('alert.description')}} { if (response.code == 200) { - this.tableData = response.data.list - this.pageObj.total = response.data.total + this.tableData = response.data.list; + this.pageObj.total = response.data.total; } }) }, @@ -607,6 +538,16 @@ export default { receiver: '', } }, + jumpTo(data,id) { + this.$store.state.assetData.moduleData = data + this.$store.state.assetData.selectedData = id + this.$router.push({ + path: "/" + data, + query: { + t: +new Date() + } + }); + }, pageNo(val) { this.pageObj.pageNo = val; this.getTableData() diff --git a/nezha-fronted/src/components/page/alarm/list.vue b/nezha-fronted/src/components/page/alert/list.vue similarity index 75% rename from nezha-fronted/src/components/page/alarm/list.vue rename to nezha-fronted/src/components/page/alert/list.vue index f136ed9ad..e90264a73 100644 --- a/nezha-fronted/src/components/page/alarm/list.vue +++ b/nezha-fronted/src/components/page/alert/list.vue @@ -2,43 +2,6 @@ .account { height: 100%; } - .content-left { - float: left; - width: 370px; - height: 100%; - } - .sidebar-title { - padding-left: 30px; - padding-top: 20px; - } - - .sidebar-info { - margin-top: 20px; - border: 1px solid #acacac; - border-radius: 8px; - height: calc(90vh - 55px); - width: calc(100% - 30px); - } - - .sidebar-info-header { - background: #acacac; - text-align: center; - line-height: 50px; - border-top-left-radius: 8px; - border-top-right-radius: 8px; - height: 60px; - width: 100%; - } - - .sidebar-info-footer { - padding-top: 15px; - padding-left: 15px; - } - .account-list { - height: calc(100% - 131px); - margin-left: 370px; - padding: 0 15px 0 0; - } .account-list-option { cursor: pointer; display: inline-block; @@ -56,11 +19,6 @@ .account-list-option .el-icon-view:hover { color: #409EFF; } - .account-list-search { - float: right; - width: 220px; - margin: 15px 0; - } /* begin--右侧弹框*/ .right-box { position: fixed; @@ -202,22 +160,26 @@ - - - Config - - - - - + + + + + {{$t('overall.add')}} + + + - Project Alarm - Module Alarm - Device Alarm + Project alert + Module alert + Device alert {{scope.row[item.prop].name}} @@ -250,7 +212,7 @@ - + @@ -258,7 +220,7 @@ diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index 93527cea5..92f1a4d0e 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -2,65 +2,29 @@ .account { height: 100%; } - .content-left { - float: left; - width: 370px; - height: 100%; - } - .sidebar-title { - padding-left: 30px; - padding-top: 20px; - } - .sidebar-info { - margin-top: 20px; - border: 1px solid #acacac; - border-radius: 8px; - height: calc(90vh - 55px); - width: calc(100% - 30px); - } - - .sidebar-info-header { - background: #acacac; - text-align: center; - line-height: 50px; - border-top-left-radius: 8px; - border-top-right-radius: 8px; - height: 60px; - width: 100%; - } - - .sidebar-info-footer { - padding-top: 15px; - padding-left: 15px; - } - .account-list { + .content-right { height: calc(100% - 131px); - margin-left: 370px; - padding: 0 15px 0 0; + margin-left: 322px; + padding: 0 15px 0 25px; } - .account-list-option { + .content-right-option { cursor: pointer; display: inline-block; margin-right: 6px; } - .account-list-option .el-icon-delete { + .content-right-option .el-icon-delete { color: #F98D9A; } - .account-list-option .el-icon-delete:hover { + .content-right-option .el-icon-delete:hover { color: #D96D7A; } - .account-list-option .el-icon-view { + .content-right-option .el-icon-view { color: #60BEFF; } - .account-list-option .el-icon-view:hover { + .content-right-option .el-icon-view:hover { color: #409EFF; } - .account-list-search { - float: right; - width: 220px; - margin: 15px 0; - } /* begin--右侧弹框*/ .right-box { position: fixed; @@ -203,21 +167,25 @@ - - Config - - - + Config + + Account List + Prometheus Server - - + + + + + {{$t('overall.add')}} + + + - - - - + + + + {{scope.row[item.prop] == 'en' ? 'English' : ''}} @@ -757,7 +725,7 @@ export default { } }) }, - add: function() { + toAdd: function() { this.cleanUser(); this.rightBox.isEdit = true; this.rightBox.title = this.$t("config.account.createAccount"); @@ -771,6 +739,16 @@ export default { } }, + jumpTo(data,id) { + this.$store.state.assetData.moduleData = data + this.$store.state.assetData.selectedData = id + this.$router.push({ + path: "/" + data, + query: { + t: +new Date() + } + }); + }, toEditReceiver: function(item) { if (!item.isEdit) { //如果不在编辑状态,那么其他项如果有改动,则还原改动,最后开始编辑 diff --git a/nezha-fronted/src/components/page/config/promServer.vue b/nezha-fronted/src/components/page/config/promServer.vue index da272603f..5d3b6a35f 100644 --- a/nezha-fronted/src/components/page/config/promServer.vue +++ b/nezha-fronted/src/components/page/config/promServer.vue @@ -2,65 +2,27 @@ .prom { height: 100%; } - .content-left { - float: left; - width: 370px; - height: 100%; - } - .sidebar-title { - padding-left: 30px; - padding-top: 20px; + .prom .el-table { + border-radius: 5px; } - .sidebar-info { - margin-top: 20px; - border: 1px solid #acacac; - border-radius: 8px; - height: calc(90vh - 55px); - width: calc(100% - 30px); - } - - .sidebar-info-header { - background: #acacac; - text-align: center; - line-height: 50px; - border-top-left-radius: 8px; - border-top-right-radius: 8px; - height: 60px; - width: 100%; - } - - .sidebar-info-footer { - padding-top: 15px; - padding-left: 15px; - } - .prom-list { - height: calc(100% - 131px); - margin-left: 370px; - padding: 0 15px 0 0; - } - .prom-list-option { + .content-right-option { cursor: pointer; display: inline-block; margin-right: 6px; } - .prom-list-option .el-icon-delete { + .content-right-option .el-icon-delete { color: #F98D9A; } - .prom-list-option .el-icon-delete:hover { + .content-right-option .el-icon-delete:hover { color: #D96D7A; } - .prom-list-option .el-icon-view { + .content-right-option .el-icon-view { color: #60BEFF; } - .prom-list-option .el-icon-view:hover { + .content-right-option .el-icon-view:hover { color: #409EFF; } - .prom-list-search { - float: right; - width: 220px; - margin: 15px 0; - } /* begin--右侧弹框*/ .right-box { position: fixed; @@ -203,21 +165,25 @@ - - Config - - - + {{$t('config.config')}} + + {{$t('config.account.accountList')}} + {{$t('config.promServer.promServerList')}} - - + + + + + {{$t('overall.add')}} + + + - - - - + + + + @@ -330,7 +296,7 @@ - {{$t('overall.cancel')}}{{promServer.id == '' ? $t('overall.create') : $t('overall.save')}} + {{$t('overall.cancel')}}{{promServer.id == '' ? $t('overall.create') : $t('overall.save')}} @@ -423,7 +389,7 @@ export default { } }, methods: { - edit: function(u) { + toEdit: function(u) { this.promServer = Object.assign({}, u); this.rightBox.isEdit = true; this.rightBox.title = this.$t("config.promServer.editProm") + " ID:" + u.id; @@ -445,24 +411,34 @@ export default { this.rightBox.title = "Prometheus Server ID:" + u.id; this.rightBox.show = true; }, - add: function() { + toAdd: function() { this.cleanPromServer(); this.rightBox.isEdit = true; this.rightBox.title = this.$t("config.promServer.createProm"); this.rightBox.show = true; }, - saveOrToEdit: function() { - if (!this.rightBox.isEdit) { - this.rightBox.isEdit = true; - this.rightBox.title = this.$t("config.promServer.editProm") + " ID:" + this.promServer.id; - } else { + save: function() { + if (this.promServer.id) { this.$put('promServer', this.promServer).then(response => { if (response.code === 200) { this.getTableData(); this.rightBox.isEdit = false; - } - }) + }); + } else { + this.$post('promServer', this.promServer).then(response => { + if (response.code === 200) { + this.getTableData(); + this.rightBox.isEdit = false; + } + }); + } + }, + saveOrToEdit: function() { + if (!this.rightBox.isEdit) { + this.toEdit(this.promServer); + } else { + this.save(); } }, toEditIdc: function(item) { @@ -473,9 +449,16 @@ export default { } else { //如果已在编辑状态,判断name是否有变更,有变更则发请求 if (item.name != item.oldName) { - if (this.updateIdcName(item) == 200) { - item.isEdit = false; - } + this.$put('idc', item).then(response => { + if (response.code === 200) { + item.errorMessage = ''; + item.oldName = item.name; + item.isEdit = false; + } else { + console.info(response.msg) + this.$set(item, 'errorMessage', response.msg); + } + }) } else { item.errorMessage = ''; item.isEdit = false; @@ -496,10 +479,12 @@ export default { this.blurEditIdc(); //TODO 请求后台,删除 }, - getIdcData: function() { - this.$get('idc', this.pageObj).then(response => { + getIdcData: async function() { + console.info(1) + await this.$get('idc', this.pageObj).then(response => { if (response.code === 200) { this.idcData = response.data.list; + this.getTableData(); } }) for (var i = 0; i < this.idcData.length; i++) { @@ -512,12 +497,22 @@ export default { }, stopFun: function() { + }, + jumpTo(data,id) { + this.$store.state.assetData.moduleData = data + this.$store.state.assetData.selectedData = id + this.$router.push({ + path: "/" + data, + query: { + t: +new Date() + } + }); }, getTableData: function() { this.$get('promServer', this.pageObj).then(response => { if (response.code === 200) { - console.info(this.idcData) for (var i = 0; i < response.data.list.length; i++) { + console.info(this.idcData) for (var j = 0; j < this.idcData.length; j++) { if (response.data.list[i].idcId == this.idcData[j].id) { response.data.list[i].idc = this.idcData[j]; @@ -530,14 +525,6 @@ export default { } }) }, - updateIdcName: function(item) { - //TODO 请求接口改名 - var code = 200; - //this.$set(item, 'errorMessage', 'err'); - item.errorMessage = ''; - item.oldName = item.name; - return code; - }, cleanPromServer: function() { this.promServer = { id: '', @@ -555,9 +542,13 @@ export default { this.getTableData(); } }, - mounted() { + mounted: function() { this.getIdcData(); - this.getTableData(); + }, + watch: { + 'promServer.idc': function(n, o) { + this.promServer.idcId = n.id; + } } } diff --git a/nezha-fronted/src/components/page/project/project.vue b/nezha-fronted/src/components/page/project/project.vue index 951bc17ff..36417c04d 100644 --- a/nezha-fronted/src/components/page/project/project.vue +++ b/nezha-fronted/src/components/page/project/project.vue @@ -1,25 +1,270 @@ + - - - - - - - - - + + + Config + + Account List + Prometheus Server + + + + + + {{$t('project.endpoint.endpoint')}} + + + {{$t('project.metrics')}} + + + + + {{$t('overall.add')}} + + + + + + + + {{scope.row[item.prop]}} + + + + + + + + + + + + + + + + + + + + + + + + {{$t('overall.esc')}} + + + + + + {{$t('overall.save')}} + {{$t('overall.edit')}} + + + + + + {{$t('overall.delete')}} + + + + + + {{rightBox.title}} + + + + + + IDC + aaa + + + + Host + + + {{endpoint.host}} + + + + + + + + {{$t('overall.cancel')}}{{endpoint.id == '' ? $t('overall.create') : $t('overall.save')}} + + + + + + - - \ No newline at end of file diff --git a/nezha-fronted/src/http.js b/nezha-fronted/src/http.js index fe9d97450..67b3174cd 100644 --- a/nezha-fronted/src/http.js +++ b/nezha-fronted/src/http.js @@ -1,11 +1,12 @@ import axios from 'axios' import qs from 'qs' //引入数据格式化 +//axios.defaults.baseURL = 'http://localhost:8088/nz-admin'; axios.defaults.baseURL = 'http://192.168.40.247:8080/nz-admin'; axios.interceptors.request.use(config => { - config.headers = { - "Content-Type": 'application/x-www-form-urlencoded', - } - config.data = qs.stringify(config.data); + // config.headers = { + // "Content-Type": 'application/x-www-form-urlencoded', + // } + // config.data = qs.stringify(config.data); let token = sessionStorage.getItem('token') if (token) { config.headers['Authorization'] = token //请求头token @@ -21,7 +22,7 @@ export function get(url, params) { }).then(response => { resolve(response.data) }).catch(err => { - reject(err.response.data) + resolve(err.response.data) }) }) } @@ -32,20 +33,18 @@ export function post(url, params) { resolve(response.data) }).catch(err => { console.info(err) - reject(err.response.data) + resolve(err.response.data) }) }) } export function put(url, params) { return new Promise((resolve, reject) => { - //params = qs.stringify(Object.assign(params)); - //console.info(params); axios.put(url, params).then(response => { resolve(response.data) }).catch(err => { console.info(err) - reject(err.response.data) + resolve(err.response.data); }) }) } @@ -56,7 +55,7 @@ export function del(url, params) { resolve(response.data) }).catch(err => { console.info(err) - reject(err.response.data) + resolve(err.response.data) }) }) } diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js index d19283b9f..768a1ec2f 100644 --- a/nezha-fronted/src/router/index.js +++ b/nezha-fronted/src/router/index.js @@ -38,12 +38,12 @@ export default new Router({ component: resolve => require(['../components/page/config/promServer.vue'], resolve), }, { - path: '/alarmList', - component: resolve => require(['../components/page/alarm/list.vue'], resolve), + path: '/alertList', + component: resolve => require(['../components/page/alert/list.vue'], resolve), }, { - path: '/alarmConfig', - component: resolve => require(['../components/page/alarm/config.vue'], resolve), + path: '/alertConfig', + component: resolve => require(['../components/page/alert/config.vue'], resolve), } ] },