Browse Source

优化home页面代码

master
LiLongLong 5 months ago
parent
commit
9e8c27053d
  1. 62
      src/views/graphite/index.vue

62
src/views/graphite/index.vue

@ -119,22 +119,22 @@ const liquidArea = ref()
watch(
() => craftStore.craftInfo,
(newVal) => {
if(newVal){
heatList.value.forEach((item:any) => {
if(item.id == newVal?.heatId && item.craftInfo){
item.craftInfo.status = newVal?.status
if(newVal?.status == 3){//
if(newVal){
for(const item of heatList.value){
if(item.id == newVal?.heatId && item.craftInfo){
item.craftInfo.status = newVal?.status
if(newVal?.status == 3){//
item.executing_craft = false;
craftName.value = "选择工艺";
exeCraftName.value = "执行工艺";
}else if(item.executing_craft){//
}else if(item.executing_craft){//
if (newVal?.status == 1 && item.isSelect) {
craftName.value = "暂停工艺";
exeCraftName.value = "停止工艺";
}
}
}
});
}
}
}
);
@ -145,12 +145,9 @@ watch(()=>settingStore.heatAreaConfig,(newVal, oldValue)=>{
}
})
const heatAearStatusList = ref(statusStore.status?.heatArea || []);
const heatList = shallowRef<any>([]);
const craftVisible = ref(false);
let tubeList:any = [];
const selectedColor = "#4F85FB";
const emptyColor = "#FFFFFF";
const taskName = ref("");
let deviceData = <any>{}
onMounted(() => {
@ -160,7 +157,7 @@ onMounted(() => {
tubeBaseConfig();
//socket
const wsClient = createWebSocket(sharedWsUrl);
const subscription = wsClient.dataOb.subscribe((data) => {
const subscription = wsClient.dataOb.subscribe((data) => {
if (data.type === "cmd") {
const cmdInfo = getTxnRecord(data.data.commandId, "task");
if (cmdInfo) {
@ -227,13 +224,11 @@ const onSelectedTray = (heatAreaItem: any, type: string) => {
} else {//
heatAreaItem.isSelect = true;
}
console.log('selectedTrayList.value---', selectedTrayList.value)
tubeList = heatAreaItem.tubeList;
};
const initHeatList = () => {
let heatAearStatusList = statusStore.status.heatArea
console.log('settingStore.heatAreaConfig---', settingStore.heatAreaConfig)
heatList.value = settingStore.heatAreaConfig.map((item:any) => {
heatAearStatusList.forEach((areaItem:any) => {
if(areaItem.hardwareId == item.hardwareId){
@ -253,14 +248,15 @@ const updateHeatList = (command:any) => {
let heatAearStatusList = statusStore.status.heatArea
const selectedIds = selectedTrayList.value.map((item: any) => item.id);
heatList.value = list.map((item:any) => {
heatAearStatusList.forEach((areaItem:any) => {
if(areaItem.hardwareId == item.hardwareId){
item = {
...item,
heatAearStatus:areaItem,
}
for(const areaItem of heatAearStatusList){
if(areaItem.hardwareId == item.hardwareId){
item = {
...item,
heatAearStatus:areaItem,
}
})
}
}
if(selectedIds.includes(item.id)){
item.isSelect = true;
if(command == 'moveToHeatArea'){
@ -687,31 +683,23 @@ const onStartHeat = () => {
ElMessage.error("请选择目标加热区");
return;
}
const selectedIds = selectedTrayList.value.map((item: any) => item.id);
//
let existTubeRack = true;
let existTubeRack = heatList.value.some((item:any)=>selectedIds.includes(item.id) && item.heatAearStatus.trayStatus == 0)
//
let hasSetTemp = true;
const selectedIds = selectedTrayList.value.map((item: any) => item.id);
heatList.value.forEach((item: any) => {
if (selectedIds.includes(item.id) && item.heatAearStatus.trayStatus == 0) {
existTubeRack = true;
}
if (!item.temperature) {
hasSetTemp = false;
}
});
let hasSetTemp = heatList.value.some((item:any)=>!item.temperature)
if (!existTubeRack) {
if (existTubeRack) {
ElMessage.error("选择的加热区未放置试管架,请重新选择");
return;
}
if (!hasSetTemp) {
if (hasSetTemp) {
ElMessage.error("选择的加热区未设置温度,请设置温度");
return;
}
//
const cmdList: any = [];
selectedTrayList.value.forEach((heatArea: any) => {
const params = {
heatId: heatArea.id,
@ -719,14 +707,12 @@ const onStartHeat = () => {
};
taskCmd({ command: "startHeat", params }).then(res => {
if (res.success) {
// ElMessage.success("");
isHeating.value = true;
} else {
ElMessage.error(res.msg);
}
});
});
// onSendCmd("startHeat", cmdList)
};
//
@ -742,7 +728,6 @@ const onStopHeat = () => {
};
taskCmd({ command: "stopHeat", params }).then(res => {
if (res.success) {
// ElMessage.success("");
isHeating.value = false;
} else {
ElMessage.error(res.msg);
@ -757,7 +742,6 @@ const onStartShakingTube = () => {
const params = {};
taskCmd({ command: "startShakeUp", params }).then(res => {
if (res.success) {
// ElMessage.success("");
isSharking.value = true;
setOnGoingStatus("shaking");
} else {
@ -771,7 +755,6 @@ const onStopShakingTube = () => {
const params = {};
taskCmd({ command: "stopShakeUp", params }).then(res => {
if (res.success) {
// ElMessage.success("");
isSharking.value = false;
} else {
ElMessage.error(res.msg);
@ -805,7 +788,6 @@ const onSendCmd = (command: OperationCmd, params: any) => {
//
taskCmd({ command, params }).then(res => {
if (res.success) {
// ElMessage.success("");
setOnGoingStatus("movingToAct");
} else {
ElMessage.error(res.msg);

Loading…
Cancel
Save