2023年11月8日 星期三

V80203 – checkbox –勾選[V]已完工,則 [ ]未完工 不勾選 - onChangeEvent - V80202 -[V]TP工單,則[ ]非 TP工單不勾選

目的 : V80203 – checkbox –勾選[V]已完工, [ ]未完工  -–勾選[V]未完工, [ ]已完工 

           V80202 -[V]TP工單,則[ ]非 TP工單不勾選

處理說明: 1>get_cmp_xxx - s_chk_AMMSTS Object - 為一般Objext - 沒有 Ext onchange屬性
                      var cmp_chk_AMMSTS1 = get_cmp_chk0('已完工', 's_chk_AMMSTS', 50, '1');
                      --> Object  cmp_chk_AMMSTS1  - 為一般Object,並沒有 onchange event 的屬性
    
              2>get_cmp_XXX --> 加入 Query(Ext.FormPanel) 後, 才有 Ext 的各種屬性(onchange/.. )
                  var Query = new Ext.FormPanel({
                  id: 's_form',
                  items: [
                 {
                xtype: 'panel', id: 'panel1', layout: { type: 'hbox', align: 'stretch' }, flex: 14, border: 0,
                items: [                  
                   {
                        xtype: 'panel', id: 'panel15', layout: { type: 'vbox', align: 'stretch' }, flex: 15, border: 0,
                        items: [cmp_chk_AMMSTS, cmp_ISROOT, cmp_ISBOMIN, cmp_ISWAITNSN],
                    },   // end of panel15 , flex:16                        

           3> [V]已完工 [ ]未完工的 true/false 控制
    Ext.getCmp("s_chk_AMMSTS").items.items[0].on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue) {
            Ext.getCmp("s_chk_AMMSTS").items.items[1].setValue(false);
        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"
    Ext.getCmp("s_chk_AMMSTS").items.items[1].on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue) {
            Ext.getCmp("s_chk_AMMSTS").items.items[0].setValue(false);
        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"



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);
    cmp_chk_AMMSTS1.checked = true;    

  var Query = new Ext.FormPanel({
        id: 's_form',
        layout: { type: 'hbox', align: 'stretch' },
        fieldDefaults: { labelAlign: 'right' },
        defaults: { margin: { top: 3 } },
        items: [
            {
                xtype: 'panel', id: 'panel1', layout: { type: 'hbox', align: 'stretch' }, flex: 14, border: 0,
                items: [
                    {
                        xtype: 'panel', id: 'panel11', layout: { type: 'vbox', align: 'stretch' }, flex: 25, border: 0,
                        items: [cmp_EOECN, cmp_ACNO,cmp_AMMNO, cmp_AMMSTS, cmp_PN1, cmp_EM_SN,],
                    },  // end of panel11
                    {
                        xtype: 'panel', id: 'panel12', layout: { type: 'vbox', align: 'stretch' }, flex: 25, border: 0,
                        items: [cmp_RMK, cmp_PROJID, cmp_SAPNO, cmp_SAPMAN, cmp_STARTVAL, cmp_CHARG,],
                    },   // end of panel12 , flex:16                    
                    {
                        xtype: 'panel', id: 'panel13', layout: { type: 'vbox', align: 'stretch' }, flex: 25, border: 0,
                        items: [cmp_PN, cmp_PROCWC, cmp_MKDT,  cmp_SROTP, cmp_FACWC,],
                    },   // end of panel13 , flex:16              
                    {
                        xtype: 'panel', id: 'panel14', layout: { type: 'vbox', align: 'stretch' }, flex: 30, border: 0,
                        items: [cmp_WBSNO, cmp_ACAREA, cmp_LWA, cmp_MK,cmp_SAPDT1,],
                    },   // end of panel14 , flex:16                               
                    {
                        xtype: 'panel', id: 'panel15', layout: { type: 'vbox', align: 'stretch' }, flex: 15, border: 0,
                        items: [cmp_chk_AMMSTS, cmp_ISROOT, cmp_ISBOMIN, cmp_ISWAITNSN],
                    },   // end of panel15 , flex:16                            

    console.log("cmp_chk_AMMSTS2:", cmp_chk_AMMSTS2);
    console.log("Ext.getCmp('s_chk_AMMSTS').items.items[1]", Ext.getCmp('s_chk_AMMSTS').items.items[1]);
    Ext.getCmp("s_chk_AMMSTS").items.items[0].on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue) {
            Ext.getCmp("s_chk_AMMSTS").items.items[1].setValue(false);
        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"
    Ext.getCmp("s_chk_AMMSTS").items.items[1].on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue) {
            Ext.getCmp("s_chk_AMMSTS").items.items[0].setValue(false);
        }
    }
    );  // end of  cmp_chk_AMMSTS.items[0].on("change"




1>*.js
   //若按[TP工單],則 [非TP工單].checked=false;
    Ext.getCmp("s_chk_TP").items.items[0].on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue) {
            Ext.getCmp("s_chk_TP").items.items[1].setValue(false);
        }
    }
    );  // end of  cmp_chk_TP.items[0].on("change"
    Ext.getCmp("s_chk_TP").items.items[1].on('change', function (me, newValue, oldValue, eOpts) {
        if (newValue) {
            Ext.getCmp("s_chk_TP").items.items[0].setValue(false);
        }
    }

沒有留言:

張貼留言