mirror of
https://gitee.com/myxzgzs/boyue-ui-admin-vue3
synced 2025-08-08 16:32:43 +08:00
【代码评审】BPM:增加流程图 小手功能
This commit is contained in:
parent
3906204bb9
commit
1a4c94b830
@ -98,49 +98,39 @@ const initialX = ref(0)
|
|||||||
const initialY = ref(0)
|
const initialY = ref(0)
|
||||||
|
|
||||||
const setGrabCursor = () => {
|
const setGrabCursor = () => {
|
||||||
document.body.style.cursor = 'grab';
|
document.body.style.cursor = 'grab'
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetCursor = () => {
|
const resetCursor = () => {
|
||||||
document.body.style.cursor = 'default';
|
document.body.style.cursor = 'default'
|
||||||
}
|
}
|
||||||
|
|
||||||
const startDrag = (e: MouseEvent) => {
|
const startDrag = (e: MouseEvent) => {
|
||||||
isDragging.value = true;
|
isDragging.value = true
|
||||||
startX.value = e.clientX - currentX.value;
|
startX.value = e.clientX - currentX.value
|
||||||
startY.value = e.clientY - currentY.value;
|
startY.value = e.clientY - currentY.value
|
||||||
setGrabCursor(); // 设置小手光标
|
setGrabCursor() // 设置小手光标
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDrag = (e: MouseEvent) => {
|
const onDrag = (e: MouseEvent) => {
|
||||||
if (!isDragging.value) return;
|
if (!isDragging.value) return
|
||||||
e.preventDefault(); // 禁用文本选择
|
e.preventDefault() // 禁用文本选择
|
||||||
|
|
||||||
// 使用 requestAnimationFrame 优化性能
|
// 使用 requestAnimationFrame 优化性能
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
currentX.value = e.clientX - startX.value;
|
currentX.value = e.clientX - startX.value
|
||||||
currentY.value = e.clientY - startY.value;
|
currentY.value = e.clientY - startY.value
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const stopDrag = () => {
|
const stopDrag = () => {
|
||||||
isDragging.value = false;
|
isDragging.value = false
|
||||||
resetCursor(); // 重置光标
|
resetCursor() // 重置光标
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorDialogVisible = ref(false)
|
const errorDialogVisible = ref(false)
|
||||||
let errorNodes: SimpleFlowNode[] = []
|
let errorNodes: SimpleFlowNode[] = []
|
||||||
|
|
||||||
const saveSimpleFlowModel = async () => {
|
|
||||||
errorNodes = []
|
|
||||||
validateNode(processNodeTree.value, errorNodes)
|
|
||||||
if (errorNodes.length > 0) {
|
|
||||||
errorDialogVisible.value = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
emits('save', processNodeTree.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验节点设置。 暂时以 showText 为空 未节点错误配置
|
// 校验节点设置。 暂时以 showText 为空 未节点错误配置
|
||||||
const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => {
|
const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => {
|
||||||
if (node) {
|
if (node) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user