This commit is contained in:
njdaoyehu 2025-03-06 18:10:05 +08:00
parent 270df3dafb
commit fcb7b463da
3 changed files with 90 additions and 49 deletions

View File

@ -64,25 +64,25 @@ const columns = [
title: 'X(mm)',
dataIndex: 'x',
key: 'x',
width: '80px',
width: '75px',
},
{
title: 'Y(mm)',
dataIndex: 'y',
key: 'y',
width: '80px',
width: '75px',
},
{
title: 'w(mm)',
dataIndex: 'w',
key: 'w',
width: '80px',
width: '75px',
},
{
title: 'h(mm)',
dataIndex: 'h',
key: 'h',
width: '80px',
width: '75px',
},
{
title: '中心点(m)',

View File

@ -23,15 +23,13 @@
@click="handleDownload"
:icon="h(DownloadOutlined)"
:disabled="checkedKeys.length === 0"
>下发数据</a-button
>
>下发数据</a-button>
<a-button
type="default"
@click="handleSync"
:icon="h(SyncOutlined)"
:disabled="checkedKeys.length === 0"
>同步数据</a-button
>
>同步数据</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
@ -62,6 +60,7 @@
icon: 'ant-design:eye-outlined',
onClick: handleView.bind(null, record),
divider: true,
disabled: record.endTime === undefined || record.endTime === null,
},
{
label: '下发数据',
@ -220,18 +219,36 @@
const handleView = (record: any) => {
const params = JSON.parse(record.paramJson);
params.forEach((d) => {
const r = Math.ceil(Math.random() * 10) - 3;
d.l1 = r + parseInt(d.w);
d.l2 = r + parseInt(d.h);
d.l3 = r + parseInt(d.w);
d.l4 = r + parseInt(d.h);
const x = parseInt(d.x) + d.l1 / 2;
const y = parseInt(d.y) + d.l2 / 2;
d.c = x + ' , ' + y;
d.result = r >= -2 && r <= 5 ? 'OK' : 'NG';
const result = JSON.parse(record.resultJson);
if (record.resultJson === undefined || record.resultJson === null)
return;
result.forEach((items: any) => {
items.forEach((d: any) => {
params[d.code - 1].x1 = d.x1;
params[d.code - 1].x2 = d.x2;
params[d.code - 1].x3 = d.x3;
params[d.code - 1].x4 = d.x4;
params[d.code - 1].y1 = d.y1;
params[d.code - 1].y2 = d.y2;
params[d.code - 1].y3 = d.y3;
params[d.code - 1].y4 = d.y4;
params[d.code - 1].w = d.w;
params[d.code - 1].h = d.h;
params[d.code - 1].status = d.status;
})
});
record.resultJson = JSON.stringify(params);
// params.forEach((d) => {
// const r = Math.ceil(Math.random() * 10) - 3;
// d.l1 = r + parseInt(d.w);
// d.l2 = r + parseInt(d.h);
// d.l3 = r + parseInt(d.w);
// d.l4 = r + parseInt(d.h);
// const x = parseInt(d.x) + d.l1 / 2;
// const y = parseInt(d.y) + d.l2 / 2;
// d.c = x + ' , ' + y;
// d.result = r >= -2 && r <= 5 ? 'OK' : 'NG';
// });
record.resultJson1 = JSON.stringify(params);
openModal(true, { record });
};

View File

@ -3,9 +3,9 @@
<BasicModal v-bind="$attrs" @register="register" :closable="false" :showCancelBtn="false" okText="关闭" showFooter title="任务结果详情" width="1450px" @ok="closeModal">
<BasicTable @register="registerTable">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'result'">
<CheckOutlined :style="{ color: '#00ff00' }" v-if="record.result === 'OK'" />
<CloseOutlined :style="{ color: '#ff0000' }" v-if="record.result === 'NG'" />
<template v-if="column.dataIndex === 'status'">
<CheckOutlined :style="{ color: '#00ff00' }" v-if="record.status === 'good'" />
<CloseOutlined :style="{ color: '#ff0000' }" v-if="record.status === 'error'" />
</template>
</template>
</BasicTable>
@ -53,40 +53,64 @@ const columns = [
key: 'h',
width: '80px',
},
{
title: '边长1(mm)',
dataIndex: 'l1',
key: 'l1',
width: '90px',
},
{
title: '边长2(mm)',
dataIndex: 'l2',
key: 'l2',
width: '90px',
},
{
title: '边长3(mm)',
dataIndex: 'l3',
key: 'l3',
width: '90px',
},
{
title: '边长4(mm)',
dataIndex: 'l4',
key: 'l4',
width: '90px',
},
{
title: '检测中心(mm)',
dataIndex: 'c',
key: 'c',
width: '110px',
},
{
title: 'X1',
dataIndex: 'x1',
key: 'x1',
width: '40px',
},
{
title: 'Y1',
dataIndex: 'y1',
key: 'y1',
width: '40px',
},
{
title: 'X2',
dataIndex: 'x2',
key: 'x2',
width: '40px',
},
{
title: 'Y2',
dataIndex: 'y2',
key: 'y2',
width: '40px',
},
{
title: 'X3',
dataIndex: 'x3',
key: 'x3',
width: '40px',
},
{
title: 'Y3',
dataIndex: 'y3',
key: 'y3',
width: '40px',
},
{
title: 'X4',
dataIndex: 'x4',
key: 'x4',
width: '40px',
},
{
title: 'Y4',
dataIndex: 'y4',
key: 'y4',
width: '40px',
},
{
title: '结果',
dataIndex: 'result',
key: 'result',
dataIndex: 'status',
key: 'status',
width: '80px',
},
];
@ -100,7 +124,7 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) =>
setModalProps({ confirmLoading: false });
entity.value = data?.record;
paramData.value = [];
const items = entity.value && entity.value.resultJson ? JSON.parse(entity.value.resultJson) : [];
const items = entity.value && entity.value.resultJson ? JSON.parse(entity.value.resultJson1) : [];
items.forEach((d: any, index: number) => {
paramData.value.push({ index, ...d });
});