Browse Source

优化

master
LiLongLong 5 months ago
parent
commit
2192774632
  1. 43
      src/views/graphite/index.vue

43
src/views/graphite/index.vue

@ -115,7 +115,8 @@ import { getTxnRecord } from "@/services/txn";
import { useSettingStore } from "@/stores/setting"; import { useSettingStore } from "@/stores/setting";
import { useCraftStore } from "@/stores/craft"; import { useCraftStore } from "@/stores/craft";
import PhotoSvg from "@/assets/photo_icon.svg"; import PhotoSvg from "@/assets/photo_icon.svg";
//
const statusStore = useStatusStore();
const craftStore = useCraftStore(); const craftStore = useCraftStore();
const craftInfo = ref(craftStore.craftInfo); const craftInfo = ref(craftStore.craftInfo);
const settingStore = useSettingStore(); const settingStore = useSettingStore();
@ -143,8 +144,14 @@ watch(
} }
} }
); );
//
const statusStore = useStatusStore();
watch(()=>statusStore.status,(newVal)=>{
console.log('newVal---', newVal)
if(newVal){
onUpateHeatAreaUI()
}
})
const heatAearStatusList = ref(statusStore.status?.heatArea || []); const heatAearStatusList = ref(statusStore.status?.heatArea || []);
const heatList: any = ref([]); const heatList: any = ref([]);
const craftVisible = ref(false); const craftVisible = ref(false);
@ -152,7 +159,6 @@ let tubeList = reactive<any>([]);
const selectedColor = "#4F85FB"; const selectedColor = "#4F85FB";
const emptyColor = "#FFFFFF"; const emptyColor = "#FFFFFF";
const taskName = ref(""); const taskName = ref("");
let globeStatus: any = 0;
onMounted(() => { onMounted(() => {
//6 //6
heatList.value = settingStore.heatAreaConfig.map((item:any) => { heatList.value = settingStore.heatAreaConfig.map((item:any) => {
@ -173,11 +179,6 @@ onMounted(() => {
//socket //socket
const wsClient = createWebSocket(sharedWsUrl); const wsClient = createWebSocket(sharedWsUrl);
const subscription = wsClient.dataOb.subscribe((data) => { const subscription = wsClient.dataOb.subscribe((data) => {
if(!globeStatus){// TODO
console.log('globeStatus====', data)
}
globeStatus = 1;
if (data.type === "cmd") { if (data.type === "cmd") {
const cmdInfo = getTxnRecord(data.data.commandId, "task"); const cmdInfo = getTxnRecord(data.data.commandId, "task");
if (cmdInfo) { if (cmdInfo) {
@ -267,7 +268,6 @@ const onCraftStart = () => {
// //
let hasCraft = true; let hasCraft = true;
let len = selectedTrayList.value.length; let len = selectedTrayList.value.length;
console.log('selectedTrayList---', selectedTrayList.value)
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
let item = selectedTrayList.value[i]; let item = selectedTrayList.value[i];
if (!item.craftInfo) { if (!item.craftInfo) {
@ -340,7 +340,6 @@ const onAddSolution = (data: any) => {
ElMessage.error(res.msg); ElMessage.error(res.msg);
} }
}); });
globeStatus = 0;
// tubeList.forEach((item: any) => { // tubeList.forEach((item: any) => {
// if (ids.includes(item.id)) { // if (ids.includes(item.id)) {
// item.default = defaultColor; // item.default = defaultColor;
@ -453,7 +452,23 @@ const onMoveToHeat = () => {
} }
}); });
//UI
};
//UI
const onUpateHeatAreaUI = () => {
//1
if (!selectedTrayList.value.length) {
ElMessage.error("请选择目标加热区");
return;
}
//2
if (selectedTrayList.value.length != 1) {
ElMessage.error("只能选择一个加热区");
return;
}
let selectedDataItem = selectedTrayList.value[0];
//UI
let list = [...heatList.value]; let list = [...heatList.value];
list.forEach((item: any) => { list.forEach((item: any) => {
if (item.id == selectedDataItem.id) { if (item.id == selectedDataItem.id) {
@ -468,7 +483,8 @@ const onMoveToHeat = () => {
item.default = ""; item.default = "";
}); });
heatList.value = [...list]; heatList.value = [...list];
};
console.log('heatList.value---', heatList.value)
}
//() //()
const currentSelectedTube = ref({}); const currentSelectedTube = ref({});
@ -500,6 +516,7 @@ const onMoveToOperationArea = () => {
heatList.value.forEach((item: any) => { heatList.value.forEach((item: any) => {
if (item.id == selectedDataItem.id) { if (item.id == selectedDataItem.id) {
tubeList = [...item.tubeList]; tubeList = [...item.tubeList];
item.isSelect = false;
} }
}); });
onSelectedTray(selectedDataItem, "isMove"); onSelectedTray(selectedDataItem, "isMove");

Loading…
Cancel
Save