Skip to content

Commit

Permalink
转bpmn接口
Browse files Browse the repository at this point in the history
  • Loading branch information
caidefeng committed Nov 25, 2023
1 parent 6511740 commit 5fe5e5d
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 本地环境
VITE_USER_NODE_ENV=development

# 公共基础路径
VITE_PUBLIC_PATH=/

# 开发环境接口地址
VITE_API_URL="https://www.666cxf.com/stage-api"
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: pnpm install
# 打包
- name: 打包
run: pnpm build
run: pnpm build:test
# 部署
- name: 部署到gh-pages分支
uses: peaceiris/actions-gh-pages@v3
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
"private": true,
"version": "0.1.0",
"scripts": {
"mock": "vite --mode mock --force",
"dev": "vite",
"build": "vite build --mode development",
"build:dev": "vite build --mode development",
"build:test": "vite build --mode test",
"mock": "vite --mode mock --force",
"generate": "vite-ssg build",
"preview": "vite preview",
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"axios": "^1.5.1",
"element-plus": "^2.3.12",
"file-saver": "^2.0.5",
"vue": "^3.3.4"
},
"devDependencies": {
"@iconify-json/ep": "^1.1.12",
"@types/file-saver": "^2.0.5",
"@types/node": "^20.6.0",
"@vitejs/plugin-vue": "^4.3.4",
"@vitejs/plugin-vue-jsx": "^3.0.1",
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RequestHttp {
// 请求拦截
this.service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
config.headers['Authorization'] = "Bearer 87779e5a-3342-4df6-865d-d8828800d6fb"
// config.headers['Authorization'] = "Bearer 87779e5a-3342-4df6-865d-d8828800d6fb"
return config
},
(error: AxiosError) => {
Expand Down
10 changes: 10 additions & 0 deletions src/api/modules/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import http from '~/api/index'
import FileSaver from "file-saver";

export const downloadXml = async (data: object) => {
const res = await http.download('/workflow/model/download', data)
FileSaver.saveAs(
new Blob([res], { type: 'application/octet-stream;charset=utf-8' }),
'测试流程.bpmn20.xml'
)
}
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import "uno.css";

// If you want to use ElMessage, import it.
import "element-plus/theme-chalk/src/message.scss";
import "element-plus/theme-chalk/src/notification.scss";
import "element-plus/theme-chalk/el-input-number.css";


Expand Down
21 changes: 21 additions & 0 deletions src/views/flowDesign/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {computed, onUnmounted, provide, ref} from "vue";
import {Plus, Minus} from "@element-plus/icons-vue";
import {useVModels} from "@vueuse/core";
import {Field} from "~/components/Render/interface";
import {downloadXml} from "~/api/modules/model";
export interface FlowDesignProps {
process: FlowNode,
Expand Down Expand Up @@ -48,6 +49,25 @@ const handleZoom = (e: WheelEvent) => {
const validate = () => {
validateNodes()
}
const converterBpmn = () => {
const processModel = {
code: 'test',
name: '测试',
icon: {
name: 'el:HomeFilled',
color: '#409EFF',
},
process: process.value,
form: {
fields: fields.value
},
version: 1,
sort: 0,
groupId: '',
remark: '',
}
downloadXml(processModel)
}
// 按住shift键滚动鼠标滚轮,可以放大/缩小
window.addEventListener('wheel', handleZoom)
// 离开页面时,销毁事件监听
Expand All @@ -64,6 +84,7 @@ onUnmounted(() => {
<span>{{ zoom }}%</span>
<el-button :icon="Minus" @click="zoom -= 10" circle :disabled="zoom <= 50"></el-button>
<el-button @click="validate">校验</el-button>
<el-button @click="converterBpmn">转bpmn</el-button>
</div>
<!--流程树-->
<div class="node-container">
Expand Down
14 changes: 14 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ export default defineConfig({
},
},
},
server: {
host: '0.0.0.0',
port: 3200,
open: true,
proxy: {
'/api': {
target: 'http://localhost:8084',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/^\/api/, ''),
secure: false
}
}
},
plugins: [
vue(),
vueJsx(),
Expand Down

0 comments on commit 5fe5e5d

Please sign in to comment.