import Magix from 'magix' import View from '../../../view' Magix.applyStyle('@./edit.less') export default View.extend({ tmpl: '@edit.html', init (options) { this.options = options }, render () { const { template } = this.options const { description, mark, highlight, usageIndex = 5, id, name } = template const params = { description, mark, highlight, usageIndex, id, name } this.updater.digest({ params }) }, async 'confirm' (e) { this.updater.digest({ loading: true }) try { const { params } = this.updater.get() const models = [{ name: 'api_operation_new_template_edit_put', isJson: true, params }] await this.fetch(models) this._alert('提示', '恭喜,修改模板成功!', () => { this.options.dialog.close() this.options.callback() }) // const data = model.get('data', {}) // return data } catch (error) { this.alert('错误提示', error.msg || error.message || error) } this.updater.digest({ loading: false }) }, 'cancel' (e) { this.options.dialog.close() } })