juyuyujava21 2017-03-09 06:30 采纳率: 0%
浏览 841

ext中如何把用户,产品,代理商, 调到另一行

var ttoolbarItems = [ {
xtype : 'textfield',
id : 'serialNum',
fieldLabel : '序列号',
labelWidth : 60,
width : '20%'
},

               {
                xtype: 'datefield',
                id : 'createTime',
                fieldLabel : '入库开始时间',

// labelWidth : 60,
// width : '20%'

            },{
                xtype: 'datefield',
                id : 'releaseTime',
                fieldLabel : '入库结束时间',

// lableWidth : 60,
// width : '20%'

            }, 
            userSelector, 
             agentSelector, 
             productSelector,

            {
                xtype : 'button',
                text : '查询',
                iconCls : 'x-fa fa-search',
                width : 70,
                handler : function(btn, eventObj) {
                    var searchParams = {
                        serialNum : Ext.getCmp('serialNum').getValue(),
                        createTime : Ext.getCmp('createTime').getValue(),
                        releaseTime : Ext.getCmp('releaseTime').getValue(),
                        normalUserId: Ext.getCmp('user_id').getValue(),
                        agentId: Ext.getCmp('agent_id').getValue(),
                        productId: Ext.getCmp('product_id').getValue(),


                    };
                    Ext.apply(store.proxy.extraParams, searchParams);
                    store.loadPage(1);
                }
            }, {
                xtype : 'button',
                text : '重置',
                iconCls : 'x-fa fa-undo',
                width : 70,
                handler : function(btn, eventObj) {
                    Ext.getCmp('serialNum').setValue(null);
                    Ext.getCmp('createTime').setValue(null);
                    Ext.getCmp('releaseTime').setValue(null);
                    Ext.getCmp('user_id').setValue(null);
                    Ext.getCmp('agent_id').setValue(null);
                    Ext.getCmp('product_id').setValue(null);

                    store.proxy.extraParams = {};
                    store.reload();
                }
            }, {
                xtype: 'button',
                text: '出库撤销',
                handler: function(){
                    var result = getInventorySelection(me);
                    if(result == null){
                        Ext.Msg.alert('错误提示', '请选择终端!');
                        return;
                    }

                    var window = Ext.create('Forestry.app.inventory.CancelAssignmentWindow', {
                        selected_ids: result['selected_ids']
                    });
                    var form = window.down('form').getForm();
                    var params = {
                        'serialNum': result['serialNumStr']
                    };

                    form.setValues(params);
                    window.show();
                }
            }, {
                xtype : 'button',
                text : '删除',
                iconCls : 'x-fa fa-remove',
                width : 70,
                handler : function(btn, eventObj) {
                    var grid = Ext.getCmp("inventory-grid");
                    if (grid.getSelectionModel().getSelection().length > 0) {
                        var id = grid.getSelectionModel().getSelection()[0].get('id');
                        globalObject.confirmTip('删除的记录不可恢复,继续吗?', function(btn) {
                            if (btn == 'yes') {
                                grid.getEl().mask("数据删除中,请稍候...");
                                Ext.Ajax.request({
                                    url : appBaseUri + '/sys/inventory/deleteInventory',
                                    params : {
                                        id : id
                                    },
                                    method : "POST",
                                    success : function(response) {
                                        if (response.responseText != '') {
                                            var res = Ext.JSON.decode(response.responseText);
                                            if (res.success) {
                                                globalObject.msgTip('操作成功');
                                                grid.getStore().reload();
                                            } else {
                                                Ext.Msg.alert('错误提示', res.message);
                                            }
                                        }
                                        grid.getEl().unmask();
                                    },
                                    failure : function(response) {
                                        grid.getEl().unmask();
                                        Ext.Msg.alert('错误提示', '操作失败!');
                                    }
                                });
                            }
                        });
                    }else {
                        Ext.Msg.alert('提示', '请选择一条宝贝记录');
                    }
                }
            }];
            if(globalObject.haveActionMenu(me.cButtons, 'ReceiveInventory')){
                ttoolbarItems.splice(3, 0, receiveInventoryBtn);
            }
            if(globalObject.haveActionMenu(me.cButtons, 'DistributeInventory')){
                ttoolbarItems.splice(3, 0, distributeInventoryBtn);
            }
            var ttoolbar = Ext.create('Ext.toolbar.Toolbar', {
                items : ttoolbarItems
            });


            Ext.apply(this, {
                store : store,
                tbar : ttoolbar,
                bbar : Ext.create('Ext.PagingToolbar', {
                    store : store,
                    displayInfo : true
                }),
                columns : columns,
                selModel: Ext.create('Ext.selection.CheckboxModel')
            });

            store.loadPage(1);

            this.callParent(arguments);
        }
    });
}else{
    Ext.define('Forestry.app.inventory.InventoryList', {
        extend: 'Ext.grid.Grid',
        height: '100%',
        requires: [
            'Ext.grid.plugin.Editable',
            'Ext.grid.plugin.ViewOptions',
            'Ext.grid.plugin.PagingToolbar',
            'Ext.grid.plugin.SummaryRow',
            'Ext.grid.plugin.ColumnResizing',
            'Ext.grid.plugin.MultiSelection',
            'Ext.grid.plugin.RowExpander'
        ],
        store: store,
        shadow: true,
        rowLines: true,
        itemConfig:{
            body:{
                tpl:'<div style="color:#aaa;">代理商:{agentRealName}<br/>用户:{userRealName}<br/>入库时间:{createTime:date("Y-m-d H:i:s")}<br/>出库时间:{releaseTime:date("Y-m-d H:i:s")}</div>'
            }
        },
        columns: [
            {
                text: '序列号',
                dataIndex: 'serialNum',
                width: window.innerWidth*0.6
            },
            {
                text: '产品',
                dataIndex: 'productTitle',
                width: window.innerWidth*0.4
            }
        ],
        plugins: [{
            type: 'grideditable'
        }, {
            type: 'gridviewoptions'
        }, {
            type: 'pagingtoolbar'
        }, {
            type: 'summaryrow'
        }, {
            type: 'columnresizing'
        }, {
            type: 'rowexpander'
        }]
    });
}

})();

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2017-03-09 23:40
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题