|
@@ -0,0 +1,1414 @@
|
|
|
+<template>
|
|
|
+ <div class="CLX">
|
|
|
+ <div class="message">
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>润滑油品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ v-model="lubricantBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="handleBrandChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxPP"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>润滑油型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ v-model="lubricantModel"
|
|
|
+ placeholder="请选择"
|
|
|
+ :disabled="!lubricantBrand"
|
|
|
+ @change="lube"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in lubricatingXXoptions"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- LLS -->
|
|
|
+ <!-- <p class="locationP">
|
|
|
+ <i @click="addLSS" class="el-icon-plus"></i>
|
|
|
+ <i v-if="lowSpeedList.length > 1" @click="delLSS" class="el-icon-minus"></i>
|
|
|
+ </p> -->
|
|
|
+ <div class="message">
|
|
|
+ <p class="caption">
|
|
|
+ <span class="capSpan1">LSS低速轴</span>
|
|
|
+ </p>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in lowSpeedList.length > 0 ? lowSpeedList : [{}]"
|
|
|
+ :key="index"
|
|
|
+ class="message-BOX"
|
|
|
+ >
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>{{ index === 0 ? "低速轴承品牌:" : "低速轴承2/品牌:" }}</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ v-model="item.bearingBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="LSSslow(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in clxZC"
|
|
|
+ :key="option"
|
|
|
+ :label="option"
|
|
|
+ :value="option"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>{{ index === 0 ? "低速轴承型号:" : "低速轴承2/型号:" }}</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ v-model="item.bearingModel"
|
|
|
+ placeholder="请选择"
|
|
|
+ :disabled="!item.bearingBrand"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in LSSbearingXXoptions"
|
|
|
+ :key="option"
|
|
|
+ :label="option"
|
|
|
+ :value="option"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 行星轮 -->
|
|
|
+ <p class="locationP">
|
|
|
+ <i @click="addPlanet" class="el-icon-plus"></i>
|
|
|
+ <i v-if="planets.length > 1" @click="delPlanet" class="el-icon-minus"></i>
|
|
|
+ </p>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in planets.length > 0 ? planets : [{}]"
|
|
|
+ :key="index"
|
|
|
+ class="message"
|
|
|
+ >
|
|
|
+ <p class="caption">
|
|
|
+ <span class="capSpan1">{{ `${levelNames[index]}行星轮结构` }}</span>
|
|
|
+ </p>
|
|
|
+ <div class="message-BOX">
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>行星轮轴承品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ v-model="item.bearingBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="XXLzhoucheng(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxZC"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option
|
|
|
+ ></el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>行星轮轴承型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ @change="handleUnitGearboxStructureDtoList('planets')"
|
|
|
+ v-model="item.bearingModel"
|
|
|
+ :disabled="!item.bearingBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in bearingXXoptions"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option
|
|
|
+ ></el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>齿圈齿数:</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.gearRingTeethCount"
|
|
|
+ @input="
|
|
|
+ validateInput(
|
|
|
+ $event,
|
|
|
+ index,
|
|
|
+ 'gearRingTeethCount',
|
|
|
+ 'handleUnitGearboxStructureDtoList',
|
|
|
+ 'planets'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>太阳轮齿数:</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.sunWheelTeethCount"
|
|
|
+ @input="
|
|
|
+ validateInput(
|
|
|
+ $event,
|
|
|
+ index,
|
|
|
+ 'sunWheelTeethCount',
|
|
|
+ 'handleUnitGearboxStructureDtoList',
|
|
|
+ 'planets'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>行星轮个数:</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.planetWheelCount"
|
|
|
+ @input="
|
|
|
+ validateInput(
|
|
|
+ $event,
|
|
|
+ index,
|
|
|
+ 'planetWheelCount',
|
|
|
+ 'handleUnitGearboxStructureDtoList',
|
|
|
+ 'planets'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>行星轮齿数:</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.planetWheelTeethCount"
|
|
|
+ @input="
|
|
|
+ validateInput(
|
|
|
+ $event,
|
|
|
+ index,
|
|
|
+ 'planetWheelTeethCount',
|
|
|
+ 'handleUnitGearboxStructureDtoList',
|
|
|
+ 'planets'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="message-BOX">
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>太阳轮轴承品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ v-model="item.sunWheelBearingBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="TYLzhoucheng(item)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxZC"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option
|
|
|
+ ></el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>太阳轮轴承型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ @change="handleUnitGearboxStructureDtoList('planets')"
|
|
|
+ v-model="item.sunWheelBearingModel"
|
|
|
+ :disabled="!item.sunWheelBearingBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in bearingXXoptions"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option
|
|
|
+ ></el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 平行轮 -->
|
|
|
+ <p class="locationP">
|
|
|
+ <i @click="addparallel" class="el-icon-plus"></i>
|
|
|
+ <i
|
|
|
+ v-if="parallel.length > 1"
|
|
|
+ @click="delparallel"
|
|
|
+ class="el-icon-minus"
|
|
|
+ ></i>
|
|
|
+ </p>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in parallel.length > 0 ? parallel : [{}]"
|
|
|
+ :key="`parallel-${index}`"
|
|
|
+ class="message"
|
|
|
+ >
|
|
|
+ <p class="caption">
|
|
|
+ <span class="capSpan1">{{ `${levelNames[index]}平行轮结构` }}</span>
|
|
|
+ </p>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>大齿轮齿数</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.largeGearTeethCount"
|
|
|
+ @change="handleUnitGearboxStructureDtoList('parallel')"
|
|
|
+ @input="
|
|
|
+ validateInput(
|
|
|
+ $event,
|
|
|
+ index,
|
|
|
+ 'largeGearTeethCount',
|
|
|
+ 'handleUnitGearboxStructureDtoList',
|
|
|
+ 'parallel'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>小齿轮齿数</p>
|
|
|
+ <el-input
|
|
|
+ @change="handleUnitGearboxStructureDtoList('parallel')"
|
|
|
+ v-model="item.smallGearTeethCount"
|
|
|
+ @input="
|
|
|
+ validateInput(
|
|
|
+ $event,
|
|
|
+ index,
|
|
|
+ 'smallGearTeethCount',
|
|
|
+ 'handleUnitGearboxStructureDtoList',
|
|
|
+ 'parallel'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 低速中间轴 -->
|
|
|
+ <p class="locationP">
|
|
|
+ <i @click="addslowly" class="el-icon-plus"></i>
|
|
|
+ <i
|
|
|
+ v-if="lowSpeedIntermediateShaftList.length > 1"
|
|
|
+ @click="delslowly"
|
|
|
+ class="el-icon-minus"
|
|
|
+ ></i>
|
|
|
+ </p>
|
|
|
+ <div class="message">
|
|
|
+ <p class="caption">
|
|
|
+ <span class="capSpan1">低速中间轴</span>
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in lowSpeedIntermediateShaftList.length > 0
|
|
|
+ ? lowSpeedIntermediateShaftList
|
|
|
+ : [{}]"
|
|
|
+ :key="index"
|
|
|
+ class="message-BOX"
|
|
|
+ >
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-RS品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ @change="DSrs(item)"
|
|
|
+ v-model="item.bearingRsBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxZC"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-RS型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ :disabled="!item.bearingRsBrand"
|
|
|
+ v-model="item.bearingRsModel"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="handleLowSpeedIntermediateBearingsDtoList"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in RSbearingXXoptionsDS"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-GS品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ @change="DSgs(item)"
|
|
|
+ v-model="item.bearingGsBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxZC"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-GS型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ :disabled="!item.bearingGsBrand"
|
|
|
+ v-model="item.bearingGsModel"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="handleLowSpeedIntermediateBearingsDtoList"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in GSbearingXXoptions"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>齿圈齿数:</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.gearRingTeethCount"
|
|
|
+ @input="
|
|
|
+ (event) =>
|
|
|
+ validateInput(
|
|
|
+ event,
|
|
|
+ index,
|
|
|
+ 'gearRingTeethCount',
|
|
|
+ 'handleLowSpeedIntermediateBearingsDtoList',
|
|
|
+ 'lowSpeedIntermediateShaftList'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 高速轴 -->
|
|
|
+ <!-- <p class="locationP">
|
|
|
+ <i @click="addhigh" class="el-icon-plus"></i>
|
|
|
+ <i v-if="highSpeedShaftList.length > 1" @click="delhigh" class="el-icon-minus"></i>
|
|
|
+ </p> -->
|
|
|
+ <div class="message">
|
|
|
+ <p class="caption">
|
|
|
+ <span class="capSpan1">高速轴</span>
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in highSpeedShaftList.length > 0
|
|
|
+ ? highSpeedShaftList
|
|
|
+ : [{}]"
|
|
|
+ :key="index"
|
|
|
+ class="message-BOX"
|
|
|
+ >
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-RS品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ @change="GSrs(item)"
|
|
|
+ v-model="item.bearingRsBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxZC"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-RS型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ :disabled="!item.bearingRsBrand"
|
|
|
+ v-model="item.bearingRsModel"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="handleHighSpeedBearingsDtoList"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in RSbearingXXoptions"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-GS品牌:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ @change="GSgs(item)"
|
|
|
+ v-model="item.bearingGsBrand"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in clxZC"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>轴承-GS型号:</p>
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ :disabled="!item.bearingGsBrand"
|
|
|
+ v-model="item.bearingGsModel"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="handleHighSpeedBearingsDtoList"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in GSbearingXXoptions"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="message-DIV">
|
|
|
+ <p>齿圈齿数:</p>
|
|
|
+ <el-input
|
|
|
+ v-model="item.gearRingTeethCount"
|
|
|
+ @input="
|
|
|
+ (event) =>
|
|
|
+ validateInput(
|
|
|
+ event,
|
|
|
+ index,
|
|
|
+ 'gearRingTeethCount',
|
|
|
+ 'handleHighSpeedBearingsDtoList',
|
|
|
+ 'highSpeedShaftList'
|
|
|
+ )
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getBrandModelNameOrModelNumber } from "@/api/maintain";
|
|
|
+import { log } from "plotly.js-dist";
|
|
|
+export default {
|
|
|
+ props: {
|
|
|
+ clxPP: {
|
|
|
+ type: Array,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ clxZC: {
|
|
|
+ type: Array,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ unitGearDto: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({}),
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ lubricantBrand: "",
|
|
|
+ lubricantModel: "",
|
|
|
+ // 低速轴
|
|
|
+ lowSpeedList: [
|
|
|
+ {
|
|
|
+ bearingBrand: "",
|
|
|
+ bearingModel: "",
|
|
|
+ parallelWheelGrade: 1,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ bearingBrand: "",
|
|
|
+ bearingModel: "",
|
|
|
+ sunWheelBearingBrand: "",
|
|
|
+ sunWheelBearingModel: "",
|
|
|
+ // 行星轮
|
|
|
+ planets: [
|
|
|
+ {
|
|
|
+ planetWheelCount: "",
|
|
|
+ planetWheelTeethCount: "",
|
|
|
+ sunWheelTeethCount: "",
|
|
|
+ gearRingTeethCount: "",
|
|
|
+ bearingBrand: "",
|
|
|
+ bearingModel: "",
|
|
|
+ sunWheelBearingBrand: "",
|
|
|
+ sunWheelBearingModel: "",
|
|
|
+ gearboxStructure: 1,
|
|
|
+ planetaryGearGrade: 1,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ levelNames: ["一级", "二级", "三级"],
|
|
|
+ //
|
|
|
+ parallel: [
|
|
|
+ {
|
|
|
+ largeGearTeethCount: "",
|
|
|
+ smallGearTeethCount: "",
|
|
|
+ gearboxStructure: 2,
|
|
|
+ planetaryGearGrade: 1,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // 低速中间轴
|
|
|
+ lowSpeedIntermediateShaftList: [
|
|
|
+ {
|
|
|
+ gearRingTeethCount: "",
|
|
|
+ bearingRsBrand: "",
|
|
|
+ bearingRsModel: "",
|
|
|
+ bearingGsBrand: "",
|
|
|
+ bearingGsModel: "",
|
|
|
+ gearboxBearingLevel: 1,
|
|
|
+ parallelWheelGrade: 2,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // 高速轴
|
|
|
+ highSpeedShaftList: [
|
|
|
+ {
|
|
|
+ gearRingTeethCount: "",
|
|
|
+ bearingRsBrand: "",
|
|
|
+ bearingRsModel: "",
|
|
|
+ bearingGsBrand: "",
|
|
|
+ bearingGsModel: "",
|
|
|
+ parallelWheelGrade: 3,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ lubricatingXXoptions: [],
|
|
|
+
|
|
|
+ bearingXXoptions: [],
|
|
|
+ unitGearboxBearingsDtoList: [],
|
|
|
+ unitGearboxStructureDtoList: [],
|
|
|
+
|
|
|
+ LSSbearingXXoptions: [],
|
|
|
+ RSbearingXXoptions: [],
|
|
|
+ GSbearingXXoptions: [],
|
|
|
+ RSbearingXXoptionsDS: [],
|
|
|
+ GSbearingXXoptions: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 高速轴
|
|
|
+ highSpeedShaftList: {
|
|
|
+ handler(newValue) {
|
|
|
+ newValue.forEach((item) => {
|
|
|
+ if (item.bearingRsBrand) {
|
|
|
+ } else {
|
|
|
+ item.bearingRsModel = "";
|
|
|
+ }
|
|
|
+ if (item.bearingGsBrand) {
|
|
|
+ } else {
|
|
|
+ item.bearingGsModel = "";
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deep: true, // 启用深度监听
|
|
|
+ },
|
|
|
+
|
|
|
+ unitGearboxBearingsDtoList: function (newValue, oldValue) {
|
|
|
+ console.log("unitGearboxBearingsDtoList changed:", newValue);
|
|
|
+ // 在这里可以调用你需要处理的逻辑,比如调用 handleLowSpeedBearingsDtoList 方法
|
|
|
+ },
|
|
|
+ unitGearDto: {
|
|
|
+ immediate: true, // 初始化时触发
|
|
|
+ deep: true, // 深度监听
|
|
|
+ handler(newVal) {
|
|
|
+ if (newVal && typeof newVal === "object") {
|
|
|
+ this.initializeData(newVal);
|
|
|
+ } else {
|
|
|
+ console.warn("unitGearDto 为空或无效:", newVal);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted() {
|
|
|
+ this.highSpeedShaftList.forEach((item) => {
|
|
|
+ // 如果 bearingRsBrand 有值,调用接口获取型号
|
|
|
+ if (item.bearingRsBrand) {
|
|
|
+ this.GSrs(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果 bearingGsBrand 有值,调用接口获取型号
|
|
|
+ if (item.bearingGsBrand) {
|
|
|
+ this.GSgs(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ if (this.unitGearDto && typeof this.unitGearDto === "object") {
|
|
|
+ this.initializeData(this.unitGearDto);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initializeData(newVal = {}) {
|
|
|
+ if (!newVal || typeof newVal !== "object" || Array.isArray(newVal)) {
|
|
|
+ console.warn("传入的数据无效,跳过初始化:", newVal);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.lubricantBrand = newVal?.lubricantBrand || "";
|
|
|
+ this.lubricantModel = newVal?.lubricantModel || "";
|
|
|
+ this.distributeByParallelWheelGrade(newVal.unitGearboxBearingsList);
|
|
|
+ this.distributeDataByStructureAndGrade(newVal.unitGearboxStructureList);
|
|
|
+ },
|
|
|
+ distributeByParallelWheelGrade(data) {
|
|
|
+ this.lowSpeedList = [];
|
|
|
+ this.lowSpeedIntermediateShaftList = [];
|
|
|
+ this.highSpeedShaftList = [];
|
|
|
+
|
|
|
+ data.forEach((item) => {
|
|
|
+ switch (item.parallelWheelGrade) {
|
|
|
+ case 1:
|
|
|
+ this.lowSpeedList.push(item);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ this.lowSpeedIntermediateShaftList.push(item);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ this.highSpeedShaftList.push(item);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // return {
|
|
|
+ // lowSpeedList,
|
|
|
+ // lowSpeedIntermediateShaftList,
|
|
|
+ // highSpeedShaftList,
|
|
|
+ // };
|
|
|
+ },
|
|
|
+ distributeDataByStructureAndGrade(data) {
|
|
|
+ this.planets = [];
|
|
|
+ this.parallel = [];
|
|
|
+ console.log(data, "-=-==-=");
|
|
|
+ const planets = [];
|
|
|
+ const parallel = [];
|
|
|
+ // 分配数据到planets和parallel
|
|
|
+ // 分配数据到planets和parallel
|
|
|
+ data.forEach((item) => {
|
|
|
+ if (item.gearboxStructure === 1) {
|
|
|
+ planets.push(item);
|
|
|
+ } else if (item.gearboxStructure === 2) {
|
|
|
+ parallel.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 对planets和parallel数组按planetaryGearGrade排序
|
|
|
+ planets.sort((a, b) => a.planetaryGearGrade - b.planetaryGearGrade);
|
|
|
+ parallel.sort((a, b) => a.planetaryGearGrade - b.planetaryGearGrade);
|
|
|
+ console.log(planets, "-=-==-=", parallel);
|
|
|
+ this.planets = planets;
|
|
|
+ this.parallel = parallel;
|
|
|
+ // return {
|
|
|
+ // planets,
|
|
|
+ // parallel,
|
|
|
+ // };
|
|
|
+ },
|
|
|
+ // 润滑油
|
|
|
+ handleBrandChange() {
|
|
|
+ const params = {
|
|
|
+ unitType: 2,
|
|
|
+ manufacture: this.lubricantBrand,
|
|
|
+ };
|
|
|
+ if (this.lubricantBrand == "") {
|
|
|
+ this.lubricantModel = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.lubricatingXXoptions = res.data;
|
|
|
+
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "lubricantBrand",
|
|
|
+ value: this.lubricantBrand,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ lube() {
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "lubricantModel",
|
|
|
+ value: this.lubricantModel,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 低速轴
|
|
|
+ LSSslow(item) {
|
|
|
+ console.log("lowSpeedList====", this.lowSpeedList);
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.bearingBrand,
|
|
|
+ };
|
|
|
+ console.log(params);
|
|
|
+ // 异步获取品牌和型号数据
|
|
|
+
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.LSSbearingXXoptions = res.data;
|
|
|
+
|
|
|
+ // this.handleLowSpeedBearingsDtoList(); // 在数据更新后再调用方法
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 行星轮
|
|
|
+ XXLzhoucheng(item) {
|
|
|
+ console.log(item, this.planets);
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.bearingBrand,
|
|
|
+ };
|
|
|
+ console.log(this.planets);
|
|
|
+ this.handleUnitGearboxStructureDtoList("planets");
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.bearingXXoptions = res.data;
|
|
|
+ // item.bearingModel = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ TYLzhoucheng(item) {
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.sunWheelBearingBrand,
|
|
|
+ };
|
|
|
+ console.log(params);
|
|
|
+ this.handleUnitGearboxStructureDtoList("planets");
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.bearingXXoptions = res.data;
|
|
|
+ item.sunWheelBearingModel = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 结构
|
|
|
+ handleUnitGearboxStructureDtoList(listName) {
|
|
|
+ if (!listName) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(this[listName]);
|
|
|
+
|
|
|
+ const requiredFields = [
|
|
|
+ "gearboxStructure",
|
|
|
+ "planetaryGearGrade",
|
|
|
+ "uniqueKey",
|
|
|
+ ];
|
|
|
+
|
|
|
+ this[listName].forEach((item, index) => {
|
|
|
+ // 过滤掉空值属性(空字符串、null、undefined)
|
|
|
+ const plainItem = { ...item };
|
|
|
+ const sanitizedItem = {};
|
|
|
+ for (const key in plainItem) {
|
|
|
+ if (
|
|
|
+ plainItem[key] !== "" &&
|
|
|
+ plainItem[key] !== null &&
|
|
|
+ plainItem[key] !== undefined
|
|
|
+ ) {
|
|
|
+ sanitizedItem[key] = plainItem[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否还有有效属性值
|
|
|
+ if (Object.keys(sanitizedItem).length === 0) {
|
|
|
+ console.log("Skipping empty sanitizedItem:", sanitizedItem);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查 sanitizedItem 是否只包含这三个字段
|
|
|
+ const isOnlyRequiredFields = Object.keys(sanitizedItem).every((field) =>
|
|
|
+ requiredFields.includes(field)
|
|
|
+ );
|
|
|
+
|
|
|
+ // 如果 sanitizedItem 只包含这三个字段,跳过当前项
|
|
|
+ if (isOnlyRequiredFields) {
|
|
|
+ console.log(
|
|
|
+ "Skipping sanitizedItem with only required fields:",
|
|
|
+ sanitizedItem
|
|
|
+ );
|
|
|
+ // 过滤掉 uniqueKey 为 "gearboxStructure-22" 的对象
|
|
|
+ const updatedArray = this.unitGearboxStructureDtoList.filter(
|
|
|
+ (item) =>
|
|
|
+ item.uniqueKey !==
|
|
|
+ `gearboxStructure-${sanitizedItem.gearboxStructure}${sanitizedItem.planetaryGearGrade}`
|
|
|
+ );
|
|
|
+ this.unitGearboxStructureDtoList = updatedArray;
|
|
|
+ console.log(this.unitGearboxStructureDtoList);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成唯一标识符
|
|
|
+ const uniqueKey = `gearboxStructure-${sanitizedItem.gearboxStructure}${sanitizedItem.planetaryGearGrade}`;
|
|
|
+ console.log("Generated uniqueKey:", uniqueKey);
|
|
|
+
|
|
|
+ // 确保 uniqueKey 没有空格或意外字符,进行清理
|
|
|
+ const cleanedUniqueKey = uniqueKey.trim();
|
|
|
+
|
|
|
+ // 检查目标数组中是否已存在此唯一标识
|
|
|
+
|
|
|
+ // if (!exists) {
|
|
|
+ // console.log("Adding new uniqueKey:", cleanedUniqueKey);
|
|
|
+ // // 使用 Vue.set 来确保响应式更新,或者替换数组
|
|
|
+ // this.unitGearboxStructureDtoList.push({
|
|
|
+ // ...sanitizedItem,
|
|
|
+ // uniqueKey: cleanedUniqueKey,
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // console.log("Skipping existing uniqueKey:", cleanedUniqueKey);
|
|
|
+ // }
|
|
|
+ if (Array.isArray(this.unitGearboxStructureDtoList)) {
|
|
|
+ const exists = this.unitGearboxStructureDtoList.some(
|
|
|
+ (entry) => entry.uniqueKey === cleanedUniqueKey
|
|
|
+ );
|
|
|
+ console.log(sanitizedItem, plainItem, sanitizedItem.bearingModel);
|
|
|
+ if (exists) {
|
|
|
+ // 找到对应的项并更新
|
|
|
+ const index = this.unitGearboxStructureDtoList.findIndex(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ this.unitGearboxStructureDtoList[index] = {
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ // 如果不存在,直接 push 新对象
|
|
|
+ this.unitGearboxStructureDtoList.push({
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error(
|
|
|
+ "unitGearboxBearingsDtoList is not an array",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(
|
|
|
+ "Updated unitGearboxStructureDtoList (CHILUN):",
|
|
|
+ this.unitGearboxStructureDtoList
|
|
|
+ );
|
|
|
+
|
|
|
+ // Emit the updated data to parent component or to store
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxStructureDtoList",
|
|
|
+ value: this.unitGearboxStructureDtoList,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ DSrs(item) {
|
|
|
+ console.log(
|
|
|
+ "lowSpeedIntermediateShaftList====",
|
|
|
+ this.lowSpeedIntermediateShaftList,
|
|
|
+ item
|
|
|
+ );
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.bearingRsBrand,
|
|
|
+ };
|
|
|
+ console.log(params);
|
|
|
+ this.handleLowSpeedIntermediateBearingsDtoList();
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.RSbearingXXoptionsDS = res.data;
|
|
|
+ item.bearingRsModel = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ filterEmptyValues(obj) {
|
|
|
+ return Object.fromEntries(
|
|
|
+ Object.entries(obj).filter(
|
|
|
+ ([_, value]) =>
|
|
|
+ !(value === "" || value === null || value === undefined)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ // 结构化低速轴
|
|
|
+ handleLowSpeedBearingsDtoList(a) {
|
|
|
+ const lowSpeedList = JSON.parse(JSON.stringify(this[a]));
|
|
|
+ lowSpeedList.forEach((lowSpeedItem) => {
|
|
|
+ // 使用深拷贝转为普通对象
|
|
|
+ const plainItem = JSON.parse(JSON.stringify(lowSpeedItem));
|
|
|
+ // 过滤掉空值属性(空字符串、null、undefined)
|
|
|
+ const sanitizedItem = Object.entries(plainItem).reduce(
|
|
|
+ (acc, [key, value]) => {
|
|
|
+ if (value !== "" && value !== null && value !== undefined) {
|
|
|
+ acc[key] = value;
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ },
|
|
|
+ {}
|
|
|
+ );
|
|
|
+ console.log(sanitizedItem, plainItem);
|
|
|
+
|
|
|
+ // 检查是否还有有效属性值
|
|
|
+ if (Object.keys(sanitizedItem).length === 0) {
|
|
|
+ console.log("Skipping empty sanitizedItem:", sanitizedItem);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成唯一标识符
|
|
|
+ const uniqueKey = `parallelWheelGrade-${sanitizedItem.parallelWheelGrade}`;
|
|
|
+ // 检查目标数组中是否已存在此唯一标识
|
|
|
+ if (Array.isArray(this.unitGearboxBearingsDtoList)) {
|
|
|
+ const exists = this.unitGearboxBearingsDtoList.some(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ console.log(sanitizedItem, plainItem, sanitizedItem.bearingModel);
|
|
|
+ if (exists) {
|
|
|
+ // 找到对应的项并更新
|
|
|
+ const index = this.unitGearboxBearingsDtoList.findIndex(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ this.unitGearboxBearingsDtoList[index] = {
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ // 如果不存在,直接 push 新对象
|
|
|
+ this.unitGearboxBearingsDtoList.push({
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error(
|
|
|
+ "unitGearboxBearingsDtoList is not an array",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(
|
|
|
+ "Updated unitGearboxBearingsDtoList (LSSslow):",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxBearingsDtoList",
|
|
|
+ value: this.unitGearboxBearingsDtoList,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 结构化低速中间轴
|
|
|
+ handleLowSpeedIntermediateBearingsDtoList() {
|
|
|
+ const requiredFields = [
|
|
|
+ "gearboxBearingLevel",
|
|
|
+ "parallelWheelGrade",
|
|
|
+ "uniqueKey",
|
|
|
+ ];
|
|
|
+
|
|
|
+ this.lowSpeedIntermediateShaftList.forEach((shaftItem, index) => {
|
|
|
+ // 过滤掉空值属性(空字符串、null、undefined)
|
|
|
+ const plainItem = { ...shaftItem };
|
|
|
+ const sanitizedItem = {};
|
|
|
+ for (const key in plainItem) {
|
|
|
+ if (
|
|
|
+ plainItem[key] !== "" &&
|
|
|
+ plainItem[key] !== null &&
|
|
|
+ plainItem[key] !== undefined
|
|
|
+ ) {
|
|
|
+ sanitizedItem[key] = plainItem[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("1111111111111111:", shaftItem);
|
|
|
+ console.log("2222222222222222:", sanitizedItem);
|
|
|
+ // 检查是否还有有效属性值
|
|
|
+ if (Object.keys(sanitizedItem).length === 0) {
|
|
|
+ console.log("Skipping empty sanitizedItem:", sanitizedItem);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查 sanitizedItem 是否只包含这三个字段: gearboxBearingLevel, parallelWheelGrade, uniqueKey
|
|
|
+ const isOnlyRequiredFields = Object.keys(sanitizedItem).every((field) =>
|
|
|
+ requiredFields.includes(field)
|
|
|
+ );
|
|
|
+
|
|
|
+ // 如果 sanitizedItem 只包含这三个字段,跳过当前项
|
|
|
+ if (isOnlyRequiredFields) {
|
|
|
+ console.log(
|
|
|
+ "Skipping sanitizedItem with only required fields:",
|
|
|
+ sanitizedItem
|
|
|
+ );
|
|
|
+ const updatedArray = this.unitGearboxStructureDtoList.filter(
|
|
|
+ (item) =>
|
|
|
+ item.uniqueKey !==
|
|
|
+ `parallelWheelGrade-${sanitizedItem.parallelWheelGrade}${sanitizedItem.gearboxBearingLevel}`
|
|
|
+ );
|
|
|
+ this.unitGearboxBearingsDtoList = updatedArray;
|
|
|
+ console.log(this.unitGearboxBearingsDtoList);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成唯一标识符
|
|
|
+ const uniqueKey = `parallelWheelGrade-${sanitizedItem.parallelWheelGrade}${sanitizedItem.gearboxBearingLevel}`;
|
|
|
+
|
|
|
+ // 检查目标数组中是否已存在此唯一标识
|
|
|
+ // 检查目标数组中是否已存在此唯一标识
|
|
|
+ if (Array.isArray(this.unitGearboxBearingsDtoList)) {
|
|
|
+ const exists = this.unitGearboxBearingsDtoList.some(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ console.log(sanitizedItem, plainItem, sanitizedItem.bearingModel);
|
|
|
+ if (exists) {
|
|
|
+ // 找到对应的项并更新
|
|
|
+ const index = this.unitGearboxBearingsDtoList.findIndex(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ this.unitGearboxBearingsDtoList[index] = {
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ // 如果不存在,直接 push 新对象
|
|
|
+ this.unitGearboxBearingsDtoList.push({
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error(
|
|
|
+ "unitGearboxBearingsDtoList is not an array",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(
|
|
|
+ "Updated unitGearboxBearingsDtoList (DSrs):",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxBearingsDtoList",
|
|
|
+ value: this.unitGearboxBearingsDtoList,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 结构化高速轴
|
|
|
+ handleHighSpeedBearingsDtoList() {
|
|
|
+ this.highSpeedShaftList.forEach((lowSpeedItem) => {
|
|
|
+ // 过滤掉空值属性(空字符串、null、undefined)
|
|
|
+ const plainItem = { ...lowSpeedItem };
|
|
|
+ const sanitizedItem = {};
|
|
|
+ for (const key in plainItem) {
|
|
|
+ if (
|
|
|
+ plainItem[key] !== "" &&
|
|
|
+ plainItem[key] !== null &&
|
|
|
+ plainItem[key] !== undefined
|
|
|
+ ) {
|
|
|
+ sanitizedItem[key] = plainItem[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否还有有效属性值
|
|
|
+ if (Object.keys(sanitizedItem).length === 0) {
|
|
|
+ console.log("Skipping empty sanitizedItem:", sanitizedItem);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成唯一标识符
|
|
|
+ const uniqueKey = `parallelWheelGrade-${sanitizedItem.parallelWheelGrade}`;
|
|
|
+
|
|
|
+ // 检查目标数组中是否已存在此唯一标识
|
|
|
+ // 检查目标数组中是否已存在此唯一标识
|
|
|
+ if (Array.isArray(this.unitGearboxBearingsDtoList)) {
|
|
|
+ const exists = this.unitGearboxBearingsDtoList.some(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ console.log(sanitizedItem, plainItem, sanitizedItem.bearingModel);
|
|
|
+ if (exists) {
|
|
|
+ // 找到对应的项并更新
|
|
|
+ const index = this.unitGearboxBearingsDtoList.findIndex(
|
|
|
+ (entry) => entry.uniqueKey === uniqueKey
|
|
|
+ );
|
|
|
+ this.unitGearboxBearingsDtoList[index] = {
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ // 如果不存在,直接 push 新对象
|
|
|
+ this.unitGearboxBearingsDtoList.push({
|
|
|
+ ...sanitizedItem,
|
|
|
+ uniqueKey,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error(
|
|
|
+ "unitGearboxBearingsDtoList is not an array",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(
|
|
|
+ "Updated unitGearboxBearingsDtoList (High):",
|
|
|
+ this.unitGearboxBearingsDtoList
|
|
|
+ );
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxBearingsDtoList",
|
|
|
+ value: this.unitGearboxBearingsDtoList,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ DSgs(item) {
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.bearingGsBrand,
|
|
|
+ };
|
|
|
+ console.log(params);
|
|
|
+ this.handleLowSpeedIntermediateBearingsDtoList();
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.GSbearingXXoptions = res.data;
|
|
|
+
|
|
|
+ item.bearingGsModel = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ GSrs(item) {
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.bearingRsBrand,
|
|
|
+ };
|
|
|
+ console.log(params);
|
|
|
+ this.handleHighSpeedBearingsDtoList();
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.RSbearingXXoptions = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ GSgs(item) {
|
|
|
+ const params = {
|
|
|
+ unitType: 1,
|
|
|
+ manufacture: item.bearingGsBrand,
|
|
|
+ };
|
|
|
+ console.log(params);
|
|
|
+ this.handleHighSpeedBearingsDtoList();
|
|
|
+ getBrandModelNameOrModelNumber(params).then((res) => {
|
|
|
+ this.GSbearingXXoptions = res.data;
|
|
|
+
|
|
|
+ // item.bearingGsModel = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addPlanet() {
|
|
|
+ const newPlanetaryGearGrade = this.planets.length + 1;
|
|
|
+ if (this.planets.length < 3) {
|
|
|
+ // 深拷贝默认值并推入 planets 数组
|
|
|
+ const defaultPlanet = {
|
|
|
+ planetWheelCount: "",
|
|
|
+ planetWheelTeethCount: "",
|
|
|
+ sunWheelTeethCount: "",
|
|
|
+ gearRingTeethCount: "",
|
|
|
+ bearingBrand: "", // 行星轮轴承品牌
|
|
|
+ bearingModel: "", // 行星轮轴承型号
|
|
|
+ sunWheelBearingBrand: "", // 太阳轮轴承品牌
|
|
|
+ sunWheelBearingModel: "", // 太阳轮轴承型号
|
|
|
+ gearboxStructure: 1,
|
|
|
+ planetaryGearGrade: newPlanetaryGearGrade,
|
|
|
+ };
|
|
|
+ this.planets.push({ ...defaultPlanet });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ delPlanet() {
|
|
|
+ if (this.planets.length > 1) {
|
|
|
+ this.planets.pop();
|
|
|
+ }
|
|
|
+ // 过滤掉 uniqueKey 为 "gearboxStructure-22" 的对象
|
|
|
+ const updatedArray = this.unitGearboxStructureDtoList.filter(
|
|
|
+ (item) =>
|
|
|
+ item.uniqueKey !== `gearboxStructure-1${this.planets.length + 1}`
|
|
|
+ );
|
|
|
+ this.unitGearboxStructureDtoList = updatedArray;
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxStructureDtoList",
|
|
|
+ value: this.unitGearboxStructureDtoList,
|
|
|
+ });
|
|
|
+ console.log(this.unitGearboxStructureDtoList);
|
|
|
+ },
|
|
|
+ validateInput(value, index, field, structureName, listName) {
|
|
|
+ const validValue = value.replace(/[^0-9]/g, "");
|
|
|
+ if (validValue !== value) {
|
|
|
+ this.$message({
|
|
|
+ message: "只能输入数字",
|
|
|
+ type: "warning",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this[listName][index][field] = Number(validValue) || "";
|
|
|
+ structureName && this[structureName](listName);
|
|
|
+ },
|
|
|
+
|
|
|
+ addparallel() {
|
|
|
+ const newPlanetaryGearGrade = this.parallel.length + 1;
|
|
|
+ if (this.parallel.length < 3) {
|
|
|
+ this.parallel.push({
|
|
|
+ largeGearTeethCount: "",
|
|
|
+ smallGearTeethCount: "",
|
|
|
+ gearboxStructure: 2,
|
|
|
+ planetaryGearGrade: newPlanetaryGearGrade,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ delparallel() {
|
|
|
+ if (this.parallel.length > 1) {
|
|
|
+ this.parallel.pop();
|
|
|
+ }
|
|
|
+ // 过滤掉 uniqueKey 为 "gearboxStructure-22" 的对象
|
|
|
+ const updatedArray = this.unitGearboxStructureDtoList.filter(
|
|
|
+ (item) =>
|
|
|
+ item.uniqueKey !== `gearboxStructure-2${this.parallel.length + 1}`
|
|
|
+ );
|
|
|
+ this.unitGearboxStructureDtoList = updatedArray;
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxStructureDtoList",
|
|
|
+ value: this.unitGearboxStructureDtoList,
|
|
|
+ });
|
|
|
+ console.log(this.unitGearboxStructureDtoList);
|
|
|
+ },
|
|
|
+
|
|
|
+ addLSS() {
|
|
|
+ if (this.lowSpeedList.length < 2) {
|
|
|
+ this.lowSpeedList.push({ lubricantBrand: "", lubricantModel: "" });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ delLSS() {
|
|
|
+ if (this.lowSpeedList.length > 1) {
|
|
|
+ this.lowSpeedList.pop();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addslowly() {
|
|
|
+ if (this.lowSpeedIntermediateShaftList.length >= 2) {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "只能添加最多两项!",
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const newGearboxBearingLevel =
|
|
|
+ this.lowSpeedIntermediateShaftList.length + 1;
|
|
|
+ // 添加新项到数组
|
|
|
+ this.lowSpeedIntermediateShaftList.push({
|
|
|
+ gearRingTeethCount: "",
|
|
|
+ bearingRsBrand: "",
|
|
|
+ bearingRsModel: "",
|
|
|
+ bearingGsBrand: "",
|
|
|
+ bearingGsModel: "",
|
|
|
+ gearboxBearingLevel: newGearboxBearingLevel, // 动态增加的字段
|
|
|
+ parallelWheelGrade: 2,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ delslowly() {
|
|
|
+ if (this.lowSpeedIntermediateShaftList.length > 1) {
|
|
|
+ this.lowSpeedIntermediateShaftList.pop();
|
|
|
+ }
|
|
|
+ // 过滤掉 uniqueKey 为 "gearboxStructure-22" 的对象
|
|
|
+ const updatedArray = this.unitGearboxBearingsDtoList.filter(
|
|
|
+ (item) =>
|
|
|
+ item.uniqueKey !==
|
|
|
+ `parallelWheelGrade-${sanitizedItem.parallelWheelGrade}${this.lowSpeedIntermediateShaftList.length.gearboxBearingLevel}`
|
|
|
+ );
|
|
|
+ this.unitGearboxBearingsDtoList = updatedArray;
|
|
|
+ this.$emit("update", {
|
|
|
+ key: "unitGearboxBearingsDtoList",
|
|
|
+ value: this.unitGearboxBearingsDtoList,
|
|
|
+ });
|
|
|
+ console.log(this.unitGearboxBearingsDtoList);
|
|
|
+ },
|
|
|
+ addhigh() {
|
|
|
+ if (this.highSpeedShaftList.length < 2) {
|
|
|
+ this.highSpeedShaftList.push({
|
|
|
+ gearRingTeethCount: "",
|
|
|
+ bearingRsBrand: null,
|
|
|
+ bearingRsModel: null,
|
|
|
+ bearingGsBrand: null,
|
|
|
+ bearingGsModel: null,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ delhigh() {
|
|
|
+ if (this.highSpeedShaftList.length > 1) {
|
|
|
+ this.highSpeedShaftList.pop();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.CLX {
|
|
|
+ .message {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .message-BOX {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ .message-DIV {
|
|
|
+ width: 25%;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ margin-bottom: 20px;
|
|
|
+ justify-content: space-between;
|
|
|
+ p {
|
|
|
+ // margin-right: 10px;
|
|
|
+ width: 140px;
|
|
|
+ line-height: 40px;
|
|
|
+ height: 40px;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ .el-input {
|
|
|
+ width: 223px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .message-DIV {
|
|
|
+ width: 25%;
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ justify-content: space-between;
|
|
|
+ p {
|
|
|
+ // margin-right: 10px;
|
|
|
+ width: 140px;
|
|
|
+ line-height: 40px;
|
|
|
+ height: 40px;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ .el-input {
|
|
|
+ width: 223px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .caption {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0 10px;
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ color: #ffffff;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ .el-icon-plus:before {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+ .capSpan1 {
|
|
|
+ background: rgb(101, 101, 101);
|
|
|
+ width: 140px;
|
|
|
+ padding-left: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .locationP {
|
|
|
+ text-align: right;
|
|
|
+ font-size: 24px;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|