var hq; $(function(){ if(hq == null){ //IEで2回実行される問題(原因不明)への対策 hq = new HnsQuote(); hq.init(); } }); function HnsQuote(){ var _this = this; this.debugMode = false; var actionUrl_numOfPoles = '/kiban/utf-8/hns/csHnsEst:numOfPoles.do'; var actionUrl_pinNumberingArray = '/kiban/utf-8/hns/csHnsEst:pinNumberingArray.do'; var actionUrl_contactNo = '/kiban/utf-8/hns/csHnsEst:contactNo.do'; var actionUrl_exec = '/kiban/utf-8/hns/csHnsEst:exec.do'; HnsQuote.actionUrl_userInfo = '/kiban/com/jq/csComLogin:userInfo.do'; HnsQuote.actionUrl_login = '/kiban/com/jq/csComLogin:execa.do'; var actionUrl_save = '/kiban/hns/csHnsEst:save.do'; this.formBlockArray; this.initFormBlockArray = function(){ _this.formBlockArray = new Array() } this.scrollGimmick = new ScrollGimmick(); this.dispCon = new DisplayController(this, HnsDisplayControlConfFactory); this.optCon = new HnsOptionControl(this); var colorsValue = $('input[name=colors]').val() var parsedColorsValue = colorsValue ? JSON.parse(colorsValue) : undefined this.viewer = new HnsViewer(this, $('#viewport'), $('#colorTableBody'), parsedColorsValue); this.quoteExeBtn = new HnsQuoteExeBtn(_this); this.loadingControl = new LoadingControl('loading3'); this.loadingControlWhenLogin = new LoadingControl('loading3'); this.resultsDisplay; //ロード完了時に初期化 this.errorDisplay; //ロード完了時に初期化 this.contextNavi = new ContextNavi(); this.init = function(){ //selectメニューのUI表現 $('select.select').selectmenu(); //tooltip $(document).tooltip(); var staticHeader = $('#navi'); //アンカーリンクをスライドモーションに変更 _this.slideMotionEH(staticHeader); //scrollUP & scrollDown Util Button _this.scrollUtils(staticHeader); //INPUTの値がボタン表現に反映されるようEventHandlerを設置 _this.attachEH2Input(); //ボタン押下がINPUTの値を変更するようEventHandlerを設置 _this.attachEH2Btn(); //最初から用意されているINPUT項目の初期値をボタンに反映(動的に生成される項目は生成時に実行されます) _this.shwInputVal(); //userIndicationのname変更(strutsから値を取得するのが目的のフィールドであり、値を取得しUIに反映したら不要となる) _this.incapacitateUserIndication(); //colorTableの一括選択ボタンのイベントハンドラ _this.colorTable_slctallHndlr(); //floating_results $('.floating_results').draggable(); _this.resultsDisplay = new ResultsDisplay(_this); _this.errorDisplay = new ErrorDisplay('error_wrapper', 'error_messages', null, _this.resultsDisplay.errorHandler); /* * ==================================== * EventHandlerとControlの設置 * ==================================== */ //quoteMethod(見積方法)ボタンのINPUTを押したとき固有のEventHandlerを設置 _this.attachEH2QuoteMethod(); //quoteMethod初期値による動作 _this.quoteMethodControl(); _this.attachEH2Quantity(); _this.quantityControl(); _this.attachEH2Shape(); _this.shapeControl(); _this.attachEH2WireUl(); _this.wireUlControl(); _this.attachEH2WireDiameter(); _this.wireDiameterControl(); _this.attachEH2SizeX(); _this.sizeXControl(); _this.attachEH2RightSideProcessing(); _this.rightSideProcessingControl(); _this.attachEH2LeftSideProcessing(); _this.leftSideProcessingControl(); _this.attachEH2LeftSideContactNo(); _this.leftSideContactNoControl(); _this.attachEH2LeftSideHousingNo(); _this.leftSideHousingNoControl(); _this.attachEH2RightSideContactNo(); _this.rightSideContactNoControl(); _this.attachEH2RightSideHousingNo(); _this.rightSideHousingNoControl(); _this.attachEH2Usage(); _this.usageControl(); _this.attachEH2OptionTwisted(); _this.optionTwistedControl(); _this.attachEH2OptionWiringPattern(); _this.optionWiringPatternControl(); new HnsSharedLink(_this); _this.loadingControl.appendLoadingAction(_this.quoteExeBtn.off); //loading開始時は「見積実行」が無効化される _this.loadingControl.appendAfterAction(_this.doLast); _this.loadingControlWhenLogin.appendLoadingAction(_this.quoteExeBtn.off); //loading開始時は「見積実行」が無効化される _this.loadingControlWhenLogin.appendAfterAction(_this.doLastWhenLogin); stopEstimateItems.notifyIfNeeded() } /* * loadingControlがexitする際に実行させる内容 */ this.doLast = function(){ _this.resetInGrayoutBlock(); //グレーアウトブロック内の項目をリセット _this.viewer.draw(); //設計図描画 _this.autoExec(); //見積を開いていたら再計算 _this.quoteExeBtn.on(); //loading完了時は「見積実行」が有効化される。 _this.contextNavi.init(); //loading完了時に右クリックメニューが用意される。 _this._disableUserIndication(); //loading完了時にuserIndicationエレメントの値を消す(#1905 副作用を止める) _this._adjustDisabler(); //loading完了時にdisabled表現(#blk_parts内の項目単位のグレーアウト) } this.doLastWhenLogin = function(){ _this.contextNavi.init(); //loading完了時に右クリックメニューが用意される。 _this._disableUserIndication(); //loading完了時にuserIndicationエレメントの値を消す(#1905 副作用を止める) } /* * ======================================================== * ボタンへのイベントハンドラと、コントローラ[START] * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */ /* * -------quoteMethod------------ */ this.attachEH2QuoteMethod = function(){ $('input[name=quoteMethod]').change(function(event){ //#933 clickイベントで動作させるとFirefoxでは新しい値が取れない。changeイベントで動作させるべき _this.quoteMethodControl(this.value); }); } this.quoteMethodControl = function(val,duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('quoteMethod'); } //レイアウト順序の変更と既存入力値(もしあれば)のリセット if(val=='0'){ _this.wireBasedLayout(); _this.resetPartsBlock(); }else{ _this.partsBasedLayout(); _this.resetWireBlock(); } _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); _this._wireUlOption(function(){ _this._wireDiameterOption(doAfter); }); } this.resetPartsBlock = function(){ _this._setVal('usage', '0'); _this._setVal('leftSidePartsMaker', ''); _this._setVal('leftSidePartsSeries', ''); _this._setVal('leftSideContactNo', ''); _this._setVal('leftSideHousingNo', ''); } this.resetWireBlock = function(){ _this._setVal('wireUl', 'NONE'); _this._setVal('wireDiameter', ''); } this.resetProcessingBlock = function(){ _this._setVal('rightSideProcessing', ''); _this._setVal('leftSideProcessing', ''); } /* * -------quantity------------ */ this.attachEH2Quantity = function(){ $('input[name=quantity]').change(function(event){ _this.quantityControl(); }); } this.quantityControl = function(){ _this.autoExec(); } /* * -------shape------------ */ this.attachEH2Shape = function(){ $('input[name=shape]').change(function(event){ _this.shapeControl(this.value); }); }; this.shapeControl = function(val,duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('shape'); } _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); _this.dispCon.displayControl('shape', null, duration); //disabled項目の値クリア _this._clearDisabledPartsAndProcessing(val); //optionWiringPattern 選択肢の取得 _this.optCon.optionControl('optionWiringPattern', {shape: val}); var doAfter2 = function(){ var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); var usageVal = _this._getVal('usage'); //leftSidePartsMaker 選択肢の取得 _this.optCon.optionControl('leftSidePartsMaker', { shape: val, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: usageVal }); //leftSidePartsSeries 選択肢の取得 var leftSidePartsMakerVal = _this._getVal('leftSidePartsMaker'); _this.optCon.optionControl('leftSidePartsSeries', { shape: val, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: usageVal, leftSidePartsMaker: leftSidePartsMakerVal }); //leftSideContactNo / leftSideHousingNo 選択肢の取得 var leftSidePartsSeriesVal = _this._getVal('leftSidePartsSeries'); _this.optCon.optionControl('leftSideContactNoOrLeftSideHousingNo', { shape: val, wireUl: wireUlVal, wireDiameter: wireDiameterVal, leftSidePartsSeries: leftSidePartsSeriesVal }); //rightSidePartsMakerは「leftSideContactNo / leftSideHousingNo」の変更があればそちらで再取得される。shapeだけの変更は影響しないはず。 //rightSidePartsSeriesはrightSidePartsMakerの変更があればそちらで再取得される。shapeだけの変更は影響しないはず。 //形状を変えたとき、コンタクト⇔ハウジングの変更がありうる(maker, seriesの変更に依存せず、shapeの変更に直接依存する) //rightSideContactNo / rightSideHousingNo 選択肢の取得 var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); var rightSidePartsSeriesVal = _this._getVal('rightSidePartsSeries'); _this.optCon.optionControl('rightSideContactNoOrRightSideHousingNo', { shape: val, wireUl: wireUlVal, wireDiameter: wireDiameterVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsSeries: rightSidePartsSeriesVal, }); //optionTwisted 選択肢の取得 _this.optCon.optionControl('optionTwisted', { shape: val, wireDiameter: wireDiameterVal, leftSideHousingNo: leftSideHousingNoVal, }); if(doAfter){ doAfter(); } } _this._wireUlOption(function(){ _this._wireDiameterOption(doAfter2); }); }; this._clearDisabledPartsAndProcessing = function(shapeVal){ if(shapeVal == '1'){ _this._setVal('leftSidePartsMaker', null); _this._setVal('leftSidePartsSeries', null); _this._setVal('leftSideContactNo', null); _this._setVal('leftSideHousingNo', null); _this._setVal('rightSidePartsMaker', null); _this._setVal('rightSidePartsSeries', null); _this._setVal('rightSideContactNo', null); _this._setVal('rightSideHousingNo', null); }else if(shapeVal == '2' || shapeVal == '3'){ _this._setVal('rightSidePartsMaker', null); _this._setVal('rightSidePartsSeries', null); _this._setVal('rightSideContactNo', null); _this._setVal('rightSideHousingNo', null); _this._setVal('leftSideProcessing', null); }else if(shapeVal == '4' || shapeVal == '5' || shapeVal == '6'){ _this._setVal('leftSideProcessing', null); _this._setVal('rightSideProcessing', null); } } /* * -------wireUl------------ */ this.attachEH2WireUl = function(){ $('input[name=wireUl]').change(function(event){ _this.wireUlControl(this.value); }); } this.wireUlControl = function(val,duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('wireUl'); } var doAfter2 = function(){ var shapeVal = _this._getVal('shape'); var wireDiameterVal = _this._getVal('wireDiameter'); var usageVal = _this._getVal('usage'); var leftSidePartsMakerVal = _this._getVal('leftSidePartsMaker'); var leftSidePartsSeriesVal = _this._getVal('leftSidePartsSeries'); //usage選択肢の取得 _this.optCon.optionControl('usage', { wireUl: val, wireDiameter: wireDiameterVal, }); //leftSidePartsMaker選択肢の取得 _this.optCon.optionControl('leftSidePartsMaker', { shape: shapeVal, wireUl: val, wireDiameter: wireDiameterVal, usage: usageVal }); //leftSidePartsSeries選択肢の取得 _this.optCon.optionControl('leftSidePartsSeries', { shape: shapeVal, wireUl: val, wireDiameter: wireDiameterVal, usage: usageVal, leftSidePartsMaker: leftSidePartsMakerVal }); //leftSideContactNo / leftSideHousingNo選択肢の取得 _this.optCon.optionControl('leftSideContactNoOrLeftSideHousingNo', { shape: shapeVal, wireUl: val, wireDiameter: wireDiameterVal, leftSidePartsSeries: leftSidePartsSeriesVal }); //rightSidePartsMaker選択肢の取得 var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); _this.optCon.optionControl('rightSidePartsMaker', { shape: shapeVal, wireUl: val, wireDiameter: wireDiameterVal, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal }); //rightSidePartsSeries選択肢の取得 var rightSidePartsMakerVal = _this._getVal('rightSidePartsMaker'); _this.optCon.optionControl('rightSidePartsSeries', { shape: shapeVal, wireUl: val, wireDiameter: wireDiameterVal, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsMaker: rightSidePartsMakerVal }); //rightSideContactNo / rightSideHousingNo選択肢の取得 var rightSidePartsSeriesVal = _this._getVal('rightSidePartsSeries'); _this.optCon.optionControl('rightSideContactNoOrRightSideHousingNo', { shape: shapeVal, wireUl: val, wireDiameter: wireDiameterVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsSeries: rightSidePartsSeriesVal }); if(doAfter){ doAfter(); } } _this._wireDiameterOption(doAfter2); //wireDiameter選択肢の取得 } /* * -------wireDiameter------------ */ this.attachEH2WireDiameter = function(){ $('input[name=wireDiameter]').change(function(event){ _this.wireDiameterControl(this.value); }); }; this.wireDiameterControl = function(val,duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('wireDiameter'); } _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); var usageVal = _this._getVal('usage'); var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); //usage 選択肢の取得 _this.optCon.optionControl('usage', { wireUl: wireUlVal, wireDiameter: val }); //leftSidePartsMaker 選択肢の取得 _this.optCon.optionControl('leftSidePartsMaker', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: val, usage: usageVal }); //leftSidePartsSeries 選択肢の取得 var leftSidePartsMakerVal = _this._getVal('leftSidePartsMaker'); _this.optCon.optionControl('leftSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: val, usage: usageVal, leftSidePartsMaker: leftSidePartsMakerVal }); //leftSideContactNo / leftSideHousingNo 選択肢の取得 var leftSidePartsSeriesVal = _this._getVal('leftSidePartsSeries'); _this.optCon.optionControl('leftSideContactNoOrLeftSideHousingNo', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: val, leftSidePartsSeries: leftSidePartsSeriesVal }); //rightSidePartsMaker選択肢の取得 var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); _this.optCon.optionControl('rightSidePartsMaker', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: val, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal }); //rightSidePartsSeries選択肢の取得 var rightSidePartsMakerVal = _this._getVal('rightSidePartsMaker'); _this.optCon.optionControl('rightSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: val, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsMaker: rightSidePartsMakerVal }); //rightSideContactNo / rightSideHousingNo選択肢の取得 var rightSidePartsSeriesVal = _this._getVal('rightSidePartsSeries'); _this.optCon.optionControl('rightSideContactNoOrRightSideHousingNo', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: val, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsSeries: rightSidePartsSeriesVal }); //optionTwisted 選択肢の取得 var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); _this.optCon.optionControl('optionTwisted', { shape: shapeVal, wireDiameter: val, leftSideHousingNo: leftSideHousingNoVal }); if(doAfter){ doAfter(); } }; /* * -------sizeX------------ */ this.attachEH2SizeX = function(){ $('input[name=sizeX]').change(function(event){ _this.sizeXControl(this.value); }); } this.sizeXControl = function(){ _this.autoExec(); _this.viewer.draw(); } /* * -------rightSideProcessing------------ */ this.attachEH2RightSideProcessing = function(){ $('input[name=rightSideProcessing]').change(function(event){ _this.rightSideProcessingControl(this.value); }); } this.rightSideProcessingControl = function(){ _this._adjustDisabler(); _this.viewer.draw(); _this.autoExec(); } /* * -------leftSideProcessing------------ */ this.attachEH2LeftSideProcessing = function(){ $('input[name=leftSideProcessing]').change(function(event){ _this.leftSideProcessingControl(this.value); }); } this.leftSideProcessingControl = function(){ _this._adjustDisabler(); _this.viewer.draw(); _this.autoExec(); } /* * -------usage------------ */ this.attachEH2Usage = function(){ $('input[name=usage]').change(function(event){ _this.usageControl(this.value); }); } this.usageControl = function(val,duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('usage'); } var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); var leftSidePartsMakerVal = _this._getVal('leftSidePartsMaker'); //leftSidePartsMaker 選択肢の取得 _this.optCon.optionControl('leftSidePartsMaker', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: val }); //leftSidePartsSeries 選択肢の取得 _this.optCon.optionControl('leftSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: val, leftSidePartsMaker: leftSidePartsMakerVal }); //rightSidePartsMaker選択肢の取得 var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); _this.optCon.optionControl('rightSidePartsMaker', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: val, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal }); //rightSidePartsSeries選択肢の取得 var rightSidePartsMakerVal = _this._getVal('rightSidePartsMaker'); _this.optCon.optionControl('rightSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: val, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsMaker: rightSidePartsMakerVal }); if(doAfter){ doAfter(); } } /* * -------leftSidePartsMaker------------ */ this.attachEH2LeftSidePartsMaker = function(){ $('input[name=leftSidePartsMaker]').change(function(event){ _this.leftSidePartsMakerControl(this.value); }); } this.leftSidePartsMakerControl = function(val, duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('leftSidePartsMaker'); } _this.dispCon.displayControl('leftSidePartsMaker', val, duration); var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); var usageVal = _this._getVal('usage'); //leftSidePartsSeries 選択肢の取得 _this.optCon.optionControl('leftSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: usageVal, leftSidePartsMaker: val }); if(doAfter){ doAfter(); } } /* * -------rightSidePartsMaker------------ */ this.attachEH2RightSidePartsMaker = function(){ $('input[name=rightSidePartsMaker]').change(function(event){ _this.rightSidePartsMakerControl(this.value); }); } this.rightSidePartsMakerControl = function(val, duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('rightSidePartsMaker'); } _this.dispCon.displayControl('rightSidePartsMaker', val, duration); var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); var usageVal = _this._getVal('usage'); var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); //rightSidePartsSeries 選択肢の取得 _this.optCon.optionControl('rightSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsMaker: val }); if(doAfter){ doAfter(); } } /* * -------leftSidePartsSeries------------ */ this.attachEH2LeftSidePartsSeries = function(){ $('input[name=leftSidePartsSeries]').change(function(event){ _this.leftSidePartsSeriesControl(this.value); }); } this.leftSidePartsSeriesControl = function(val, duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('leftSidePartsSeries'); } var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); //leftSideContactNo / leftSideHousingNo 選択肢の取得 _this.optCon.optionControl('leftSideContactNoOrLeftSideHousingNo', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, leftSidePartsSeries: val, }); if(doAfter){ doAfter(); } } /* * -------rightSidePartsSeries------------ */ this.attachEH2RightSidePartsSeries = function(){ $('input[name=rightSidePartsSeries]').change(function(event){ _this.rightSidePartsSeriesControl(this.value); }); } this.rightSidePartsSeriesControl = function(val, duration, doAfter){ if(val==null || val==undefined){ val = _this._getVal('rightSidePartsSeries'); } var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); //rightSideContactNo / rightSideHousingNo 選択肢の取得 _this.optCon.optionControl('rightSideContactNoOrRightSideHousingNo', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsSeries: val, }); if(doAfter){ doAfter(); } } /* * -------leftSideContactNo------------ */ this.attachEH2LeftSideContactNo = function(){ $('input[name=leftSideContactNo]').change(function(event){ _this.leftSideContactNoControl(this.value); }); }; this.leftSideContactNoControl = function(val,duration, doAfter){ _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); _this._doAfterLeftPartsControl(duration, doAfter); } /* * -------leftSideHousingNo------------ */ this.attachEH2LeftSideHousingNo = function(){ $('input[name=leftSideHousingNo]').change(function(event){ _this.leftSideHousingNoControl(this.value); }); }; this.leftSideHousingNoControl = function(val,duration, doAfter){ _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); _this._doAfterLeftPartsControl(duration, doAfter); }; this._doAfterLeftPartsControl = function(duration, doAfter){ var doAfter2 = function(){ var shapeVal = _this._getVal('shape'); var wireUlVal = _this._getVal('wireUl'); var wireDiameterVal = _this._getVal('wireDiameter'); var usageVal = _this._getVal('usage'); var leftSideContactNoVal = _this._getVal('leftSideContactNo'); var leftSideHousingNoVal = _this._getVal('leftSideHousingNo'); //rightSidePartsMaker 選択肢の取得 _this.optCon.optionControl('rightSidePartsMaker', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal }); //rightSidePartsSeries選択肢の取得 var rightSidePartsMakerVal = _this._getVal('rightSidePartsMaker'); _this.optCon.optionControl('rightSidePartsSeries', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, usage: usageVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsMaker: rightSidePartsMakerVal }); //rightSideContactNo / rightSideHousingNo選択肢の取得 var rightSidePartsSeriesVal = _this._getVal('rightSidePartsSeries'); _this.optCon.optionControl('rightSideContactNoOrRightSideHousingNo', { shape: shapeVal, wireUl: wireUlVal, wireDiameter: wireDiameterVal, leftSideContactNo: leftSideContactNoVal, leftSideHousingNo: leftSideHousingNoVal, rightSidePartsSeries: rightSidePartsSeriesVal }); //optionTwisted 選択肢の取得 _this.optCon.optionControl('optionTwisted', { shape: shapeVal, wireDiameter: wireDiameterVal, leftSideHousingNo: leftSideHousingNoVal }); if(doAfter){ doAfter(); } } _this._wireUlOption(function(){ _this._wireDiameterOption(doAfter2); }); } /* * -------rightSideContactNo------------ */ this.attachEH2RightSideContactNo = function(){ $('input[name=rightSideContactNo]').change(function(event){ _this.rightSideContactNoControl(this.value); }); }; this.rightSideContactNoControl = function(val,duration, doAfter){ _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); _this._wireUlOption(function(){ _this._wireDiameterOption(doAfter); }); } /* * -------rightSideHousingNo------------ */ this.attachEH2RightSideHousingNo = function(){ $('input[name=rightSideHousingNo]').change(function(event){ _this.rightSideHousingNoControl(this.value); }); }; this.rightSideHousingNoControl = function(val,duration, doAfter){ _this.dispCon.displayControl(['quoteMethod', 'shape', 'wireDiameter', 'leftSideContactNo', 'leftSideHousingNo', 'rightSideContactNo', 'rightSideHousingNo'], null, duration); _this._wireUlOption(function(){ _this._wireDiameterOption(doAfter); }); }; /* * -------optionTwisted------------ */ this.attachEH2OptionTwisted = function(){ $('input[name=optionTwisted]').change(function(event){ _this.optionTwistedControl(this.value); }); } this.optionTwistedControl = function(){ if(_this.viewer.validateTwistedWiring()){ _this.viewer.draw(); _this.autoExec(); }else{ _this.loadingControl.doIfExitted( /* * loading中の場合、viewer.validateTwistedWiringはハウジングが定まっておらず、 * 電線数を「0本」と不正に見積もる可能性があるため、アラートは出さない。 * loading中にアラートを出さねばならない状況は想定されす、 * ユーザーがツイスト加工を変更した時は、(loadingには入らず)必要に応じてこのアラートが出る。 */ function(){ alert('「ツイスト加工:あり」は、電線は2本以上が必要です。'); _this._setVal('optionTwisted', '0'); } ); } } /* * -------optionWiringPattern------------ */ this.attachEH2OptionWiringPattern = function(){ $('input[name=optionWiringPattern]').change(function(event){ _this.optionWiringPatternControl(this.value); }); } this.optionWiringPatternControl = function(){ _this.viewer.draw(); _this.autoExec(); } /* * 【UL】選択肢の導出について * 「電線の仕様から」の場合は依存はない/「ハウジング・コンタクトから」の場合は、以下に依存する。 * ・部品型番がある場合は「シリーズ」と「部品型番」(部品型番は不要かもしれないが一応渡す) * ・部品型番が ない場合(片側or両側コンタクトの場合)は「部品シリーズ」のみ * ・部品型番もシリーズもない場合(電線のみの場合)は依存はない */ this._wireUlOption = function(doAfter){ var quoteMethod = _this._getVal('quoteMethod'); var shape = _this._getVal('shape'); if(shape == null || shape == undefined){ return; } var leftSidePartsSeries = null; var leftSideContactNo = null; var leftSideHousingNo = null; var rightSidePartsSeries = null; var rightSideContactNo = null; var rightSideHousingNo = null; if(quoteMethod == '1'){ if(shape == '1'){ //依存なし }else{ //leftSidePartsSeries,rightSidePartsSeriesに依存(leftSideHousingNo,rightSideHousingNoも一応) leftSidePartsSeries = _this._getVal('leftSidePartsSeries'); leftSideContactNo = _this._getVal('leftSideContactNo'); leftSideHousingNo = _this._getVal('leftSideHousingNo'); rightSidePartsSeries = _this._getVal('rightSidePartsSeries'); rightSideContactNo = _this._getVal('rightSideContactNo'); rightSideHousingNo = _this._getVal('rightSideHousingNo'); } } _this.optCon.optionControl('wireUl', { shape: shape, leftSidePartsSeries: leftSidePartsSeries, leftSideContactNo: leftSideContactNo, leftSideHousingNo: leftSideHousingNo, rightSidePartsSeries: rightSidePartsSeries, rightSideContactNo: rightSideContactNo, rightSideHousingNo: rightSideHousingNo, }, doAfter); } /* * 【サイズ】の選択肢の導出について * * 「電線の仕様から」の場合は、「UL」にだけ依存する/「ハウジング・コンタクトから」の場合は、以下に依存する。 * ・部品型番がある場合は「ULと部品型番」 * ・部品型番が ない場合(片側or両側コンタクトの場合)は「ULと部品シリーズ」、 * ・部品型番もシリーズもない場合(電線のみの場合)は「UL」だけに依存する */ this._wireDiameterOption = function(doAfter){ var quoteMethod = _this._getVal('quoteMethod'); var shape = _this._getVal('shape'); if(shape == null || shape == undefined){ return; } var wireUl = _this._getVal('wireUl'); var leftSidePartsSeries = null; var leftSideContactNo = null; var leftSideHousingNo = null; var rightSidePartsSeries = null; var rightSideContactNo = null; var rightSideHousingNo = null; if(quoteMethod == '1'){ if(shape == '1'){ //shape,ULにだけ依存 }else{ //shape,ULとleftSidePartsSeries,leftSideHousingNo,rightSidePartsSeries,rightSideHousingNoに依存 leftSidePartsSeries = _this._getVal('leftSidePartsSeries'); leftSideContactNo = _this._getVal('leftSideContactNo'); leftSideHousingNo = _this._getVal('leftSideHousingNo'); rightSidePartsSeries = _this._getVal('rightSidePartsSeries'); rightSideContactNo = _this._getVal('rightSideContactNo'); rightSideHousingNo = _this._getVal('rightSideHousingNo'); } } _this.optCon.optionControl('wireDiameter', { shape: shape, wireUl: wireUl, leftSidePartsSeries: leftSidePartsSeries, leftSideContactNo: leftSideContactNo, leftSideHousingNo: leftSideHousingNo, rightSidePartsSeries: rightSidePartsSeries, rightSideContactNo: rightSideContactNo, rightSideHousingNo: rightSideHousingNo, }, doAfter); } /* * optionの読み込みが完了し、表示が確定したら、グレーブロックの中の選択内容をリセットする。 * ただし、この操作をsetTimeoutなしに実行すると、不正にリセットされてしまう現象が発生する。 * 【推測される原因1】グレーのオーバーレイはアニメーションで消している為、消している最中は、オーバーレイがvisible(つまりグレーアウト状態)と判定されてしまう。 * 【推測される原因2】LoadingControlのloading→exit→loading→exitと繰り返す際の、途中のexitで実行されるとNG */ this.resetInGrayoutBlock = function(){ var exection = function(){ if(!_this.loadingControl.isLoading()){ if( $('#gray_wire_reqParts:visible').length > 0 || $('#gray_wire_reqBasic:visible').length > 0 ){ _this.resetWireBlock(); } if( $('#gray_parts_reqWire:visible').length > 0 || $('#gray_parts_reqBasic:visible').length > 0 ){ _this.resetPartsBlock(); _this.resetProcessingBlock(); } } }; setTimeout(exection, 1000); } this._adjustDisabler = function(){ // executionを即時実行した後、0.5秒後に再実行して終了します。 // 即時の動作が好ましいが、option追加によるHTML再描画が間に合っていないケースがあるようなので再実行を入れています。 var execution = function(){ if(execution.count > 1){ return; } execution.count++; if(!_this.loadingControl.isLoading()){ var origin = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:first-child > TH:first-child').offset(); var offset = {'top':origin.top, 'left':origin.left}; _this._adjustDisabler_leftParts(offset); _this._adjustDisabler_rightParts(offset); _this._adjustDisabler_leftProcessing(offset); _this._adjustDisabler_rightProcessing(offset); setTimeout(execution, 500); } }; execution.count = 0; execution(); } this._adjustDisabler_leftParts = function(originOffset){ var topleftcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(3) > TH:nth-child(2)'); var bottomrightcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(5) > TD:nth-child(2)'); _this._adjustDisabler_cmn($('#disabled_leftParts'), originOffset, topleftcell, bottomrightcell); } this._adjustDisabler_rightParts = function(originOffset){ var topleftcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(3) > TH:nth-child(4)'); var bottomrightcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(5) > TD:nth-child(4)'); _this._adjustDisabler_cmn($('#disabled_rightParts'), originOffset, topleftcell, bottomrightcell); } this._adjustDisabler_leftProcessing = function(originOffset){ var topleftcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(6) > TH:nth-child(2)'); var bottomrightcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(6) > TD:nth-child(3)'); _this._adjustDisabler_cmn($('#disabled_leftProcessing'), originOffset, topleftcell, bottomrightcell); } this._adjustDisabler_rightProcessing = function(originOffset){ var topleftcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(6) > TH:nth-child(4)'); var bottomrightcell = $('DIV#cat_wrapper_parts > TABLE > TBODY > TR:nth-child(6) > TD:nth-child(5)'); _this._adjustDisabler_cmn($('#disabled_rightProcessing'), originOffset, topleftcell, bottomrightcell); } this._adjustDisabler_cmn = function(target, originOffset, topleftcell, bottomrightcell){ target .css('top', topleftcell.offset().top - originOffset.top) .css('left', topleftcell.offset().left - originOffset.left) .css('width', bottomrightcell.offset().left - topleftcell.offset().left + bottomrightcell.outerWidth()) .css('height', bottomrightcell.offset().top - topleftcell.offset().top + bottomrightcell.outerHeight()); } /* * ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ * ボタンへのイベントハンドラと、コントローラ[END] * ======================================================== */ /* * ======================================================== * 個別の動作定義[START] * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */ /* * 縦スクロール時のUI表現をコントロールします。 */ this.scrollControl = function(){ _this.scrollGimmick.stop(); _this.scrollGimmick.initStaticHeader($('#navi'), $('#header').height()); _this.scrollGimmick.initNaviIndication(_this.formBlockArray, 50); _this.scrollGimmick.start(); } this.alternate1 = $('#alternate1'); this.alternate2 = $('#alternate2'); this.basicNavi = $('#navi_basic'); this.wireNavi = $('#navi_wire'); //this.wireHead = $('#head_wire'); this.wireBlk = $('#blk_wire'); this.partsNavi = $('#navi_parts'); /*this.partsHead = $('#head_parts');*/ this.partsBlk = $('#blk_parts'); this.optionsNavi = $('#navi_options'); //this.optionsHead = $('#head_options'); this.optionsBlk = $('#blk_options'); this.figureNavi = $('#navi_figure'); //this.figureHead = $('#head_figure'); this.figureBlk = $('#blk_figure'); this.execNavi = $('#step_last'); this.wireBasedLayout = function(){ //navi buttons _this._reOrderNavi_wirePrimal() //「部品」category blocksの後方移動 _this.alternate2/*.append(_this.partsHead)*/.append(_this.partsBlk); //順番の記憶 _this.initFormBlockArray(); _this.formBlockArray.push($('#blk_basic')); _this.formBlockArray.push($('#blk_wire')); _this.formBlockArray.push($('#blk_processing')); _this.formBlockArray.push($('#blk_parts')); _this.formBlockArray.push($('#blk_options')); _this.formBlockArray.push($('#blk_figure')); //scrollGimmickのリセット _this.scrollControl(); } this.partsBasedLayout = function(){ //navi buttons _this._reOrderNavi_partsPrimal(); //「部品」category blocksの前方移動 _this.alternate1/*.append(_this.partsHead)*/.append(_this.partsBlk); //順番の記憶 _this.initFormBlockArray(); _this.formBlockArray.push($('#blk_basic')); _this.formBlockArray.push($('#blk_parts')); _this.formBlockArray.push($('#blk_wire')); _this.formBlockArray.push($('#blk_processing')); _this.formBlockArray.push($('#blk_options')); _this.formBlockArray.push($('#blk_figure')); //scrollGimmickのリセット _this.scrollControl(); } /* * ナビボタンをアニメーションで動かした後(ギミックのみでHTMLの構造・順序はそのまま) * アニメーションに使ったマージン設定をリセットしつつ、ボタンの再配置(appendによる)を行う。 * (_reOrderNavi_wirePrimalの逆の動作) */ this._reOrderNavi_partsPrimal = function(){ if($('DIV#menu_wrapper > DIV:nth-child(2)[id=navi_parts]').length == 1){ return; //2番目に「部品型番・先端加工」ボタンが既に配置されていたら動作不要 } _this.loadingControl.entryLoading(); var duration = 200; //「部品型番・先端加工」ナビボタンを動かした後、アニメーションに使ったマージン設定をリセットしつつ、ボタンの再配置(appendによる)を行う。 _this.partsNavi.animate( {marginTop:'35px'}, duration, //「部品型番・先端加工」を下へ移動 function(){ _this.wireNavi.animate( {marginLeft:'156px'},duration //「電線選択」を右へ移動 ); _this.partsNavi.animate( {marginLeft:'-303px'}, duration, //「部品型番・先端加工」を左へ移動 function(){ _this.partsNavi.animate( {marginTop:'0px'}, duration, //「部品型番・先端加工」を上へ移動 function(){ //再配置とマージン設定のリセット $('#menu_wrapper').append(_this.basicNavi) .append(_this.partsNavi.css('marginLeft','3px')) .append(_this.wireNavi.css('margin-left', '3px')) .append(_this.optionsNavi) .append(_this.figureNavi) .append(_this.execNavi); _this.loadingControl.exitLoading(); } ); } ); } ); } /* * ナビボタンをアニメーションで動かした後(ギミックのみでHTMLの構造・順序はそのまま) * アニメーションに使ったマージン設定をリセットしつつ、ボタンの再配置(appendによる)を行う。 * (_reOrderNavi_partsPrimalの逆の動作) */ this._reOrderNavi_wirePrimal = function(){ if($('DIV#menu_wrapper > DIV:nth-child(2)[id=navi_wire]').length == 1){ return; //2番目に「電線選択」ボタンが既に配置されていたら動作不要 } _this.loadingControl.entryLoading(); var duration = 200; _this.partsNavi.animate( {marginTop:'35px'}, duration, //「部品型番・先端加工」を下へ移動 function(){ _this.wireNavi.animate( {marginLeft:'-147px'},duration //「電線選択」を左へ移動 ); _this.optionsNavi.animate( {marginLeft:'156px'},duration //「オプション」以右を動かさない ); _this.partsNavi.animate( //「部品型番・先端加工」を右へ移動。同時に「オプション」以右を動かさないようにmargin-rightを調整 {marginLeft:'156px', marginRight:'-156px'}, duration, function(){ _this.partsNavi.animate( {marginTop:'0px'}, duration, //「部品型番・先端加工」を上へ移動 function(){ //再配置とマージン設定のリセット $('#menu_wrapper').append(_this.basicNavi) .append(_this.wireNavi.css('margin-left', '3px')) .append(_this.partsNavi.css('marginLeft','3px').css('margin-right', '0px')) .append(_this.optionsNavi.css('margin-left', '3px')) .append(_this.figureNavi) .append(_this.execNavi); _this.loadingControl.exitLoading(); } ); } ); } ); } this.colorTable_slctallHndlr = function(){ $('SELECT[name=cl_all]').on('change',function(){ if(this.value != null && this.value != ''){ for(var i=0; i < _this.wireCount(); i++){ _this._setVal('cl_'+i, this.value); } } }); } this.exec = function(){ $.ajax({ type:"POST", url:actionUrl_exec, data:_this.buildArg_customized(), dataType:"json", success:function(msg){ if(msg.isError){ _this.errorDisplay.setError(msg.messages); }else{ //errorをクリアー _this.errorDisplay.setError(null); } _this.contextNavi.init(); _this.resultsDisplay.show(msg); }, error:function(msg){ } }); } this.buildArg_customized = function(requiredHiddens){ var arg = _this.buildArg(requiredHiddens); var colors = []; for(var i=0; ; i++){ var v = arg['cl_' + i]; if(v == undefined || v == null){ break; } colors.push(v); } arg.colors = JSON.stringify(colors); return arg; } this.autoExec = function(){ if(_this.resultsDisplay.opened && _this.autoExec.timerId == null){ _this.autoExec.timerId = setTimeout( function(){ _this.resultsDisplay.hide(); //resultDisplayが表示されている間は、見積実行ボタンは禁止されている。非表示にして実行準備 _this.quoteExeBtn.safeExecute(); _this.autoExec.timerId = null; }, 1000 ); } } this.autoExec.timerId; this.save = function(){ $('body') .formGen({ method:'POST', url: actionUrl_save, data: _this.buildArg_customized() }) .formGen('submit'); } /* * ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ * 個別の動作定義[END] * ======================================================== */ /* * ======================================================== * 情報アクセス[START] * ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */ this.wireCount = function(){ var cnt = 0; var shapeVal = _this._getVal('shape'); if(shapeVal == null || shapeVal == undefined || shapeVal == ''){ cnt = 0; }else if( shapeVal == '1' || shapeVal == '2' || shapeVal == '5' ){ cnt = 1; }else{ var _leftSideHousingNo = _this._getVal('leftSideHousingNo'); if(_leftSideHousingNo){ var _r = _this.getPinNumberingArrays(); var pinNumArray = eval(_r.left_side_pin_numbering_array); cnt = pinNumArray.length; } } return cnt; } this.getPinNumberingArrays = function(){ var result = null; var _shape = _this._getVal('shape'); var _leftSideHousingNo = _this._getVal('leftSideHousingNo'); var _rightSideHousingNo = _this._getVal('rightSideHousingNo'); if(_leftSideHousingNo){ $.ajax({ type:'POST', url:actionUrl_pinNumberingArray, data:{'shape':_shape, 'leftSideHousingNo':_leftSideHousingNo, 'rightSideHousingNo':_rightSideHousingNo}, dataType:"json", async:false, success:function(msg){ result = msg; }, error:function(msg){ } }); } return result; } this.getLeftProcessing = function(){ var label = null; var shapeVal = _this._getVal('shape'); if(shapeVal == '1'){ var p1 = _this._getVal('leftSideProcessing'); //leftSideProcessingの絵が左をむいているので、そちらを取得する。 label = _this.processingLab(p1); } if(label != null && label.length > 8){ label = label.replace(' + ', '\n + '); } return label; } this.getRightProcessing = function(){ var label = null; var shapeVal = _this._getVal('shape'); if(shapeVal == '1'){ var p = _this._getVal('rightSideProcessing'); //rightSideProcessingの絵が右をむいているので、そちらを取得する。 label = _this.processingLab(p); }else if(shapeVal == '2' || shapeVal == '3'){ var p = _this._getVal('rightSideProcessing'); label = _this.processingLab(p); } if(label != null && label.length > 8){ label = label.replace(' + ', '\n + '); } return label; } this.processingLab = function(processingVal){ if(processingVal == '1'){ return '切り落とし'; }else if(processingVal == '2'){ return '電線剥き(5.0mm)'; }else if(processingVal == '3'){ return '電線剥き(5.0mm) + 予備はんだ'; }else{ return null; } } this.wireUlLab = function(wireUl){ if(wireUl == 'NONE'){ return '指定なし'; }else if(wireUl == 'UL1007'){ return 'UL1007'; }else if(wireUl == 'UL1015'){ return 'UL1015'; }else if(wireUl == 'UL1061'){ return 'UL1061'; }else if(wireUl == 'UL1571'){ return 'UL1571'; } } this.wireDiameterLab = function(wireDiameter){ if(wireDiameter == 'AWG30'){ return 'AWG30'; }else if(wireDiameter == 'AWG28'){ return 'AWG28'; }else if(wireDiameter == 'AWG26'){ return 'AWG26'; }else if(wireDiameter == 'AWG24'){ return 'AWG24'; }else if(wireDiameter == 'AWG22'){ return 'AWG22'; }else if(wireDiameter == 'AWG20'){ return 'AWG20'; }else if(wireDiameter == 'AWG18'){ return 'AWG18'; }else if(wireDiameter == 'AWG16'){ return 'AWG16'; }else if(wireDiameter == 'AWG14'){ return 'AWG14'; } } this.getLeftContactNo = function(){ var shape = _this._getVal('shape'); //左が部品無しの場合はNULLを返す if(shape == '1'){ return null; } //左がコンタクトの場合は、選択されたコンタクト型番をそのまま返す else if(shape == '2' || shape == '5'){ return _this._getVal('leftSideContactNo'); } //右がハウジングの場合は、ハウジング型番からコンタクト型番を引く else{ return _this._getContactNoByHousingNo('leftSideHousingNo'); } } this.getRightContactNo = function(){ var shape = _this._getVal('shape'); //右が部品無しの場合はNULLを返す if(shape == '1' || shape == '2' || shape == '3'){ return null; } //右がコンタクトの場合は、選択されたコンタクト型番をそのまま返す else if(shape == '4' || shape == '5'){ return _this._getVal('rightSideContactNo'); } //右がハウジングの場合は、ハウジング型番からコンタクト型番を引く else{ return _this._getContactNoByHousingNo('rightSideHousingNo'); } } this._getContactNoByHousingNo = function(propName){ var contactNo = null; var housingNo = _this._getVal(propName); var wireDiameter = _this._getVal('wireDiameter'); if(housingNo){ $.ajax({ type:'POST', url:actionUrl_contactNo, data:_this._contactNoActionArgs(propName, housingNo, wireDiameter), dataType:"json", async:false, success:function(msg){ if(propName == 'leftSideHousingNo'){ contactNo = msg.left_side_contact_no; }else if(propName == 'rightSideHousingNo'){ contactNo = msg.right_side_contact_no; } }, error:function(msg){ } }); } return contactNo; } /* 戻り値は以下の形式 * {'[left | right]SideHousingNo':≪housingNo≫, 'wireDiameter':≪wireDiameter≫} */ this._contactNoActionArgs = function(housingNoPropName, housingNo, wireDiameter){ var arg = new Object(); arg[housingNoPropName] = housingNo; arg.wireDiameter = wireDiameter; return arg; } this.optionWiringPatternLab = function(optionWiringPattern){ if(optionWiringPattern == '1'){ return 'ストレート'; }else if(optionWiringPattern == '2'){ return 'クロス'; }else{ return ''; } } /* * ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ * 情報アクセス[END] * ======================================================== */ } HnsQuote.prototype = new AbstractQuote();