hookehuyr

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

This diff is collapsed. Click to expand it.
/*
* @Date: 2023-11-30 10:34:01
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-02 15:08:01
* @LastEditTime: 2023-12-06 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));
......
<!--
* @Date: 2023-11-01 10:18:53
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-11-24 16:23:41
* @LastEditTime: 2023-12-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);
});
}
}
}
}
);
......
/*
* @Date: 2023-10-27 09:29:59
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-11-14 15:31:33
* @LastEditTime: 2023-12-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})
},
......
......@@ -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
}
......