hookehuyr

新增批量保存节点属性功能

This diff is collapsed. Click to expand it.
1 /* 1 /*
2 * @Date: 2023-11-30 10:34:01 2 * @Date: 2023-11-30 10:34:01
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-02 15:08:01 4 + * @LastEditTime: 2023-12-06 11:36:04
5 * @FilePath: /vue-flow-editor/doc/api/index.js 5 * @FilePath: /vue-flow-editor/doc/api/index.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -14,6 +14,7 @@ const Api = { ...@@ -14,6 +14,7 @@ const Api = {
14 ENABLE_FLOW_VERSION: '/admin/?a=enable_flow_version', 14 ENABLE_FLOW_VERSION: '/admin/?a=enable_flow_version',
15 FLOW_NODE_PROPERTY: '/admin/?a=flow_node_property', 15 FLOW_NODE_PROPERTY: '/admin/?a=flow_node_property',
16 SAVE_FLOW_NODE_PROPERTY: '/admin/?a=save_node_property', 16 SAVE_FLOW_NODE_PROPERTY: '/admin/?a=save_node_property',
17 + SAVE_ALL_FLOW_NODE_PROPERTY: '/admin/?a=save_all_node_property',
17 } 18 }
18 19
19 /** 20 /**
...@@ -64,3 +65,11 @@ export const flowNodePropertyAPI = (params) => fn(fetch.get(Api.FLOW_NODE_PROPER ...@@ -64,3 +65,11 @@ export const flowNodePropertyAPI = (params) => fn(fetch.get(Api.FLOW_NODE_PROPER
64 * @returns 65 * @returns
65 */ 66 */
66 export const saveFlowNodePropertyAPI = (params) => fn(fetch.stringifyPost(Api.SAVE_FLOW_NODE_PROPERTY, params)); 67 export const saveFlowNodePropertyAPI = (params) => fn(fetch.stringifyPost(Api.SAVE_FLOW_NODE_PROPERTY, params));
68 +
69 +/**
70 + * @description: 保存所有节点属性
71 + * @param {*} flow_id 流程 ID
72 + * @param {*} data 节点属性的数据,json格式字符串
73 + * @returns
74 + */
75 +export const saveAllFlowNodePropertyAPI = (params) => fn(fetch.stringifyPost(Api.SAVE_ALL_FLOW_NODE_PROPERTY, params));
......
1 <!-- 1 <!--
2 * @Date: 2023-11-01 10:18:53 2 * @Date: 2023-11-01 10:18:53
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-11-24 16:23:41 4 + * @LastEditTime: 2023-12-06 12:52:57
5 * @FilePath: /vue-flow-editor/doc/selectUserView.vue 5 * @FilePath: /vue-flow-editor/doc/selectUserView.vue
6 * @Description: 成员列表选择控件 6 * @Description: 成员列表选择控件
7 --> 7 -->
...@@ -411,6 +411,18 @@ watch( ...@@ -411,6 +411,18 @@ watch(
411 nextTick(() => { 411 nextTick(() => {
412 tabTextWidth.value = $("#" + activeTabId.value).width() + "px"; 412 tabTextWidth.value = $("#" + activeTabId.value).width() + "px";
413 }); 413 });
414 + userTags.value = _.cloneDeep(props.list);
415 + // 第一项目是组织结构树,默认展开第一个节点
416 + if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') {
417 + if (userTabs.value[activeTabIdx.value]['data'].length) {
418 + // 默认展开第一个节点
419 + defaultExpandedKeys.value = [userTabs.value[activeTabIdx.value]['data'][0]['id']];
420 + // 把用户选中的节点注入树结构显示选中状态
421 + nextTick(() => {
422 + currentCheckedNodeKey.value = userTags.value.map(ele => ele.id);
423 + });
424 + }
425 + }
414 } 426 }
415 } 427 }
416 ); 428 );
......
1 /* 1 /*
2 * @Date: 2023-10-27 09:29:59 2 * @Date: 2023-10-27 09:29:59
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-11-14 15:31:33 4 + * @LastEditTime: 2023-12-06 09:51:19
5 * @FilePath: /vue-flow-editor/src/shape/control.ts 5 * @FilePath: /vue-flow-editor/src/shape/control.ts
6 * @Description: 自定义控制节点 6 * @Description: 自定义控制节点
7 */ 7 */
...@@ -53,7 +53,8 @@ export function registerControl(G6) { ...@@ -53,7 +53,8 @@ export function registerControl(G6) {
53 }, 53 },
54 drawShape(cfg, group) { // 继承了基类,可以使用drawShape,如果没有继承,必须要有draw 54 drawShape(cfg, group) { // 继承了基类,可以使用drawShape,如果没有继承,必须要有draw
55 55
56 - let {text, desc, img, color} = cfg 56 + let {text, desc, img, error, color} = cfg
57 +
57 color = color || BASE_COLOR 58 color = color || BASE_COLOR
58 desc = desc || '无描述' 59 desc = desc || '无描述'
59 60
...@@ -77,6 +78,10 @@ export function registerControl(G6) { ...@@ -77,6 +78,10 @@ export function registerControl(G6) {
77 type: 'image', 78 type: 'image',
78 attrs: {x: height / 4 - width / 2, y: height / 4 - height / 2, width: height / 2, height: height / 2, img}, 79 attrs: {x: height / 4 - width / 2, y: height / 4 - height / 2, width: height / 2, height: height / 2, img},
79 }, 80 },
81 + error: {
82 + type: 'image',
83 + attrs: {x: height / 4 + width / 4 + 5, y: height / 4 - height / 2, width: height / 2.1, height: height / 2.1, img: error},
84 + },
80 label: { 85 label: {
81 type: 'text', 86 type: 'text',
82 attrs: {text, x: height - width / 2, y: height * (4 / 8) - height / 2, fontSize: 14, textAlign: 'left', textBaseline: 'middle', fill: 'black'}, 87 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) { ...@@ -111,6 +116,7 @@ export function registerControl(G6) {
111 group = group.getContainer() 116 group = group.getContainer()
112 // group.shapes.sideRect.attr({fill: cfg.color}) 117 // group.shapes.sideRect.attr({fill: cfg.color})
113 group.shapes.img.attr({img: cfg.img}) 118 group.shapes.img.attr({img: cfg.img})
119 + group.shapes.error.attr({img: cfg.desc})
114 group.shapes.label.attr({text: cfg.text}) 120 group.shapes.label.attr({text: cfg.text})
115 // group.shapes.desc.attr({text: cfg.desc}) 121 // group.shapes.desc.attr({text: cfg.desc})
116 }, 122 },
......
...@@ -157,6 +157,7 @@ export function formatNodeModel_control(model: any, controlConfig: object) { ...@@ -157,6 +157,7 @@ export function formatNodeModel_control(model: any, controlConfig: object) {
157 // 把 control 的配置挂到model上 157 // 把 control 的配置挂到model上
158 model.shape = 'control' 158 model.shape = 'control'
159 model.img = controlConfig[control].img 159 model.img = controlConfig[control].img
160 + model.error = controlConfig[control].error
160 model.color = controlConfig[control].color 161 model.color = controlConfig[control].color
161 } 162 }
162 163
......