| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- /**
- * 教职工信息
- */
- Ext.define('school.view.basic.staff.StaffList', {
- extend: 'school.view.core.base.BasePanel',
- xtype: 'basic-staff-stafflist',
- dataUrl: '/api/school/teacher/list',
- _title: '教职工信息导入',
- caller: 'Teacher',
- pathKey: 'teacher',
- initComponent: function () {
- var me = this;
- Ext.apply(this, {
- searchField: [{
- xtype: 'textfield',
- name: 'teacher_number',
- fieldLabel: '教职工号'
- }, {
- xtype: 'textfield',
- name: 'teacher_name',
- fieldLabel: '姓名'
- }],
- gridConfig: {
- addTitle: '教职工信息',
- addXtype: 'basic-staff-staffdetail',
- idField: 'teacher_id',
- codeField: 'teacher_number',
- detailField: 'teacher_number',
- dataUrl: me.dataUrl,
- 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-staff-staffdetail', '新增教职工信息', 'basic-staff-staffdetail-add');
- }
- }, {
- xtype: 'importbutton',
- text: '导入',
- 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('teacher_id')
- };
- });
- if (data.length == 0) {
- school.util.BaseUtil.showErrorToast('请先勾选需要删除的记录');
- return;
- }
- grid.setLoading(true);
- school.util.BaseUtil.request({
- // url: 'http://10.1.80.47:9560/teacher/batchDelete',
- url: '/api/school/teacher/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: 'teacher_id',
- hidden: true
- }, {
- text: '工号',
- dataIndex: 'teacher_number',
- width: 150
- }, {
- text: '姓名',
- dataIndex: 'teacher_name',
- width: 120
- }, {
- text: '手机号',
- dataIndex: 'phone',
- width: 120
- }, {
- text: '性别',
- dataIndex: 'teacher_sex',
- renderer: function (v, m, r) {
- return v == 1 ? '男' : (v == 0 ? '女' : '未知');
- }
- }, {
- text: '民族',
- dataIndex: 'teacher_nation'
- }, {
- text: '学历',
- dataIndex: 'teacher_education'
- }, {
- text: '专业',
- dataIndex: 'teacher_major'
- }]
- },
- });
- 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;
- },
- });
|