曹睿
2025-04-24 5519cbf2e00c7ba4c650a542d98da99978124a30
src/pages/production/detail/twistDetail.vue
@@ -1,12 +1,21 @@
<template>
  <view>
    <ProductCard />
    <ProductCard
      :data="cardData"
      :map="{
        deviceModel: 'deviceModel',
        model: 'model',
        totalAmount: 'totalAmount',
        amount: 'amount',
        unAmount: 'unAmount',
      }"
    />
    <view class="mx-3">
      <wd-grid class="rounded-lg" clickable>
        <wd-grid-item
          icon="computer"
          link-type="navigateTo"
          url="/pages/production/twist/report/index"
          :url="`/pages/production/twist/report/index?id=${paramsId}`"
          text="报工"
        />
        <!-- <wd-grid-item
@@ -18,13 +27,13 @@
        <wd-grid-item
          icon="tips"
          link-type="navigateTo"
          url="/pages/production/twist/backman/index"
          :url="`/pages/production/twist/backman/index?id=${paramsId}`"
          text="杂工"
        />
        <wd-grid-item
          icon="wallet"
          link-type="navigateTo"
          url="/pages/production/twist/receive/index"
          :url="`/pages/production/twist/receive/index?id=${paramsId}`"
          text="材料领用"
        />
      </wd-grid>
@@ -33,7 +42,34 @@
</template>
<script lang="ts" setup>
import { onLoad } from "@dcloudio/uni-app";
import ProductCard from "@/components/product_card/index.vue";
import TwistApi from "@/api/product/twist";
const paramsId = ref();
const cardData = reactive({
  deviceModel: undefined,
  model: undefined,
  totalAmount: undefined,
  amount: undefined,
  unAmount: undefined,
});
const getDetailData = async (id: string) => {
  const { data } = await TwistApi.getTwistDetailById({
    id: id,
  });
  cardData.deviceModel = data.deviceModel;
  cardData.model = data.model;
  cardData.totalAmount = data.totalLength;
  cardData.amount = data.length;
  cardData.unAmount = data.unLength;
};
onLoad((options: any) => {
  paramsId.value = options.id;
  getDetailData(options.id);
});
</script>
<style lang="scss" scoped></style>