|
|
@ -1,10 +1,10 @@ |
|
|
|
import React, { useState, useEffect, useRef, useCallback, useMemo } from "react"; |
|
|
|
import { Button, Checkbox, CheckboxProps, Drawer, Input, InputNumber, message, Select, Spin, Switch } from "antd"; |
|
|
|
import { DownOutlined, UpOutlined, LeftOutlined, RightOutlined, UndoOutlined, RedoOutlined } from '@ant-design/icons'; |
|
|
|
import { useNavigate } from "react-router"; |
|
|
|
import { |
|
|
|
fetchAnalysisReport, |
|
|
|
getAlignPointsByRailSize, |
|
|
|
getReport, |
|
|
|
startMeasurement, |
|
|
|
stopMeasurement, |
|
|
|
} from "../../../services/measure/analysis"; |
|
|
@ -28,7 +28,6 @@ import "./MeasureAction.scss"; |
|
|
|
import { GX_CODE } from "../../../constant"; |
|
|
|
// 创建 websocket 客户端
|
|
|
|
const wsClient = createWebSocket(sharedWsUrl); |
|
|
|
|
|
|
|
export default function MeasureAction() { |
|
|
|
const dispatch = useAppDispatch(); |
|
|
|
const navigate = useNavigate(); |
|
|
@ -90,7 +89,19 @@ export default function MeasureAction() { |
|
|
|
// setOpenDrawer(true);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
fetchAnalysisReport(railSize).then(res => { |
|
|
|
let params = { |
|
|
|
code:railSize, |
|
|
|
pointList:[] |
|
|
|
} |
|
|
|
|
|
|
|
if(showCalibration){//校准分析时,添加校准后的坐标点
|
|
|
|
params.pointList = calibrationData |
|
|
|
} |
|
|
|
|
|
|
|
// getReport(params).then(res=> {
|
|
|
|
// console.log('res---', res)
|
|
|
|
// })
|
|
|
|
getReport(params).then(res => { |
|
|
|
if (res.success) { |
|
|
|
const report: AnalysisReport = res.data; |
|
|
|
console.log(report); |
|
|
@ -177,12 +188,14 @@ export default function MeasureAction() { |
|
|
|
//校准
|
|
|
|
const [showCalibration, setshowCalibration] = useState(false) |
|
|
|
const [caloading, setCaLoading] = useState(false) |
|
|
|
const [calibrationData, setCalibrationData] = useState([]) |
|
|
|
const onCalibrationBtnClick = () => { |
|
|
|
setCaLoading(true) |
|
|
|
//获取校准数据
|
|
|
|
getAlignPointsByRailSize({railSize:railSize}).then(res => { |
|
|
|
if(res.success){ |
|
|
|
setshowCalibration(true) |
|
|
|
setCalibrationData(res.data) |
|
|
|
canvasRef.current?.setMeasurementCalibrationData(res.data) |
|
|
|
}else{ |
|
|
|
message.error('校准失败!') |
|
|
@ -467,12 +480,13 @@ export default function MeasureAction() { |
|
|
|
<section className="ml-auto flex gap-4 items-center"> |
|
|
|
{/* 参考线开关 */} |
|
|
|
<div className="flex gap-2 items-center"> |
|
|
|
<Switch defaultChecked onChange={checked => setShowGrid(checked)} /> |
|
|
|
<Switch defaultChecked size="small" onChange={checked => setShowGrid(checked)} /> |
|
|
|
<span>参考线</span> |
|
|
|
</div> |
|
|
|
{/* 标准线开关 */} |
|
|
|
<div className="flex gap-2 items-center"> |
|
|
|
<Switch |
|
|
|
size="small" |
|
|
|
checked={showStandard} |
|
|
|
onChange={checked => { |
|
|
|
setShowStandard(checked); |
|
|
@ -490,6 +504,7 @@ export default function MeasureAction() { |
|
|
|
{analysisReport && ( |
|
|
|
<div className="flex gap-2 items-center"> |
|
|
|
<Switch |
|
|
|
size="small" |
|
|
|
checked={showMark} |
|
|
|
disabled={!showStandard} |
|
|
|
onChange={checked => { |
|
|
|