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
1a4c94b830
commit
ab86cb1ff9
@ -85,10 +85,12 @@ const emits = defineEmits<{
|
|||||||
const processNodeTree = useWatchNode(props)
|
const processNodeTree = useWatchNode(props)
|
||||||
|
|
||||||
provide('readonly', props.readonly)
|
provide('readonly', props.readonly)
|
||||||
|
|
||||||
|
// TODO 可优化:拖拽有点卡顿
|
||||||
|
/** 拖拽、放大缩小等操作 */
|
||||||
let scaleValue = ref(100)
|
let scaleValue = ref(100)
|
||||||
const MAX_SCALE_VALUE = 200
|
const MAX_SCALE_VALUE = 200
|
||||||
const MIN_SCALE_VALUE = 50
|
const MIN_SCALE_VALUE = 50
|
||||||
|
|
||||||
const isDragging = ref(false)
|
const isDragging = ref(false)
|
||||||
const startX = ref(0)
|
const startX = ref(0)
|
||||||
const startY = ref(0)
|
const startY = ref(0)
|
||||||
@ -128,10 +130,33 @@ const stopDrag = () => {
|
|||||||
resetCursor() // 重置光标
|
resetCursor() // 重置光标
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zoomIn = () => {
|
||||||
|
if (scaleValue.value == MAX_SCALE_VALUE) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scaleValue.value += 10
|
||||||
|
}
|
||||||
|
|
||||||
|
const zoomOut = () => {
|
||||||
|
if (scaleValue.value == MIN_SCALE_VALUE) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scaleValue.value -= 10
|
||||||
|
}
|
||||||
|
|
||||||
|
const processReZoom = () => {
|
||||||
|
scaleValue.value = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetPosition = () => {
|
||||||
|
currentX.value = initialX.value
|
||||||
|
currentY.value = initialY.value
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 校验节点设置 */
|
||||||
const errorDialogVisible = ref(false)
|
const errorDialogVisible = ref(false)
|
||||||
let errorNodes: SimpleFlowNode[] = []
|
let errorNodes: SimpleFlowNode[] = []
|
||||||
|
|
||||||
// 校验节点设置。 暂时以 showText 为空 未节点错误配置
|
|
||||||
const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => {
|
const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => {
|
||||||
if (node) {
|
if (node) {
|
||||||
const { type, showText, conditionNodes } = node
|
const { type, showText, conditionNodes } = node
|
||||||
@ -212,37 +237,11 @@ const importLocalFile = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 放大
|
|
||||||
const zoomIn = () => {
|
|
||||||
if (scaleValue.value == MAX_SCALE_VALUE) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
scaleValue.value += 10
|
|
||||||
}
|
|
||||||
|
|
||||||
// 缩小
|
|
||||||
const zoomOut = () => {
|
|
||||||
if (scaleValue.value == MIN_SCALE_VALUE) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
scaleValue.value -= 10
|
|
||||||
}
|
|
||||||
|
|
||||||
const processReZoom = () => {
|
|
||||||
scaleValue.value = 100
|
|
||||||
}
|
|
||||||
|
|
||||||
// 在组件初始化时记录初始位置
|
// 在组件初始化时记录初始位置
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initialX.value = currentX.value
|
initialX.value = currentX.value
|
||||||
initialY.value = currentY.value
|
initialY.value = currentY.value
|
||||||
})
|
})
|
||||||
|
|
||||||
// 重置位置的函数
|
|
||||||
const resetPosition = () => {
|
|
||||||
currentX.value = initialX.value
|
|
||||||
currentY.value = initialY.value
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user