焊接日报上传附件

This commit is contained in:
2026-06-24 16:50:38 +08:00
parent d99af327fd
commit 41623ecb32
8 changed files with 486 additions and 225 deletions
+17 -1
View File
@@ -2,7 +2,7 @@ import { useUserStore } from '@/store'
// TODO: 替换为实际的 API 地址
export const baseUrl = 'https://lygcgs.com.cn:8078/shjapi/api/'
export const baseFileUrl = 'https://lygcgs.com.cn:8078/shj/'
// ===== 防止重复请求 =====
const pendingRequests = new Map()
@@ -148,6 +148,22 @@ export const post = (url, data = {}) => {
}
/**
* 解析附件 URL 字符串为可展示的照片列表
* @param {string} urlStr - 逗号分隔的附件路径,如 "FileUpLoad/xxx.png,FileUpLoad/yyy.png"
* @param {number} startId - 起始 ID,用于生成唯一标识
* @returns {Array<{_id: number, src: string, uploaded: boolean}>}
*/
export const parseAttachUrls = (urlStr, startId = 0) => {
if (!urlStr) return []
let id = startId
return urlStr.split(',').filter(Boolean).map(url => ({
_id: ++id,
src: `${baseFileUrl}${url}`,
uploaded: true
}))
}
export const getUrlParam = (url, name) => {
if (!url || !name) return null;
+6 -6
View File
@@ -9,12 +9,12 @@ export const parseScanResult = (str) => {
if (!str) return null
// 焊接接头二维码:https://sggl.sedin.com.cn/StaticPage/HJGL/index.html?id=xxx&weldjoint=1
// if (str.includes('weldjoint')) {
// const id = getUrlParam(str, 'id')
// if (id) {
// return { path: '/scanpages/hj/material_sampling', query: `id=${id}` }
// }
// }
if (str.includes('weldjoint')) {
const id = getUrlParam(str, 'id')
if (id) {
return { path: '/scanpages/hj/daily_paper', query: `id=${id}` }
}
}
// 后续可在此扩展其他扫码类型...