This commit is contained in:
njdaoyehu 2025-05-26 17:00:24 +08:00
parent f643ca1626
commit afbe9b59ad
5 changed files with 120 additions and 70 deletions

Binary file not shown.

View File

@ -88,6 +88,11 @@
padding-top: 10px;
}
.ant-checkbox-group-item {
font-family: "Noto Sans SC", serif;
font-size: 14px;
color: #FFFFFF;
}
.ant-tree-checkbox-inner,
.ant-checkbox-inner {
border: 1px solid rgba(45, 119, 243, 0.3) !important;

View File

@ -230,7 +230,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
// authentication schemese.g: Bearer
// authenticationScheme: 'Bearer',
authenticationScheme: '',
timeout: 10 * 1000,
timeout: 60 * 1000,
// 基础接口地址
// baseURL: globSetting.apiUrl,

View File

@ -4,18 +4,26 @@
<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="确定要清空预埋件列表吗?"
ok-text="确定"
cancel-text="取消"
@confirm="handleDeleteAll"
>
<a-button type="primary" :icon="h(MinusOutlined)">清空列表</a-button>
</Popconfirm>
<div>
<div style="margin-bottom: 10px">
<a-button type="primary" style="margin-left: 10px" :icon="h(PlusOutlined)" @click="handleCreate"> </a-button>
<a-button type="primary" style="margin-left: 10px" :icon="h(EyeOutlined)" :disabled="importDisabled" @click="handleOpenFileDialog">OCR识别</a-button>
<a-button type="primary" style="margin-left: 10px" :icon="h(FileExcelOutlined)" :disabled="importDisabled" @click="handleImport">导入Excel</a-button>
<Popconfirm
title="确定要清空预埋件列表吗?"
ok-text="确定"
cancel-text="取消"
@confirm="handleDeleteAll"
>
<a-button type="primary" style="margin-left: 10px" :icon="h(MinusOutlined)">清空列表</a-button>
</Popconfirm>
</div>
<div>
<span v-if="numberList.length !== 0" style="font-family: 'Noto Sans SC', serif; font-size: 14px; color: #ffffff; padding-right: 10px">{{ valueLabel }}</span>
<CheckboxGroup v-if="numberList.length !== 0" v-model:value="numberCheckedList" :options="numberList" />
<a-button type="primary" style="margin-left: 10px" :icon="h(FileSyncOutlined)" :disabled="importDisabled" @click="handleParamData">整理OCR数据</a-button>
</div>
</div>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'x'">
@ -70,7 +78,7 @@ import { BasicDrawer, useDrawerInner } from '@/components/Drawer';
import * as TaskApi from '@/api/data/taskApi';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { EyeOutlined, PlusOutlined, MinusOutlined, FileSyncOutlined, FileExcelOutlined } from "@ant-design/icons-vue";
import { Popconfirm } from 'ant-design-vue';
import { Popconfirm, CheckboxGroup } from 'ant-design-vue';
import Modal from "@/views/data/task/modal.vue";
import { useModal } from '/@/components/Modal';
const [register, { openModal }] = useModal();
@ -123,6 +131,10 @@ const columns = [
},
];
const valueLabel = ref<string>("");
const numberList = ref<any>([]);
const numberCheckedList = ref<any>([]);
const paramRawData = ref<any>([]);
const paramData = ref<any>([]);
const emit = defineEmits(['success', 'register', 'ocrClick']);
@ -141,6 +153,10 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (
setDrawerProps({confirmLoading: false});
isUpdate.value = !!data?.isUpdate;
entity.value = data?.record;
valueLabel.value = "";
numberList.value = [];
numberCheckedList.value = [];
paramRawData.value = [];
paramData.value = [];
const items = entity.value && entity.value.paramJson ? JSON.parse(entity.value.paramJson) : [];
items.forEach((d: any, index: number) => {
@ -227,7 +243,7 @@ const handleCreate = () => {
openModal(true, { isUpdate: false });
};
const handleEdit = (record: Recordable, index: number) => {
const handleEdit = (record: Recordable) => {
openModal(true, { record, isUpdate: true });
};
@ -315,8 +331,6 @@ const handleValuesChanged = () => {
// OCR
const setParamData = (data: any) => {
if (!paramData.value)
paramData.value = [];
data.forEach((d: any) => {
const items = paramData.value.filter((p: any) => p.code === d.code);
if (items.length === 0) {
@ -326,63 +340,94 @@ const setParamData = (data: any) => {
items[0] = {...d};
}
});
WebViewService.setMessage('数据导入成功!', "success").then(() => {});
};
// OCR
const handleParamData = () => {
const data = getFieldsValue();
const wallType = data.wallType;
const direction = data.direction;
numberList.value = [];
numberCheckedList.value = [];
const wallType = getFieldsValue().wallType;
// x
const uniqueListX = Array.from(new Map(paramData.value.map((item: any) => [item.x, item])).values());
// y
const uniqueListY = Array.from(new Map(paramData.value.map((item: any) => [item.y, item])).values());
// B
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(paramData.value.map((item: any) => [item.nY, item])).values());
const maxY = Math.max(...uniqueY.map((item: any) => Math.abs(Number(item.nY))));
const minY = Math.min(...uniqueY.map((item: any) => Math.abs(Number(item.nY))));
paramData.value.forEach((d: any) => {
if (Math.abs(Number(d.nY)) === minY) {
d.zm = 1;
} else if (Math.abs(Number(d.nY)) === maxY) {
d.zm = 0;
} else if (maxY - Math.abs(Number(d.nY)) < Math.abs(Number(d.nY)) - minY) {
d.zm = 0;
} else {
d.zm = 1;
}
});
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;
}
if (wallType === "B类" && uniqueListX.length <= 3 && uniqueListY.length > 3) {
valueLabel.value = "选择X值:";
uniqueListX.forEach((item: any) => { numberList.value.push(item.x); });
}
if (wallType === "A类" && uniqueListY.length <= 3 && uniqueListX.length > 3) {
valueLabel.value = "选择Y值:";
uniqueListY.forEach((item: any) => { numberList.value.push(item.y); });
}
};
// OCR
const handleParamData = () => {
if (valueLabel.value === "") return;
if (numberCheckedList.value.length === 0) {
WebViewService.setMessage('没有' + valueLabel.value, 'information').then(() => {});
return;
}
if (paramRawData.value.length === 0) {
paramData.value.forEach((d: any) => {
paramRawData.value.push({ ...d });
})
}
paramData.value = paramRawData.value.filter((d: any) => {
return (valueLabel.value.includes("X") && numberCheckedList.value.join(",").includes(d.x)) ||
(valueLabel.value.includes("Y") && numberCheckedList.value.join(",").includes(d.y))
});
// const data = getFieldsValue();
// const wallType = data.wallType;
// const direction = data.direction;
// x
// const uniqueListX = Array.from(new Map(paramData.value.map((item: any) => [item.x, item])).values());
// // y
// const uniqueListY = Array.from(new Map(paramData.value.map((item: any) => [item.y, item])).values());
// // B
// paramData.value.forEach((d: any) => {
// if (wallType === "B" && uniqueListX.length <= 4 && 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(paramData.value.map((item: any) => [item.nY, item])).values());
// const maxY = Math.max(...uniqueY.map((item: any) => Math.abs(Number(item.nY))));
// const minY = Math.min(...uniqueY.map((item: any) => Math.abs(Number(item.nY))));
// paramData.value.forEach((d: any) => {
// if (Math.abs(Number(d.nY)) === minY) {
// d.zm = 1;
// } else if (Math.abs(Number(d.nY)) === maxY) {
// d.zm = 0;
// } else if (maxY - Math.abs(Number(d.nY)) < Math.abs(Number(d.nY)) - minY) {
// d.zm = 0;
// } else {
// d.zm = 1;
// }
// });
// 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(() => {});
}

View File

@ -98,7 +98,7 @@ export const schema = {
},
{
field: 'direction',
label: '方向',
label: '检测方向',
defaultValue: undefined,
form: {
colProps,