/** * 学生信息 */ Ext.define('school.view.basic.student.StudentList', { extend: 'school.view.core.base.BasePanel', xtype: 'basic-student-studentlist', dataUrl: '/api/school/student/list', _title: '学生信息', caller: 'Student', pathKey: 'student', initComponent: function() { var me = this; Ext.apply(this, { searchField: [{ xtype: 'textfield', name: 'grade', fieldLabel: '年级' }, { xtype: 'textfield', name: 'class', fieldLabel: '班级' }, { xtype: 'textfield', name: 'code', fieldLabel:'学号' }, { xtype: 'textfield', name: 'name', fieldLabel: '姓名' }, { xtype: 'textfield', name: 'parent', fieldLabel: '家长' }], gridConfig: { addTitle: '学生信息', addXtype: 'basic-student-studentdetail', idField: 'stu_id', codeField: '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: '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: '一键开通' }, { xtype: 'button', text: '添加', handler: function() { school.util.BaseUtil.openTab('basic-student-studentdetail', '新增学生信息', 'basic-student-studentdetail-add'); } }, { xtype: 'button', text: '删除' }], 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: 'grade' }, { text: '班级', dataIndex: 'class' }, { text: '出生日期', dataIndex: 'stu_birthday', width: 120, xtype: 'datecolumn', format: 'Y-m-d' }, { text: '年龄', dataIndex: 'stu_age' }, { text: '入学日期', dataIndex: 'stu_enroll_date', xtype: 'datecolumn', format: 'Y-m-d' }, { text: '毕业日期', dataIndex: 'stu_graduate_date', xtype: 'datecolumn', format: 'Y-m-d' }, { text: '状态', dataIndex: 'stu_status' }] }, }); this.callParent(arguments); }, /** * 处理部分字段值 */ getConditionValue: function (field, value) { var me = this, xtypes = field.getXTypes().split('/'), conditionValue; if (me.isContainsAny(xtypes, ['datefield'])) { conditionValue = Ext.Date.format(new Date(from), 'Y-m-d H:i:s'); } else if (me.isContainsAny(xtypes, ['conmonthfield'])) { var from = value.from, to = value.to; conditionValue = from + ',' + to; } else if (me.isContainsAny(xtypes, ['condatefield'])) { var from = value.from, to = value.to; conditionValue = Ext.Date.format(new Date(from), 'Y-m-d 00:00:00') + ',' + Ext.Date.format(new Date(to), 'Y-m-d 23:59:59'); } else if (me.isContainsAny(xtypes, ['dbfindtrigger'])) { conditionValue = value; } else if (me.isContainsAny(xtypes, ['combobox', 'combo'])) { conditionValue = value; } else if (me.isContainsAny(xtypes, ['multicombo'])) { conditionValue = value.map ? value.map(function (v) { return v.value; }).join(',') : ''; } else { conditionValue = value; } return conditionValue; }, getExtraParams: function(store, op, condition) { var temp = {}; for(let x = 0; x < condition.length; x++) { let c = condition[x]; if(c.field == 'keyword') { temp.keyword = c.value; }else if(c.field == 'date') { temp.fromDate = new Date(c.value.split(',')[0]).getTime(); temp.endDate = new Date(c.value.split(',')[1]).getTime(); }else if(c.field == 'quoted') { temp.quoted = c.value == 'all' ? null : c.value; }else if(c.field == 'closed') { // temp.endDate = c.value == 'all' ? null : ( // c.value == '0' ? // ); } } let obj = { pageNumber: store.exportNumber?store.exportNumber:op._page, pageSize: store.exportPageSize?store.exportPageSize:store.pageSize }; for(let k in temp) { if(!!temp[k]) { obj[k] = temp[k]; } } return obj; }, });