LengthCalculator.vue 21.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
<template>
  <div class="border-gray-200 w-[90%] m-auto sm:w-[800px] relative pb-12">
    <a-tabs v-model:activeKey="activeKey">
      <a-tab-pane key="1" tab="锂片重量和片数计算">
        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            基础数据
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂片密度</span>
                {{ lithiumWaferDensity + ' g/cm3' }}
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">直径</span>
                <a-input-number v-model:value="diameter">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">厚度</span>
                <a-input-number v-model:value="thickness">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>
          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据重量算片数
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">片数</span>
                <a-input-number v-model:value="numberOfPieces">
                  <template #addonAfter>片</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">重量</span>
                {{ weight + ' g' }}
              </div>
            </div>
          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据重量算片数
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求重量</span>
                <a-input-number v-model:value="requiredWeight">
                  <template #addonAfter>g</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求片数</span>
                {{ numberOfRequiredPieces + ' 片' }}
              </div>
            </div>
          </a-form>
        </div>
      </a-tab-pane>

      <a-tab-pane key="2" tab="锂带重量和米数计算" force-render>
        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            基础数据
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂带密度</span>
                {{ lithiumStripDensity2 + ' g/cm3' }}
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">厚度</span>
                <a-input-number v-model:value="thickness2">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">宽度</span>
                <a-input-number v-model:value="width2">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>

          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据米数算重量
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">米数</span>
                <a-input-number v-model:value="length2">
                  <template #addonAfter>m</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">重量</span>
                {{ weight2 + ' g' }}
              </div>
            </div>
          </a-form>
        </div>


        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据重量算米数
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求重量</span>
                <a-input-number v-model:value="demandWeight2">
                  <template #addonAfter>g</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求米数</span>
                {{ demandLength2 + ' m' }}
              </div>
            </div>
          </a-form>
        </div>
      </a-tab-pane>

      <a-tab-pane key="3" tab="铜锂复合带重量和米数计算">
        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            铜锂复合带产品重量和米数计算
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂带密度</span>
                {{ lithiumStripDensity3 + ' g/cm3' }}
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">铜箔密度</span>
                {{ copperFoilDensity3 + ' g/cm3' }}
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂带厚度</span>
                <a-input-number v-model:value="lithiumStripThickness3">
                  <template #addonAfter>um</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">铜箔厚度</span>
                <a-input-number v-model:value="copperFoilThickness3">
                  <template #addonAfter>um</template>
                </a-input-number>
              </div>
            </div>


            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂带宽度</span>
                <a-input-number v-model:value="lithiumStripWidth3">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">铜箔宽度</span>
                <a-input-number v-model:value="copperFoilWidth3">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂带层数</span>
                <a-input-number v-model:value="lithiumStripLayers3">
                  <template #addonAfter>层</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">米数</span>
                <a-input-number v-model:value="length3">
                  <template #addonAfter>m</template>
                </a-input-number>
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">锂带重量</span>
                {{ lithiumStripWeight3 + ' g' }}
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">铜箔重量</span>
                {{ copperFoilWeight3 + ' g' }}
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">总重量</span>
                {{ totalWeight3 + ' g' }}
              </div>
            </div>
          </a-form>
        </div>

      </a-tab-pane>

      <a-tab-pane key="4" tab="铜箔重量和米数计算">
        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            基础数据
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">铜箔密度</span>
                {{ copperFoilDensity4 + ' g/cm3' }}
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">厚度</span>
                <a-input-number v-model:value="thickness4">
                  <template #addonAfter>um</template>
                </a-input-number>
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">宽度</span>
                <a-input-number v-model:value="width4">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>

          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据米数算重量
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">米数</span>
                <a-input-number v-model:value="length4">
                  <template #addonAfter>m</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">重量</span>
                {{ weight4 + ' kg' }}
              </div>
            </div>
          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据重量算米数
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求重量</span>
                <a-input-number v-model:value="demandWeight4">
                  <template #addonAfter>kg</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求米数</span>
                {{ demandLength4 + ' m' }}
              </div>
            </div>
          </a-form>
        </div>

      </a-tab-pane>

      <a-tab-pane key="5" tab="铝箔重量和米数计算">
        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            基础数据
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">铝箔密度</span>
                {{ aluminumFoilDensity5 + ' g/cm3' }}
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">厚度</span>
                <a-input-number v-model:value="aluminumFoilThickness5">
                  <template #addonAfter>um</template>
                </a-input-number>
              </div>
            </div>

            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">宽度</span>
                <a-input-number v-model:value="aluminumFoilWidth5">
                  <template #addonAfter>mm</template>
                </a-input-number>
              </div>
            </div>


          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据米数算重量
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">米数</span>
                <a-input-number v-model:value="aluminumFoilLength5">
                  <template #addonAfter>m</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">重量</span>
                {{ aluminumFoilWeight5 + ' kg' }}
              </div>
            </div>
          </a-form>
        </div>

        <div class="p-2 mb-4 bg-gray-100 rounded-lg shadow-sm">
          <h3 class="pl-2 font-bold my-3 text-[16px]">
            根据重量算米数
          </h3>
          <a-form>
            <div class="flex flex-wrap">
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求重量</span>
                <a-input-number v-model:value="demandAluminumFoilWeight5">
                  <template #addonAfter>kg</template>
                </a-input-number>
              </div>
              <div class="flex items-center w-full md:w-1/2">
                <span class="inline-block w-[110px] mr-6 text-right text-gray-700 py-2">需求米数</span>
                {{ demandAluminumFoilLength5 + ' m' }}
              </div>
            </div>
          </a-form>
        </div>
      </a-tab-pane>
    </a-tabs>

    <div class="fixed left-0 flex justify-end w-full bottom-4">
      <div class="w-[90%] sm:w-[800px] m-auto text-right">
        <a-button type="primary" @click="handleSave" class="bg-[#1677ff] w-[85px]">
          计算
        </a-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { FloatAdd, FloatDiv, FloatMul, FloatSub, roundToDecimal } from '../utils/NumberUtils'
document.title = "理论数据计算器";

const activeKey = ref("1");
const PI = 3.1415926;

const lithiumWaferDensity = ref(0.534);
const diameter = ref(18);
const thickness = ref(1);
const numberOfPieces = ref(2000);
const weight = ref(272);
const requiredWeight = ref(100);
const numberOfRequiredPieces = ref(736);

const lithiumStripDensity2 = ref(0.534);
const thickness2 = ref(0.05);
const width2 = ref(100);
const length2 = ref(47);
const weight2 = ref(125);
const demandWeight2 = ref(50);
const demandLength2 = ref(18.7);

const lithiumStripDensity3 = ref(0.534);
const copperFoilDensity3 = ref(8.9);
const lithiumStripThickness3 = ref(50);
const copperFoilThickness3 = ref(8);
const lithiumStripWidth3 = ref(65);
const copperFoilWidth3 = ref(80);
const lithiumStripLayers3 = ref(1);
const length3 = ref(13.0);
const lithiumStripWeight3 = ref(23);
const copperFoilWeight3 = ref(74);
const totalWeight3 = ref(97);

const copperFoilDensity4 = ref(8.9);
const thickness4 = ref(8);
const width4 = ref(250);
const length4 = ref(100);
const weight4 = ref(1.780);
const demandWeight4 = ref(5);
const demandLength4 = ref(281);

const aluminumFoilDensity5 = ref(2.7);
const aluminumFoilThickness5 = ref(12);
const aluminumFoilWidth5 = ref(240);
const aluminumFoilLength5 = ref(300);
const aluminumFoilWeight5 = ref(2.333);
const demandAluminumFoilWeight5 = ref(3);
const demandAluminumFoilLength5 = ref(386);



const handleSave = async () => {

  //重量计算
  let weightTemp1 = FloatMul(lithiumWaferDensity.value, PI);
  let weightTemp2 = FloatDiv(diameter.value, 10);
  let weightTemp3 = FloatDiv(weightTemp2, 2);
  weight.value = roundToDecimal(FloatMul(FloatDiv(FloatMul(FloatMul(FloatMul(weightTemp1, weightTemp3), weightTemp3), thickness.value), 10), numberOfPieces.value), 1);

  //需求片数计算
  let numberOfRequiredPiecesTemp1 = FloatDiv(requiredWeight.value, lithiumWaferDensity.value);
  let numberOfRequiredPiecesTemp2 = FloatDiv(FloatDiv(diameter.value, 10), 2);
  let numberOfRequiredPiecesTemp3 = FloatMul(FloatMul(numberOfRequiredPiecesTemp2, PI), numberOfRequiredPiecesTemp2);
  let numberOfRequiredPiecesTemp4 = FloatMul(numberOfRequiredPiecesTemp3, thickness.value);
  numberOfRequiredPieces.value = roundToDecimal(FloatDiv(numberOfRequiredPiecesTemp1, FloatDiv(numberOfRequiredPiecesTemp4, 10)), 1);

  //根据米数算重量
  let weight2Temp1 = FloatDiv(FloatMul(thickness2.value, lithiumStripDensity2.value), 10);
  let weight2Temp2 = FloatMul(FloatMul(FloatDiv(width2.value, 10), length2.value), 100);
  weight2.value = roundToDecimal(FloatMul(weight2Temp1, weight2Temp2), 2);

  //根据重量算米数
  let demandLength2Temp1 = FloatDiv(demandWeight2.value, lithiumStripDensity2.value);
  let demandLength2Temp2 = FloatDiv(FloatMul(FloatDiv(thickness2.value, 10), width2.value), 10);
  demandLength2.value = roundToDecimal(FloatDiv(FloatDiv(demandLength2Temp1, demandLength2Temp2), 100), 1);

  //锂带重量计算
  let lithiumStripWeight3Temp1 = FloatMul(FloatMul(lithiumStripDensity3.value, lithiumStripThickness3.value), lithiumStripLayers3.value);
  let lithiumStripWeight3Temp2 = FloatDiv(FloatMul(FloatDiv(lithiumStripWeight3Temp1, 10000), lithiumStripWidth3.value), 10);
  lithiumStripWeight3.value = roundToDecimal(FloatMul(FloatMul(lithiumStripWeight3Temp2, length3.value), 100), 1);

  //铜箔重量计算
  let copperFoilWeight3Temp1 = FloatDiv(FloatMul(copperFoilThickness3.value, copperFoilDensity3.value), 10000);
  let copperFoilWeight3Temp2 = FloatDiv(FloatMul(copperFoilWeight3Temp1, copperFoilWidth3.value), 10);
  copperFoilWeight3.value = roundToDecimal(FloatMul(FloatMul(copperFoilWeight3Temp2, length3.value), 100), 1);

  //总重量计算
  totalWeight3.value = roundToDecimal(FloatAdd(lithiumStripWeight3.value, copperFoilWeight3.value), 1);

  //根据米数计算重量:铜箔重量
  let weight4Temp1 = FloatMul(FloatDiv(FloatMul(copperFoilDensity4.value, thickness4.value), 10000), width4.value);
  let weight4Temp2 = FloatMul(FloatDiv(weight4Temp1, 10), length4.value);
  weight4.value = roundToDecimal(FloatDiv(FloatMul(weight4Temp2, 100), 1000), 1);

  //根据重量计算米数:需求米数
  let demandLength4Temp1 = FloatDiv(FloatMul(demandWeight4.value, 1000), copperFoilDensity4.value);
  let demandLength4Temp2 = FloatDiv(FloatMul(FloatDiv(thickness4.value, 10000), width4.value), 10);
  demandLength4.value = roundToDecimal(FloatDiv(FloatDiv(demandLength4Temp1, demandLength4Temp2), 100), 1);

  //根据米数计算重量:铜箔重量
  let weight5Temp1 = FloatMul(FloatDiv(FloatMul(aluminumFoilDensity5.value, aluminumFoilThickness5.value), 10000), aluminumFoilWidth5.value);
  let weight5Temp2 = FloatMul(FloatDiv(weight5Temp1, 10), aluminumFoilLength5.value);
  aluminumFoilWeight5.value = roundToDecimal(FloatDiv(FloatMul(weight5Temp2, 100), 1000), 1);

  //根据重量计算米数:需求米数
  let demandLength5Temp1 = FloatDiv(FloatMul(demandAluminumFoilWeight5.value, 1000), aluminumFoilDensity5.value);
  let demandLength5Temp2 = FloatDiv(FloatMul(FloatDiv(aluminumFoilThickness5.value, 10000), aluminumFoilWidth5.value), 10);
  demandAluminumFoilLength5.value = roundToDecimal(FloatDiv(FloatDiv(demandLength5Temp1, demandLength5Temp2), 100), 1);

};
</script>