diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 6a84b6a65..1b4edb51a 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -2254,3 +2254,10 @@ li{ .alert-level-P3{ background: #f7ba78; } +.required-marker { + label:before{ + content: '*'; + color: #F56C6C; + margin-right: 4px; + } +} diff --git a/nezha-fronted/src/components/common/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/alert/alertMessageTable.vue index 592b0360b..163987ad4 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageTable.vue @@ -3,11 +3,6 @@ - - - - - @@ -187,7 +182,11 @@ - + + + + + {{$t('tip.no')}} @@ -409,6 +408,7 @@ this.queryChartDate() }) }, + formatThreshold:function(value,unit){ let unitMethod=chartDataFormat.getUnit(unit) if(unitMethod&&value){ @@ -598,13 +598,19 @@ if (obj) { this.deleteBox.ids = obj.id + ""; } + this.deleteBox.remark=""; this.deleteBox.show = true; }, deleteMessage() { - this.$emit('deleteMessage',this.deleteBox,()=>{ - this.deleteBox.ids=[]; - }); - this.deleteBox.show = false; + this.$refs.remarkForm.validate(valid => { + console.log('valid',valid) + if (valid) { + this.$emit('deleteMessage',this.deleteBox,()=>{ + this.deleteBox.ids=[]; + }); + this.deleteBox.show = false; + } + }) }, selectChange(s) { let ids = []; @@ -613,6 +619,7 @@ ids.push(item.id); }); this.deleteBox.ids = ids.join(","); + this.$emit('select-change',s) }, showExportDialog() { this.importBox.show = true; diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue index 746adb482..01cf2615d 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue @@ -21,15 +21,18 @@ class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="alert-list-export"> + {this.batchDeleteObjs=selection}" > @@ -85,12 +88,14 @@ import chart from '../../../page/dashboard/overview/chart' import bus from '../../../../libs/bus' import alertMessageTable from '@/components/common/alert/alertMessageTable.vue' + import deleteButton from "../../deleteButton"; export default { name: "alertMessageTab", components: { 'nz-alert-tag': nzAlertTag, 'chart': chart, 'alertMessageTable':alertMessageTable, + 'delete-button':deleteButton, }, props: { from: String, //来自哪个主页面,有:"asset"、"alertRule" @@ -109,6 +114,7 @@ requestIndex:0, defaultSearchValue: this.obj.alertNum ? 1 : 0, showElementSet: false, + batchDeleteObjs:[], tableId: 'alertListTable', //需要分页的table的id,用于记录每页数量 showTopBtn: false, //top按钮是否显示 loading: false, @@ -453,6 +459,12 @@ dialogClose() { this.graphShow = false; }, + openDelMessageBox:function(){ + if(this.batchDeleteObjs.length<1) return; + if(this.$refs.alertMessageTable){ + this.$refs.alertMessageTable.toDeleteMessage(false); + } + }, del(u) { this.$confirm(this.$t("tip.confirmDelete"), { confirmButtonText: this.$t("tip.yes"), diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue index 2b0d488f1..9916c081e 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/cabinetTab.vue @@ -13,6 +13,7 @@ class="nz-btn nz-btn-size-normal nz-btn-style-light float-right margin-l-20" id="cab-add"> + + style="width: 100%;" + @selection-change="(selection)=>{this.batchDeleteObjs=selection}" + > + + import cabinetBox from "../../rightBox/cabinetBox"; + import deleteButton from "../../deleteButton"; export default { name: "cabinetTab", components: { - "cabinet-box": cabinetBox + "cabinet-box": cabinetBox, + 'delete-button':deleteButton, }, props: { obj: Object, //关联的实体对象 @@ -99,6 +110,7 @@ seq:'', uSize:1 }, + batchDeleteObjs:[], rightBox: {show: false}, showTopBtn: false, //top按钮是否显示 loading: false, diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue index a387c58f1..6304bc108 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointTab.vue @@ -25,6 +25,7 @@ + @@ -49,7 +50,14 @@ ref="endpointTable" style="width: 100%;" @sort-change="tableDataSort" + @selection-change="(selection)=>{this.batchDeleteObjs=selection}" > + + + {{dateFormat(scope.row.lastUpdate)}} @@ -133,10 +142,12 @@ + + diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 51cb522bb..309e80dbb 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -374,6 +374,7 @@ const cn = { }, tip: { confirmDelete: "确认删除吗?", + confirmBatchDelete:'确定删除这{0}条数据吗?', assetConfirmDelete: "关联的Endpoint和告警将会被删除,确认删除吗?", yes: "是", no: "否", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 261ccab5b..a22023b9b 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -377,6 +377,7 @@ const en = { }, tip: { confirmDelete: "Are you sure you want to delete?", //Are you sure you want to delete? + confirmBatchDelete:'Are you sure to delete these {0} pieces of data', assetConfirmDelete: 'Related endpoints and alerts will be removed, are you sure you want to delete this asset?',//Related endpoints and alerts will be removed, are you sure you want to delete this asset? yes: 'Yes', //"是" no: "No",//No diff --git a/nezha-fronted/src/components/common/rightBox/assetBox.vue b/nezha-fronted/src/components/common/rightBox/assetBox.vue index f7c949bee..a760fc006 100644 --- a/nezha-fronted/src/components/common/rightBox/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/assetBox.vue @@ -75,7 +75,7 @@ - + diff --git a/nezha-fronted/src/components/page/alert/config.vue b/nezha-fronted/src/components/page/alert/config.vue index dff5a90cd..f7044522f 100644 --- a/nezha-fronted/src/components/page/alert/config.vue +++ b/nezha-fronted/src/components/page/alert/config.vue @@ -48,6 +48,7 @@ + @@ -75,7 +76,14 @@ style="width: 100%;" @sort-change="tableDataSort" @row-dblclick="detail" + @selection-change="(selection)=>{this.batchDeleteObjs=selection}" > + + + {this.batchDeleteObjs=selection}" > @@ -102,6 +105,7 @@ import alertRuleInfo from '../../common/alert/alertRuleInfo' import alertLabel from '../../common/alert/alertLabel' import alertMessageTable from '../../common/alert/alertMessageTable.vue' + import deleteButton from "../../common/deleteButton"; export default { name: "alertList", components: { @@ -111,6 +115,7 @@ 'alertLabel':alertLabel, 'alertMessageTable':alertMessageTable, 'pick-time':pickTime, + 'delete-button':deleteButton, }, data() { return { @@ -140,7 +145,7 @@ //导出相关 importBox: {show: false, title:this.$t('overall.exportExcel')}, deleteBox: {show: false, ids: "", remark: '', state: 2}, - + batchDeleteObjs:[], //详情相关 graphShow: false, chartDatas: [], @@ -411,6 +416,12 @@ this.$refs['assetEditUnit'].tabView = false } }, + openDelMessageBox:function(){ + if(this.batchDeleteObjs.length<1) return; + if(this.$refs.alertMessageTable){ + this.$refs.alertMessageTable.toDeleteMessage(false); + } + }, toDeleteMessage(obj) { if (obj) { this.deleteBox.ids = obj.id + ""; diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue index b964afa10..fe15a85e0 100644 --- a/nezha-fronted/src/components/page/asset/asset.vue +++ b/nezha-fronted/src/components/page/asset/asset.vue @@ -10,13 +10,14 @@ export-url="/asset/export" import-url="/asset/import" :params="searchLabel" - @afterImport="getTableData" + @afterImport="afterTableListChange" > + @@ -44,7 +45,14 @@ :cell-class-name="messageStyle" @sort-change="tableDataSort" @row-dblclick="detail" + @selection-change="(selection)=>{this.batchDeleteObjs=selection}" > + + { if (response.code === 200) { this.$message({duration: 2000, type: 'success', message: this.$t("tip.deleteSuccess")}); - this.getTableData(); - bus.$emit('asset-list-change') + this.afterTableListChange() } else { this.$message.error(response.msg); } @@ -539,11 +549,14 @@ closeRightBox(refresh) { this.rightBox.show = false; if (refresh) { - this.getTableData(); - bus.$emit('asset-list-change') + this.afterTableListChange() this.loadKeys(); } }, + afterTableListChange:function(){ + this.getTableData(); + bus.$emit('asset-list-change') + }, pageNo(val) { this.pageObj.pageNo = val; this.getTableData() diff --git a/nezha-fronted/src/components/page/config/account.vue b/nezha-fronted/src/components/page/config/account.vue index 1a4185fde..53e7bde1b 100644 --- a/nezha-fronted/src/components/page/config/account.vue +++ b/nezha-fronted/src/components/page/config/account.vue @@ -18,6 +18,7 @@ class="nz-btn nz-btn-size-normal nz-btn-style-light margin-l-20" id="account-add"> + @@ -42,7 +43,15 @@ v-loading="tools.loading" v-scrollBar:el-table="'large'" style="width: 100%;" - @sort-change="tableDataSort"> + @sort-change="tableDataSort" + @selection-change="(selection)=>{this.batchDeleteObjs=selection}" + > + +