const Magix = require('magix') const View = require('dmp-new/view') Magix.applyStyle('@./treaty.less') module.exports = View.extend({ tmpl: '@treaty.html', init (options) { this.options = options }, render () { this.updater.digest({ isSign: this.options.isSign || false, treatyTitle: this.options.treatyTitle, treatyContent: this.options.treatyContent || '@./treaty-content', checked: false }) }, async 'confirm' (e) { if (!this.updater.get('checked')) { return } try { const models = [{ name: this.options.treatyApi }] await this.fetch(models) this.alert('提示', '恭喜,协议签订成功!', () => { this.options.dialog.close() if (this.options.enterCallback) { this.options.enterCallback() } else { window.location.reload() } }, { mask: true }) } catch (error) { this.alert('错误提示', error.msg, () => { }, { mask: true }) } }, 'cancel' (e) { if (this.options.cancelCallback) { this.options.cancelCallback() } else { window.location.href = '/login.html' } }, 'ensure' (e) { this.options.dialog.close() } })