2024年5月16日 星期四

V20302B – 調整版面 panel 的高度大小 - splitter - 版面 - 挑選人員

 目的: V20302B – 系統件除帳 工號(25284247) – 調整版面 panel 的高度大小

處理說明:  1> {  xtype: 'splitter',  width: 2,    },



1>*.js

//[顯示Email]  - 子畫面欄位
    var sub1_ShowEmail_Flds = [
        {
            xtype:'panel',bodyStyle: "background-color:transparent;", border: false, layout: {  type: "vbox",  align: 'stretch' }, padding: "5",
            id: 'sub1_myForm', items: [
                {
                    xtype: "fieldcontainer", fieldLabel: "主旨", labelWidth: 60, layout: "fit", flex: 1, items: [
                        {
                            xtype: "textfield", id: "sub1_Subject", name: "sub1_Subject",  padding: "0 4 0 0",
                            //value: "AJT",
                        },
                    ]
                },  //end of 主旨
                {
                    xtype: "fieldcontainer", fieldLabel: "內容", labelWidth: 60, layout: "fit", flex: 3, items: [
                        {
                            id: "sub1_content", name: "sub1_content", xtype: "textareafield",  padding: "0 4 0 0", 
                            //value: "AJT",
                        },
                    ]
                }, // end of 內容
                {
                    xtype: 'splitter',
                    width: 2,
                },

                {  //下方 TreeView, 左右移,正本/副本
                    xtype: "panel", flex: 5,
                    layout: {
                        type: 'hbox',
                        align: 'stretch'
                    },
                    //autoScroll: true,
                    items: [
                        { // TreeView
                            xtype: "panel", flex: 4, layout: { type: 'vbox', align: 'stretch' },                            
                            autoScroll: true, items: [treepanel1]
                        },  //TreeView
                        {  //正本&副本.[左移/右移]按鈕
                            xtype: "panel", flex: 2, layout: { type: 'vbox', align: 'stretch' }, border: false,
                            //bodyStyle: 'background:blue; ',
                            items: [
                                {  //  正本.左右移的 Button
                                    xtype: 'panel', id: 'panel1_btns1', layout: { type: 'vbox', align: 'stretch' }, flex: 1, border: false,
                                    //bodyStyle: 'background:yellow; ',                                    
                                    items: [                                        
                                        {//space panel
                                            xtype: 'panel',    flex: 1,                                            
                                        },// end of 
                                        {//正本.1往右移
                                            xtype: 'button',
                                            id: 'btn1_move11',
                                            text: '往右',
                                            iconCls: 'icon-right',
                                            flex: 1,
                                            handler: function () {
                                                //console.log("Ext.getCmp('sub1_treepanel'):", Ext.getCmp('sub1_treepanel'));
                                                //var node = treepanel1.getSelectionModel().getSelectedNode();
                                                var nodes = treepanel1.getSelectionModel().getSelection();
                                                var node = nodes[0];
                                                if (checkisnull(node)) {
                                                    var Tmp_Str = "請先選擇要Email的人員!!";
                                                    mywarnalert(Tmp_Str);
                                                    return;
                                                }
                                                    
                                                //console.log("node:", node);
                                                //console.log("node.raw:", node.raw);
                                                var Tmp_Emplyid, Tmp_EmplyNM, Tmp_Notes_EMAIL;
                                                if (node.raw.leaf) {
                                                    Tmp_Emplyid = node.raw.id;
                                                    Tmp_EmplyNM = StrExtract(node.raw.text, 2, ":");
                                                    //console.log("姓名:", Tmp_EmplyNM);
                                                    var Tmp_Email = getEmp_Email(Tmp_Emplyid);
                                                    //console.log("Email:", Tmp_Email);
                                                    var Tmp_rec = { EMPLYNM: Tmp_EmplyNM, NOTES_MAIL: Tmp_Email };
                                                    var find = Ext.getCmp("sub1_Grid1").store.find('EMPLYNM', Tmp_EmplyNM);
                                                    if (find != -1) {
                                                        // 已存在,則不再加入
                                                        Tmp_Str = "人員(" + Tmp_EmplyNM + ")已存在,不可再加入";
                                                        mywarnalert(Tmp_Str);
                                                        return;
                                                    } else {
                                                        Ext.getCmp("sub1_Grid1").store.add(Tmp_rec);
                                                    };
                                                }
                                                else {
                                                    var Tmp_Str = "請先選擇要Email的人員!!";
                                                    mywarnalert(Tmp_Str);
                                                }
                                            }
                                        },// end of 往右移                                        
                                        {//正本.1往左
                                            xtype: 'button',
                                            id: 'btn1_move12',
                                            text: '往左',
                                            iconCls: 'icon-left',
                                            flex: 1,
                                            handler: function () {
                                                var nodes = Ext.getCmp("sub1_Grid1").getSelectionModel().getSelection();                                               
                                                if (nodes.length == 0) {                                                    
                                                        mywarnalert("請先選擇要左移的資料");                                                        
                                                    return;
                                                }
                                                var node = nodes[0];                                                
                                                Ext.getCmp("sub1_Grid1").store.remove(node);
                                            }
                                        },//往左移
                                        {//space panel
                                            xtype: 'panel',flex: 1,
                                        },// end of 
                                    ]
                                }, //panel_btn1
                                {  //  副本.左右移的 Button
                                    xtype: 'panel', id: 'panel1_btns2', layout: { type: 'vbox', align: 'stretch' }, flex: 1, border: false,                                    
                                    //bodyStyle: 'background:red; ',
                                    items: [
                                    {//space panel                                    
                                    xtype: 'panel', flex: 1,                                },// end of 
                                        {//副本.2往右
                                            xtype: 'button',
                                            id: 'btn1_move21',
                                            text: '往右',
                                            iconCls: 'icon-right',
                                            flex: 1,
                                            handler: function () {
                                                //console.log("Ext.getCmp('sub1_treepanel'):", Ext.getCmp('sub1_treepanel'));
                                                //var node = treepanel1.getSelectionModel().getSelectedNode();
                                                var nodes = treepanel1.getSelectionModel().getSelection();
                                                var node = nodes[0];
                                                var Tmp_Str;
                                                if (checkisnull(node)) {
                                                    Tmp_Str = "請先選擇要Email的人員!!";
                                                    mywarnalert(Tmp_Str);
                                                    return;
                                                }
                                                //console.log("node:", node);
                                                //console.log("node.raw:", node.raw);
                                                var Tmp_Emplyid, Tmp_EmplyNM, Tmp_Notes_EMAIL;
                                                if (node.raw.leaf) {
                                                    Tmp_Emplyid = node.raw.id;
                                                    Tmp_EmplyNM = StrExtract(node.raw.text, 2, ":");
                                                    //console.log("姓名:", Tmp_EmplyNM);
                                                    var Tmp_Email = getEmp_Email(Tmp_Emplyid);
                                                    //console.log("Email:", Tmp_Email);
                                                    var Tmp_rec = { EMPLYNM: Tmp_EmplyNM, NOTES_MAIL: Tmp_Email };
                                                    var find = Ext.getCmp("sub1_Grid2").store.find('EMPLYNM', Tmp_EmplyNM);
                                                    if (find != -1) {
                                                        // 已存在,則不再加入
                                                        Tmp_Str = "人員(" + Tmp_EmplyNM + ")已存在,不可再加入";
                                                        mywarnalert(Tmp_Str);
                                                        return;
                                                    } else {
                                                        Ext.getCmp("sub1_Grid2").store.add(Tmp_rec);
                                                    };
                                                    
                                                }
                                                else {
                                                    var Tmp_Str = "請先選擇要Email的人員!!";
                                                    mywarnalert(Tmp_Str);
                                                }
                                            }
                                        },// end of 往右移
                                        //{ xtype: 'panel', flex: 1, },// end of  虛 space
                                        {//副本.2往左
                                            xtype: 'button',
                                            id: 'btn1_move22',
                                            text: '往左',
                                            iconCls: 'icon-left',
                                            flex: 1,
                                            handler: function () {
                                                var nodes = Ext.getCmp("sub1_Grid2").getSelectionModel().getSelection();
                                                if (nodes.length == 0) {
                                                    mywarnalert("請先選擇要左移的資料");
                                                    return;
                                                }
                                                var node = nodes[0];
                                                Ext.getCmp("sub1_Grid2").store.remove(node);                                            
                                            }
                                        },//往左移
                                        {//space panel
                                            xtype: 'panel', flex: 1,
                                        },// end of 
                                    ]
                                }, //panel_btn2                                                        
                            ]
                        },  //按鈕
                        {  //正本,副本人員
                            xtype: "panel", flex: 4,                            
                            layout: { type: 'vbox', align: 'stretch' },                            
                            items: [
                                {
                                    xtype: "panel", flex: 1, title: '正本人員', layout: 'fit',                                  
                                    bodyStyle: 'background:yellow; ', items: [sub1_Grid1],
                                },
                                {
                                    xtype: "panel", flex: 1, title: '副本人員', layout: 'fit',                                                                       
                                    bodyStyle: 'background:blue; ', items: [sub1_Grid2],
                                },
                            ],                            
                        },  //正本副本
                    ]
                }, // end of TreeView                
            ]  //end of sub_myForm
        }]  //end of sub_ShowPN_Flds


沒有留言:

張貼留言