Показать сообщение отдельно
  #33 (permalink)  
Старый 15.05.2014, 22:24
Новичок на форуме
Отправить личное сообщение для kazemir Посмотреть профиль Найти все сообщения от kazemir
 
Регистрация: 15.05.2014
Сообщений: 2

калькулятор для подбора типоразмера шин
<!doctype html>
<html ng-app>
<head>
<meta charset="utf-8">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<script src="http://code.angularjs.org/1.1.5/angular.min.js"></script>
<script language="javascript" type="text/javascript">
      function TireController($scope) {        
        //набор 1
        var IVALUE = 25.4;
        var I2VALUE = 0.02;
        $scope.sectionWidthSet1 = 0; 
        $scope.aspectRatioSet1 = 0;
        $scope.rimDiameter_Inch_Set1 = 0;
        //набор 2
        $scope.sectionWidthSet2 = 0;
        $scope.aspectRatioSet2 = 0;
        $scope.rimDiameter_Inch_Set2 = 0;
        //расчетные данные
        $scope.rimHeight_mm_Set1;
        $scope.innDiameterSet1;
        $scope.extDiameterSet1;
        $scope.rimHeight_mm_Set2;
        $scope.innDiameterSet2;
        $scope.extDiameterSet2;
        $scope.roadClearance;
        $scope.computing=function(){  
           // Внутренний диаметр, мм                                
           $scope.innDiameterSet1 = Math.round($scope.rimDiameter_Inch_Set1 * IVALUE);
           $scope.innDiameterSet2 = Math.round($scope.rimDiameter_Inch_Set2 * IVALUE);  
          // Внешний диаметр, мм
          $scope.extDiameterSet1 = Math.round($scope.sectionWidthSet1 * $scope.aspectRatioSet1 * I2VALUE + $scope.innDiameterSet1);
          $scope.extDiameterSet2 = Math.round($scope.sectionWidthSet2 * $scope.aspectRatioSet2 * I2VALUE + $scope.innDiameterSet2);
          //Высота профиля, мм
          $scope.rimHeight_mm_Set1 = Math.round(($scope.extDiameterSet1 - $scope.innDiameterSet1)/2);
          $scope.rimHeight_mm_Set2 = Math.round(($scope.extDiameterSet2 - $scope.innDiameterSet2)/2);
          //Изменение значения клиренса
          $scope.roadClearance = ( $scope.extDiameterSet2 - $scope.extDiameterSet1 )/2;
        }
        //do calculation
        $scope.computing();
      }
    </script>
</head>
<body>
<div ng-controller="TireController">
    <div class="container">
        <div class="row">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="col-md-5 col-md-offset-1">
                        <b>Старый размер</b>:
                        <select class="form-control" ng-model="sectionWidthSet1" ng-change="computing()">
                            <option value="145">145</option>
                            <option value="155">155</option>
                            <option value="165">165</option>
                            <option selected="selected" value="175">175</option>
                            <option value="185">185</option>
                            <option value="195">195</option>
                            <option value="205">205</option>
                            <option value="215">215</option>
                            <option value="225">225</option>
                            <option value="235">235</option>
                            <option value="245">245</option>
                            <option value="255">255</option>
                            <option value="265">265</option>
                            <option value="275">275</option>
                            <option value="285">285</option>
                            <option value="295">295</option>
                            <option value="305">305</option>
                            <option value="315">315</option>
                            <option value="325">325</option>
                        </select>
                         &nbsp;/
                        <select class="form-control" ng-model="aspectRatioSet1" ng-change="computing()">
                            <option value="0">&mdash;</option>
                            <option value="25">25</option>
                            <option value="30">30</option>
                            <option value="35">35</option>
                            <option value="40">40</option>
                            <option value="45">45</option>
                            <option value="50">50</option>
                            <option value="55">55</option>
                            <option value="60">60</option>
                            <option value="65">65</option>
                            <option selected="selected" value="70">70</option>
                            <option value="75">75</option>
                            <option value="80">80</option>
                            <option value="85">85</option>
                        </select>
                         &nbsp;R
                        <select class="form-control" ng-model="rimDiameter_Inch_Set1" ng-change="computing()">
                            <option value="12">12</option>
                            <option selected="selected" value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option>
                            <option value="21">21</option>
                            <option value="22">22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                        </select>
                        <br>
                    </div>
                    <div class="col-md-5">
                        <b>Новый размер</b>:
                        <select class="form-control" ng-model="sectionWidthSet2" ng-change="computing()">
                            <option value="145">145</option>
                            <option value="155">155</option>
                            <option value="165">165</option>
                            <option selected="selected" value="175">175</option>
                            <option value="185">185</option>
                            <option value="195">195</option>
                            <option value="205">205</option>
                            <option value="215">215</option>
                            <option value="225">225</option>
                            <option value="235">235</option>
                            <option value="245">245</option>
                            <option value="255">255</option>
                            <option value="265">265</option>
                            <option value="275">275</option>
                            <option value="285">285</option>
                            <option value="295">295</option>
                            <option value="305">305</option>
                            <option value="315">315</option>
                            <option value="325">325</option>
                        </select>
                         &nbsp;/
                        <select class="form-control" ng-model="aspectRatioSet2" ng-change="computing()">
                            <option value="0">&mdash;</option>
                            <option value="25">25</option>
                            <option value="30">30</option>
                            <option value="35">35</option>
                            <option value="40">40</option>
                            <option value="45">45</option>
                            <option value="50">50</option>
                            <option value="55">55</option>
                            <option value="60">60</option>
                            <option value="65">65</option>
                            <option selected="selected" value="70">70</option>
                            <option value="75">75</option>
                            <option value="80">80</option>
                            <option value="85">85</option>
                        </select>
                         &nbsp;R
                        <select class="form-control" ng-model="rimDiameter_Inch_Set2" ng-change="computing()">
                            <option value="12">12</option>
                            <option selected="selected" value="13">13</option>
                            <option value="14">14</option>
                            <option value="15">15</option>
                            <option value="16">16</option>
                            <option value="17">17</option>
                            <option value="18">18</option>
                            <option value="19">19</option>
                            <option value="20">20</option>
                            <option value="21">21</option>
                            <option value="22">22</option>
                            <option value="23">23</option>
                            <option value="24">24</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
Ответить с цитированием