保存ボタンクリック時にイベントを一括削除

This commit is contained in:
Mouriya
2024-05-13 00:53:24 +09:00
parent c426bbf793
commit 700fa24868
5 changed files with 558 additions and 311 deletions

View File

@@ -20,13 +20,12 @@
</div>
</q-drawer>
</div>
<q-btn flat dense round
:icon="drawerLeft?'keyboard_double_arrow_left':'keyboard_double_arrow_right'"
:style="[drawerLeft?{'left':'300px'}:{'left':'0px'}]"
@click="drawerLeft=!drawerLeft" class="expand" />
<div class="q-pa-md q-gutter-sm" :style="{minWidth: minPanelWidth}">
<div class="flowchart" v-if="store.currentFlow" :style="[drawerLeft?{paddingLeft:'300px'}:{}]">
<node-item v-if="rootNode!==undefined" :key="rootNode.id" :isSelected="rootNode === store.activeNode"
<q-btn flat dense round :icon="drawerLeft ? 'keyboard_double_arrow_left' : 'keyboard_double_arrow_right'"
:style="[drawerLeft ? { 'left': '300px' } : { 'left': '0px' }]" @click="drawerLeft = !drawerLeft"
class="expand" />
<div class="q-pa-md q-gutter-sm" :style="{ minWidth: minPanelWidth }">
<div class="flowchart" v-if="store.currentFlow" :style="[drawerLeft ? { paddingLeft: '300px' } : {}]">
<node-item v-if="rootNode !== undefined" :key="rootNode.id" :isSelected="rootNode === store.activeNode"
:actionNode="rootNode" @addNode="addNode" @nodeSelected="onNodeSelected" @nodeEdit="onNodeEdit"
@deleteNode="onDeleteNode" @deleteAllNextNodes="onDeleteAllNextNodes" @copyFlow="onCopyFlow"></node-item>
</div>
@@ -35,13 +34,13 @@
</q-layout>
<ShowDialog v-model:visible="showAddAction" name="アクション" @close="closeDg" min-width="500px" min-height="500px">
<template v-slot:toolbar>
<q-input dense debounce="200" v-model="filter" placeholder="検索" clearable>
<q-input dense debounce="200" v-model="filter" placeholder="検索" clearable>
<template v-slot:before>
<q-icon name="search" />
</template>
</q-input>
</template>
<action-select ref="appDg" name="model" :filter="filter" type="single"></action-select>
<action-select ref="appDg" name="model" :filter="filter" type="single"></action-select>
</ShowDialog>
</q-page>
@@ -77,20 +76,20 @@ const prevNodeIfo = ref({
// const refFlow = ref<ActionFlow|null>(null);
const showAddAction = ref(false);
const drawerRight = ref(false);
const filter=ref("");
const filter = ref("");
const model = ref("");
const addActionNode = (action: IActionNode) => {
// refFlow.value?.actionNodes.push(action);
store.currentFlow?.actionNodes.push(action);
}
const rootNode = computed(()=>{
const rootNode = computed(() => {
return store.currentFlow?.getRoot();
});
const minPanelWidth=computed(()=>{
const minPanelWidth = computed(() => {
const root = store.currentFlow?.getRoot();
if(store.currentFlow && root){
if (store.currentFlow && root) {
return store.currentFlow?.getColumns(root) * 300 + 'px';
}else{
} else {
return "300px";
}
});
@@ -149,7 +148,7 @@ const closeDg = (val: any) => {
*/
const onCopyFlow = () => {
if (navigator.clipboard) {
const jsonData =JSON.stringify(store.currentFlow) ;
const jsonData = JSON.stringify(store.currentFlow);
navigator.clipboard.writeText(jsonData).then(() => {
console.log('Text successfully copied to clipboard');
},
@@ -195,7 +194,22 @@ const onDeploy = async () => {
const onSaveFlow = async () => {
const targetFlow = store.selectedFlow;
const deleteFlows = () => {
$q.notify({
type: 'positive',
caption: "通知",
message: `削除 ${store.deleteFlowIds.length} イベント`
});
store.deletebackendFlow();
}
if (targetFlow === undefined) {
if (store.deleteFlowIds.length > 0) {
deleteFlows();
return;
}
$q.notify({
type: 'negative',
caption: "エラー",
@@ -204,6 +218,9 @@ const onSaveFlow = async () => {
return;
}
try {
if (store.deleteFlowIds.length > 0) {
deleteFlows();
}
saveLoading.value = true;
await store.saveFlow(targetFlow);
saveLoading.value = false;
@@ -265,7 +282,8 @@ onMounted(() => {
top: 50px;
z-index: 999;
}
.expand{
.expand {
position: fixed;
left: 0px;
top: 50%;