| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- /**
- * 学生信息
- */
- Ext.define('school.view.basic.student.StudentList', {
- extend: 'school.view.core.base.BasePanel',
- xtype: 'basic-student-studentlist',
- dataUrl: '/api/school/student/list',
- // dataUrl: 'http:/api/school/student/list',
- _title: '学生信息',
- caller: 'Student',
- pathKey: 'student',
- initComponent: function() {
- var me = this;
- Ext.apply(this, {
- searchField: [{
- xtype: 'gradecombo',
- name: 'stu_grade',
- fieldLabel: '年级',
- listeners: {
- select: function (combo, record, eOpts) {
- combo.up('form').getForm().findField('stu_class').setValue(null);
- }
- }
- }, {
- xtype: 'classcombo',
- name: 'stu_class',
- fieldLabel: '班级',
- listeners: {
- expand: function (combo, eOpts) {
- combo.store.clearFilter();
- var gradeCombo = combo.up('form').getForm().findField('stu_grade');
- var gradeName = gradeCombo.getValue();
- var filter = new Ext.util.Filter({
- property: 'clazz_grade',
- value: gradeName
- });
- if (!!gradeName) {
- combo.store.setFilters([filter]);
- }
- },
- select: function (combo, record, eOpts) {
- combo.up('form').getForm().findField('stu_grade').setValue(record.get('clazz_grade'));
- }
- }
- }, {
- xtype: 'textfield',
- name: 'stu_number',
- fieldLabel:'学号'
- }, {
- xtype: 'textfield',
- name: 'stu_name',
- fieldLabel: '姓名'
- }, {
- xtype: 'condatefield',
- name: 'stu_enroll_date',
- fieldLabel: '入学日期',
- columnWidth: 0.5
- }],
-
- gridConfig: {
- addTitle: '学生信息',
- addXtype: 'basic-student-studentdetail',
- idField: 'stu_id',
- codeField: 'stu_number',
- detailField: 'stu_number',
- dataUrl: me.dataUrl,
- caller: null,
- rootProperty: 'data.list',
- totalProperty: 'data.total',
- actionColumn: [],
- selModel: {
- checkOnly:true,
- type:'checkboxmodel',
- mode : "MULTI" ,
- ignoreRightMouseSelection : false
- },
- hiddenTools: false,
- toolBtns: [{
- xtype: 'button',
- text: '新增',
- handler: function() {
- school.util.BaseUtil.openTab('basic-student-studentdetail', '新增学生信息', 'basic-student-studentdetail-add');
- }
- }, {
- xtype: 'importbutton',
- belong: me,
- caller: me.caller,
- pathKey: me.pathKey,
- onSuccess: function() {
- //刷新界面
- var g = me.down('grid');
- g.store.loadPage(g.store.currentPage);
- }
- }, {
- xtype: 'button',
- text: '删除',
- handler: function() {
- let grid = this.up('grid'),
- selectedRecords = grid.getSelection();
- let data;
- data = selectedRecords.map(function(r) {
- return {
- id: r.get('stu_id')
- };
- });
- if(data.length == 0) {
- school.util.BaseUtil.showErrorToast('请先勾选需要删除的记录');
- return;
- }
- grid.setLoading(true);
- school.util.BaseUtil.request({
- // url: 'http://10.1.80.47:9560/student/batchDelete',
- url: '/api/school/student/batchDelete',
- method: 'POST',
- params: JSON.stringify({
- baseDTOs: data
- })
- }).then(function(res) {
- grid.setLoading(false);
- school.util.BaseUtil.showSuccessToast('成功删除' + data.length + '条记录');
- grid.store.loadPage(grid.store.currentPage);
- }).catch(function(e) {
- grid.setLoading(false);
- school.util.BaseUtil.showErrorToast('删除失败: ' + e.message);
- });
- }
- }],
- columns : [{
- text: 'id',
- dataIndex: 'stu_id',
- hidden: true
- }, {
- text: '学号',
- dataIndex: 'stu_number',
- width: 150
- }, {
- text: '姓名',
- dataIndex: 'stu_name',
- width: 120
- }, {
- text: '性别',
- dataIndex: 'stu_sex',
- width: 120,
- renderer: function(v, m, r) {
- return v == 1 ? '男' : (v == 0 ? '女' : '未知');
- }
- }, {
- text: '年级',
- dataIndex: 'stu_grade',
- editor: {
- xtype: 'combobox',
- displayField: 'name',
- valueField: 'value',
- store: {
- type: 'store_grade'
- },
- queryMode: 'local'
- },
- }, {
- text: '班级',
- dataIndex: 'stu_class'
- }, {
- text: '入学日期',
- dataIndex: 'stu_enroll_date',
- xtype: 'datecolumn',
- format: 'Y-m-d'
- }, {
- text: '出生日期',
- dataIndex: 'stu_birthday',
- width: 120,
- xtype: 'datecolumn',
- format: 'Y-m-d'
- }]
- },
- });
- this.callParent(arguments);
- },
- refresh: function() {
- Ext.StoreMgr.get('store_grade').load();
- Ext.StoreMgr.get('store_class').load();
- this.items.items[0].store.load();
- }
- });
|