|
@ -2,11 +2,42 @@ |
|
|
<div class="px-6 pt-4 pb-3 flex justify-between"> |
|
|
<div class="px-6 pt-4 pb-3 flex justify-between"> |
|
|
<div class="w-full"> |
|
|
<div class="w-full"> |
|
|
<div class="flex items-center mb-3 gap-5"> |
|
|
<div class="flex items-center mb-3 gap-5"> |
|
|
<p class="font-medium text-primary">喷涂路线</p> |
|
|
|
|
|
<img :src="selectCraft.routeType === 1 ? route_v : route_v2" alt="icon" @click="sprayDirection('v')" /> |
|
|
|
|
|
<img :src="selectCraft.routeType === 1 ? route_h2 : route_h" alt="icon" @click="sprayDirection('h')" /> |
|
|
|
|
|
<button class="btn-dark px-8 py-2 text-lg" @click="onStartSpray">开始喷涂</button> |
|
|
<button class="btn-dark px-8 py-2 text-lg" @click="onStartSpray">开始喷涂</button> |
|
|
<button class="btn-light px-8 py-2 text-lg" @click="onStopSpray">停止喷涂</button> |
|
|
<button class="btn-light px-8 py-2 text-lg" @click="onStopSpray">停止喷涂</button> |
|
|
|
|
|
<section class="flex items-center gap-3 px-4 text-base ml-auto"> |
|
|
|
|
|
<div class="flex items-center"> |
|
|
|
|
|
<span class="self-center text-right text-primary font-medium mr-3">选择基质</span> |
|
|
|
|
|
<el-select v-model="selectMatrix" placeholder="Select" style="width: 120px" @change="onMatrixChange"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in settingStore.matrixList" |
|
|
|
|
|
:key="item.id" |
|
|
|
|
|
:label="item.name" |
|
|
|
|
|
:value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="flex items-center"> |
|
|
|
|
|
<span class="self-center text-right text-primary font-medium mr-3">工艺</span> |
|
|
|
|
|
<el-select |
|
|
|
|
|
:disabled="craftList.length === 0" |
|
|
|
|
|
v-model="selectCraft" |
|
|
|
|
|
placeholder="Select" |
|
|
|
|
|
style="width: 120px" |
|
|
|
|
|
@change="onCraftChange"> |
|
|
|
|
|
<el-option v-for="item in craftList" :key="item.id" :label="item.name" :value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<el-popover placement="bottom" :width="380" trigger="click"> |
|
|
|
|
|
<template #reference> |
|
|
|
|
|
<div class="text-primary underline flex items-center gap-1"> |
|
|
|
|
|
<span>详细参数</span> |
|
|
|
|
|
<img src="@/assets/icon_info.svg" alt="info" /> |
|
|
|
|
|
</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
<template #default> |
|
|
|
|
|
<SprayParam :sprayParam="selectCraft" @save="updateSprayParam" /> |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-popover> |
|
|
|
|
|
</section> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<section class="flex flex-col items-start"> |
|
|
<section class="flex flex-col items-start"> |
|
@ -71,60 +102,13 @@ |
|
|
</van-checkbox-group> |
|
|
</van-checkbox-group> |
|
|
</section> |
|
|
</section> |
|
|
</div> |
|
|
</div> |
|
|
<div class="shadow-card absolute top-[calc(var(--headerHeight)+16px)] right-[calc(var(--borderWidth)+20px)] w-[400px]"> |
|
|
|
|
|
<el-collapse accordion> |
|
|
|
|
|
<el-collapse-item name="1"> |
|
|
|
|
|
<template #title> |
|
|
|
|
|
<section class="flex items-center gap-3 px-4 text-base"> |
|
|
|
|
|
<div> |
|
|
|
|
|
<span class="self-center text-right text-primary font-medium mr-3">选择基质</span> |
|
|
|
|
|
<!-- <input |
|
|
|
|
|
type="text" |
|
|
|
|
|
class="border-none outline-none h-[28px] w-[80px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center" /> --> |
|
|
|
|
|
|
|
|
|
|
|
<el-select |
|
|
|
|
|
v-model="selectMatrix" |
|
|
|
|
|
placeholder="Select" |
|
|
|
|
|
style="width: 120px" |
|
|
|
|
|
@change="onMatrixChange"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="item in settingStore.matrixList" |
|
|
|
|
|
:key="item.id" |
|
|
|
|
|
:label="item.name" |
|
|
|
|
|
:value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div> |
|
|
|
|
|
<span class="self-center text-right text-primary font-medium mr-3">工艺</span> |
|
|
|
|
|
<!-- <input |
|
|
|
|
|
type="text" |
|
|
|
|
|
class="border-none outline-none h-[28px] w-[80px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center" /> --> |
|
|
|
|
|
|
|
|
|
|
|
<el-select |
|
|
|
|
|
:disabled="craftList.length === 0" |
|
|
|
|
|
v-model="selectCraft" |
|
|
|
|
|
placeholder="Select" |
|
|
|
|
|
style="width: 120px" |
|
|
|
|
|
@change="onCraftChange"> |
|
|
|
|
|
<el-option v-for="item in craftList" :key="item.id" :label="item.name" :value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</div> |
|
|
|
|
|
</section> |
|
|
|
|
|
</template> |
|
|
|
|
|
<SprayParam :sprayParam="selectCraft" @save="updateSprayParam" /> |
|
|
|
|
|
</el-collapse-item> |
|
|
|
|
|
</el-collapse> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- <SprayParam :sprayParam="selectCraft" @save="updateSprayParam" /> --> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import route_v from "@/assets/route_vertical.png"; |
|
|
|
|
|
import route_v2 from "@/assets/route_vertical2.png"; |
|
|
|
|
|
import route_h from "@/assets/route_horizontal.png"; |
|
|
|
|
|
import route_h2 from "@/assets/route_horizontal2.png"; |
|
|
|
|
|
import Spray, { type GridArea } from "@/components/Spray.vue"; |
|
|
import Spray, { type GridArea } from "@/components/Spray.vue"; |
|
|
import { ref } from "vue"; |
|
|
|
|
|
|
|
|
import { onMounted, ref } from "vue"; |
|
|
import { startSpray, stopWork } from "@/services/globalCmd/globalCmd"; |
|
|
import { startSpray, stopWork } from "@/services/globalCmd/globalCmd"; |
|
|
import type { WorkType } from "@/services/globalCmd/cmdTypes"; |
|
|
import type { WorkType } from "@/services/globalCmd/cmdTypes"; |
|
|
import { ElMessage } from "element-plus"; |
|
|
import { ElMessage } from "element-plus"; |
|
@ -134,20 +118,20 @@ import type { CraftItem } from "@/services/matrix/type"; |
|
|
import { getListByMatrixId } from "@/services/matrix/craft"; |
|
|
import { getListByMatrixId } from "@/services/matrix/craft"; |
|
|
import SprayParam from "@/components/SprayParam.vue"; |
|
|
import SprayParam from "@/components/SprayParam.vue"; |
|
|
|
|
|
|
|
|
const defaultCraft: CraftItem = { |
|
|
|
|
|
|
|
|
const defaultCraft: Partial<CraftItem> = { |
|
|
id: 0, |
|
|
id: 0, |
|
|
name: "default", |
|
|
name: "default", |
|
|
matrixId: 0, |
|
|
matrixId: 0, |
|
|
routeType: 1, |
|
|
routeType: 1, |
|
|
space: 20, |
|
|
|
|
|
nitrogenFlowVelocity: 20, |
|
|
|
|
|
nitrogenAirPressure: 20, |
|
|
|
|
|
matrixFlowVelocity: 220, |
|
|
|
|
|
voltage: 220, |
|
|
|
|
|
|
|
|
space: undefined, |
|
|
|
|
|
nitrogenFlowVelocity: undefined, |
|
|
|
|
|
nitrogenAirPressure: undefined, |
|
|
|
|
|
matrixFlowVelocity: undefined, |
|
|
|
|
|
voltage: undefined, |
|
|
needPower: false, |
|
|
needPower: false, |
|
|
height: 10, |
|
|
|
|
|
movementSpeed: 20, |
|
|
|
|
|
position: [{ x1: 10, y1: 10, x2: 20, y2: 20 }], |
|
|
|
|
|
|
|
|
height: undefined, |
|
|
|
|
|
movementSpeed: undefined, |
|
|
|
|
|
position: [], |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const settingStore = useSettingStore(); |
|
|
const settingStore = useSettingStore(); |
|
@ -157,27 +141,27 @@ const selectMatrix = ref<MatrixItem>( |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const craftList = ref<CraftItem[]>([]); |
|
|
const craftList = ref<CraftItem[]>([]); |
|
|
const selectCraft = ref<CraftItem>(defaultCraft); |
|
|
|
|
|
|
|
|
const selectCraft = ref<Partial<CraftItem>>(defaultCraft); |
|
|
|
|
|
|
|
|
const selectedArea = ref<GridArea>(); |
|
|
const selectedArea = ref<GridArea>(); |
|
|
const checked = ref(["a", "b"]); |
|
|
const checked = ref(["a", "b"]); |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
|
if (settingStore.matrixList.length > 0) { |
|
|
|
|
|
onMatrixChange(settingStore.matrixList[0].id); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
function onSelectArea(area: GridArea) { |
|
|
function onSelectArea(area: GridArea) { |
|
|
selectedArea.value = area; |
|
|
selectedArea.value = area; |
|
|
} |
|
|
} |
|
|
function needPower(need: boolean) { |
|
|
|
|
|
selectCraft.value.needPower = need; |
|
|
|
|
|
} |
|
|
|
|
|
function sprayDirection(direction: "h" | "v") { |
|
|
|
|
|
selectCraft.value.routeType = direction === "h" ? 1 : 2; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onMatrixChange(val: number) { |
|
|
function onMatrixChange(val: number) { |
|
|
getListByMatrixId({ matrixId: val }).then(res => { |
|
|
getListByMatrixId({ matrixId: val }).then(res => { |
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
craftList.value = res.data || []; |
|
|
craftList.value = res.data || []; |
|
|
if (res.data.length > 0) { |
|
|
if (res.data.length > 0) { |
|
|
selectCraft.value = res.data[0]; |
|
|
|
|
|
|
|
|
selectCraft.value = { ...res.data[0], needPower: res.data[0].voltage > 0 }; |
|
|
} else { |
|
|
} else { |
|
|
selectCraft.value = defaultCraft; |
|
|
selectCraft.value = defaultCraft; |
|
|
} |
|
|
} |
|
@ -199,12 +183,17 @@ function onStartSpray() { |
|
|
y1: selectedArea.value?.yStart || 10, |
|
|
y1: selectedArea.value?.yStart || 10, |
|
|
x2: selectedArea.value?.xEnd || 20, |
|
|
x2: selectedArea.value?.xEnd || 20, |
|
|
y2: selectedArea.value?.yEnd || 20, |
|
|
y2: selectedArea.value?.yEnd || 20, |
|
|
|
|
|
index: 0, |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
const params = selectCraft.value.needPower ? selectCraft : { ...selectCraft, voltage: 0 }; |
|
|
const params = selectCraft.value.needPower ? selectCraft : { ...selectCraft, voltage: 0 }; |
|
|
console.log(params); |
|
|
console.log(params); |
|
|
|
|
|
|
|
|
startSpray({ ...selectCraft.value, matrixCraftId: selectCraft.value.id }).then(res => { |
|
|
|
|
|
|
|
|
//TODO 检查参数合法性 |
|
|
|
|
|
startSpray({ |
|
|
|
|
|
...(selectCraft.value as CraftItem), |
|
|
|
|
|
matrixId: selectMatrix.value.id, |
|
|
|
|
|
matrixCraftId: selectCraft.value.id || 0, |
|
|
|
|
|
}).then(res => { |
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
} else { |
|
|
} else { |
|
|
ElMessage.error(res.msg); |
|
|
ElMessage.error(res.msg); |
|
@ -222,7 +211,7 @@ function onStopSpray() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function updateSprayParam(p: WorkType) { |
|
|
function updateSprayParam(p: WorkType) { |
|
|
console.log(p) |
|
|
|
|
|
|
|
|
console.log(p); |
|
|
selectCraft.value = p as CraftItem; |
|
|
selectCraft.value = p as CraftItem; |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|