Feature: 纸管重量长度计算
This commit is contained in:
@ -1,11 +1,159 @@
|
||||
<template>
|
||||
<div
|
||||
class="calculator-container"
|
||||
>
|
||||
<v-row justify="center">
|
||||
<!-- 参数输入区域 -->
|
||||
<v-col
|
||||
cols="12"
|
||||
lg="5"
|
||||
md="6"
|
||||
>
|
||||
<v-card
|
||||
class="pa-6 parameters-card"
|
||||
elevation="8"
|
||||
rounded="xl"
|
||||
>
|
||||
<v-card-title class="text-h5 mb-6 d-flex align-center">
|
||||
<VIcon
|
||||
class="mr-3"
|
||||
color="primary"
|
||||
icon="mdi-tune"
|
||||
size="large"
|
||||
/>
|
||||
{{ $t('parameters') }}
|
||||
</v-card-title>
|
||||
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<ParamInputField
|
||||
v-model="paperCoreDiameter"
|
||||
:label="`${$t('paperCoreDiameter')} (${paperCoreDiameter.unit})`"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<ParamInputField
|
||||
v-model="paperRollExternalDiameter"
|
||||
:label="`${$t('paperRollExternalDiameter')} (${paperRollExternalDiameter.unit})`"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<ParamInputField
|
||||
v-model="paperRollWidth"
|
||||
:label="`${$t('paperRollWidth')} (${paperRollWidth.unit})`"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<ParamInputField
|
||||
v-model="paperDensity"
|
||||
:label="`${$t('paperDensity')} (${paperDensity.unit})`"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<ParamInputField
|
||||
v-model="paperGrammage"
|
||||
:label="`${$t('paperGrammage')} (${paperGrammage.unit})`"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-divider class="my-6" />
|
||||
<v-row>
|
||||
<v-btn
|
||||
block
|
||||
color="warning"
|
||||
prepend-icon="mdi-refresh"
|
||||
size="large"
|
||||
variant="outlined"
|
||||
>
|
||||
{{ $t('reset') }}
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<!-- 结果显示区域 -->
|
||||
<v-col
|
||||
cols="12"
|
||||
lg="5"
|
||||
md="6"
|
||||
>
|
||||
<VCard
|
||||
class="pa-6 result-card"
|
||||
elevation="8"
|
||||
rounded="xl"
|
||||
>
|
||||
<VCardTitle class="text-h5 mb-6 d-flex align-center">
|
||||
<VIcon
|
||||
class="mr-3"
|
||||
color="primary"
|
||||
icon="mdi-calculator"
|
||||
size="large"
|
||||
/>
|
||||
{{ $t('results') }}
|
||||
</VCardTitle>
|
||||
|
||||
<VRow>
|
||||
<VCol cols="12">
|
||||
<ResultCard
|
||||
:label="$t('paperRollWeight')"
|
||||
:value="paperRollWeight"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<ResultCard
|
||||
:label="$t('paperRollLength')"
|
||||
:value="paperRollLength"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12">
|
||||
<ResultCard
|
||||
:label="$t('paperThickness')"
|
||||
:value="paperThickness"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCard>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { createParam, type Param } from '@/types/param'
|
||||
|
||||
const paperCoreDiameter = ref<Param>(createParam(76.2, 'mm'))
|
||||
const paperRollExternalDiameter = ref<Param>(createParam(200, 'mm'))
|
||||
const paperRollWidth = ref<Param>(createParam(100, 'mm'))
|
||||
const paperDensity = ref<Param>(createParam(0.76, 'g/cm³'))
|
||||
const paperGrammage = ref<Param>(createParam(420, 'g/m²'))
|
||||
|
||||
const paperThickness = computed(() => {
|
||||
// 计算纸张厚度
|
||||
return createParam(paperGrammage.value.value / paperDensity.value.value / 1000, 'mm')
|
||||
})
|
||||
|
||||
const paperRollWeight = computed(() => {
|
||||
// 计算纸卷总重量
|
||||
const paperRollExternalRadius = paperRollExternalDiameter.value.value / 2
|
||||
const paperCoreRadius = paperCoreDiameter.value.value / 2
|
||||
const paperRollVolume = (Math.PI * Math.pow(paperRollExternalRadius, 2) - Math.PI * Math.pow(paperCoreRadius, 2)) * paperRollWidth.value.value
|
||||
const weight = paperRollVolume * paperDensity.value.value / 1_000_000 // 计算重量
|
||||
return createParam(weight, 'kg')
|
||||
})
|
||||
|
||||
const paperRollLength = computed(() => {
|
||||
// 计算纸卷长度
|
||||
const paperRollExternalRadius = paperRollExternalDiameter.value.value / 2
|
||||
const paperCoreRadius = paperCoreDiameter.value.value / 2
|
||||
const paperRollVolume = (Math.PI * Math.pow(paperRollExternalRadius,
|
||||
2) - Math.PI * Math.pow(paperCoreRadius, 2)) * paperRollWidth.value.value
|
||||
const length = paperRollVolume / (paperThickness.value.value * paperRollWidth.value.value) / 1000
|
||||
return createParam(length, 'm')
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped lang="sass">
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user