<template>
|
<view class="process-route">
|
<!-- 使用通用页面头部组件 -->
|
<PageHeader title="工艺路线"
|
@back="goBack" />
|
<!-- 搜索区域 -->
|
<view class="search-section">
|
<view class="search-bar">
|
<view class="search-input">
|
<up-input class="search-text"
|
placeholder="请输入规格名称搜索"
|
v-model="searchForm.model"
|
@change="handleQuery"
|
clearable />
|
</view>
|
<view class="filter-button"
|
@click="handleQuery">
|
<up-icon name="search"
|
size="24"
|
color="#999"></up-icon>
|
</view>
|
</view>
|
</view>
|
<!-- 列表区域 -->
|
<scroll-view scroll-y
|
class="list-container"
|
v-if="tableData.length > 0"
|
@scrolltolower="loadMore">
|
<view v-for="(item, index) in tableData"
|
:key="item.id || index"
|
@click="goDetail(item)">
|
<view class="ledger-item">
|
<view class="item-header">
|
<view class="item-left">
|
<view class="document-icon">
|
<up-icon name="share-square"
|
size="16"
|
color="#ffffff"></up-icon>
|
</view>
|
<text class="item-id">{{ item.processRouteCode }}</text>
|
</view>
|
</view>
|
<up-divider></up-divider>
|
<view class="item-details">
|
<view class="detail-row">
|
<text class="detail-label">产品名称</text>
|
<text class="detail-value font-bold">{{ item.productName || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">规格名称</text>
|
<text class="detail-value">{{ item.model || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">BOM编号</text>
|
<text class="detail-value">{{ item.bomNo || '-' }}</text>
|
</view>
|
<view class="detail-row">
|
<text class="detail-label">描述</text>
|
<text class="detail-value">{{ item.description || '-' }}</text>
|
</view>
|
</view>
|
<view class="item-footer">
|
<text class="more-detail">路线项目</text>
|
<up-icon name="arrow-right"
|
size="14"
|
color="#999"></up-icon>
|
</view>
|
</view>
|
</view>
|
<up-loadmore :status="loadStatus"
|
v-if="tableData.length >= page.size" />
|
</scroll-view>
|
<view v-else
|
class="no-data">
|
<up-empty mode="data"
|
text="暂无工艺路线数据"></up-empty>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import { ref, reactive, toRefs, getCurrentInstance } from "vue";
|
import { onShow } from "@dcloudio/uni-app";
|
import { listPage } from "@/api/productionManagement/processRoute.js";
|
import PageHeader from "@/components/PageHeader.vue";
|
|
const { proxy } = getCurrentInstance();
|
|
// 加载状态
|
const loading = ref(false);
|
const loadStatus = ref("loadmore");
|
// 列表数据
|
const tableData = ref([]);
|
|
// 分页配置
|
const page = reactive({
|
current: 1,
|
size: 10,
|
total: 0,
|
});
|
|
// 搜索表单数据
|
const data = reactive({
|
searchForm: {
|
model: "",
|
},
|
});
|
const { searchForm } = toRefs(data);
|
|
// 返回上一页
|
const goBack = () => {
|
uni.navigateBack();
|
};
|
|
// 查询列表
|
const handleQuery = () => {
|
page.current = 1;
|
tableData.value = [];
|
getList();
|
};
|
|
// 加载更多
|
const loadMore = () => {
|
if (loadStatus.value === "nomore" || loading.value) return;
|
page.current++;
|
getList();
|
};
|
|
// 获取列表数据
|
const getList = () => {
|
loading.value = true;
|
loadStatus.value = "loading";
|
|
const params = {
|
current: page.current,
|
size: page.size,
|
model: searchForm.value.model,
|
};
|
|
listPage(params)
|
.then(res => {
|
loading.value = false;
|
const records = res.data.records || [];
|
if (page.current === 1) {
|
tableData.value = records;
|
} else {
|
tableData.value = [...tableData.value, ...records];
|
}
|
|
if (records.length < page.size) {
|
loadStatus.value = "nomore";
|
} else {
|
loadStatus.value = "loadmore";
|
}
|
page.total = res.data.total || 0;
|
})
|
.catch(() => {
|
loading.value = false;
|
loadStatus.value = "loadmore";
|
uni.showToast({
|
title: "加载失败",
|
icon: "error",
|
});
|
});
|
};
|
|
// 跳转路线项目
|
const goDetail = item => {
|
uni.navigateTo({
|
url: `/pages/productionManagement/processRoute/items?id=${
|
item.id
|
}&processRouteCode=${
|
item.processRouteCode
|
}&productName=${encodeURIComponent(
|
item.productName || ""
|
)}&model=${encodeURIComponent(item.model || "")}&bomNo=${
|
item.bomNo || ""
|
}&bomId=${item.bomId || ""}&description=${encodeURIComponent(
|
item.description || ""
|
)}`,
|
});
|
};
|
|
// 页面显示时加载数据
|
onShow(() => {
|
handleQuery();
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "@/styles/sales-common.scss";
|
|
.process-route {
|
min-height: 100vh;
|
background: #f8f9fa;
|
display: flex;
|
flex-direction: column;
|
}
|
|
.list-container {
|
flex: 1;
|
height: 0;
|
}
|
|
.ledger-item {
|
background: #fff;
|
margin: 20rpx;
|
padding: 24rpx;
|
border-radius: 16rpx;
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
|
.item-header {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding-bottom: 12rpx;
|
|
.item-left {
|
display: flex;
|
align-items: center;
|
|
.document-icon {
|
width: 44rpx;
|
height: 44rpx;
|
background: #3c9cff;
|
border-radius: 10rpx;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
margin-right: 20rpx;
|
}
|
|
.item-id {
|
font-size: 30rpx;
|
font-weight: bold;
|
color: #333;
|
}
|
}
|
}
|
|
.item-details {
|
padding: 16rpx 0;
|
|
.detail-row {
|
display: flex;
|
justify-content: space-between;
|
align-items: flex-start;
|
margin-bottom: 16rpx;
|
|
.detail-label {
|
font-size: 26rpx;
|
color: #999;
|
min-width: 140rpx;
|
}
|
|
.detail-value {
|
font-size: 26rpx;
|
color: #333;
|
text-align: right;
|
flex: 1;
|
|
&.font-bold {
|
font-weight: bold;
|
}
|
}
|
}
|
}
|
|
.item-footer {
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
padding-top: 16rpx;
|
border-top: 1rpx solid #f0f0f0;
|
|
.more-detail {
|
font-size: 24rpx;
|
color: #3c9cff;
|
margin-right: 8rpx;
|
}
|
}
|
}
|
|
.no-data {
|
padding-top: 200rpx;
|
}
|
</style>
|