新增焊缝外观检测

This commit is contained in:
huhao
2026-08-17 11:29:27 +08:00
parent 57bd21d6b9
commit b342fb971b
10 changed files with 902 additions and 13 deletions
+10
View File
@@ -31,6 +31,16 @@ export const reqToDoItemByProjectIdUserId = (projectId, personId)=>get(`ToDoItem
*/ */
export const reqGetGrooveTypeList = ()=>get(`BaseInfo/GetGrooveType`) export const reqGetGrooveTypeList = ()=>get(`BaseInfo/GetGrooveType`)
/**
* 获取焊缝类型列表
*/
export const reqGetWeldTypeList = () => get(`BaseInfo/GetWeldType`)
/**
* 获取焊接方法列表
*/
export const reqGetWeldingMethodList = () => get(`BaseInfo/GetWeldingMethod`)
/** /**
* 附件上传 * 附件上传
* @param {string} filePath - 本地文件路径 * @param {string} filePath - 本地文件路径
+27 -1
View File
@@ -15,7 +15,8 @@ export const reqHJIndexData = (projectId) => get(`HJGLIndex/GetJGLIndexItem?proj
export const reqGetWeldJointByWeldJointId = (id) => get(`PipeJoint/getWeldJointByWeldJointId?WeldJointId=${id}`) export const reqGetWeldJointByWeldJointId = (id) => get(`PipeJoint/getWeldJointByWeldJointId?WeldJointId=${id}`)
/** /**
* 焊接日报填报 * 焊接日报填报(提交时传 WeldTypeId / WeldingMethodId,后端同步更新焊口对应字段)
* @param {Object} data - { WeldJointId, Personid, time, weldingLocation, welderType, WeldTypeId, WeldingMethodId, PreWeldAttachUrl, PostWeldAttachUrl }
*/ */
export const reqSaveWeldingDailyByWeldJointId = (data={}) => post( export const reqSaveWeldingDailyByWeldJointId = (data={}) => post(
`PreWeldingDaily/SaveWeldingDailyByWeldJointId`,data `PreWeldingDaily/SaveWeldingDailyByWeldJointId`,data
@@ -157,6 +158,12 @@ export const reqPreWeldJointByWeldJointId = (WeldJointId)=>get(`PreWeldInspectio
*/ */
export const reqCuttingCheckByWeldJointId = (weldJointId)=>get(`/PreWeldCuttingCheck/GetRecordsByWeldJointId?weldJointId=${weldJointId}`) export const reqCuttingCheckByWeldJointId = (weldJointId)=>get(`/PreWeldCuttingCheck/GetRecordsByWeldJointId?weldJointId=${weldJointId}`)
/**
* 获取专项审核办理人列表
* @param {String} projectId
*/
export const reqGetSpecialReviewers = (projectId) => get(`/PreWeldCuttingCheck/GetSpecialReviewers`, { projectId })
/** /**
* 保存下料检查记录 * 保存下料检查记录
* @param {Object} data * @param {Object} data
@@ -221,3 +228,22 @@ export const reqAuditWeldingDaily = (data = {}) => post(`/PreWeldingDaily/AuditP
*/ */
export const reqDeleteWeldingDaily = (data = {}) => post(`/PreWeldingDaily/DeletePendingWeldingDailyTempDetails`, data) export const reqDeleteWeldingDaily = (data = {}) => post(`/PreWeldingDaily/DeletePendingWeldingDailyTempDetails`, data)
// ========================= 焊缝外观检测 ====================================
/**
* 分页查询当前项目中已焊接的焊口
* @param {Object} params - { projectId, pipelineCode?, weldJointCode?, pageIndex?, pageSize? }
*/
export const reqWeldedJoints = (params = {}) => get('/WeldAppearanceCheck/GetWeldedJoints', params)
/**
* 查询焊口基础信息及历史外观检测记录
* @param {String} weldJointId 焊口ID
*/
export const reqWeldAppearanceJointDetail = (weldJointId) => get('/WeldAppearanceCheck/GetJointDetail', { weldJointId })
/**
* 保存焊缝外观检测记录
* @param {Object} data - { AppearanceCheckId?, ProjectId, WeldJointId, IsQualified, CheckPerson, CheckTime, Remark, AttachUrl, CreateUser }
*/
export const reqSaveWeldAppearanceCheck = (data = {}) => post('/WeldAppearanceCheck/SaveRecord', data)
+322
View File
@@ -0,0 +1,322 @@
<template>
<view class="history-card">
<!-- 空态 -->
<view v-if="list.length === 0" class="history-card__empty">
<text class="history-card__empty-text">暂无{{ title }}记录</text>
</view>
<!-- 有记录 -->
<template v-else>
<view class="history-card__section">
<view class="history-card__header">
<view class="history-card__bar"></view>
<text class="history-card__title">{{ title }}记录</text>
<text v-if="list.length > 1" class="history-card__more" @click="showPopup = true">查看全部({{ list.length }})</text>
</view>
<!-- 最新一条 -->
<view v-if="latest" class="history-card__card"
:class="isPass(latest) ? 'history-card__card--pass' : 'history-card__card--fail'">
<view class="history-card__row">
<text class="history-card__label">外观是否合格</text>
<view class="history-card__tag" :style="tagBgStyle(latest)">
<text class="history-card__tag-icon" :style="tagIconStyle(latest)">
{{ isPass(latest) ? '\u2713' : '\u2717' }}
</text>
<text class="history-card__tag-text" :style="tagTextStyle(latest)">
{{ qualifiedText(latest) }}
</text>
</view>
</view>
<view class="history-card__row">
<text class="history-card__label">检测人</text>
<text class="history-card__value">{{ latest.CheckPersonName || '--' }}</text>
</view>
<view class="history-card__row">
<text class="history-card__label">检测时间</text>
<text class="history-card__value">{{ latest.CheckTime || '--' }}</text>
</view>
<view class="history-card__row">
<text class="history-card__label">备注</text>
<text class="history-card__value">{{ latest.Remark || '--' }}</text>
</view>
<view class="history-card__row history-card__row--stack">
<text class="history-card__label history-card__label--stack">照片</text>
<view class="history-card__value--stack">
<nbd-photo-view :attachUrl="latest.AttachUrl || ''" :cols="4" />
</view>
</view>
</view>
</view>
<!-- 弹窗:全部记录 -->
<u-popup v-model="showPopup" mode="bottom" :safe-area-inset-bottom="true">
<view class="history-card__popup">
<view class="history-card__popup-hd">
<text class="history-card__popup-title">全部{{ title }}记录</text>
<text class="history-card__popup-close" @click="showPopup = false">✕</text>
</view>
<scroll-view class="history-card__popup-bd" scroll-y>
<view v-for="(item, index) in list" :key="item.AppearanceCheckId || index"
class="history-card__card history-card__card--popup"
:class="isPass(item) ? 'history-card__card--pass' : 'history-card__card--fail'">
<view class="history-card__row">
<text class="history-card__label">外观是否合格</text>
<view class="history-card__tag" :style="tagBgStyle(item)">
<text class="history-card__tag-icon" :style="tagIconStyle(item)">
{{ isPass(item) ? '\u2713' : '\u2717' }}
</text>
<text class="history-card__tag-text" :style="tagTextStyle(item)">
{{ qualifiedText(item) }}
</text>
</view>
</view>
<view class="history-card__row">
<text class="history-card__label">检测人</text>
<text class="history-card__value">{{ item.CheckPersonName || '--' }}</text>
</view>
<view class="history-card__row">
<text class="history-card__label">检测时间</text>
<text class="history-card__value">{{ item.CheckTime || '--' }}</text>
</view>
<view class="history-card__row">
<text class="history-card__label">备注</text>
<text class="history-card__value">{{ item.Remark || '--' }}</text>
</view>
<view class="history-card__row history-card__row--stack">
<text class="history-card__label history-card__label--stack">照片</text>
<view class="history-card__value--stack">
<nbd-photo-view :attachUrl="item.AttachUrl || ''" :cols="4" />
</view>
</view>
</view>
</scroll-view>
</view>
</u-popup>
</template>
</view>
</template>
<script setup>
import {
ref,
computed
} from 'vue'
const props = defineProps({
list: {
type: Array,
default: () => []
},
title: {
type: String,
default: '外观检测'
},
})
const showPopup = ref(false)
const latest = computed(() => props.list[0] || null)
const isPass = (item) => item?.IsQualified === true
const qualifiedText = (item) => {
if (item?.QualifiedText) return item.QualifiedText
return isPass(item) ? '合格' : '不合格'
}
const tagIconStyle = (item) => ({
color: isPass(item) ? '#22c55e' : '#ef4444',
})
const tagTextStyle = (item) => ({
color: isPass(item) ? '#16a34a' : '#dc2626',
})
const tagBgStyle = (item) => ({
background: isPass(item) ? '#ebf9f0' : '#fef2f2',
})
</script>
<style lang="scss" scoped>
$primary: #2979ff;
$card-bg: #fff;
$card-shadow: 0 2rpx 16rpx rgba(0, 0, 0, 0.06);
$text: #1a1a2e;
$text-secondary: #8e99a4;
.history-card {
&__empty {
padding: 40rpx 24rpx;
text-align: center;
}
&__empty-text {
font-size: 26rpx;
color: $text-secondary;
}
&__header {
display: flex;
align-items: center;
margin-bottom: 12rpx;
padding: 0 6rpx;
}
&__bar {
width: 6rpx;
height: 32rpx;
border-radius: 3rpx;
background: $primary;
margin-right: 14rpx;
}
&__title {
font-size: 28rpx;
font-weight: 700;
color: $text;
flex: 1;
}
&__more {
font-size: 24rpx;
color: $primary;
padding: 6rpx 16rpx;
background: rgba($primary, 0.08);
border-radius: 20rpx;
}
&__card {
position: relative;
box-sizing: border-box;
width: 100%;
background: $card-bg;
border-radius: 12rpx;
padding: 20rpx;
box-shadow: $card-shadow;
overflow: hidden;
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
right: 0;
height: 6rpx;
}
&--pass::before {
background: #22c55e;
}
&--fail::before {
background: #ef4444;
}
&--popup {
margin-bottom: 12rpx;
&:last-child {
margin-bottom: 0;
}
}
}
&__row {
display: flex;
align-items: center;
padding: 8rpx 0;
border-bottom: 1rpx solid #f0f0f0;
&--stack {
flex-direction: column;
align-items: flex-start;
}
}
&__label {
font-size: 26rpx;
color: $text-secondary;
flex-shrink: 0;
margin-right: 24rpx;
width: 160rpx;
&--stack {
width: 140rpx;
margin-top: 8rpx;
}
}
&__value {
flex: 1;
text-align: left;
font-family: "SF Mono", "Menlo", "Consolas", monospace;
font-size: 28rpx;
font-weight: 500;
color: #0f1724;
letter-spacing: 0.3rpx;
&--stack {
padding: 8rpx 0 8rpx 20rpx;
width: 100%;
box-sizing: border-box;
}
}
&__tag {
display: inline-flex;
align-items: center;
gap: 6rpx;
padding: 6rpx 16rpx;
border-radius: 8rpx;
min-width: 100rpx;
justify-content: center;
&-icon {
font-size: 22rpx;
font-weight: 700;
}
&-text {
font-size: 24rpx;
font-weight: 600;
}
}
&__popup {
background: #fff;
display: flex;
flex-direction: column;
height: 80vh;
border-radius: 24rpx 24rpx 0 0;
}
&__popup-hd {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 28rpx 12rpx;
border-bottom: 1rpx solid #f0f0f0;
}
&__popup-title {
font-size: 30rpx;
font-weight: 700;
color: $text;
}
&__popup-close {
font-size: 32rpx;
color: $text-secondary;
padding: 8rpx;
}
&__popup-bd {
flex: 1;
box-sizing: border-box;
overflow-y: auto;
background: #f5f5f5;
padding: 12rpx 20rpx 20rpx;
}
}
</style>
+9 -2
View File
@@ -22,7 +22,8 @@
</view> </view>
<!-- 列表内容 --> <!-- 列表内容 -->
<scroll-view scroll-y="true" class="nbd-select-inner" :scroll-into-view="scrollIntoView"> <scroll-view scroll-y="true" class="nbd-select-inner" :scroll-into-view="scrollIntoView"
:lower-threshold="80" @scrolltolower="handleScrollToLower">
<view class="nbd-select-inner-wrap"> <view class="nbd-select-inner-wrap">
<!-- 空状态 --> <!-- 空状态 -->
<view class="nbd-select-empty" v-if="filteredList.length === 0"> <view class="nbd-select-empty" v-if="filteredList.length === 0">
@@ -128,7 +129,8 @@
'cancel', 'cancel',
'confirm', 'confirm',
'searchChange', 'searchChange',
'change' 'change',
'scrolltolower'
]) ])
const localVisible = ref(false) const localVisible = ref(false)
@@ -218,6 +220,11 @@
emit('searchChange', val) emit('searchChange', val)
} }
// 列表触底
const handleScrollToLower = () => {
emit('scrolltolower')
}
// 取消 // 取消
const handleCancel = () => { const handleCancel = () => {
emit('cancel') emit('cancel')
+6
View File
@@ -163,6 +163,12 @@
"style": { "style": {
"navigationBarTitleText": "日报审核详情" "navigationBarTitleText": "日报审核详情"
} }
},
{
"path": "hj/weld_appearance",
"style": {
"navigationBarTitleText": "焊缝检测"
}
} }
] ]
} }
+3 -2
View File
@@ -411,6 +411,7 @@
bottom: 0; bottom: 0;
background: #ffffff; background: #ffffff;
padding: 20rpx 32rpx; padding: 20rpx 32rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
display: flex; display: flex;
align-items: center; align-items: center;
gap: 20rpx; gap: 20rpx;
@@ -447,8 +448,8 @@
} }
} }
// 给底部操作栏留出空间 // 给底部操作栏留出空间(含安全区)
.list-scroll { .list-scroll {
padding-bottom: 140rpx; padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
} }
</style> </style>
+91 -7
View File
@@ -69,9 +69,14 @@
<text class="card__value">{{ form.Specification || '--' }}</text> <text class="card__value">{{ form.Specification || '--' }}</text>
</view> </view>
<!-- 焊缝类型 --> <!-- 焊缝类型 -->
<view class="card__row"> <view class="card__row" @click="handleShowWeldTypeSelect">
<text class="card__label">焊缝类型</text> <text class="card__label">焊缝类型</text>
<text class="card__value">{{ form.WeldTypeCode || '--' }}</text> <view class="card__value-wrap card__value-wrap--clickable">
<text class="card__value" :class="{ 'card__value--placeholder': !form.WeldTypeCode }">
{{ form.WeldTypeCode || '请选择' }}
</text>
<u-icon name="arrow-right" :size="24" color="#bbb" />
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -119,10 +124,13 @@
</view> </view>
</view> </view>
<!-- 焊接方法 --> <!-- 焊接方法 -->
<view class="card__row"> <view class="card__row" @click="handleShowWeldingMethodSelect">
<text class="card__label">焊接方法</text> <text class="card__label">焊接方法</text>
<view class="card__value-wrap"> <view class="card__value-wrap card__value-wrap--clickable">
<input class="card__input" v-model="form.WeldingMethodCode" type="text" placeholder="请输入焊接方法" /> <text class="card__value" :class="{ 'card__value--placeholder': !form.WeldingMethodCode }">
{{ form.WeldingMethodCode || '请选择' }}
</text>
<u-icon name="arrow-right" :size="24" color="#bbb" />
</view> </view>
</view> </view>
<!-- 备注 --> <!-- 备注 -->
@@ -169,6 +177,14 @@
<!-- 焊工类型选择弹窗 --> <!-- 焊工类型选择弹窗 -->
<nbd-select v-model="showTypePicker" title="选择焊工类型" :list="welderTypeList" label-key="BaseInfoName" <nbd-select v-model="showTypePicker" title="选择焊工类型" :list="welderTypeList" label-key="BaseInfoName"
value-key="BaseInfoCode" @confirm="handleConfirmType" /> value-key="BaseInfoCode" @confirm="handleConfirmType" />
<!-- 焊缝类型选择弹窗 -->
<nbd-select v-model="showWeldTypePicker" :show-search="true" title="选择焊缝类型" :list="weldTypeList"
label-key="BaseInfoCode" value-key="BaseInfoId" @confirm="handleConfirmWeldType" />
<!-- 焊接方法选择弹窗 -->
<nbd-select v-model="showWeldingMethodPicker" :show-search="true" title="选择焊接方法" :list="weldingMethodList"
label-key="BaseInfoCode" value-key="BaseInfoId" @confirm="handleConfirmWeldingMethod" />
</view> </view>
</template> </template>
@@ -176,7 +192,7 @@
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { reqGetWeldJointByWeldJointId, reqSaveWeldingDailyByWeldJointId, reqGetManualPointSave, reqFitupCheckByWeldJointId } from '@/api/hj.js' import { reqGetWeldJointByWeldJointId, reqSaveWeldingDailyByWeldJointId, reqGetManualPointSave, reqFitupCheckByWeldJointId } from '@/api/hj.js'
import { reqWeldingLocation } from '@/api/base.js' import { reqWeldingLocation, reqGetWeldTypeList, reqGetWeldingMethodList } from '@/api/base.js'
import { useUserStore, useMenuStore } from '@/store' import { useUserStore, useMenuStore } from '@/store'
@@ -193,7 +209,11 @@ const postWeldAttachUrl = ref('')
// ===== 弹窗 ===== // ===== 弹窗 =====
const showLocationPicker = ref(false) const showLocationPicker = ref(false)
const showTypePicker = ref(false) const showTypePicker = ref(false)
const showWeldTypePicker = ref(false)
const showWeldingMethodPicker = ref(false)
const locationList = ref([]) const locationList = ref([])
const weldTypeList = ref([])
const weldingMethodList = ref([])
const welderTypeList = ref([ const welderTypeList = ref([
{ BaseInfoName: '打底/盖面', BaseInfoCode: 0 }, { BaseInfoName: '打底/盖面', BaseInfoCode: 0 },
{ BaseInfoName: '打底', BaseInfoCode: 1 }, { BaseInfoName: '打底', BaseInfoCode: 1 },
@@ -246,6 +266,34 @@ const handleConfirmType = (item) => {
showTypePicker.value = false showTypePicker.value = false
} }
const handleShowWeldTypeSelect = () => {
reqGetWeldTypeList().then(res => {
weldTypeList.value = res.data || []
showWeldTypePicker.value = true
})
}
const handleConfirmWeldType = (item) => {
form.value.WeldTypeId = item.BaseInfoId
form.value.WeldTypeCode = item.BaseInfoCode
form.value.WeldTypeName = item.BaseInfoName
showWeldTypePicker.value = false
}
const handleShowWeldingMethodSelect = () => {
reqGetWeldingMethodList().then(res => {
weldingMethodList.value = res.data || []
showWeldingMethodPicker.value = true
})
}
const handleConfirmWeldingMethod = (item) => {
form.value.WeldingMethodId = item.BaseInfoId
form.value.WeldingMethodCode = item.BaseInfoCode
form.value.WeldingMethodName = item.BaseInfoName
showWeldingMethodPicker.value = false
}
// ===== 操作 ===== // ===== 操作 =====
const handlePoint = async () => { const handlePoint = async () => {
await reqGetManualPointSave(form.value.WeldJointId) await reqGetManualPointSave(form.value.WeldJointId)
@@ -279,6 +327,9 @@ const handleReport = () => {
time: form.value.WeldingDateTemp, time: form.value.WeldingDateTemp,
weldingLocation: form.value.WeldingLocationId || '', weldingLocation: form.value.WeldingLocationId || '',
welderType: form.value.welderType, welderType: form.value.welderType,
// 同步更新焊口焊缝类型 / 焊接方法
WeldTypeId: form.value.WeldTypeId || '',
WeldingMethodId: form.value.WeldingMethodId || '',
PreWeldAttachUrl: preWeldAttachUrl.value || form.value.PreWeldAttachUrl || '', PreWeldAttachUrl: preWeldAttachUrl.value || form.value.PreWeldAttachUrl || '',
PostWeldAttachUrl: postWeldAttachUrl.value || form.value.PostWeldAttachUrl || '' PostWeldAttachUrl: postWeldAttachUrl.value || form.value.PostWeldAttachUrl || ''
}) })
@@ -295,11 +346,42 @@ const handleMutualCheck = () => {
uni.navigateTo({ url: '/scanpages/hj/make_right?id=' + weldJointId.value }) uni.navigateTo({ url: '/scanpages/hj/make_right?id=' + weldJointId.value })
} }
// 按 Code 回填 Id,保证未重选时提交仍能同步更新焊口
const fillTypeMethodIds = async () => {
const needWeldType = form.value.WeldTypeCode && !form.value.WeldTypeId
const needMethod = form.value.WeldingMethodCode && !form.value.WeldingMethodId
if (!needWeldType && !needMethod) return
try {
const tasks = []
if (needWeldType) tasks.push(reqGetWeldTypeList())
else tasks.push(Promise.resolve(null))
if (needMethod) tasks.push(reqGetWeldingMethodList())
else tasks.push(Promise.resolve(null))
const [typeRes, methodRes] = await Promise.all(tasks)
if (typeRes?.data) {
const hit = typeRes.data.find(i => i.BaseInfoCode === form.value.WeldTypeCode)
if (hit) {
form.value.WeldTypeId = hit.BaseInfoId
form.value.WeldTypeName = hit.BaseInfoName
}
}
if (methodRes?.data) {
const hit = methodRes.data.find(i => i.BaseInfoCode === form.value.WeldingMethodCode)
if (hit) {
form.value.WeldingMethodId = hit.BaseInfoId
form.value.WeldingMethodName = hit.BaseInfoName
}
}
} catch (e) {
console.error('回填焊缝类型/焊接方法ID失败:', e)
}
}
// ===== 生命周期 ===== // ===== 生命周期 =====
onLoad((opt) => { onLoad((opt) => {
weldJointId.value = opt.id || '' weldJointId.value = opt.id || ''
reqGetWeldJointByWeldJointId(opt.id).then(res => { reqGetWeldJointByWeldJointId(opt.id).then(async (res) => {
form.value = res.data || {} form.value = res.data || {}
if (form.value.CoverWelderName) { if (form.value.CoverWelderName) {
form.value.welderName = form.value.CoverWelderName form.value.welderName = form.value.CoverWelderName
@@ -316,6 +398,8 @@ onLoad((opt) => {
// 回显已有照片 // 回显已有照片
preWeldAttachUrl.value = form.value.PreWeldAttachUrl || '' preWeldAttachUrl.value = form.value.PreWeldAttachUrl || ''
postWeldAttachUrl.value = form.value.PostWeldAttachUrl || '' postWeldAttachUrl.value = form.value.PostWeldAttachUrl || ''
await fillTypeMethodIds()
}) })
reqFitupCheckByWeldJointId(opt.id).then(res => { reqFitupCheckByWeldJointId(opt.id).then(res => {
+64 -1
View File
@@ -62,6 +62,24 @@
failText="不准确" /> failText="不准确" />
</view> </view>
</view> </view>
<!-- 专项审核办理人:材料编码批次或材料数量不准确时必填 -->
<view class="card__row" @click="handleShowReviewerSelect">
<text class="card__label" :class="{ required: needSpecialReviewer }">专项审核办理人</text>
<view class="card__value-wrap card__value-wrap--clickable">
<text class="card__value" :class="{ 'card__value--placeholder': !specialReviewerName }">
{{ specialReviewerName || '请选择' }}
</text>
<u-icon name="arrow-right" :size="24" color="#bbb" />
</view>
</view>
<!-- 两侧主编码反馈 -->
<view class="card__row card__row--stack">
<text class="card__label">两侧主编码反馈</text>
<view class="card__value-wrap">
<textarea readonly class="remark-input" placeholder="请输入" :maxlength="200" auto-height />
</view>
</view>
</view> </view>
</view> </view>
@@ -174,6 +192,10 @@
<text class="btn-primary-gradient__text">提交结果</text> <text class="btn-primary-gradient__text">提交结果</text>
</view> </view>
</view> </view>
<!-- 专项审核办理人选择 -->
<nbd-select v-model="showReviewerPicker" :show-search="true" title="选择专项审核办理人" :list="reviewerList"
label-key="BaseInfoName" value-key="BaseInfoId" @confirm="handleConfirmReviewer" />
</view> </view>
</template> </template>
@@ -183,7 +205,7 @@ import { onLoad } from '@dcloudio/uni-app'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useUserStore, useMenuStore } from '@/store' import { useUserStore, useMenuStore } from '@/store'
import { reqPreWeldJointByWeldJointId, reqSaveCuttingCheck, reqCuttingCheckByWeldJointId, reqGetAntiCorrosionCheck } from '@/api/hj' import { reqPreWeldJointByWeldJointId, reqSaveCuttingCheck, reqCuttingCheckByWeldJointId, reqGetAntiCorrosionCheck, reqGetSpecialReviewers } from '@/api/hj'
const cuttingFields = [ const cuttingFields = [
{ label: '下料长度', key: 'CuttingLength' }, { label: '下料长度', key: 'CuttingLength' },
@@ -191,6 +213,7 @@ const cuttingFields = [
{ label: '坡口角度', key: 'GrooveAngle' }, { label: '坡口角度', key: 'GrooveAngle' },
{ label: '材料编码批次', key: 'IsMaterialCodeBatchNoAccurate', type: 'tag', tagMatch: true, tagPassText: '准确', tagFailText: '不准确' }, { label: '材料编码批次', key: 'IsMaterialCodeBatchNoAccurate', type: 'tag', tagMatch: true, tagPassText: '准确', tagFailText: '不准确' },
{ label: '材料数量', key: 'IsMaterialQuantityAccurate', type: 'tag', tagMatch: true, tagPassText: '准确', tagFailText: '不准确' }, { label: '材料数量', key: 'IsMaterialQuantityAccurate', type: 'tag', tagMatch: true, tagPassText: '准确', tagFailText: '不准确' },
{ label: '专项审核办理人', key: 'SpecialReviewerName' },
{ label: '检查人', key: 'CheckPersonName' }, { label: '检查人', key: 'CheckPersonName' },
{ label: '检查时间', key: 'CheckTime' }, { label: '检查时间', key: 'CheckTime' },
{ label: '检查结果', key: 'CheckResult', type: 'tag', tagMatch: '合格' }, { label: '检查结果', key: 'CheckResult', type: 'tag', tagMatch: '合格' },
@@ -231,11 +254,21 @@ const layingOffForm = ref({
CheckResult: '合格', CheckResult: '合格',
IsMaterialCodeBatchNoAccurate: '准确', IsMaterialCodeBatchNoAccurate: '准确',
IsMaterialQuantityAccurate: '准确', IsMaterialQuantityAccurate: '准确',
SpecialReviewerId: '',
UnqualifiedReason: '', UnqualifiedReason: '',
RectifyRequirement: '', RectifyRequirement: '',
Remark: '' Remark: ''
}) })
const showReviewerPicker = ref(false)
const reviewerList = ref([])
const specialReviewerName = ref('')
// 材料编码批次或材料数量不准确时,专项审核办理人必填
const needSpecialReviewer = computed(() =>
layingOffForm.value.IsMaterialCodeBatchNoAccurate === '不准确' ||
layingOffForm.value.IsMaterialQuantityAccurate === '不准确'
)
// 照片组件引用 // 照片组件引用
const photoRef = ref(null) const photoRef = ref(null)
@@ -260,11 +293,40 @@ watch(() => layingOffForm.value.CheckResult, async (val) => {
} }
}) })
const handleShowReviewerSelect = () => {
const projectId = currentProject.value?.ProjectId || info.value?.ProjectId
if (!projectId) {
uni.showToast({ title: '缺少项目信息', icon: 'none' })
return
}
reqGetSpecialReviewers(projectId).then(res => {
reviewerList.value = Array.isArray(res.data) ? res.data : []
showReviewerPicker.value = true
})
}
const handleConfirmReviewer = (item) => {
if (!item) return
layingOffForm.value.SpecialReviewerId = item.BaseInfoId || item.PersonId || ''
specialReviewerName.value = item.BaseInfoName || item.PersonName || ''
showReviewerPicker.value = false
}
const validateSpecialReviewer = () => {
if (!needSpecialReviewer.value) return true
if (!layingOffForm.value.SpecialReviewerId) {
uni.showToast({ title: '请选择专项审核办理人', icon: 'none' })
return false
}
return true
}
const handleSubmit = () => { const handleSubmit = () => {
if (!canEdit.value) { if (!canEdit.value) {
uni.showToast({ title: '当前岗位仅可查看', icon: 'none' }) uni.showToast({ title: '当前岗位仅可查看', icon: 'none' })
return return
} }
if (!validateSpecialReviewer()) return
uni.showModal({ uni.showModal({
title: '确认提交', title: '确认提交',
content: '确定提交吗?', content: '确定提交吗?',
@@ -286,6 +348,7 @@ const handleSubmit = () => {
GrooveAngle: layingOffForm.value.GrooveAngle, // 坡口角度 GrooveAngle: layingOffForm.value.GrooveAngle, // 坡口角度
IsMaterialCodeBatchNoAccurate: layingOffForm.value.IsMaterialCodeBatchNoAccurate === '准确', // 材料编码批次 IsMaterialCodeBatchNoAccurate: layingOffForm.value.IsMaterialCodeBatchNoAccurate === '准确', // 材料编码批次
IsMaterialQuantityAccurate: layingOffForm.value.IsMaterialQuantityAccurate === '准确', // 材料数量 IsMaterialQuantityAccurate: layingOffForm.value.IsMaterialQuantityAccurate === '准确', // 材料数量
SpecialReviewerId: layingOffForm.value.SpecialReviewerId || '', // 专项审核办理人
CheckPerson: userInfo.value?.PersonId, // 检查人员 CheckPerson: userInfo.value?.PersonId, // 检查人员
CheckTime: uni.formatTime(new Date().getTime(), 'YYYY-MM-DD HH:mm'), // 检查时间 CheckTime: uni.formatTime(new Date().getTime(), 'YYYY-MM-DD HH:mm'), // 检查时间
CreateUser: userInfo.value?.PersonId, // 创建人员 CreateUser: userInfo.value?.PersonId, // 创建人员
+361
View File
@@ -0,0 +1,361 @@
<template>
<view class="detail-page">
<!-- 焊口主标识 -->
<view class="joint-hero">
<text class="joint-hero__code">{{ info.WeldJointCode || '--' }}</text>
<view class="joint-hero__meta">
<view class="joint-hero__pill">
<text class="pill-label">管线编码</text>
<text class="pill-value">{{ info.PipelineCode || '--' }}</text>
</view>
<view class="joint-hero__pill">
<text class="pill-label">项目名称</text>
<text class="pill-value">{{ info.ProjectName || info.ProjectId || '--' }}</text>
</view>
</view>
</view>
<!-- 外观检测填报 -->
<view class="section">
<view class="section__header">
<view class="section__bar"></view>
<text class="section__title">焊缝外观检测</text>
</view>
<view class="card">
<view class="card__row">
<text class="card__label required">外观是否合格</text>
<view class="card__value-wrap card__value-wrap--clickable">
<nbd-check-btn v-model="form.qualifiedText" passKey="合格" failKey="不合格" passText="合格"
failText="不合格" />
</view>
</view>
<view class="card__row">
<text class="card__label">检测人</text>
<view class="card__value-wrap">
<text class="card__value">{{ checkPersonName || '--' }}</text>
</view>
</view>
<view class="card__row card__row--stack">
<text class="card__label">备注</text>
<view class="card__value-wrap">
<textarea class="remark-input" v-model="form.Remark" placeholder="请输入备注信息(选填)"
:maxlength="200" auto-height />
</view>
</view>
<view class="card__row card__row--stack">
<text class="card__label required">照片</text>
<view class="card__value-wrap">
<nbd-photo-upload ref="photoRef" v-model:attachUrl="form.AttachUrl"
typeName="WeldAppearance" />
</view>
</view>
</view>
</view>
<!-- 外观检测记录 -->
<view class="section">
<nbd-history-card title="外观检测" :list="recordList" />
</view>
<!-- 提交按钮 -->
<view class="submit-bar">
<view class="btn-primary-gradient" @click="handleSubmit">
<text class="btn-primary-gradient__text">提交结果</text>
</view>
</view>
</view>
</template>
<script setup>
import {
ref,
computed
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app'
import {
storeToRefs
} from 'pinia'
import {
useUserStore
} from '@/store'
import {
reqWeldAppearanceJointDetail,
reqSaveWeldAppearanceCheck
} from '@/api/hj.js'
const userStore = useUserStore()
const {
userInfo,
currentProject
} = storeToRefs(userStore)
const id = ref('')
const info = ref({})
const recordList = ref([])
const photoRef = ref(null)
const form = ref({
qualifiedText: '合格',
Remark: '',
AttachUrl: ''
})
const checkPersonName = computed(() => userInfo.value?.PersonName || '')
const toBoolQualified = (val) => {
if (val === true || val === 1 || val === '1' || val === 'true' || val === '合格') return true
if (val === false || val === 0 || val === '0' || val === 'false' || val === '不合格') return false
return !!val
}
const normalizeRecords = (list) => {
if (!Array.isArray(list)) return []
return list.map((item) => {
const qualified = toBoolQualified(item.IsQualified)
return {
...item,
IsQualified: qualified,
CheckPersonName: item.CheckPersonName || item.CheckPerson || '--',
CheckTime: item.CheckTime || '--',
AttachUrl: item.AttachUrl || item.AttachUrl1 || ''
}
})
}
const parseDetail = (data) => {
if (!data) return {
joint: {},
records: []
}
if (Array.isArray(data)) {
return {
joint: {},
records: data
}
}
const joint = data.Joint || data.WeldJoint || data.joint || data.JointInfo || data
const records = data.History || data.Records || data.AppearanceChecks || data.AppearanceCheckList ||
data.HistoryList || data.CheckRecords || data.list || data.records || []
return {
joint: joint && typeof joint === 'object' && !Array.isArray(joint) ? joint : {},
records: Array.isArray(records) ? records : []
}
}
const loadDetail = async (weldJointId) => {
try {
uni.showLoading({
title: '加载中...',
mask: true
})
const res = await reqWeldAppearanceJointDetail(weldJointId)
const {
joint,
records
} = parseDetail(res.data)
info.value = {
...joint,
WeldJointId: joint.WeldJointId || weldJointId,
ProjectName: joint.ProjectName || currentProject.value?.ProjectName || ''
}
recordList.value = normalizeRecords(records)
} catch (error) {
console.error('获取焊缝外观检测详情失败:', error)
uni.showToast({
title: '加载失败',
icon: 'none'
})
} finally {
uni.hideLoading()
}
}
const handleSubmit = () => {
const jointId = info.value.WeldJointId || id.value
if (!jointId) {
uni.showToast({
title: '焊口信息缺失',
icon: 'none'
})
return
}
if (!form.value.AttachUrl && !photoRef.value?.hasPending()) {
uni.showToast({
title: '请上传照片',
icon: 'none'
})
return
}
uni.showModal({
title: '确认提交',
content: '确定提交吗?',
success: async ({
confirm
}) => {
if (!confirm) return
try {
if (photoRef.value?.hasPending()) {
uni.showLoading({
title: '上传照片中...',
mask: true
})
await photoRef.value.uploadAll()
uni.hideLoading()
}
await reqSaveWeldAppearanceCheck({
ProjectId: currentProject.value?.ProjectId || info.value.ProjectId,
WeldJointId: jointId,
IsQualified: form.value.qualifiedText === '合格',
CheckPerson: userInfo.value?.PersonId,
CheckTime: uni.formatTime(new Date().getTime(), 'YYYY-MM-DD HH:mm'),
CreateUser: userInfo.value?.PersonId,
Remark: form.value.Remark || '',
AttachUrl: form.value.AttachUrl,
AppearanceCheckId: ''
})
uni.showToast({
title: '提交成功',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
} catch (error) {
console.error('保存焊缝外观检测失败:', error)
}
}
})
}
onLoad((opt) => {
if (opt.id) {
// opt.id = '6c887720-3168-4bb4-a268-7ceef24561a4'
id.value = opt.id
loadDetail(opt.id)
} else {
uni.showToast({
title: '请通过扫码进入',
icon: 'none'
})
}
})
</script>
<style lang="scss" scoped>
$primary: $app-primary;
$primary-light: $app-primary-light;
$primary-mid: $app-primary-mid;
$primary-dark: $app-primary-dark;
$text: $app-text;
$text-secondary: $app-text-secondary;
$border: $app-border;
$radius: $app-radius;
$bg: #f0f2f5;
$card-bg: #ffffff;
$shadow-md: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
.detail-page {
background: $bg;
}
.joint-hero {
position: relative;
margin: 24rpx;
padding: 36rpx 32rpx 28rpx;
background: $card-bg;
border-radius: $radius;
box-shadow: $shadow-md;
overflow: hidden;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4rpx;
background: linear-gradient(90deg, $primary, #6ba3ff, $primary);
background-size: 200% 100%;
animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
0%,
100% {
background-position: 0% 0;
}
50% {
background-position: 100% 0;
}
}
&__code {
display: block;
font-size: 52rpx;
font-weight: 800;
color: $text;
line-height: 1.2;
word-break: break-all;
font-family: monospace;
letter-spacing: 2rpx;
margin-bottom: 28rpx;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 6rpx;
bottom: 6rpx;
width: 4rpx;
background: $primary;
border-radius: 2rpx;
}
}
&__meta {
display: flex;
flex-wrap: wrap;
gap: 12rpx;
}
&__pill {
display: inline-flex;
width: 100%;
align-items: center;
gap: 8rpx;
background: $primary-light;
padding: 10rpx 18rpx;
border-radius: 10rpx;
border: 1rpx solid $primary-mid;
.pill-label {
font-size: 22rpx;
color: $text-secondary;
width: 60rpx;
}
.pill-value {
font-size: 24rpx;
font-weight: 600;
color: $primary-dark;
font-family: monospace;
}
}
}
.submit-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 20rpx 24rpx;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
background: linear-gradient(180deg, rgba(240, 242, 245, 0) 0%, $bg 20%);
}
</style>
+9
View File
@@ -88,6 +88,15 @@ export const defaultApps = [{
funcKey: 'dailyAudit', funcKey: 'dailyAudit',
prefix: 'nbd-icon', prefix: 'nbd-icon',
selected: false selected: false
},
{
name: '焊缝检测',
icon: 'daiban',
menuId: "",
path: "/scanpages/hj/weld_appearance",
isScan: true,
prefix: 'nbd-icon',
selected: false
} }
] ]