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-12-06 12:54:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
db3b44a36d8aa70936f6bd0b66bea64d9a23a1a3
db3b44a3
1 parent
c751b0b0
新增批量保存节点属性功能
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
4 deletions
doc/App.vue
doc/api/index.js
doc/selectUserView.vue
src/shape/control.ts
src/utils/utils.ts
doc/App.vue
View file @
db3b44a
This diff is collapsed. Click to expand it.
doc/api/index.js
View file @
db3b44a
/*
* @Date: 2023-11-30 10:34:01
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-0
2 15:08:01
* @LastEditTime: 2023-12-0
6 11:36:04
* @FilePath: /vue-flow-editor/doc/api/index.js
* @Description: 文件描述
*/
...
...
@@ -14,6 +14,7 @@ const Api = {
ENABLE_FLOW_VERSION
:
'/admin/?a=enable_flow_version'
,
FLOW_NODE_PROPERTY
:
'/admin/?a=flow_node_property'
,
SAVE_FLOW_NODE_PROPERTY
:
'/admin/?a=save_node_property'
,
SAVE_ALL_FLOW_NODE_PROPERTY
:
'/admin/?a=save_all_node_property'
,
}
/**
...
...
@@ -64,3 +65,11 @@ export const flowNodePropertyAPI = (params) => fn(fetch.get(Api.FLOW_NODE_PROPER
* @returns
*/
export
const
saveFlowNodePropertyAPI
=
(
params
)
=>
fn
(
fetch
.
stringifyPost
(
Api
.
SAVE_FLOW_NODE_PROPERTY
,
params
));
/**
* @description: 保存所有节点属性
* @param {*} flow_id 流程 ID
* @param {*} data 节点属性的数据,json格式字符串
* @returns
*/
export
const
saveAllFlowNodePropertyAPI
=
(
params
)
=>
fn
(
fetch
.
stringifyPost
(
Api
.
SAVE_ALL_FLOW_NODE_PROPERTY
,
params
));
...
...
doc/selectUserView.vue
View file @
db3b44a
<!--
* @Date: 2023-11-01 10:18:53
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-1
1-24 16:23:41
* @LastEditTime: 2023-1
2-06 12:52:57
* @FilePath: /vue-flow-editor/doc/selectUserView.vue
* @Description: 成员列表选择控件
-->
...
...
@@ -411,6 +411,18 @@ watch(
nextTick(() => {
tabTextWidth.value = $("#" + activeTabId.value).width() + "px";
});
userTags.value = _.cloneDeep(props.list);
// 第一项目是组织结构树,默认展开第一个节点
if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') {
if (userTabs.value[activeTabIdx.value]['data'].length) {
// 默认展开第一个节点
defaultExpandedKeys.value = [userTabs.value[activeTabIdx.value]['data'][0]['id']];
// 把用户选中的节点注入树结构显示选中状态
nextTick(() => {
currentCheckedNodeKey.value = userTags.value.map(ele => ele.id);
});
}
}
}
}
);
...
...
src/shape/control.ts
View file @
db3b44a
/*
* @Date: 2023-10-27 09:29:59
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-1
1-14 15:31:33
* @LastEditTime: 2023-1
2-06 09:51:19
* @FilePath: /vue-flow-editor/src/shape/control.ts
* @Description: 自定义控制节点
*/
...
...
@@ -53,7 +53,8 @@ export function registerControl(G6) {
},
drawShape
(
cfg
,
group
)
{
// 继承了基类,可以使用drawShape,如果没有继承,必须要有draw
let
{
text
,
desc
,
img
,
color
}
=
cfg
let
{
text
,
desc
,
img
,
error
,
color
}
=
cfg
color
=
color
||
BASE_COLOR
desc
=
desc
||
'无描述'
...
...
@@ -77,6 +78,10 @@ export function registerControl(G6) {
type
:
'image'
,
attrs
:
{
x
:
height
/
4
-
width
/
2
,
y
:
height
/
4
-
height
/
2
,
width
:
height
/
2
,
height
:
height
/
2
,
img
},
},
error
:
{
type
:
'image'
,
attrs
:
{
x
:
height
/
4
+
width
/
4
+
5
,
y
:
height
/
4
-
height
/
2
,
width
:
height
/
2.1
,
height
:
height
/
2.1
,
img
:
error
},
},
label
:
{
type
:
'text'
,
attrs
:
{
text
,
x
:
height
-
width
/
2
,
y
:
height
*
(
4
/
8
)
-
height
/
2
,
fontSize
:
14
,
textAlign
:
'left'
,
textBaseline
:
'middle'
,
fill
:
'black'
},
...
...
@@ -111,6 +116,7 @@ export function registerControl(G6) {
group
=
group
.
getContainer
()
// group.shapes.sideRect.attr({fill: cfg.color})
group
.
shapes
.
img
.
attr
({
img
:
cfg
.
img
})
group
.
shapes
.
error
.
attr
({
img
:
cfg
.
desc
})
group
.
shapes
.
label
.
attr
({
text
:
cfg
.
text
})
// group.shapes.desc.attr({text: cfg.desc})
},
...
...
src/utils/utils.ts
View file @
db3b44a
...
...
@@ -157,6 +157,7 @@ export function formatNodeModel_control(model: any, controlConfig: object) {
// 把 control 的配置挂到model上
model
.
shape
=
'control'
model
.
img
=
controlConfig
[
control
].
img
model
.
error
=
controlConfig
[
control
].
error
model
.
color
=
controlConfig
[
control
].
color
}
...
...
Please
register
or
login
to post a comment