<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>
|