2023年11月3日 星期五

V80203 – checkbox – 過濾條件加文字輸入欄位 - checkboxgroup

目的: V80203 – checkbox – 加文字輸入欄位  - checkboxgroup

處理說明: 1>checkboxGroup - 內含 checkbox
                       //已完工/未完工
                      var cmp_chk_AMMSTS = get_cmp_chkgrp1('單況', 's_chk_AMMSTS', 50);    
                      var cmp_chk_AMMSTS1 = get_cmp_chk0('已完工', 's_chk_AMMSTS', 50, '1');
                      var cmp_chk_AMMSTS2 = get_cmp_chk0('未完工', 's_chk_AMMSTS', 50, '2');
                      cmp_chk_AMMSTS.items.push(cmp_chk_AMMSTS1, cmp_chk_AMMSTS2);
                 2>單一checkbox 
                     var cmp_ISROOT = get_cmp_chk1('機務工單', 's_ISROOT', 80, 'Y', '0 0 0 50');                                   3>checkbox 後接文字欄位  : 利用 panel 當 fieldcontainer
                        //預估到件率>xx
                       var cmp_RT = get_cmp_panel1(0);
                       var cmp_RT1 = get_cmp_chk1('預估到件率>', 's_RT', 80, 'Y','0 5 0 0');
                       var cmp_RT2 = get_cmp_txt0('s_RT1', 30);
                        cmp_RT.items.push(cmp_RT1,cmp_RT2);

                4>checkboxgroup 必需先 getValue ,再傳入 np 



1>*.js
//單況: 已完工/未完工
var cmp_chk_AMMSTS = get_cmp_chkgrp1('單況', 's_chk_AMMSTS', 50);
var cmp_chk_AMMSTS1 = get_cmp_chk0('已完工', 's_chk_AMMSTS', 50, '1');
var cmp_chk_AMMSTS2 = get_cmp_chk0('未完工', 's_chk_AMMSTS', 50, '2');
cmp_chk_AMMSTS.items.push(cmp_chk_AMMSTS1, cmp_chk_AMMSTS2);

//機務工單
var cmp_ISROOT = get_cmp_chk1('機務工單', 's_ISROOT', 80, 'Y', '0 0 0 50');

//超過xx天
    var cmp_STARTDT = get_cmp_panel1(0);
    var cmp_STARTDT1 = get_cmp_chk1('超過', 's_START', 80, 'Y', '0 5 0 0');
    var cmp_STARTDT2 = get_cmp_txt0('s_STARTDT1', 30);
    var cmp_STARTDT3 = get_cmp_lbl0('天', 30);
    cmp_STARTDT.items.push(cmp_STARTDT1, cmp_STARTDT2, cmp_STARTDT3,);

    var cmp_RT = get_cmp_panel1(0);
    var cmp_RT1 = get_cmp_chk1('預估到件率>', 's_RT', 80, 'Y','0 5 0 0');
    var cmp_RT2 = get_cmp_txt0('s_RT1', 30);
    cmp_RT.items.push(cmp_RT1,cmp_RT2);

      //顯示資料
       var np = s_JSON('s_form'); //TMFunction.js, 組合form上的查詢條件為json參數傳遞             
       //已完工,未完工 //若同時勾選[v]已發工[v]已完工 , 則欄位值 Array of  :  ['1','2']
       np["s_chk_AMMSTS"] = Ext.getCmp('s_chk_AMMSTS').getValue();                            
        var gridstore = Ext.getCmp('grid_M').store;      
        gridstore.getProxy().url = '../api/V80203API/getGridData_M';
        gridstore.getProxy().extraParams = np; //分頁OK,篩選條件OK
        Ext.getCmp('grid_M').reloadGridData();


2>*.cs
              //已完工/未完工 AMMSTS
            if (!myfunc.checkisnull(Tmp_chk_AMMSTS))
            {
                if (Tmp_chk_AMMSTS=="1")  //已完工
                    Tmp_Sql = Tmp_Sql + " AND   AMMSTS  IN ('F','G','H','I')  ";
                if (Tmp_chk_AMMSTS == "2")  //未完工
                    Tmp_Sql = Tmp_Sql + " AND   AMMSTS  < 'F'  ";
            };
            //機務工單 - ISROOT
            if (!myfunc.checkisnull(Tmp_ISROOT))
            {
                if (Tmp_ISROOT== "true" )
                   Tmp_Sql = Tmp_Sql + " AND   ISROOT=" + myfunc.AA("Y");                
            };

             //預估到件率> xx
            if (!myfunc.checkisnull(Tmp_ISRT))
            {
                if (Tmp_ISRT == "true")
                    Tmp_Sql = Tmp_Sql + " AND   RT>= "+myfunc.AA(Tmp_RT1);
            };


沒有留言:

張貼留言