/** * 教职工信息 */ Ext.define('school.view.basic.staff.StaffList', { extend: 'school.view.core.base.BasePanel', xtype: 'basic-staff-stafflist', dataUrl: '/teacher/list', initComponent: function() { var me = this; Ext.apply(this, { searchField: [{ xtype: 'textfield', name: 'code', fieldLabel:'教职工号' }, { xtype: 'textfield', name: 'name', fieldLabel: '姓名' }, { xtype: 'textfield', name: 'job', fieldLabel: '职位' }], caller: null, _formXtype: null, _title: null, _deleteUrl: null, _batchOpenUrl: null, _batchCloseUrl: null, _batchDeleteUrl: null, gridConfig: { idField: null, codeField: null, statusCodeField: null, 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: me.onImport, }, { xtype: 'button', text: '一键开通' }, { xtype: 'button', text: '下载模板' }, { xtype: 'button', text: '批量导入' }, { xtype: 'button', text: '删除' }, { xtype: 'button', text: '新增' }], columns : [{ text: '工号', dataIndex: 'code', width: 150 }, { text: '绑定手机号', dataIndex: 'phone', width: 120 }, { text: '姓名', dataIndex: 'name', width: 120 }, { text: '职位', dataIndex: 'job', width: 120 }, { text: '是否开通', dataIndex: 'open' }, { text: '状态', dataIndex: 'status' }], listeners: { itemclick: function(view, record, item, index, e, eOpts) { school.util.BaseUtil.openTab('basic-staff-staffdetail', '教职工信息', 'basic-staff-staffdetail'+record.get('id'), { initId: record.get('id') }); } } }, }); this.callParent(arguments); }, onImport:function(){ var grid = this.ownerCt.ownerCt; var form = grid.ownerCt,panelEl = form.getEl(); var box = panelEl.getBox(); var height = box.height; var width = box.width; var win = form.add(Ext.create('school.view.core.base.ImportWindow', { cls:'x-window-dbfind', belong:form, modal:true, height: height * 0.8, width: width * 0.8, title: form._title + '导入', scrollable: true, bodyPadding: 10, constrain: true, closable: true, layout:'fit', renderTo:form.getEl() })); win.show(); }, /** * 处理部分字段值 */ 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; }, });