Compare commits

...

3 Commits

Author SHA1 Message Date
d3d9554ead Feature: 皮带规格计算 2025-07-10 16:22:40 +08:00
1485841e4b Fix: 修正英文翻译 2025-07-10 14:42:02 +08:00
e3f03f72d4 Feature: 纸带宽度角度计算 2025-07-10 14:35:31 +08:00
6 changed files with 410 additions and 27 deletions

View File

@ -1,11 +1,241 @@
<script setup lang="ts">
</script>
<template> <template>
<h1>test</h1> <div class="calculator-container">
<v-row justify="center">
<!-- 参数输入区域 -->
<v-col
cols="12"
lg="5"
md="6"
>
<v-card
class="pa-6 parameter-card"
elevation="8"
rounded="xl"
>
<v-card-title class="text-h5 mb-6 d-flex align-center">
<v-icon
class="mr-3"
color="primary"
icon="mdi-tune"
size="large"
/>
{{ $t('parameters') }}
</v-card-title>
<v-row>
<v-col cols="6">
<v-select
v-model="currentSelect"
density="comfortable"
:items="selects"
:label="`${$t('machineModel')}`"
@update:model-value="updateParams"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="maxWheelbase"
:disabled="!isCustomMode"
:label="`${$t('maxWheelbase')} (${maxWheelbase.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="hubDiameter"
:disabled="!isCustomMode"
:label="`${$t('hubDiameter')} (${hubDiameter.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="paperCoreDiameter"
:label="`${$t('paperCoreDiameter')} (${paperCoreDiameter.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="paperRollWallThickness"
:label="`${$t('paperRollWallThickness')} (${paperRollWallThickness.unit})`"
/>
</v-col>
</v-row>
</v-card>
</v-col>
<!-- 结果显示区域 -->
<v-col
cols="12"
lg="5"
md="6"
>
<v-card
class="pa-6 result-card"
elevation="8"
rounded="xl"
>
<v-card-title class="text-h5 mb-6 d-flex align-center">
<v-icon
class="mr-3"
color="primary"
icon="mdi-calculator"
size="large"
/>
{{ $t('results') }}
</v-card-title>
<v-row>
<v-col cols="12">
<result-card
:label="`${$t('recommendBeltThickness')} (${result.recommendBeltThickness.unit})`"
:value="result.recommendBeltThickness"
/>
</v-col>
<v-col cols="12">
<result-card
:label="`${$t('recommendBeltWidth')} (${result.recommendBeltWidth.unit})`"
:value="result.recommendBeltWidth"
/>
</v-col>
<v-col cols="12">
<result-card
:label="`${$t('recommendBeltLength')} (${result.recommendBeltLength.unit})`"
:value="result.recommendBeltLength"
/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</div>
</template> </template>
<style scoped lang="sass"> <script setup lang="ts">
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { createParam, type Param } from '@/types/param'
</style> const { t, locale } = useI18n()
const currentSelect = ref('')
const currentSelectIndex = ref(0)
const selects = computed(() => [
t('50_120Series'),
t('200_Series'),
t('600_Series'),
t('new_50_120Series'),
t('new_200_Series'),
t('custom'),
])
const maxWheelbase = ref<Param>(createParam(900, 'mm'))
const hubDiameter = ref<Param>(createParam(215, 'mm'))
const paperCoreDiameter = ref<Param>(createParam(76.2, 'mm'))
const paperRollWallThickness = ref<Param>(createParam(10, 'mm'))
const result = computed(() => {
const hubCircumference = Math.PI * hubDiameter.value.value
const paperRollExternalDiameter = paperCoreDiameter.value.value + paperRollWallThickness.value.value
const paperRollCircumference = Math.PI * paperRollExternalDiameter
const recommendBeltLength = Math.round((paperRollCircumference + hubCircumference + (maxWheelbase.value.value - 50) * 2) / 10) * 10
const beltWidthMapping = [
{ threshold: 20, width: 10 },
{ threshold: 25, width: 15 },
{ threshold: 32, width: 20 },
{ threshold: 40, width: 25 },
{ threshold: 70, width: 30 },
{ threshold: 95, width: 40 },
{ threshold: 125, width: 50 },
{ threshold: 150, width: 60 },
{ threshold: 204, width: 80 },
{ threshold: 380, width: 105 },
{ threshold: 950, width: 120 },
{ threshold: 1200, width: 150 },
{ threshold: 5000, width: 200 },
]
const beltThicknessMapping = [
{ threshold: 10, thickness: 6 },
{ threshold: 15, thickness: 8 },
{ threshold: 20, thickness: 10 },
{ threshold: 30, thickness: 12 },
]
function getBeltWidth (circumference: number): number {
const mapping = beltWidthMapping.find(item => circumference < item.threshold)
return mapping ? mapping.width : 0
}
function getBeltThickness (width: number): number {
const mapping = beltThicknessMapping.find(item => width < item.threshold)
return mapping ? mapping.thickness : 15
}
const recommendBeltWidth = getBeltWidth(paperRollCircumference)
const recommendBeltThickness = getBeltThickness(paperRollWallThickness.value.value)
return {
recommendBeltLength: createParam(recommendBeltLength, 'mm'),
recommendBeltWidth: createParam(recommendBeltWidth, 'mm'),
recommendBeltThickness: createParam(recommendBeltThickness, 'mm'),
}
})
// 机器型号预设参数配置
const machineConfigs = computed(() => {
return {
[t('50_120Series')]: {
maxWheelbase: 900,
hubDiameter: 215,
},
[t('200_Series')]: {
maxWheelbase: 1100,
hubDiameter: 245,
},
[t('600_Series')]: {
maxWheelbase: 1675,
hubDiameter: 320,
},
[t('new_50_120Series')]: {
maxWheelbase: 900,
hubDiameter: 240,
},
[t('new_200_Series')]: {
maxWheelbase: 1100,
hubDiameter: 268,
},
}
})
// 选择机器型号时更新参数
function updateParams (machineModel: string): void {
const config = machineConfigs.value[machineModel]
currentSelectIndex.value = selects.value.indexOf(machineModel)
if (config) {
maxWheelbase.value = createParam(config.maxWheelbase, 'mm')
hubDiameter.value = createParam(config.hubDiameter, 'mm')
}
}
// 当前处于自定义模式
const isCustomMode = computed(() => {
return currentSelect.value === t('custom')
})
onMounted(() => {
// 初始化时设置默认选择
currentSelect.value = selects.value[0]
updateParams(currentSelect.value)
})
// 监听语言变化
watch(locale, () => {
// 更新当前选择的机器型号
currentSelect.value = selects.value[currentSelectIndex.value]
updateParams(currentSelect.value)
})
</script>

View File

@ -1,11 +1,122 @@
<script setup lang="ts">
</script>
<template> <template>
<div class="calculator-container">
<v-row justify="center">
<!-- 参数输入区域 -->
<v-col
cols="12"
lg="5"
md="6"
>
<v-card
class="pa-6 parameter-card"
elevation="8"
rounded="xl"
>
<v-card-title class="text-h5 mb-6 d-flex align-center">
<v-icon
class="mr-3"
color="primary"
icon="mdi-tune"
size="large"
/>
{{ $t('parameters') }}
</v-card-title>
<v-row>
<v-col cols="12">
<param-input-field
v-model="paperCoreDiameter"
:label="`${$t('paperCoreDiameter')} (${paperCoreDiameter.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="paperRollWallThickness"
:label="`${$t('paperRollWallThickness')} (${paperRollWallThickness.unit})`"
/>
</v-col>
<v-col cols="12">
<param-input-field
v-model="innerPaperWidth"
:label="`${$t('innerPaperWidth')} (${innerPaperWidth.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"
@click="resetParameters"
>
{{ $t('reset') }}
</v-btn>
</v-row>
</v-card>
</v-col>
<!-- 结果显示区域 -->
<v-col cols="12" lg="5" md="6">
<v-card class="pa-6 result-card" elevation="8" rounded="xl">
<v-card-title class="text-h5 mb-6 d-flex align-center">
<v-icon class="mr-3" color="primary" icon="mdi-calculator" size="large" />
{{ $t('results') }}
</v-card-title>
<v-row>
<v-col cols="12">
<result-card :label="$t('beltAngle')" :value="result.beltAngle" />
</v-col>
<v-col cols="12">
<result-card :label="$t('paperHolderAngle')" :value="result.paperHolderAngle" />
</v-col>
<v-col cols="12">
<result-card :label="$t('leadingLength')" :value="result.leadingLength" />
</v-col>
<v-col cols="12">
<result-card :label="$t('paperWidth')" :value="result.paperWidth" />
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</div>
</template> </template>
<style scoped lang="sass"> <script setup lang="ts">
import { computed, ref } from 'vue'
import ParamInputField from '@/components/ParamInputField.vue'
import { createParam, type Param } from '@/types/param'
import { degreesToRadians, radiansToDegrees } from '@/utils/angle'
</style> const paperCoreDiameter = ref<Param>(createParam(76.2, 'mm'))
const paperRollWallThickness = ref<Param>(createParam(10, 'mm'))
const innerPaperWidth = ref<Param>(createParam(105, 'mm'))
const result = computed(() => {
const paperRollExternalDiameter = paperCoreDiameter.value.value + 2 * paperRollWallThickness.value.value
const paperHolderAngle = 90 - radiansToDegrees(Math.acos(innerPaperWidth.value.value / (paperCoreDiameter.value.value * Math.PI)))
const leadingLength = innerPaperWidth.value.value / Math.sin(degreesToRadians(90 - paperHolderAngle))
const beltAngle = 90 - radiansToDegrees(Math.atan(paperRollExternalDiameter * Math.PI / leadingLength))
const paperWidth = leadingLength * Math.sin(Math.atan(paperRollExternalDiameter * Math.PI / leadingLength))
return {
beltAngle: createParam(beltAngle, '°'),
paperHolderAngle: createParam(paperHolderAngle, '°'),
leadingLength: createParam(leadingLength, 'mm'),
paperWidth: createParam(paperWidth, 'mm'),
}
})
const resetParameters = () => {
paperCoreDiameter.value = createParam(76.2, 'mm')
paperRollWallThickness.value = createParam(10, 'mm')
innerPaperWidth.value = createParam(105, 'mm')
}
</script>

View File

@ -1,6 +1,7 @@
<template> <template>
<v-text-field <v-text-field
density="compact" density="compact"
:disabled="disabled"
hide-details hide-details
:label="label" :label="label"
:model-value="modelValue.value.toString()" :model-value="modelValue.value.toString()"
@ -17,6 +18,7 @@
interface Props { interface Props {
label: string label: string
modelValue: Param modelValue: Param
disabled?: boolean
} }
interface Emits { interface Emits {

View File

@ -2,27 +2,27 @@
"appTitle": "Paper Tube Production Calculator", "appTitle": "Paper Tube Production Calculator",
"beltSpecificationCalculate": "Belt Specification Calculate", "beltSpecificationCalculate": "Belt Specification Calculate",
"multiLayerPaperTapeWidthAngleCalculate": "MultiLayer Paper Tape Width Angle Calculate", "multiLayerPaperTapeWidthAngleCalculate": "MultiLayer Paper Tape Width Angle Calculate",
"paperCoreDiameter": "Paper Core Diameter", "paperCoreDiameter": "Paper core diameter",
"paperDensity": "Paper Density", "paperDensity": "Paper density",
"paperGrammage": "Grammage", "paperGrammage": "Grammage",
"paperRollExternalDiameter": "Paper Roll External Diameter", "paperRollExternalDiameter": "Paper roll external diameter",
"paperRollLength": "Paper Roll Length", "paperRollLength": "Paper roll length",
"paperRollWallThickness": "Paper Roll Wall Thickness", "paperRollWallThickness": "Paper roll wall thickness",
"paperRollWeightLengthCalculate": "Paper Roll Weight Length Calculate", "paperRollWeightLengthCalculate": "Paper Roll Weight Length Calculate",
"paperTapeWidthAngleCalculate": "Paper Tape Width Angle Calculate", "paperTapeWidthAngleCalculate": "Paper Tape Width Angle Calculate",
"paperTubeProductionCalculate": "Paper Tube Production Calculate", "paperTubeProductionCalculate": "Paper Tube Production Calculate",
"paperTubeWeightCalculate": "Paper Tube Weight Calculate", "paperTubeWeightCalculate": "Paper Tube Weight Calculate",
"parameters": "Parameters", "parameters": "Parameters",
"productionAmount": "Production Amount", "productionAmount": "Production amount",
"reset": "Reset", "reset": "Reset",
"results": "Results", "results": "Results",
"singlePaperTubeWeight": "Single Paper Tube Weight", "singlePaperTubeWeight": "Single paper tube weight",
"totalPaperTubeWeight": "Total Paper Tube Weight", "totalPaperTubeWeight": "Total paper tube weight",
"paperRollWidth": "Paper Roll Width", "paperRollWidth": "Paper roll width",
"paperThickness": "Paper Thickness", "paperThickness": "Paper thickness",
"paperRollWeight": "Paper Roll Weight", "paperRollWeight": "Paper roll weight",
"paperLength": "Paper Roll Length", "paperLength": "Paper Roll Length",
"innerPaperWidth": "Inner Paper Width", "innerPaperWidth": "Inner paper width",
"workFrequency": "Work Frequency", "workFrequency": "Work Frequency",
"workTime": "Work time", "workTime": "Work time",
"workEfficiency": "Work efficiency", "workEfficiency": "Work efficiency",
@ -31,5 +31,21 @@
"productionAmountPerDay": "Daily output", "productionAmountPerDay": "Daily output",
"productionAmountPerHour": "Hourly output", "productionAmountPerHour": "Hourly output",
"productionWeightPerDay": "Daily output", "productionWeightPerDay": "Daily output",
"productionWeightPerHour": "Hourly output" "productionWeightPerHour": "Hourly output",
"beltAngle": "Belt angle",
"paperHolderAngle": "Paper holder angle",
"leadingLength": "Leading length",
"paperWidth": "Paper width",
"machineModel": "Model",
"maxWheelbase": "Maximum wheelbase",
"hubDiameter": "Hub diameter",
"50_120Series": "50, 120 series",
"200_Series": "200 series",
"600_Series": "600 series",
"new_50_120Series": "New 50, 200 series",
"new_200_Series": "New 200 series",
"custom": "Customize",
"recommendBeltLength": "Recommended belt length",
"recommendBeltWidth": "Recommended bandwidth",
"recommendBeltThickness": "Recommended belt thickness"
} }

View File

@ -31,5 +31,21 @@
"productionAmountPerHour": "每小时产量", "productionAmountPerHour": "每小时产量",
"productionWeightPerHour": "每小时产量", "productionWeightPerHour": "每小时产量",
"productionAmountPerDay": "每天产量", "productionAmountPerDay": "每天产量",
"productionWeightPerDay": "每天产量" "productionWeightPerDay": "每天产量",
"beltAngle": "皮带角度",
"paperHolderAngle": "纸架角度",
"leadingLength": "导程",
"paperWidth": "面纸宽度",
"machineModel": "机器型号",
"maxWheelbase": "最大轮距",
"hubDiameter": "轮毂直径",
"50_120Series": "50、120系列",
"200_Series": "200系列",
"600_Series": "600系列",
"new_50_120Series": "新50、200系列",
"new_200_Series": "新200系列",
"custom": "自定义",
"recommendBeltThickness": "推荐皮带厚度",
"recommendBeltWidth": "推荐皮带宽度",
"recommendBeltLength": "推荐皮带长度"
} }

8
src/utils/angle.ts Normal file
View File

@ -0,0 +1,8 @@
// 角度转弧度
export function degreesToRadians (degrees: number): number {
return degrees * (Math.PI / 180)
}
// 弧度转角度
export function radiansToDegrees (radians: number): number {
return radians * (180 / Math.PI)
}