flow add&update

This commit is contained in:
2023-09-23 14:53:48 +00:00
parent 7f7d625fdd
commit 94a17073dd
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { api } from 'boot/axios';
export class FlowCtrl
{
async SaveFlow(jsonData:any):Promise<boolean>
{
const result = await api.post('http://127.0.0.1:8000/api/flow',jsonData);
console.info(result.data)
return true;
}
async UpdateFlow(jsonData:any):Promise<boolean>
{
const result = await api.put('http://127.0.0.1:8000/api/flow/' + jsonData.flowid,jsonData);
console.info(result.data)
return true;
}
}

View File

@@ -23,6 +23,7 @@
color="primary"
size="sm"
label="保存する"
@click="save()"
dense
/>
</div>
@@ -81,13 +82,28 @@ import ItemSelector from 'components/flowEditor/left/ItemSelector.vue';
import { ref } from 'vue';
import { storeToRefs } from 'pinia';
import { useFlowEditorStore } from 'stores/flowEditor';
import { FlowCtrl } from '../control/flowctrl'
const flowCtrl = new FlowCtrl();
const actName = ref('勤怠管理 - 4');
const drawerLeft = ref(false);
const store = useFlowEditorStore();
const { flowNames1 } = storeToRefs(store);
let isNew = ref(true);
const save = () =>{
if(isNew.value)
{
flowCtrl.SaveFlow({appid:'1',flowid:'flow123',eventid:'event123',name:'test',content:'[]'});
isNew.value = false;
}
else
{
flowCtrl.UpdateFlow({appid:'1',flowid:'flow123',eventid:'event123',name:'test',content:'[{"a":"b"}]'});
}
}