`
yjshengshe
  • 浏览: 201869 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

ext草稿

阅读更多

Ext.onReady(function() {
    Ext.BLANK_IMAGE_URL = '../ext/resources/images/default/s.gif';
    Ext.QuickTips.init();// 初始化tip
    var orderInfoForm;// 工单表单
    var appointmentTime;// 预约时间

    var MeterWinForSelect;
    var selectMeterWin;
    var winss;
    var meterWinForEdit;
    var meterEditWin;
    var selectWin;// 新户开通查询客户信息窗体
    var w = window.screen.width;// 屏幕分辨率宽度
    var h = window.screen.height;// 屏幕分辨率高度
    /* 获得一些用来显示控件的容器 */
    var firstInit = Ext.get("first");
    var secondInit = Ext.get("second");
    var firstInit1 = Ext.get("first1");
    var secondInit1 = Ext.get("second1");
   
    var sky_i = 1; //任务流程判断参数

    // 获取URL参数的函数
    function GetRequest() {
        var url = location.search; // 获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }
    // 声明获取参数的变量
    var Request = {};
    Request = GetRequest();

    // 上传组件窗体 2010 0119 wl
    var dialog = new Ext.ux.UploadDialog.Dialog({
                modal : true,
                closable : true,
                draggable : true,
                minWidth : 400,
                minHeight : 200,
                width : 600,
                height : 400,
                constraintoviewport : true,
                // permitted_extensions:['JPG','jpg','jpeg','JPEG','GIF','gif','pdf','txt'],
                resizable : false,
                title : '文件上传',
                url : './projectManage!uploadFileAndSave.action',
                reset_on_hide : false,
                allow_close_on_upload : true,
                listeners : {
                    'beforefileuploadstart' : function(d, f, r) {
                        // 上传的文件名
                        var url = encodeURI(f.substring(f.lastIndexOf('\\') + 1));
                        Ext.apply(this.base_params,{
                                    myUrl : url,
                                    orderId : mainPanel.form.findField('orderId').getValue()
                                });
                    }
                }
            });
    /* 上层主工单部分FormPanel */
    var mainPanel = new Ext.FormPanel({
        id : 'mainform',
        frame : true,
        labelWidth : 80,
        height : 200,
        labelAlign : 'right',
        bodyStyle : 'padding:0 10px 0;',
        autoScroll : true,
        buttonAlign : 'center',
        reader : new Ext.data.JsonReader({// 表格数据Reader
            root : 'JsonObjs',
            successProperty : 'success'
        },        // 指定是否成功加载数据标识属性
        ['orderId', 'contactPhone', 'dateCalled', 'applicant', 'type',
                'projectName', 'customerName', 'contactPhone', 'address',
                'purpose', 'consumptionYear', 'houseCount', 'detail']),
        tbar : [{
                    text : '添加',
                    iconCls : 'add',
                    id : 'add',
                    handler : function() {
                        mainPanel.form.reset();// 重置表单
                        Ext.getCmp('save').setDisabled(false);
                        // 启用表单
                        var tf = Ext.getCmp('mainform').findByType('textfield');
                        var nf = Ext.getCmp('mainform')
                                .findByType('numberfield');
                        var df = Ext.getCmp('mainform').findByType('datefield');
                        var taf = Ext.getCmp('mainform').findByType('textarea');
                        var com = Ext.getCmp('mainform').findByType('combo');
                        var arr = tf.concat(nf, df, taf, com); // 合并数组
                        for (var i = 0; i < arr.length; i++) {
                            arr[i].setDisabled(false); // 设置文本框
                            if (arr[i].name = 'orderId') {
                                continue;
                            }
                        }
                    }
                }, {
                    text : '修改',
                    iconCls : 'edit',
                    id : 'edit',
                    handler : function() {
                        Ext.getCmp('save').setDisabled(false);
                        // 启用表单
                        var tf = Ext.getCmp('mainform').findByType('textfield');
                        var nf = Ext.getCmp('mainform')
                                .findByType('numberfield');
                        var df = Ext.getCmp('mainform').findByType('datefield');
                        var taf = Ext.getCmp('mainform').findByType('textarea');
                        var com = Ext.getCmp('mainform').findByType('combo');
                        var arr = tf.concat(nf, df, taf, com); // 合并数组
                        for (var i = 0; i < arr.length; i++) {
                            arr[i].setDisabled(false); // 设置文本框
                            if (arr[i].name = 'orderId') {
                                continue;
                            }
                        }
                    }
                }, {
                    text : '保存',
                    iconCls : 'save', // 背景的样式
                    id : 'save',
                    disabled : true,
                    handler : function(form, action) {
                        if (mainPanel.form.isValid()) {
                            Ext.Msg.confirm(label_msg.saveAlertTitle,
                                    label_msg.saveProject, function(btn) {
                                        if (btn == 'yes') {
                                            mainPanel.form.submit({
                                                url : 'projectManage!addApp.action?orderId='
                                                        + mainPanel.form
                                                                .findField('orderId')
                                                                .getValue(),
                                                success : function(form, action) {
                                                    var msg = action.result.msg;
                                                    var orderId = action.result.orderId;
                                                    mainPanel.form
                                                            .findField('orderId')
                                                            .setValue(orderId);
                                                    // 激活 填写申请单 按钮
                                                    // Ext.getCmp('excel').setDisabled(false);
                                                    // 激活 下一步 按钮
                                                    Ext.getCmp('send')
                                                            .setDisabled(false);
                                                    Ext.getCmp('upload')
                                                            .setDisabled(false);
                                                    Ext.getCmp('openExcel')
                                                            .setDisabled(false);
                                                    Ext.getCmp('save')
                                                            .setDisabled(true);
                                                    Ext.Msg
                                                            .alert(
                                                                    label_msg.alertTitle,
                                                                    action.result.msg);// 成功提示信息
                                                },

                                                failure : function(from, action) {
                                                    Ext.Msg
                                                            .alert(
                                                                    label_msg.alertTitle,
                                                                    action.result.msg);// 失败提示信息
                                                },

                                                waitTitle : label_msg.saveAlertTitle,
                                                waitMsg : label_msg.saveWaitMsg
                                            });
                                        }
                                    });
                        }
                    }
                }, {
                    text : '下一步',
                    iconCls : 'order_move',
                    id : 'send',
                    disabled : true,
                    handler : function() {

                    }
                }, {
                    text : '查询',
                    iconCls : 'select',
                    id : 'select',
                    handler : function() {
                        var p = parent.main
                                .getComponent(label_window.orderSelectTitle);
                        if (!p) {
                            // var sid=
                            // mainPanel.form.findField('orderId').getValue();
                            var phone = mainPanel.form
                                    .findField('contactPhone').getValue();
                            var customerName = mainPanel.form
                                    .findField('customerName').getValue();
                            var projectName = mainPanel.form
                                    .findField('projectName').getValue();
                            p = parent.clickCreateTab('select', '查询记录',
                                    'project/historyProjectSelect.jsp?contactPhone='
                                            + phone + '&customerName='
                                            + customerName + '&projectName='
                                            + projectName);
                            parent.main.add(p);
                        }
                        parent.main.setActiveTab(p);
                    }
                }, {
                    text : '上传附件',
                    iconCls : 'upload',
                    name : 'upload',
                    id : 'upload',
                    disabled : true,
                    handler : function() {
                        var Id = mainPanel.form.findField('orderId').getValue();
                        if (Id != null || Id != '') {
                            this.setDisabled(false);
                            dialog.show();
                        }
                    }
                }, {
                    text : '打开Excel',
                    iconCls : 'order_activites',
                    id : 'openExcel',
                    disabled : true,
                    handler : function() {
                        var excelWin = new Ext.Window({
                            layout : 'fit',
                            name : 'excelwin',
                            height : 600,
                            colseAction : 'hide',
                            draggable : true,
                            maximizable : true,
                            width : 800,
                            buttonAlign : 'center',
                            buttons : [{
                                        text : '上传',
                                        iconCls : 'save',
                                        handler : function() {
                                            uploadExcel();
                                            excelWin.close();
                                            var prog = new Ext.ProgressBar({
                                                        text : '上传...',
                                                        width : 300
                                                    });
                                            prog.wait({
                                                        duration : 5000,
                                                        interval : 1000,
                                                        increment : 5
                                                    });
                                        }
                                    }],
                            title : "保存文件",
                            html : '<div><OBJECT id="FramerControl1" codeBase="dsoframer.ocx" height="100%" width="100%" classid="clsid:00460182-9E5E-11D5-B7C8-B8269041DD57">'
                                    + '<PARAM NAME="_ExtentX" VALUE="16960">'
                                    + '<PARAM NAME="_ExtentY" VALUE="13600">'
                                    + '<PARAM NAME="BorderColor" VALUE="-2147483632">'
                                    + '<PARAM NAME="BackColor" VALUE="-2147483643">'
                                    + '<PARAM NAME="ForeColor" VALUE="-2147483640">'
                                    + '<PARAM NAME="TitlebarColor" VALUE="-2147483635">'
                                    + '<PARAM NAME="TitlebarTextColor" VALUE="-2147483634">'
                                    + '<PARAM NAME="BorderStyle" VALUE="1">'
                                    + '<PARAM NAME="Titlebar" VALUE="0">'
                                    + '<PARAM NAME="Toolbars" VALUE="1">'
                                    + '<PARAM NAME="Menubar" VALUE="0">'
                                    + '</OBJECT></div>'
                        });

                        excelWin.show();
                        getExcel();

                        // 设置excel按钮不可用
                        Ext.getCmp('openExcel').setDisabled(false);
                    }

                }],
        items : [{
            layout : "column",
            items : [{
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'textfield',
                                    fieldLabel : '工程编号',
                                    name : 'orderId',
                                    id : 'orderId',
                                    allowBlank : true,
                                    readOnly : true,
                                    disabled : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'datefield',
                                    fieldLabel : '申请日期',
                                    name : 'dateCalled',
                                    format : 'Y-m-d',
                                    allowBlank : true,
                                    anchor : '100%',
                                    value : new Date()
                                }]
                    }, {
                        columnWidth : 0.5,
                        layout : 'form',
                        items : [{
                                    xtype : 'textfield',
                                    fieldLabel : '项目名称',
                                    name : 'projectName',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                            xtype : 'combo',
                            fieldLabel : '申请类型',
                            name : 'type',
                            hiddenName : 'type',
                            anchor : '100%',
                            mode : 'local',
                            triggerAction : 'all',
                            allowBlank : false,
                            emptyText : '请选择...',
                            editable : false, // 禁止手写及联想功能
                            displayField : 'desc',
                            valueField : 'code',
                            store : new Ext.data.Store({
                                proxy : new Ext.data.HttpProxy({
                                            url : 'projectManage!loadTypeTree.action'
                                        }),
                                reader : new Ext.data.JsonReader({
                                            totalProperty : 'count',
                                            root : 'JsonObjs',
                                            fields : ['code', 'desc']
                                        }),
                                autoLoad : true
                            }),
                            selectNodeModel : 'all',
                            listeners : {
                                'select' : function(o) {
                                    var consumptionYear = mainPanel.form
                                            .findField('consumptionYear');
                                    var houseCount = mainPanel.form
                                            .findField('houseCount');
                                    var purpose = mainPanel.form
                                            .findField('purpose');
                                    var ch = o.getRawValue();
                                    if (ch == '新装-工团') { // 工团类型
                                        hideField(houseCount);
                                        showField(consumptionYear);
                                        showField(purpose);
                                    } else if (ch == '新装-民用') { // 民用类型
                                        showField(houseCount);
                                        hideField(consumptionYear);
                                        hideField(purpose);
                                    } else if (ch == "新装-开发配套客户") { // 开发配套类型
                                        hideField(houseCount);
                                        hideField(consumptionYear);
                                        hideField(purpose);
                                    } else if (ch == "拆除") { // 拆除类型
                                        hideField(houseCount);
                                        hideField(consumptionYear);
                                        hideField(purpose);

                                    } else if (ch == "" || ch == null) {
                                        hideField(houseCount);
                                        hideField(consumptionYear);
                                        hideField(purpose);
                                    }
                                }
                            }
                        }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'textfield',
                                    fieldLabel : '申请人',
                                    name : 'applicant',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'textfield',
                                    fieldLabel : '联系人',
                                    name : 'customerName',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'numberfield',
                                    fieldLabel : '联系电话',
                                    name : 'contactPhone',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.5,
                        layout : 'form',
                        items : [{
                                    xtype : 'textfield',
                                    fieldLabel : '地址',
                                    name : 'address',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                            xtype : 'combo',
                            fieldLabel : '用气性质',
                            name : 'purpose',
                            maxLength : '20',
                            anchor : '100%',
                            editable : false,/* 是否允许用户输入 */
                            allowBlank : true,/* 非空验证 */
                            displayField : 'desc',/* 显示的字段,在store中定义的 */
                            valueField : 'code',/* 值的字段 在store中定义的 */
                            triggerAction : 'all',
                            store : new Ext.data.Store({
                                proxy : new Ext.data.HttpProxy({
                                    url : 'codeManage!loadCodesByRootIDAndCodeKey.action?codekey1=155&mark=1&both=1'
                                }),
                                reader : new Ext.data.JsonReader({
                                            root : 'rows',
                                            totalProperty : 'results',
                                            fields : ['code', 'desc']
                                        })
                            })
                        }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'numberfield',
                                    fieldLabel : '用气量',
                                    name : 'consumptionYear',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 0.25,
                        layout : 'form',
                        items : [{
                                    xtype : 'numberfield',
                                    fieldLabel : '户数',
                                    name : 'houseCount',
                                    allowBlank : true,
                                    anchor : '100%'
                                }]
                    }, {
                        columnWidth : 1,
                        layout : 'form',
                        items : [{
                                    xtype : 'textarea',
                                    fieldLabel : '申请内容',
                                    name : 'detail',
                                    allowBlank : true,
                                    anchor : '99%'
                                }]
                    }, {
                        xtype : 'hidden',
                        id : 'processInstanceId',
                        name : 'processInstanceId'
                    }]
        }],
        listeners : {
            'render' : function() {
                var tf = this.findByType('textfield');
                var nf = this.findByType('numberfield');
                var df = this.findByType('datefield');
                var taf = this.findByType('textarea');
                var com = this.findByType('combo');
                var arr = tf.concat(nf, df, taf, com); // 合并数组
                for (var i = 0; i < arr.length; i++) {
                    arr[i].setDisabled(true);
                }
            }
        }
    });

    /* 表格列头定义 */
    var cm = new Ext.grid.ColumnModel([{
                header : '日志时间',
                dataIndex : 'startTime',// 日志时间
                align : 'center',
                width : 110
            }, {
                header : '当前操作',
                dataIndex : 'currentOperation',// 当前处理
                align : 'center',
                width : 100
            }, {
                header : '处理部门',
                dataIndex : 'handleDept',// 处理部门
                align : 'left',
                width : 250
            }, {
                header : '操作人',
                dataIndex : 'operator',// 操作人
                align : 'left',
                width : 110,
                renderer : function(value, params, record) {
                    return (record.get('recId') == null || record.get('recId') == '')
                            ? value
                            : value
                                    + "  (<a href='#'><img src='../smallIcons/listen_black.gif' width='24' height='17' border='0'/></a>)";
                }
            }, {
                header : '细节',
                dataIndex : 'detail',// 细节
                align : 'left',
                width : 300
            }]);
    cm.defaultSortable = false;// 是否支持排序

    /* 数据读取器 */
    var logReader = new Ext.data.JsonReader({
                totalProperty : 'count',
                root : 'JsonObjs'
            }, [{
                        name : 'autoId'
                    }, {
                        name : 'currentOperation'
                    }, {
                        name : 'startTime'
                    }, {
                        name : 'handleDept'
                    }, {
                        name : 'operator'
                    }, {
                        name : 'detail'
                    }, {
                        name : 'recId'
                    }]);
    /* 数据Store */
    var logStore = new Ext.data.Store({
                proxy : new Ext.data.HttpProxy({
                            url : 'projectManage!loadOrderActivities.action'
                        }),
                reader : logReader,
                sortInfo : {
                    field : 'autoId',
                    direction : "Desc"
                } // 排序
            });
    logStore.on('beforeload', function() {
                Ext.apply(this.baseParams, {
                            orderId : Ext.getCmp('orderId').getValue()
                        });
            });

    var grid = new Ext.grid.GridPanel({
                store : logStore,
                cm : cm,
                loadMask : {
                    msg : label_grid.loadMsg
                }, // 加载时显示的等待信息
                stripeRows : true,
                // cls:'grid-row',
                // width:(w==1280 &
                // h==1024)?secondInit.getComputedWidth():secondInit1.getComputedWidth(),
                // height:(w==1280 &
                // h==1024)?secondInit.getComputedHeight():secondInit1.getComputedHeight(),
                viewConfig : {
                    forceFit : true,
                    autoScroll : true
                },
                autoExpandColumn : "detail"
            });
       
    /* 下达任务formpanel */
    sky_fp = function(title){
         return  new Ext.form.FormPanel({
            title:title,
            width:"100%",
            layout:'fit',
            height:"50%",
            frame:true,
            labelWidth:100,
            labelAlign:"right",
            bodyStyle:'padding:10px 0 0 0',
            items:[{
                layout:"column",
                xtype:"fieldset",
                title:"处理结果",
                items:[{
                    columnWidth:.8,
                    layout:"form",
                    items:[{
                        xtype:"textarea",
                        fieldLabel:"处理结果",
                        width:700,
                        autoScroll:true,
                        height:150
                    }]               
                },{
                    columnWidth:.5,
                    layout:"form",
                    items:[{
                        xtype:"textfield",
                        fieldLabel:"任务内容"
                    }]
                },{
                    columnWidth:.5,
                    layout:"form",
                    items:[{
                        xtype:"textfield",
                        fieldLabel:"任务内容"
                    }]
                },{
                    columnWidth:.5,
                    layout:"form",
                    items:[{
                        xtype:"textfield",
                        fieldLabel:"任务内容"
                    }]
                }]               
            }
            ],
            tbar:[{
                text:"保存",
                iconCls:"save",
                handler:function(){               
                }
            },{
                text:"修改",
                iconCls:"edit",
                handler:function(){               
                }
            },{
                text:"上传附件",
                iconCls:"upload",
                handler:function(){               
                }
            }                 
            ]                 
        });
    };

   
   
    //跟踪记录
    jilu = function(i){
        if(i == 1){
            /* 下达任务panel创建 */
            var c1 = new sky_fp("下达任务");
            return c1;
        };
       
    };
//工单删除
        var del = new Ext.form.FormPanel({
        labelWidth : 75,
        frame : true,
        items:[
        {
            xtype:'textarea',
            fieldLabel : '处理结果',
            name : 'remark1',
            growMin : 234,
            maxLengthText : '最大长度不能超过600个字符!',
            height:(w==1280 & h==1024)?"300px":"150px",
            anchor:'99%',
            maxLength:600
        }],
        buttons:[
        {   
            xtype:'button',
            text:label_window.save,//保存
            iconCls:'save',
            handler:function(){}
        },{
            xtype:'button',
            text:label_window.chongzhi,//重置
            iconCls:'clear',
            handler:function(){
                del.form.findField('remark').setValue("");
            }
        }]
        });
//小杨写的部分
        var data ={totalProperty:11,root:[
                  {kehuming:"sky",shenfenzheng:"320621546456665",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"infi",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"fly",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"lucifer",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"tod",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"张红印",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"王桑",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"},
                  {kehuming:"李朝",shenfenzheng:"ddddddd",kehubianhao:"ddddddd",zhuangbiaodushu:"dffd",lianxiren:"fdfd",gudingdianhua:"fdfdfd",louhao:"ddddddd",danyuanhao:"ddddddd",fangjianhao:"dddd",qibiaobianhao:"ddfdfd"}
          ]};
      var sm = new Ext.grid.CheckboxSelectionModel({singleSelect:true});
      var cm = new Ext.grid.ColumnModel([
          new Ext.grid.RowNumberer(),
          sm,
         {header:"客户名称",type:"string",dataIndex:"kehuming",tooltip:"客户名称",width:60},
         {header:"身份证号码",type:"string",dataIndex:"shenfenzheng",tooltip:"客户编号",width:60},
         {header:"客户编号",type:"string",dataIndex:"kehubianhao",tooltip:"客户编号",width:60},
         {header:"装表读数",type:"string",dataIndex:"zhuangbiaodushu",tooltip:"客户编号",width:60},
         {header:"联系人",type:"string",dataIndex:"lianxiren",tooltip:"客户编号",width:60},
         {header:"固定电话",type:"string",dataIndex:"gudingdianhua",tooltip:"客户编号",width:60},
         {header:"楼号",type:"string",dataIndex:"louhao",tooltip:"楼号",width:60},
         {header:"单元号",type:"string",dataIndex:"danyuanhao",tooltip:"单元号",width:60},
         {header:"房间号",type:"string",dataIndex:"fangjianhao",tooltip:"房间号",width:60 },
         {header:"气表表号",type:"string",dataIndex:"qibiaobianhao",tooltip:"表号",id:"Biaohao"}
         ]);
      var cm_proxy = new Ext.data.MemoryProxy(data);
      var cm_record = Ext.data.Record.create([
              {name:"kehuming",type:"string",mapping:"kehuming"},
              {name:"shenfenzheng",type:"string",mapping:"shenfenzheng"},
              {name:"kehubianhao",type:"string",mapping:"kehubianhao"},
              {name:"zhuangbiaodushu",type:"string",mapping:"zhuangbiaodushu"},
              {name:"lianxiren",type:"string",mapping:"lianxiren"},
              {name:"gudingdianhua",type:"string",mapping:"gudingdianhua"},
              {name:"louhao",type:"string",mapping:"louhao"},
              {name:"danyuanhao",type:"string",mapping:"danyuanhao"},
              {name:"fangjianhao",type:"string",mapping:"fangjianhao"},
              {name:"qibiaobianhao",type:"string",mapping:"qibiaobianhao"}
          ]);
      var cm_reader = new Ext.data.JsonReader({totalProperty:"totalProperty",root:"root"},cm_record);
      var cm_store = new Ext.data.Store({
          proxy:cm_proxy,
          reader:cm_reader
      });
      cm_store.load({params:{start:0,limit:6}});
     
      //new user js end

  //创建客户信息表单
  var form_c = function(){
      var cc = new Ext.FormPanel({
            title:"客户信息",
            collapsible:true,
            titleCollapse:true,
            width:"100%",
            frame:true,
            layout:"form",
            autoHeight:true,
            labelWidth:65,
            labelAlign:"right",
            bodyStyle:{padding:"15px"},
            items:[
                   {
                       layout:"column",
                       items:[{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                  name:"kehuming",
                                  id:"kehuming",
                                  allowBlank: false,
                                  xtype:"textfield",
                                  fieldLabel:"客户名称",
                                  width:200
                                  }]
                               },{
                                  columnWidth:.5,
                                  layout:"form",                                  
                                  items:[{
                                      name:"shenfenzheng",
                                      id:"shenfenzheng",
                                      allowBlank: false,
                                      xtype:"textfield",
                                      fieldLabel:"身份证号",
                                      width:200
                                  }]
                              }
                       ]
                   },{
                       layout:"column",
                       items:[{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                        name:"kehubianhao",
                                        id:"kehubianhao",
                                        allowBlank: false,
                                        xtype:"textfield",
                                      fieldLabel:"客户编号",
                                      width:200
                                  }]
                               },{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                      name:"zhuangbiaodushu",
                                      id:"zhuangbiaodushu",
                                      allowBlank: false,
                                      xtype:"textfield",
                                      fieldLabel:"装表读数",
                                      width:200
                                  }]
                              }
                       ]
                   },{
                       layout:"column",
                       items:[{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                        name:"lianxiren",
                                        id:"lianxiren",
                                        allowBlank: false,
                                        xtype:"textfield",
                                      fieldLabel:"联系人",
                                      width:200
                                  }]
                               },{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                      name:"gudingdianhua",
                                      id:"gudingdianhua",
                                      allowBlank: false,
                                      xtype:"textfield",
                                      fieldLabel:"固定电话",
                                      width:200
                                  }]
                              }
                       ]
                   },{
                       layout:"column",
                       items:[{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                        name:"louhao",
                                        id:"louhao",
                                        allowBlank: false,
                                        xtype:"textfield",
                                      fieldLabel:"楼号",
                                      width:200
                                  }]
                               },{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                      name:"danyuanhao",
                                      id:"danyuanhao",
                                      allowBlank: false,
                                      xtype:"textfield",
                                      fieldLabel:"单元",
                                      width:200
                                  }]
                              }
                       ]
                   },{
                       layout:"column",
                       items:[{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                        name:"fangjianhao",
                                        id:"fangjianhao",
                                        xtype:"textfield",
                                      fieldLabel:"房间",
                                      width:200
                                  }]
                               },{
                                  columnWidth:.5,
                                  layout:"form",
                                  items:[{
                                      name:"qibiaobianhao",
                                      id:"qibiaobianhao",
                                      allowBlank: false,
                                      xtype:"textfield",
                                      fieldLabel:"气表编号",
                                      width:200
                                  }]
                              }
                       ]
                   }          
                 ]
         });
     return cc;
  };
  //客户信息表格创建
  var sky_grid = new Ext.grid.GridPanel({
      title:"客户信息",
      width:"100%",
      height:Ext.getBody().getHeight(),
      cm:cm,
      frame:true,
      sm:sm,
      store:cm_store,
      autoExpandColumn:"Biaohao",
      tbar:[
      {
          text:"添加",
          iconCls : 'add',
          handler:function(){
            new customer_b();
          }
      },
      {
          text:"查看",
          iconCls : 'select',
          handler:function(){
          new customer_e();
          }
    },"-","总户数","-","挂表方式"

      ],
      bbar:[
      new Ext.PagingToolbar({
              store:cm_store,
              pageSize:6,
              displayInfo:true,
              displayMsg:"本页显示第{0}条到第{1}条的记录,一共{2}条",
              emptyMsg:"没有记录" ,
              width:700
          })
    ]
  });
  //客户添加
  customer_b = function(){
    var form1 = new form_c();
  

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics