mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect-embeded.git
synced 2025-06-24 13:34:13 +08:00
fixed
This commit is contained in:
parent
f539747c03
commit
84bfb5a4fa
@ -3,8 +3,10 @@
|
||||
<BasicForm @register="registerForm" @field-value-change="handleValuesChanged" />
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<div style="margin-right: 20px; color: #ffffff; font-size: 14px;">共 {{ paramData.length }} 件</div>
|
||||
<a-button type="primary" :icon="h(PlusOutlined)" @click="handleCreate">新 增</a-button>
|
||||
<a-button type="primary" :icon="h(EyeOutlined)" :disabled="importDisabled" @click="handleOpenFileDialog">OCR识别</a-button>
|
||||
<a-button type="primary" :icon="h(FileSyncOutlined)" style="font-size: 10px;" :disabled="importDisabled" @click="handleParamData">根据墙体类型和方向整理OCR识别的数据</a-button>
|
||||
<a-button type="primary" :icon="h(FileExcelOutlined)" :disabled="importDisabled" @click="handleImport">导入Excel</a-button>
|
||||
<Popconfirm
|
||||
title="确定要清空预埋件列表吗?"
|
||||
@ -67,7 +69,7 @@ import { formSchema } from './schema';
|
||||
import { BasicDrawer, useDrawerInner } from '@/components/Drawer';
|
||||
import * as TaskApi from '@/api/data/taskApi';
|
||||
import { BasicTable, useTable, TableAction } from '@/components/Table';
|
||||
import { EyeOutlined, PlusOutlined, MinusOutlined, FileExcelOutlined } from "@ant-design/icons-vue";
|
||||
import { EyeOutlined, PlusOutlined, MinusOutlined, FileSyncOutlined, FileExcelOutlined } from "@ant-design/icons-vue";
|
||||
import { Popconfirm } from 'ant-design-vue';
|
||||
import Modal from "@/views/data/task/modal.vue";
|
||||
import { useModal } from '/@/components/Modal';
|
||||
@ -248,6 +250,7 @@ const handleOpenFileDialog = () => {
|
||||
emit("ocrClick", data);
|
||||
};
|
||||
|
||||
// 导入EXCEL
|
||||
const handleImport = () => {
|
||||
WebViewService.importExcel().then((res: any) => {
|
||||
const data = getFieldsValue();
|
||||
@ -266,12 +269,6 @@ const handleImport = () => {
|
||||
items.forEach((d: any) => {
|
||||
if (d.wallType.toUpperCase() === data.wallType && d.direction === data.direction) {
|
||||
const items = paramData.value.filter((p: any) => p.code === d.code);
|
||||
// if (data.wallType === "B类") {
|
||||
// const nX: any = d["y"];
|
||||
// const nY: any = d["x"];
|
||||
// d.x = nX;
|
||||
// d.y = nY;
|
||||
// }
|
||||
if (items.length === 0) {
|
||||
paramData.value.push({...d});
|
||||
} else {
|
||||
@ -316,20 +313,11 @@ const handleValuesChanged = () => {
|
||||
importDisabled.value = data.wallType === undefined || data.direction === undefined;
|
||||
};
|
||||
|
||||
// OCR识别
|
||||
const setParamData = (data: any) => {
|
||||
const items = handleParamData(data);
|
||||
if (!paramData.value)
|
||||
paramData.value = [];
|
||||
items.forEach((d: any) => {
|
||||
if (d.hasOwnProperty("zm")) {
|
||||
delete d.zm;
|
||||
}
|
||||
if (d.hasOwnProperty("nX")) {
|
||||
delete d.nX;
|
||||
}
|
||||
if (d.hasOwnProperty("nY")) {
|
||||
delete d.nY;
|
||||
}
|
||||
data.forEach((d: any) => {
|
||||
const items = paramData.value.filter((p: any) => p.code === d.code);
|
||||
if (items.length === 0) {
|
||||
paramData.value.push({...d});
|
||||
@ -341,28 +329,34 @@ const setParamData = (data: any) => {
|
||||
WebViewService.setMessage('数据导入成功!', "success").then(() => {});
|
||||
};
|
||||
|
||||
const handleParamData = (items: any) => {
|
||||
// OCR识别数据整理
|
||||
const handleParamData = () => {
|
||||
const data = getFieldsValue();
|
||||
const wallType = data.wallType;
|
||||
const direction = data.direction;
|
||||
// x去重
|
||||
const uniqueListX = Array.from(new Map(items.map((item: any) => [item.x, item])).values());
|
||||
const uniqueListX = Array.from(new Map(paramData.value.map((item: any) => [item.x, item])).values());
|
||||
// y去重
|
||||
const uniqueListY = Array.from(new Map(items.map((item: any) => [item.y, item])).values());
|
||||
const uniqueListY = Array.from(new Map(paramData.value.map((item: any) => [item.y, item])).values());
|
||||
// 墙体类型为 B
|
||||
items.forEach((d: any) => {
|
||||
paramData.value.forEach((d: any) => {
|
||||
if (wallType === "B类" && uniqueListX.length <= 3 && uniqueListY.length > 3) {
|
||||
const nX: any = d["y"];
|
||||
const nY: any = d["x"];
|
||||
d.nX = nX;
|
||||
d.nY = nY;
|
||||
} else {
|
||||
const nX: any = d["x"];
|
||||
const nY: any = d["y"];
|
||||
d.nX = nX;
|
||||
d.nY = nY;
|
||||
}
|
||||
});
|
||||
// 判断正面、背面
|
||||
const uniqueY = Array.from(new Map(items.map((item: any) => [item.nY, item])).values());
|
||||
const uniqueY = Array.from(new Map(paramData.value.map((item: any) => [item.nY, item])).values());
|
||||
const maxY = Math.max(...uniqueY.map((item: any) => Number(item.nY)));
|
||||
const minY = Math.min(...uniqueY.map((item: any) => Number(item.nY)));
|
||||
items.forEach((d: any) => {
|
||||
paramData.value.forEach((d: any) => {
|
||||
if (Number(d.nY) === minY) {
|
||||
d.zm = 1;
|
||||
} else if (Number(d.nY) === maxY) {
|
||||
@ -373,7 +367,23 @@ const handleParamData = (items: any) => {
|
||||
d.zm = 1;
|
||||
}
|
||||
});
|
||||
return direction === "正面" ? items.filter((d: any) => { return d.zm === 1 }).map((d: any) => ({...d})) : items.filter((d: any) => { return d.zm === 0 }).map((d: any) => ({...d}));
|
||||
paramData.value = direction === "正面" ? paramData.value.filter((d: any) => {
|
||||
return d.zm === 1
|
||||
}).map((d: any) => ({...d})) : paramData.value.filter((d: any) => {
|
||||
return d.zm === 0
|
||||
}).map((d: any) => ({...d}));
|
||||
paramData.value.forEach((d: any) => {
|
||||
if (d.hasOwnProperty("zm")) {
|
||||
delete d.zm;
|
||||
}
|
||||
if (d.hasOwnProperty("nX")) {
|
||||
delete d.nX;
|
||||
}
|
||||
if (d.hasOwnProperty("nY")) {
|
||||
delete d.nY;
|
||||
}
|
||||
});
|
||||
WebViewService.setMessage('数据整理完成!', "success").then(() => {});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
Loading…
Reference in New Issue
Block a user