功能调整

This commit is contained in:
huhao
2026-08-18 18:05:16 +08:00
parent b342fb971b
commit 47559d6ed2
17 changed files with 2677 additions and 246 deletions
+141 -33
View File
@@ -24,7 +24,7 @@
<view class="card">
<!-- 下料长度 -->
<view class="card__row" @click="showPaintCodePicker = true">
<text class="card__label">下料长度</text>
<text class="card__label">下料长度(mm)</text>
<view class="card__value-wrap">
<input class="card__input" v-model="layingOffForm.CuttingLength" type="digit"
placeholder="请输入下料长度" />
@@ -38,6 +38,14 @@
placeholder="请输入坡口形式" />
</view>
</view>
<!-- 坡口加工类型 -->
<view class="card__row">
<text class="card__label">坡口加工类型</text>
<view class="card__value-wrap">
<input class="card__input" v-model="layingOffForm.GrooveProcessType" type="text"
placeholder="请输入坡口加工类型" />
</view>
</view>
<!-- 坡口角度 -->
<view class="card__row">
<text class="card__label">坡口角度</text>
@@ -63,8 +71,8 @@
</view>
</view>
<!-- 专项审核办理人:材料编码批次或材料数量不准确时必填 -->
<view class="card__row" @click="handleShowReviewerSelect">
<text class="card__label" :class="{ required: needSpecialReviewer }">专项审核办理人</text>
<view v-if="needSpecialReviewer" class="card__row" @click="handleShowReviewerSelect">
<text class="card__label required">专项审核办理人</text>
<view class="card__value-wrap card__value-wrap--clickable">
<text class="card__value" :class="{ 'card__value--placeholder': !specialReviewerName }">
{{ specialReviewerName || '请选择' }}
@@ -73,12 +81,18 @@
</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 />
<text class="card__label">两侧主编码</text>
<view v-if="sideMaterials.length" class="side-codes">
<view v-for="(m, idx) in sideMaterials" :key="m.side || idx" class="side-codes__item">
<text class="side-codes__title">侧{{ m.side || (idx + 1) }}</text>
<text class="side-codes__line">上报主编码:{{ m.reported || '--' }}</text>
<text class="side-codes__line">原主编码:{{ m.original || '--' }}</text>
<text v-if="m.batchChanged" class="side-codes__changed">批次已变更</text>
</view>
</view>
<text v-else class="card__value">暂无主编码信息</text>
</view>
</view>
</view>
@@ -188,8 +202,9 @@
<!-- 提交按钮 -->
<view v-if="canEdit" class="submit-bar">
<view class="btn-primary-gradient" @click="handleSubmit">
<text class="btn-primary-gradient__text">提交结果</text>
<view class="btn-primary-gradient" :class="{ 'btn-primary-gradient--disabled': submitting }"
@click="handleSubmit">
<text class="btn-primary-gradient__text">{{ submitting ? '提交中...' : '提交结果' }}</text>
</view>
</view>
@@ -210,7 +225,12 @@ import { reqPreWeldJointByWeldJointId, reqSaveCuttingCheck, reqCuttingCheckByWel
const cuttingFields = [
{ label: '下料长度', key: 'CuttingLength' },
{ label: '坡口形式', key: 'GrooveForm' },
{ label: '坡口加工类型', key: 'GrooveProcessType' },
{ label: '坡口角度', key: 'GrooveAngle' },
{ label: '侧1上报主编码', key: 'Side1ReportedMainCode' },
{ label: '侧1原主编码', key: 'Side1OriginalMainCode' },
{ label: '侧2上报主编码', key: 'Side2ReportedMainCode' },
{ label: '侧2原主编码', key: 'Side2OriginalMainCode' },
{ label: '材料编码批次', key: 'IsMaterialCodeBatchNoAccurate', type: 'tag', tagMatch: true, tagPassText: '准确', tagFailText: '不准确' },
{ label: '材料数量', key: 'IsMaterialQuantityAccurate', type: 'tag', tagMatch: true, tagPassText: '准确', tagFailText: '不准确' },
{ label: '专项审核办理人', key: 'SpecialReviewerName' },
@@ -250,6 +270,7 @@ const formAttachUrl = ref('')
const layingOffForm = ref({
CuttingLength: '',
GrooveForm: '',
GrooveProcessType: '',
GrooveAngle: '',
CheckResult: '合格',
IsMaterialCodeBatchNoAccurate: '准确',
@@ -270,8 +291,48 @@ const needSpecialReviewer = computed(() =>
layingOffForm.value.IsMaterialQuantityAccurate === '不准确'
)
const pickMaterials = (list) => Array.isArray(list) ? list : []
const flattenCuttingRecord = (item) => {
const extra = {}
pickMaterials(item.Materials).forEach((m) => {
const side = m.MaterialSide
if (side === undefined || side === null || side === '') return
extra[`Side${side}ReportedMainCode`] = m.ReportedMainCode || ''
extra[`Side${side}OriginalMainCode`] = m.OriginalMainCode || ''
})
return { ...item, ...extra }
}
const sideMaterials = computed(() => {
const fromCheck = pickMaterials(cuttingList.value[0]?.Materials)
if (fromCheck.length) {
return fromCheck.map((m) => ({
side: m.MaterialSide ?? '',
reported: m.ReportedMainCode || '',
original: m.OriginalMainCode || '',
batchChanged: !!m.IsBatchChanged,
}))
}
const items = info.value.preWeldMaterialItems || []
return items.map((item, i) => ({
side: i + 1,
reported: item.ReportedMainCode || item.MainCode || item.MaterialCode || '',
original: item.OriginalMainCode || '',
batchChanged: !!item.IsBatchChanged,
}))
})
watch(needSpecialReviewer, (need) => {
if (!need) {
layingOffForm.value.SpecialReviewerId = ''
specialReviewerName.value = ''
}
})
// 照片组件引用
const photoRef = ref(null)
const submitting = ref(false)
const failVisible = ref(layingOffForm.value.CheckResult === '不合格')
const failAnimating = ref(false)
@@ -326,41 +387,48 @@ const handleSubmit = () => {
uni.showToast({ title: '当前岗位仅可查看', icon: 'none' })
return
}
if (submitting.value) return
if (!validateSpecialReviewer()) return
uni.showModal({
title: '确认提交',
content: '确定提交吗?',
success: async (res) => {
if (res.confirm) {
if (!res.confirm) return
submitting.value = true
try {
if (photoRef.value?.hasPending()) {
uni.showLoading({ title: '上传照片中...', mask: true })
await photoRef.value.uploadAll()
uni.hideLoading()
}
const CuttingAttachUrl1 = formAttachUrl.value || info.value.CuttingAttachUrl1 || ''
const params = {
ProjectId: currentProject.value?.ProjectId, // 项目ID
WeldJointId: info.value?.WeldJointId, // 焊口ID
CuttingLength: layingOffForm.value.CuttingLength, // 下料长度
GrooveForm: layingOffForm.value.GrooveForm, // 坡口形式
GrooveAngle: layingOffForm.value.GrooveAngle, // 坡口角度
IsMaterialCodeBatchNoAccurate: layingOffForm.value.IsMaterialCodeBatchNoAccurate === '准确', // 材料编码批次
IsMaterialQuantityAccurate: layingOffForm.value.IsMaterialQuantityAccurate === '准确', // 材料数量
SpecialReviewerId: layingOffForm.value.SpecialReviewerId || '', // 专项审核办理人
CheckPerson: userInfo.value?.PersonId, // 检查人员
CheckTime: uni.formatTime(new Date().getTime(), 'YYYY-MM-DD HH:mm'), // 检查时间
CreateUser: userInfo.value?.PersonId, // 创建人员
CheckResult: layingOffForm.value.CheckResult, // 检查结果
Remark: remark.value, // 备注
UnqualifiedReason: layingOffForm.value.UnqualifiedReason, // 不合格原因
RectifyRequirement: layingOffForm.value.RectifyRequirement, // 整改要求
CuttingCheckId: null,
ProjectId: currentProject.value?.ProjectId,
WeldJointId: info.value?.WeldJointId,
CuttingLength: layingOffForm.value.CuttingLength,
GrooveForm: layingOffForm.value.GrooveForm,
GrooveProcessType: layingOffForm.value.GrooveProcessType,
GrooveAngle: layingOffForm.value.GrooveAngle,
IsMaterialCodeBatchNoAccurate: layingOffForm.value.IsMaterialCodeBatchNoAccurate === '准确',
IsMaterialQuantityAccurate: layingOffForm.value.IsMaterialQuantityAccurate === '准确',
SpecialReviewerId: needSpecialReviewer.value ? (layingOffForm.value.SpecialReviewerId || null) : null,
CheckPerson: userInfo.value?.PersonId,
CheckTime: uni.formatTime(new Date().getTime(), 'YYYY-MM-DD HH:mm'),
CreateUser: userInfo.value?.PersonId,
CheckResult: layingOffForm.value.CheckResult,
Remark: layingOffForm.value.Remark || '',
UnqualifiedReason: layingOffForm.value.UnqualifiedReason,
RectifyRequirement: layingOffForm.value.RectifyRequirement,
AttachUrl1: CuttingAttachUrl1,
}
await reqSaveCuttingCheck(params)
uni.showToast({ title: '提交成功', icon: 'none' })
setTimeout(() => { uni.navigateBack() }, 1500)
} catch (error) {
console.error('保存下料抽检失败:', error)
} finally {
submitting.value = false
}
}
})
@@ -384,13 +452,19 @@ const getInfo = async (id) => {
if (info.value.WeldJointId) {
const cuttingRes = await reqCuttingCheckByWeldJointId(info.value.WeldJointId)
if (cuttingRes.code === 1 && cuttingRes.data) {
cuttingList.value = cuttingRes.data
cuttingList.value = (Array.isArray(cuttingRes.data) ? cuttingRes.data : []).map(flattenCuttingRecord)
if (cuttingList.value.length > 0) {
layingOffForm.value.CuttingLength = cuttingList.value[0].CuttingLength
layingOffForm.value.GrooveForm = cuttingList.value[0].GrooveForm
layingOffForm.value.GrooveAngle = cuttingList.value[0].GrooveAngle
layingOffForm.value.IsMaterialCodeBatchNoAccurate = cuttingList.value[0].IsMaterialCodeBatchNoAccurate?'准确' : '不准确'
layingOffForm.value.IsMaterialQuantityAccurate = cuttingList.value[0].IsMaterialQuantityAccurate?'准确' : '不准确'
const latest = cuttingList.value[0]
layingOffForm.value.CuttingLength = latest.CuttingLength
layingOffForm.value.GrooveForm = latest.GrooveForm
layingOffForm.value.GrooveProcessType = latest.GrooveProcessType || ''
layingOffForm.value.GrooveAngle = latest.GrooveAngle
layingOffForm.value.IsMaterialCodeBatchNoAccurate = latest.IsMaterialCodeBatchNoAccurate?'准确' : '不准确'
layingOffForm.value.IsMaterialQuantityAccurate = latest.IsMaterialQuantityAccurate?'准确' : '不准确'
if (latest.SpecialReviewerId) {
layingOffForm.value.SpecialReviewerId = latest.SpecialReviewerId
specialReviewerName.value = latest.SpecialReviewerName || ''
}
}
}
}
@@ -634,4 +708,38 @@ $shadow-md: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
}
}
.side-codes {
width: 100%;
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 8rpx 0 12rpx;
&__item {
display: flex;
flex-direction: column;
gap: 6rpx;
padding: 16rpx 20rpx;
background: #f5f7fa;
border-radius: 12rpx;
}
&__title {
font-size: 26rpx;
font-weight: 600;
color: $text;
}
&__line {
font-size: 24rpx;
color: $text-secondary;
font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
&__changed {
font-size: 22rpx;
color: #dc2626;
}
}
</style>