import Magix from 'magix' import * as View from '../../../view' Magix.applyStyle('@./create-options.less') export default View.extend({ tmpl: '@create-options.html', init (options) { this.options = options }, render () { const { selectedList } = this.options this.updater.digest({ selectedList }) }, async 'confirm' (e) { if (!this.isValid()) { return } const { folderName } = this.updater.get() const { tagId, optionGroupId, selectedList } = this.options const optionList = selectedList.map(item => { return { optionName: item.optionName, optionValue: item.optionValue, properties: item.properties } }) const params = { folderName, tagId, optionGroupId, optionList } try { const models = [{ name: 'api_tag_option_pack_post', params, isJson: true }] await this.fetch(models) this.alert('提示', '恭喜,选项夹创建成功!', () => { this.options.dialog.close() }) } catch (error) { this.alert('错误提示', error.msg || error.message || error, null, { mask: true }) } }, 'cancel' (e) { this.options.dialog.close() } })