Browse Source

调试页面转速换接口

master
zhangjiming 5 months ago
parent
commit
f201d4422a
  1. 5
      src/services/globalCmd/globalCmd.ts
  2. 12
      src/views/debug/index.vue

5
src/services/globalCmd/globalCmd.ts

@ -22,7 +22,6 @@ export function switchThreeWayValve(params: { type: string }) {
}); });
} }
//氮气三路 //氮气三路
export function controlValve(params: ControlValueType) { export function controlValve(params: ControlValueType) {
const commandId = addTxnRecord({ ...params, category: "debug" }); const commandId = addTxnRecord({ ...params, category: "debug" });
@ -72,6 +71,9 @@ export function pushInTray(params: Record<string, any>) {
export function rotate(params: any) { export function rotate(params: any) {
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/rotate", params, method: "POST" }); return httpRequest<BaseResponse<string>>({ url: "/api/cmd/rotate", params, method: "POST" });
} }
export function setMotorSpeed(params: { axis: "X" | "Y" | "Z"; speed: number }) {
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/setMotorSpeed", params: { params }, method: "POST" });
}
export type SprayParam = { export type SprayParam = {
matrixId: number; matrixId: number;
@ -103,7 +105,6 @@ export function stopDehumidify() {
return httpRequest<BaseResponse>({ url: "/api/cmd/stopDehumidify", method: "POST" }); return httpRequest<BaseResponse>({ url: "/api/cmd/stopDehumidify", method: "POST" });
} }
//停止电机 //停止电机
export function stopMotor(params: any) { export function stopMotor(params: any) {
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/stopMotor", params, method: "POST" }); return httpRequest<BaseResponse<string>>({ url: "/api/cmd/stopMotor", params, method: "POST" });

12
src/views/debug/index.vue

@ -102,7 +102,7 @@
<el-radio value="Z">Z</el-radio> <el-radio value="Z">Z</el-radio>
</el-radio-group> </el-radio-group>
<div> <div>
速度:<input type="number" v-model="rotateForm.rotationSpeed" placeholder='' class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫米/
速度:<input type="number" v-model="rotateForm.speed" placeholder='' class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫米/
<!-- 时间:<input type="number" v-model="rotateForm.time" placeholder='' class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫秒 --> <!-- 时间:<input type="number" v-model="rotateForm.time" placeholder='' class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫秒 -->
</div> </div>
<div class="mt-[20px]"> <div class="mt-[20px]">
@ -295,7 +295,8 @@ import {
turnOffLightPanel, turnOffLightPanel,
turnOnLightPanel, turnOnLightPanel,
stopWash, stopWash,
stopDehumidify
stopDehumidify,
setMotorSpeed
} from "@/services/globalCmd/globalCmd"; } from "@/services/globalCmd/globalCmd";
const activeName = ref('debug') const activeName = ref('debug')
const voltageValue = ref() const voltageValue = ref()
@ -311,7 +312,7 @@ import {
index: 0 index: 0
}) })
const rotateForm = ref<Record<string, string>>({})
const rotateForm = ref<{ axis: "X" | "Y" | "Z"; speed: number }>({axis:"X",speed:20})
let subscription:any let subscription:any
onMounted(()=>{ onMounted(()=>{
//websocket //websocket
@ -447,11 +448,10 @@ import {
const onRotate = () => { const onRotate = () => {
const params = { const params = {
params : {
...rotateForm.value ...rotateForm.value
} }
}
rotate(params).then((res:any) => {
setMotorSpeed(params).then((res:any) => {
success(res) success(res)
}) })
} }

Loading…
Cancel
Save