flow add&update
This commit is contained in:
22
frontend/src/control/flowctrl.ts
Normal file
22
frontend/src/control/flowctrl.ts
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"}]'});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user