refactor: 主动销毁监听事件,防止重复监听,改善内存使用

This commit is contained in:
wangjiahao 2022-06-30 17:03:01 +08:00
parent 2de5c6ab76
commit 43724c930b
45 changed files with 334 additions and 225 deletions

View File

@ -94,32 +94,30 @@ export default {
//
loadMsgTypes()
this.queryCount()
// this.search()
// 30s
/* this.timer = setInterval(() => {
this.queryCount()
}, 30000) */
},
mounted() {
bus.$on('refresh-top-notification', () => {
if (this.visible) this.search()
else this.queryCount()
})
bus.$on('web-msg-topic-call', msg => {
this.count = (this.count || this.paginationConfig.total) + 1
// this.queryCount()
// this.search()
})
this.initEvents()
},
beforeDestroy() {
this.timer && clearInterval(this.timer)
bus.$off('refresh-top-notification', this.refreshTopNotification)
bus.$off('web-msg-topic-call', this.webMsgTopicCall)
},
destroyed() {
this.timer && clearInterval(this.timer)
},
methods: {
refreshTopNotification() {
if (this.visible) this.search()
else this.queryCount()
},
webMsgTopicCall() {
this.count = (this.count || this.paginationConfig.total) + 1
},
initEvents() {
bus.$on('refresh-top-notification', this.refreshTopNotification)
bus.$on('web-msg-topic-call', this.webMsgTopicCall)
},
showDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.visible = false

View File

@ -40,10 +40,10 @@ export default {
eventBus.$on('move', (isDownward, isRightward) => {
this.showLine(isDownward, isRightward)
})
eventBus.$on('unmove', () => {
this.hideLine()
})
eventBus.$on('unmove', this.hideLine)
},
beforeDestroy() {
eventBus.$off('unmove', this.hideLine)
},
methods: {
hideLine() {

View File

@ -287,6 +287,7 @@ export default {
erd.uninstall(this.$refs.canvasInfoTemp)
erd.uninstall(this.$refs.canvasInfoMain)
clearInterval(this.timer)
eventBus.$off('openChartDetailsDialog', this.openChartDetailsDialog)
},
methods: {
_isMobile() {
@ -411,7 +412,6 @@ export default {
})
}
}, 1500)
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
}
}

View File

@ -178,6 +178,7 @@ export default {
_this.canvasStyleDataInit()
},
beforeDestroy() {
eventBus.$off('openChartDetailsDialog', this.openChartDetailsDialog)
clearInterval(this.timer)
},
methods: {

View File

@ -94,13 +94,17 @@ export default {
}
this.element.type === 'custom' && (this.pointList = ['l', 'r'])
eventBus.$on('runAnimation', () => {
eventBus.$on('runAnimation', this.runAnimation)
},
beforeDestroy() {
eventBus.$off('runAnimation', this.runAnimation)
},
methods: {
runAnimation() {
if (this.element === this.curComponent) {
runAnimation(this.$el, this.curComponent.animations)
}
})
},
methods: {
},
//
enter() {
this.mouseOn = true

View File

@ -1051,9 +1051,7 @@ export default {
//
this.$store.commit('getEditor')
const _this = this
eventBus.$on('hideArea', () => {
this.hideArea()
})
eventBus.$on('hideArea', this.hideArea)
eventBus.$on('startMoveIn', this.startMoveIn)
eventBus.$on('openChartDetailsDialog', this.openChartDetailsDialog)
bus.$on('onRemoveLastItem', this.removeLastItem)
@ -1065,6 +1063,12 @@ export default {
}, 500)
}
},
beforeDestroy() {
eventBus.$off('hideArea', this.hideArea)
eventBus.$off('startMoveIn', this.startMoveIn)
eventBus.$off('openChartDetailsDialog', this.openChartDetailsDialog)
bus.$off('onRemoveLastItem', this.removeLastItem)
},
created() {
},
methods: {

View File

@ -202,6 +202,11 @@ export default {
this.mobileLayoutInitStatus = this.mobileLayoutStatus
this.showGridSwitch = this.canvasStyleData.aidedDesign.showGrid
},
beforeDestroy() {
eventBus.$off('preview', this.preview)
eventBus.$off('save', this.save)
eventBus.$off('clearCanvas', this.clearCanvas)
},
methods: {
close() {
//
@ -734,4 +739,8 @@ export default {
.el-dropdown-menu__item{
line-height: 32px;
}
::v-deep .el-radio-button__inner{
padding:7px 7px
}
</style>

View File

@ -67,14 +67,18 @@ export default {
created() {
},
mounted() {
bus.$on('frameLinksChange-' + this.element.id, () => {
bus.$on('frameLinksChange-' + this.element.id, this.frameLinksChange)
},
beforeDestroy() {
bus.$off('frameLinksChange-' + this.element.id, this.frameLinksChange)
},
methods: {
frameLinksChange() {
this.frameShow = false
this.$nextTick(() => {
this.frameShow = true
})
})
},
methods: {
},
loaded(e) {
},
onError(e) {

View File

@ -84,7 +84,14 @@ export default {
},
mounted() {
this.initOption()
bus.$on('streamMediaLinksChange-' + this.element.id, () => {
bus.$on('streamMediaLinksChange-' + this.element.id, this.streamMediaLinksChange)
},
beforeDestroy() {
bus.$off('streamMediaLinksChange-' + this.element.id, this.streamMediaLinksChange)
this.destroyPlayer()
},
methods: {
streamMediaLinksChange() {
this.pOption = this.element.streamMediaLinks[this.element.streamMediaLinks.videoType]
this.flvPlayer = null
this.videoShow = false
@ -92,12 +99,7 @@ export default {
this.videoShow = true
this.initOption()
})
})
},
beforeDestroy() {
this.destroyPlayer()
},
methods: {
},
initOption() {
if (flvjs.isSupported() && this.pOption.url) {
this.destroyPlayer()

View File

@ -90,15 +90,19 @@ export default {
this.initOption()
},
mounted() {
bus.$on('videoLinksChange-' + this.element.id, () => {
bus.$on('videoLinksChange-' + this.element.id, this.videoLinksChange)
},
beforeDestroy() {
bus.$off('videoLinksChange-' + this.element.id, this.videoLinksChange)
},
methods: {
videoLinksChange() {
this.showVideo = false
this.$nextTick(() => {
this.showVideo = true
this.initOption()
})
})
},
methods: {
},
initOption() {
this.pOption = this.element.videoLinks[this.element.videoLinks.videoType]
this.pOption.height = this.h - (this.curGap * 2)

View File

@ -404,6 +404,17 @@ export default {
this.bindPluginEvent()
},
beforeDestroy() {
bus.$off('plugin-chart-click', this.pluginChartClick)
bus.$off('plugin-jump-click', this.pluginJumpClick)
bus.$off('plugin-add-view-track-filter', this.pluginAddViewTrackFilter)
bus.$off('view-in-cache', this.viewInCache)
bus.$off('batch-opt-change', this.batchOptChange)
bus.$off('onSubjectChange', this.optFromBatchThemeChange)
bus.$off('onThemeColorChange', this.optFromBatchThemeChange)
bus.$off('onThemeAttrChange', this.optFromBatchSingleProp)
bus.$off('clear_panel_linkage', this.clearPanelLinkage)
},
created() {
this.refId = uuid.v1
if (this.element && this.element.propValue && this.element.propValue.viewId) {
@ -441,7 +452,7 @@ export default {
this.$store.commit('recordViewEdit', { viewId: this.chart.id, hasEdit: true })
this.mergeScale()
},
optFromBatchThemeChange(changeType) {
optFromBatchThemeChange() {
const updateParams = { 'id': this.chart.id }
const sourceCustomAttr = JSON.parse(this.sourceCustomAttrStr)
const sourceCustomStyle = JSON.parse(this.sourceCustomStyleStr)
@ -467,38 +478,34 @@ export default {
: this.$refs[this.element.propValue.id].chartResize()
}
},
bindPluginEvent() {
bus.$on('plugin-chart-click', param => {
param.viewId && param.viewId === this.element.propValue.viewId && this.chartClick(param)
})
bus.$on('plugin-jump-click', param => {
param.viewId && param.viewId === this.element.propValue.viewId && this.jumpClick(param)
})
bus.$on('plugin-add-view-track-filter', param => {
param.viewId && param.viewId === this.element.propValue.viewId && this.addViewTrackFilter(param)
})
bus.$on('view-in-cache', param => {
param.viewId && param.viewId === this.element.propValue.viewId && this.getDataEdit(param)
})
bus.$on('batch-opt-change', param => {
this.batchOptChange(param)
})
bus.$on('onSubjectChange', () => {
this.optFromBatchThemeChange('subject')
})
bus.$on('onThemeColorChange', () => {
this.optFromBatchThemeChange('themeColor')
})
bus.$on('onThemeAttrChange', (param) => {
this.optFromBatchSingleProp(param)
})
bus.$on('clear_panel_linkage', (param) => {
if (param.viewId === 'all' || param.viewId === this.element.propValue.viewId) {
this.$refs[this.element.propValue.id].reDrawView()
}
})
pluginChartClick(param) {
param.viewId && param.viewId === this.element.propValue.viewId && this.chartClick(param)
},
pluginJumpClick(param) {
param.viewId && param.viewId === this.element.propValue.viewId && this.jumpClick(param)
},
pluginAddViewTrackFilter(param) {
param.viewId && param.viewId === this.element.propValue.viewId && this.addViewTrackFilter(param)
},
viewInCache(param) {
param.viewId && param.viewId === this.element.propValue.viewId && this.getDataEdit(param)
},
clearPanelLinkage(param) {
if (param.viewId === 'all' || param.viewId === this.element.propValue.viewId) {
this.$refs[this.element.propValue.id].reDrawView()
}
},
bindPluginEvent() {
bus.$on('plugin-chart-click', this.pluginChartClick)
bus.$on('plugin-jump-click', this.pluginJumpClick)
bus.$on('plugin-add-view-track-filter', this.pluginAddViewTrackFilter)
bus.$on('view-in-cache', this.viewInCache)
bus.$on('batch-opt-change', this.batchOptChange)
bus.$on('onSubjectChange', this.optFromBatchThemeChange)
bus.$on('onThemeColorChange', this.optFromBatchThemeChange)
bus.$on('onThemeAttrChange', this.optFromBatchSingleProp)
bus.$on('clear_panel_linkage', this.clearPanelLinkage)
},
addViewTrackFilter(linkageParam) {
this.$store.commit('addViewTrackFilter', linkageParam)
},

View File

@ -112,12 +112,20 @@ export default {
}
},
mounted() {
bus.$on('onScroll', () => {
bus.$on('onScroll', this.onScroll)
bus.$on('reset-default-value', this.resetDefaultValue)
},
beforeDestroy() {
bus.$off('onScroll', this.onScroll)
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
onScroll() {
if (this.onFocus) {
this.$refs.dateRef.hidePicker()
}
})
bus.$on('reset-default-value', id => {
},
resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) {
if (!this.element.options.attrs.default.isDynamic) {
this.values = this.fillValueDerfault()
@ -128,12 +136,7 @@ export default {
this.values = widget.dynamicDateFormNow(this.element)
this.dateChange(this.values)
}
})
},
beforeDestroy() {
bus.$off('reset-default-value')
},
methods: {
},
onBlur() {
this.onFocus = false
},

View File

@ -71,17 +71,18 @@ export default {
}
},
mounted() {
bus.$on('reset-default-value', id => {
bus.$on('reset-default-value', this.resetDefaultValue)
},
beforeDestroy() {
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.search()
}
})
},
beforeDestroy() {
bus.$off('reset-default-value')
},
methods: {
},
search() {
if (!this.inDraw) {
this.element.options.value = this.value

View File

@ -104,7 +104,13 @@ export default {
}
},
mounted() {
bus.$on('reset-default-value', id => {
bus.$on('reset-default-value', this.resetDefaultValue)
},
beforeDestroy() {
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) {
const values = this.element.options.value
this.form.min = values[0]
@ -113,12 +119,7 @@ export default {
}
this.search()
}
})
},
beforeDestroy() {
bus.$off('reset-default-value')
},
methods: {
},
searchWithKey(index) {
this.timeMachine = setTimeout(() => {
if (index === this.changeIndex) {

View File

@ -178,23 +178,25 @@ export default {
this.initLoad()
},
mounted() {
bus.$on('onScroll', () => {
bus.$on('onScroll', this.onScroll)
bus.$on('reset-default-value', this.resetDefaultValue)
},
beforeDestroy() {
bus.$off('onScroll', this.onScroll)
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
onScroll() {
if (this.onFocus) {
this.$refs.deSelect.blur()
}
})
bus.$on('reset-default-value', id => {
},
resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
})
},
beforeDestroy() {
bus.$off('reset-default-value')
},
methods: {
},
onBlur() {
this.onFocus = false
},

View File

@ -199,7 +199,13 @@ export default {
this.initLoad()
},
mounted() {
bus.$on('reset-default-value', id => {
bus.$on('reset-default-value', this.resetDefaultValue)
},
beforeDestroy() {
bus.$off('reset-default-value', this.resetDefaultValue)
},
methods: {
resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
@ -209,13 +215,7 @@ export default {
this.isIndeterminate = this.value.length > 0 && this.value.length < this.datas.length
}
}
})
},
beforeDestroy() {
bus.$off('reset-default-value')
},
methods: {
},
changeInputStyle() {
if (!this.$parent.handlerInputStyle) return
this.$nextTick(() => {

View File

@ -202,21 +202,19 @@ export default {
this.initLoad()
},
mounted() {
bus.$on('onScroll', () => {
bus.$on('reset-default-value', this.resetDefaultValue)
},
beforeDestroy() {
bus.$off('reset-default-value', this.resetDefaultValue)
},
})
bus.$on('reset-default-value', id => {
methods: {
resetDefaultValue(id) {
if (this.inDraw && this.manualModify && this.element.id === id) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
})
},
beforeDestroy() {
bus.$off('reset-default-value')
},
methods: {
},
onFoucs() {
this.$nextTick(() => {
this.handleCoustomStyle()

View File

@ -283,6 +283,9 @@ export default {
bus.$on('add-new-tab', this.addNewTab)
this.activeTabName = this.element.options.tabList[0].name
},
beforeDestroy() {
bus.$off('add-new-tab', this.addNewTab)
},
methods: {
beforeHandleCommond(item, param) {
return {
@ -337,13 +340,12 @@ export default {
return
}
this.$warning(this.$t('detabs.please') + this.$t('detabs.selectOthers'))
},
sureViewSelector() {
const nodes = this.$refs.viewSelect.getCurrentSelected()
if (!nodes || nodes.length === 0) {
this.$warning(this.$t('detabs.please') + this.$t('detabs.selectview'))
return
}
const node = nodes[0]

View File

@ -197,14 +197,19 @@ export default {
bus.$on('set-top-menu-active-info', this.setTopMenuActiveInfo)
bus.$on('set-top-text-info', this.setTopTextInfo)
bus.$on('set-top-text-active-info', this.setTopTextActiveInfo)
bus.$on('sys-logout', param => {
this.logout(param)
})
bus.$on('sys-logout', this.logout)
this.showTips && this.$nextTick(() => {
const drop = this.$refs['my-drop']
drop && drop.show && drop.show()
})
},
beforeDestroy() {
bus.$off('set-top-menu-info', this.setTopMenuInfo)
bus.$off('set-top-menu-active-info', this.setTopMenuActiveInfo)
bus.$off('set-top-text-info', this.setTopTextInfo)
bus.$off('set-top-text-active-info', this.setTopTextActiveInfo)
bus.$off('sys-logout', this.logout)
},
created() {
this.loadUiInfo()
},

View File

@ -97,11 +97,15 @@ export default {
})
},
mounted() {
bus.$on('PanelSwitchComponent', (c) => {
this.componentName = c.name
})
bus.$on('PanelSwitchComponent', this.panelSwitchComponent)
},
beforeDestroy() {
bus.$off('PanelSwitchComponent', this.panelSwitchComponent)
},
methods: {
panelSwitchComponent(c) {
this.componentName = c.name
},
handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
}

View File

@ -157,7 +157,10 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
clickItem(param) {

View File

@ -131,7 +131,10 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
clickItem(param) {

View File

@ -141,9 +141,12 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
this.init()
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
init() {
if (!this.item.formatterCfg) {

View File

@ -73,7 +73,10 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
clickItem(param) {

View File

@ -74,7 +74,10 @@ export default {
}
},
mounted() {
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
clickItem(param) {

View File

@ -176,7 +176,10 @@ export default {
mounted() {
this.init()
this.isEnableCompare()
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
init() {

View File

@ -173,7 +173,10 @@ export default {
mounted() {
this.init()
this.isEnableCompare()
bus.$on('reset-change-table', () => this.getItemTagType())
bus.$on('reset-change-table', this.getItemTagType)
},
beforeDestroy() {
bus.$off('reset-change-table', this.getItemTagType)
},
methods: {
init() {

View File

@ -99,9 +99,10 @@ export default {
this.init()
this.calcHeight()
//
eventBus.$on('resizing', (componentId) => {
this.chartResize()
})
eventBus.$on('resizing', this.chartResize)
},
beforeDestroy() {
eventBus.$off('resizing', this.chartResize)
},
methods: {
init() {

View File

@ -117,9 +117,10 @@ export default {
this.init()
this.calcHeight()
//
eventBus.$on('resizing', (componentId) => {
this.chartResize()
})
eventBus.$on('resizing', this.chartResize)
},
beforeDestroy() {
eventBus.$off('resizing', this.chartResize)
},
methods: {
init() {

View File

@ -251,9 +251,10 @@ export default {
},
mounted() {
this.init()
bus.$on('prop-change-data', () => {
this.initCustomColor()
})
bus.$on('prop-change-data', this.initCustomColor)
},
beforeDestroy() {
bus.$off('prop-change-data', this.initCustomColor)
},
methods: {
changeColorOption(modifyName = 'value') {

View File

@ -145,11 +145,10 @@ export default {
mounted() {
this.init()
//
eventBus.$on('resizing', (componentId) => {
this.chartResize()
})
eventBus.$on('resizing', this.chartResize)
},
beforeDestroy() {
eventBus.$off('resizing',this.chartResize)
clearInterval(this.scrollTimer)
},
methods: {

View File

@ -1334,6 +1334,16 @@ export default {
},
mounted() {
},
beforeDestroy() {
bus.$off('show-dimension-edit-filter', this.showDimensionEditFilter)
bus.$off('show-rename', this.showRename)
bus.$off('show-quota-edit-filter', this.showQuotaEditFilter)
bus.$off('show-quota-edit-compare', this.showQuotaEditCompare)
bus.$off('show-edit-filter', this.showEditFilter)
bus.$off('calc-data', this.calcData)
bus.$off('plugins-calc-style', this.calcStyle)
bus.$off('plugin-chart-click', this.chartClick)
},
activated() {
},

View File

@ -100,12 +100,7 @@ export default {
}
},
created() {
bus.$on('refresh-my-share-out', () => {
this.initOutData().then(res => {
this.outDatas = res.data
this.setMainNull()
})
})
bus.$on('refresh-my-share-out', this.refreshMyShareOut)
this.initData().then(res => {
this.datas = res.data
if (this.msgPanelIds && this.msgPanelIds.length > 0) {
@ -116,8 +111,16 @@ export default {
this.outDatas = res.data
})
},
beforeDestroy() {
bus.$off('refresh-my-share-out', this.refreshMyShareOut)
},
methods: {
refreshMyShareOut() {
this.initOutData().then(res => {
this.outDatas = res.data
this.setMainNull()
})
},
initData() {
const param = {}
return loadTree(param)

View File

@ -40,9 +40,10 @@ export default {
]),
created() {
this.initForm()
bus.$on('onThemeColorChange', () => {
this.initForm()
})
bus.$on('onThemeColorChange', this.initForm)
},
beforeDestroy() {
bus.$off('onThemeColorChange', this.initForm)
},
methods: {
initForm() {

View File

@ -71,9 +71,10 @@ export default {
},
created() {
this.initForm()
bus.$on('onThemeColorChange', () => {
this.initForm()
})
bus.$on('onThemeColorChange', this.initForm)
},
beforeDestroy() {
bus.$off('onThemeColorChange', this.initForm)
},
mounted() {
},

View File

@ -183,9 +183,10 @@ export default {
]),
created() {
this.initForm()
bus.$on('onThemeColorChange', () => {
this.initForm()
})
bus.$on('onThemeColorChange',this.initForm)
},
beforeDestroy() {
bus.$off('onThemeColorChange',this.initForm)
},
mounted() {
},

View File

@ -60,9 +60,10 @@ export default {
]),
created() {
this.initForm()
bus.$on('onThemeColorChange', () => {
this.initForm()
})
bus.$on('onThemeColorChange',this.initForm)
},
beforeDestroy() {
bus.$off('onThemeColorChange',this.initForm)
},
mounted() {
this.init()

View File

@ -75,20 +75,24 @@ export default {
watch: {},
mounted() {
bus.$on('onSubjectChange', () => {
this.collapseShow = false
this.$nextTick(() => {
this.init()
this.dataMerge()
this.collapseShow = true
})
})
bus.$on('onSubjectChange', this.onSubjectChange)
},
beforeDestroy() {
bus.$off('onSubjectChange', this.onSubjectChange)
},
created() {
this.init()
},
methods: {
onSubjectChange() {
this.collapseShow = false
this.$nextTick(() => {
this.init()
this.dataMerge()
this.collapseShow = true
})
},
sliderReload() {
this.sliderShow = false
this.$nextTick(() => {
@ -190,5 +194,4 @@ export default {
padding: 0!important;
}
</style>

View File

@ -610,25 +610,7 @@ export default {
this.init(this.$store.state.panel.panelInfo.id)
},
mounted() {
// this.insertToBody()
bus.$on('component-on-drag', () => {
this.show = false
})
bus.$on('component-dialog-edit', () => {
this.editDialog()
})
bus.$on('component-dialog-style', () => {
this.styleDialogVisible = true
})
bus.$on('previewFullScreenClose', () => {
this.previewVisible = false
})
bus.$on('change_panel_right_draw', (param) => {
this.changeRightDrawOpen(param)
})
this.initEvents()
const _this = this
const erd = elementResizeDetectorMaker()
// div
@ -640,10 +622,31 @@ export default {
this.loadMultiplexingViewTree()
},
beforeDestroy() {
bus.$off('component-on-drag', this.componentOnDrag)
bus.$off('component-dialog-edit', this.editDialog)
bus.$off('component-dialog-style', this.componentDialogStyle)
bus.$off('previewFullScreenClose', this.previewFullScreenClose)
bus.$off('change_panel_right_draw', this.changeRightDrawOpen)
const elx = this.$refs.rightPanel
elx && elx.remove()
},
methods: {
componentOnDrag() {
this.show = false
},
componentDialogStyle() {
this.styleDialogVisible = true
},
previewFullScreenClose() {
this.previewVisible = false
},
initEvents() {
bus.$on('component-on-drag', this.componentOnDrag)
bus.$on('component-dialog-edit', this.editDialog)
bus.$on('component-dialog-style', this.componentDialogStyle)
bus.$on('previewFullScreenClose', this.previewFullScreenClose)
bus.$on('change_panel_right_draw', this.changeRightDrawOpen)
},
loadMultiplexingViewTree() {
queryPanelMultiplexingViewTree().then(res => {
this.viewData = res.data

View File

@ -50,6 +50,9 @@ export default {
bus.$on('panle_start_list_refresh', this.refreshStarts)
this.initData()
},
beforeDestroy() {
bus.$off('panle_start_list_refresh', this.refreshStarts)
},
methods: {
showPanel(row) {
initPanelData(row.panelGroupId, function() {

View File

@ -366,11 +366,11 @@ export default {
this.ProhibitMultiple()
},
mounted() {
bus.$on('valid-values-change', valid => {
this.validateFilterValue(valid)
})
bus.$on('valid-values-change', this.validateFilterValue)
},
beforeDestroy() {
bus.$off('valid-values-change', this.validateFilterValue)
},
methods: {
treeNode(cache) {

View File

@ -45,14 +45,12 @@ export default {
// }
},
mounted() {
bus.$on('to-msg-share', params => {
this.toMsgShare(params)
})
bus.$on('PanelSwitchComponent', (c) => {
this.param = c.param
this.componentName = c.name
this.$store.dispatch('panel/setMainActiveName', c.name)
})
bus.$on('to-msg-share', this.toMsgShare)
bus.$on('PanelSwitchComponent', this.panelSwitchComponent)
},
beforeDestroy() {
bus.$off('to-msg-share', this.toMsgShare)
bus.$off('PanelSwitchComponent', this.panelSwitchComponent)
},
created() {
bus.$emit('PanelSwitchComponent', { name: 'PanelMain' })
@ -61,6 +59,11 @@ export default {
this.toMsgShare(routerParam)
},
methods: {
panelSwitchComponent(c) {
this.param = c.param
this.componentName = c.name
this.$store.dispatch('panel/setMainActiveName', c.name)
},
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
const panelShareTypeIds = [1, 2, 3]

View File

@ -232,15 +232,21 @@ export default {
}
},
mounted() {
bus.$on('set-panel-show-type', type => {
this.showType = type || 0
})
bus.$on('set-panel-share-user', userId => {
this.shareUserId = userId
})
bus.$on('set-panel-show-type', this.setPanelShowType)
bus.$on('set-panel-share-user', this.setPanelShareUser)
this.initPdfTemplate()
},
beforeDestroy() {
bus.$off('set-panel-show-type', this.setPanelShowType)
bus.$off('set-panel-share-user', this.setPanelShareUser)
},
methods: {
setPanelShowType(type) {
this.showType = type || 0
},
setPanelShareUser(userId) {
this.shareUserId = userId
},
initPdfTemplate() {
queryAll().then(res => {
this.pdfTemplateAll = res.data

View File

@ -23,9 +23,10 @@ export default {
}
},
mounted() {
bus.$on('to-msg-ds', params => {
this.toMsgDs(params)
})
bus.$on('to-msg-ds', this.toMsgDs)
},
beforeDestroy() {
bus.$off('to-msg-ds', this.toMsgDs)
},
created() {
this.$store.dispatch('app/toggleSideBarHide', true)

View File

@ -4,7 +4,7 @@
<el-row>
<el-tabs v-model="tabActive" @tab-click="changeTab">
<el-tab-pane :label="$t('dataset.task.list')" name="DatasetTaskList">
<dataset-task-list v-if="tabActive=='DatasetTaskList'" :param="task" :transCondition="transCondition" @jumpTaskRecord="jumpTaskRecord" />
<dataset-task-list v-if="tabActive=='DatasetTaskList'" :param="task" :trans-condition="transCondition" @jumpTaskRecord="jumpTaskRecord" />
</el-tab-pane>
<el-tab-pane :label="$t('dataset.task.record')" name="TaskRecord">
<task-record v-if="tabActive=='TaskRecord'" ref="task_record" :param="task" :trans-condition="transCondition" @jumpTask="jumpTask" />
@ -38,9 +38,10 @@ export default {
])
},
mounted() {
bus.$on('to-msg-dataset', params => {
this.toMsgShare(params)
})
bus.$on('to-msg-dataset', this.toMsgShare)
},
beforeDestroy() {
bus.$off('to-msg-dataset', this.toMsgShare)
},
created() {
this.$store.dispatch('app/toggleSideBarHide', false)