diff --git a/src/apis/log.ts b/src/apis/log.ts index 5b21943..e8f5467 100644 --- a/src/apis/log.ts +++ b/src/apis/log.ts @@ -20,3 +20,4 @@ export interface logResponse { } export const list = (params: logQuery): Promise => http.post('log/list', params) +export const del = (ids: string) => http.delete(`log/${ids}`) diff --git a/src/apis/system.ts b/src/apis/system.ts index 37aee3e..9784918 100644 --- a/src/apis/system.ts +++ b/src/apis/system.ts @@ -12,3 +12,4 @@ export const control = (params: any) => http.post('/function', params) export const debugControl = (params: any) => http.post('/function/debug', params) export const getDeviceStatus = () => http.get('/device-status/') export const getDeviceSelfTest = () => http.get('/self-test/') +export const getSprayStatus = () => http.get('/spray-task/status') diff --git a/src/components/common/FTStream/index.vue b/src/components/common/FTStream/index.vue index 90ffb9e..40ffb65 100644 --- a/src/components/common/FTStream/index.vue +++ b/src/components/common/FTStream/index.vue @@ -144,6 +144,7 @@ const handleMouseUp = () => { cursor: move; // 添加鼠标指针样式 .el-icon svg{ width: 30px; + cursor: pointer; } } .mask-body { diff --git a/src/components/spray/trayGraph/index.vue b/src/components/spray/trayGraph/index.vue index b876a26..8442dca 100644 --- a/src/components/spray/trayGraph/index.vue +++ b/src/components/spray/trayGraph/index.vue @@ -16,7 +16,7 @@ const stage = ref() const layer = ref() const rect = ref() const tr = ref() -const line = ref() +const lines = ref([]) // 修改: 将 line 改为 lines 数组 onMounted(() => { addStage() @@ -39,15 +39,15 @@ const addStage = () => { layer.value.draw() } -let newWidth = 50 -let newHeight = 75 +let newWidth = 85 +let newHeight = 200 const addSelect = () => { rect.value = new Konva.Rect({ - x: 35, - y: 75 * 2, - width: 50, - height: 75, + x: 20, + y: 100, + width: 85, + height: 200, fill: 'rgba(238,10,36, 0.2)', draggable: true, }) @@ -144,32 +144,43 @@ const formatNum = (num: number) => { return Math.round(num * 100) / 100 } -const addLine = () => { - line.value = new Konva.Line({ +const addLine = (stroke: string = 'green') => { + const newLine = new Konva.Line({ points: [], - stroke: 'green', + stroke, strokeWidth: 5, listening: false, }) - layer.value.add( - line.value, - ) + lines.value.push(newLine) // 修改: 将新线条添加到 lines 数组中 + layer.value.add(newLine) layer.value.draw() } -const updateLine = (point: { x: number, y: number }) => { - if (!line.value) { +const updateLine = (point: { x: number, y: number }, index: number) => { + if (lines.value.length === 0) { return } - line.value.points([...line.value.points(), point.x, point.y]) - line.value.getLayer()!.batchDraw() // 批量重绘提升性能 + const currentLine = lines.value[index] // 修改: 获取最后一条线条 + currentLine.points([...currentLine.points(), point.x, point.y]) + currentLine.getLayer()!.batchDraw() // 批量重绘提升性能 +} + +// 新增方法:清除所有 line +const clearLines = () => { + lines.value.forEach(line => line.destroy()) // 修改: 遍历并销毁所有线条 + lines.value = [] // 清空 lines 数组 + layer.value.draw() } // 新增方法:判断是否已添加了 line -const hasLine = computed(() => { - return line.value !== undefined && line.value !== null +const hasLines = computed(() => { + return lines.value.length > 0 // 修改: 判断 lines 数组长度 }) +const hasLine = (index: number) => { + return lines.value[index] !== undefined +} + watch( () => props.select, () => { @@ -181,7 +192,9 @@ defineExpose({ getSelection, addLine, updateLine, - hasLine, // 暴露新方法 + hasLines, // 修改: 曝露新方法 + hasLine, + clearLines, // 修改: 曝露清除所有 line 的方法 }) diff --git a/src/libs/socket.ts b/src/libs/socket.ts index b976b26..b264d13 100644 --- a/src/libs/socket.ts +++ b/src/libs/socket.ts @@ -83,7 +83,7 @@ export const socket: socket = { }) } else { - console.error('请注册当前类型的回调函数', message) + // console.error('请注册当前类型的回调函数', message) } }, diff --git a/src/libs/utils.ts b/src/libs/utils.ts index fb3b3e2..ce16a53 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -18,6 +18,7 @@ export const sendControl = async (params: any, type?: string) => { 'matrix_spray_start', 'syringe_pipeline_wash_stop', 'matrix_prefill_stop', + 'matrix_spray_change_param', ] if (systemStatus.spraying && (type === 'debug' || sprayingDisableCmd.includes(params.cmdCode))) { FtMessage.error('设备正在喷涂中, 请等待喷涂完成') @@ -120,5 +121,7 @@ export const cmdNameMap = { lighting_panel_open: '打开照明灯', lighting_panel_close: '关闭照明灯', motor_xyz_origin: '三轴回原点', + device_self_test: '设备自检', + matrix_spray_change_param: '实时调整参数', } diff --git a/src/views/clean/index.vue b/src/views/clean/index.vue index 0056de3..073e5ce 100644 --- a/src/views/clean/index.vue +++ b/src/views/clean/index.vue @@ -91,15 +91,15 @@ const syringePipelineWashStop = async () => { uL/min - + 清洗注射器管路 - - + + 清洗喷嘴管路 - - + + 结束清洗 - + @@ -114,4 +114,11 @@ const syringePipelineWashStop = async () => { margin: 30px; } } +:deep(.button-style) { + .my-button { + width: 500px; + display: flex; + justify-content: center; + } +} diff --git a/src/views/log/index.vue b/src/views/log/index.vue index 7e883d6..3b8ab01 100644 --- a/src/views/log/index.vue +++ b/src/views/log/index.vue @@ -1,17 +1,26 @@