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)', title: 'X(mm)',
dataIndex: 'x', dataIndex: 'x',
key: 'x', key: 'x',
width: '80px', width: '75px',
}, },
{ {
title: 'Y(mm)', title: 'Y(mm)',
dataIndex: 'y', dataIndex: 'y',
key: 'y', key: 'y',
width: '80px', width: '75px',
}, },
{ {
title: 'w(mm)', title: 'w(mm)',
dataIndex: 'w', dataIndex: 'w',
key: 'w', key: 'w',
width: '80px', width: '75px',
}, },
{ {
title: 'h(mm)', title: 'h(mm)',
dataIndex: 'h', dataIndex: 'h',
key: 'h', key: 'h',
width: '80px', width: '75px',
}, },
{ {
title: '中心点(m)', title: '中心点(m)',

View File

@ -23,15 +23,13 @@
@click="handleDownload" @click="handleDownload"
:icon="h(DownloadOutlined)" :icon="h(DownloadOutlined)"
:disabled="checkedKeys.length === 0" :disabled="checkedKeys.length === 0"
>下发数据</a-button >下发数据</a-button>
>
<a-button <a-button
type="default" type="default"
@click="handleSync" @click="handleSync"
:icon="h(SyncOutlined)" :icon="h(SyncOutlined)"
:disabled="checkedKeys.length === 0" :disabled="checkedKeys.length === 0"
>同步数据</a-button >同步数据</a-button>
>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
@ -62,6 +60,7 @@
icon: 'ant-design:eye-outlined', icon: 'ant-design:eye-outlined',
onClick: handleView.bind(null, record), onClick: handleView.bind(null, record),
divider: true, divider: true,
disabled: record.endTime === undefined || record.endTime === null,
}, },
{ {
label: '下发数据', label: '下发数据',
@ -220,18 +219,36 @@
const handleView = (record: any) => { const handleView = (record: any) => {
const params = JSON.parse(record.paramJson); const params = JSON.parse(record.paramJson);
params.forEach((d) => { const result = JSON.parse(record.resultJson);
const r = Math.ceil(Math.random() * 10) - 3; if (record.resultJson === undefined || record.resultJson === null)
d.l1 = r + parseInt(d.w); return;
d.l2 = r + parseInt(d.h); result.forEach((items: any) => {
d.l3 = r + parseInt(d.w); items.forEach((d: any) => {
d.l4 = r + parseInt(d.h); params[d.code - 1].x1 = d.x1;
const x = parseInt(d.x) + d.l1 / 2; params[d.code - 1].x2 = d.x2;
const y = parseInt(d.y) + d.l2 / 2; params[d.code - 1].x3 = d.x3;
d.c = x + ' , ' + y; params[d.code - 1].x4 = d.x4;
d.result = r >= -2 && r <= 5 ? 'OK' : 'NG'; 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 }); 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"> <BasicModal v-bind="$attrs" @register="register" :closable="false" :showCancelBtn="false" okText="关闭" showFooter title="任务结果详情" width="1450px" @ok="closeModal">
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'result'"> <template v-if="column.dataIndex === 'status'">
<CheckOutlined :style="{ color: '#00ff00' }" v-if="record.result === 'OK'" /> <CheckOutlined :style="{ color: '#00ff00' }" v-if="record.status === 'good'" />
<CloseOutlined :style="{ color: '#ff0000' }" v-if="record.result === 'NG'" /> <CloseOutlined :style="{ color: '#ff0000' }" v-if="record.status === 'error'" />
</template> </template>
</template> </template>
</BasicTable> </BasicTable>
@ -53,40 +53,64 @@ const columns = [
key: 'h', key: 'h',
width: '80px', 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)', title: '检测中心(mm)',
dataIndex: 'c', dataIndex: 'c',
key: 'c', key: 'c',
width: '110px', 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: '结果', title: '结果',
dataIndex: 'result', dataIndex: 'status',
key: 'result', key: 'status',
width: '80px', width: '80px',
}, },
]; ];
@ -100,7 +124,7 @@ const [register, { closeModal, setModalProps }] = useModalInner(async (data) =>
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
entity.value = data?.record; entity.value = data?.record;
paramData.value = []; 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) => { items.forEach((d: any, index: number) => {
paramData.value.push({ index, ...d }); paramData.value.push({ index, ...d });
}); });