define(['jquery', 'bootstrap', 'backend', 'form'], function ($, undefined, Backend, Form) { var Controller = { index: function () { new Vue({ el: '#splitRuleIndex', data: { listData: [], loading: false }, mounted() { this.getList(); }, methods: { getList() { this.loading = true; Fast.api.ajax({ url: 'shopro/split/rule/index', type: 'GET', data: { limit: 100 } }, (ret, res) => { this.listData = (res.data && res.data.rows) || []; this.loading = false; return false; }, () => { this.loading = false; }); }, openEdit(id) { Backend.api.open('shopro/split/rule/edit/ids/' + id, '编辑规则', { callback: () => this.getList() }); }, roleTypeText(type) { const map = { platform: '平台', promoter: '推广员', regional_agent: '区域公司', }; return map[type] || type; } } }); }, edit: function () { Form.api.bindevent($('form[role=form]')); } }; return Controller; });