|
|
@ -338,6 +338,7 @@ import type { |
|
|
|
SyringeParams, |
|
|
|
VoltageType, |
|
|
|
ControlValueType, |
|
|
|
Axis, |
|
|
|
} from "@/services/globalCmd/cmdTypes"; |
|
|
|
import { |
|
|
|
moveMotorToPosition, |
|
|
@ -349,7 +350,6 @@ import { |
|
|
|
turnOffSyringePump, |
|
|
|
startWork, |
|
|
|
stopWork, |
|
|
|
rotate, |
|
|
|
stopMotor, |
|
|
|
turnOffLightPanel, |
|
|
|
turnOnLightPanel, |
|
|
@ -359,6 +359,8 @@ import { |
|
|
|
type WashType, |
|
|
|
startWash |
|
|
|
} from "@/services/globalCmd/globalCmd"; |
|
|
|
import type { BaseResponse } from "@/services/httpRequest"; |
|
|
|
import type { WorkType } from '../../services/globalCmd/cmdTypes'; |
|
|
|
const activeName = ref("debug"); |
|
|
|
const voltageValue = ref(); |
|
|
|
const syringeForm = ref<SyringeParams>({ |
|
|
@ -366,15 +368,27 @@ const syringeForm = ref<SyringeParams>({ |
|
|
|
time: 0, |
|
|
|
direction: "1", |
|
|
|
}); |
|
|
|
const workForm = ref<Record<string, any>>({ |
|
|
|
const workForm = ref<WorkType>({ |
|
|
|
routeType: 1, |
|
|
|
space: 2, |
|
|
|
nitrogenFlowVelocity: 1, |
|
|
|
nitrogenAirPressure: 1, |
|
|
|
matrixFlowVelocity: 1, |
|
|
|
voltage: 1, |
|
|
|
needPower: false, |
|
|
|
height: 6, |
|
|
|
movementSpeed: 10, |
|
|
|
position: [], |
|
|
|
}); |
|
|
|
const axis = ref<any>({ |
|
|
|
const axis = ref<Axis>({ |
|
|
|
index: 0, |
|
|
|
x1: 10, |
|
|
|
y1: 10, |
|
|
|
x2: 20, |
|
|
|
y2: 20, |
|
|
|
}); |
|
|
|
|
|
|
|
const rotateForm = ref<{ axis: "X" | "Y" | "Z"; speed: number }>({ axis: "X", speed: 20 }); |
|
|
|
let subscription: any; |
|
|
|
|
|
|
|
watch(voltageValue,(newVal)=>{ |
|
|
|
if(newVal > 5000){ |
|
|
@ -389,41 +403,35 @@ watch(voltageValue,(newVal)=>{ |
|
|
|
onMounted(() => { |
|
|
|
//连接websocket |
|
|
|
const wsClient = createWebSocket(sharedWsUrl); |
|
|
|
subscription = wsClient.dataOb.subscribe(data => { |
|
|
|
//@ts-ignore |
|
|
|
if (data.type == "moveMotorToPosition") { |
|
|
|
//@ts-ignore |
|
|
|
ElMessage.success(data.data.text); |
|
|
|
} |
|
|
|
const subscription = wsClient.dataOb.subscribe(data => { |
|
|
|
}); |
|
|
|
wsClient.connect(); |
|
|
|
}); |
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
subscription && subscription.unsubscribe(); |
|
|
|
onUnmounted(() => { |
|
|
|
subscription && subscription.unsubscribe(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const machineryForm = ref<Record<string, string>>({}); |
|
|
|
const onMoveMachinery = (axis: string) => { |
|
|
|
if (!axis) return; |
|
|
|
const params = { |
|
|
|
commandName: "moveMotorToPosition", |
|
|
|
params: <MachineryType>{ |
|
|
|
const params = <MachineryType>{ |
|
|
|
axis, |
|
|
|
position: parseFloat(machineryForm.value[axis]), |
|
|
|
}, |
|
|
|
}; |
|
|
|
moveMotorToPosition(params).then((res: any) => { |
|
|
|
moveMotorToPosition(params).then((res) => { |
|
|
|
console.log("-----moveMotorToPosition----res---", res); |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const onSwitchThreeWayValve = (type: string) => { |
|
|
|
const params = <any>{ |
|
|
|
params: { type }, |
|
|
|
const params = { |
|
|
|
type, |
|
|
|
}; |
|
|
|
switchThreeWayValve(params).then((res: any) => { |
|
|
|
switchThreeWayValve(params).then((res) => { |
|
|
|
console.log("---onSwitchThreeWayValve---res---", res); |
|
|
|
success(res); |
|
|
|
}); |
|
|
@ -436,14 +444,14 @@ const onControlValve = (type: ControlNitrogen, open: boolean) => { |
|
|
|
isOpen: open, |
|
|
|
}, |
|
|
|
}; |
|
|
|
controlValve(params).then((res: any) => { |
|
|
|
controlValve(params).then((res) => { |
|
|
|
console.log("---onControlValve---res---", res); |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const onStopDehumidify = () => { |
|
|
|
stopDehumidify().then((res: any) => { |
|
|
|
stopDehumidify().then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
@ -459,7 +467,7 @@ function onStartWash(type: WashType) { |
|
|
|
} |
|
|
|
|
|
|
|
const onStopWash = () => { |
|
|
|
stopWash({}).then((res: any) => { |
|
|
|
stopWash({}).then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
@ -469,7 +477,7 @@ const onTurnOnHighVoltage = () => { |
|
|
|
const params = <VoltageType>{ |
|
|
|
params: { voltage: +voltageValue.value }, |
|
|
|
}; |
|
|
|
turnOnHighVoltage(params).then((res: any) => { |
|
|
|
turnOnHighVoltage(params).then((res) => { |
|
|
|
console.log("---onTurnOnHighVoltage- 电压控制 on --res---", res); |
|
|
|
success(res); |
|
|
|
}); |
|
|
@ -477,7 +485,7 @@ const onTurnOnHighVoltage = () => { |
|
|
|
|
|
|
|
//电压控制 关闭 |
|
|
|
const onTurnOffHighVoltage = () => { |
|
|
|
turnOffHighVoltage().then((res: any) => { |
|
|
|
turnOffHighVoltage().then((res) => { |
|
|
|
console.log("---onTurnOffHighVoltage- 电压控制 off--res---", res); |
|
|
|
success(res); |
|
|
|
}); |
|
|
@ -493,35 +501,31 @@ const onTurnOnSyringePump = () => { |
|
|
|
// time: syringeForm.value.time, |
|
|
|
}, |
|
|
|
}; |
|
|
|
turnOnSyringePump(params).then((res: any) => { |
|
|
|
turnOnSyringePump(params).then((res) => { |
|
|
|
console.log("---onTurnOffHighVoltage- 电泵开启--res---", res); |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const onTurnOffSyringePump = () => { |
|
|
|
turnOffSyringePump().then((res: any) => { |
|
|
|
turnOffSyringePump().then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const onStartWork = () => { |
|
|
|
const params = <any>{ |
|
|
|
params: { |
|
|
|
const params = <WorkType>{ |
|
|
|
...workForm.value, |
|
|
|
position: <any>[axis.value], |
|
|
|
}, |
|
|
|
position: [axis.value], |
|
|
|
}; |
|
|
|
|
|
|
|
startWork(params).then((res: any) => { |
|
|
|
console.log("startWork-----", startWork); |
|
|
|
startWork(params).then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function onStopWork() { |
|
|
|
stopWork().then((res: any) => { |
|
|
|
console.log("startWork-----", startWork); |
|
|
|
stopWork().then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
} |
|
|
@ -531,51 +535,35 @@ const onRotate = () => { |
|
|
|
...rotateForm.value, |
|
|
|
}; |
|
|
|
|
|
|
|
setMotorSpeed(params).then((res: any) => { |
|
|
|
setMotorSpeed(params).then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const onStopRotate = (axis: string) => { |
|
|
|
const params = { |
|
|
|
params: { |
|
|
|
axis, |
|
|
|
}, |
|
|
|
}; |
|
|
|
stopMotor(params).then((res: any) => { |
|
|
|
console.log("res--停止电机-"); |
|
|
|
stopMotor({axis}).then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
type resData = { |
|
|
|
code: number; |
|
|
|
msg: string; |
|
|
|
}; |
|
|
|
|
|
|
|
let brightness = ref() |
|
|
|
const onTurnOnLightPanel = () => { |
|
|
|
const params = { |
|
|
|
params: { |
|
|
|
brightness: brightness.value |
|
|
|
}, |
|
|
|
}; |
|
|
|
turnOnLightPanel(params).then((res: any) => { |
|
|
|
turnOnLightPanel({brightness: brightness.value}).then(res => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function onTurnOffLightPanel() { |
|
|
|
const params = { |
|
|
|
params: { |
|
|
|
brightness: 40, |
|
|
|
}, |
|
|
|
brightness: 40, |
|
|
|
}; |
|
|
|
turnOffLightPanel(params).then((res: any) => { |
|
|
|
turnOffLightPanel(params).then((res) => { |
|
|
|
success(res); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function success(data: resData) { |
|
|
|
|
|
|
|
function success(data:BaseResponse) { |
|
|
|
if (data && data.msg == "ok") { |
|
|
|
ElMessage.success("发送成功"); |
|
|
|
} else { |
|
|
|