@zhangqingcq/vgce 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -1
- package/dist/vgce.js +5 -12
- package/dist/vgce.umd.cjs +2 -2
- package/package.json +3 -2
- package/src/App.vue +11 -0
- package/src/assets/base.less +49 -0
- package/src/assets/icons/add.svg +1 -0
- package/src/assets/icons/delete.svg +12 -0
- package/src/assets/icons/export.svg +1 -0
- package/src/assets/icons/group.svg +13 -0
- package/src/assets/icons/import.svg +1 -0
- package/src/assets/icons/lock.svg +7 -0
- package/src/assets/icons/menu-fold.svg +9 -0
- package/src/assets/icons/menu-unfold.svg +9 -0
- package/src/assets/icons/preview.svg +6 -0
- package/src/assets/icons/redo.svg +8 -0
- package/src/assets/icons/return.svg +8 -0
- package/src/assets/icons/rotate.svg +1 -0
- package/src/assets/icons/save.svg +9 -0
- package/src/assets/icons/setting.svg +6 -0
- package/src/assets/icons/undo.svg +7 -0
- package/src/assets/icons/ungroup.svg +16 -0
- package/src/assets/icons/unlock.svg +7 -0
- package/src/assets/main.less +6 -0
- package/src/assets/svgs/alternator.svg +8 -0
- package/src/assets/svgs/bot-12.svg +1 -0
- package/src/assets/svgs/bot-2.svg +1 -0
- package/src/assets/svgs/bot-3.svg +1 -0
- package/src/assets/svgs/bot-7.svg +1 -0
- package/src/assets/svgs/bot-9.svg +94 -0
- package/src/assets/svgs/car.svg +1 -0
- package/src/assets/svgs/circuit-breaker.svg +11 -0
- package/src/assets/svgs/clock-a.svg +23 -0
- package/src/assets/svgs/common-table.svg +7 -0
- package/src/assets/svgs/el-button.svg +10 -0
- package/src/assets/svgs/el-tag.svg +13 -0
- package/src/assets/svgs/hospital.svg +1 -0
- package/src/assets/svgs/house.svg +1 -0
- package/src/assets/svgs/light.svg +24 -0
- package/src/assets/svgs/now-time.svg +9 -0
- package/src/assets/svgs/package.svg +1 -0
- package/src/assets/svgs/pie-charts.svg +10 -0
- package/src/assets/svgs/progress-a.svg +1 -0
- package/src/assets/svgs/reservoir.svg +10 -0
- package/src/assets/svgs/svg-text.svg +5 -0
- package/src/assets/svgs/switch-a.svg +5 -0
- package/src/assets/svgs/traction-transformer.svg +11 -0
- package/src/components/ace-edit/index.ts +27 -0
- package/src/components/config/index.ts +450 -0
- package/src/components/config/types.ts +25 -0
- package/src/components/svg-analysis/index.vue +11 -0
- package/src/components/svg-editor/center-panel/index.vue +867 -0
- package/src/components/svg-editor/center-panel/types.ts +11 -0
- package/src/components/svg-editor/component-tree/index.vue +33 -0
- package/src/components/svg-editor/connection-line/index.vue +125 -0
- package/src/components/svg-editor/connection-panel/index.vue +198 -0
- package/src/components/svg-editor/export-json/index.vue +37 -0
- package/src/components/svg-editor/handle-panel/index.vue +342 -0
- package/src/components/svg-editor/import-json/index.vue +37 -0
- package/src/components/svg-editor/index.vue +280 -0
- package/src/components/svg-editor/left-panel/index.vue +83 -0
- package/src/components/svg-editor/right-panel/code-edit-modal.vue +50 -0
- package/src/components/svg-editor/right-panel/common-animate.vue +96 -0
- package/src/components/svg-editor/right-panel/condition.vue +101 -0
- package/src/components/svg-editor/right-panel/dynamic-el-form-item.vue +97 -0
- package/src/components/svg-editor/right-panel/index.vue +304 -0
- package/src/components/svg-editor/right-panel/list.vue +86 -0
- package/src/components/svg-editor/top-panel/index.vue +139 -0
- package/src/components/svg-editor/types.ts +22 -0
- package/src/components/svg-viewer/index.vue +340 -0
- package/src/components/vue3-ruler-tool/index.vue +506 -0
- package/src/config/files/clock-a.vue +66 -0
- package/src/config/files/common-table.vue +49 -0
- package/src/config/files/light-a.vue +72 -0
- package/src/config/files/now-time.vue +53 -0
- package/src/config/files/pie-charts.vue +72 -0
- package/src/config/files/progress.vue +40 -0
- package/src/config/files/svg-text.vue +39 -0
- package/src/config/files/switch-a.vue +45 -0
- package/src/config/index.ts +28 -0
- package/src/config/svg/animation/index.ts +8 -0
- package/src/config/svg/animation/reservoir.ts +32 -0
- package/src/config/svg/custom/clock-a.ts +23 -0
- package/src/config/svg/custom/index.ts +11 -0
- package/src/config/svg/custom/light.ts +29 -0
- package/src/config/svg/custom/svg-text.ts +54 -0
- package/src/config/svg/custom/switch-a.ts +29 -0
- package/src/config/svg/index.ts +12 -0
- package/src/config/svg/stateful/circuit-breaker.ts +38 -0
- package/src/config/svg/stateful/index.ts +8 -0
- package/src/config/svg/stateless/alternator.ts +28 -0
- package/src/config/svg/stateless/bot-12.ts +22 -0
- package/src/config/svg/stateless/bot-2.ts +22 -0
- package/src/config/svg/stateless/bot-3.ts +22 -0
- package/src/config/svg/stateless/bot-7.ts +22 -0
- package/src/config/svg/stateless/bot-9.ts +22 -0
- package/src/config/svg/stateless/car.ts +22 -0
- package/src/config/svg/stateless/hospital.ts +22 -0
- package/src/config/svg/stateless/house.ts +22 -0
- package/src/config/svg/stateless/index.ts +30 -0
- package/src/config/svg/stateless/package.ts +22 -0
- package/src/config/svg/stateless/traction-transformer.ts +28 -0
- package/src/config/types.ts +126 -0
- package/src/config/vue/component/button.ts +57 -0
- package/src/config/vue/component/common-table.ts +124 -0
- package/src/config/vue/component/index.ts +13 -0
- package/src/config/vue/component/now-time.ts +29 -0
- package/src/config/vue/component/progress.ts +29 -0
- package/src/config/vue/component/tag.ts +46 -0
- package/src/config/vue/echarts/index.ts +8 -0
- package/src/config/vue/echarts/pie-charts.ts +60 -0
- package/src/config/vue/index.ts +5 -0
- package/src/hooks.ts +47 -0
- package/src/index.ts +14 -0
- package/src/main.ts +15 -0
- package/src/router.ts +24 -0
- package/src/stores/config/index.ts +44 -0
- package/src/stores/config/types.ts +27 -0
- package/src/stores/global/index.ts +109 -0
- package/src/stores/global/types.ts +115 -0
- package/src/stores/main.ts +10 -0
- package/src/stores/svg-edit-layout/index.ts +17 -0
- package/src/stores/svg-edit-layout/types.ts +8 -0
- package/src/stores/system/index.ts +174 -0
- package/src/stores/system/types.ts +43 -0
- package/src/utils/fetch.ts +351 -0
- package/src/utils/file-read-write.ts +26 -0
- package/src/utils/index.ts +397 -0
- package/src/utils/mqtt-net.ts +48 -0
- package/src/utils/proxy.ts +7 -0
- package/src/utils/scale-core.ts +214 -0
- package/src/utils/types.ts +13 -0
- package/src/views/EditorS.vue +18 -0
- package/src/views/Preview.vue +12 -0
@@ -0,0 +1,304 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import {
|
3
|
+
ElCollapse,
|
4
|
+
ElCollapseItem,
|
5
|
+
ElColorPicker,
|
6
|
+
ElForm,
|
7
|
+
ElFormItem,
|
8
|
+
ElIcon,
|
9
|
+
ElInput,
|
10
|
+
ElInputNumber,
|
11
|
+
ElOption,
|
12
|
+
ElSelect,
|
13
|
+
ElSwitch,
|
14
|
+
ElTabPane,
|
15
|
+
ElTabs
|
16
|
+
} from 'element-plus'
|
17
|
+
import { ref } from 'vue'
|
18
|
+
import { pinia } from '@/hooks'
|
19
|
+
import { useConfigStore } from '@/stores/config'
|
20
|
+
import { useGlobalStore } from '@/stores/global'
|
21
|
+
import { numberArray } from '@/utils'
|
22
|
+
import { EGlobalStoreIntention } from '@/stores/global/types'
|
23
|
+
import type { IDoneJson } from '@/stores/global/types'
|
24
|
+
import DynamicElFormItem from './dynamic-el-form-item.vue'
|
25
|
+
import CommonAnimate from './common-animate.vue'
|
26
|
+
import ComponentTree from '@/components/svg-editor/component-tree/index.vue'
|
27
|
+
import SvgAnalysis from '@/components/svg-analysis/index.vue'
|
28
|
+
import List from '@/components/svg-editor/right-panel/list.vue'
|
29
|
+
import Condition from '@/components/svg-editor/right-panel/condition.vue'
|
30
|
+
import { ElButton } from 'element-plus'
|
31
|
+
import CodeEditModal from '@/components/svg-editor/right-panel/code-edit-modal.vue'
|
32
|
+
import { EConditionType, EEventAction, EEventType } from '@/config/types'
|
33
|
+
import type { IEventsItem } from '@/config/types'
|
34
|
+
|
35
|
+
const configStore = useConfigStore(pinia)
|
36
|
+
const globalStore = useGlobalStore(pinia)
|
37
|
+
|
38
|
+
const activeName = ref('page')
|
39
|
+
const activeNameB = ref('style')
|
40
|
+
|
41
|
+
const updateCommonAniVal = (item: IDoneJson | undefined, val: string) => {
|
42
|
+
if (item?.common_animations) {
|
43
|
+
item.common_animations.val = val
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
configStore.$subscribe((mutation, state) => {
|
48
|
+
if (mutation.storeId === 'config-store') {
|
49
|
+
localStorage.setItem('svg-editor-config', JSON.stringify(state))
|
50
|
+
}
|
51
|
+
})
|
52
|
+
|
53
|
+
const eventsActive = ref(numberArray(20))
|
54
|
+
const netActive = ref(['MQTT'])
|
55
|
+
const addEvent = ref()
|
56
|
+
addEvent.value = () => {
|
57
|
+
let a: IEventsItem = {
|
58
|
+
type: EEventType.Null,
|
59
|
+
action: EEventAction.Null,
|
60
|
+
target: '',
|
61
|
+
scripts: '',
|
62
|
+
condition: { type: EConditionType.None }
|
63
|
+
}
|
64
|
+
|
65
|
+
globalStore.handle_svg_info?.info?.events!.push(a)
|
66
|
+
}
|
67
|
+
|
68
|
+
const addEventList = (e: string, item: IEventsItem) => {
|
69
|
+
if (e === 'ChangeAttr') {
|
70
|
+
item.attrs = [
|
71
|
+
{
|
72
|
+
key: '',
|
73
|
+
val: ''
|
74
|
+
}
|
75
|
+
]
|
76
|
+
} else {
|
77
|
+
delete item.attrs
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
const deleteE = (i: number) => {
|
82
|
+
globalStore.handle_svg_info?.info?.events!.splice(i, 1)
|
83
|
+
}
|
84
|
+
</script>
|
85
|
+
|
86
|
+
<template>
|
87
|
+
<el-tabs class="mx-2 rightTabs" v-if="globalStore.intention != EGlobalStoreIntention.Select" v-model="activeName">
|
88
|
+
<el-tab-pane label="图纸" name="page">
|
89
|
+
<el-form label-width="60px" label-position="left">
|
90
|
+
<el-form-item label="背景色" size="small">
|
91
|
+
<el-color-picker v-model="configStore.svg.background_color" />
|
92
|
+
</el-form-item>
|
93
|
+
<el-form-item label="x原点" size="small">
|
94
|
+
<el-input-number v-model="configStore.svg.position_center.x" />
|
95
|
+
</el-form-item>
|
96
|
+
<el-form-item label="y原点" size="small">
|
97
|
+
<el-input-number v-model="configStore.svg.position_center.y" />
|
98
|
+
</el-form-item>
|
99
|
+
<el-form-item label="网格" size="small">
|
100
|
+
<el-switch v-model="configStore.svg.grid" />
|
101
|
+
</el-form-item>
|
102
|
+
<el-form-item label="标尺" size="small">
|
103
|
+
<el-switch v-model="configStore.svg.ruler" />
|
104
|
+
</el-form-item>
|
105
|
+
<el-form-item label="缩放" size="small">
|
106
|
+
<el-input-number v-model="configStore.svg.scale" :step="0.1" step-strictly />
|
107
|
+
</el-form-item>
|
108
|
+
</el-form>
|
109
|
+
</el-tab-pane>
|
110
|
+
<el-tab-pane label="通信" name="net">
|
111
|
+
<el-collapse v-model="netActive">
|
112
|
+
<el-collapse-item name="MQTT">
|
113
|
+
<template #title>
|
114
|
+
<span style="font-weight: bold">MQTT</span>
|
115
|
+
</template>
|
116
|
+
<el-form label-width="60px" label-position="left">
|
117
|
+
<el-form-item label="URL" size="small">
|
118
|
+
<el-input v-model="configStore.net.mqtt.url" placeholder="如 ws://127.0.0.1:4500" />
|
119
|
+
</el-form-item>
|
120
|
+
<el-form-item label="用户名" size="small">
|
121
|
+
<el-input v-model="configStore.net.mqtt.user" placeholder="username" />
|
122
|
+
</el-form-item>
|
123
|
+
<el-form-item label="密码" size="small">
|
124
|
+
<el-input v-model="configStore.net.mqtt.pwd" placeholder="password" />
|
125
|
+
</el-form-item>
|
126
|
+
<el-form-item label="Topics" size="small">
|
127
|
+
<el-input v-model="configStore.net.mqtt.topics" placeholder="topics" />
|
128
|
+
</el-form-item>
|
129
|
+
</el-form>
|
130
|
+
</el-collapse-item>
|
131
|
+
</el-collapse>
|
132
|
+
</el-tab-pane>
|
133
|
+
<el-tab-pane label="连线" name="line">
|
134
|
+
<el-form label-width="60px" label-position="left" v-if="configStore.connection_line.props">
|
135
|
+
<dynamic-el-form-item :obj-info="configStore.connection_line.props" :hide="['point_position']" />
|
136
|
+
</el-form>
|
137
|
+
<el-form label-width="60px" label-position="left" v-if="configStore.connection_line.animations">
|
138
|
+
<dynamic-el-form-item :obj-info="configStore.connection_line.animations" />
|
139
|
+
</el-form>
|
140
|
+
</el-tab-pane>
|
141
|
+
<el-tab-pane label="结构" name="tree">
|
142
|
+
<component-tree />
|
143
|
+
</el-tab-pane>
|
144
|
+
</el-tabs>
|
145
|
+
<el-tabs
|
146
|
+
class="mx-2 rightTabs"
|
147
|
+
v-else-if="globalStore.intention == EGlobalStoreIntention.Select && globalStore.handle_svg_info"
|
148
|
+
v-model="activeNameB"
|
149
|
+
>
|
150
|
+
<el-tab-pane label="外观" name="style">
|
151
|
+
<el-form label-width="60px" label-position="left">
|
152
|
+
<el-form-item label="标题" size="small">
|
153
|
+
<el-input v-model="globalStore.handle_svg_info!.info.title" />
|
154
|
+
</el-form-item>
|
155
|
+
<el-form-item label="x坐标" size="small">
|
156
|
+
<el-input-number v-model="globalStore.handle_svg_info!.info.x" />
|
157
|
+
</el-form-item>
|
158
|
+
<el-form-item label="y坐标" size="small">
|
159
|
+
<el-input-number v-model="globalStore.handle_svg_info!.info.y" />
|
160
|
+
</el-form-item>
|
161
|
+
<el-form-item label="显示" size="small">
|
162
|
+
<el-switch v-model="globalStore.handle_svg_info!.info.display" />
|
163
|
+
</el-form-item>
|
164
|
+
</el-form>
|
165
|
+
</el-tab-pane>
|
166
|
+
<el-tab-pane label="事件" name="event">
|
167
|
+
<el-button type="primary" style="width: 100%" @click="addEvent">添加事件</el-button>
|
168
|
+
<el-collapse v-model="eventsActive">
|
169
|
+
<el-collapse-item :name="i" v-for="(item, i) in globalStore.handle_svg_info!.info!.events" :key="'event' + i">
|
170
|
+
<template #title>
|
171
|
+
<div class="events-title">
|
172
|
+
<span>事件{{ i + 1 }}</span>
|
173
|
+
<el-icon :size="16" class="bt-Icon" @click.stop="deleteE(i)">
|
174
|
+
<svg-analysis name="delete" />
|
175
|
+
</el-icon>
|
176
|
+
</div>
|
177
|
+
</template>
|
178
|
+
<el-form label-width="90px" label-position="left">
|
179
|
+
<el-form-item label="类型" size="small">
|
180
|
+
<el-select v-model="item.type">
|
181
|
+
<el-option value="Click" label="点击" />
|
182
|
+
<el-option value="Change" label="值改变" />
|
183
|
+
</el-select>
|
184
|
+
</el-form-item>
|
185
|
+
<el-form-item label="行为" size="small">
|
186
|
+
<el-select v-model="item.action" @change="addEventList($event, item)">
|
187
|
+
<el-option value="ChangeAttr" label="改变属性" />
|
188
|
+
<el-option value="JavaScript" label="执行JavaScript" />
|
189
|
+
</el-select>
|
190
|
+
</el-form-item>
|
191
|
+
|
192
|
+
<el-form-item label="目标" size="small" v-if="item.action === 'ChangeAttr'">
|
193
|
+
<el-input v-model="item.target" placeholder="默认自身" />
|
194
|
+
</el-form-item>
|
195
|
+
<list v-if="item.action === 'ChangeAttr'" v-model="item.attrs" />
|
196
|
+
|
197
|
+
<el-form-item label="JavaScript" size="small" v-if="item.action === 'JavaScript'">
|
198
|
+
<code-edit-modal v-model="item.scripts" lang="javascript" />
|
199
|
+
</el-form-item>
|
200
|
+
<condition v-model="item.condition" />
|
201
|
+
</el-form>
|
202
|
+
</el-collapse-item>
|
203
|
+
</el-collapse>
|
204
|
+
</el-tab-pane>
|
205
|
+
<el-tab-pane label="动效" name="animation">
|
206
|
+
<el-form label-width="60px" label-position="left" v-if="globalStore.handle_svg_info?.info.animations">
|
207
|
+
<dynamic-el-form-item :obj-info="globalStore.handle_svg_info!.info.animations"></dynamic-el-form-item>
|
208
|
+
</el-form>
|
209
|
+
<el-form label-width="60px" label-position="left" v-else-if="globalStore.handle_svg_info!.info.common_animations">
|
210
|
+
<el-form-item label="动画效果" size="small">
|
211
|
+
<common-animate
|
212
|
+
@update-common-ani-val="(val: string) => updateCommonAniVal(globalStore.handle_svg_info?.info, val)"
|
213
|
+
:val="globalStore.handle_svg_info!.info.common_animations.val"
|
214
|
+
></common-animate>
|
215
|
+
</el-form-item>
|
216
|
+
<el-form-item label="延迟" size="small">
|
217
|
+
<el-select v-model="globalStore.handle_svg_info!.info.common_animations.delay">
|
218
|
+
<el-option value="delay-0s" label="无" />
|
219
|
+
<el-option value="delay-1s" label="1秒" />
|
220
|
+
<el-option value="delay-2s" label="2秒" />
|
221
|
+
<el-option value="delay-3s" label="3秒" />
|
222
|
+
<el-option value="delay-4s" label="4秒" />
|
223
|
+
<el-option value="delay-5s" label="5秒" />
|
224
|
+
</el-select>
|
225
|
+
</el-form-item>
|
226
|
+
<el-form-item label="动画速度" size="small">
|
227
|
+
<el-select v-model="globalStore.handle_svg_info!.info.common_animations.speed">
|
228
|
+
<el-option value="slow" label="慢" />
|
229
|
+
<el-option value="slower" label="最慢" />
|
230
|
+
<el-option value="fast" label="快" />
|
231
|
+
<el-option value="faster" label="最快" />
|
232
|
+
</el-select>
|
233
|
+
</el-form-item>
|
234
|
+
<el-form-item label="循环次数" size="small">
|
235
|
+
<el-select v-model="globalStore.handle_svg_info!.info.common_animations.repeat">
|
236
|
+
<el-option value="repeat-1" label="一次" />
|
237
|
+
<el-option value="repeat-2" label="两次" />
|
238
|
+
<el-option value="repeat-3" label="三次" />
|
239
|
+
<el-option value="infinite" label="无限次" />
|
240
|
+
</el-select>
|
241
|
+
</el-form-item>
|
242
|
+
</el-form>
|
243
|
+
</el-tab-pane>
|
244
|
+
<el-tab-pane label="数据" name="data">
|
245
|
+
<el-form label-width="90px" label-position="left">
|
246
|
+
<el-form-item label="ID" size="small">
|
247
|
+
<el-input v-model="globalStore.handle_svg_info!.info.id" />
|
248
|
+
</el-form-item>
|
249
|
+
<div
|
250
|
+
v-for="(e, k) in globalStore.handle_svg_info!.info.state"
|
251
|
+
:key="'state' + k"
|
252
|
+
v-if="globalStore.handle_svg_info!.info.state"
|
253
|
+
>
|
254
|
+
<el-form-item class="props-row" :label="String(k)" size="small"> {{ e?.default }}</el-form-item>
|
255
|
+
|
256
|
+
<el-form-item
|
257
|
+
v-if="k === 'OnOff'"
|
258
|
+
:label="globalStore.handle_svg_info!.info.state?.OnOff!.title"
|
259
|
+
size="small"
|
260
|
+
>
|
261
|
+
<el-switch v-model="globalStore.handle_svg_info!.info.state!.OnOff!.default"></el-switch>
|
262
|
+
</el-form-item>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div v-if="globalStore.handle_svg_info!.info?.hasOwnProperty('tag_slot')">
|
266
|
+
<el-form-item class="props-row" label="tag_slot" size="small">
|
267
|
+
{{ globalStore.handle_svg_info!.info.tag_slot }}
|
268
|
+
</el-form-item>
|
269
|
+
<el-form-item label="文字插槽" size="small">
|
270
|
+
<el-input v-model="globalStore.handle_svg_info!.info.tag_slot" />
|
271
|
+
</el-form-item>
|
272
|
+
</div>
|
273
|
+
<dynamic-el-form-item :obj-info="globalStore.handle_svg_info!.info.props" code />
|
274
|
+
</el-form>
|
275
|
+
</el-tab-pane>
|
276
|
+
<el-tab-pane label="结构" name="tree">
|
277
|
+
<component-tree />
|
278
|
+
</el-tab-pane>
|
279
|
+
</el-tabs>
|
280
|
+
</template>
|
281
|
+
|
282
|
+
<style scoped lang="less">
|
283
|
+
.events-title {
|
284
|
+
width: calc(~'100% - 28px');
|
285
|
+
display: flex;
|
286
|
+
align-items: center;
|
287
|
+
|
288
|
+
> span {
|
289
|
+
font-weight: bold;
|
290
|
+
}
|
291
|
+
|
292
|
+
> i {
|
293
|
+
margin-left: 15px;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
</style>
|
297
|
+
|
298
|
+
<style lang="less">
|
299
|
+
.rightTabs {
|
300
|
+
.el-tabs__item {
|
301
|
+
padding: 0 10px;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
</style>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import type { IAttrItem } from '@/config/types'
|
3
|
+
import { ElIcon, ElInput } from 'element-plus'
|
4
|
+
import SvgAnalysis from '@/components/svg-analysis/index.vue'
|
5
|
+
import { computed } from 'vue'
|
6
|
+
|
7
|
+
const props = withDefaults(defineProps<{ modelValue: IAttrItem[] }>(), {
|
8
|
+
modelValue: () => [
|
9
|
+
{
|
10
|
+
key: '',
|
11
|
+
val: ''
|
12
|
+
}
|
13
|
+
]
|
14
|
+
})
|
15
|
+
const emit = defineEmits(['update:modelValue'])
|
16
|
+
|
17
|
+
const value = computed({
|
18
|
+
get() {
|
19
|
+
return props.modelValue
|
20
|
+
},
|
21
|
+
set(val) {
|
22
|
+
emit('update:modelValue', val)
|
23
|
+
}
|
24
|
+
})
|
25
|
+
|
26
|
+
const addL = () => {
|
27
|
+
value.value.push({
|
28
|
+
key: '',
|
29
|
+
val: ''
|
30
|
+
})
|
31
|
+
}
|
32
|
+
|
33
|
+
const deleteL = (i: number) => {
|
34
|
+
value.value.splice(i, 1)
|
35
|
+
}
|
36
|
+
</script>
|
37
|
+
|
38
|
+
<template>
|
39
|
+
<div class="wall-l">
|
40
|
+
<div class="head-l">
|
41
|
+
<span>key</span>
|
42
|
+
<span>value</span>
|
43
|
+
|
44
|
+
<el-icon :size="16" class="bt-Icon" @click="addL">
|
45
|
+
<svg-analysis name="add" />
|
46
|
+
</el-icon>
|
47
|
+
</div>
|
48
|
+
<div class="row-l" v-for="(item, i) of value">
|
49
|
+
<el-input class="content-l" v-model="item.key" size="small" placeholder="key" />
|
50
|
+
<el-input class="content-l" v-model="item.val" size="small" placeholder="value" />
|
51
|
+
|
52
|
+
<el-icon :size="16" class="bt-Icon" @click="deleteL(i)">
|
53
|
+
<svg-analysis name="delete" />
|
54
|
+
</el-icon>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</template>
|
58
|
+
|
59
|
+
<style lang="less" scoped>
|
60
|
+
.wall-l {
|
61
|
+
background-color: #f3f6f9;
|
62
|
+
padding: 4px 5px 2px 5px;
|
63
|
+
border-radius: 4px;
|
64
|
+
.head-l {
|
65
|
+
display: flex;
|
66
|
+
align-items: center;
|
67
|
+
|
68
|
+
span {
|
69
|
+
display: inline-block;
|
70
|
+
width: 42%;
|
71
|
+
margin-right: 10px;
|
72
|
+
color: #666;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
.row-l {
|
77
|
+
display: flex;
|
78
|
+
align-items: center;
|
79
|
+
padding-bottom: 6px;
|
80
|
+
.content-l {
|
81
|
+
width: 42%;
|
82
|
+
margin-right: 10px;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
</style>
|
@@ -0,0 +1,139 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { pinia } from '@/hooks'
|
3
|
+
import { useConfigStore } from '@/stores/config'
|
4
|
+
import { useGlobalStore } from '@/stores/global'
|
5
|
+
import { useEditPrivateStore } from '@/stores/system'
|
6
|
+
import { ElIcon, ElDivider } from 'element-plus'
|
7
|
+
import SvgAnalysis from '../../svg-analysis/index.vue'
|
8
|
+
import { useSvgEditLayoutStore } from '@/stores/svg-edit-layout'
|
9
|
+
import { EVisibleConfKey } from '../types'
|
10
|
+
import type { IDataModel } from '../types'
|
11
|
+
import { EGlobalStoreIntention } from '@/stores/global/types'
|
12
|
+
|
13
|
+
const svgEditLayoutStore = useSvgEditLayoutStore(pinia)
|
14
|
+
const globalStore = useGlobalStore(pinia)
|
15
|
+
const editPrivateStore = useEditPrivateStore(pinia)
|
16
|
+
const configStore = useConfigStore(pinia)
|
17
|
+
const emits = defineEmits(['changeVisible', 'onReturn', 'onPreview', 'onSave'])
|
18
|
+
const onDeleteBtnClick = () => {
|
19
|
+
globalStore.done_json.length <= 0 || globalStore.setDoneJson([])
|
20
|
+
globalStore.intention = EGlobalStoreIntention.None
|
21
|
+
}
|
22
|
+
const onPreviewClick = () => {
|
23
|
+
const data_model: IDataModel = {
|
24
|
+
layout_center: svgEditLayoutStore.center_offset,
|
25
|
+
config: configStore.$state,
|
26
|
+
done_json: globalStore.done_json
|
27
|
+
}
|
28
|
+
emits('onPreview', data_model)
|
29
|
+
}
|
30
|
+
const onSaveClick = () => {
|
31
|
+
const data_model: IDataModel = {
|
32
|
+
layout_center: svgEditLayoutStore.center_offset,
|
33
|
+
config: configStore.$state,
|
34
|
+
done_json: globalStore.done_json
|
35
|
+
}
|
36
|
+
emits('onSave', data_model)
|
37
|
+
}
|
38
|
+
</script>
|
39
|
+
|
40
|
+
<template>
|
41
|
+
<div class="flex justify-between" style="width: 100%">
|
42
|
+
<div class="flex items-center justify-between" style="width: 220px">
|
43
|
+
<div class="flex items-center"><span class="logo-title">组态编辑器</span></div>
|
44
|
+
<el-icon :size="24" class="bt-Icon" @click="svgEditLayoutStore.left_nav = !svgEditLayoutStore.left_nav">
|
45
|
+
<svg-analysis v-if="svgEditLayoutStore.left_nav" name="menu-unfold" />
|
46
|
+
<svg-analysis v-else name="menu-fold" />
|
47
|
+
</el-icon>
|
48
|
+
</div>
|
49
|
+
<div class="flex justify-between" style="width: calc(100% - 440px)">
|
50
|
+
<div class="flex items-center">
|
51
|
+
<el-icon
|
52
|
+
title="撤销 ctrl+z"
|
53
|
+
:size="20"
|
54
|
+
:class="`${editPrivateStore.getTopBtnUndoStatus ? 'bt-Icon' : 'icon-disable'} ml-20px`"
|
55
|
+
@click="() => editPrivateStore.topUndoBtnClick()"
|
56
|
+
>
|
57
|
+
<svg-analysis name="undo" />
|
58
|
+
</el-icon>
|
59
|
+
<el-icon
|
60
|
+
title="重做 ctrl+shift+z"
|
61
|
+
:class="`${editPrivateStore.getTopBtnRedoStatus ? 'bt-Icon' : 'icon-disable'} ml-5px`"
|
62
|
+
:size="20"
|
63
|
+
@click="() => editPrivateStore.topRedoBtnClick()"
|
64
|
+
>
|
65
|
+
<svg-analysis name="redo" />
|
66
|
+
</el-icon>
|
67
|
+
<el-divider direction="vertical"></el-divider>
|
68
|
+
<el-icon
|
69
|
+
title="清空 ctrl+delete"
|
70
|
+
:class="`${globalStore.done_json.length > 0 ? 'bt-Icon' : 'icon-disable'}`"
|
71
|
+
:size="20"
|
72
|
+
@click="onDeleteBtnClick"
|
73
|
+
>
|
74
|
+
<svg-analysis name="delete" />
|
75
|
+
</el-icon>
|
76
|
+
<el-divider direction="vertical" />
|
77
|
+
<el-icon
|
78
|
+
title="导入数据模型"
|
79
|
+
class="bt-Icon"
|
80
|
+
:size="20"
|
81
|
+
@click="emits('changeVisible', EVisibleConfKey.ImportJson, true)"
|
82
|
+
>
|
83
|
+
<svg-analysis name="import" />
|
84
|
+
</el-icon>
|
85
|
+
<el-icon
|
86
|
+
title="导出数据模型"
|
87
|
+
:size="20"
|
88
|
+
class="bt-Icon ml-5px"
|
89
|
+
@click="emits('changeVisible', EVisibleConfKey.ExportJson, true)"
|
90
|
+
>
|
91
|
+
<svg-analysis name="export" />
|
92
|
+
</el-icon>
|
93
|
+
<!-- <el-divider direction="vertical"></el-divider>
|
94
|
+
<el-icon title="组合" class="bt-Icon" :size="20">
|
95
|
+
<svg-analysis name="group"/>
|
96
|
+
</el-icon>
|
97
|
+
<el-divider direction="vertical"></el-divider>
|
98
|
+
<el-icon title="取消组合" class="bt-Icon" :size="20">
|
99
|
+
<svg-analysis name="ungroup"/>
|
100
|
+
</el-icon>
|
101
|
+
<el-divider direction="vertical"></el-divider>
|
102
|
+
<el-icon title="锁定" class="bt-Icon" :size="20">
|
103
|
+
<svg-analysis name="lock"/>
|
104
|
+
</el-icon> -->
|
105
|
+
</div>
|
106
|
+
<div class="flex items-center mr-20px">
|
107
|
+
<el-icon title="返回" class="bt-Icon" :size="20" @click="emits('onReturn')">
|
108
|
+
<svg-analysis name="return" />
|
109
|
+
</el-icon>
|
110
|
+
<el-divider direction="vertical"></el-divider>
|
111
|
+
<el-icon title="保存" class="bt-Icon" :size="20" @click="onSaveClick">
|
112
|
+
<svg-analysis name="save" />
|
113
|
+
</el-icon>
|
114
|
+
<el-divider direction="vertical"></el-divider>
|
115
|
+
<el-icon title="预览" class="bt-Icon" :size="22" @click="onPreviewClick">
|
116
|
+
<svg-analysis name="preview" />
|
117
|
+
</el-icon>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
<div class="flex items-center" style="width: 220px">
|
121
|
+
<el-icon :size="24" class="bt-Icon" @click="svgEditLayoutStore.right_nav = !svgEditLayoutStore.right_nav">
|
122
|
+
<svg-analysis v-if="svgEditLayoutStore.right_nav" name="menu-fold" />
|
123
|
+
<svg-analysis v-else name="menu-unfold" />
|
124
|
+
</el-icon>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
</template>
|
128
|
+
|
129
|
+
<style scoped lang="less">
|
130
|
+
.logo-title {
|
131
|
+
font-size: 15px;
|
132
|
+
font-weight: 600;
|
133
|
+
}
|
134
|
+
|
135
|
+
.icon-disable {
|
136
|
+
cursor: not-allowed;
|
137
|
+
color: #ccc;
|
138
|
+
}
|
139
|
+
</style>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { IPositionCenterSvg, INet } from '@/stores/config/types'
|
2
|
+
import type { IDoneJson } from '@/stores/global/types'
|
3
|
+
import type { ISystemStraightLine } from '@/components/config/types'
|
4
|
+
|
5
|
+
export type IVisibleConf = {
|
6
|
+
[key in EVisibleConfKey]: boolean
|
7
|
+
}
|
8
|
+
|
9
|
+
export enum EVisibleConfKey {
|
10
|
+
ImportJson = 'ImportJson',
|
11
|
+
ExportJson = 'ExportJson',
|
12
|
+
ImportFile = 'ImportFile'
|
13
|
+
}
|
14
|
+
|
15
|
+
export interface IDataModel {
|
16
|
+
layout_center: {
|
17
|
+
x: number
|
18
|
+
y: number
|
19
|
+
}
|
20
|
+
config: { svg: IPositionCenterSvg; connection_line: ISystemStraightLine; net: INet }
|
21
|
+
done_json: IDoneJson[]
|
22
|
+
}
|