diff --git a/src/components/draw-app/properties/CiCjConfig.vue b/src/components/draw-app/properties/CiCjConfig.vue index 8386d35..5652b8d 100644 --- a/src/components/draw-app/properties/CiCjConfig.vue +++ b/src/components/draw-app/properties/CiCjConfig.vue @@ -137,20 +137,7 @@ watch( relayCabinetStore.currentPressKey == PressKeyForCiCjQd.alt ) { onSubmit(); - let nestPos = { - row: click.row + 1, - col: click.col, - }; - if (click.row + 1 <= CiCjListRows) { - relayCabinetStore.editCiCjConfigIndex = nestPos; - } - if (click.row + 1 > CiCjListRows && click.col < CiCjListCols) { - nestPos = { - row: 1, - col: click.col + 1, - }; - relayCabinetStore.editCiCjConfigIndex = nestPos; - } + handleNextPosition(); } } } @@ -167,6 +154,16 @@ watch( } ); +//监听空格 +watch( + () => relayCabinetStore.currentPressKey, + (val) => { + if (val == PressKeyForCiCjQd.space1 || val == PressKeyForCiCjQd.space2) { + handleNextPosition(); + } + } +); + let CiCjListRows = 0; let CiCjListCols = 0; onMounted(() => { @@ -286,6 +283,24 @@ function deletePosition() { relayCabinetStore.updateCiCjList = true; } +function handleNextPosition() { + const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil; + let nestPos = { + row: click.row + 1, + col: click.col, + }; + if (click.row + 1 <= CiCjListRows) { + relayCabinetStore.editCiCjConfigIndex = nestPos; + } + if (click.row + 1 > CiCjListRows && click.col < CiCjListCols) { + nestPos = { + row: 1, + col: click.col + 1, + }; + relayCabinetStore.editCiCjConfigIndex = nestPos; + } +} + onUnmounted(() => { relayCabinetStore.showCiCjConfig = false; }); diff --git a/src/components/draw-app/properties/CiQdConfig.vue b/src/components/draw-app/properties/CiQdConfig.vue index 58548bc..ba269a5 100644 --- a/src/components/draw-app/properties/CiQdConfig.vue +++ b/src/components/draw-app/properties/CiQdConfig.vue @@ -114,21 +114,7 @@ watch( relayCabinetStore.currentPressKey == PressKeyForCiCjQd.alt ) { onSubmit(); - const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil; - let nestPos = { - row: click.row + 1, - col: click.col, - }; - if (click.row + 1 <= CiQdListRows) { - relayCabinetStore.editCiCjConfigIndex = nestPos; - } - if (click.row + 1 > CiQdListRows && click.col < CiQdListCols) { - nestPos = { - row: 1, - col: click.col + 1, - }; - relayCabinetStore.editCiCjConfigIndex = nestPos; - } + handleNextPosition(); } } } @@ -144,6 +130,16 @@ watch( } ); +//监听空格 +watch( + () => relayCabinetStore.currentPressKey, + (val) => { + if (val == PressKeyForCiCjQd.space1 || val == PressKeyForCiCjQd.space2) { + handleNextPosition(); + } + } +); + let CiQdListRows = 0; let CiQdListCols = 0; onMounted(() => { @@ -242,6 +238,24 @@ function deletePosition() { relayCabinetStore.updateCiCjList = true; } +function handleNextPosition() { + const click = relayCabinetStore.editCiCjConfigIndex as CiCjConfigCeil; + let nestPos = { + row: click.row + 1, + col: click.col, + }; + if (click.row + 1 <= CiQdListRows) { + relayCabinetStore.editCiCjConfigIndex = nestPos; + } + if (click.row + 1 > CiQdListRows && click.col < CiQdListCols) { + nestPos = { + row: 1, + col: click.col + 1, + }; + relayCabinetStore.editCiCjConfigIndex = nestPos; + } +} + onUnmounted(() => { relayCabinetStore.showCiCjConfig = false; }); diff --git a/src/layouts/RelayCabinetLayout/RelayCabinetLayout.vue b/src/layouts/RelayCabinetLayout/RelayCabinetLayout.vue index 7cb5932..03a785e 100644 --- a/src/layouts/RelayCabinetLayout/RelayCabinetLayout.vue +++ b/src/layouts/RelayCabinetLayout/RelayCabinetLayout.vue @@ -1225,6 +1225,11 @@ function handleKeyDown(event: KeyboardEvent) { } else if (event.altKey) { relayCabinetStore.currentPressKey = PressKeyForCiCjQd.alt; event.preventDefault(); + } else if (event.code == 'Space') { + relayCabinetStore.currentPressKey = + relayCabinetStore.currentPressKey == PressKeyForCiCjQd.space1 + ? PressKeyForCiCjQd.space2 + : PressKeyForCiCjQd.space1; } } } diff --git a/src/stores/relayCabinet-store.ts b/src/stores/relayCabinet-store.ts index 8157b2a..5ff8c3e 100644 --- a/src/stores/relayCabinet-store.ts +++ b/src/stores/relayCabinet-store.ts @@ -19,6 +19,8 @@ export enum PressKeyForCiCjQd { alt, shiftCtrl, shiftAlt, + space1, + space2, } export const useRelayCabinetStore = defineStore('relayCabinet', {