Skip to content

Commit 905eb94

Browse files
新增xml数据转换json功能
1 parent 87ded10 commit 905eb94

3 files changed

Lines changed: 178 additions & 45 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
rules_folder: example_rules //用来加载rule的目录,默认是example_rules
3+
run_every: //ElastAlert多久查询一次Elasticsearch
4+
minutes: 1
5+
buffer_time: //用来设置请求里时间字段的范围
6+
minutes: 15
7+
es_host: 192.168.232.191 //elasticsearch的host地址,每个规则都可以拥有自己的Elasticsearch主机
8+
es_port: 9200 //elasticsearch 对应的端口号
9+
es_url_prefix: elasticsearch // 可选的,es url前缀
10+
es_send_get_body_as: GET // 可选的,查询es的方式,默认是GET,如果由于某种原因失败,则可以传递“ GET”,“ POST”或“ source”。
11+
use_ssl: True //可选的,选择是否用SSL连接es,true或者false
12+
verify_certs: True //可选的,是否验证TLS证书,设置为true或者false,默认为- true
13+
es_username: someusername //es认证的username和password,如果未使用可注释
14+
es_password: somepassword
15+
writeback_index: elastalert_status //elastalert产生的日志在elasticsearch中的创建的索引
16+
alert_time_limit: //失败重试的时间限制
17+
days: 2

src/views/customToolbar/component/uploadData.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<el-dialog
3-
:title="isOutputXml ? '数据导出':'数据导入'"
3+
:title="isOutputXml ? '数据导出' : '数据导入'"
44
:visible.sync="centerDialogVisible"
55
width="70%;"
66
center
@@ -24,18 +24,17 @@
2424
<em>点击上传</em>
2525
<div slot="tip" class="el-upload__tip">
2626
只能上传
27-
<em>xml</em> 文件,且最大文件数量不超过
28-
<em>1</em> 个
27+
<em>xml</em> 文件,且最大文件数量不超过 <em>1</em> 个
2928
</div>
3029
</div>
3130
</el-upload>
3231
<!--codemirror插件-->
33-
<div style="display:flex">
32+
<div style="display: flex">
3433
<codemirror
3534
:value="currentNodeData"
3635
v-model="currentNodeData"
3736
:options="options"
38-
:style="{'width': isOutputXml ? '50%':'100%'}"
37+
:style="{ width: isOutputXml ? '50%' : '100%' }"
3938
class="codemirror"
4039
></codemirror>
4140
<!-- xml转json -->
@@ -50,8 +49,12 @@
5049
</div>
5150
<span slot="footer" class="dialog-footer">
5251
<el-button @click="cancelUpload">取 消</el-button>
53-
<el-button type="primary" @click="confirmUpload" v-if="!isOutputXml">导入</el-button>
54-
<el-button type="primary" @click="saveXmlFile" v-if="isOutputXml">另存为XML文件</el-button>
52+
<el-button type="primary" @click="confirmUpload" v-if="!isOutputXml"
53+
>导入</el-button
54+
>
55+
<el-button type="primary" @click="saveXmlFile" v-if="isOutputXml"
56+
>另存为XML文件</el-button
57+
>
5558
</span>
5659
</el-dialog>
5760
</template>

src/views/customToolbar/customToolbar.vue

Lines changed: 151 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@
33
<!-- 左侧节点/放大缩小工具 菜单 -->
44
<div class="toolbarContainer">
55
<div class="aside-button-group">
6-
<el-button-group style="margin:10px 0 ">
7-
<el-tooltip class="item" effect="dark" content="放大" placement="bottom">
6+
<el-button-group style="margin: 10px 0">
7+
<el-tooltip
8+
class="item"
9+
effect="dark"
10+
content="放大"
11+
placement="bottom"
12+
>
813
<el-button icon="el-icon-zoom-in" @click="zoomIn"></el-button>
914
</el-tooltip>
10-
<el-tooltip class="item" effect="dark" content="缩小" placement="bottom">
15+
<el-tooltip
16+
class="item"
17+
effect="dark"
18+
content="缩小"
19+
placement="bottom"
20+
>
1121
<el-button icon="el-icon-zoom-out" @click="zoomOut"></el-button>
1222
</el-tooltip>
13-
<el-tooltip class="item" effect="dark" content="等比缩放" placement="bottom">
14-
<el-button @click="autoSize" icon="iconfont icon-expandalt-fill"></el-button>
23+
<el-tooltip
24+
class="item"
25+
effect="dark"
26+
content="等比缩放"
27+
placement="bottom"
28+
>
29+
<el-button
30+
@click="autoSize"
31+
icon="iconfont icon-expandalt-fill"
32+
></el-button>
1533
</el-tooltip>
1634
</el-button-group>
1735
</div>
@@ -27,7 +45,7 @@
2745
:key="item['index']"
2846
ref="generalToolItems"
2947
>
30-
<span class="generalTooltitle">{{item['text']}}</span>
48+
<span class="generalTooltitle">{{ item["text"] }}</span>
3149
</span>
3250
</el-collapse-item>
3351
<el-collapse-item name="2" class="custom-toolbar">
@@ -36,14 +54,14 @@
3654
<span
3755
v-for="item in toolbarItems"
3856
style
39-
:class="{'rectangle-node':item['nodeType']==='rectangle'} "
57+
:class="{ 'rectangle-node': item['nodeType'] === 'rectangle' }"
4058
class="custom-node"
4159
:key="item['title']"
4260
ref="toolItem"
4361
>
4462
<img style :src="item['icon']" />
4563
<br />
46-
<span class="node-title">{{item['title']}}</span>
64+
<span class="node-title">{{ item["title"] }}</span>
4765
</span>
4866
</el-collapse-item>
4967
<!-- 箭头模板图标 -->
@@ -73,7 +91,7 @@
7391
class="group-item"
7492
ref="grouptoolItem"
7593
>
76-
<b>{{item.title}}</b>
94+
<b>{{ item.title }}</b>
7795
</li>
7896
</ul>
7997
</el-collapse-item>
@@ -84,18 +102,52 @@
84102
<el-col :span="4">
85103
<div
86104
class="grid-content bg-purple"
87-
style="color: rgb(64, 158, 255);font-weight: 800;font-size: 22px;margin-left: 44px;"
88-
>Easy Editor</div>
105+
style="
106+
color: rgb(64, 158, 255);
107+
font-weight: 800;
108+
font-size: 22px;
109+
margin-left: 44px;
110+
"
111+
>
112+
Easy Editor
113+
</div>
89114
</el-col>
90115
<el-col :span="12" class="tools-group">
91-
<el-tooltip class="item" effect="dark" content="组合" placement="bottom">
92-
<el-button type="text" icon="iconfont icon-zuhe" @click="enGroup"></el-button>
116+
<el-tooltip
117+
class="item"
118+
effect="dark"
119+
content="组合"
120+
placement="bottom"
121+
>
122+
<el-button
123+
type="text"
124+
icon="iconfont icon-zuhe"
125+
@click="enGroup"
126+
></el-button>
93127
</el-tooltip>
94-
<el-tooltip class="item" effect="dark" content="导入xml文件" placement="bottom">
95-
<el-button type="text" icon="iconfont icon-fileplus-fill" @click="inPutXml"></el-button>
128+
<el-tooltip
129+
class="item"
130+
effect="dark"
131+
content="导入xml文件"
132+
placement="bottom"
133+
>
134+
<el-button
135+
type="text"
136+
icon="iconfont icon-fileplus-fill"
137+
@click="inPutXml"
138+
></el-button>
96139
</el-tooltip>
97-
<el-tooltip class="item" effect="dark" content="导出xml文件" placement="bottom">
98-
<el-button type="text" icon="iconfont icon-xmloutput" @click="outPutXml"></el-button>
140+
<el-tooltip
141+
class="item"
142+
effect="dark"
143+
content="导出xml文件"
144+
placement="bottom"
145+
>
146+
<el-button
147+
type="text"
148+
icon="iconfont icon-xmloutput"
149+
@click="outPutXml"
150+
></el-button>
99151
</el-tooltip>
100152
<el-tooltip
101153
class="item"
@@ -107,40 +159,96 @@
107159
<el-button
108160
type="text"
109161
icon="iconfont icon-dituleiwanggequ-copy"
110-
@click="showBackground=false"
162+
@click="showBackground = false"
111163
></el-button>
112164
</el-tooltip>
113-
<el-tooltip v-else class="item" effect="dark" content="显示网格背景" placement="bottom">
165+
<el-tooltip
166+
v-else
167+
class="item"
168+
effect="dark"
169+
content="显示网格背景"
170+
placement="bottom"
171+
>
114172
<el-button
115173
type="text"
116174
icon="iconfont icon-fangxingweixuanzhong-copy"
117-
@click="showBackground=true"
175+
@click="showBackground = true"
118176
></el-button>
119177
</el-tooltip>
120-
<el-tooltip class="item" effect="dark" content="导出为图片" placement="bottom">
121-
<el-button type="text" icon="iconfont icon-tupian" @click="showImage"></el-button>
178+
<el-tooltip
179+
class="item"
180+
effect="dark"
181+
content="导出为图片"
182+
placement="bottom"
183+
>
184+
<el-button
185+
type="text"
186+
icon="iconfont icon-tupian"
187+
@click="showImage"
188+
></el-button>
122189
</el-tooltip>
123-
<el-tooltip class="item" effect="dark" content="树形布局" placement="bottom">
124-
<el-button type="text" icon="iconfont icon-Directory-tree"></el-button>
190+
<el-tooltip
191+
class="item"
192+
effect="dark"
193+
content="树形布局"
194+
placement="bottom"
195+
>
196+
<el-button
197+
type="text"
198+
icon="iconfont icon-Directory-tree"
199+
></el-button>
125200
</el-tooltip>
126-
<el-tooltip class="item" effect="dark" content="撤销" placement="bottom">
127-
<el-button type="text" icon="iconfont icon-reply" @click="goBack"></el-button>
201+
<el-tooltip
202+
class="item"
203+
effect="dark"
204+
content="撤销"
205+
placement="bottom"
206+
>
207+
<el-button
208+
type="text"
209+
icon="iconfont icon-reply"
210+
@click="goBack"
211+
></el-button>
128212
</el-tooltip>
129-
<el-tooltip class="item" effect="dark" content="前进" placement="bottom">
130-
<el-button type="text" icon="iconfont icon-share" @click="goForward"></el-button>
213+
<el-tooltip
214+
class="item"
215+
effect="dark"
216+
content="前进"
217+
placement="bottom"
218+
>
219+
<el-button
220+
type="text"
221+
icon="iconfont icon-share"
222+
@click="goForward"
223+
></el-button>
131224
</el-tooltip>
132-
<el-tooltip class="item" effect="dark" content="删除" placement="bottom">
133-
<el-button type="text" icon="el-icon-delete-solid" @click="deleteNode"></el-button>
225+
<el-tooltip
226+
class="item"
227+
effect="dark"
228+
content="删除"
229+
placement="bottom"
230+
>
231+
<el-button
232+
type="text"
233+
icon="el-icon-delete-solid"
234+
@click="deleteNode"
235+
></el-button>
134236
</el-tooltip>
135237
</el-col>
136238
<el-col :span="8">
137239
<div
138240
class="grid-content bg-purple"
139-
style="display:flex;justify-content: flex-end;padding-right:20px"
241+
style="display: flex; justify-content: flex-end; padding-right: 20px"
140242
>
141-
<el-button round size="medium" @click="loadFlowCase(1)">化工流程案例</el-button>
142-
<el-button round size="medium" @click="loadFlowCase(2)">组件管理案例</el-button>
143-
<el-button round size="medium" @click="loadFlowCase(3)">Vue生命周期案例</el-button>
243+
<el-button round size="medium" @click="loadFlowCase(1)"
244+
>化工流程案例</el-button
245+
>
246+
<el-button round size="medium" @click="loadFlowCase(2)"
247+
>组件管理案例</el-button
248+
>
249+
<el-button round size="medium" @click="loadFlowCase(3)"
250+
>Vue生命周期案例</el-button
251+
>
144252
</div>
145253
</el-col>
146254
</div>
@@ -149,7 +257,7 @@
149257
class="graphContainer"
150258
id="graphContainer"
151259
ref="container"
152-
:class="{'graphContainer-background':showBackground}"
260+
:class="{ 'graphContainer-background': showBackground }"
153261
></div>
154262
<!-- 右侧栏 -->
155263
<div class="right-bar">
@@ -177,8 +285,13 @@
177285
ref="styleSelect"
178286
/>
179287
<div class="json-viewer">
180-
<h4 style="text-align:center">Json数据结构</h4>
181-
<json-viewer :value="jsonData" style="height:80%" copyable sort></json-viewer>
288+
<h4 style="text-align: center">Json数据结构</h4>
289+
<json-viewer
290+
:value="jsonData"
291+
style="height: 80%"
292+
copyable
293+
sort
294+
></json-viewer>
182295
</div>
183296
</div>
184297

@@ -676,7 +789,7 @@ export default {
676789
let groupObj = _.pick(addCell, ['id', 'title', 'parent', 'geometry']);
677790
this.jsonData['cells']['groups'].push(groupObj);
678791
} else {
679-
let nodeObj = _.pick(addCell, ['id', , 'title', 'parent', 'geometry']);
792+
let nodeObj = _.pick(addCell, ['id', 'title', 'parent', 'geometry']);
680793
this.jsonData['cells']['nodes'].push(nodeObj);
681794
this.$message.info('添加了一个节点');
682795
}

0 commit comments

Comments
 (0)