预制组件详情
This commit is contained in:
@@ -118,3 +118,9 @@ export const reqDeletePackagingFromTrain = (id='')=>get(`TrainNumberManage/Delet
|
|||||||
* @param {Object} params - { projectId, pageindex, pagesize, state }
|
* @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}`)
|
export const reqPipelineComponentList = (params={})=>get(`/PipelineComponent/GetPipelineComponentList?projectId=${params.projectId}&pageindex=${params.pageindex}&pagesize=${params.pagesize}&state=${params.state}`)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预制组件验收
|
||||||
|
* @param {Object} params - { PipelineComponentId, PersonId, Message }
|
||||||
|
*/
|
||||||
|
export const reqPipelineComponentAccept = (params={})=>get(`/PipelineComponent/GetComponentConfirmArrival?PipelineComponentId=${params.PipelineComponentId}&PersonId=${params.PersonId}&Message=${params.Message}`)
|
||||||
|
|||||||
+167
-64
@@ -3,108 +3,211 @@
|
|||||||
<!-- 基本信息 -->
|
<!-- 基本信息 -->
|
||||||
<view class="info-group">
|
<view class="info-group">
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">预制图纸名称</text>
|
<text class="info-label">组件编号</text>
|
||||||
<text class="info-value">{{ form.DrawingName || '--' }}</text>
|
<text class="info-value">{{ info.PipelineComponentCode || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">组件编号</text>
|
<text class="info-label">预制图纸名称</text>
|
||||||
<text class="info-value">{{ form.PipelineComponentCode || '--' }}</text>
|
<text class="info-value">{{ info.DrawingName || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">物流箱号</text>
|
<text class="info-label">物流箱号</text>
|
||||||
<text class="info-value">{{ form.BoxNumber || '--' }}</text>
|
<text class="info-value">{{ info.BoxNumber || '--' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="info-label">组件状态</text>
|
||||||
|
<text class="card-tag" :class="'status-' + info.State">{{ getStatus(info.State) }}</text>
|
||||||
|
</view>
|
||||||
|
<view v-if="info.State == -1 || info.State == -2" class="info-item">
|
||||||
|
<text class="info-label">验收意见</text>
|
||||||
|
<text class="info-value">{{ info.Remark || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">计划安装日期</text>
|
<text class="info-label">计划安装日期</text>
|
||||||
<text class="info-value">{{ form.PlanStartDate || '--' }}</text>
|
<text class="info-value">{{ info.PlanStartDate || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">验收人</text>
|
<text class="info-label">验收人</text>
|
||||||
<text class="info-value">{{ form.ReceiveMan || '--' }}</text>
|
<text class="info-value">{{ info.ReceiveMan || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="info-label">验收日期</text>
|
<text class="info-label">验收日期</text>
|
||||||
<text class="info-value">{{ form.ReceiveDate || '--' }}</text>
|
<text class="info-value">{{ info.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>
|
</view>
|
||||||
|
|
||||||
|
<!-- 验收操作 -->
|
||||||
|
<view v-if="isShow && info.State == 0" class="info-group">
|
||||||
|
<view class="info-item">
|
||||||
|
<text class="info-label">是否通过</text>
|
||||||
|
<u-radio-group v-model="isPass" @change="onPassChange">
|
||||||
|
<u-radio :name="1" label="通过" active-color="#3577FF"></u-radio>
|
||||||
|
<u-radio :name="0" label="不通过" active-color="#3577FF" style="margin-left: 32rpx;"></u-radio>
|
||||||
|
</u-radio-group>
|
||||||
|
</view>
|
||||||
|
<view v-if="isPass == 0" class="info-item">
|
||||||
|
<text class="info-label">验收意见</text>
|
||||||
|
<u-input
|
||||||
|
type="select"
|
||||||
|
:value="idea || '请选择验收意见'"
|
||||||
|
readonly
|
||||||
|
@click="onShowIdea"
|
||||||
|
placeholder="请选择验收意见"
|
||||||
|
></u-input>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<view v-if="isShow && info.State == 0" class="bottom-btns">
|
||||||
|
<u-button size="medium" type="primary" @click="saveModel">验收</u-button>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 验收意见选择弹窗 -->
|
||||||
|
<nbd-select v-model="showIdea" v-model:model="selectedIdea" title="选择验收意见" :list="ideaList"
|
||||||
|
label-key="label" value-key="value" @confirm="onIdeaConfirm" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { reqPipelineComponentById, reqPipelineComponentAccept } from '@/api/hj.js'
|
||||||
|
|
||||||
// 表单数据
|
// ==== 状态库 ====
|
||||||
const form = ref({
|
const userStore = useUserStore()
|
||||||
PipelineComponentId: '',
|
const { currentProject, userInfo } = storeToRefs(userStore)
|
||||||
DrawingName: '',
|
|
||||||
PipelineComponentCode: '',
|
|
||||||
BoxNumber: '',
|
|
||||||
PlanStartDate: '',
|
|
||||||
ReceiveMan: '',
|
|
||||||
ReceiveDate: '',
|
|
||||||
State: 0
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取状态文本
|
// ===== 数据 =====
|
||||||
const getStatus = (state) => {
|
const info = ref({})
|
||||||
const statusMap = {
|
const from = ref('1')
|
||||||
0: '未验收',
|
const isShow = ref(false)
|
||||||
1: '已验收',
|
const id = ref(null)
|
||||||
2: '已出库',
|
|
||||||
|
// 验收相关
|
||||||
|
const isPass = ref(1)
|
||||||
|
const showIdea = ref(false)
|
||||||
|
const selectedIdea = ref({ label: '', value: '' })
|
||||||
|
const idea = ref('')
|
||||||
|
const ideaList = ref([
|
||||||
|
{ label: '焊缝外观成形差', value: '焊缝外观成形差' },
|
||||||
|
{ label: '未酸洗', value: '未酸洗' },
|
||||||
|
{ label: '标识不全', value: '标识不全' },
|
||||||
|
{ label: '污迹', value: '污迹' },
|
||||||
|
{ label: '未进行成品保护', value: '未进行成品保护' }
|
||||||
|
])
|
||||||
|
|
||||||
|
// ===== 状态文本 =====
|
||||||
|
const getStatus = (val) => {
|
||||||
|
const map = {
|
||||||
|
'0': '未验收',
|
||||||
|
'1': '已验收',
|
||||||
|
'2': '已出库',
|
||||||
'-2': '待整改',
|
'-2': '待整改',
|
||||||
'-1': '已整改'
|
'-1': '已整改'
|
||||||
}
|
}
|
||||||
return statusMap[state] || '--'
|
return map[String(val)] || '--'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取状态样式类
|
// ===== 获取详情 =====
|
||||||
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) => {
|
const getInfo = async (id) => {
|
||||||
try {
|
try {
|
||||||
// 替换为实际的API调用
|
const params = {
|
||||||
const res = {
|
projectId: currentProject.value?.ProjectId,
|
||||||
code: 1,
|
personId: userInfo.value?.PersonId,
|
||||||
data: {
|
PipelineComponentId: id
|
||||||
PipelineComponentId: id,
|
|
||||||
DrawingName: '预制组件A-001',
|
|
||||||
PipelineComponentCode: 'PC-2024-001',
|
|
||||||
BoxNumber: 'BOX-001',
|
|
||||||
PlanStartDate: '2024-01-15',
|
|
||||||
ReceiveMan: '张三',
|
|
||||||
ReceiveDate: '',
|
|
||||||
State: 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
const res = await reqPipelineComponentById(params)
|
||||||
if (res.code === 1) {
|
if (res.code === 1) {
|
||||||
form.value = { ...form.value, ...res.data }
|
info.value = res.data.pipelineComponentItem
|
||||||
|
if (from.value === '0' && res.data.isPower) {
|
||||||
|
isShow.value = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取预制组件详情失败:', error)
|
console.error('获取预制组件详情失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '加载失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生命周期
|
// ===== 验收相关操作 =====
|
||||||
onLoad((options) => {
|
const onPassChange = (val) => {
|
||||||
const id = options?.id || ''
|
isPass.value = val
|
||||||
if (id) {
|
// 切换为"通过"时清空验收意见
|
||||||
getInfo(id)
|
if (val === 1) {
|
||||||
|
idea.value = ''
|
||||||
|
selectedIdea.value = { label: '', value: '' }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const onShowIdea = () => {
|
||||||
|
showIdea.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const onIdeaConfirm = (item) => {
|
||||||
|
idea.value = item.label
|
||||||
|
selectedIdea.value = item
|
||||||
|
showIdea.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveModel = () => {
|
||||||
|
if (isPass.value === 0 && !idea.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请选择验收意见',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.showModal({
|
||||||
|
title: '确认验收',
|
||||||
|
content: `确定要验收该组件吗?`,
|
||||||
|
success: async (modalRes) => {
|
||||||
|
if (modalRes.confirm) {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
PipelineComponentId: id.value,
|
||||||
|
PersonId: userInfo.value?.PersonId,
|
||||||
|
Message: isPass.value === 1 ? '' : idea.value
|
||||||
|
}
|
||||||
|
const res = await reqPipelineComponentAccept(params)
|
||||||
|
if (res.code === 1) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '验收成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
|
}, 2000)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg || '网络异常',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('验收失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '网络异常',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 生命周期 =====
|
||||||
|
onLoad((query) => {
|
||||||
|
id.value = query.id
|
||||||
|
from.value = query.from
|
||||||
|
getInfo(query.id)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user