Merge branch 'dev-3.10' of git.mesalab.cn:nezha/nezha-fronted into dev-3.11

This commit is contained in:
zyh
2024-07-03 16:41:50 +08:00
8 changed files with 52 additions and 57 deletions

View File

@@ -172,7 +172,7 @@ export default {
}, },
showDeleteTableRel (n) { showDeleteTableRel (n) {
if (!n) { if (!n) {
this.$parent.getTableData() this.$parent.getTableData && this.$parent.getTableData()
} }
} }
}, },

View File

@@ -590,14 +590,16 @@ export default {
this.notebookLoading = true this.notebookLoading = true
if (this.obj.id) { if (this.obj.id) {
this.$get('/visual/notebook/' + this.obj.id).then(response => { this.$get('/visual/notebook/' + this.obj.id).then(response => {
if (response.code === 200) {
this.notebookLoading = false this.notebookLoading = false
if (response.code === 200) {
this.dataList = response.data.charts.map(item => { this.dataList = response.data.charts.map(item => {
return { return {
...item, ...item,
loaded: false loaded: false
} }
}) })
} else {
this.$message.error(response.msg)
} }
}) })
} else { } else {

View File

@@ -124,33 +124,13 @@ export default {
type: String, type: String,
default: 'project.topology.data' default: 'project.topology.data'
}, },
single: { // 是否需要强制删除 single: {
type: Boolean type: Boolean
} }
}, },
inject: ['getTableData', 'delCallBack'], inject: ['getTableData', 'delCallBack'],
methods: { methods: {
batchDelete: function () { batchDelete: function () {
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.$lodash.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(() => { setTimeout(() => {
this.$emit('before') this.$emit('before')
if (this.deleteObjs.length < 1) return if (this.deleteObjs.length < 1) return
@@ -174,7 +154,6 @@ export default {
} }
this.dialogVisible = true this.dialogVisible = true
}, 50) }, 50)
}
}, },
handleClose () { handleClose () {
this.dialogVisible = false this.dialogVisible = false
@@ -213,7 +192,7 @@ export default {
}) })
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
if (this.delCallBack) { if (this.delCallBack) {
this.delCallBack(this.idStr) this.delCallBack(this.idStr, this.from)
} }
// this.$emit('after') // this.$emit('after')
} else { } else {
@@ -259,7 +238,6 @@ export default {
selectIcon (type) { selectIcon (type) {
switch (type) { switch (type) {
case 'asset' : return 'nz-icon monitorColor nz-icon-overview-project' case 'asset' : return 'nz-icon monitorColor nz-icon-overview-project'
case 'datacenter' : return 'nz-icon monitorColor nz-icon-Datacenter2'
case 'dc' : return 'nz-icon monitorColor nz-icon-Datacenter2' case 'dc' : return 'nz-icon monitorColor nz-icon-Datacenter2'
case 'project' : return 'nz-icon monitorColor nz-icon-project' case 'project' : return 'nz-icon monitorColor nz-icon-project'
case 'module' : return 'nz-icon monitorColor nz-icon-overview-module' case 'module' : return 'nz-icon monitorColor nz-icon-overview-module'

View File

@@ -58,6 +58,17 @@ export default {
} }
}, },
methods: { methods: {
// 打开底部二级页面时 若删除此数据 关闭底部二级页面
delCallBack (ids, from) {
const dataList = this.$refs.dataList
if ((dataList && dataList.from == from) && (dataList.bottomBox && dataList.bottomBox.showSubList)) {
console.log(dataList.bottomBox.object)
console.log(dataList.bottomBox.object.id)
if (ids.indexOf(dataList.bottomBox.object.id) !== -1) {
dataList.bottomBox.showSubList = false
}
}
},
sortableShow: tableSet.sortableShow, sortableShow: tableSet.sortableShow,
propTitle: tableSet.propTitle, propTitle: tableSet.propTitle,
asce: tableSet.asce, asce: tableSet.asce,

View File

@@ -71,6 +71,7 @@ export default {
if (!params.targetTab) delete params.targetTab if (!params.targetTab) delete params.targetTab
if (!params.bottomBox) delete params.bottomBox if (!params.bottomBox) delete params.bottomBox
if (this.detailType === 'list' && this.$refs[detailType]) { if (this.detailType === 'list' && this.$refs[detailType]) {
if (params.bottomBox) {
const obj = { const obj = {
id: this.$refs[detailType].bottomBox.object.id, id: this.$refs[detailType].bottomBox.object.id,
name: this.$refs[detailType].bottomBox.object.name, name: this.$refs[detailType].bottomBox.object.name,
@@ -96,6 +97,9 @@ export default {
if (JSON.stringify(obj) != '{}') { if (JSON.stringify(obj) != '{}') {
params.selectObj = JSON.stringify(obj) params.selectObj = JSON.stringify(obj)
} }
} else {
delete params.targetTab
}
} else if (this.$refs[detailType] && this.$refs[detailType].detailViewRightObj) { } else if (this.$refs[detailType] && this.$refs[detailType].detailViewRightObj) {
this.$nextTick(() => { this.$nextTick(() => {
const obj = { const obj = {

View File

@@ -118,7 +118,7 @@
<el-dropdown-item v-has="'dc_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item> <el-dropdown-item v-has="'dc_edit'" :command="['edit', scope.row]"><i class="nz-icon nz-icon-edit"></i><span class="operation-dropdown-text">{{$t('overall.edit')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'dc_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item> <el-dropdown-item v-has="'dc_edit'" :command="['copy', scope.row]"><i class="nz-icon nz-icon-override"></i><span class="operation-dropdown-text">{{$t('overall.duplicate')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'dc_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'dc'}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item> <el-dropdown-item v-has="'dc_delete'" :command="['delete-rel', scope.row, {forceDeleteShow:true, single:true,from:'dc'}]"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
<el-dropdown-item v-has="'asset_add'" :command="['topology', scope.row, 'datacenter']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</span></el-dropdown-item> <el-dropdown-item v-has="'asset_add'" :command="['topology', scope.row, 'dc']"><i class="nz-icon nz-icon-Topology"></i><span class="operation-dropdown-text">{{$t('overall.topology')}}</span></el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>

View File

@@ -110,7 +110,7 @@
<delete-button <delete-button
ref="deleteButton" ref="deleteButton"
:single="false" :single="false"
:from="'datacenter'" :from="'dc'"
:forceDeleteShow="true" :forceDeleteShow="true"
:deleteTitle="'overall.dc'" :deleteTitle="'overall.dc'"
:type="'link'" :type="'link'"

View File

@@ -195,8 +195,8 @@ export default {
} }
}) })
}, },
delCallBack (id) { delCallBack (ids) {
if (id.indexOf(this.$store.state.currentProject.id) !== -1) { if (ids.indexOf(this.$store.state.currentProject.id) !== -1) {
this.$store.commit('currentProjectChange', { this.$store.commit('currentProjectChange', {
id: '', id: '',
name: '', name: '',