mirror of
https://github.com/veops/cmdb.git
synced 2025-09-20 04:19:20 +08:00
feat(ui): optimize batch operations for auto-discovery pool
This commit is contained in:
@@ -603,6 +603,8 @@ const cmdb_en = {
|
||||
acceptTime: 'Accept Time',
|
||||
confirmAccept: 'Confirm Accept?',
|
||||
acceptSuccess: 'Accept successfully',
|
||||
batchAccept: 'Currently being stored...',
|
||||
batchAccept2: 'Currently being stored: {total} items, {successNum} successful, {errorNum} failed',
|
||||
isAccept: 'Accept',
|
||||
deleteADC: 'Confirm to delete this data?',
|
||||
batchDelete: 'Confirm to delete this data?',
|
||||
|
@@ -603,6 +603,8 @@ const cmdb_zh = {
|
||||
acceptTime: '入库时间',
|
||||
confirmAccept: '确认入库?',
|
||||
acceptSuccess: '入库成功',
|
||||
batchAccept: '正在入库...',
|
||||
batchAccept2: '正在入库,共{total}个,成功{successNum}个,失败{errorNum}个',
|
||||
isAccept: '入库',
|
||||
deleteADC: '确认删除该条数据?',
|
||||
batchDelete: '确认删除这些数据?',
|
||||
|
@@ -33,6 +33,7 @@
|
||||
<template #two>
|
||||
<div id="discovery-ci">
|
||||
<AdcCounter :typeId="currentType" />
|
||||
<a-spin :tip="loadTip" :spinning="loading">
|
||||
<div class="discovery-ci-header">
|
||||
<a-input-search
|
||||
:placeholder="$t('cmdb.components.pleaseSearch')"
|
||||
@@ -77,12 +78,11 @@
|
||||
:height="tableHeight"
|
||||
:scroll-y="{ enabled: true, gt: 50 }"
|
||||
:scroll-x="{ enabled: true, gt: 0 }"
|
||||
:loading="loading"
|
||||
:checkbox-config="{ reserve: true, highlight: true, range: true }"
|
||||
:sort-config="{ remote: false, trigger: 'cell' }"
|
||||
@checkbox-change="onSelectChange"
|
||||
@checkbox-all="onSelectChange"
|
||||
@checkbox-range-end="onSelectChange"
|
||||
:checkbox-config="{ reserve: true, highlight: true, range: true }"
|
||||
:sort-config="{ remote: false, trigger: 'cell' }"
|
||||
>
|
||||
<vxe-column
|
||||
align="center"
|
||||
@@ -168,6 +168,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</ops-table>
|
||||
</a-spin>
|
||||
|
||||
<a-modal
|
||||
v-model="logModalVisible"
|
||||
@@ -232,7 +233,8 @@ export default {
|
||||
logTextArray: [],
|
||||
acceptByFilters: [],
|
||||
selectedCount: 0,
|
||||
loading: false
|
||||
loading: false,
|
||||
loadTip: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -301,6 +303,8 @@ export default {
|
||||
},
|
||||
getAdc(isInit) {
|
||||
this.loading = true
|
||||
this.loadTip = this.$t('loading')
|
||||
|
||||
getAdc({
|
||||
type_id: this.currentType,
|
||||
page_size: 100000,
|
||||
@@ -380,35 +384,73 @@ export default {
|
||||
},
|
||||
|
||||
async batchAccept() {
|
||||
let successNum = 0
|
||||
let errorNum = 0
|
||||
this.loading = true
|
||||
this.loadTip = this.$t('cmdb.ad.batchAccept')
|
||||
|
||||
for (let i = 0; i < this.selectedRowKeys.length; i++) {
|
||||
await updateADCAccept(this.selectedRowKeys[i])
|
||||
await updateADCAccept(this.selectedRowKeys[i]).then((res) => {
|
||||
successNum += 1
|
||||
}).catch(() => {
|
||||
errorNum += 1
|
||||
}).finally(() => {
|
||||
this.loadTip = this.$t('cmdb.ad.batchAccept2', {
|
||||
total: this.selectedRowKeys.length,
|
||||
successNum: successNum,
|
||||
errorNum: errorNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
this.$message.success(this.$t('cmdb.ad.acceptSuccess'))
|
||||
this.getAdc(false)
|
||||
|
||||
this.loading = false
|
||||
this.loadTip = ''
|
||||
this.selectedRowKeys = []
|
||||
this.getAdc(false)
|
||||
this.$refs.xTable.getVxetableRef().clearCheckboxRow()
|
||||
this.$refs.xTable.getVxetableRef().clearCheckboxReserve()
|
||||
this.$refs.xTable.getVxetableRef().clearSort()
|
||||
},
|
||||
|
||||
async batchDelete() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ad.batchDelete'),
|
||||
async onOk() {
|
||||
for (let i = 0; i < that.selectedRowKeys.length; i++) {
|
||||
await deleteAdc(that.selectedRowKeys[i])
|
||||
title: this.$t('warning'),
|
||||
content: this.$t('cmdb.ad.batchDelete'),
|
||||
onOk: () => {
|
||||
this.batchDeleteAsync()
|
||||
}
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.getAdc(false)
|
||||
that.selectedRowKeys = []
|
||||
that.$refs.xTable.getVxetableRef().clearCheckboxRow()
|
||||
that.$refs.xTable.getVxetableRef().clearCheckboxReserve()
|
||||
that.$refs.xTable.getVxetableRef().clearSort()
|
||||
},
|
||||
onCancel() {},
|
||||
})
|
||||
},
|
||||
|
||||
async batchDeleteAsync() {
|
||||
let successNum = 0
|
||||
let errorNum = 0
|
||||
this.loading = true
|
||||
this.loadTip = this.$t('cmdb.ci.batchDeleting')
|
||||
|
||||
for (let i = 0; i < this.selectedRowKeys.length; i++) {
|
||||
await deleteAdc(this.selectedRowKeys[i]).then((res) => {
|
||||
successNum += 1
|
||||
}).catch(() => {
|
||||
errorNum += 1
|
||||
}).finally(() => {
|
||||
this.loadTip = this.$t('cmdb.ci.batchDeleting2', {
|
||||
total: this.selectedRowKeys.length,
|
||||
successNum: successNum,
|
||||
errorNum: errorNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.loading = false
|
||||
this.loadTip = ''
|
||||
this.selectedRowKeys = []
|
||||
this.getAdc(false)
|
||||
this.$refs.xTable.getVxetableRef().clearCheckboxRow()
|
||||
this.$refs.xTable.getVxetableRef().clearCheckboxReserve()
|
||||
this.$refs.xTable.getVxetableRef().clearSort()
|
||||
},
|
||||
|
||||
onSelectChange({ records, checked }) {
|
||||
this.selectedRowKeys = records.map((item) => item.id)
|
||||
},
|
||||
|
Reference in New Issue
Block a user