Compare commits

..

2 Commits

Author SHA1 Message Date
njdaoyehu
bb15f8ca33 fixed 2025-04-23 14:49:49 +08:00
njdaoyehu
c64df82202 fixed 2025-04-23 10:27:38 +08:00
5 changed files with 41 additions and 7 deletions

View File

@ -60,6 +60,7 @@ export const schema = {
},
colProps,
component: 'Input',
rules: [{ required: true, message: '请输入设备序列号!' }],
},
table: {
},

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

@ -292,11 +292,20 @@
isLoading.value = true;
OCRService.importByOCR(base64ImageString).then(
(res: any) => {
if (res === "") {
isLoading.value = false;
return;
}
const data = JSON.parse(res);
if (data.length === 0) {
isLoading.value = false;
return;
}
// 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',