预制组件列表

This commit is contained in:
2026-06-12 15:14:46 +08:00
parent c749dd6b28
commit 36c7851d39
9 changed files with 1279 additions and 336 deletions
+29 -17
View File
@@ -54,10 +54,7 @@ export const reqPackagingManage = ()=>get(`PackagingManage/GetPackagingCategorie
* 保存包装
*/
export const reqSavePackaging = (data)=> post(`PackagingManage/SavePackaging`, data)
/**
* 请求包装详情
*/
export const reqPackagingInformationById = (params={})=>get(`PackagingManage/GetPackagingInformationById?projectId=${params.projectId||''}&personId=${params.personId||''}&packagingManageId=${params.packagingManageId||''}`)
/**
* 请求预制组件详情
*/
@@ -84,25 +81,40 @@ export const reqTrainNumberList = (data={})=> get(`TrainNumberManage/GetTrainNum
/**
* 获取车次详情
*/
export const reqTrainNumberById = (id) => get(`TrainNumberManage/GetTrainNumberById?trainNumberId=${id}`)
export const reqTrainNumberDetail = (id) => get(`TrainNumberManage/GetTrainNumberList?filter.id=${id}&pageindex=1&pagesize=1`)
/**
* 保存/发货车次
* @param {Object} data - { trainNumberId, projectId, unitId, trainNumber, driverName, driverPhone, licensePlateNumber, contactName, contactPhone, remark, state }
* 根据车次获取包装列表
*/
export const reqSaveTrainNumber = (data) => post(`TrainNumberManage/SaveTrainNumber`, data)
export const reqPackagingByTrain = (id) => get(`TrainNumberManage/GetPackagingByTrain?trainNumberId=${id}`)
/**
* 签收车次
* 获取包装详情
* @param {Object} params - { projectId, personId, packagingManageId }
*/
export const reqSignTrainNumber = (params = {}) => get(`TrainNumberManage/SignTrainNumber?trainNumberId=${params.trainNumberId}&personId=${params.personId}`)
export const reqPackagingInformationById = (params={})=>get(`PackagingManage/GetPackagingInformationById?projectId=${params.projectId}&personId=${params.personId}&packagingManageId=${params.packagingManageId}`)
/**
* 删除包装
* 保存包装到车次
* @param {Object} params - { packagingManageId, trainNumberId }
*/
export const reqDeletePackagingFromTrain = (params = {}) => get(`TrainNumberManage/DeletePackagingFromTrain?trainNumberId=${params.trainNumberId}&packagingManageId=${params.packagingManageId}`)
export const reqSavePackagingToTrain = (params={})=>get(`TrainNumberManage/SavePackagingToTrain?packagingManageId=${params.packagingManageId}&trainNumberId=${params.trainNumberId}`)
/**
* 获取包装列表
* 保存车次
* @param {Object} data - { Id, TrainNumber, unitId, ProjectId, State, DriverName, DriverPhone, LicensePlateNumber, ContactName, ContactPhone, Remark }
*/
export const reqPackagingListByTrain = (trainNumberId) => get(`PackagingManage/GetPackagingListByTrain?trainNumberId=${trainNumberId}`)
export const reqSaveTrainNumber = (data)=> post(`TrainNumberManage/SaveTrainNumber`, data)
/**
* 确认到场(签收)
*/
export const reqTrainInfoConfirmArrival = (params={})=>get(`TrainNumberManage/SaveTrainInfoConfirmArrival?PersonId=${params.PersonId}&Id=${params.Id}`)
/**
* 从车次中删除包装
* @param {String} id
*/
export const reqDeletePackagingFromTrain = (id='')=>get(`TrainNumberManage/DeletePackagingFromTrain?packagingManageId=${id}`)
// ========================= 预制组件管理 ====================================
/**
* 获取预制组件管理列表
* @param {Object} params - { projectId, pageindex, pagesize, state }
*/
export const reqPipelineComponentList = (params={})=>get(`/PipelineComponent/GetPipelineComponentList?projectId=${params.projectId}&pageindex=${params.pageindex}&pagesize=${params.pagesize}&state=${params.state}`)
+234 -108
View File
@@ -791,7 +791,7 @@
.page-detail {
min-height: 100vh;
background: #f5f6f8;
padding-bottom: 180rpx;
padding-bottom: 160rpx;
}
// 信息分组
@@ -800,29 +800,40 @@
margin: 24rpx;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
}
// 信息项
.info-item {
display: flex;
align-items: center;
padding: 28rpx 32rpx;
padding: 24rpx 32rpx;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
// 备注字段特殊处理 - 顶部对齐
&.info-textarea {
align-items: flex-start;
}
.info-label {
width: 200rpx;
flex-shrink: 0;
width: 180rpx;
font-size: 28rpx;
color: #666;
flex-shrink: 0;
display: flex;
align-items: center;
line-height: 40rpx;
position: relative;
.required {
color: #ff4d4f;
margin-right: 4rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: -16rpx;
font-size: 24rpx;
color: #fa3534;
}
}
@@ -830,48 +841,56 @@
flex: 1;
font-size: 28rpx;
color: #333;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.card-tag {
display: inline-block;
padding: 6rpx 16rpx;
padding: 8rpx 20rpx;
border-radius: 20rpx;
font-size: 24rpx;
background: rgba(153, 153, 153, 0.1);
color: #999;
font-weight: 500;
&.status-0 {
background: rgba(153, 153, 153, 0.1);
background: #f5f5f5;
color: #999;
}
&.status-1 {
background: rgba(255, 167, 38, 0.1);
color: #ffa726;
background: #fff7e6;
color: #fa8c16;
}
&.status-2 {
background: rgba(76, 175, 80, 0.1);
color: #4caf50;
background: #f6ffed;
color: #52c41a;
}
&.status-3 {
background: #e6f7ff;
color: #1890ff;
}
}
.u-input {
flex: 1;
background: transparent;
}
// 可点击行(扫码添加)
&.info-link {
.info-value {
color: #999;
.info-label {
flex: 1;
}
.scan-icon {
margin-left: auto;
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f6f8;
border-radius: 50%;
transition: all 0.2s ease;
&:active {
background: #e8e9eb;
transform: scale(0.95);
}
}
&:active {
@@ -880,6 +899,16 @@
}
}
// 输入框包装
.info-input-wrap {
flex: 1;
min-width: 0;
:deep(.u-input) {
background: transparent;
}
}
// 预制组件列表
.package-group {
margin: 24rpx;
@@ -1080,96 +1109,34 @@
}
}
// 发货管理详情
.page-detail {
min-height: 100vh;
background: #f5f6f8;
padding-bottom: 160rpx;
}
.info-group {
// 底部按钮
.bottom-btns {
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
padding: 20rpx 24rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
background: #ffffff;
margin: 24rpx;
border-radius: 16rpx;
overflow: hidden;
}
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.06);
gap: 20rpx;
.info-item {
display: flex;
align-items: flex-start;
padding: 28rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
}
.info-label {
flex-shrink: 0;
width: 180rpx;
font-size: 28rpx;
color: #666;
line-height: 40rpx;
.required {
color: #fa3534;
margin-right: 4rpx;
}
}
.info-value {
flex: 1;
font-size: 28rpx;
color: #333;
line-height: 40rpx;
}
// 扫码行
.scan-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
.scan-text {
font-size: 28rpx;
color: #666;
}
.scan-btn {
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f6f8;
border-radius: 50%;
}
}
// 包装列表区域
.package-section {
padding: 24rpx;
.section-title {
display: block;
:deep(.u-button) {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
font-size: 30rpx;
font-weight: 600;
color: #333;
margin-bottom: 16rpx;
}
}
// 包装表格
// 表格样式(保留)
.package-table {
border: 1rpx solid #e5e5e5;
border-radius: 8rpx;
overflow: hidden;
}
// 表格行
.table-hd {
display: flex;
background: #f5f6f8;
@@ -1189,7 +1156,6 @@
}
}
// 表格单元格
.table-td {
flex: 1;
padding: 20rpx;
@@ -1205,7 +1171,167 @@
}
}
// 表格空状态
.table-empty {
padding: 40rpx 0;
}
// 包装详情弹窗样式
.bz-detail-modal {
width: 600rpx;
max-height: 70vh;
background: #ffffff;
border-radius: 24rpx 24rpx 0 0;
overflow: hidden;
display: flex;
flex-direction: column;
.modal-header {
padding: 32rpx 40rpx;
background: linear-gradient(135deg, #3577FF 0%, #2B5FE8 100%);
text-align: center;
flex-shrink: 0;
.modal-title {
font-size: 32rpx;
font-weight: 600;
color: #ffffff;
}
}
.modal-body {
padding: 24rpx;
flex: 1;
overflow-y: auto;
min-height: 0;
.detail-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.detail-label {
font-size: 26rpx;
color: #999;
}
.detail-value {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
}
.prepipe-section {
margin-top: 24rpx;
padding-top: 24rpx;
border-top: 1rpx solid #f0f0f0;
.prepipe-title {
font-size: 26rpx;
color: #666;
margin-bottom: 16rpx;
}
.prepipe-list {
.prepipe-card {
background: #f5f6f8;
border-radius: 12rpx;
margin-bottom: 12rpx;
overflow: hidden;
&:last-child {
margin-bottom: 0;
}
.card-header {
padding: 16rpx 20rpx;
background: #e8e9eb;
.card-code {
font-size: 28rpx;
color: #333;
font-weight: 600;
}
}
.card-body {
padding: 16rpx 20rpx;
.card-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8rpx 0;
&:first-child {
padding-top: 0;
}
&:last-child {
padding-bottom: 0;
}
.card-label {
font-size: 24rpx;
color: #999;
}
.card-value {
font-size: 26rpx;
color: #333;
}
}
}
}
}
}
}
.modal-footer {
display: flex;
justify-content: space-between;
padding: 24rpx 40rpx 32rpx;
gap: 24rpx;
flex-shrink: 0;
border-top: 1rpx solid #f0f0f0;
.cancel-btn {
flex: 1;
height: 70rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f6f8;
border-radius: 12rpx;
font-size: 28rpx;
color: #666;
&:active {
background: #e8e9eb;
}
}
.confirm-btn {
flex: 1;
height: 70rpx;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #3577FF 0%, #2B5FE8 100%);
border-radius: 12rpx;
font-size: 28rpx;
color: #ffffff;
font-weight: 500;
&:active {
opacity: 0.9;
}
}
}
}
+12
View File
@@ -85,6 +85,18 @@
"style": {
"navigationBarTitleText": "发货管理"
}
},
{
"path": "precast/list",
"style": {
"navigationBarTitleText": "预制组件管理"
}
},
{
"path": "precast/detail",
"style": {
"navigationBarTitleText": "预制组件管理"
}
}
]
}
+140
View File
@@ -0,0 +1,140 @@
<template>
<view class="page-detail">
<!-- 基本信息 -->
<view class="info-group">
<!-- 车次 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>车次</text>
<text class="info-label" v-else>车次</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.TrainNumber" placeholder="请输入" />
</view>
<text class="info-value" v-else>{{ form.TrainNumber || '--' }}</text>
</view>
<!-- 单位名称 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>单位名称</text>
<text class="info-label" v-else>单位名称</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.UnitName" :clearable="false" type="select" placeholder="请选择" @click="handleShowUnit" />
</view>
<text class="info-value" v-else>{{ form.UnitName || '--' }}</text>
</view>
<!-- 驾驶员姓名 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>驾驶员姓名</text>
<text class="info-label" v-else>驾驶员姓名</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.DriverName" placeholder="请输入" />
</view>
<text class="info-value" v-else>{{ form.DriverName || '--' }}</text>
</view>
<!-- 驾驶员电话 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>驾驶员电话</text>
<text class="info-label" v-else>驾驶员电话</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.DriverPhone" placeholder="请输入" type="number" />
</view>
<text class="info-value" v-else>{{ form.DriverPhone || '--' }}</text>
</view>
<!-- 车牌号 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>车牌号</text>
<text class="info-label" v-else>车牌号</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.LicensePlateNumber" placeholder="请输入" />
</view>
<text class="info-value" v-else>{{ form.LicensePlateNumber || '--' }}</text>
</view>
<!-- 联系人姓名 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>联系人姓名</text>
<text class="info-label" v-else>联系人姓名</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.ContactName" placeholder="请输入" />
</view>
<text class="info-value" v-else>{{ form.ContactName || '--' }}</text>
</view>
<!-- 联系人电话 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>联系人电话</text>
<text class="info-label" v-else>联系人电话</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.ContactPhone" placeholder="请输入" type="number" />
</view>
<text class="info-value" v-else>{{ form.ContactPhone || '--' }}</text>
</view>
<!-- 备注 -->
<view class="info-item">
<text class="info-label">备注</text>
<view v-if="isEdit" class="info-input-wrap">
<u-input v-model="form.Remark" placeholder="请输入" type="textarea" />
</view>
<text class="info-value" v-else>{{ form.Remark || '--' }}</text>
</view>
<!-- 状态 -->
<view class="info-item">
<text class="info-label">状态</text>
<text class="info-value">{{ form.StateName || '--' }}</text>
</view>
<!-- 扫码添加 -->
<view class="info-item info-link" v-if="form.TrainNumberId && isEdit" @click="handleScan">
<text class="info-label">扫码添加</text>
<view class="scan-icon">
<u-icon name="scan" :size="36" color="#3577FF"></u-icon>
</view>
</view>
</view>
<!-- 包装列表 -->
<view class="package-group" v-if="form.TrainNumberId">
<view class="section-title">
<text>包装列表</text>
<text class="section-count">({{ BZList.length }})</text>
</view>
<view v-for="(item, index) in BZList" :key="index" class="package-card">
<view class="card-header">
<text class="card-title">{{ item.PackagingCode || '--' }}</text>
<view class="del-btn" @click="handleDeletePackage(item)" v-if="isEdit">
<u-icon name="trash" :size="36" color="#ffffff"></u-icon>
</view>
</view>
<view class="card-body">
<view class="card-row">
<text class="row-label">预制工作包</text>
<text class="row-value">{{ item.StackingPosition || '--' }}</text>
</view>
</view>
</view>
<view v-if="BZList.length === 0" class="package-empty">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns" v-if="isEdit">
<u-button size="medium" type="primary" :disabled="disabledBtn" @click="handleSave(0)">保存</u-button>
<u-button size="medium" type="success" :disabled="disabledBtn" @click="handleSave(1)">发货</u-button>
</view>
<view class="bottom-btns" v-if="form.State === 1">
<u-button size="medium" type="warning" :disabled="disabledBtn" @click="handleSign">签收</u-button>
</view>
<!-- 单位选择弹窗 -->
<nbd-select v-model="showUnitSelect" v-model:model="selectedUnit" :show-search="true" title="选择单位"
:list="unitList" label-key="UnitName" value-key="UnitId" @confirm="handleUnitConfirm" />
</view>
</template>
<script setup>
</script>
+512 -210
View File
@@ -1,111 +1,125 @@
<template>
<view class="page-detail">
<!-- 信息表单 -->
<!-- 基本信息 -->
<view class="info-group">
<!-- 车次 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>车次</text>
<text class="info-label" v-else>车次</text>
<u-input v-if="isEdit" v-model="form.TrainNumber" placeholder="请输入车次" />
<text class="info-label"><text class="required">*</text>车次</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.TrainNumber" placeholder="请输入车次" />
</view>
<text class="info-value" v-else>{{ form.TrainNumber || '--' }}</text>
</view>
<!-- 单位名称 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>单位名称</text>
<text class="info-label" v-else>单位名称</text>
<u-input v-if="isEdit" v-model="form.UnitName" :clearable="false" type="select" placeholder="请选择单位" @click="handleShowUnit" />
<text class="info-label"><text class="required">*</text>单位名称</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.UnitName" :clearable="false" type="select" placeholder="请选择单位"
@click="handleShowUnit" />
</view>
<text class="info-value" v-else>{{ form.UnitName || '--' }}</text>
</view>
<!-- 驾驶员姓名 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>驾驶员姓名</text>
<text class="info-label" v-else>驾驶员姓名</text>
<u-input v-if="isEdit" v-model="form.DriverName" placeholder="请输入驾驶员姓名" />
<text class="info-label"><text class="required">*</text>驾驶员姓名</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.DriverName" placeholder="请输入驾驶员姓名" />
</view>
<text class="info-value" v-else>{{ form.DriverName || '--' }}</text>
</view>
<!-- 驾驶员电话 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>驾驶员电话</text>
<text class="info-label" v-else>驾驶员电话</text>
<u-input v-if="isEdit" v-model="form.DriverPhone" placeholder="请输入驾驶员电话" type="number" />
<text class="info-label"><text class="required">*</text>驾驶员电话</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.DriverPhone" placeholder="请输入驾驶员电话" type="number" />
</view>
<text class="info-value" v-else>{{ form.DriverPhone || '--' }}</text>
</view>
<!-- 车牌号 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>车牌号</text>
<text class="info-label" v-else>车牌号</text>
<u-input v-if="isEdit" v-model="form.LicensePlateNumber" placeholder="请输入车牌号" />
<text class="info-label"><text class="required">*</text>车牌号</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.LicensePlateNumber" placeholder="请输入车牌号" />
</view>
<text class="info-value" v-else>{{ form.LicensePlateNumber || '--' }}</text>
</view>
<!-- 联系人姓名 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>联系人姓名</text>
<text class="info-label" v-else>联系人姓名</text>
<u-input v-if="isEdit" v-model="form.ContactName" placeholder="请输入联系人姓名" />
<text class="info-label"><text class="required">*</text>联系人姓名</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.ContactName" placeholder="请输入联系人姓名" />
</view>
<text class="info-value" v-else>{{ form.ContactName || '--' }}</text>
</view>
<!-- 联系人电话 -->
<view class="info-item">
<text class="info-label" v-if="isEdit"><text class="required">*</text>联系人电话</text>
<text class="info-label" v-else>联系人电话</text>
<u-input v-if="isEdit" v-model="form.ContactPhone" placeholder="请输入联系人电话" type="number" />
<text class="info-label"><text class="required">*</text>联系人电话</text>
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.ContactPhone" placeholder="请输入联系人电话" type="number" />
</view>
<text class="info-value" v-else>{{ form.ContactPhone || '--' }}</text>
</view>
<!-- 备注 -->
<view class="info-item">
<view class="info-item info-textarea">
<text class="info-label">备注</text>
<u-input v-if="isEdit" v-model="form.Remark" placeholder="请输入备注" type="textarea" />
<view class="info-input-wrap" v-if="!form.State || form.State === 0">
<u-input v-model="form.Remark" placeholder="请输入备注" type="textarea" />
</view>
<text class="info-value" v-else>{{ form.Remark || '--' }}</text>
</view>
<!-- 状态 -->
<view class="info-item">
<text class="info-label">状态</text>
<text class="info-value">{{ form.StateName || '--' }}</text>
<text class="card-tag" :class="'status-' + form.State">{{ getStatus(form.State) }}</text>
</view>
<!-- 扫码添加编辑状态有Id且未发货 -->
<view class="scan-row" v-if="form.TrainNumberId && isEdit">
<text class="scan-text">扫码添加</text>
<view class="scan-btn" @click="handleScan">
<u-icon name="scan" :size="40" color="#2979ff"></u-icon>
</view>
</view>
<!-- 包装列表 -->
<view class="package-section" v-if="form.TrainNumberId">
<text class="section-title">包装列表</text>
<view class="package-table">
<view class="table-hd">
<text class="table-td">包装编号</text>
<text class="table-td">预制工作包</text>
<text class="table-td td-operate" v-if="isEdit">操作</text>
</view>
<view v-for="(item, index) in BZList" :key="index" class="table-tr">
<text class="table-td">{{ item.PackagingCode }}</text>
<text class="table-td">{{ item.StackingPosition || '--' }}</text>
<text class="table-td td-operate" v-if="isEdit" @click="handleDeletePackage(item)">
<u-icon name="trash" :size="20" color="#fa3534"></u-icon>
</text>
</view>
<view v-if="BZList.length === 0" class="table-empty">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
<!-- 扫码添加 -->
<view class="info-item info-link" v-if="form.Id && (!form.State || form.State === 0)" @click="handleScan">
<text class="info-label">扫码添加</text>
<view class="scan-icon">
<u-icon name="scan" :size="36" color="#3577FF"></u-icon>
</view>
</view>
</view>
<!-- 包装列表 -->
<view class="package-group" v-if="form.Id">
<view class="section-title">
<text>包装列表</text>
<text class="section-count">({{ BZList.length }})</text>
</view>
<view v-for="(item, index) in BZList" :key="index" class="package-card">
<view class="card-header">
<text class="card-title">{{ item.PackagingCode || '--' }}</text>
<view class="del-btn" @click="handleDeletePackage(item)" v-if="!form.State || form.State === 0">
<u-icon name="trash" :size="36" color="#ffffff"></u-icon>
</view>
</view>
<view class="card-body">
<view class="card-row">
<text class="row-label">预制工作包</text>
<text class="row-value">{{ item.StackingPosition || '--' }}</text>
</view>
</view>
</view>
<view v-if="BZList.length === 0" class="package-empty">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns" v-if="isEdit">
<view class="bottom-btns" v-if="!form.State || form.State === 0">
<u-button size="medium" type="primary" :disabled="disabledBtn" @click="handleSave(0)">保存</u-button>
<u-button size="medium" type="success" :disabled="disabledBtn" @click="handleSave(1)">发货</u-button>
<u-button v-if="form.Id" size="medium" type="success" :disabled="disabledBtn"
@click="handleSave(1)">发货</u-button>
</view>
<view class="bottom-btns" v-if="form.State === 1">
<u-button size="medium" type="warning" :disabled="disabledBtn" @click="handleSign">签收</u-button>
@@ -114,22 +128,105 @@
<!-- 单位选择弹窗 -->
<nbd-select v-model="showUnitSelect" v-model:model="selectedUnit" :show-search="true" title="选择单位"
:list="unitList" label-key="UnitName" value-key="UnitId" @confirm="handleUnitConfirm" />
<!-- 包装详情弹窗 -->
<u-popup v-model="showBZDetail" mode="center" :closeable="true" @close="closeBZDetail">
<view class="bz-detail-modal">
<view class="modal-header">
<text class="modal-title">包装详情</text>
</view>
<view class="modal-body" v-if="currentBZInfo">
<view class="detail-row">
<text class="detail-label">包装编号</text>
<text class="detail-value">{{ currentBZInfo.PackagingCode || '--' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">最早安装时间</text>
<text class="detail-value">{{ currentBZInfo.EarliestInstallTime || '--' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">堆放位置</text>
<text class="detail-value">{{ currentBZInfo.StackingPosition || '--' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">到场状态</text>
<text class="detail-value">{{ getBZStatus(currentBZInfo.State) }}</text>
</view>
<view class="detail-row">
<text class="detail-label">联系人及电话</text>
<text class="detail-value">{{ currentBZInfo.ContactName || '' }}/{{ currentBZInfo.ContactPhone
|| '' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">收货人</text>
<text class="detail-value">{{ currentBZInfo.ReceiveMan || '--' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">收货日期</text>
<text class="detail-value">{{ currentBZInfo.ReceiveDate || '--' }}</text>
</view>
<!-- 预制组件列表 -->
<view class="prepipe-section" v-if="currentBZItems && currentBZItems.length > 0">
<view class="prepipe-title">预制组件列表{{ currentBZItems.length }}</view>
<view class="prepipe-list">
<view class="prepipe-card" v-for="(item, index) in currentBZItems" :key="index">
<view class="card-header">
<text class="card-code">{{ item.PipelineComponentCode || '--' }}</text>
</view>
<view class="card-body">
<view class="card-row">
<text class="card-label">数量/单位</text>
<text class="card-value">{{ item.PreUnit || '--' }}</text>
</view>
<view class="card-row">
<text class="card-label">所属主项</text>
<text class="card-value">{{ item.UnitWorkName || '--' }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="modal-footer">
<view class="cancel-btn" @click="closeBZDetail">取消</view>
<view class="confirm-btn" @click="confirmAddBZ">确认添加</view>
</view>
</view>
</u-popup>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store'
import { storeToRefs } from 'pinia'
import { reqUnitByProjectIdUnitType } from '@/api/base'
import { reqTrainNumberById, reqSaveTrainNumber, reqSignTrainNumber, reqDeletePackagingFromTrain, reqPackagingListByTrain } from '@/api/hj'
// 是否编辑状态
const isEdit = computed(() => !form.value.State || form.value.State === 0)
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import {
useUserStore
} from '@/store'
import {
storeToRefs
} from 'pinia'
import {
reqUnitByProjectIdUnitType
} from '@/api/base'
import {
reqTrainNumberDetail,
reqPackagingByTrain,
reqPackagingInformationById,
reqSavePackagingToTrain,
reqSaveTrainNumber,
reqTrainInfoConfirmArrival,
reqDeletePackagingFromTrain
} from '@/api/hj'
const userStore = useUserStore()
const { currentProject } = storeToRefs(userStore)
const {
currentProject,
userInfo
} = storeToRefs(userStore)
// ===== 页面状态 =====
const trainNumberId = ref('')
@@ -153,17 +250,26 @@
// ===== 单位选择 =====
const showUnitSelect = ref(false)
const unitList = ref([{ UnitId: '', UnitName: '全部单位' }])
const selectedUnit = ref({ UnitId: '', UnitName: '全部单位' })
const unitList = ref([])
const selectedUnit = ref()
// ===== 包装列表 =====
const BZList = ref([])
// ===== 包装详情弹窗 =====
const showBZDetail = ref(false)
const currentBZInfo = ref(null)
const currentBZItems = ref([])
// ===== 获取单位列表 =====
const getUnitList = async () => {
try {
if (!currentProject.value?.ProjectId) {
console.warn('currentProject 未初始化,无法获取单位列表')
return
}
const res = await reqUnitByProjectIdUnitType(currentProject.value?.ProjectId || '')
unitList.value = [{ UnitId: '', UnitName: '全部单位' }, ...(res.data || [])]
unitList.value = [...(res.data || [])]
} catch (error) {
console.error('获取单位列表失败:', error)
}
@@ -171,165 +277,329 @@
// ===== 显示单位选择 =====
const handleShowUnit = () => {
if (form.value.UnitId) {
selectedUnit.value = {
UnitId: form.value.UnitId,
UnitName: form.value.UnitName
}
if (!form.value.State || form.value.State === 0) {
showUnitSelect.value = true
}
showUnitSelect.value = true
}
// ===== 单位选择确认 =====
const handleUnitConfirm = (item) => {
form.value.UnitId = item.UnitId
form.value.UnitName = item.UnitName
selectedUnit.value = item
const handleUnitConfirm = () => {
form.value.UnitId = selectedUnit.value.UnitId
form.value.UnitName = selectedUnit.value.UnitName
showUnitSelect.value = false
}
// ===== 获取车次详情 =====
const getTrainNumberDetail = async () => {
if (!trainNumberId.value) return
// ===== 获取状态文本 =====
const getStatus = (val) => {
const map = {
'0': '待发货',
'1': '已发货',
'2': '已签收'
}
return form.value.Id && map[String(val)] || '--'
}
try {
const res = await reqTrainNumberById(trainNumberId.value)
if (res.data) {
form.value = { ...form.value, ...res.data }
selectedUnit.value = {
UnitId: res.data.UnitId,
UnitName: res.data.UnitName
// ===== 扫码添加 =====
const handleScan = () => {
uni.scanCode({
success(res) {
let result = res.result
console.log('扫码结果:', result)
if (!result.includes('PackagingManage$')) {
uni.showToast({
title: '非包装二维码',
icon: 'none',
duration: 3000
})
return
}
let bzId = result.split('$')[1]
if (bzId) {
getBZInfo(bzId)
} else {
uni.showToast({
title: '二维码格式错误',
icon: 'none'
})
}
},
fail(err) {
console.error('扫码失败:', err)
if (err.errMsg && err.errMsg.includes('cancel')) {
// 用户取消扫码
} else {
uni.showToast({
title: '扫码失败,请重试',
icon: 'none'
})
}
}
// 获取包装列表
getPackagingList()
} catch (error) {
console.error('获取车次详情失败:', error)
}
})
}
// ===== 获取包装列表 =====
const getPackagingList = async () => {
if (!trainNumberId.value) return
// ===== 获取包装信息 =====
const getBZInfo = async (bzId) => {
try {
const res = await reqPackagingListByTrain(trainNumberId.value)
BZList.value = res.data || []
} catch (error) {
console.error('获取包装列表失败:', error)
}
}
uni.showLoading({
title: '加载中...',
mask: true
})
// ===== 删除包装 =====
const handleDeletePackage = async (item) => {
try {
await reqDeletePackagingFromTrain({
trainNumberId: trainNumberId.value,
packagingManageId: item.PackagingManageId || item.PackagingId
})
uni.showToast({
title: '删除成功',
icon: 'success'
})
getPackagingList()
let params = {
projectId: currentProject.value?.ProjectId,
personId: userInfo.value?.PersonId,
packagingManageId: bzId
}
let res = await reqPackagingInformationById(params)
if (res.code == 1) {
const BZInfo = res.data.packagingManageDetailItem
const BZItem = res.data.packagingPrepipeItems
// 检查是否已存在
if (BZList.value.some(item => item.PackagingId === bzId)) {
uni.hideLoading()
return uni.showToast({
title: '该包装已存在',
icon: 'none'
})
}
// 保存当前包装信息用于弹窗显示
currentBZInfo.value = BZInfo
currentBZItems.value = BZItem || []
uni.hideLoading()
// 显示包装详情弹窗
showBZDetail.value = true
} else {
uni.hideLoading()
uni.showToast({
title: res.msg || '获取包装信息失败',
icon: 'none'
})
}
} catch (error) {
console.error('删除包装失败:', error)
console.error('获取包装信息失败:', error)
uni.hideLoading()
uni.showToast({
title: '删除失败',
title: '获取包装信息失败',
icon: 'none'
})
}
}
// ===== 扫码 =====
const handleScan = () => {
// #ifdef MP-WEIXIN
wx.scanCode({
// ===== 删除包装 =====
const handleDeletePackage = (item) => {
uni.showModal({
title: '确认删除',
content: '确定要删除该包装吗?',
success: (res) => {
console.log('扫码结果:', res)
uni.showToast({
title: '扫码成功',
icon: 'success'
})
// TODO: 根据扫码结果处理
},
fail: (err) => {
console.error('扫码失败:', err)
uni.showToast({
title: '扫码失败',
if (res.confirm) {
// TODO: 调用删除接口
reqDeletePackagingFromTrain(item.PackagingManageId).then(
(res) => {
if (res.code === 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
})
getPackagingList(form.value.Id)
} else {
uni.showToast({
title: '删除成功',
icon: 'none'
})
}
}
).catch((err) => {
uni.showToast({
title: '删除失败',
icon: 'none'
})
})
}
}
})
}
// ===== 关闭包装详情弹窗 =====
const closeBZDetail = () => {
showBZDetail.value = false
currentBZInfo.value = null
currentBZItems.value = []
}
// ===== 确认添加包装 =====
const confirmAddBZ = () => {
if (currentBZInfo.value) {
reqSavePackagingToTrain({
packagingManageId: currentBZInfo.value.PackagingManageId,
trainNumberId: trainNumberId.value
}).then(
(res) => {
if (res.code === 1) {
uni.showToast({
title: '添加成功',
})
closeBZDetail()
} else {
uni.showToast({
title: res.msg || '添加失败',
icon: 'none'
})
}
}
)
}
}
// ===== 车次详情 =====
const getInfo = async (id) => {
try {
const res = await reqTrainNumberDetail(id)
if (res.code === 1) {
form.value = res.data?.getDataList?.[0] || {}
// 直接使用接口返回的 UnitName,避免依赖 unitList
if (form.value.UnitId && unitList.value.length > 0) {
selectedUnit.value = unitList.value.find(e => e.UnitId === form.value.UnitId) || {}
if (selectedUnit.value.UnitName) {
form.value.UnitName = selectedUnit.value.UnitName
}
}
getPackagingList(form.value.Id)
}
} catch (error) {
console.error('获取车次详情失败:', error)
}
}
// 获取包装列表
const getPackagingList = async (id) => {
try {
const res = await reqPackagingByTrain(id)
if (res.code === 1) {
BZList.value = res.data || []
}
} catch (error) {
console.error('获取包装列表失败:', error)
}
}
// ===== 保存 =====
const handleSave = (type) => {
if (!form.value.TrainNumber) {
return uni.showToast({
title: '请输入车次',
icon: 'none'
})
}
if (!form.value.UnitId) {
return uni.showToast({
title: '请选择单位',
icon: 'none'
})
}
if (!form.value.DriverName) {
return uni.showToast({
title: '请输入驾驶员姓名',
icon: 'none'
})
}
if (!form.value.DriverPhone) {
return uni.showToast({
title: '请输入驾驶员电话',
icon: 'none'
})
}
if (!form.value.LicensePlateNumber) {
return uni.showToast({
title: '请输入车牌号',
icon: 'none'
})
}
if (!form.value.ContactName) {
return uni.showToast({
title: '请输入联系人姓名',
icon: 'none'
})
}
if (!form.value.ContactPhone) {
return uni.showToast({
title: '请输入联系人电话',
icon: 'none'
})
}
const params = {
Id: form.value.Id || '',
TrainNumber: form.value.TrainNumber,
UnitId: form.value.UnitId,
ProjectId: userInfo.value?.ProjectId || '',
State: type,
DriverName: form.value.DriverName,
DriverPhone: form.value.DriverPhone,
LicensePlateNumber: form.value.LicensePlateNumber,
ContactName: form.value.ContactName,
ContactPhone: form.value.ContactPhone,
Remark: form.value.Remark || ''
}
if (type === 1) {
// 检查是否已添加包装
if (!BZList.value.length) {
return uni.showToast({
title: '请添加包装',
icon: 'none'
})
}
})
// #endif
// 发货需要确认
uni.showModal({
title: '提示',
content: '是否确认发货',
showCancel: true,
success: (res) => {
if (res.confirm) {
saveTrainNumber(params)
}
}
})
} else {
// 保存直接调用
saveTrainNumber(params)
}
}
// ===== 保存/发货 =====
const handleSave = async (state) => {
// 验证必填项
if (!form.value.TrainNumber) {
uni.showToast({ title: '请输入车次', icon: 'none' })
return
}
if (!form.value.UnitId) {
uni.showToast({ title: '请选择单位', icon: 'none' })
return
}
if (!form.value.DriverName) {
uni.showToast({ title: '请输入驾驶员姓名', icon: 'none' })
return
}
if (!form.value.DriverPhone) {
uni.showToast({ title: '请输入驾驶员电话', icon: 'none' })
return
}
if (!form.value.LicensePlateNumber) {
uni.showToast({ title: '请输入车牌号', icon: 'none' })
return
}
if (!form.value.ContactName) {
uni.showToast({ title: '请输入联系人姓名', icon: 'none' })
return
}
if (!form.value.ContactPhone) {
uni.showToast({ title: '请输入联系人电话', icon: 'none' })
return
}
disabledBtn.value = true
// 保存车次信息
const saveTrainNumber = async (params) => {
try {
const res = await reqSaveTrainNumber({
trainNumberId: trainNumberId.value || '',
projectId: currentProject.value?.ProjectId || '',
unitId: form.value.UnitId,
trainNumber: form.value.TrainNumber,
driverName: form.value.DriverName,
driverPhone: form.value.DriverPhone,
licensePlateNumber: form.value.LicensePlateNumber,
contactName: form.value.ContactName,
contactPhone: form.value.ContactPhone,
remark: form.value.Remark,
state: state
})
disabledBtn.value = true
const res = await reqSaveTrainNumber(params)
if (res.code === 1) {
// 更新表单状态
form.value.Id = res.data?.id || form.value.Id
form.value.State = params.State
if (res.code === 1 || res.data) {
uni.showToast({
title: state === 1 ? '发货成功' : '保存成功',
icon: 'success'
title: params.State === 1 ? '发货成功' : '保存成功',
icon: 'none'
})
setTimeout(() => {
const newId = res.data?.trainNumberId || trainNumberId.value
uni.redirectTo({
url: `/pipe/deliver/add?id=${newId}&from=1`
uni.navigateBack({
delta: 1
})
}, 1500)
}, 900)
} else {
uni.showToast({
title: res.msg || '操作失败',
icon: 'none'
})
}
} catch (error) {
console.error('保存失败:', error)
uni.showToast({
title: '保存失败,请重试',
title: '操作失败',
icon: 'none'
})
} finally {
@@ -338,47 +608,79 @@
}
// ===== 签收 =====
const handleSign = async () => {
disabledBtn.value = true
try {
const res = await reqSignTrainNumber({
trainNumberId: trainNumberId.value,
personId: currentProject.value?.PersonId || ''
const handleSign = () => {
// 检查是否已添加包装
if (!BZList.value.length) {
return uni.showToast({
title: '请添加包装',
icon: 'none'
})
}
uni.showModal({
title: '提示',
content: '是否确认签收',
showCancel: true,
success: (res) => {
if (res.confirm) {
signTrainNumber()
}
}
})
}
// 签收车次
const signTrainNumber = async () => {
try {
const res = await reqTrainInfoConfirmArrival(userInfo.value?.UserId || '', form.value.Id)
if (res.code === 1) {
uni.showToast({
title: '签收成功',
icon: 'success'
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
uni.navigateBack({
delta: 1
})
}, 900)
} else {
uni.showToast({
title: res.msg || '签收失败',
icon: 'none'
})
}
} catch (error) {
console.error('签收失败:', error)
uni.showToast({
title: '签收失败,请重试',
title: '签收失败',
icon: 'none'
})
} finally {
disabledBtn.value = false
}
}
// ===== 生命周期 =====
onLoad((options) => {
if (options.id) {
trainNumberId.value = options.id
// ===== 包装到场状态 =====
const getBZStatus = (state) => {
const statusMap = {
0: '待发货',
1: '已发货',
2: '已签收',
3: '已到场'
}
})
return statusMap[state] || '--'
}
onShow(() => {
getUnitList()
// ===== 生命周期 =====
onLoad(async (options) => {
trainNumberId.value = options?.id || ''
// 并行加载单位列表和车次详情
if (trainNumberId.value) {
getTrainNumberDetail()
await Promise.all([
getUnitList(),
getInfo(trainNumberId.value)
])
} else {
await getUnitList()
}
})
</script>
</script>
+1 -1
View File
@@ -211,7 +211,7 @@ import { reqTrainNumberList } from '@/api/hj'
const clickTap = (item) => {
uni.navigateTo({
url: `/pipe/deliver/detail?id=${item.TrainNumberId}&from=1`
url: `/pipe/deliver/detail?id=${item.Id}&from=1`
})
}
+110
View File
@@ -0,0 +1,110 @@
<template>
<view class="page-detail">
<!-- 基本信息 -->
<view class="info-group">
<view class="info-item">
<text class="info-label">预制图纸名称</text>
<text class="info-value">{{ form.DrawingName || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">组件编号</text>
<text class="info-value">{{ form.PipelineComponentCode || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">物流箱号</text>
<text class="info-value">{{ form.BoxNumber || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">计划安装日期</text>
<text class="info-value">{{ form.PlanStartDate || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">验收人</text>
<text class="info-value">{{ form.ReceiveMan || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">验收日期</text>
<text class="info-value">{{ form.ReceiveDate || '--' }}</text>
</view>
<view class="info-item">
<text class="info-label">状态</text>
<text class="card-tag" :class="getStatusClass(form.State)">{{ getStatus(form.State) }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
// 表单数据
const form = ref({
PipelineComponentId: '',
DrawingName: '',
PipelineComponentCode: '',
BoxNumber: '',
PlanStartDate: '',
ReceiveMan: '',
ReceiveDate: '',
State: 0
})
// 获取状态文本
const getStatus = (state) => {
const statusMap = {
0: '未验收',
1: '已验收',
2: '已出库',
'-2': '待整改',
'-1': '已整改'
}
return statusMap[state] || '--'
}
// 获取状态样式类
const getStatusClass = (state) => {
const classMap = {
0: 'status-0',
1: 'status-2',
2: 'status-3',
'-2': 'status-1',
'-1': 'status-2'
}
return classMap[state] || 'status-0'
}
// 获取详情
const getInfo = async (id) => {
try {
// 替换为实际的API调用
const res = {
code: 1,
data: {
PipelineComponentId: id,
DrawingName: '预制组件A-001',
PipelineComponentCode: 'PC-2024-001',
BoxNumber: 'BOX-001',
PlanStartDate: '2024-01-15',
ReceiveMan: '张三',
ReceiveDate: '',
State: 0
}
}
if (res.code === 1) {
form.value = { ...form.value, ...res.data }
}
} catch (error) {
console.error('获取预制组件详情失败:', error)
}
}
// 生命周期
onLoad((options) => {
const id = options?.id || ''
if (id) {
getInfo(id)
}
})
</script>
+240
View File
@@ -0,0 +1,240 @@
<template>
<view class="page-list">
<!-- 标签页 -->
<u-tabs
:list="tabs"
:current="activeTab"
active-color="#3577FF"
inactive-color="#666"
:border-bottom="false"
@change="onTabChange"
></u-tabs>
<!-- 预制组件列表 -->
<scroll-view class="list-scroll" scroll-y @scrolltolower="loadMore" refresher-enabled
:refresher-triggered="refreshing" @refresh="handleRefresh">
<view class="list-wrap">
<view v-for="(item, index) in list" :key="index" class="card-item" @click="goDetail(item)">
<view class="card-header">
<text class="card-title">{{ item.DrawingName || '--' }}</text>
<text class="card-tag" :class="'status-' + item.State">
{{ getStatus(item.State) }}
</text>
</view>
<view class="card-body">
<view class="card-row">
<text class="row-label">组件编号</text>
<text class="row-value">{{ item.PipelineComponentCode || '--' }}</text>
</view>
<view class="card-row">
<text class="row-label">物流箱号</text>
<text class="row-value">{{ item.BoxNumber || '--' }}</text>
</view>
<view class="card-row">
<text class="row-label">计划安装日期</text>
<text class="row-value">{{ formatDate(item.PlanStartDate) || '--' }}</text>
</view>
<view class="card-row">
<text class="row-label">验收人</text>
<text class="row-value">{{ item.ReceiveMan || '--' }}</text>
</view>
<view class="card-row">
<text class="row-label">验收日期</text>
<text class="row-value">{{ formatDate(item.ReceiveDate) || '--' }}</text>
</view>
</view>
</view>
<!-- 空状态 -->
<u-empty v-if="!loading && list.length === 0" mode="list" text="暂无数据"></u-empty>
<!-- 加载提示 -->
<view v-if="loading && list.length > 0" class="loading-more">
<u-loading mode="circle" size="32"></u-loading>
<text>加载中...</text>
</view>
<!-- 没有更多 -->
<view v-if="!loading && isFinished && list.length > 0" class="no-more">
<text> 没有更多了 </text>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store'
import { storeToRefs } from 'pinia'
import {reqPipelineComponentList} from '@/api/hj'
const userStore = useUserStore()
const { currentProject } = storeToRefs(userStore)
// 标签页配置(u-tabs格式)
const tabs = ref([
{ name: '未验收', state: 0 },
{ name: '已验收', state: 1 },
{ name: '已出库', state: 2 },
{ name: '待整改', state: -2 },
{ name: '已整改', state: -1 }
])
// 页面状态
const activeTab = ref(0)
const list = ref([])
const loading = ref(false)
const refreshing = ref(false)
const isFinished = ref(false)
const pageIndex = ref(1)
const pageSize = ref(10)
// 获取状态值
const getState = (index) => {
if (index === 3) return -2
if (index === 4) return -1
return index
}
// 状态映射
const getStatus = (val) => {
const map = {
'0': '未验收',
'1': '已验收',
'2': '已出库',
'-2': '待整改',
'-1': '已整改'
}
return map[String(val)] || '--'
}
// 切换标签
const onTabChange = (index) => {
activeTab.value = index
handleRefresh()
}
// 获取列表
const getList = async () => {
if (loading.value || (!refreshing.value && isFinished.value)) return
loading.value = true
try {
const params = {
projectId: currentProject.value?.ProjectId || '',
pageindex: pageIndex.value,
pagesize: pageSize.value,
state: getState(activeTab.value)
}
const res = await reqPipelineComponentList(params)
if (res.code === 1) {
const dataList = res.data?.getDataList || []
if (dataList.length < pageSize.value) {
isFinished.value = true
}
if (refreshing.value) {
list.value = dataList
} else {
list.value = [...list.value, ...dataList]
}
}
} catch (error) {
console.error('获取预制组件列表失败:', error)
uni.showToast({
title: '加载失败,请重试',
icon: 'none'
})
} finally {
loading.value = false
refreshing.value = false
}
}
// 刷新
const handleRefresh = () => {
pageIndex.value = 1
isFinished.value = false
list.value = []
getList()
}
// 加载更多
const loadMore = () => {
if (!loading.value && !isFinished.value) {
pageIndex.value++
getList()
}
}
// 格式化日期
const formatDate = (date) => {
if (!date) return ''
return date
}
// 跳转到详情
const goDetail = (item) => {
uni.navigateTo({
url: `/pipe/precast/detail?id=${item.PipelineComponentId}&from=1`
})
}
// 生命周期
onShow(() => {
handleRefresh()
})
</script>
<style lang="scss" scoped>
.page-list {
min-height: 100vh;
background: #f5f6f8;
}
.list-scroll {
height: calc(100vh - 180rpx);
}
.list-wrap {
padding: 24rpx;
}
.card-tag.status--2 {
background: rgba(255, 82, 82, 0.1);
color: #ff5252;
}
.card-tag.status--1 {
background: rgba(255, 167, 38, 0.1);
color: #ffa726;
}
.loading-more {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx;
text {
font-size: 26rpx;
color: #999;
margin-left: 12rpx;
}
}
.no-more {
text-align: center;
padding: 30rpx;
text {
font-size: 24rpx;
color: #ccc;
}
}
</style>
+1
View File
@@ -46,6 +46,7 @@ export const defaultApps = [{
name: '预制组件管理',
icon: 'yuzhijian',
menuId: "8255554C-0A92-4C7B-BF19-779AF0220A8C",
path: "/pipe/precast/list",
prefix: 'nbd-icon',
selected: false
}