2017-07-05 23:41:34 +08:00

58 lines
1.4 KiB
JavaScript

import Ember from 'ember';
import BaseListRoute from './../base-list';
const cols = ['showId',
'showName',
'showYear',
'showYtdSale',
'showCountryCode',
'showState',
'showCity',
'showMs',
'showRegion',
'showSalesperson',
'showStatus',
];
const config = {
showAll: true,
showAllChanged: Ember.observer('showAll', function() {
let me = this;
if (!me.get('lock')) {
let val = me.get('showAll');
cols.forEach(col => {
me.set(col, val);
});
}
}),
colChanged: Ember.observer(...cols.concat(function() {
let me = this;
me.set('lock', true);
me.set('showAll',
cols.map(col => {
return me[col];
}).reduce((val, prevVal) => {
return val && prevVal;
}, true));
me.set('lock', false);
}))
};
cols.forEach((col) => {
config[col] = true;
});
const TableOptions = Ember.Object.extend(config);
export default BaseListRoute.extend({
breadcrumbs: [{text: '客户列表'}],
actions: {
sort(col) {
Ember.Logger.info('sort: ', col);
}
},
setupController(controller) {
let me = this;
me._super(...arguments);
controller.set('tableOptions', TableOptions.create());
},
});