spring
9 天以前 e0fc86fda41a8777a0cec5a9de7aa9f1474f5dc8
src/pages/production/twist/components/MonofilCard.vue
@@ -9,10 +9,12 @@
    >
      <wd-card>
        <wd-cell-group :border="true">
          <wd-cell title="单丝编号" :value="data.monofilamentNumber" />
          <wd-cell title="理论长度" :value="data.amount + ' (m)'" />
          <wd-cell title="生产长度" :value="data.actuallyLength + ' (m)'" />
          <wd-cell title="重量" :value="data.actuallyWeight + ' (kg)'" />
          <wd-cell title="单丝编号" :value="data.monofilamentNumber || '-'" />
          <wd-cell title="单丝盘长度" :value="reelLengthText" />
          <wd-cell title="绞层" :value="layerText" />
          <wd-cell title="规格型号" :value="specificationText" />
          <wd-cell title="理论长度" :value="amountText" />
          <wd-cell title="重量" :value="weightText" />
        </wd-cell-group>
      </wd-card>
    </view>
@@ -23,7 +25,7 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { ref, computed } from "vue";
const props = defineProps({
  data: {
@@ -32,6 +34,21 @@
  },
});
/** 有值才拼单位,空值显示 "-",避免出现 "undefined (m)" */
const withUnit = (value: any, unit: string) =>
  value === undefined || value === null || value === "" ? "-" : `${value} (${unit})`;
/** 单丝盘长度:对应原来的实际长度 actuallyLength */
const reelLengthText = computed(() => withUnit(props.data?.actuallyLength, "m"));
const amountText = computed(() => withUnit(props.data?.amount, "m"));
const weightText = computed(() => withUnit(props.data?.actuallyWeight, "kg"));
/** 绞层:优先 twistedLayer,兜底 layer */
const layerText = computed(() => props.data?.twistedLayer || props.data?.layer || "-");
/** 规格型号:优先 specificationModel,兜底 model */
const specificationText = computed(
  () => props.data?.specificationModel || props.data?.model || "-"
);
const emit = defineEmits(["delete", "swipe-open"]);
const translateX = ref(0);