|
@@ -19,13 +19,19 @@
|
|
|
<script setup lang="ts">
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { generateUUID } from '@/utils'
|
|
|
+import { getFlowTemplateTree, addTProcessEngine } from '@/api/oa/workflow'
|
|
|
+import { openFlow } from '@/utils/flow'
|
|
|
const { push } = useRouter()
|
|
|
const props: any = defineProps({
|
|
|
menuData: {
|
|
|
type: Object
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+const router = useRouter()
|
|
|
+/**
|
|
|
+ * 初始化新建流程中流程模板Tree
|
|
|
+ */
|
|
|
+const flowTemplateTree = ref<any>()
|
|
|
const menuList = ref(props.menuData.children)
|
|
|
const pushName = ref(props.menuData.path)
|
|
|
// 获取assets静态资源
|
|
@@ -33,26 +39,24 @@ const getAssetsFile = (url: string) => {
|
|
|
return new URL(`../../../assets/imgs/menus/${url}`, import.meta.url).href
|
|
|
}
|
|
|
const menuClick = (item: any) => {
|
|
|
+ const name = item['name']
|
|
|
+ let id = ''
|
|
|
const path = item['path']
|
|
|
if (
|
|
|
path &&
|
|
|
(path.toLocaleLowerCase().startsWith('http') || path.toLocaleLowerCase().startsWith('https'))
|
|
|
) {
|
|
|
- push({
|
|
|
- // path: item['componentName'],
|
|
|
- // query: {
|
|
|
- // iframe: '1',
|
|
|
- // url: path,
|
|
|
- // iFrameId: `${item['componentName']}_001`
|
|
|
- // }
|
|
|
- path: '/processContainer',
|
|
|
- query: {
|
|
|
- iFrameId: generateUUID(),
|
|
|
- url: path,
|
|
|
- title: item['name'],
|
|
|
- iframe: '1'
|
|
|
+ // 遍历查询对应名称的流程模板ID
|
|
|
+ flowTemplateTree.value.forEach((element: any) => {
|
|
|
+ if (element.name === name) {
|
|
|
+ id = element.id
|
|
|
}
|
|
|
})
|
|
|
+ // 根据流程模板ID添加流程实例
|
|
|
+ addTProcessEngine(id).then((result: any) => {
|
|
|
+ // 跳转到流程实例具体页面
|
|
|
+ openFlow(router, result, name)
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
push('/OaSystem/' + pushName.value + '/' + item.path)
|
|
@@ -66,9 +70,19 @@ const initAbsolute = () => {
|
|
|
active.style.top = -(activeAll.bottom - docHeight + 15) + 'px'
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// 获取流程模板列表
|
|
|
+const initFlowTemplateTree = () => {
|
|
|
+ getFlowTemplateTree().then((result) => {
|
|
|
+ const tree = result.data[0]['children']
|
|
|
+ flowTemplateTree.value = tree[0].children
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
/** 初始化 **/
|
|
|
onMounted(() => {
|
|
|
initAbsolute()
|
|
|
+ initFlowTemplateTree()
|
|
|
})
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|