diff --git a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue index 1125d8e7..70eade33 100644 --- a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue +++ b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue @@ -63,8 +63,6 @@ const props = defineProps({ }) const processData = inject('processData') as Ref - - const loading = ref(false) const formFields = ref([]) const formType = ref(20) @@ -110,7 +108,6 @@ const updateModel = () => { } } - const saveSimpleFlowModel = async (simpleModelNode: SimpleFlowNode) => { if (!simpleModelNode) { return @@ -201,7 +198,5 @@ onMounted(async () => { const simpleProcessModelRef = ref() - -defineExpose({ -}) +defineExpose({}) diff --git a/src/components/SimpleProcessDesignerV2/src/SimpleProcessModel.vue b/src/components/SimpleProcessDesignerV2/src/SimpleProcessModel.vue index b9a26475..23f2d791 100644 --- a/src/components/SimpleProcessDesignerV2/src/SimpleProcessModel.vue +++ b/src/components/SimpleProcessDesignerV2/src/SimpleProcessModel.vue @@ -3,10 +3,15 @@
- 导出 - 导入 + + 导出 + + + 导入 + {{ scaleValue }}% - - - - - - - - -
@@ -53,7 +49,7 @@ import ProcessNodeTree from './ProcessNodeTree.vue' import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from './consts' import { useWatchNode } from './node' -import { ZoomOut, ZoomIn, ScaleToOriginal, Select } from '@element-plus/icons-vue' +import { ZoomOut, ZoomIn, ScaleToOriginal } from '@element-plus/icons-vue' import { isString } from '@/utils/is' defineOptions({ @@ -73,7 +69,7 @@ const props = defineProps({ }) const emits = defineEmits<{ - 'save': [node: SimpleFlowNode | undefined] + save: [node: SimpleFlowNode | undefined] }>() const processNodeTree = useWatchNode(props) @@ -175,25 +171,28 @@ defineExpose({ getCurrentFlowData }) +/** 导出 JSON */ +// TODO @zws:增加一个 download 里面搞个 json 更好 const exportJson = () => { - const blob = new Blob([JSON.stringify(processNodeTree.value)]); - const tempLink = document.createElement('a'); // 创建a标签 - const href = window.URL.createObjectURL(blob); // 创建下载的链接 - //filename - const fileName = `model.json`; - tempLink.href = href; - tempLink.target = '_blank'; - tempLink.download = fileName; - document.body.appendChild(tempLink); - tempLink.click(); // 点击下载 - document.body.removeChild(tempLink); // 下载完成移除元素 - window.URL.revokeObjectURL(href); // 释放掉blob对象 + const blob = new Blob([JSON.stringify(processNodeTree.value)]) + const tempLink = document.createElement('a') // 创建a标签 + const href = window.URL.createObjectURL(blob) // 创建下载的链接 + // filename + const fileName = `model.json` + tempLink.href = href + tempLink.target = '_blank' + tempLink.download = fileName + document.body.appendChild(tempLink) + tempLink.click() // 点击下载 + document.body.removeChild(tempLink) // 下载完成移除元素 + window.URL.revokeObjectURL(href) // 释放掉 blob 对象 } + +/** 导入 JSON */ +const refFile = ref() const importJson = () => { refFile.value.click() } -const refFile = ref() -// 加载本地文件 const importLocalFile = () => { const file = refFile.value.files[0] const reader = new FileReader() diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 34466079..4b177ae8 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -344,6 +344,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ } }, { + // TODO @zws:1)建议,在加一个路由。然后标题是“复制流程”,这样体验会好点;2)复制出来的数据,在名字前面,加“副本 ”,和钉钉保持一致! path: 'manager/model/:type/:id', component: () => import('@/views/bpm/model/form/index.vue'), name: 'BpmModelUpdate', diff --git a/src/views/bpm/model/editor/index.vue b/src/views/bpm/model/editor/index.vue index 101ea1b8..b91c250e 100644 --- a/src/views/bpm/model/editor/index.vue +++ b/src/views/bpm/model/editor/index.vue @@ -51,7 +51,7 @@ const formType = ref(20) provide('formFields', formFields) provide('formType', formType) -//注入 流程数据 +// 注入流程数据 const xmlString = inject('processData') as Ref const modeler = shallowRef() // BPMN Modeler @@ -66,13 +66,12 @@ const controlForm = ref({ }) const model = ref() // 流程模型的信息 - /** 初始化 modeler */ +// TODO @zws:需要初始化,不然首次创建后,无法发布!相当于说,key、name 要去赋值下 const initModeler = async (item) => { modeler.value = item } - /** 添加/修改模型 */ const save = async (bpmnXml: string) => { try { @@ -84,7 +83,6 @@ const save = async (bpmnXml: string) => { } } - // 在组件卸载时清理 onBeforeUnmount(() => { modeler.value = null @@ -94,8 +92,6 @@ onBeforeUnmount(() => { w.bpmnInstances = null } }) - -