This commit is contained in:
njdaoyehu 2025-04-23 14:49:49 +08:00
parent c64df82202
commit bb15f8ca33
4 changed files with 37 additions and 14 deletions

View File

@ -52,10 +52,10 @@ const [register, { openModal }] = useModal();
const columns = [
{
title: '序号',
dataIndex: 'index',
key: 'index',
dataIndex: 'sn',
key: 'sn',
width: '50px',
customRender: ({ index }) => `${index + 1}`,
// customRender: ({ index }) => `${index + 1}`,
},
{
title: '预埋件编号',
@ -129,10 +129,13 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (
const setParamData = (items: any) => {
if (!paramData.value)
paramData.value = [];
items.forEach((d: any, index: number) => {
items.forEach((d: any) => {
const items = paramData.value.filter((p: any) => p.code === d.code);
if (items.length === 0) {
paramData.value.push({index, ...d});
paramData.value.push({...d});
}
else {
items[0] = {...d};
}
});
};
@ -196,7 +199,7 @@ const handleEdit = (record: Recordable, index: number) => {
};
const handleDelete = (record: Recordable) => {
paramData.value = paramData.value.filter(d => d.code !== record.code);
paramData.value = paramData.value.filter((d: any) => d.code !== record.code);
};
const handleOpenFileDialog = () => {
@ -215,7 +218,11 @@ const handleOpenFileDialog = () => {
};
const updateParamData = async (data: any) => {
paramData.value[data.index] = { ...data };
paramData.value.forEach((d: any, index: number) => {
if (d["code"] === data["code"]) {
paramData.value[index] = { ...data };
}
});
}
defineExpose({

View File

@ -288,10 +288,9 @@
pdfView.value.show();
};
let wallCode = null;
const handleCapture = (base64ImageString: any) => {
isLoading.value = true;
OCRService.importByOCR(base64ImageString, wallCode).then(
OCRService.importByOCR(base64ImageString).then(
(res: any) => {
if (res === "") {
isLoading.value = false;
@ -302,11 +301,11 @@
isLoading.value = false;
return;
}
if (data[0].length > 5) {
wallCode = data[0].code.substring(0, data.length - 5);
} else {
wallCode = null;
}
// if (data[0].length > 5) {
// wallCode = data[0].code.substring(0, data.length - 5);
// } else {
// wallCode = null;
// }
if (ocrData === null) {
const record = {
name: '',

View File

@ -26,6 +26,18 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) =>
});
const paramSchema: FormSchema[] = [
{
colProps: { span: 24 },
field: "sn",
label: "序号",
componentProps: {
allowClear: false,
placeholder: '序号',
},
component: "Input",
defaultValue: undefined,
rules: [{ required: true, message: '请输入序号!' }],
},
{
colProps: { span: 24 },
field: "code",

View File

@ -30,6 +30,11 @@ import ExcelJS from 'exceljs';
import { saveAs } from 'file-saver';
const columns = [
{
title: '序号',
dataIndex: 'sn',
key: 'sn',
},
{
title: '预埋件编号',
dataIndex: 'code',