yyb
10 天以前 552ec6b7d8ccc56c379da195fc6c9c74312b1070
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
  <view class="structure-page">
    <PageHeader :title="'BOM结构 - ' + bomNo"
                @back="goBack" />
    <view class="info-card">
      <view class="info-row">
        <text class="info-label">产品名称:</text>
        <text class="info-value">{{ productName }}-{{ productModelName }}</text>
      </view>
    </view>
    <view class="structure-list"
          v-if="dataList.length > 0">
      <BomStructureItem v-for="(item, index) in dataList"
                        :key="index"
                        :item="item"
                        :level="0"
                        :isLast="index === dataList.length - 1"
                        :processOptions="processOptions" />
    </view>
    <view v-else
          class="no-data">
      <up-empty text="暂无结构数据"
                mode="list"></up-empty>
    </view>
  </view>
</template>
 
<script setup>
  import { ref, reactive, computed } from "vue";
  import { onLoad } from "@dcloudio/uni-app";
  import { queryStructureList } from "@/api/productionManagement/bom";
  import { list as getProcessList } from "@/api/productionManagement/processManagement";
  import BomStructureItem from "./BomStructureItem.vue";
 
  const bomId = ref(null);
  const bomNo = ref("");
  const productName = ref("");
  const dataList = ref([]);
  const processOptions = ref([]);
 
  const goBack = () => {
    uni.navigateBack();
  };
 
  const fetchData = () => {
    queryStructureList(bomId.value).then(res => {
      dataList.value = res.data || [];
    });
  };
 
  const fetchProcess = () => {
    getProcessList().then(res => {
      processOptions.value = res.data || [];
    });
  };
 
  const productModelName = ref("");
 
  onLoad(options => {
    bomId.value = options.id;
    bomNo.value = decodeURIComponent(options.bomNo);
    productName.value = decodeURIComponent(options.productName);
    productModelName.value = decodeURIComponent(options.productModelName);
    fetchData();
    fetchProcess();
  });
</script>
 
<style scoped lang="scss">
  .structure-page {
    background-color: #f5f5f5;
    min-height: 100vh;
    padding-bottom: 120rpx;
  }
 
  .info-card {
    background: #fff;
    padding: 30rpx;
    margin-bottom: 20rpx;
    .info-row {
      display: flex;
      font-size: 28rpx;
      .info-label {
        color: #666;
      }
      .info-value {
        color: #333;
        font-weight: bold;
      }
    }
  }
 
  .structure-list {
    padding: 20rpx;
  }
 
  .no-data {
    padding-top: 100rpx;
  }
</style>