Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
vue-flow-editor
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2023-11-29 15:12:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
789344e9d0a79131e4758be09bbb2a3847014006
789344e9
1 parent
7e4a850a
fix
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
21 deletions
doc/App.vue
doc/App.vue
View file @
789344e
...
...
@@ -319,14 +319,14 @@
<div style="position: absolute; top:20px; right: 15px;">
<el-dropdown trigger="click">
<div style="margin-left: 15px;">
<div v-if="state.flow_version === state.current_enable_version" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div>
<div v-if="state.
select_
flow_version === state.current_enable_version" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div>
<div v-else style="width: 10px; height: 10px; background-color: #f0a800; border-radius: 50%; display: inline-block; margin-right: 8px;"></div>
<span style="font-size: 13px;">流程版本 (V{{ state.flow_version }})</span>
<span style="font-size: 13px;">流程版本 (V{{ state.
select_
flow_version }})</span>
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click.native="onSelectFlowVersion(item.id, item.code, item.note)" v-for="(item, index) in state.version_list" :key="index">
<i v-if="item.code === state.flow_version" class="el-icon-check" style="color: #009688; margin-right: 8px;"></i>
<i v-if="item.code === state.
select_
flow_version" class="el-icon-check" style="color: #009688; margin-right: 8px;"></i>
<div v-else style="width: 15px; height: 15px;display: inline-block; margin-right: 8px;"></div>
<span>流程版本 (V{{ item.code }})</span>
<span v-if="item.code === state.current_enable_version" style="background: #edf9f1; border-color: #46c26f; color: #46c26f;font-size: 10px; padding: 0 5px; border-radius: 3px; margin-left: 8px;">启用中</span>
...
...
@@ -572,8 +572,7 @@ export default {
field_auths: [],
field_extend: [],
current_enable_version: 0,
flow_version: 0,
flow_version_list: [],
select_flow_version: 0,
version_list: [],
dialogVersionFormVisible: false,
versionForm: {
...
...
@@ -648,25 +647,24 @@ export default {
let flow_id = urlQuery.flow_id? urlQuery.flow_id : ''; // 流程id,如果是新的流程,则为空
/**
* 因为从外部页面到流程图页面,flow_id都需要从当前页面生成
* 获取版本信息列表
*/
const getVersionList = () => {
axios.get('/admin/?a=flow_version&form_id=' + form_id)
.then(res => {
if (res.data.code) {
// 版本列表
//
流程
版本列表
state.version_list = res.data.data;
// 版本列表不含有启用的版本
state.flow_version_list = res.data.data.filter((ele) => {
return ele.status !== '1';
});
const urlQuery = getQueryParams(location.href);
let flow_id = urlQuery.flow_id? urlQuery.flow_id : ''; // 流程id,如果是新的流程,则为空
// 从外部页面第一次跳到流程编辑页面时,flow_id不存在
if (flow_id) {
if (state.version_list.length) {
// 启用的版本号
state.version_list.forEach((ele) => {
if (ele.id === +flow_id) {
//
流程版本显示信息
state.flow_version = ele.code;
//
选中的版本号
state.
select_
flow_version = ele.code;
}
if (ele.status === '1') {
// 流程版本列表显示启用项
...
...
@@ -677,12 +675,19 @@ export default {
} else {
// 如果列表里没有启用的版本获取flow_id不存在时,默认选中第一个
if (state.version_list.length) {
if (!state.flow_version_list) {
let ele = state.version_list[0];
flow_id = ele.id;
updateUrl(flow_id); // 更新url
state.flow_version = ele.code;
state.select_flow_version = ele.code; // 选中的版本号
state.version_list.forEach((ele) => {
if (ele.status === '1') {
// 流程版本列表显示启用项
state.current_enable_version = ele.code;
}
});
console.warn(ele);
getFlowData(flow_id);
}
}
// 没有默认版本列表,自动新增流程
...
...
@@ -745,7 +750,10 @@ export default {
state.reloadLoading = false;
});
}
if (flow_id) {
getFlowData(flow_id);
}
// 显示提示框的标志位
onMounted(async () => {
...
...
@@ -775,7 +783,7 @@ export default {
// 切换版本信息
updateUrl(id); // 更新URL
getFlowData(id); // 更新流程图数据
state.flow_version = code;
state.
select_
flow_version = code;
}
const showEditFlowVersion = (id: number, code: number, note: string) => {
// 切换版本信息
...
...
@@ -811,7 +819,7 @@ export default {
state.version_list.forEach((ele) => {
if (ele.id === +flow_id) {
// 选中新增的版本
state.flow_version = ele.code;
state.
select_
flow_version = ele.code;
}
if (ele.status === '1') {
state.current_enable_version = ele.code;
...
...
@@ -845,10 +853,11 @@ export default {
type: 'success',
message: '启用成功',
});
getVersionList(); // 刷新版本列表
updateUrl(res.data.data); // 更新URL
let flow_id = res.data.data;
state.reloadLoading = true; // 打开loading
getFlowData(res.data.data); // 更新流程图数据
updateUrl(flow_id); // 更新URL
getVersionList(); // 刷新版本列表
getFlowData(flow_id); // 更新流程图数据
}
})
.catch(err => {
...
...
@@ -859,7 +868,7 @@ export default {
const editFlowVersion = () => { // 编辑版本
state.dialogVersionFormVisible = true;
state.version_list.forEach((ele) => {
if (ele.code === state.flow_version) {
if (ele.code === state.
select_
flow_version) {
state.versionForm.id = ele.id;
state.versionForm.code = ele.code;
state.versionForm.note = ele.note;
...
...
Please
register
or
login
to post a comment