吉安感知网项目-前端
罗广辉
2026-06-06 53030a00d328ab653a305016644289bacdc285c4
feat: ai图片框
2 files modified
22 ■■■■ changed files
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue 5 ●●●●● patch | view | raw | blame | history
packages/utils/common/index.js 17 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/views/orderView/orderManage/inspectionRequest/ViewDiaLog.vue
@@ -87,10 +87,9 @@
                            >
                                <el-image
                                    v-if="item.attachmentType === 1 || item.attachmentType === 2"
                                    :src="item.attachmentType === 1 ? item.resultUrl : getAiImg(item.resultUrl)"
                                    :preview-src-list="[item.attachmentType === 1 ? item.resultUrl : getAiImg(item.resultUrl)]"
                                    :src="item.attachmentType === 1 ? item.resultUrl : getAiImg(item.resultUrl,item.geojson)"
                                    :preview-src-list="[item.attachmentType === 1 ? item.resultUrl : getAiImg(item.resultUrl,item.geojson)]"
                                    fit="cover"
                                    style="width: 80px; height: 80px"
                                    preview-teleported
                                />
                                <div class="video-btn" v-if="item.attachmentType === 3" @click="videoClick(item)">
packages/utils/common/index.js
@@ -76,13 +76,10 @@
// 图片转带ai框的图片
export function getAiImg(url, aiFrameSource) {
    if (!url) return ''
    const aiFrame = aiFrameSource || [
        '{"score":0.91357421875,"bbox":{"x_cen":1246.0,"y_cen":209.0,"width":166.0,"height":334.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"}',
        '{"score":0.89697265625,"bbox":{"x_cen":370.0,"y_cen":694.5,"width":162.0,"height":331.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"}',
        '{"score":0.89501953125,"bbox":{"x_cen":396.0,"y_cen":343.0,"width":168.0,"height":330.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"}',
        '{"score":0.79296875,"bbox":{"x_cen":409.5,"y_cen":52.5,"width":167.0,"height":105.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"}',
    ]
    if (!url) return url
    if (!aiFrameSource) return url
    const aiFrame = JSON.parse(aiFrameSource)
    // const aiFrame = '[{"score":0.89990234375,"bbox":{"x_cen":195.5,"y_cen":326.5,"width":117.0,"height":265.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"},{"score":0.89306640625,"bbox":{"x_cen":1194.5,"y_cen":559.5,"width":115.0,"height":261.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"},{"score":0.88720703125,"bbox":{"x_cen":179.0,"y_cen":955.5,"width":124.0,"height":249.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"},{"score":0.88330078125,"bbox":{"x_cen":1198.5,"y_cen":260.5,"width":115.0,"height":285.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"},{"score":0.84716796875,"bbox":{"x_cen":204.5,"y_cen":71.5,"width":115.0,"height":143.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"},{"score":0.83203125,"bbox":{"x_cen":186.0,"y_cen":657.5,"width":114.0,"height":269.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"},{"score":0.78662109375,"bbox":{"x_cen":1205.5,"y_cen":49.5,"width":117.0,"height":99.0},"class_name":"car","algorithmId":"e71116098eeb1d60cfebd04d30653b151"}]'
    const img = new Image()
    img.crossOrigin = 'anonymous'
    return new Promise(resolve => {
@@ -105,12 +102,6 @@
            aiFrame.forEach(item => {
                let target = item
                try {
                    target = typeof item === 'string' ? JSON.parse(item) : item
                } catch (error) {
                    return
                }
                const { x_cen, y_cen, width, height } = target.bbox || {}
                if ([x_cen, y_cen, width, height].some(value => typeof value !== 'number')) return