新增焊缝外观检测
This commit is contained in:
@@ -69,9 +69,14 @@
|
||||
<text class="card__value">{{ form.Specification || '--' }}</text>
|
||||
</view>
|
||||
<!-- 焊缝类型 -->
|
||||
<view class="card__row">
|
||||
<view class="card__row" @click="handleShowWeldTypeSelect">
|
||||
<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>
|
||||
@@ -119,10 +124,13 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 焊接方法 -->
|
||||
<view class="card__row">
|
||||
<view class="card__row" @click="handleShowWeldingMethodSelect">
|
||||
<text class="card__label">焊接方法</text>
|
||||
<view class="card__value-wrap">
|
||||
<input class="card__input" v-model="form.WeldingMethodCode" type="text" placeholder="请输入焊接方法" />
|
||||
<view class="card__value-wrap card__value-wrap--clickable">
|
||||
<text class="card__value" :class="{ 'card__value--placeholder': !form.WeldingMethodCode }">
|
||||
{{ form.WeldingMethodCode || '请选择' }}
|
||||
</text>
|
||||
<u-icon name="arrow-right" :size="24" color="#bbb" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 备注 -->
|
||||
@@ -169,6 +177,14 @@
|
||||
<!-- 焊工类型选择弹窗 -->
|
||||
<nbd-select v-model="showTypePicker" title="选择焊工类型" :list="welderTypeList" label-key="BaseInfoName"
|
||||
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>
|
||||
</template>
|
||||
|
||||
@@ -176,7 +192,7 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
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'
|
||||
|
||||
|
||||
@@ -193,7 +209,11 @@ const postWeldAttachUrl = ref('')
|
||||
// ===== 弹窗 =====
|
||||
const showLocationPicker = ref(false)
|
||||
const showTypePicker = ref(false)
|
||||
const showWeldTypePicker = ref(false)
|
||||
const showWeldingMethodPicker = ref(false)
|
||||
const locationList = ref([])
|
||||
const weldTypeList = ref([])
|
||||
const weldingMethodList = ref([])
|
||||
const welderTypeList = ref([
|
||||
{ BaseInfoName: '打底/盖面', BaseInfoCode: 0 },
|
||||
{ BaseInfoName: '打底', BaseInfoCode: 1 },
|
||||
@@ -246,6 +266,34 @@ const handleConfirmType = (item) => {
|
||||
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 () => {
|
||||
await reqGetManualPointSave(form.value.WeldJointId)
|
||||
@@ -279,6 +327,9 @@ const handleReport = () => {
|
||||
time: form.value.WeldingDateTemp,
|
||||
weldingLocation: form.value.WeldingLocationId || '',
|
||||
welderType: form.value.welderType,
|
||||
// 同步更新焊口焊缝类型 / 焊接方法
|
||||
WeldTypeId: form.value.WeldTypeId || '',
|
||||
WeldingMethodId: form.value.WeldingMethodId || '',
|
||||
PreWeldAttachUrl: preWeldAttachUrl.value || form.value.PreWeldAttachUrl || '',
|
||||
PostWeldAttachUrl: postWeldAttachUrl.value || form.value.PostWeldAttachUrl || ''
|
||||
})
|
||||
@@ -295,11 +346,42 @@ const handleMutualCheck = () => {
|
||||
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) => {
|
||||
weldJointId.value = opt.id || ''
|
||||
|
||||
reqGetWeldJointByWeldJointId(opt.id).then(res => {
|
||||
reqGetWeldJointByWeldJointId(opt.id).then(async (res) => {
|
||||
form.value = res.data || {}
|
||||
if (form.value.CoverWelderName) {
|
||||
form.value.welderName = form.value.CoverWelderName
|
||||
@@ -316,6 +398,8 @@ onLoad((opt) => {
|
||||
// 回显已有照片
|
||||
preWeldAttachUrl.value = form.value.PreWeldAttachUrl || ''
|
||||
postWeldAttachUrl.value = form.value.PostWeldAttachUrl || ''
|
||||
|
||||
await fillTypeMethodIds()
|
||||
})
|
||||
|
||||
reqFitupCheckByWeldJointId(opt.id).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user