提交 489032ec 作者: “kai”

fix:第一套

上级 cb781c19
File added
...@@ -6,3 +6,4 @@ export { default as ViewLibrary } from './modules/viewLibrary'; ...@@ -6,3 +6,4 @@ export { default as ViewLibrary } from './modules/viewLibrary';
export { default as TaskInfo } from './modules/taskInfo'; export { default as TaskInfo } from './modules/taskInfo';
export { default as System } from './modules/system'; export { default as System } from './modules/system';
export { default as Resource_API } from './modules/resource'; export { default as Resource_API } from './modules/resource';
export { default as DataOutputs } from './modules/dataOutputs';
\ No newline at end of file
import request from "../request";
/**
* 数据输出接口(成果中心)
* 移植自 mmc-tmjv4-vue 成果中心(/MonitoringCenter/dataOutputs)的导出报告
*/
export default {
/**
* 导出 AI 分析报告(docx)
* params: { folderId, fileType } TMJ 按文件夹导出
* { deviceId, fileType } FKZX 图库按设备组织(无 folderId)
*/
exporAnalysis(params) {
return request({
url: "/admin-api/data/video-image/export-analysis",
method: "get",
responseType: "blob",
params,
});
},
};
<template> <template>
<!-- <!--
FKZX 左侧菜单图标的微应用内副本(违法取证/日常巡检/火情识别) FKZX 左侧功能按钮(烟火识别 / 导出报告)
- 显示时机:与右侧工具栏/资源按钮一致——**选中(接管)无人机后才出现**(v-show 保位置不重置) - 显示时机:选中(接管)无人机后才出现(v-show="visible")
- 位置:视频播放器右侧(默认 top:20%; left:calc(35%+730px),随 .player 尺寸走) - 位置:视频播放器右侧(默认 top:20%; left:calc(35%+730px))
- 可整条鼠标拖动(transform 位移,不回弹) - 可整条鼠标拖动(transform 位移,不回弹)
- 高亮当前菜单(rootNode.menuName) - 烟火识别:复用播放器 aiList 的 kbtAi 识别(截图当前视频→AI接口→结果弹窗)
- 点击(非拖动)→ postMessage 通知主项目切换菜单(event: menuChange) - 导出报告:调用成果中心接口导出 AI 分析报告 docx
--> -->
<div <div
class="fk-menu-icons" class="fk-menu-icons"
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
class="fmi-item" class="fmi-item"
v-for="item in menus" v-for="item in menus"
:key="item.name" :key="item.name"
:class="{ active: item.name === menuName }"
:style="{ '--mc': item.color, '--icon': `url(${item.icon})` }" :style="{ '--mc': item.color, '--icon': `url(${item.icon})` }"
@click="onItemClick(item)" @click="onItemClick(item)"
> >
...@@ -32,6 +31,7 @@ ...@@ -32,6 +31,7 @@
import uavIcon from "./assets/uav.svg"; import uavIcon from "./assets/uav.svg";
import uavVideoIcon from "./assets/uavVideo.svg"; import uavVideoIcon from "./assets/uavVideo.svg";
import { mapState } from "vuex"; import { mapState } from "vuex";
import { DataOutputs } from "../../api";
export default { export default {
name: "FkMenuIcons", name: "FkMenuIcons",
...@@ -40,22 +40,18 @@ export default { ...@@ -40,22 +40,18 @@ export default {
return { return {
menus: [ menus: [
{ {
name: "违法取证", name: "烟火识别",
label: this.tf("dataCenter.违法取证", "违法取证"), label: this.tf("common.烟火识别", "烟火识别"),
color: "#E9B949", color: "#FF7A45",
icon: uavIcon, icon: uavIcon,
action: "fire",
}, },
{ {
name: "日常巡检", name: "导出报告",
label: this.tf("common.日常巡检", "日常巡检"), label: this.tf("common.导出报告", "导出报告"),
color: "#4AA3EF", color: "#43DEFF",
icon: uavIcon,
},
{
name: "火情识别",
label: this.tf("common.火情识别", "火情识别"),
color: "#63D18C",
icon: uavVideoIcon, icon: uavVideoIcon,
action: "report",
}, },
], ],
tx: 0, // 拖动位移 X tx: 0, // 拖动位移 X
...@@ -68,17 +64,23 @@ export default { ...@@ -68,17 +64,23 @@ export default {
menuName() { menuName() {
return (this.rootNode && this.rootNode.menuName) || ""; return (this.rootNode && this.rootNode.menuName) || "";
}, },
// 与右侧工具栏(ControlPanel v-if="uav && showPanel")保持一致: // 仅在选中「火情/烟火识别」菜单且已接管无人机时展示
// 未选中/未接管无人机时不显示,选中设备后才浮现 // menuName 由主框架下发(无 code),用关键词兼容中/英/俄多语言菜单名
visible() { visible() {
return !!this.uav; if (!this.uav) return false;
const name = (this.menuName || "").trim().toLowerCase();
return (
name.includes("火情") ||
name.includes("烟火") ||
name.includes("fire") ||
name.includes("пожар")
);
}, },
dragStyle() { dragStyle() {
return { transform: `translate(${this.tx}px, ${this.ty}px)` }; return { transform: `translate(${this.tx}px, ${this.ty}px)` };
}, },
}, },
methods: { methods: {
// i18n 兜底:key 不存在时退回中文(避免 micro 端缺命名空间显示 key 本身)
tf(key, fallback) { tf(key, fallback) {
try { try {
const v = this.$t(key); const v = this.$t(key);
...@@ -87,10 +89,9 @@ export default { ...@@ -87,10 +89,9 @@ export default {
return fallback; return fallback;
} }
}, },
// 按下开始拖动:document 级 mousemove/mouseup,位移超 3px 视为拖动
onDragStart(e) { onDragStart(e) {
if (e.button !== 0) return; if (e.button !== 0) return;
e.preventDefault(); // 阻止选中文字/图片原生拖拽 e.preventDefault();
const state = { const state = {
startX: e.clientX, startX: e.clientX,
startY: e.clientY, startY: e.clientY,
...@@ -98,7 +99,7 @@ export default { ...@@ -98,7 +99,7 @@ export default {
startTy: this.ty, startTy: this.ty,
moved: false, moved: false,
}; };
this._dragState = state; // 非响应式,仅内部用 this._dragState = state;
const move = (ev) => { const move = (ev) => {
const dx = ev.clientX - state.startX; const dx = ev.clientX - state.startX;
const dy = ev.clientY - state.startY; const dy = ev.clientY - state.startY;
...@@ -115,19 +116,63 @@ export default { ...@@ -115,19 +116,63 @@ export default {
document.addEventListener("mousemove", move); document.addEventListener("mousemove", move);
document.addEventListener("mouseup", up); document.addEventListener("mouseup", up);
}, },
// 点击切换菜单:拖动结束的那次 click 不触发(moved 标记在下一次 mousedown 才复位)
onItemClick(item) { onItemClick(item) {
// 拖动结束的那次 click 不触发
if (this._dragState && this._dragState.moved) return; if (this._dragState && this._dragState.moved) return;
if (item.name === this.menuName) return; // 已是当前菜单 if (item.action === "fire") {
window.parent.postMessage( this.onFireIdentify();
{ } else if (item.action === "report") {
module: "MMCFlightControlCenter", this.onExportReport();
type: "event", }
event: "menuChange",
data: { name: item.name },
}, },
"*" // 烟火识别:复用播放器 aiList 的 kbtAi 识别(截图当前画面)
); onFireIdentify() {
const player = window.$uavPlayer;
if (!player) {
this.$message && this.$message.warning("播放器未就绪,请先接管无人机");
return;
}
const aiList = player.$refs && player.$refs.aiList;
if (!aiList) {
this.$message &&
this.$message.warning("AI 识别组件未加载,请重新进入无人机应用");
return;
}
// 2 = 烟火识别 typeId(识别结果存成果中心 detectorType=2)
aiList.onAiIdentify(2);
},
// 导出报告:成果中心 AI 分析报告(docx)
async onExportReport() {
const uav = this.uav || {};
try {
if (this.$message) {
this.$message({ message: "报告生成中...", type: "success" });
}
// 只导烟火识别报告:detectorType=2
const params = { fileType: 0, detectorType: 2 };
// FKZX 图库按设备组织;若后端要求 folderId 需另行确认
if (uav.deviceId) {
params.deviceId = uav.deviceId;
}
const res = await DataOutputs.exporAnalysis(params);
const blob = res instanceof Blob ? res : new Blob([res]);
this.downloadBlob(blob, "AI分析报告.docx");
} catch (e) {
console.warn("[fk-menu-icons] 导出报告失败", e);
if (this.$message) {
this.$message.error("导出报告失败");
}
}
},
downloadBlob(blob, filename) {
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, },
}, },
}; };
...@@ -136,7 +181,6 @@ export default { ...@@ -136,7 +181,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.fk-menu-icons { .fk-menu-icons {
position: absolute; position: absolute;
// 视频播放器(.player)为 left:35% + 宽718px,图标条默认贴其右侧(+12px 间隙),同 top 起点
top: 20%; top: 20%;
left: calc(35% + 730px); left: calc(35% + 730px);
z-index: 20; z-index: 20;
...@@ -159,7 +203,6 @@ export default { ...@@ -159,7 +203,6 @@ export default {
background: rgba(8, 34, 30, 0.6); background: rgba(8, 34, 30, 0.6);
transition: background 0.2s, box-shadow 0.2s, border-color 0.2s; transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
// 图标 mask 染色(与主项目左侧菜单同款做法)
.fmi-icon { .fmi-icon {
display: block; display: block;
width: 24px; width: 24px;
...@@ -184,12 +227,7 @@ export default { ...@@ -184,12 +227,7 @@ export default {
&:hover { &:hover {
border-color: var(--mc); border-color: var(--mc);
} background: rgba(8, 34, 30, 0.9);
&.active {
background: rgba(8, 34, 30, 0.92);
border-color: var(--mc);
box-shadow: inset 0 0 12px -4px var(--mc), 0 0 10px -5px var(--mc);
} }
} }
} }
......
<template>
<div class="region-report">
<!-- 绘制面板 -->
<div class="rr-panel" v-show="visible">
<div class="rr-head">
<span class="rr-title">区域分析</span>
<span class="rr-close" @click="onClose">×</span>
</div>
<div class="rr-body">
<div class="rr-row">
<span class="rr-label">绘制工具:</span>
<span
class="rr-tool"
:class="{ active: markType === 'POLYGON' }"
@click="drawClick('POLYGON')"
>多边形</span
>
<span
class="rr-tool"
:class="{ active: markType === 'CIRCLE' }"
@click="drawClick('CIRCLE')"
>圆形</span
>
</div>
<div class="rr-tip">{{ tip }}</div>
</div>
<div class="rr-foot">
<span class="rr-btn" @click="onClose">取消</span>
<span class="rr-btn primary" @click="onSubmit">确定</span>
</div>
</div>
<!-- 统计结果 + 导出 -->
<div class="rr-result" v-show="showResult">
<div class="rr-head">
<span class="rr-title">分析结果</span>
<span class="rr-close" @click="showResult = false">×</span>
</div>
<div class="rr-chart" ref="chartRef"></div>
<div class="rr-export" @click="onExport">生成并导出报告</div>
</div>
</div>
</template>
<script>
import { mapState } from "vuex";
import echarts from "echarts";
import { DataOutputs } from "../../api";
// 模块级绘制缓存(与 TMJ Regional 一致的实现方式)
let entities = [];
let positions = [];
let radiusDistance = null;
let circleEntity = null;
export default {
name: "RegionReport",
props: {
visible: { type: Boolean, default: false },
},
data() {
return {
markType: "",
tip: "请选择绘制工具,在地图上绘制区域",
showResult: false,
chartInstance: null,
currentData: [], // 统计结果缓存,导出用
};
},
computed: {
...mapState("MMCFlightControlCenter", ["cesiumViewer"]),
},
beforeDestroy() {
this.clearMarker();
this.removeInputAction();
if (this.chartInstance) {
this.chartInstance.dispose();
this.chartInstance = null;
}
},
methods: {
// Cartesian3 -> WGS84 经纬度(Cesium 原生实现,替代 mmc/utils/cesium 的 Utils)
transformCartesian2WGS84(cartesian) {
const Cesium = window.Cesium;
const carto = Cesium.Cartographic.fromCartesian(cartesian);
return {
lng: Cesium.Math.toDegrees(carto.longitude),
lat: Cesium.Math.toDegrees(carto.latitude),
alt: carto.height,
};
},
getViewer() {
return (
this.cesiumViewer ||
(window.$mmc_stl && window.$mmc_stl.viewer) ||
window.viewer
);
},
// 屏幕坐标 -> 世界坐标(pickPosition 失败时回退椭球拾取)
pickWorld(viewer, clientPos) {
const Cesium = window.Cesium;
let pos = null;
try {
pos = viewer.scene.pickPosition(clientPos);
} catch (e) {
pos = null;
}
if (!pos) {
try {
pos = viewer.camera.pickEllipsoid(clientPos, viewer.scene.globe.ellipsoid);
} catch (e) {
pos = null;
}
}
return pos;
},
onClose() {
this.clearMarker();
this.removeInputAction();
this.markType = "";
this.showResult = false;
this.$emit("close");
},
removeInputAction() {
const viewer = this.getViewer();
const Cesium = window.Cesium;
if (!viewer || !Cesium || !viewer.screenSpaceEventHandler) return;
if (this.leftClickHandler) {
viewer.screenSpaceEventHandler.removeInputAction(
Cesium.ScreenSpaceEventType.LEFT_CLICK,
this.leftClickHandler
);
this.leftClickHandler = null;
}
if (this.rightClickHandler) {
viewer.screenSpaceEventHandler.removeInputAction(
Cesium.ScreenSpaceEventType.RIGHT_CLICK,
this.rightClickHandler
);
this.rightClickHandler = null;
}
},
clearMarker() {
const viewer = this.getViewer();
if (viewer && entities.length) {
entities.forEach((e) => viewer.entities.remove(e));
}
entities = [];
positions = [];
circleEntity = null;
radiusDistance = null;
},
// 添加点
createPoint(viewer, Cesium, position) {
const pointEntity = viewer.entities.add({
position,
point: {
pixelSize: 20,
color: Cesium.Color.RED,
outlineColor: Cesium.Color.WHITE,
outlineWidth: 2,
},
});
entities.push(pointEntity);
positions.push(position);
},
// 添加两点之间的线 + 距离标注
createPolyline(viewer, Cesium, position) {
if (positions.length > 1) {
const lineEntity = viewer.entities.add({
polyline: {
positions: [positions[positions.length - 2], position],
width: 2,
material: Cesium.Color.RED,
},
});
entities.push(lineEntity);
radiusDistance = Cesium.Cartesian3.distance(
position,
positions[positions.length - 2]
);
}
},
// 绘制圆形
createCircle(viewer, Cesium) {
if (positions.length < 2) return;
const radius = Cesium.Cartesian3.distance(positions[0], positions[1]);
circleEntity = viewer.entities.add({
position: positions[0],
ellipse: {
semiMinorAxis: radius,
semiMajorAxis: radius,
material: Cesium.Color.RED.withAlpha(0.5),
outline: true,
outlineColor: Cesium.Color.WHITE,
},
});
entities.push(circleEntity);
},
// 选择绘制工具
drawClick(type) {
const viewer = this.getViewer();
const Cesium = window.Cesium;
if (!viewer || !Cesium) {
this.$message && this.$message.warning("地图未就绪");
return;
}
this.removeInputAction();
this.clearMarker();
this.markType = type;
if (type === "CIRCLE") {
this.tip = "圆形:点击选择圆心,再点击确定半径";
this.leftClickHandler = viewer.screenSpaceEventHandler.setInputAction(
(event) => {
const pos = this.pickWorld(viewer, event.position);
if (!pos) return;
this.createPoint(viewer, Cesium, pos);
if (positions.length === 2) {
this.createCircle(viewer, Cesium);
this.removeInputAction();
this.tip = "圆形绘制完成,可点击「确定」统计";
} else {
this.tip = "请点击第二点确定半径";
}
},
Cesium.ScreenSpaceEventType.LEFT_CLICK
);
} else {
this.tip = "多边形:左键逐点绘制,右键双击闭合";
this.leftClickHandler = viewer.screenSpaceEventHandler.setInputAction(
(e) => {
const pos = this.pickWorld(viewer, e.position);
if (!pos) return;
this.createPoint(viewer, Cesium, pos);
this.createPolyline(viewer, Cesium, pos);
},
Cesium.ScreenSpaceEventType.LEFT_CLICK
);
let rightClickTimer = null;
let isRightDoubleClick = false;
this.rightClickHandler = viewer.screenSpaceEventHandler.setInputAction(
() => {
if (rightClickTimer) {
clearTimeout(rightClickTimer);
isRightDoubleClick = true;
this.finishPolygon(viewer, Cesium);
} else {
rightClickTimer = setTimeout(() => {
if (!isRightDoubleClick) return;
rightClickTimer = undefined;
isRightDoubleClick = false;
}, 300);
}
},
Cesium.ScreenSpaceEventType.RIGHT_CLICK
);
}
},
// 闭合多边形
finishPolygon(viewer, Cesium) {
if (positions.length < 3) {
this.$message && this.$message.warning("请最少选择三个点");
return;
}
this.removeInputAction();
const polygonEntity = viewer.entities.add({
polygon: {
hierarchy: positions,
material: Cesium.Color.RED.withAlpha(0.5),
},
});
entities.push(polygonEntity);
// 补最后一条闭合边
const lineEntity = viewer.entities.add({
polyline: {
positions: [positions[0], positions[positions.length - 1]],
width: 2,
material: Cesium.Color.RED,
},
});
entities.push(lineEntity);
this.tip = "多边形绘制完成,可点击「确定」统计";
},
// 确定 -> 统计
async onSubmit() {
if (!entities.length || !positions.length || !this.markType) {
this.$message && this.$message.warning("请先绘制区域");
return;
}
let points = [];
let radius = 0;
if (this.markType === "POLYGON") {
const closed = [...positions, positions[0]];
closed.forEach((item) => {
const { lng, lat } = this.transformCartesian2WGS84(item);
points.push({ latitude: lat, longitude: lng, height: 0 });
});
points = JSON.stringify(points);
} else {
const { lng, lat } = this.transformCartesian2WGS84(positions[0]);
points = JSON.stringify([{ latitude: lat, longitude: lng, height: 0 }]);
radius = (radiusDistance || 0) / 100000;
}
const data = {
areaData: points,
areaType: this.markType === "CIRCLE" ? 4 : 3,
radius: this.markType === "CIRCLE" ? radius : 0,
};
try {
const res = await DataOutputs.areaAnalysis(data);
const list = (res && res.data) || (Array.isArray(res) ? res : []) || [];
if (!list.length) {
this.$message && this.$message.warning("此地区无带有标签的标注");
return;
}
this.currentData = list;
this.showResult = true;
this.$nextTick(() => this.renderChart(list));
} catch (e) {
console.warn("[regionReport] areaAnalysis 失败", e);
}
},
// 渲染饼图
renderChart(list) {
const dom = this.$refs.chartRef;
if (!dom) return;
if (!this.chartInstance) {
this.chartInstance = echarts.init(dom);
}
this.chartInstance.clear();
const pieData = list.map((item) => ({
name: item.name,
value: item.count,
}));
this.chartInstance.setOption({
tooltip: { trigger: "item" },
legend: {
type: "scroll",
orient: "horizontal",
bottom: 0,
textStyle: { color: "#cbd0eb", fontSize: 10 },
},
series: [
{
name: "标注统计",
type: "pie",
radius: ["30%", "62%"],
center: ["50%", "45%"],
data: pieData,
label: { color: "#cbd0eb", fontSize: 10 },
},
],
});
},
// 导出报告
async onExport() {
const dom = this.$refs.chartRef;
if (!dom) return;
try {
const canvas = dom.querySelector("canvas");
let blob = null;
if (canvas) {
blob = await new Promise((resolve) =>
canvas.toBlob((b) => resolve(b))
);
}
const data = new FormData();
data.append("file", blob);
data.append("areaType", this.markType === "CIRCLE" ? 4 : 3);
if (this.markType === "CIRCLE") {
data.append("radius", (radiusDistance || 0) / 100000);
}
// areaData 复用绘制时数据:重新组装
let points = [];
if (this.markType === "POLYGON") {
[...positions, positions[0]].forEach((item) => {
const { lng, lat } = this.transformCartesian2WGS84(item);
points.push({ latitude: lat, longitude: lng, height: 0 });
});
} else {
const { lng, lat } = this.transformCartesian2WGS84(positions[0]);
points.push({ latitude: lat, longitude: lng, height: 0 });
}
data.append("areaData", JSON.stringify(points));
const res = await DataOutputs.analysisDocx(data);
const blobData = res && res.data ? res.data : res;
let filename = "区域分析报告.docx";
const headers = (res && res.headers) || {};
const cd =
headers["content-disposition"] ||
headers["Content-Disposition"] ||
headers["Content-disposition"];
if (cd) {
const m = cd.match(/filename[*]?\s*=\s*(?:"([^"]+)"|'([^']+)'|([^;\s]+))/i);
if (m) {
const raw = m[1] || m[2] || m[3];
try {
filename = decodeURIComponent(raw);
} catch (e) {
filename = raw;
}
}
}
this.downloadBlob(blobData, filename);
} catch (e) {
console.warn("[regionReport] 导出失败", e);
this.$message && this.$message.error("导出失败");
}
},
downloadBlob(blob, filename) {
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
},
},
};
</script>
<style lang="scss" scoped>
.region-report {
.rr-panel,
.rr-result {
position: fixed;
right: 80px;
top: 106px;
width: 320px;
background: rgba(10, 22, 38, 0.92);
border: 1px solid var(--border-light, #43deff);
border-radius: 4px;
color: #cbd0eb;
z-index: 30;
backdrop-filter: blur(4px);
}
.rr-result {
top: 106px;
right: 410px;
width: 360px;
}
.rr-head {
height: 32px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
border-bottom: 1px solid rgba(67, 222, 255, 0.25);
.rr-title {
font-size: 14px;
color: #ebf5ff;
}
.rr-close {
cursor: pointer;
color: #9bacbe;
}
}
.rr-body {
padding: 10px;
.rr-row {
display: flex;
align-items: center;
gap: 8px;
}
.rr-label {
font-size: 13px;
color: #9bacbe;
}
.rr-tool {
cursor: pointer;
padding: 4px 10px;
border: 1px solid rgba(67, 222, 255, 0.4);
border-radius: 3px;
font-size: 12px;
color: #cbd0eb;
&.active {
background: rgba(0, 79, 255, 0.3);
border-color: #43deff;
color: #fff;
}
}
.rr-tip {
margin-top: 8px;
font-size: 12px;
color: #9bacbe;
line-height: 18px;
}
}
.rr-foot {
display: flex;
justify-content: center;
gap: 10px;
padding: 0 0 10px;
.rr-btn {
cursor: pointer;
width: 90px;
height: 30px;
line-height: 30px;
text-align: center;
background: rgba(0, 79, 255, 0.5);
border-radius: 3px;
font-size: 13px;
color: #ebf5ff;
&.primary {
background: #004fff;
}
}
}
.rr-chart {
width: 100%;
height: 240px;
}
.rr-export {
cursor: pointer;
margin: 0 10px 10px;
height: 32px;
line-height: 32px;
text-align: center;
background: #004fff;
border-radius: 3px;
color: #fff;
font-size: 13px;
}
}
</style>
...@@ -340,7 +340,20 @@ return [ ...@@ -340,7 +340,20 @@ return [
* ai处理, 父组件也调用 * ai处理, 父组件也调用
*/ */
aiIdentify(type, callback) { aiIdentify(type, callback) {
let find = this.aiIdentifyList.find((item) => item.type === type); // type 支持字符串标识(type)或数字(typeId),便于精确指定识别类型(如烟火 typeId=2)
// 优先用接口配置的可用列表;未加载/为空时回退到前端完整列表(deAiIdentifyList)
const list =
this.aiIdentifyList && this.aiIdentifyList.length
? this.aiIdentifyList
: this.deAiIdentifyList;
let find =
typeof type === "number"
? list.find((item) => item.typeId === type)
: list.find((item) => item.type === type);
if (!find) {
callback && callback(false);
return;
}
this.aiTitle = find.title; this.aiTitle = find.title;
let isSuccess = false; let isSuccess = false;
// 截图做ai识别 // 截图做ai识别
...@@ -357,13 +370,13 @@ return [ ...@@ -357,13 +370,13 @@ return [
prob: 1, prob: 1,
}, */ }, */
]; ];
switch (type) { switch (find.type) {
// 车牌识别 自研 // 车牌识别 自研
/* case "plate": { /* case "plate": {
let formData = new FormData(); let formData = new FormData();
formData.append("image", blob, `下载.jpeg`); formData.append("image", blob, `下载.jpeg`);
formData.append("iscount", 1); formData.append("iscount", 1);
let res = await AI_API[type](formData); let res = await AI_API[find.type](formData);
results = results =
res?.data?.data?.map((item) => { res?.data?.data?.map((item) => {
...@@ -387,7 +400,7 @@ return [ ...@@ -387,7 +400,7 @@ return [
// 用的百度 // 用的百度
let formData = new FormData(); let formData = new FormData();
formData.append("image", blob, `下载.jpeg`); formData.append("image", blob, `下载.jpeg`);
let res = await AI_API[type](formData); let res = await AI_API[find.type](formData);
results = res?.data?.data?.map((item) => { results = res?.data?.data?.map((item) => {
return { return {
x: item.left, x: item.left,
...@@ -410,7 +423,7 @@ return [ ...@@ -410,7 +423,7 @@ return [
let formData = new FormData(); let formData = new FormData();
formData.append("image", blob, `下载.jpeg`); formData.append("image", blob, `下载.jpeg`);
formData.append("iscount", 1); formData.append("iscount", 1);
let res = await AI_API[type](formData); let res = await AI_API[find.type](formData);
results = results =
res?.data?.data?.data?.map((item) => { res?.data?.data?.data?.map((item) => {
return { return {
...@@ -432,7 +445,7 @@ return [ ...@@ -432,7 +445,7 @@ return [
let formData = new FormData(); let formData = new FormData();
formData.append("image", blob, `下载.jpeg`); formData.append("image", blob, `下载.jpeg`);
formData.append("iscount", 1); formData.append("iscount", 1);
let res = await AI_API[type](formData); let res = await AI_API[find.type](formData);
results = results =
res?.data?.data?.data?.map((item) => { res?.data?.data?.data?.map((item) => {
return { return {
...@@ -452,7 +465,7 @@ return [ ...@@ -452,7 +465,7 @@ return [
// 共达地通用数据结构 // 共达地通用数据结构
default: default:
{ {
let res = await AI_API[type]({ let res = await AI_API[find.type]({
image: base64, image: base64,
}); });
/* let targets = [ /* let targets = [
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论