logic-helper
Version:
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
31 lines (28 loc) • 774 B
JavaScript
import {
store
} from '@/common/js/app.js'
import { markRaw } from 'vue';
import {deepMerge} from '@/utils/util.js'
export function sort_nodes({oldIndex, newIndex}){
const nodes = store.storage.currentTopo?.config?.data?.nodeDataArray??[];
let old = nodes[oldIndex];
let new_ = nodes[newIndex];
nodes.splice(oldIndex, 1, new_);
nodes.splice(newIndex, 1, old);
store.storage.setData()
}
//编辑拓扑
export async function edit_topo(data){
store.topo.update(data.id,data);
store.storage.saveToFiles();
}
//创建拓扑
export async function create_topo(data){
store.topo.create(data)
store.storage.saveToFiles();
}
//删除拓扑
export async function del_topo(id){
store.topo.delete(id);
store.storage.saveToFiles();
}