vue-wiring-diagram 1.1.24 → 1.1.26

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.
Files changed (32) hide show
  1. package/README.md +93 -93
  2. package/dist/style.css +1 -1
  3. package/dist/vue-wiring-diagram.es.js +4501 -4488
  4. package/dist/vue-wiring-diagram.umd.js +35 -35
  5. package/package.json +1 -1
  6. package/packages/components/Shortcuts.vue +31 -31
  7. package/packages/components/baseShape.js +62 -62
  8. package/packages/components/common.js +105 -105
  9. package/packages/components/edge-control/arrow-line.vue +292 -292
  10. package/packages/components/edge-control/condition.vue +110 -110
  11. package/packages/components/edge-control/default-line.vue +156 -156
  12. package/packages/components/edge-control/index.vue +94 -94
  13. package/packages/components/edge-control/pipe-line.vue +354 -354
  14. package/packages/components/editor/index.vue +590 -590
  15. package/packages/components/enums.js +80 -80
  16. package/packages/components/graph-control/index.vue +121 -121
  17. package/packages/components/image-control/group-form.vue +114 -114
  18. package/packages/components/image-control/image-condition.vue +117 -117
  19. package/packages/components/image-control/image-form.vue +184 -184
  20. package/packages/components/image-control/image-management.vue +213 -213
  21. package/packages/components/image-control/index.vue +290 -290
  22. package/packages/components/portsOptions.js +21 -21
  23. package/packages/components/preview/index.vue +399 -399
  24. package/packages/components/settings.js +262 -262
  25. package/packages/components/text-control/index.vue +472 -457
  26. package/packages/components/tools.js +256 -256
  27. package/packages/http.js +104 -104
  28. package/packages/index.js +43 -43
  29. package/packages/styles/animation.scss +27 -27
  30. package/packages/styles/dialog.scss +4 -4
  31. package/packages/styles/editor.scss +165 -165
  32. package/packages/styles/elPath.scss +257 -257
@@ -1,354 +1,354 @@
1
- /**
2
- * @Author: HuaYJ
3
- * @Date: 2024/10/24 09:42
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">颜色1</div>
13
- </el-col>
14
- <el-col :span="12">
15
- <el-color-picker v-model="stroke1" :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">颜色2</div>
21
- </el-col>
22
- <el-col :span="12">
23
- <el-color-picker v-model="stroke2" :show-alpha="true" size="small" @change="changeLine"/>
24
- </el-col>
25
- </el-row>
26
- <el-row :gutter="20">
27
- <el-col :span="12">
28
- <div class="row-label">粗细</div>
29
- </el-col>
30
- <el-col :span="12">
31
- <el-input-number v-model="strokeWidth" size="small" controls-position="right"
32
- @change="changeLine" :min="1" :max="10"
33
- :step="1"/>
34
- </el-col>
35
- </el-row>
36
- </div>
37
- </el-collapse-item>
38
- <el-collapse-item title="管道设置" name="1">
39
- <div class="row-column">
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-input-number v-model="strokeDasharray" size="small" controls-position="right"
46
- @change="changeLine" :min="5" :max="100"
47
- :step="1"/>
48
- </el-col>
49
- </el-row>
50
- <el-row :gutter="20">
51
- <el-col :span="12">
52
- <div class="row-label">默认流动方向</div>
53
- </el-col>
54
- <el-col :span="12">
55
- <el-select v-model="strokeDashoffset" placeholder="请选择管道方向" size="small"
56
- @change="changeLine">
57
- <el-option v-for="item in directionList" :key="item.value" :label="item.label"
58
- :value="item.value">
59
- </el-option>
60
- </el-select>
61
- </el-col>
62
- </el-row>
63
- <el-row :gutter="20">
64
- <el-col :span="12">
65
- <div class="row-label">参数设置</div>
66
- </el-col>
67
- <el-col :span="12">
68
- <el-select v-model="deviceCode" placeholder="请选择设备" @change="checkDevice" size="small"
69
- filterable clearable>
70
- <el-option v-for="item in deviceList" :key="item.deviceCode" :label="item.deviceName"
71
- :value="item.deviceCode"/>
72
- </el-select>
73
- <el-select v-model="fieldCode" placeholder="请选择字段" @change="checkField" size="small"
74
- filterable clearable style="margin-top: 10px">
75
- <el-option v-for="item in fieldList" :key="item.dataField" :label="item.name"
76
- :value="item.dataField"/>
77
- </el-select>
78
- </el-col>
79
- </el-row>
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-switch v-model="isCondition" :active-value="true" :inactive-value="false" size="small"
86
- @change="changeCondition"/>
87
- <el-button type="primary" size="small" @click="showCondition" style="margin-left: 10px">
88
- 配置
89
- </el-button>
90
- </el-col>
91
- </el-row>
92
- </div>
93
- </el-collapse-item>
94
- <el-collapse-item title="箭头1设置" name="2">
95
- <div class="row-column">
96
- <el-row :gutter="20">
97
- <el-col :span="12">
98
- <div class="row-label">类型</div>
99
- </el-col>
100
- <el-col :span="12">
101
- <el-select v-model="sourceMarker.name" placeholder="请选择箭头类型" clearable size="small"
102
- @change="changeLine">
103
- <el-option v-for="item in arrowList" :key="item.value" :label="item.label"
104
- :value="item.value">
105
- </el-option>
106
- </el-select>
107
- </el-col>
108
- </el-row>
109
- <el-row :gutter="20">
110
- <el-col :span="12">
111
- <div class="row-label">宽</div>
112
- </el-col>
113
- <el-col :span="12">
114
- <el-input-number v-model="sourceMarker.args.width" size="small" controls-position="right"
115
- @change="changeLine" :min="0" :max="10"
116
- :step="1"/>
117
- </el-col>
118
- </el-row>
119
- <el-row :gutter="20">
120
- <el-col :span="12">
121
- <div class="row-label">高</div>
122
- </el-col>
123
- <el-col :span="12">
124
- <el-input-number v-model="sourceMarker.args.height" size="small" controls-position="right"
125
- @change="changeLine" :min="0" :max="10"
126
- :step="1"/>
127
- </el-col>
128
- </el-row>
129
- <el-row :gutter="20">
130
- <el-col :span="12">
131
- <div class="row-label">偏移</div>
132
- </el-col>
133
- <el-col :span="12">
134
- <el-input-number v-model="sourceMarker.args.offset" size="small" controls-position="right"
135
- @change="changeLine" :min="0" :max="10"
136
- :step="1"/>
137
- </el-col>
138
- </el-row>
139
- </div>
140
- </el-collapse-item>
141
- <el-collapse-item title="箭头2设置" name="3">
142
- <div class="row-column">
143
- <el-row :gutter="20">
144
- <el-col :span="12">
145
- <div class="row-label">类型</div>
146
- </el-col>
147
- <el-col :span="12">
148
- <el-select v-model="targetMarker.name" placeholder="请选择箭头类型" clearable size="small"
149
- @change="changeLine">
150
- <el-option v-for="item in arrowList" :key="item.value" :label="item.label"
151
- :value="item.value">
152
- </el-option>
153
- </el-select>
154
- </el-col>
155
- </el-row>
156
- <el-row :gutter="20">
157
- <el-col :span="12">
158
- <div class="row-label">宽</div>
159
- </el-col>
160
- <el-col :span="12">
161
- <el-input-number v-model="targetMarker.args.width" size="small" controls-position="right"
162
- @change="changeLine" :min="0" :max="10"
163
- :step="1"/>
164
- </el-col>
165
- </el-row>
166
- <el-row :gutter="20">
167
- <el-col :span="12">
168
- <div class="row-label">高</div>
169
- </el-col>
170
- <el-col :span="12">
171
- <el-input-number v-model="targetMarker.args.height" size="small" controls-position="right"
172
- @change="changeLine" :min="0" :max="10"
173
- :step="1"/>
174
- </el-col>
175
- </el-row>
176
- <el-row :gutter="20">
177
- <el-col :span="12">
178
- <div class="row-label">偏移</div>
179
- </el-col>
180
- <el-col :span="12">
181
- <el-input-number v-model="targetMarker.args.offset" size="small" controls-position="right"
182
- @change="changeLine" :min="0" :max="10"
183
- :step="1"/>
184
- </el-col>
185
- </el-row>
186
- </div>
187
- </el-collapse-item>
188
- </el-collapse>
189
- <el-dialog v-model="dialogCondition.show" width="500px" title="条件配置" :show-close="false"
190
- :close-on-click-modal="false"
191
- :close-on-press-escape="false">
192
- <condition v-if="dialogCondition.show" :payload="dialogCondition.payload" type="pipe"
193
- @close="closeCondition"></condition>
194
- </el-dialog>
195
- </div>
196
- </template>
197
-
198
- <script setup>
199
- import {onMounted, reactive, ref} from "vue";
200
- import {lineOptions} from "../settings.js";
201
- import {setPipeDirection} from "packages/components/tools.js";
202
- import {arrowList, directionList, STOP, typeList} from "packages/components/enums.js";
203
- import Condition from "packages/components/edge-control/condition.vue";
204
- import {getDeviceList, getFieldList} from "packages/components/common.js";
205
-
206
- const props = defineProps({
207
- payload: Object,
208
- itemId: {
209
- type: String,
210
- default: ''
211
- }
212
- })
213
-
214
- const activeName = ref('0')
215
-
216
- const stroke1 = ref(props.payload.attrs.line.stroke)
217
- const stroke2 = ref(props.payload.attrs.pipe.stroke)
218
- const strokeWidth = ref(props.payload.attrs.line.strokeWidth)
219
- const strokeDasharray = ref(props.payload.attrs.pipe.strokeDasharray)
220
- const strokeDashoffset = ref(props.payload.attrs.pipe?.style?.animation.split(' ')[0] ?? STOP)
221
- const sourceMarker = reactive({
222
- name: props.payload.attrs.pipe.sourceMarker?.name ?? null,
223
- args: props.payload.attrs.pipe.sourceMarker?.args ?? {}
224
- })
225
- const targetMarker = reactive({
226
- name: props.payload.attrs.pipe.targetMarker?.name ?? null,
227
- args: props.payload.attrs.pipe.targetMarker?.args ?? {}
228
- })
229
-
230
- /**
231
- * 线段属性改变
232
- */
233
- const changeLine = () => {
234
- props.payload.attr('line/stroke', stroke1.value)
235
- props.payload.attr('pipe/stroke', stroke2.value)
236
- props.payload.attr('line/strokeWidth', strokeWidth.value)
237
- props.payload.attr('pipe/strokeWidth', strokeWidth.value)
238
- props.payload.attr('pipe/strokeDasharray', strokeDasharray.value)
239
- props.payload.attr('pipe/sourceMarker/name', sourceMarker.name)
240
- props.payload.attr('pipe/sourceMarker/args', sourceMarker.args)
241
- props.payload.attr('pipe/targetMarker/name', targetMarker.name)
242
- props.payload.attr('pipe/targetMarker/args', targetMarker.args)
243
- props.payload.attr('pipe/style/animation', setPipeDirection(strokeDashoffset.value))
244
- lineOptions.markup = props.payload.markup
245
- lineOptions.attrs = props.payload.attrs
246
- console.log('线-基础配置', lineOptions)
247
- console.log('线-当前配置', props.payload)
248
- }
249
-
250
- // 条件线是否开启
251
- const isCondition = ref(props.payload.data.isCondition ?? false)
252
-
253
- /**
254
- * 条件线改变
255
- */
256
- const changeCondition = () => {
257
- props.payload.data.isCondition = isCondition.value
258
- }
259
-
260
- // 条件线配置
261
- const dialogCondition = reactive({
262
- show: false,
263
- payload: null
264
- })
265
-
266
- /**
267
- * 条件线配置显示
268
- */
269
- const showCondition = () => {
270
- dialogCondition.show = true
271
- dialogCondition.payload = props.payload.data.condition ?? []
272
- }
273
-
274
- /**
275
- * 条件线配置关闭
276
- * @param condition
277
- */
278
- const closeCondition = (condition) => {
279
- dialogCondition.show = false
280
- dialogCondition.payload = null
281
- if (condition) {
282
- props.payload.data.condition = condition
283
- }
284
- console.log('条件线', props.payload.data)
285
- }
286
-
287
- const deviceList = ref([]) // 设备列表
288
- const deviceCode = ref(props.payload.data?.fields?.[0]?.deviceCode ?? '') // 设备编码
289
- const fieldCode = ref(props.payload.data?.fields?.[0]?.field ?? '') // 字段编码
290
-
291
- /**
292
- * 获取设备列表
293
- */
294
- const getDevices = async () => {
295
- deviceList.value = await getDeviceList(props.itemId)
296
- if (deviceCode.value) {
297
- checkDevice()
298
- }
299
- }
300
-
301
- let currentDevice = reactive({}) // 当前设备信息
302
-
303
- /**
304
- * 监听设备编码变化
305
- */
306
- const checkDevice = () => {
307
- currentDevice = deviceList.value.find(item => item.deviceCode === deviceCode.value)
308
- if (currentDevice) {
309
- getFields()
310
- props.payload.data.fields = [{
311
- index: 0,
312
- deviceName: currentDevice.deviceName,
313
- deviceCode: currentDevice.deviceCode,
314
- field: fieldCode.value ?? '',
315
- }]
316
- fieldCode.value = props.payload.data.fields[0].field
317
- } else {
318
- fieldCode.value = ''
319
- props.payload.data.fields = []
320
- }
321
- console.log('管道配置', props.payload)
322
- }
323
-
324
- const fieldList = ref([])
325
-
326
- /**
327
- * 获取字段列表
328
- */
329
- const getFields = async () => {
330
- fieldList.value = await getFieldList(currentDevice.deviceCode)
331
- }
332
-
333
- /**
334
- * 监听字段编码变化
335
- */
336
- const checkField = () => {
337
- props.payload.data.fields = [{
338
- index: 0,
339
- deviceName: currentDevice.deviceName,
340
- deviceCode: currentDevice.deviceCode,
341
- field: fieldCode.value ?? '',
342
- }]
343
- console.log('管道配置', props.payload)
344
- }
345
-
346
- onMounted(() => {
347
- getDevices()
348
- })
349
- </script>
350
-
351
- <style scoped lang="scss">
352
- @use "../../styles/editor.scss";
353
-
354
- </style>
1
+ /**
2
+ * @Author: HuaYJ
3
+ * @Date: 2024/10/24 09:42
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">颜色1</div>
13
+ </el-col>
14
+ <el-col :span="12">
15
+ <el-color-picker v-model="stroke1" :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">颜色2</div>
21
+ </el-col>
22
+ <el-col :span="12">
23
+ <el-color-picker v-model="stroke2" :show-alpha="true" size="small" @change="changeLine"/>
24
+ </el-col>
25
+ </el-row>
26
+ <el-row :gutter="20">
27
+ <el-col :span="12">
28
+ <div class="row-label">粗细</div>
29
+ </el-col>
30
+ <el-col :span="12">
31
+ <el-input-number v-model="strokeWidth" size="small" controls-position="right"
32
+ @change="changeLine" :min="1" :max="10"
33
+ :step="1"/>
34
+ </el-col>
35
+ </el-row>
36
+ </div>
37
+ </el-collapse-item>
38
+ <el-collapse-item title="管道设置" name="1">
39
+ <div class="row-column">
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-input-number v-model="strokeDasharray" size="small" controls-position="right"
46
+ @change="changeLine" :min="5" :max="100"
47
+ :step="1"/>
48
+ </el-col>
49
+ </el-row>
50
+ <el-row :gutter="20">
51
+ <el-col :span="12">
52
+ <div class="row-label">默认流动方向</div>
53
+ </el-col>
54
+ <el-col :span="12">
55
+ <el-select v-model="strokeDashoffset" placeholder="请选择管道方向" size="small"
56
+ @change="changeLine">
57
+ <el-option v-for="item in directionList" :key="item.value" :label="item.label"
58
+ :value="item.value">
59
+ </el-option>
60
+ </el-select>
61
+ </el-col>
62
+ </el-row>
63
+ <el-row :gutter="20">
64
+ <el-col :span="12">
65
+ <div class="row-label">参数设置</div>
66
+ </el-col>
67
+ <el-col :span="12">
68
+ <el-select v-model="deviceCode" placeholder="请选择设备" @change="checkDevice" size="small"
69
+ filterable clearable>
70
+ <el-option v-for="item in deviceList" :key="item.deviceCode" :label="item.deviceName"
71
+ :value="item.deviceCode"/>
72
+ </el-select>
73
+ <el-select v-model="fieldCode" placeholder="请选择字段" @change="checkField" size="small"
74
+ filterable clearable style="margin-top: 10px">
75
+ <el-option v-for="item in fieldList" :key="item.dataField" :label="item.name"
76
+ :value="item.dataField"/>
77
+ </el-select>
78
+ </el-col>
79
+ </el-row>
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-switch v-model="isCondition" :active-value="true" :inactive-value="false" size="small"
86
+ @change="changeCondition"/>
87
+ <el-button type="primary" size="small" @click="showCondition" style="margin-left: 10px">
88
+ 配置
89
+ </el-button>
90
+ </el-col>
91
+ </el-row>
92
+ </div>
93
+ </el-collapse-item>
94
+ <el-collapse-item title="箭头1设置" name="2">
95
+ <div class="row-column">
96
+ <el-row :gutter="20">
97
+ <el-col :span="12">
98
+ <div class="row-label">类型</div>
99
+ </el-col>
100
+ <el-col :span="12">
101
+ <el-select v-model="sourceMarker.name" placeholder="请选择箭头类型" clearable size="small"
102
+ @change="changeLine">
103
+ <el-option v-for="item in arrowList" :key="item.value" :label="item.label"
104
+ :value="item.value">
105
+ </el-option>
106
+ </el-select>
107
+ </el-col>
108
+ </el-row>
109
+ <el-row :gutter="20">
110
+ <el-col :span="12">
111
+ <div class="row-label">宽</div>
112
+ </el-col>
113
+ <el-col :span="12">
114
+ <el-input-number v-model="sourceMarker.args.width" size="small" controls-position="right"
115
+ @change="changeLine" :min="0" :max="10"
116
+ :step="1"/>
117
+ </el-col>
118
+ </el-row>
119
+ <el-row :gutter="20">
120
+ <el-col :span="12">
121
+ <div class="row-label">高</div>
122
+ </el-col>
123
+ <el-col :span="12">
124
+ <el-input-number v-model="sourceMarker.args.height" size="small" controls-position="right"
125
+ @change="changeLine" :min="0" :max="10"
126
+ :step="1"/>
127
+ </el-col>
128
+ </el-row>
129
+ <el-row :gutter="20">
130
+ <el-col :span="12">
131
+ <div class="row-label">偏移</div>
132
+ </el-col>
133
+ <el-col :span="12">
134
+ <el-input-number v-model="sourceMarker.args.offset" size="small" controls-position="right"
135
+ @change="changeLine" :min="0" :max="10"
136
+ :step="1"/>
137
+ </el-col>
138
+ </el-row>
139
+ </div>
140
+ </el-collapse-item>
141
+ <el-collapse-item title="箭头2设置" name="3">
142
+ <div class="row-column">
143
+ <el-row :gutter="20">
144
+ <el-col :span="12">
145
+ <div class="row-label">类型</div>
146
+ </el-col>
147
+ <el-col :span="12">
148
+ <el-select v-model="targetMarker.name" placeholder="请选择箭头类型" clearable size="small"
149
+ @change="changeLine">
150
+ <el-option v-for="item in arrowList" :key="item.value" :label="item.label"
151
+ :value="item.value">
152
+ </el-option>
153
+ </el-select>
154
+ </el-col>
155
+ </el-row>
156
+ <el-row :gutter="20">
157
+ <el-col :span="12">
158
+ <div class="row-label">宽</div>
159
+ </el-col>
160
+ <el-col :span="12">
161
+ <el-input-number v-model="targetMarker.args.width" size="small" controls-position="right"
162
+ @change="changeLine" :min="0" :max="10"
163
+ :step="1"/>
164
+ </el-col>
165
+ </el-row>
166
+ <el-row :gutter="20">
167
+ <el-col :span="12">
168
+ <div class="row-label">高</div>
169
+ </el-col>
170
+ <el-col :span="12">
171
+ <el-input-number v-model="targetMarker.args.height" size="small" controls-position="right"
172
+ @change="changeLine" :min="0" :max="10"
173
+ :step="1"/>
174
+ </el-col>
175
+ </el-row>
176
+ <el-row :gutter="20">
177
+ <el-col :span="12">
178
+ <div class="row-label">偏移</div>
179
+ </el-col>
180
+ <el-col :span="12">
181
+ <el-input-number v-model="targetMarker.args.offset" size="small" controls-position="right"
182
+ @change="changeLine" :min="0" :max="10"
183
+ :step="1"/>
184
+ </el-col>
185
+ </el-row>
186
+ </div>
187
+ </el-collapse-item>
188
+ </el-collapse>
189
+ <el-dialog v-model="dialogCondition.show" width="500px" title="条件配置" :show-close="false"
190
+ :close-on-click-modal="false"
191
+ :close-on-press-escape="false">
192
+ <condition v-if="dialogCondition.show" :payload="dialogCondition.payload" type="pipe"
193
+ @close="closeCondition"></condition>
194
+ </el-dialog>
195
+ </div>
196
+ </template>
197
+
198
+ <script setup>
199
+ import {onMounted, reactive, ref} from "vue";
200
+ import {lineOptions} from "../settings.js";
201
+ import {setPipeDirection} from "packages/components/tools.js";
202
+ import {arrowList, directionList, STOP, typeList} from "packages/components/enums.js";
203
+ import Condition from "packages/components/edge-control/condition.vue";
204
+ import {getDeviceList, getFieldList} from "packages/components/common.js";
205
+
206
+ const props = defineProps({
207
+ payload: Object,
208
+ itemId: {
209
+ type: String,
210
+ default: ''
211
+ }
212
+ })
213
+
214
+ const activeName = ref('0')
215
+
216
+ const stroke1 = ref(props.payload.attrs.line.stroke)
217
+ const stroke2 = ref(props.payload.attrs.pipe.stroke)
218
+ const strokeWidth = ref(props.payload.attrs.line.strokeWidth)
219
+ const strokeDasharray = ref(props.payload.attrs.pipe.strokeDasharray)
220
+ const strokeDashoffset = ref(props.payload.attrs.pipe?.style?.animation.split(' ')[0] ?? STOP)
221
+ const sourceMarker = reactive({
222
+ name: props.payload.attrs.pipe.sourceMarker?.name ?? null,
223
+ args: props.payload.attrs.pipe.sourceMarker?.args ?? {}
224
+ })
225
+ const targetMarker = reactive({
226
+ name: props.payload.attrs.pipe.targetMarker?.name ?? null,
227
+ args: props.payload.attrs.pipe.targetMarker?.args ?? {}
228
+ })
229
+
230
+ /**
231
+ * 线段属性改变
232
+ */
233
+ const changeLine = () => {
234
+ props.payload.attr('line/stroke', stroke1.value)
235
+ props.payload.attr('pipe/stroke', stroke2.value)
236
+ props.payload.attr('line/strokeWidth', strokeWidth.value)
237
+ props.payload.attr('pipe/strokeWidth', strokeWidth.value)
238
+ props.payload.attr('pipe/strokeDasharray', strokeDasharray.value)
239
+ props.payload.attr('pipe/sourceMarker/name', sourceMarker.name)
240
+ props.payload.attr('pipe/sourceMarker/args', sourceMarker.args)
241
+ props.payload.attr('pipe/targetMarker/name', targetMarker.name)
242
+ props.payload.attr('pipe/targetMarker/args', targetMarker.args)
243
+ props.payload.attr('pipe/style/animation', setPipeDirection(strokeDashoffset.value))
244
+ lineOptions.markup = props.payload.markup
245
+ lineOptions.attrs = props.payload.attrs
246
+ console.log('线-基础配置', lineOptions)
247
+ console.log('线-当前配置', props.payload)
248
+ }
249
+
250
+ // 条件线是否开启
251
+ const isCondition = ref(props.payload.data.isCondition ?? false)
252
+
253
+ /**
254
+ * 条件线改变
255
+ */
256
+ const changeCondition = () => {
257
+ props.payload.data.isCondition = isCondition.value
258
+ }
259
+
260
+ // 条件线配置
261
+ const dialogCondition = reactive({
262
+ show: false,
263
+ payload: null
264
+ })
265
+
266
+ /**
267
+ * 条件线配置显示
268
+ */
269
+ const showCondition = () => {
270
+ dialogCondition.show = true
271
+ dialogCondition.payload = props.payload.data.condition ?? []
272
+ }
273
+
274
+ /**
275
+ * 条件线配置关闭
276
+ * @param condition
277
+ */
278
+ const closeCondition = (condition) => {
279
+ dialogCondition.show = false
280
+ dialogCondition.payload = null
281
+ if (condition) {
282
+ props.payload.data.condition = condition
283
+ }
284
+ console.log('条件线', props.payload.data)
285
+ }
286
+
287
+ const deviceList = ref([]) // 设备列表
288
+ const deviceCode = ref(props.payload.data?.fields?.[0]?.deviceCode ?? '') // 设备编码
289
+ const fieldCode = ref(props.payload.data?.fields?.[0]?.field ?? '') // 字段编码
290
+
291
+ /**
292
+ * 获取设备列表
293
+ */
294
+ const getDevices = async () => {
295
+ deviceList.value = await getDeviceList(props.itemId)
296
+ if (deviceCode.value) {
297
+ checkDevice()
298
+ }
299
+ }
300
+
301
+ let currentDevice = reactive({}) // 当前设备信息
302
+
303
+ /**
304
+ * 监听设备编码变化
305
+ */
306
+ const checkDevice = () => {
307
+ currentDevice = deviceList.value.find(item => item.deviceCode === deviceCode.value)
308
+ if (currentDevice) {
309
+ getFields()
310
+ props.payload.data.fields = [{
311
+ index: 0,
312
+ deviceName: currentDevice.deviceName,
313
+ deviceCode: currentDevice.deviceCode,
314
+ field: fieldCode.value ?? '',
315
+ }]
316
+ fieldCode.value = props.payload.data.fields[0].field
317
+ } else {
318
+ fieldCode.value = ''
319
+ props.payload.data.fields = []
320
+ }
321
+ console.log('管道配置', props.payload)
322
+ }
323
+
324
+ const fieldList = ref([])
325
+
326
+ /**
327
+ * 获取字段列表
328
+ */
329
+ const getFields = async () => {
330
+ fieldList.value = await getFieldList(currentDevice.deviceCode)
331
+ }
332
+
333
+ /**
334
+ * 监听字段编码变化
335
+ */
336
+ const checkField = () => {
337
+ props.payload.data.fields = [{
338
+ index: 0,
339
+ deviceName: currentDevice.deviceName,
340
+ deviceCode: currentDevice.deviceCode,
341
+ field: fieldCode.value ?? '',
342
+ }]
343
+ console.log('管道配置', props.payload)
344
+ }
345
+
346
+ onMounted(() => {
347
+ getDevices()
348
+ })
349
+ </script>
350
+
351
+ <style scoped lang="scss">
352
+ @use "../../styles/editor.scss";
353
+
354
+ </style>