function HnsDisplayControlConfFactory(trigger, value){ var _this = this; this.trigger = trigger; this.value = value; this.confs = null; this.getConfs = function(){ return _this.confs; } /* * フラグとconfsの設定 */ this.init = function(){ if(_this.trigger instanceof Array){ //keyとvalueの紐付Mapを作成しておく _this.initKeyValMap(_this.trigger, _this.value); if( _this._contains('quoteMethod','shape','wireDiameter','leftSideContactNo','leftSideHousingNo','rightSideContactNo','rightSideHousingNo') ){ _this.confs = _this._copyConfs(HnsDisplayControlConfFactory, '_confs_quoteMethod_shape_wireDiameter_leftSideContactNo_leftSideHousingNo_rightSideContactNo_rightSideHousingNo'); } }else{ _this.confs = _this._copyConfs(HnsDisplayControlConfFactory, '_confs_' + trigger); } } /* * confsの編集 */ this.mod = function(){ if(_this.trigger instanceof Array){ if( _this._contains('quoteMethod','shape','wireDiameter','leftSideContactNo','leftSideHousingNo','rightSideContactNo','rightSideHousingNo') ){ _this.modby_quoteMethod_shape_wireDiameter_leftSideContactNo_leftSideHousingNo_rightSideContactNo_rightSideHousingNo(); } }else{ _this['modby_' + _this.trigger](); } } //#######################confs編集のサブルーチン this.modby_quoteMethod_shape_wireDiameter_leftSideContactNo_leftSideHousingNo_rightSideContactNo_rightSideHousingNo = function(){ /* * 見積方法=「電線の仕様から」 * ⇒「電線選択項目」は「基本項目」の「形状」が入力されたら、入力可 * ⇒「先端加工項目」は「基本項目」の「形状」が入力されたら、入力可 * * ⇒「部品選択項目」は「電線項目」の「径」が入力されたら、入力可 */ if(_this.keyValMap.quoteMethod == '0'){ if(_this.keyValMap.shape != AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_wire_reqBasic'].display = 'none'; } if(_this.keyValMap.wireDiameter != AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_parts_reqWire'].display = 'none'; } } /* * 見積方法=「ハウジング・コンタクトから」 * ⇒「部品選択項目」は「基本項目」の「形状」が入力されたら、入力可 * * 形状が「電線のみ」の場合 * ⇒「部品選択項目」は非表示になるので、「電線選択項目」「先端加工項目」は共に入力可になる。 * 形状が「片側コンタクト」の場合 * ⇒「電線選択項目」は左側コンタクト型番が入力されたら、入力可 * 形状が「片側ハウジング」の場合 * ⇒「電線選択項目」は左側ハウジング型番が入力されたら、入力可 * 形状が「片側ハウジング・片側コンタクト」or「両側コンタクト」の場合 * ⇒「電線選択項目」は右側コンタクト型番が入力されたら、入力可 * 形状が「両側ハウジング」の場合 * ⇒「電線選択項目」は右側ハウジング型番が入力されたら、入力可 * */ else if(_this.keyValMap.quoteMethod == '1'){ _this.confs['gray_parts_reqWire'].display = 'none'; _this.confs['gray_wire_reqBasic'].display = 'none'; if(_this.keyValMap.shape == AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_parts_reqBasic'].display = 'block'; }else{ //_this.confs['gray_parts_reqBasic'].display = 'none' デフォルトなので操作不要 } if(_this.keyValMap.shape == AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_wire_reqParts'].display = 'block'; }else if(_this.keyValMap.shape == '1'){ //_this.confs['gray_wire_reqParts'].display = 'none' デフォルトなので操作不要 }else if(_this.keyValMap.shape == '2'){ if(_this.keyValMap.leftSideContactNo == AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_wire_reqParts'].display = 'block'; } }else if(_this.keyValMap.shape == '3'){ if(_this.keyValMap.leftSideHousingNo == AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_wire_reqParts'].display = 'block'; } }else if( _this.keyValMap.shape == '4' || _this.keyValMap.shape == '5' ){ if(_this.keyValMap.rightSideContactNo == AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_wire_reqParts'].display = 'block'; } }else if(_this.keyValMap.shape == '6'){ if(_this.keyValMap.rightSideHousingNo == AbstractDisplayControlConfFactory.EMPTY_VALUE){ _this.confs['gray_wire_reqParts'].display = 'block'; } } } } this.modby_shape = function(){ if(_this.keyValMap.shape == '1'){ _this.confs['disabled_leftProcessing'].display = 'none'; _this.confs['disabled_rightProcessing'].display = 'none'; _this.confs['disabled_leftParts'].display = 'none'; _this.confs['disabled_rightParts'].display = 'none'; _this.confs['tr_usage'].display = 'none'; _this.confs['tr_partsMaker'].display = 'none'; _this.confs['tr_partsSeries'].display = 'none'; _this.confs['tr_partsNo'].display = 'none'; }else if( _this.keyValMap.shape == '2' || _this.keyValMap.shape == '3' ){ _this.confs['disabled_leftParts'].display = 'none'; _this.confs['disabled_rightProcessing'].display = 'none'; }else if( _this.keyValMap.shape == '4' || _this.keyValMap.shape == '5' || _this.keyValMap.shape == '6' ){ _this.confs['disabled_leftParts'].display = 'none'; _this.confs['disabled_rightParts'].display = 'none'; _this.confs['disabled_leftProcessing'].display = 'none'; _this.confs['disabled_rightProcessing'].display = 'none'; _this.confs['tr_processing'].display = 'none'; } //UL elements if(_this.keyValMap.shape == '1'){ } else if(_this.keyValMap.shape == '2'){ _this.confs['list_leftSideContactNo'].display = 'block'; } else if(_this.keyValMap.shape == '3'){ _this.confs['list_leftSideHousingNo'].display = 'block'; } else if(_this.keyValMap.shape == '4'){ _this.confs['list_leftSideHousingNo'].display = 'block'; _this.confs['list_rightSideContactNo'].display = 'block'; } else if(_this.keyValMap.shape == '5'){ _this.confs['list_leftSideContactNo'].display = 'block'; _this.confs['list_rightSideContactNo'].display = 'block'; } else if(_this.keyValMap.shape == '6'){ _this.confs['list_leftSideHousingNo'].display = 'block'; _this.confs['list_rightSideHousingNo'].display = 'block'; } } this.modby_leftSidePartsMaker = function(){ if(_this.value == 'JST'){ _this.confs['leftSidePartsMakerMessage'].display = 'block'; } } this.modby_rightSidePartsMaker = function(){ if(_this.value == 'JST'){ _this.confs['rightSidePartsMakerMessage'].display = 'block'; } } //#########################################初期化 _this.init(); _this.mod(); } HnsDisplayControlConfFactory.prototype = new AbstractDisplayControlConfFactory(); /* * ########################################### * DEFAULT SETTINGS * ########################################### */ //複合 HnsDisplayControlConfFactory._confs_quoteMethod_shape_wireDiameter_leftSideContactNo_leftSideHousingNo_rightSideContactNo_rightSideHousingNo = { 'gray_wire_reqParts' : {'display': 'none'}, 'gray_wire_reqBasic' : {'display': 'block'}, 'gray_parts_reqWire' : {'display': 'block'}, 'gray_parts_reqBasic' : {'display': 'none'} } //単体 HnsDisplayControlConfFactory._confs_shape = { 'disabled_leftParts' : {'display' : 'block'}, 'disabled_rightParts' : {'display' : 'block'}, 'disabled_leftProcessing' : {'display' : 'block'}, 'disabled_rightProcessing' : {'display' : 'block'}, 'tr_usage' : {'display' : 'table-row'}, 'tr_partsMaker' : {'display' : 'table-row'}, 'tr_partsSeries' : {'display' : 'table-row'}, 'tr_partsNo' : {'display' : 'table-row'}, 'tr_processing' : {'display' : 'table-row'}, 'list_leftSideContactNo' : {'display' : 'none'}, 'list_leftSideHousingNo' : {'display' : 'none'}, 'list_rightSideContactNo' : {'display' : 'none'}, 'list_rightSideHousingNo' : {'display' : 'none'}, } HnsDisplayControlConfFactory._confs_leftSidePartsMaker = { 'leftSidePartsMakerMessage': {'display' : 'none'} } HnsDisplayControlConfFactory._confs_rightSidePartsMaker = { 'rightSidePartsMakerMessage': {'display' : 'none'} }