From 9e9826acbb196b4c0f1420642c20b2d8c7a5e1b7 Mon Sep 17 00:00:00 2001 From: Zones <765289303@qq.com> Date: Wed, 24 Jun 2026 20:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/settings.json | 7 + api/hj.js | 8 +- assets/css/page.scss | 7 +- components/nbd-photo-upload.vue | 211 ++++++++ pages/index/index.vue | 26 +- scanpages/hj/daily_paper.vue | 228 ++------- scanpages/hj/make_right.vue | 777 ++++++++++++++++------------- scanpages/hj/material_sampling.vue | 59 ++- utils/request.js | 1 + 9 files changed, 738 insertions(+), 586 deletions(-) create mode 100644 .claude/settings.json create mode 100644 components/nbd-photo-upload.vue diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..7d752e4 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,7 @@ +{ + "permissions": { + "allow": [ + "Bash(git checkout *)" + ] + } +} diff --git a/api/hj.js b/api/hj.js index ec9b04b..680f360 100644 --- a/api/hj.js +++ b/api/hj.js @@ -160,4 +160,10 @@ export const reqSaveCuttingCheck = (data)=> post(`PreWeldInspection/SaveCuttingC * 获取坡口类型列表 * TODO: 确认接口地址 */ -export const reqGetGrooveTypeList = ()=>get(`BaseInfo/GetGrooveTypeList`) \ No newline at end of file +export const reqGetGrooveTypeList = ()=>get(`BaseInfo/GetGrooveType`) + +/** + * 保存组对抽查记录 + * + */ +export const reqSaveFitupCheck = (data)=>post(`PreWeldInspection/SaveFitupCheck`, data) diff --git a/assets/css/page.scss b/assets/css/page.scss index 06b6e1c..aef8ab6 100644 --- a/assets/css/page.scss +++ b/assets/css/page.scss @@ -372,12 +372,15 @@ } } - .edit-grid { + .edit-scroll { flex: 1; min-height: 0; overflow: hidden; + } + + .edit-grid { display: grid; - grid-template-columns: repeat(4, calc(25% - 20rpx)); + grid-template-columns: repeat(4, 1fr); gap: 20rpx; padding: 24rpx 0 160rpx; box-sizing: border-box; diff --git a/components/nbd-photo-upload.vue b/components/nbd-photo-upload.vue new file mode 100644 index 0000000..452f42c --- /dev/null +++ b/components/nbd-photo-upload.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index b85a642..4717906 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -110,21 +110,23 @@ - - - - + + + + + + + {{ item.name }} + + + - {{ item.name }} - - + + 没有匹配的应用 - - 没有匹配的应用 - 取消 diff --git a/scanpages/hj/daily_paper.vue b/scanpages/hj/daily_paper.vue index 354c3d8..b3bed84 100644 --- a/scanpages/hj/daily_paper.vue +++ b/scanpages/hj/daily_paper.vue @@ -67,44 +67,22 @@ - + 焊前拍照 - 请拍摄焊接前照片 - - - - - - - - - - - 拍照 - + + - + 焊后拍照 - 请拍摄焊接后照片 - - - - - - - - - - - 拍照 - + + @@ -127,14 +105,17 @@ import { ref } from 'vue' import { onLoad } from '@dcloudio/uni-app' import { reqGetWeldJointByWeldJointId, reqSaveWeldingDailyByWeldJointId, reqGetManualPointSave } from '@/api/hj.js' - import { reqWeldingLocation, uploadAttach } from '@/api/base.js' - import { baseFileUrl, parseAttachUrls } from '@/utils/request.js' + import { reqWeldingLocation } from '@/api/base.js' import { useUserStore } from '@/store' + + const userStore = useUserStore() const { userInfo } = userStore // ===== 表单数据 ===== const form = ref({}) + const preWeldAttachUrl = ref('') + const postWeldAttachUrl = ref('') // ===== 弹窗 ===== const showLocationPicker = ref(false) @@ -146,79 +127,8 @@ { BaseInfoName: '盖面', BaseInfoCode: 2 }, ]) - // ===== 照片数据 ===== - const beforePhotoList = ref([]) - const afterPhotoList = ref([]) - let photoIdSeed = 0 - - // ===== 拍照(只存本地,等填报时统一上传) ===== - const handleTakeBeforePhoto = () => takePhoto(beforePhotoList) - const handleTakeAfterPhoto = () => takePhoto(afterPhotoList) - - const takePhoto = (listRef) => { - uni.chooseImage({ - count: 1, - sourceType: ['camera'], - success: (res) => { - const tempPath = res.tempFilePaths[0] - const id = ++photoIdSeed - listRef.value.push({ - _id: id, - src: tempPath, - uploaded: false - }) - } - }) - } - - // ===== 是否需要上传(本地临时路径才需要) ===== - const isLocalPath = (src) => src && !src.startsWith(baseFileUrl) - - // ===== 批量上传 ===== - const uploadAllPhotos = async (listRef, typeName) => { - const photos = listRef.value.filter(p => !p.uploaded && isLocalPath(p.src)) - const urls = [] - for (const photo of photos) { - photo.uploading = true - photo.progress = 0 - try { - const result = await uploadAttach(photo.src, { typeName }, (progress) => { - photo.progress = progress - }) - photo.uploading = false - photo.uploaded = true - photo.result = result - const url = Array.isArray(result) ? result[0] : result - if (url) { - urls.push(url) - photo.src = `${baseFileUrl}${url}` - } - } catch (e) { - photo.uploading = false - } - } - return urls - } - - const hasPendingBefore = () => beforePhotoList.value.some(p => !p.uploaded && isLocalPath(p.src)) - const hasPendingAfter = () => afterPhotoList.value.some(p => !p.uploaded && isLocalPath(p.src)) - - // ===== 预览照片 ===== - const previewPhoto = (list, index) => { - const urls = list.map(p => p.src) - uni.previewImage({ current: index, urls }) - } - - // ===== 删除照片 ===== - const deletePhoto = (list, index) => { - uni.showModal({ - title: '确认删除', - content: '确定要删除这张照片吗?', - success: ({ confirm }) => { - if (confirm) list.splice(index, 1) - } - }) - } + const beforePhotoRef = ref(null) + const afterPhotoRef = ref(null) // ===== 弹窗 ======== const handleShowLocationSelect = () => { @@ -254,29 +164,13 @@ content: '确定要填报吗?', success: async ({ confirm }) => { if (confirm) { - const needBefore = hasPendingBefore() - const needAfter = hasPendingAfter() - let PreWeldAttachUrl = form.value.PreWeldAttachUrl || '' - let PostWeldAttachUrl = form.value.PostWeldAttachUrl || '' - + console.log(beforePhotoRef.value?.hasPending()) + const needBefore = beforePhotoRef.value?.hasPending() + const needAfter = afterPhotoRef.value?.hasPending() if (needBefore || needAfter) { uni.showLoading({ title: '上传照片中...', mask: true }) - if (needBefore) { - const urls = await uploadAllPhotos(beforePhotoList, 'WeldingDaily_Before') - if (urls.length) { - PreWeldAttachUrl = PreWeldAttachUrl - ? PreWeldAttachUrl + ',' + urls.join(',') - : urls.join(',') - } - } - if (needAfter) { - const urls = await uploadAllPhotos(afterPhotoList, 'WeldingDaily_After') - if (urls.length) { - PostWeldAttachUrl = PostWeldAttachUrl - ? PostWeldAttachUrl + ',' + urls.join(',') - : urls.join(',') - } - } + if (needBefore) await beforePhotoRef.value.uploadAll() + if (needAfter) await afterPhotoRef.value.uploadAll() uni.hideLoading() } @@ -286,8 +180,8 @@ time: form.value.WeldingDateTemp, weldingLocation: form.value.WeldingLocationId || '', welderType: form.value.welderType, - PreWeldAttachUrl, - PostWeldAttachUrl + PreWeldAttachUrl: preWeldAttachUrl.value || form.value.PreWeldAttachUrl || '', + PostWeldAttachUrl: postWeldAttachUrl.value || form.value.PostWeldAttachUrl || '' }) uni.showToast({ title: '保存成功', icon: 'none' }) setTimeout(() => { uni.navigateBack() }, 1500) @@ -315,95 +209,35 @@ form.value.welderTypeName = "打底/盖面" // 回显已有照片 - beforePhotoList.value = parseAttachUrls(form.value.PreWeldAttachUrl, photoIdSeed) - photoIdSeed += beforePhotoList.value.length - afterPhotoList.value = parseAttachUrls(form.value.PostWeldAttachUrl, photoIdSeed) - photoIdSeed += afterPhotoList.value.length + preWeldAttachUrl.value = form.value.PreWeldAttachUrl || '' + postWeldAttachUrl.value = form.value.PostWeldAttachUrl || '' }) }) diff --git a/scanpages/hj/make_right.vue b/scanpages/hj/make_right.vue index 14d1fdb..a58abe0 100644 --- a/scanpages/hj/make_right.vue +++ b/scanpages/hj/make_right.vue @@ -22,8 +22,9 @@ 坡口类型 - - 坡口类型名称 + + *坡口类型名称 {{ form.GrooveTypeName || '请选择坡口类型' }} @@ -37,7 +38,9 @@ 坡口加工类型 - {{ form.GrooveProcessType || '--' }} + + + @@ -52,412 +55,470 @@ 坡口角度 - {{ form.GrooveAngle ?? '--' }} + ° 组对间隙 - {{ form.FitupGap ?? '--' }} + mm 错边量 - {{ form.Misalignment ?? '--' }} + mm - - - - - 取消 - 选择坡口类型 - 确定 - - - - - {{ item.BaseInfoName }} - {{ item.BaseInfoCode }} - - - - + + + + + 备注 - + + +