import Magix from 'magix' import * as View from '../../../../view' Magix.applyStyle('@./funnel-analysis.less') export default View.extend({ tmpl: '@funnel-analysis.html', init (options) { this.options = options }, async render () { const colors = ['#CEB6FF', '#B69AF8', '#977FDA', '#7A65BE', '#5E4DA3'] const funnelData = await this.getFunnelData() this.updater.digest({ funnelData, colors }) }, async getFunnelData () { try { const { deliverType, crowdId } = this.options const params = { crowdId, deliverType } const models = [{ name: 'api_report_channel_funnel_get', params }] const [model] = await this.fetch(models) const data = model.get('data', {}) return data } catch (error) { this.alert('错误提示', error.msg || error.message || error, null, { mask: true }) } }, 'showTab' (e) { this.owner.parent().invoke('changeTab', [e.params]) }, 'showPlanAnalysis' (e) { this.owner.parent().invoke('showPlanAnalysis') }, 'expandCrowd' (e) { const viewPath = '@./expand-crowd' const dialogOptions = { width: 410, top: 100 } const viewOptions = { crowdId: this.options.crowdId } this.mxDialog(viewPath, viewOptions, dialogOptions) } })