|
|
@ -152,60 +152,61 @@ export default function MeasureDetail() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const onShowDetail = (item:DetailTable)=> { |
|
|
|
const onShowDetail = async (item:DetailTable)=> { |
|
|
|
//获取基线
|
|
|
|
getBaseRecordPointSetByCode("6001").then(res => { |
|
|
|
if (res.success) { |
|
|
|
setIsModalOpen(true) |
|
|
|
const benchmarkShapes = JSON.parse(res.data.points) as BenchmarkShape[]; |
|
|
|
setTimeout(()=>{ |
|
|
|
if (canvasRef.current) { |
|
|
|
console.log("解析后的基础图形数据:", benchmarkShapes); |
|
|
|
canvasRef.current.setBenchmarkData(benchmarkShapes); |
|
|
|
} |
|
|
|
},50) |
|
|
|
} |
|
|
|
}); |
|
|
|
getDetail({id:item.id}).then(res=>{ |
|
|
|
console.log('res==测量记录详情=', res) |
|
|
|
if(res){ |
|
|
|
|
|
|
|
// navigate(`/measure/detail/${item.id}`)
|
|
|
|
//@ts-ignore
|
|
|
|
getRecordByUuid(res.data.uuid) |
|
|
|
//@ts-ignore
|
|
|
|
onDetaiResult(res.data.uuid) |
|
|
|
} |
|
|
|
}) |
|
|
|
setIsModalOpen(true) |
|
|
|
let res = await getBaseRecordPointSetByCode("6001") |
|
|
|
if (res.success) { |
|
|
|
const benchmarkShapes = JSON.parse(res.data.points) as BenchmarkShape[]; |
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
|
console.log('canvasRef.current---', canvasRef.current) |
|
|
|
if (canvasRef.current) { |
|
|
|
console.log("解析后的基础图形数据:", benchmarkShapes); |
|
|
|
canvasRef.current.setBenchmarkData(benchmarkShapes); |
|
|
|
} |
|
|
|
},100) |
|
|
|
} |
|
|
|
|
|
|
|
let resData = await getDetail({id:item.id}) |
|
|
|
console.log('res==测量记录详情=', resData) |
|
|
|
if(resData){ |
|
|
|
// navigate(`/measure/detail/${item.id}`)
|
|
|
|
//@ts-ignore
|
|
|
|
getRecordByUuid(resData.data.uuid) |
|
|
|
//@ts-ignore
|
|
|
|
onDetaiResult(resData.data.uuid) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//法线
|
|
|
|
const [analysisReport, setAnalysisReport] = useState<AnalysisReport>(); |
|
|
|
const onDetaiResult = (uuid:string) => { |
|
|
|
|
|
|
|
getReport(uuid,'6001').then(res=> { |
|
|
|
if (res.success) { |
|
|
|
const report: AnalysisReport = res.data; |
|
|
|
console.log(report); |
|
|
|
// 更新 canvas 的分析数据
|
|
|
|
if (report && report.angleAnalysisList) { |
|
|
|
// 先过滤掉 distance 为 null 的数据
|
|
|
|
const validItems = report.angleAnalysisList.filter(item => item.distance !== null); |
|
|
|
const analysisData: AnalysisData[] = validItems.map(item => ({ |
|
|
|
pointA: { x: parseFloat(item.pointA.x), y: parseFloat(item.pointA.y) }, |
|
|
|
pointB: { x: parseFloat(item.pointB.x), y: parseFloat(item.pointB.y) }, |
|
|
|
base: { x: parseFloat(item.pointA.x), y: parseFloat(item.pointA.y) }, |
|
|
|
measure: { x: parseFloat(item.pointB.x), y: parseFloat(item.pointB.y) }, |
|
|
|
distance: parseFloat(item.distance), |
|
|
|
describe: item.describe, |
|
|
|
})); |
|
|
|
|
|
|
|
canvasRef.current?.setAnalysisData(analysisData); |
|
|
|
} |
|
|
|
console.log('report---', report) |
|
|
|
setAnalysisReport(report); |
|
|
|
} else { |
|
|
|
message.error("分析报告请求失败: " + res.data.info); |
|
|
|
} |
|
|
|
const report: AnalysisReport = res.data; |
|
|
|
console.log(report); |
|
|
|
// 更新 canvas 的分析数据
|
|
|
|
if (report && report.angleAnalysisList) { |
|
|
|
// 先过滤掉 distance 为 null 的数据
|
|
|
|
const validItems = report.angleAnalysisList.filter(item => item.distance !== null); |
|
|
|
const analysisData: AnalysisData[] = validItems.map(item => ({ |
|
|
|
pointA: { x: parseFloat(item.pointA ? item.pointA.x : '0'), y: parseFloat(item.pointA ? item.pointA.y : '0') }, |
|
|
|
pointB: { x: parseFloat(item.pointB ? item.pointB.x : '0'), y: parseFloat(item.pointB ? item.pointB.y : '0') }, |
|
|
|
base: { x: parseFloat(item.pointA ? item.pointA.x : '0'), y: parseFloat(item.pointA ? item.pointA.y : '0') }, |
|
|
|
measure: { x: parseFloat(item.pointB ? item.pointB.x : '0'), y: parseFloat(item.pointB ? item.pointB.y : '0') }, |
|
|
|
distance: parseFloat(item.distance), |
|
|
|
describe: item.describe, |
|
|
|
})); |
|
|
|
|
|
|
|
canvasRef.current?.setAnalysisData(analysisData); |
|
|
|
} |
|
|
|
setAnalysisReport(report); |
|
|
|
|
|
|
|
} else { |
|
|
|
message.error("分析报告请求失败: " + res.data.info); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
@ -295,6 +296,11 @@ export default function MeasureDetail() { |
|
|
|
|
|
|
|
} |
|
|
|
const handleCancel = () => { |
|
|
|
canvasRef.current?.setAnalysisData([]); |
|
|
|
canvasRef.current?.setMeasurementData([]); |
|
|
|
canvasRef.current?.setBenchmarkData([]) |
|
|
|
//@ts-ignore
|
|
|
|
setAnalysisReport({}) |
|
|
|
setIsModalOpen(false) |
|
|
|
} |
|
|
|
|
|
|
@ -329,7 +335,7 @@ export default function MeasureDetail() { |
|
|
|
<Pagination onChange={onPageChange} current={pageNum} pageSizeOptions={[5,10,20,30]} defaultCurrent={pageNum} defaultPageSize={pageSize} total={total}/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
{isModalOpen && |
|
|
|
<Modal |
|
|
|
title="测量记录详情" |
|
|
|
open={isModalOpen} |
|
|
@ -337,6 +343,7 @@ export default function MeasureDetail() { |
|
|
|
style={{ top: 20 }} |
|
|
|
closable={true} |
|
|
|
onCancel={handleCancel} |
|
|
|
key={String(isModalOpen)} |
|
|
|
footer={[ |
|
|
|
<Button key="cancel" onClick={handleCancel}> |
|
|
|
取消 |
|
|
@ -418,7 +425,7 @@ export default function MeasureDetail() { |
|
|
|
{analysisReport.railHeadWidth} |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
{analysisReport.angleAnalysisList.map((item, index) => ( |
|
|
|
{analysisReport.angleAnalysisList && analysisReport.angleAnalysisList.map((item, index) => ( |
|
|
|
<tr key={index} style={{ height: "40px", fontSize: "18px", color: "#9E9E9E" }}> |
|
|
|
<td style={{ padding: "8px", border: "1px solid #ccc" }}>{item.describe}</td> |
|
|
|
<td style={{ padding: "8px", border: "1px solid #ccc" }}>{item.distance}</td> |
|
|
@ -432,6 +439,7 @@ export default function MeasureDetail() { |
|
|
|
</div> |
|
|
|
|
|
|
|
</Modal> |
|
|
|
} |
|
|
|
</div> |
|
|
|
); |
|
|
|
} |