| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- Ext.define('school.view.basic.class.ClassDetailController', {
- extend: 'school.view.core.form.FormPanelController',
- alias: 'controller.classdetail',
- onAfterSave: function(localJson) {
- let me = this;
- me.refresh(localJson.data.id);
- },
- refresh: function(id) {
- let me = this,
- view = me.getView();
- school.util.BaseUtil.request({
- url: view._readUrl + '/' + id
- }).then(function(res) {
- view.setLoading(false);
- if(res.success) {
- let d = res.data;
- let o = {
- main: d.main
- };
- if(d.hasOwnProperty('items')) {
- o.detail0 = d.items;
- }else {
- let idx = 1;
- while(d.hasOwnProperty('items' + idx)) {
- o['detail' + (idx - 1)] = d['items' + idx];
- idx++;
- }
- }
- view.initFormData(o);
- view.fireEvent('load', classDetail, o);
- }
- }).catch(function(e) {
- school.util.BaseUtil.showErrorToast('请求数据失败: ' + e.message);
- });
- }
- });
|