包装新增页面

This commit is contained in:
2026-06-11 15:49:17 +08:00
parent 780814bad4
commit 5b3fc66a36
6 changed files with 239 additions and 37 deletions
+25 -12
View File
@@ -8,17 +8,7 @@ import {
*/ */
export const reqHJIndexData = (projectId) => get(`HJGLIndex/GetJGLIndexItem?projectId=${projectId}`) export const reqHJIndexData = (projectId) => get(`HJGLIndex/GetJGLIndexItem?projectId=${projectId}`)
/** // ======================= 焊接日报 ==========================================
* 获取点口管理列表
*/
export const reqGetNotEndPointBatch = (unitWorkId, projectId) => get(
`NDETrust/getNotEndPointBatch?unitWorkId=${unitWorkId}&projectId=${projectId}`)
/**
* 获取点口详情列表
*/
export const reqGetPointBatchDetail = (id) => get(`NDETrust/getPointBatchDetail?pointBatchId=${id}`)
/** /**
* 获取焊接日报详情 * 获取焊接日报详情
*/ */
@@ -30,14 +20,37 @@ export const reqGetWeldJointByWeldJointId = (id) => get(`PipeJoint/getWeldJointB
export const reqSaveWeldingDailyByWeldJointId = (data) => get( export const reqSaveWeldingDailyByWeldJointId = (data) => get(
`PreWeldingDaily/SaveWeldingDailyByWeldJointId?WeldJointId=${data.WeldJointId||''}&Personid=${data.Personid||''}&time=${data.time||''}&weldingLocation=${data.weldingLocation||''}&welderType=${data.welderType||''}` `PreWeldingDaily/SaveWeldingDailyByWeldJointId?WeldJointId=${data.WeldJointId||''}&Personid=${data.Personid||''}&time=${data.time||''}&weldingLocation=${data.weldingLocation||''}&welderType=${data.welderType||''}`
) )
// ==================== 点口管理 ================================================
/** /**
* 点口 * 点口
*/ */
export const reqGetManualPointSave = (weldJointId)=>get(`NDETrust/getManualPointSave?weldJointId=${weldJointId}`) export const reqGetManualPointSave = (weldJointId)=>get(`NDETrust/getManualPointSave?weldJointId=${weldJointId}`)
/**
* 获取点口管理列表
*/
export const reqGetNotEndPointBatch = (unitWorkId, projectId) => get(
`NDETrust/getNotEndPointBatch?unitWorkId=${unitWorkId}&projectId=${projectId}`)
/**
* 获取点口详情列表
*/
export const reqGetPointBatchDetail = (id) => get(`NDETrust/getPointBatchDetail?pointBatchId=${id}`)
// ========================= 包装管理 ==================================== // ========================= 包装管理 ====================================
/** /**
* 包装管理列表 * 包装管理列表
*/ */
export const reqPackagingInformationList = (data)=> get(`PackagingManage/GetPackagingInformationList?unitId=${data.unitId}&projectId=${data.projectId}&pageindex=${data.pageIndex}&pagesize=${data.pageSize}&packagingCode=${data.packagingCode}&hasTrainNumber=${data.hasTrainNumber}`) export const reqPackagingInformationList = (data)=> get(`PackagingManage/GetPackagingInformationList?unitId=${data.unitId}&projectId=${data.projectId}&pageindex=${data.pageIndex}&pagesize=${data.pageSize}&packagingCode=${data.packagingCode}&hasTrainNumber=${data.hasTrainNumber}`)
/**
* 获取包装编号
*/
export const reqPackagingNumberByProjectId = (projectId)=>get(`PackagingManage/GetPackagingNumberByProjectId?projectId=${projectId}`)
/**
* 请求包装分类
*/
export const reqPackagingManage = ()=>get(`PackagingManage/GetPackagingCategories`)
/**
* 保存包装
*/
export const reqSavePackaging = (data)=> post(`PackagingManage/SavePackaging`, data)
+16 -11
View File
@@ -783,7 +783,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
padding: 28rpx 32rpx; padding: 28rpx 32rpx;
border-bottom: 1rpx solid #f5f6f8; border-bottom: 1rpx solid #f0f0f0;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
@@ -794,23 +794,28 @@
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #666;
flex-shrink: 0; flex-shrink: 0;
display: flex;
align-items: center;
.required {
color: #ff4d4f;
margin-right: 4rpx;
}
} }
.info-value { .info-value {
flex: 1; flex: 1;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
text-align: right; text-align: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
&.info-link { .u-input {
.info-value { flex: 1;
color: #999; background: transparent;
}
&:active {
background: #f8f9fa;
}
} }
} }
@@ -829,7 +834,7 @@
height: 80rpx; height: 80rpx;
font-size: 28rpx; font-size: 28rpx;
border-radius: 8rpx; border-radius: 8rpx;
width: 45% !important; flex: 1;
margin: 0; margin: 0;
} }
+13 -2
View File
@@ -59,8 +59,19 @@
{ {
"path": "packaging/list", "path": "packaging/list",
"style": { "style": {
"navigationBarTitleText": "包装管理", "navigationBarTitleText": "包装管理"
"enablePullDownRefresh": true }
},
{
"path": "packaging/add",
"style": {
"navigationBarTitleText": "包装管理"
}
},
{
"path": "packaging/detail",
"style": {
"navigationBarTitleText": "包装管理"
} }
} }
] ]
+165 -4
View File
@@ -1,8 +1,169 @@
<template> <template>
<view class="page-detail">
<!-- 信息表单 -->
<view class="info-group">
<view class="info-item">
<text class="info-label">包装编号</text>
<text class="info-value">{{ form.PackagingCode || '保存后显示' }}</text>
</view>
<view class="info-item">
<text class="info-label">货物类型</text>
<text class="info-value">{{ form.TypeName || '预制组件' }}</text>
</view>
<view class="info-item">
<text class="info-label"><text class="required">*</text>预制工作包</text>
<u-input v-model="form.StackingPosition" placeholder="工作包 XX+ 工作包 XX" />
</view>
<view class="info-item">
<text class="info-label"><text class="required">*</text>包装分类</text>
<u-input v-model="form.CategoryName" :clearable="false" type="select" placeholder="请选择" @click="handleShowCategory" />
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns">
<u-button class="btn-submit" size="medium" type="primary" @click="handleSave">保存</u-button>
</view>
<!-- 包装分类选择弹窗 -->
<nbd-select v-model="showCategory" v-model:model="selectedCategory" title="选择包装分类" :list="categoryList" label-key="label" value-key="value"
@confirm="handleCategoryConfirm" />
</view>
</template> </template>
<script> <script setup>
</script> import {
ref
} from 'vue'
import {
useUserStore
} from '@/store'
import {
storeToRefs
} from 'pinia'
import {
onShow
} from '@dcloudio/uni-app'
import {
reqPackagingNumberByProjectId,
reqPackagingManage,
reqSavePackaging
} from '@/api/hj.js'
<style> const userStore = useUserStore()
</style> const {
currentProject
} = storeToRefs(userStore)
// ===== 表单数据 =====
const form = ref({
PackagingCode: '',
TypeName: '预制组件',
TypeInt: 10,
CategoryName: '',
CategoryInt: '',
StackingPosition: ''
})
// ===== 弹窗 =====
const showCategory = ref(false)
const categoryList = ref([])
const selectedCategory = ref({ label: '', value: '' })
// ===== 选择事件 =====
const handleShowCategory = () => {
// 同步当前选中的值
if (form.value.CategoryName) {
selectedCategory.value = {
label: form.value.CategoryName,
value: form.value.CategoryInt
}
}
showCategory.value = true
}
const handleCategoryConfirm = (item) => {
form.value.CategoryName = item.label
form.value.CategoryInt = item.value
selectedCategory.value = item
showCategory.value = false
}
// ===== 获取包装分类 =====
const getCategoryList = async () => {
try {
const res = await reqPackagingManage()
categoryList.value = Object.entries(res.data || {}).map(([label, value]) => ({ label, value }))
// 设置默认值为第一个
if (categoryList.value.length > 0 && !form.value.CategoryName) {
form.value.CategoryName = categoryList.value[0].label
form.value.CategoryInt = categoryList.value[0].value
}
} catch (error) {
console.error('获取包装分类失败:', error)
}
}
// ===== 保存 =====
const handleSave = async () => {
if (!form.value.StackingPosition) {
uni.showToast({
title: '请输入预制工作包',
icon: 'none'
})
return
}
if (!form.value.CategoryInt) {
uni.showToast({
title: '请选择包装分类',
icon: 'none'
})
return
}
try {
const res = await reqSavePackaging({
projectId: currentProject.value?.ProjectId,
PackagingCode: form.value.PackagingCode,
CategoryInt: form.value.CategoryInt,
TypeInt: form.value.TypeInt,
StackingPosition: form.value.StackingPosition,
State: 0
})
if (res.code === 1 || res.data) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
uni.redirectTo({
url: '/pipe/packaging/detail?id'+res.data.id
})
}, 1500)
}
} catch (error) {
console.error('保存失败:', error)
uni.showToast({
title: '保存失败,请重试',
icon: 'none'
})
}
}
// ===== 获取包装编号 =====
const getPackagingNo = async () => {
try {
const res = await reqPackagingNumberByProjectId(currentProject.value?.ProjectId)
form.value.PackagingCode = res.data
} catch (error) {
console.error('获取包装编号失败:', error)
}
}
// ===== 生命周期 =====
onShow(() => {
getPackagingNo()
getCategoryList()
})
</script>
+8
View File
@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>
+10 -6
View File
@@ -95,7 +95,6 @@ n <!-- 新增按钮 -->
<script setup> <script setup>
import { import {
ref, ref,
onMounted,
computed computed
} from 'vue' } from 'vue'
import { import {
@@ -110,7 +109,8 @@ n <!-- 新增按钮 -->
import { import {
reqPackagingInformationList reqPackagingInformationList
} from '@/api/hj.js' } from '@/api/hj.js'
import {
onShow } from '@dcloudio/uni-app'
const userStore = useUserStore() const userStore = useUserStore()
const { const {
currentProject currentProject
@@ -174,10 +174,14 @@ n <!-- 新增按钮 -->
hasTrainNumber: hasTrainNumber.value hasTrainNumber: hasTrainNumber.value
}) })
const pageData = res.data?.getDataList || [] const pageData = res.data?.list || res.data?.getDataList || []
hasMore.value = pageData.length === pageSize hasMore.value = pageData.length === pageSize
listData.value = [...listData.value, ...pageData] if (isRefresh) {
listData.value = pageData
} else {
listData.value = [...listData.value, ...pageData]
}
} catch (error) { } catch (error) {
console.error('加载数据失败:', error) console.error('加载数据失败:', error)
uni.showToast({ uni.showToast({
@@ -241,7 +245,7 @@ n <!-- 新增按钮 -->
} }
// ===== 生命周期 ===== // ===== 生命周期 =====
onMounted(() => { onShow(() => {
fetchData(true) resetAndLoad()
}) })
</script> </script>