vue-wiring-diagram 1.0.19 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -1
- package/dist/vue-wiring-diagram.es.js +9156 -8227
- package/dist/vue-wiring-diagram.umd.js +39 -39
- package/package.json +1 -1
- package/packages/components/edge-control/arrow-line.vue +274 -0
- package/packages/components/edge-control/condition.vue +27 -5
- package/packages/components/edge-control/default-line.vue +156 -0
- package/packages/components/edge-control/index.vue +52 -318
- package/packages/components/edge-control/index2.vue +356 -0
- package/packages/components/edge-control/pipe-line.vue +327 -0
- package/packages/components/editor/index.vue +3 -3
- package/packages/components/enums.js +23 -3
- package/packages/components/image-control/image-management.vue +2 -2
- package/packages/components/preview/index.vue +32 -6
- package/packages/components/settings.js +126 -8
- package/packages/components/tools.js +20 -5
- package/packages/styles/animation.scss +16 -0
- package/packages/styles/editor.scss +4 -0
- package/packages/styles/elPath.scss +4 -0
package/package.json
CHANGED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Author: HuaYJ
|
|
3
|
+
* @Date: 2025/4/9 14:13
|
|
4
|
+
*/
|
|
5
|
+
<template>
|
|
6
|
+
<div class="container">
|
|
7
|
+
<el-collapse v-model="activeName" accordion>
|
|
8
|
+
<el-collapse-item title="线段设置" name="0">
|
|
9
|
+
<div class="row-column">
|
|
10
|
+
<el-row :gutter="20">
|
|
11
|
+
<el-col :span="12">
|
|
12
|
+
<div class="row-label">颜色</div>
|
|
13
|
+
</el-col>
|
|
14
|
+
<el-col :span="12">
|
|
15
|
+
<el-color-picker v-model="stroke" :show-alpha="true" size="small" @change="changeLine"/>
|
|
16
|
+
</el-col>
|
|
17
|
+
</el-row>
|
|
18
|
+
<el-row :gutter="20">
|
|
19
|
+
<el-col :span="12">
|
|
20
|
+
<div class="row-label">粗细</div>
|
|
21
|
+
</el-col>
|
|
22
|
+
<el-col :span="12">
|
|
23
|
+
<el-input-number v-model="strokeWidth" size="small" controls-position="right" @change="changeLine" :min="1" :max="10"
|
|
24
|
+
:step="1"/>
|
|
25
|
+
</el-col>
|
|
26
|
+
</el-row>
|
|
27
|
+
</div>
|
|
28
|
+
</el-collapse-item>
|
|
29
|
+
<el-collapse-item title="箭头设置" name="1">
|
|
30
|
+
<div class="row-column">
|
|
31
|
+
<el-row :gutter="20">
|
|
32
|
+
<el-col :span="12">
|
|
33
|
+
<div class="row-label">箭头数量</div>
|
|
34
|
+
</el-col>
|
|
35
|
+
<el-col :span="12">
|
|
36
|
+
<el-input-number v-model="arrowNumber" size="small" controls-position="right" @change="changeLine" :min="1" :max="20"
|
|
37
|
+
:step="1"/>
|
|
38
|
+
</el-col>
|
|
39
|
+
</el-row>
|
|
40
|
+
<el-row :gutter="20">
|
|
41
|
+
<el-col :span="12">
|
|
42
|
+
<div class="row-label">箭头颜色</div>
|
|
43
|
+
</el-col>
|
|
44
|
+
<el-col :span="12">
|
|
45
|
+
<el-color-picker v-model="fill" :show-alpha="true" size="small" @change="changeLine"/>
|
|
46
|
+
</el-col>
|
|
47
|
+
</el-row>
|
|
48
|
+
<el-row :gutter="20">
|
|
49
|
+
<el-col :span="12">
|
|
50
|
+
<div class="row-label">默认箭头方向</div>
|
|
51
|
+
</el-col>
|
|
52
|
+
<el-col :span="12">
|
|
53
|
+
<el-select v-model="direction" size="small" @change="changeLine">
|
|
54
|
+
<el-option v-for="item in arrowDirection" :key="item.value" :label="item.label" :value="item.value"/>
|
|
55
|
+
</el-select>
|
|
56
|
+
</el-col>
|
|
57
|
+
</el-row>
|
|
58
|
+
<el-row :gutter="20">
|
|
59
|
+
<el-col :span="12">
|
|
60
|
+
<div class="row-label">默认箭头动作</div>
|
|
61
|
+
</el-col>
|
|
62
|
+
<el-col :span="12">
|
|
63
|
+
<el-switch v-model="animation" :active-value="FLASHING" active-text="闪烁" :inactive-value="STOP" inactive-text="静止" size="small"
|
|
64
|
+
@change="changeLine"/>
|
|
65
|
+
</el-col>
|
|
66
|
+
</el-row>
|
|
67
|
+
<el-row :gutter="20">
|
|
68
|
+
<el-col :span="12">
|
|
69
|
+
<div class="row-label">默认箭头显示</div>
|
|
70
|
+
</el-col>
|
|
71
|
+
<el-col :span="12">
|
|
72
|
+
<el-switch v-model="display" active-value="block" active-text="显示" inactive-value="none" inactive-text="隐藏" size="small"
|
|
73
|
+
@change="changeLine"/>
|
|
74
|
+
</el-col>
|
|
75
|
+
</el-row>
|
|
76
|
+
</div>
|
|
77
|
+
</el-collapse-item>
|
|
78
|
+
<el-collapse-item title="动态设置" name="2">
|
|
79
|
+
<div class="row-column">
|
|
80
|
+
<el-row :gutter="20">
|
|
81
|
+
<el-col :span="12">
|
|
82
|
+
<div class="row-label">参数设置</div>
|
|
83
|
+
</el-col>
|
|
84
|
+
<el-col :span="12">
|
|
85
|
+
<el-select v-model="deviceCode" placeholder="请选择设备" @change="checkDevice" size="small" filterable clearable>
|
|
86
|
+
<el-option v-for="item in deviceList" :key="item.deviceCode" :label="item.deviceName" :value="item.deviceCode"/>
|
|
87
|
+
</el-select>
|
|
88
|
+
<el-select v-model="fieldCode" placeholder="请选择字段" @change="checkField" size="small" filterable clearable style="margin-top: 10px">
|
|
89
|
+
<el-option v-for="item in fieldList" :key="item.dataField" :label="item.name" :value="item.dataField"/>
|
|
90
|
+
</el-select>
|
|
91
|
+
</el-col>
|
|
92
|
+
</el-row>
|
|
93
|
+
<el-row :gutter="20">
|
|
94
|
+
<el-col :span="12">
|
|
95
|
+
<div class="row-label">条件配置</div>
|
|
96
|
+
</el-col>
|
|
97
|
+
<el-col :span="12">
|
|
98
|
+
<el-switch v-model="isCondition" :active-value="true" :inactive-value="false" size="small" @change="changeCondition"/>
|
|
99
|
+
<el-button type="primary" size="small" @click="showCondition" style="margin-left: 10px">配置</el-button>
|
|
100
|
+
</el-col>
|
|
101
|
+
</el-row>
|
|
102
|
+
</div>
|
|
103
|
+
</el-collapse-item>
|
|
104
|
+
</el-collapse>
|
|
105
|
+
<el-dialog v-model="dialogCondition.show" width="800px" title="条件配置" :show-close="false" :close-on-click-modal="false"
|
|
106
|
+
:close-on-press-escape="false">
|
|
107
|
+
<condition v-if="dialogCondition.show" :payload="dialogCondition.payload" type="arrow" @close="closeCondition"></condition>
|
|
108
|
+
</el-dialog>
|
|
109
|
+
</div>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<script setup>
|
|
113
|
+
|
|
114
|
+
import {onMounted, reactive, ref} from "vue";
|
|
115
|
+
import {arrowBackward, arrowForward, lineOptions} from "packages/components/settings.js";
|
|
116
|
+
import {ARROWBACKWORD, arrowDirection, ARROWFORWARD, FLASHING, STOP} from "packages/components/enums.js";
|
|
117
|
+
import {getDeviceList, getFieldList} from "packages/components/common.js";
|
|
118
|
+
import Condition from "packages/components/edge-control/condition.vue";
|
|
119
|
+
|
|
120
|
+
const props = defineProps({
|
|
121
|
+
payload: {
|
|
122
|
+
type: Object
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const activeName = ref('0')
|
|
127
|
+
|
|
128
|
+
console.log(props.payload)
|
|
129
|
+
|
|
130
|
+
const stroke = ref(props.payload.attrs.line.stroke) // 颜色
|
|
131
|
+
const strokeWidth = ref(props.payload.attrs.line.strokeWidth) // 粗细
|
|
132
|
+
|
|
133
|
+
const oldArrowNumber = props.payload.markup.length - 1 // 记录箭头数量
|
|
134
|
+
const arrowNumber = ref(props.payload.markup.length - 1) // 箭头数量
|
|
135
|
+
|
|
136
|
+
const fill = ref(props.payload.attrs.arrow.fill) // 箭头颜色
|
|
137
|
+
const direction = ref(props.payload.attrs.arrow.d === arrowForward ? ARROWFORWARD : ARROWBACKWORD) // 箭头方向
|
|
138
|
+
const animation = ref(props.payload.attrs.arrow.style.animation.split(' ')[0] === FLASHING ? FLASHING : STOP) // 箭头闪烁
|
|
139
|
+
const display = ref(props.payload.attrs.arrow.display)
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 修改线段样式
|
|
143
|
+
*/
|
|
144
|
+
const changeLine = () => {
|
|
145
|
+
props.payload.attr('line/stroke', stroke.value)
|
|
146
|
+
props.payload.attr('line/strokeWidth', strokeWidth.value)
|
|
147
|
+
props.payload.attr('arrow/fill', fill.value)
|
|
148
|
+
props.payload.attr('arrow/stroke', fill.value)
|
|
149
|
+
// 箭头数量
|
|
150
|
+
if (arrowNumber.value !== oldArrowNumber) {
|
|
151
|
+
props.payload.markup = props.payload.markup.slice(0, 1)
|
|
152
|
+
for (let i = 0; i < arrowNumber.value; i++) {
|
|
153
|
+
props.payload.markup.push({
|
|
154
|
+
tagName: 'path',
|
|
155
|
+
groupSelector: 'arrow',
|
|
156
|
+
selector: 'arrow' + (i + 1),
|
|
157
|
+
})
|
|
158
|
+
props.payload.attr('arrow' + (i + 1), {
|
|
159
|
+
atConnectionRatio: (1 / (arrowNumber.value + 1)) * (i + 1),
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
props.payload.attr('arrow/d', direction.value === ARROWFORWARD ? arrowForward : arrowBackward)
|
|
164
|
+
props.payload.attr('arrow/style/animation', animation.value === FLASHING ? 'flashing 2s infinite linear' : '')
|
|
165
|
+
props.payload.attr('arrow/display', display.value)
|
|
166
|
+
console.log(props.payload.markup)
|
|
167
|
+
lineOptions.markup = props.payload.markup
|
|
168
|
+
lineOptions.attrs = props.payload.attrs
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const deviceList = ref([]) // 设备列表
|
|
172
|
+
const deviceCode = ref(props.payload.data?.fields?.[0]?.deviceCode ?? '') // 设备编码
|
|
173
|
+
const fieldCode = ref(props.payload.data?.fields?.[0]?.field ?? '') // 字段编码
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 获取设备列表
|
|
177
|
+
*/
|
|
178
|
+
const getDevices = async () => {
|
|
179
|
+
deviceList.value = await getDeviceList()
|
|
180
|
+
if (deviceCode.value) {
|
|
181
|
+
checkDevice()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
let currentDevice = reactive({}) // 当前设备信息
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 监听设备编码变化
|
|
189
|
+
*/
|
|
190
|
+
const checkDevice = () => {
|
|
191
|
+
currentDevice = deviceList.value.find(item => item.deviceCode === deviceCode.value)
|
|
192
|
+
if (currentDevice) {
|
|
193
|
+
getFields()
|
|
194
|
+
props.payload.data.fields = [{
|
|
195
|
+
index: 0,
|
|
196
|
+
deviceName: currentDevice.deviceName,
|
|
197
|
+
deviceCode: currentDevice.deviceCode,
|
|
198
|
+
field: fieldCode.value ?? '',
|
|
199
|
+
}]
|
|
200
|
+
fieldCode.value = props.payload.data.fields[0].field
|
|
201
|
+
} else {
|
|
202
|
+
fieldCode.value = ''
|
|
203
|
+
props.payload.data.fields = []
|
|
204
|
+
}
|
|
205
|
+
console.log('箭头线-配置', props.payload)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const fieldList = ref([])
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 获取字段列表
|
|
212
|
+
*/
|
|
213
|
+
const getFields = async () => {
|
|
214
|
+
fieldList.value = await getFieldList(currentDevice.deviceCode)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 监听字段编码变化
|
|
219
|
+
*/
|
|
220
|
+
const checkField = () => {
|
|
221
|
+
props.payload.data.fields = [{
|
|
222
|
+
index: 0,
|
|
223
|
+
deviceName: currentDevice.deviceName,
|
|
224
|
+
deviceCode: currentDevice.deviceCode,
|
|
225
|
+
field: fieldCode.value ?? '',
|
|
226
|
+
}]
|
|
227
|
+
console.log('箭头线-配置', props.payload)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// 条件线是否开启
|
|
231
|
+
const isCondition = ref(props.payload.data.isCondition ?? false)
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* 条件线改变
|
|
235
|
+
*/
|
|
236
|
+
const changeCondition = () => {
|
|
237
|
+
props.payload.data.isCondition = isCondition.value
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 条件线配置
|
|
241
|
+
const dialogCondition = reactive({
|
|
242
|
+
show: false,
|
|
243
|
+
payload: null
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 条件线配置显示
|
|
248
|
+
*/
|
|
249
|
+
const showCondition = () => {
|
|
250
|
+
dialogCondition.show = true
|
|
251
|
+
dialogCondition.payload = props.payload.data.condition ?? []
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 条件线配置关闭
|
|
256
|
+
* @param condition
|
|
257
|
+
*/
|
|
258
|
+
const closeCondition = (condition) => {
|
|
259
|
+
dialogCondition.show = false
|
|
260
|
+
dialogCondition.payload = null
|
|
261
|
+
if (condition) {
|
|
262
|
+
props.payload.data.condition = condition
|
|
263
|
+
}
|
|
264
|
+
console.log('条件线', props.payload.data)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
onMounted(() => {
|
|
268
|
+
getDevices()
|
|
269
|
+
})
|
|
270
|
+
</script>
|
|
271
|
+
|
|
272
|
+
<style scoped lang="scss">
|
|
273
|
+
|
|
274
|
+
</style>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<el-table :data="items" size="small" border>
|
|
9
9
|
<el-table-column prop="min" label="最小值" width="150" align="center">
|
|
10
10
|
<template #default="scope">
|
|
11
|
-
<el-input-number v-model="scope.row.min" size="small" controls-position="right"
|
|
11
|
+
<el-input-number v-model="scope.row.min" size="small" controls-position="right"></el-input-number>
|
|
12
12
|
</template>
|
|
13
13
|
</el-table-column>
|
|
14
14
|
<el-table-column prop="max" label="最大值" width="150" align="center">
|
|
@@ -16,13 +16,31 @@
|
|
|
16
16
|
<el-input-number v-model="scope.row.max" size="small" controls-position="right"></el-input-number>
|
|
17
17
|
</template>
|
|
18
18
|
</el-table-column>
|
|
19
|
-
<el-table-column prop="direction" label="流向" align="center">
|
|
19
|
+
<el-table-column prop="direction" label="流向" v-if="type === 'pipe'" align="center">
|
|
20
20
|
<template #default="scope">
|
|
21
21
|
<el-select v-model="scope.row.direction" size="small">
|
|
22
22
|
<el-option v-for="item in directionList" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
23
23
|
</el-select>
|
|
24
24
|
</template>
|
|
25
25
|
</el-table-column>
|
|
26
|
+
<el-table-column prop="direction" label="方向" v-if="type === 'arrow'" align="center">
|
|
27
|
+
<template #default="scope">
|
|
28
|
+
<el-switch v-model="scope.row.direction" :active-value="ARROWFORWARD" active-text="正向" :inactive-value="ARROWBACKWORD"
|
|
29
|
+
inactive-text="反向" size="small"/>
|
|
30
|
+
</template>
|
|
31
|
+
</el-table-column>
|
|
32
|
+
<el-table-column prop="direction" label="动作" v-if="type === 'arrow'" align="center">
|
|
33
|
+
<template #default="scope">
|
|
34
|
+
<el-switch v-model="scope.row.animation" :active-value="FLASHING" active-text="闪烁" :inactive-value="STOP" inactive-text="静止"
|
|
35
|
+
size="small"/>
|
|
36
|
+
</template>
|
|
37
|
+
</el-table-column>
|
|
38
|
+
<el-table-column prop="display" label="显示" v-if="type === 'arrow'" align="center">
|
|
39
|
+
<template #default="scope">
|
|
40
|
+
<el-switch v-model="scope.row.display" :active-value="'block'" active-text="显示" :inactive-value="'none'" inactive-text="隐藏"
|
|
41
|
+
size="small"/>
|
|
42
|
+
</template>
|
|
43
|
+
</el-table-column>
|
|
26
44
|
<el-table-column label="操作" align="center">
|
|
27
45
|
<template #default="scope">
|
|
28
46
|
<el-button type="danger" size="small" @click="deleteItemBtnClick(scope.$index)">删除</el-button>
|
|
@@ -38,22 +56,26 @@
|
|
|
38
56
|
|
|
39
57
|
<script setup>
|
|
40
58
|
import {ref} from "vue";
|
|
41
|
-
import {directionList} from "packages/components/enums.js";
|
|
42
|
-
import {
|
|
59
|
+
import {ARROWBACKWORD, ARROWFORWARD, directionList, FLASHING, STOP} from "packages/components/enums.js";
|
|
60
|
+
import {defaultArrowCondition, defaultPipeCondition} from "packages/components/tools.js";
|
|
43
61
|
|
|
44
62
|
const props = defineProps({
|
|
45
63
|
payload: {
|
|
46
64
|
type: Array,
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
type: String,
|
|
47
68
|
}
|
|
48
69
|
})
|
|
49
70
|
|
|
71
|
+
|
|
50
72
|
const items = ref(props.payload)
|
|
51
73
|
|
|
52
74
|
/**
|
|
53
75
|
* 添加条件
|
|
54
76
|
*/
|
|
55
77
|
const addItemBtnClick = () => {
|
|
56
|
-
items.value.push(JSON.parse(JSON.stringify(
|
|
78
|
+
items.value.push(JSON.parse(JSON.stringify(props.type === 'pipe' ? defaultPipeCondition : defaultArrowCondition)))
|
|
57
79
|
}
|
|
58
80
|
|
|
59
81
|
/**
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @Author: HuaYJ
|
|
3
|
+
* @Date: 2025/4/9 09:21
|
|
4
|
+
*/
|
|
5
|
+
<template>
|
|
6
|
+
<div class="container">
|
|
7
|
+
<el-collapse v-model="activeName" accordion>
|
|
8
|
+
<el-collapse-item title="线段设置" name="0">
|
|
9
|
+
<div class="row-column">
|
|
10
|
+
<el-row :gutter="20">
|
|
11
|
+
<el-col :span="12">
|
|
12
|
+
<div class="row-label">颜色</div>
|
|
13
|
+
</el-col>
|
|
14
|
+
<el-col :span="12">
|
|
15
|
+
<el-color-picker v-model="stroke" :show-alpha="true" size="small" @change="changeLine"/>
|
|
16
|
+
</el-col>
|
|
17
|
+
</el-row>
|
|
18
|
+
<el-row :gutter="20">
|
|
19
|
+
<el-col :span="12">
|
|
20
|
+
<div class="row-label">粗细</div>
|
|
21
|
+
</el-col>
|
|
22
|
+
<el-col :span="12">
|
|
23
|
+
<el-input-number v-model="strokeWidth" size="small" controls-position="right" @change="changeLine" :min="1" :max="10"
|
|
24
|
+
:step="1"/>
|
|
25
|
+
</el-col>
|
|
26
|
+
</el-row>
|
|
27
|
+
</div>
|
|
28
|
+
</el-collapse-item>
|
|
29
|
+
<el-collapse-item title="箭头1设置" name="1">
|
|
30
|
+
<div class="row-column">
|
|
31
|
+
<el-row :gutter="20">
|
|
32
|
+
<el-col :span="12">
|
|
33
|
+
<div class="row-label">类型</div>
|
|
34
|
+
</el-col>
|
|
35
|
+
<el-col :span="12">
|
|
36
|
+
<el-select v-model="sourceMarker.name" placeholder="请选择箭头类型" clearable size="small" @change="changeLine">
|
|
37
|
+
<el-option v-for="item in arrowList" :key="item.value" :label="item.label" :value="item.value">
|
|
38
|
+
</el-option>
|
|
39
|
+
</el-select>
|
|
40
|
+
</el-col>
|
|
41
|
+
</el-row>
|
|
42
|
+
<el-row :gutter="20">
|
|
43
|
+
<el-col :span="12">
|
|
44
|
+
<div class="row-label">宽</div>
|
|
45
|
+
</el-col>
|
|
46
|
+
<el-col :span="12">
|
|
47
|
+
<el-input-number v-model="sourceMarker.args.width" size="small" controls-position="right" @change="changeLine" :min="0" :max="10"
|
|
48
|
+
:step="1"/>
|
|
49
|
+
</el-col>
|
|
50
|
+
</el-row>
|
|
51
|
+
<el-row :gutter="20">
|
|
52
|
+
<el-col :span="12">
|
|
53
|
+
<div class="row-label">高</div>
|
|
54
|
+
</el-col>
|
|
55
|
+
<el-col :span="12">
|
|
56
|
+
<el-input-number v-model="sourceMarker.args.height" size="small" controls-position="right" @change="changeLine" :min="0" :max="10"
|
|
57
|
+
:step="1"/>
|
|
58
|
+
</el-col>
|
|
59
|
+
</el-row>
|
|
60
|
+
<el-row :gutter="20">
|
|
61
|
+
<el-col :span="12">
|
|
62
|
+
<div class="row-label">偏移</div>
|
|
63
|
+
</el-col>
|
|
64
|
+
<el-col :span="12">
|
|
65
|
+
<el-input-number v-model="sourceMarker.args.offset" size="small" controls-position="right" @change="changeLine" :min="0" :max="10"
|
|
66
|
+
:step="1"/>
|
|
67
|
+
</el-col>
|
|
68
|
+
</el-row>
|
|
69
|
+
</div>
|
|
70
|
+
</el-collapse-item>
|
|
71
|
+
<el-collapse-item title="箭头2设置" name="2">
|
|
72
|
+
<div class="row-column">
|
|
73
|
+
<el-row :gutter="20">
|
|
74
|
+
<el-col :span="12">
|
|
75
|
+
<div class="row-label">类型</div>
|
|
76
|
+
</el-col>
|
|
77
|
+
<el-col :span="12">
|
|
78
|
+
<el-select v-model="targetMarker.name" placeholder="请选择箭头类型" clearable size="small" @change="changeLine">
|
|
79
|
+
<el-option v-for="item in arrowList" :key="item.value" :label="item.label" :value="item.value">
|
|
80
|
+
</el-option>
|
|
81
|
+
</el-select>
|
|
82
|
+
</el-col>
|
|
83
|
+
</el-row>
|
|
84
|
+
<el-row :gutter="20">
|
|
85
|
+
<el-col :span="12">
|
|
86
|
+
<div class="row-label">宽</div>
|
|
87
|
+
</el-col>
|
|
88
|
+
<el-col :span="12">
|
|
89
|
+
<el-input-number v-model="targetMarker.args.width" size="small" controls-position="right" @change="changeLine" :min="0" :max="10"
|
|
90
|
+
:step="1"/>
|
|
91
|
+
</el-col>
|
|
92
|
+
</el-row>
|
|
93
|
+
<el-row :gutter="20">
|
|
94
|
+
<el-col :span="12">
|
|
95
|
+
<div class="row-label">高</div>
|
|
96
|
+
</el-col>
|
|
97
|
+
<el-col :span="12">
|
|
98
|
+
<el-input-number v-model="targetMarker.args.height" size="small" controls-position="right" @change="changeLine" :min="0" :max="10"
|
|
99
|
+
:step="1"/>
|
|
100
|
+
</el-col>
|
|
101
|
+
</el-row>
|
|
102
|
+
<el-row :gutter="20">
|
|
103
|
+
<el-col :span="12">
|
|
104
|
+
<div class="row-label">偏移</div>
|
|
105
|
+
</el-col>
|
|
106
|
+
<el-col :span="12">
|
|
107
|
+
<el-input-number v-model="targetMarker.args.offset" size="small" controls-position="right" @change="changeLine" :min="0" :max="10"
|
|
108
|
+
:step="1"/>
|
|
109
|
+
</el-col>
|
|
110
|
+
</el-row>
|
|
111
|
+
</div>
|
|
112
|
+
</el-collapse-item>
|
|
113
|
+
</el-collapse>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<script setup>
|
|
118
|
+
import {reactive, ref} from "vue";
|
|
119
|
+
import {lineOptions} from "packages/components/settings.js";
|
|
120
|
+
import {arrowList} from "packages/components/enums.js";
|
|
121
|
+
|
|
122
|
+
const props = defineProps({
|
|
123
|
+
payload: Object
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const activeName = ref('0')
|
|
127
|
+
|
|
128
|
+
const stroke = ref(props.payload.attrs.line.stroke) // 线段颜色
|
|
129
|
+
const strokeWidth = ref(props.payload.attrs.line.strokeWidth) // 线段粗细
|
|
130
|
+
const sourceMarker = reactive({
|
|
131
|
+
name: props.payload.attrs.line.sourceMarker?.name ?? null,
|
|
132
|
+
args: props.payload.attrs.line.sourceMarker?.args ?? {}
|
|
133
|
+
})
|
|
134
|
+
const targetMarker = reactive({
|
|
135
|
+
name: props.payload.attrs.line.targetMarker?.name ?? null,
|
|
136
|
+
args: props.payload.attrs.line.targetMarker?.args ?? {}
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 改变线段属性
|
|
141
|
+
*/
|
|
142
|
+
const changeLine = () => {
|
|
143
|
+
props.payload.attr('line/stroke', stroke.value)
|
|
144
|
+
props.payload.attr('line/strokeWidth', strokeWidth.value)
|
|
145
|
+
props.payload.attr('line/sourceMarker/name', sourceMarker.name)
|
|
146
|
+
props.payload.attr('line/sourceMarker/args', sourceMarker.args)
|
|
147
|
+
props.payload.attr('line/targetMarker/name', targetMarker.name)
|
|
148
|
+
props.payload.attr('line/targetMarker/args', targetMarker.args)
|
|
149
|
+
lineOptions.markup = props.payload.markup
|
|
150
|
+
lineOptions.attrs = props.payload.attrs
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<style scoped lang="scss">
|
|
155
|
+
@use "../../styles/editor.scss";
|
|
156
|
+
</style>
|