mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect-embeded.git
synced 2025-06-24 13:34:13 +08:00
fixed
This commit is contained in:
parent
a555011735
commit
c4102ab947
@ -447,7 +447,8 @@
|
||||
}
|
||||
|
||||
:deep(.anticon) {
|
||||
color: white !important;
|
||||
//color: white !important;
|
||||
color: white;
|
||||
}
|
||||
|
||||
:deep(.ant-picker-panel-layout) {
|
||||
|
@ -30,15 +30,6 @@ const data: AppRouteModule = {
|
||||
ignoreAuth: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'task/:id',
|
||||
name: 'TaskDetailPage',
|
||||
component: () => import('/@/views/data/task/detail.vue'),
|
||||
meta: {
|
||||
title: '任务详情',
|
||||
ignoreAuth: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'task-log',
|
||||
name: 'TaskLogPage',
|
||||
|
@ -54,6 +54,7 @@
|
||||
},
|
||||
);
|
||||
await action(data);
|
||||
DeviceClientService.fefreshDeviceClient(data);
|
||||
closeDrawer();
|
||||
emit('success');
|
||||
} catch {} finally {
|
||||
|
@ -1,71 +0,0 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<Card :bordered="false" :loading="isLoading">
|
||||
<PageHeader
|
||||
:title="title"
|
||||
@back="() => $router.go(-1)"
|
||||
>
|
||||
<template #extra>
|
||||
<a-button type="primary" @click="$router.go(-1)">返回上一页面</a-button>
|
||||
</template>
|
||||
</PageHeader>
|
||||
<Descriptions bordered :column="1">
|
||||
<Descriptions.Item
|
||||
v-for="p in displayProps"
|
||||
:key="p.key"
|
||||
:label="p.title">
|
||||
{{ p.value }}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, computed, ref, Ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useAsyncState } from '@vueuse/core';
|
||||
import { PageHeader, Descriptions, Card } from 'ant-design-vue';
|
||||
import { descriptionColumns } from './schema';
|
||||
import * as TaskApi from '@/api/data/taskApi';
|
||||
import { Task } from '@/api/model/task';
|
||||
|
||||
const route = useRoute();
|
||||
const id = ref(route.params?.id);
|
||||
const title = route.meta.title
|
||||
|
||||
// id 查询
|
||||
const {
|
||||
state: detail,
|
||||
isReady: isDetailReady,
|
||||
isLoading,
|
||||
execute,
|
||||
} = useAsyncState(
|
||||
TaskApi.getById(id.value).then((res: Task) => res),
|
||||
null,
|
||||
{
|
||||
immediate: false,
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
execute();
|
||||
});
|
||||
|
||||
const displayProps: Ref<Array<any>> = computed(() => {
|
||||
if (!isDetailReady.value) return {};
|
||||
const display: any = descriptionColumns.map(({ title, dataIndex = '', customRender }) => ({
|
||||
key: dataIndex,
|
||||
title,
|
||||
value: customRender ? customRender({ text: detail.value[dataIndex], record: detail.value }) : detail.value[dataIndex],
|
||||
}));
|
||||
return display;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use '@/assets/custom.scss';
|
||||
.detail-container {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -39,10 +39,10 @@
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
label: '详情',
|
||||
label: '结果查看',
|
||||
icon: 'ant-design:eye-outlined',
|
||||
onClick: handleView.bind(null, record),
|
||||
divider: true
|
||||
divider: true,
|
||||
},
|
||||
{
|
||||
label: '下发数据',
|
||||
@ -65,11 +65,11 @@
|
||||
</BasicTable>
|
||||
<TaskDrawer ref="taskDrawer" @register="registerDrawer" @success="handleSuccess" @ocrClick="handleOpenFileDialog" />
|
||||
<PdfViewer ref="pdfView" @onCapture="handleCapture" />
|
||||
<Result @register="register" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useGo } from '@/hooks/web/usePage';
|
||||
import { usePermission } from '@/hooks/web/usePermission';
|
||||
import { usePermission } from '@/hooks/web/usePermission';
|
||||
import { BasicTable, useTable, TableAction } from '@/components/Table';
|
||||
import { isObject } from '@/utils/is';
|
||||
import dayjs from 'dayjs';
|
||||
@ -87,10 +87,13 @@
|
||||
SyncOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import PdfViewer from "@/components/PdfViewer/index.vue";
|
||||
import {useModal} from "@/components/Modal";
|
||||
import Result from "@/views/data/task/result.vue";
|
||||
|
||||
const [register, { openModal }] = useModal();
|
||||
|
||||
const taskDrawer = ref<typeof TaskDrawer>();
|
||||
const { hasPermission } = usePermission();
|
||||
const go = useGo();
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const onSelectChange = (selectedRowKeys: (string | number)[]) => {
|
||||
checkedKeys.value = selectedRowKeys.filter(k => typeof k !== 'undefined');
|
||||
@ -179,7 +182,20 @@
|
||||
};
|
||||
|
||||
const handleView = (record: any) => {
|
||||
go('/data/task/' + record.id);
|
||||
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';
|
||||
});
|
||||
record.resultJson = JSON.stringify(params);
|
||||
openModal(true, {record});
|
||||
};
|
||||
|
||||
let ocrData = null;
|
||||
@ -208,8 +224,8 @@
|
||||
};
|
||||
|
||||
const handleCapture = (base64ImageString: any) => {
|
||||
WebViewService.setIsLoading(true).then(() => {});
|
||||
TaskApi.importImageOCR(base64ImageString).then((res: any) => {
|
||||
WebViewService.setMessage("数据导入成功!", "success").then(() => {});
|
||||
const data = JSON.parse(res);
|
||||
if (data.length === 0) return;
|
||||
if (ocrData === null) {
|
||||
@ -225,8 +241,11 @@
|
||||
} else {
|
||||
taskDrawer.value?.setParamData(data);
|
||||
}
|
||||
WebViewService.setMessage("数据导入成功!", "success").then(() => {});
|
||||
}).catch(() => {
|
||||
WebViewService.setMessage("数据导入失败!", "error").then(() => {});
|
||||
}).finally(() => {
|
||||
WebViewService.setIsLoading(false).then(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
|
125
src/views/data/task/result.vue
Normal file
125
src/views/data/task/result.vue
Normal file
@ -0,0 +1,125 @@
|
||||
|
||||
<template>
|
||||
<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>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BasicModal, useModalInner } from "@/components/Modal";
|
||||
import {defineEmits, ref} from "vue";
|
||||
import {BasicTable, useTable,} from "@/components/Table";
|
||||
import { CheckOutlined, CloseOutlined } from "@ant-design/icons-vue";
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '预埋件编号',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
},
|
||||
{
|
||||
title: 'X(mm)',
|
||||
dataIndex: 'x',
|
||||
key: 'x',
|
||||
width: '80px',
|
||||
},
|
||||
{
|
||||
title: 'Y(mm)',
|
||||
dataIndex: 'y',
|
||||
key: 'y',
|
||||
width: '80px',
|
||||
},
|
||||
{
|
||||
title: 'w(mm)',
|
||||
dataIndex: 'w',
|
||||
key: 'w',
|
||||
width: '80px',
|
||||
},
|
||||
{
|
||||
title: 'h(mm)',
|
||||
dataIndex: 'h',
|
||||
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: '结果',
|
||||
dataIndex: 'result',
|
||||
key: 'result',
|
||||
width: '80px',
|
||||
},
|
||||
];
|
||||
|
||||
const paramData = ref<any>([]);
|
||||
|
||||
const entity = ref();
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
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) : [];
|
||||
items.forEach((d: any, index: number) => {
|
||||
paramData.value.push({ index, ...d });
|
||||
});
|
||||
});
|
||||
|
||||
const [registerTable] = useTable({
|
||||
title: '',
|
||||
columns,
|
||||
dataSource: paramData,
|
||||
useSearchForm: false,
|
||||
showTableSetting: false,
|
||||
bordered: true,
|
||||
showIndexColumn: false,
|
||||
canResize: false,
|
||||
pagination: false,
|
||||
rowKey: (record: any) => record.code,
|
||||
});
|
||||
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@use '@/assets/custom.scss';
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user