包装新增页面
This commit is contained in:
@@ -8,17 +8,7 @@ import {
|
||||
*/
|
||||
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(
|
||||
`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 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
@@ -783,7 +783,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 28rpx 32rpx;
|
||||
border-bottom: 1rpx solid #f5f6f8;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
@@ -794,23 +794,28 @@
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.required {
|
||||
color: #ff4d4f;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.info-value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
text-align: right;
|
||||
text-align: left;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&.info-link {
|
||||
.info-value {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #f8f9fa;
|
||||
}
|
||||
.u-input {
|
||||
flex: 1;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,7 +834,7 @@
|
||||
height: 80rpx;
|
||||
font-size: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
width: 45% !important;
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -59,8 +59,19 @@
|
||||
{
|
||||
"path": "packaging/list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "包装管理",
|
||||
"enablePullDownRefresh": true
|
||||
"navigationBarTitleText": "包装管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "packaging/add",
|
||||
"style": {
|
||||
"navigationBarTitleText": "包装管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "packaging/detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "包装管理"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
+165
-4
@@ -1,8 +1,169 @@
|
||||
<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>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
<script setup>
|
||||
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>
|
||||
</style>
|
||||
const userStore = useUserStore()
|
||||
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>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
+11
-7
@@ -95,7 +95,6 @@ n <!-- 新增按钮 -->
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
@@ -110,7 +109,8 @@ n <!-- 新增按钮 -->
|
||||
import {
|
||||
reqPackagingInformationList
|
||||
} from '@/api/hj.js'
|
||||
|
||||
import {
|
||||
onShow } from '@dcloudio/uni-app'
|
||||
const userStore = useUserStore()
|
||||
const {
|
||||
currentProject
|
||||
@@ -174,10 +174,14 @@ n <!-- 新增按钮 -->
|
||||
hasTrainNumber: hasTrainNumber.value
|
||||
})
|
||||
|
||||
const pageData = res.data?.getDataList || []
|
||||
const pageData = res.data?.list || res.data?.getDataList || []
|
||||
hasMore.value = pageData.length === pageSize
|
||||
|
||||
listData.value = [...listData.value, ...pageData]
|
||||
|
||||
if (isRefresh) {
|
||||
listData.value = pageData
|
||||
} else {
|
||||
listData.value = [...listData.value, ...pageData]
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载数据失败:', error)
|
||||
uni.showToast({
|
||||
@@ -241,7 +245,7 @@ n <!-- 新增按钮 -->
|
||||
}
|
||||
|
||||
// ===== 生命周期 =====
|
||||
onMounted(() => {
|
||||
fetchData(true)
|
||||
onShow(() => {
|
||||
resetAndLoad()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user