面向对象编程

 

Ext.namespace("XXX.train");

 

XXX.train.commentShowWin = function(config)

{

    Ext.apply(this, config);

 

    // 数据源

    this.store = new Ext.data.Store

    (

        {

            url : '../trainComment/get_unfinish_detail?train='+this.uid,

            waitMsg : 'Loading',

            reader : new Ext.data.JsonReader

            (

                {

                    root : 'items',

                    id : 'id',

                    totalProperty : "totalCount",

                    fields :

                    [

                        'id',

                        'train_name',

                        'employee_name',

                        'status_name'

                    ]

                }

            )

        }

    );

    this.store.load();

    this.cm = new Ext.grid.ColumnModel

    (

        [

            {header: "培训标题", width: 50, sortable: true, dataIndex: 'train_name'},

            {header: "参训人员", width: 50, sortable: true, dataIndex: 'employee_name'},

            {header: "反馈状态", width: 25, sortable: true, dataIndex: 'status_name'}

        ]

    );

    this.grid = new Ext.grid.GridPanel

    (

        {

            id         : Ext.id(),

            margins    : '2 2 2 2',  //为了不要与容器的边框重叠,设定2px的间距。

            loadMask   : true,

            store      : this.store,

            cm         : this.cm,

            plugins    : [new Ext.ux.plugins.FitToParent()],

            stripeRows : true,

            width      : '100%',

            header     : false,

            layout     : "fit",

            frame      : false,

            border     : false,

            viewConfig : {forceFit: true}

        }

    );

    this.form = new XXX.common.baseForm

    (

        {

            id          : this.form_id,

            height      : 400,

            width       : 800,

            items       : [this.grid]

        }

    );

 

    // 初始构造函数

    XXX.train.commentShowWin.superclass.constructor.call

    (

        this,

        {

            items : [this.form]

        }

    );

};

 

// 继承

Ext.extend

(

    XXX.train.commentShowWin,

    Ext.Window,

    {

        width : 800

    }

);

 

 

Ext.namespace("XXX.train");

 

XXX.train.totalShowWin = function(config)

{

    Ext.apply(this, config);

 

    // 讲师评估图表

    this.lector_store_conn = new Ext.data.Connection

    ({

        timeout : 1200000,

        url : '../trainComment/get_lector_avg',

        method : 'POST'

    });

    this.lector_store  = new Ext.data.Store

    (

        {

            proxy : new Ext.data.HttpProxy(this.lector_store_conn),

            waitMsg : 'loading',

            reader  : new Ext.data.JsonReader

            (

                {

                    root    : 'items',

                    fields  : ['type', 'count']

                }

            )

        }

    );

    this.lector_store.baseParams =

    {

        id : this.uid

    };

    this.lector_store.load();

    this.lector_panel = new Ext.Panel

    (

        {

            title : '讲师评估',

            width : 700,

            height : 200,

            frame : true,

            items   :

            {

                store           : this.lector_store,

                xtype           : 'columnchart',

                yField          : 'count',

                xField          : 'type',

                xAxis           : new Ext.chart.CategoryAxis

                (

                    {

                        title   : ''

                    }

                ),

                yAxis           : new Ext.chart.NumericAxis

                (

                    {

                        title   : ''

                    }

                ),

                extraStyle      :

                {

                   xAxis    :

                   {

                        labelRotation           : 0 // 字体倾斜度

                   }

                }

            }

        }

    );

 

    // 课程评估图表

    this.content_store_conn = new Ext.data.Connection

    ({

        timeout : 1200000,

        url : '../trainComment/get_content_avg',

        method : 'POST'

    });

    this.content_store  = new Ext.data.Store

    (

        {

            proxy : new Ext.data.HttpProxy(this.content_store_conn),

            waitMsg : 'loading',

            reader  : new Ext.data.JsonReader

            (

                {

                    root    : 'items',

                    fields  : ['type', 'count']

                }

            )

        }

    );

    this.content_store.baseParams =

    {

        id : this.uid

    };

    this.content_store.load();

    this.content_panel = new Ext.Panel

    (

        {

            title : '课程评估',

            width : 700,

            height : 200,

            frame : true,

            items   :

            {

                store           : this.content_store,

                xtype           : 'columnchart',

                yField          : 'count',

                xField          : 'type',

                xAxis           : new Ext.chart.CategoryAxis

                (

                    {

                        title   : ''

                    }

                ),

                yAxis           : new Ext.chart.NumericAxis

                (

                    {

                        title   : ''

                    }

                ),

                extraStyle      :

                {

                   xAxis    :

                   {

                        labelRotation           : 0 // 字体倾斜度

                   }

                }

            }

        }

    );

 

    // 总体平均分

    this.score = new XXX.common.DisplayField

    ({

        id : Ext.id(),

        labelStyle : 'width:250px;',

        fieldLabel : '本次培训的总体评价平均分(满分10分)'

    });

    Ext.Ajax.request

    ({

        url: '../trainComment/get_score_avg',

        success: function(response, options)

        {

            var result = Ext.util.JSON.decode(response.responseText);

            this.score.setValue(result.score);

 

        },

        failure: function(response, options)

        {

            this.score.setValue(0);    

        },

        scope : this,

        params: { id : this.uid }

    });

 

    this.train_result = new Ext.form.TextArea

    ({

        xtype       : 'textarea',

        anchor      : '95%',

        id          : Ext.id(),

        name        : 'train_result',

        grow        : true,

        growMax     : 150,

        growMin     : 50,

        fieldLabel  : '培训收获'

    });

    Ext.Ajax.request

    ({

        url: '../trainComment/get_train_result',

        success: function(response, options)

        {

            var result = Ext.util.JSON.decode(response.responseText);

            this.train_result.setValue(result.train_result);

        },

        failure: function(response, options)

        {

            this.train_result.setValue(0);

        },

        scope : this,

        params: { id : this.uid }

    });

 

    this.train_question = new Ext.form.TextArea

    ({

        xtype       : 'textarea',

        anchor      : '95%',

        id          : Ext.id(),

        name        : 'train_question',

        grow        : true,

        growMax     : 150,

        growMin     : 50,

        fieldLabel  : '学员的问题与建议'

    });

    Ext.Ajax.request

    ({

        url: '../trainComment/get_train_question',

        success: function(response, options)

        {

            var result = Ext.util.JSON.decode(response.responseText);

            this.train_question.setValue(result.train_question);

        },

        failure: function(response, options)

        {

            this.train_question.setValue(0);

        },

        scope : this,

        params: { id : this.uid }

    });

 

    this.form = new XXX.common.baseForm

    (

        {

            id          : this.form_id,

            labelWidth : 200,  

            items       :

            [

                this.lector_panel,

                this.content_panel,

                this.score,

                this.train_result,

                this.train_question,

            ],

            buttons:

            [

                {

                    xtype   : 'submitbtn',

                    text: '提交',

                    handler: function()

                    {

                        if(this.form.getForm().isValid())

                        {

                            this.form.getForm().submit

                            (

                                {

                                    url : '../trainComment/train_comment',

                                    waitTitle : "消息提示",

                                    waitMsg : '保存数据......',

                                    scope:this,

                                    success : function(temp_form,action)

                                    {

                                        parent.set_text(action.result.msg,action.result.status);

                                        if(action.result.status == 10010)

                                        {

                                            grid.getStore().reload();

                                            this.close();

                                        }

                                    },

                                    failure : function()

                                    {

                                        parent.set_failure_text();

                                    }

                                }

                            );

                        }

                    },

                    scope : this

                },

                {

                    xtype : 'cancelbtn',

                    text : '取消',

                    handler : function()

                    {

                        this.close();

                    },

                    scope : this

                }

            ]

        }

    );

 

    XXX.train.totalShowWin.superclass.constructor.call

    (

        this,

        {

            items : [this.form]

        }

    );

};

 

// 继承

Ext.extend

(

    XXX.train.totalShowWin,

    Ext.Window,

    {

        maximized : false,

        maximizable : true, 

        width : 800

    }

);

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值