diff --git a/nezha-fronted/src/assets/css/common/tableCommon.scss b/nezha-fronted/src/assets/css/common/tableCommon.scss index 4833baf2d..4e47979db 100644 --- a/nezha-fronted/src/assets/css/common/tableCommon.scss +++ b/nezha-fronted/src/assets/css/common/tableCommon.scss @@ -325,6 +325,25 @@ &>.table-operation-item:hover { background-color: $--button-primary-hover-background-color; } + .delete-button.table-operation-item { + justify-content: center; + align-items: center; + width: 30px; + margin-right: 10px; + border: none; + border-radius: $--button-border-radius; + background-color: $--button-primary-background-color; + opacity: 1; + cursor: pointer; + transition: all .2s; + i { + color: $--button-primary-color; + font-size: 12px; + } + } + .delete-button.table-operation-item:hover { + background-color: $--button-primary-hover-background-color; + } .table-operation-item.table-operation-item--more { justify-content: center; align-items: center; diff --git a/nezha-fronted/src/assets/css/components/common/deleteButton.scss b/nezha-fronted/src/assets/css/components/common/deleteButton.scss index 564a45285..5b0dc6710 100644 --- a/nezha-fronted/src/assets/css/components/common/deleteButton.scss +++ b/nezha-fronted/src/assets/css/components/common/deleteButton.scss @@ -97,5 +97,6 @@ } .check-title{ color: $--color-text-regular; + vertical-align: middle; } } diff --git a/nezha-fronted/src/assets/css/components/common/table/settings/backupsTable.scss b/nezha-fronted/src/assets/css/components/common/table/settings/backupsTable.scss index 32bc674c0..22db0c342 100644 --- a/nezha-fronted/src/assets/css/components/common/table/settings/backupsTable.scss +++ b/nezha-fronted/src/assets/css/components/common/table/settings/backupsTable.scss @@ -1,73 +1,74 @@ -.backups-table{ +.backups-table { .nz-table-list { - .el-table__row{ - td:last-of-type{ - // border-bottom: 1px solid $--border-color-light !important; - border: none !important; - } + .el-table__row { + td:last-of-type { + // border-bottom: 1px solid $--border-color-light !important; + border: none !important; } + } } - .el-table:not(.chart-table) { - .table-operation-items { + .el-table:not(.chart-table) { + .table-operation-items { + display: flex; + justify-content: center; + .table-operation-item.delete-button { + background: $--background-color-2 !important; + border: 1px solid $--border-color-base !important; + } + .table-operation-edit { + background: $--background-color-2; + border: 1px solid $--border-color-base; + border-radius: 2px; + width: 30px; + height: 22px; + i { + font-size: 12px !important; + } + } + .table-operation-del { + background: $--background-color-2; + border: 1px solid $--border-color-base; + border-radius: 2px; + width: 22px; + height: 22px; + i { + font-size: 12px !important; + } + } + .table-operation-button { + border: none; + background-color: $--color-primary; + color: $--button-primary-color; display: flex; + text-align: center; + line-height: 22px; justify-content: center; - - .table-operation-edit { - background: $--background-color-2; - border: 1px solid $--border-color-base; - border-radius: 2px; - width: 30px; - height: 22px; - i{ - font-size: 12px !important; - } - } - .table-operation-del{ - background: $--background-color-2; - border: 1px solid $--border-color-base; - border-radius: 2px; - width: 22px; - height: 22px; - i{ - font-size: 12px !important; - } - } - .table-operation-button { - border: none; - background-color: $--color-primary; - color: $--button-primary-color; - display: flex; - text-align: center; - line-height: 22px; - justify-content: center; - align-items: center; - height: 22px; - width: 30px; - padding: 0 5px 0 5px; - margin-right: 10px; - cursor: pointer; - i.nz-icon-beifen.nz-icon::before { - font-size: 12px; - } + align-items: center; + height: 22px; + width: 30px; + padding: 0 5px 0 5px; + margin-right: 10px; + cursor: pointer; + i.nz-icon-beifen.nz-icon::before { + font-size: 12px; } } } + } - .nz-icon-shujubeifenhuifu::before{ - font-size: 12px; - } - .el-table--border td:first-child .cell{ - padding-left: 20px !important; - } + .nz-icon-shujubeifenhuifu::before { + font-size: 12px; + } + .el-table--border td:first-child .cell { + padding-left: 20px !important; + } - - - .el-table__empty-block{ - .el-table__empty-text{ - .table-no-data{ - height: 200px; - padding-top: 70px; - } + .el-table__empty-block { + .el-table__empty-text { + .table-no-data { + height: 200px; + padding-top: 70px; } } + } } diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/IpDetails.vue b/nezha-fronted/src/components/common/bottomBox/tabs/IpDetails.vue index 3f39c9aaf..f89773410 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/IpDetails.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/IpDetails.vue @@ -39,6 +39,7 @@ - +
{{title}}
@@ -98,6 +98,7 @@ export default { dialogVisible: false, idShow: true, idStr: [], + backupName: [], deleteData: [], forceDelete: 0, batchDeleteObjs: [], @@ -126,40 +127,73 @@ export default { deleteTitle: { type: String, default: 'project.topology.data' + }, + single: { + type: Boolean } }, + inject: ['getTableData'], methods: { batchDelete: function () { - this.$emit('before') - if (this.deleteObjs.length < 1) return - if (this.clickFunction) { - this.clickFunction() - return + if (!this.single) { + this.$emit('before') + if (this.deleteObjs.length < 1) return + if (this.clickFunction) { + this.clickFunction() + return + } + this.idShow = true + this.prepare = true + this.process = false + this.finish = false + this.forceDelete = 0 + this.deleteData = this.$loadsh.cloneDeep(this.deleteObjs).map(item => { + item.type = this.from + return item + }) + this.checkAll = true + this.idStr = this.deleteData.map(item => item.id) + this.dialogVisible = true + } else { + setTimeout(() => { + this.$emit('before') + if (this.deleteObjs.length < 1) return + if (this.clickFunction) { + this.clickFunction() + return + } + this.idShow = true + this.prepare = true + this.process = false + this.finish = false + this.forceDelete = 0 + this.deleteData = this.$loadsh.cloneDeep(this.deleteObjs).map(item => { + item.type = this.from + return item + }) + this.checkAll = true + this.idStr = this.deleteData.map(item => item.id) + if (this.from == 'backup') { + this.backupName = this.deleteData.map(item => item.fileName) + } + this.dialogVisible = true + }, 50) } - this.idShow = true - this.prepare = true - this.process = false - this.finish = false - this.forceDelete = 0 - this.deleteData = this.$loadsh.cloneDeep(this.deleteObjs).map(item => { - item.type = this.from - return item - }) - this.checkAll = true - this.idStr = this.deleteData.map(item => item.id) - this.dialogVisible = true }, handleClose () { this.dialogVisible = false if (this.finish) { this.$emit('after') + if (this.single) { + this.getTableData() + } } }, batchDeleteYes () { if (!this.forceDeleteShow) { this.forceDelete = 1 } - this.$delete(this.api + `?ids=${this.idStr.join(',')}&force=${this.forceDelete}`).then(res => { + this.$delete(this.api + `?ids=${this.idStr.join(',')}&force=${this.forceDelete}` + `${this.from == 'backup' ? '&filename=' + this.backupName : ''}`).then(res => { this.idShow = false this.prepare = false this.process = true diff --git a/nezha-fronted/src/components/common/mixin/dataList.js b/nezha-fronted/src/components/common/mixin/dataList.js index 241ec4bcd..c8088530a 100644 --- a/nezha-fronted/src/components/common/mixin/dataList.js +++ b/nezha-fronted/src/components/common/mixin/dataList.js @@ -45,6 +45,11 @@ export default { searchCheckBox: {} } }, + provide () { + return { + getTableData: this.getTableData + } + }, methods: { sortableShow: tableSet.sortableShow, propTitle: tableSet.propTitle, diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index 250d75e46..db6efc6d4 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -27,14 +27,24 @@ export default { return { operationWidth: '165', // 操作列宽 orderBy: null, - severityDataWeight: this.$store.getters.severityDataWeight + severityDataWeight: this.$store.getters.severityDataWeight, + singleDelete: [] } }, methods: { tableOperation ([command, row, param]) { switch (command) { + // case 'delete': { + // this.$emit('del', row) + // break + // } case 'delete': { - this.$emit('del', row) + if (this.singleDelete.length === 0) { + this.singleDelete.push(row) + } else { + this.singleDelete = [] + this.singleDelete.push(row) + } break } case 'ack': { diff --git a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue index cdc2cd63a..cc7f4248c 100644 --- a/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertMessageTable.vue @@ -112,7 +112,23 @@ - {{$t('overall.delete')}} + + + + {{$t('overall.silenceAlert')}} {{$t('overall.acknowledge')}} @@ -151,10 +167,11 @@ import { calcDurationByStringTimeB } from '../../js/tools' import { alertMessage as alertMessageConstant } from '@/components/common/js/constants' import alertLabelMixin from '@/components/common/mixin/alertLabelMixin' import alertMessageLabelMixin from '@/components/common/alert/alertMessageLabelMixin' +import deleteButton from '@/components/common/deleteButton' export default { name: 'alertMessageTable', components: { - alertRuleInfo: alertRuleInfo + alertRuleInfo: alertRuleInfo,deleteButton }, props: { nowTime: { diff --git a/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue b/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue index ab6c36ad3..b91054371 100644 --- a/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue +++ b/nezha-fronted/src/components/common/table/alert/alertRuleTable.vue @@ -149,7 +149,23 @@ {{$t('overall.edit')}} - {{$t('overall.delete')}} + + + + {{$t('overall.duplicate')}} {{$t('overall.silenceAlert')}} @@ -170,9 +186,11 @@