20260523172803

This commit is contained in:
oneao committed 2026-05-23 17:28:04 +08:00
1 parent c65407b679
commit 843529e57a
5 files changed
+76 -35

No files matched your search

@@ -16,7 +16,7 @@ spring:
time-zone: "Asia/Shanghai" time-zone: "Asia/Shanghai"
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
profiles: profiles:
active: build active: dev
file: file:
base-dir: D:/data/file base-dir: D:/data/file
@@ -1,10 +1,10 @@
#url=jdbc:sqlserver://118.89.70.199:1433;databaseName=G3BoxOCR url=jdbc:sqlserver://118.89.70.199:1433;databaseName=G3BoxOCR
#username=sa
#password=zhang520..
#driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://127.0.0.1:1433;databaseName=G3ContainerOCR
username=sa username=sa
password=123456@aaa password=zhang520..
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
#url=jdbc:sqlserver://127.0.0.1:1433;databaseName=G3ContainerOCR
#username=sa
#password=123456@aaa
#driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
@@ -11,6 +11,7 @@ const current = ref(0)
<sar-toast-agent /> <sar-toast-agent />
<sar-dialog-agent /> <sar-dialog-agent />
<sar-notify-agent /> <sar-notify-agent />
<sar-action-sheet-agent />
<!-- <view class="custom-tabbar"> <!-- <view class="custom-tabbar">
<view class="tabbar-container" @touchmove.stop.prevent> <view class="tabbar-container" @touchmove.stop.prevent>
@@ -209,6 +209,15 @@ async function handleConfirm() {
})), })),
) )
// =========================
// 检查总附件数是否 >= 5
// =========================
const totalFiles = 1 + allFiles.length
if (totalFiles < 5) {
toast.fail(`附件总数不足,上传需至少5张,当前${totalFiles}张`)
return
}
// ========================= // =========================
// 分类排序 // 分类排序
// ========================= // =========================
@@ -337,6 +346,8 @@ async function handleConfirm() {
if (res.success) { if (res.success) {
toast.success('保存成功') toast.success('保存成功')
loadMainData()
} }
else { else {
toast.fail('保存失败') toast.fail('保存失败')
@@ -350,9 +361,7 @@ async function handleConfirm() {
finally { finally {
setTimeout(() => { setTimeout(() => {
toast.hide() toast.hide()
}, 1500)
loadMainData()
}, 1000)
} }
} }
@@ -483,7 +492,7 @@ const templateCollapse = ref<string[]>(['template1'])
:auto-upload="false" :auto-upload="false"
:before-remove="handleBeforeRemove" :before-remove="handleBeforeRemove"
multiple multiple
accept="all" accept="image"
:max-size="50 * 1024 * 1024" :max-size="50 * 1024 * 1024"
/> />
</view> </view>
@@ -505,7 +514,7 @@ const templateCollapse = ref<string[]>(['template1'])
:auto-upload="false" :auto-upload="false"
:before-remove="handleBeforeRemove" :before-remove="handleBeforeRemove"
multiple multiple
accept="all" accept="image"
:max-size="50 * 1024 * 1024" :max-size="50 * 1024 * 1024"
/> />
</view> </view>
@@ -1,6 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { UploadFile, UploadFileItem } from 'sard-uniapp' import { actionSheet, dialog, toast } from 'sard-uniapp'
import { dialog, isImageUrl, isVideoUrl, toast } from 'sard-uniapp'
import { getUniqueIdApi, recognizeOcrBoxApi, saveObjectApi, uploadContainerFileApi, uploadTempFileApi } from '@/request/api' import { getUniqueIdApi, recognizeOcrBoxApi, saveObjectApi, uploadContainerFileApi, uploadTempFileApi } from '@/request/api'
import { downloadFile, getFileExtension, imageCompress, isImage } from '@/utils/file' import { downloadFile, getFileExtension, imageCompress, isImage } from '@/utils/file'
@@ -11,6 +10,8 @@ const isError = ref(false)
const showResult = ref(false) const showResult = ref(false)
const fileMode = ref('image') // image/video/all
const form = ref({ const form = ref({
b_id: 0, b_id: 0,
b_container_no: '', b_container_no: '',
@@ -41,6 +42,30 @@ onLoad(async () => {
toast.hide() toast.hide()
}) })
function handleBeforeChoose({ fileList, resolve }) {
console.log('before choose', fileList)
actionSheet({
description: '请选择上传方式',
itemList: [{ name: '照片' }, { name: '视频' }, { name: '文件' }],
showCancel: true,
onSelect(item) {
if (item.name === '视频') {
fileMode.value = 'video'
}
else if (item.name === '文件') {
fileMode.value = 'all'
}
else {
fileMode.value = 'image'
}
setTimeout(() => {
resolve(true)
}, 0)
},
})
}
function handleChooseBox() { function handleChooseBox() {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
@@ -146,6 +171,25 @@ async function handleConfirm() {
return return
} }
const subFiles = subFileListRef.value?.getUploadFiles() || []
const subFiles2 = subFileListRef2.value?.getUploadFiles() || []
const allFiles = [
...subFiles.map(item => ({
...item,
cate: '1',
})),
...subFiles2.map(item => ({
...item,
cate: '2',
})),
]
const totalFiles = (boxImage.value ? 1 : 0) + allFiles.length
if (totalFiles < 5) {
toast.fail(`附件总数不足,上传需至少5张,当前${totalFiles}张`)
return
}
toast.loading('正在保存中 . . .', { toast.loading('正在保存中 . . .', {
overlay: true, overlay: true,
transparent: false, transparent: false,
@@ -203,23 +247,6 @@ async function handleConfirm() {
return indexMap[cate]++ return indexMap[cate]++
} }
// =========================
// 获取附件
// =========================
const subFiles = subFileListRef.value?.getUploadFiles() || []
const subFiles2 = subFileListRef2.value?.getUploadFiles() || []
const allFiles = [
...subFiles.map(item => ({
...item,
cate: '1',
})),
...subFiles2.map(item => ({
...item,
cate: '2',
})),
]
// ========================= // =========================
// 上传附件 // 上传附件
// ========================= // =========================
@@ -300,7 +327,9 @@ async function handleConfirm() {
toast.fail('保存失败') toast.fail('保存失败')
} }
finally { finally {
toast.hide() setTimeout(() => {
toast.hide()
}, 1500)
} }
} }
@@ -478,8 +507,9 @@ const templateCollapse = ref<string[]>(['template1'])
:auto-upload="false" :auto-upload="false"
:before-remove="handleBeforeRemove" :before-remove="handleBeforeRemove"
multiple multiple
accept="all" :accept="fileMode"
:max-size="50 * 1024 * 1024" :max-size="50 * 1024 * 1024"
:before-choose="handleBeforeChoose"
/> />
</view> </view>
</wd-cell-group> </wd-cell-group>
@@ -499,8 +529,9 @@ const templateCollapse = ref<string[]>(['template1'])
:auto-upload="false" :auto-upload="false"
:before-remove="handleBeforeRemove" :before-remove="handleBeforeRemove"
multiple multiple
accept="all" accept="image"
:max-size="50 * 1024 * 1024" :max-size="50 * 1024 * 1024"
:before-choose="handleBeforeChoose"
/> />
</view> </view>
</wd-cell-group> </wd-cell-group>