| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- /**
- * 学校通知
- */
- Ext.define('school.view.interaction.notice.List', {
- extend: 'school.view.core.base.BasePanel',
- xtype: 'interaction-notice-list',
- dataUrl: 'http://10.1.80.180:9520/api/school/notice/list',
- // dataUrl: '/api/school/notice/list',
- _title: '学校通知',
- initComponent: function() {
- var me = this;
- Ext.apply(this, {
- searchField: [{
- xtype: 'textfield',
- name: 'keyword',
- fieldLabel:'关键字',
- getCondition: function (value) {
- return ' (notify_title like\'%' + value + '%\' or notify_details like \'%' + value + '%\') ';
- }
- }, {
- xtype: 'textfield',
- name: 'creator',
- fieldLabel: '发布人'
- }, {
- xtype: 'combobox',
- name: 'notify_status',
- fieldLabel: '发布状态',
- displayField: 'name',
- valueField: 'value',
- editable: true,
- store: Ext.create('Ext.data.ArrayStore', {
- fields: ['name', 'value'],
- data: [['已发布', 1], ['未发布', 2]]
- }),
- minChars: 0,
- queryMode: 'local'
- // }, {
- // xtype: 'condatefield',
- // name: 'publish_date',
- // fieldLabel: '发布时间',
- // columnWidth: 0.5
- }],
-
- gridConfig: {
- addTitle: '学校通知',
- addXtype: 'interaction-notice-schoolnotice',
- idField: 'notify_id',
- codeField: 'notify_title',
- detailField: 'notify_title',
- 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('interaction-notice-schoolnotice', '新增学校通知', 'interaction-notice-schoolnotice-add');
- }
- }, {
- xtype: 'button',
- text: '删除',
- handler: function() {
- let grid = this.up('grid'),
- selectedRecords = grid.getSelection();
- let data;
- data = selectedRecords.map(function(r) {
- return {
- id: r.get('notify_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/notice/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: 'notify_id',
- hidden: true
- }, {
- text: '标题',
- dataIndex: 'notify_title',
- width: 120,
- // tdCls: 'x-detail-column',
- // listeners: {
- // click: function(view, td, row, col, e, record, tr, eOpts, event) {
- // let gridConfig = me.gridConfig;
- // school.util.BaseUtil.openTab(gridConfig.addXtype, gridConfig.addTitle + '(' + record.get('notify_title') + ')', gridConfig.addXtype + record.get(gridConfig.idField), {
- // initId: record.get(gridConfig.idField)
- // });
- // }
- // }
- }, {
- text: '内容',
- dataIndex: 'notify_details',
- width: 300
- }, {
- text: '发布人',
- dataIndex: 'creator',
- width: 150
- }, {
- text: '发布状态',
- dataIndex: 'notify_status',
- width: 120,
- renderer: function(v) {
- return !!v ? (v == 2 ? '未发布' : '已发布') : '未发布'
- }
- }, {
- xtype: 'datecolumn',
- formate: 'Y-m-d H:i:s',
- text: '发布时间',
- dataIndex: 'publish_date',
- width: 120
- }]
- },
- });
- this.callParent(arguments);
- }
- });
|