17
17
<div class =" main-row" >
18
18
<div class =" collection-list" >
19
19
<div class =" label" >选择集合</div >
20
- <el-radio-group v-model =" collection_name" style = " width : 100 % ; " >
20
+ <el-radio-group v-model =" collection_name" class = " radio-group " >
21
21
<el-radio v-for =" item in collections" :key =" item" class =" collection-radio" border size =" medium" :label =" item" >
22
22
{{ item }}
23
23
</el-radio >
29
29
<el-button class =" btn" size =" mini" type =" success" :disabled =" loading" @click =" updateRule" >保存</el-button >
30
30
<el-button class =" btn" type =" danger" size =" mini" :disabled =" loading" @click =" removeRule" >删除</el-button >
31
31
</div >
32
- <json-editor v-model =" value" :dark =" true" :height =" 600" />
32
+ <json-editor v-model =" value" class = " editor " :line-numbers =" true" :dark = " false " :height =" 600" />
33
33
</div >
34
34
</div >
35
35
@@ -76,6 +76,7 @@ import JsonEditor from '@/components/JsonEditor/rule'
76
76
import { db } from ' ../../api/cloud'
77
77
import $ from ' lodash'
78
78
import { publishPolicy } from ' ../../api/publish'
79
+ import { Constants } from ' ../../api/constants'
79
80
80
81
const defaultValue = ' {}'
81
82
const defaultForm = {
@@ -125,7 +126,7 @@ export default {
125
126
methods: {
126
127
async getPolicies () {
127
128
this .loading = true
128
- const r = await db .collection (' __policies ' )
129
+ const r = await db .collection (Constants . cn . policies )
129
130
.get ()
130
131
131
132
if (! r .ok ) {
@@ -154,7 +155,7 @@ export default {
154
155
this .loading = true
155
156
const rule_data = this .value
156
157
const key = ` rules.${ this .collection_name } `
157
- const r = await db .collection (' __policies ' )
158
+ const r = await db .collection (Constants . cn . policies )
158
159
.where ({
159
160
_id: this .policy_id
160
161
})
@@ -187,7 +188,7 @@ export default {
187
188
this .loading = true
188
189
189
190
const key = ` rules.${ this .form .collection } `
190
- const { total } = await db .collection (' __policies ' )
191
+ const { total } = await db .collection (Constants . cn . policies )
191
192
.where ({
192
193
_id: this .form .policy_id ,
193
194
[key]: db .command .exists (true )
@@ -198,7 +199,7 @@ export default {
198
199
this .$message (' 该集合规则已存在!' )
199
200
return
200
201
}
201
- const r = await db .collection (' __policies ' )
202
+ const r = await db .collection (Constants . cn . policies )
202
203
.where ({
203
204
_id: this .form .policy_id ,
204
205
[key]: db .command .exists (false )
@@ -244,7 +245,7 @@ export default {
244
245
this .loading = true
245
246
246
247
const key = ` rules.${ this .collection_name } `
247
- const r = await db .collection (' __policies ' )
248
+ const r = await db .collection (Constants . cn . policies )
248
249
.where ({
249
250
_id: this .policy_id ,
250
251
[key]: db .command .exists (true )
@@ -314,7 +315,9 @@ export default {
314
315
display: flex;
315
316
316
317
.collection - list {
317
- width: 200px ;
318
+ width: 250px ;
319
+
320
+ padding- bottom: 10px ;
318
321
border- radius: 5px ;
319
322
box- sizing: border- box;
320
323
@@ -323,8 +326,20 @@ export default {
323
326
color: gray;
324
327
margin- bottom: 10px ;
325
328
}
326
- .collection - radio {
329
+
330
+ .radio - group {
327
331
width: 100 % ;
332
+ height: 640px ;
333
+ overflow- y: scroll;
334
+ overflow- x: hidden;
335
+ }
336
+
337
+ .radio - group:: - webkit- scrollbar {
338
+ display: none;
339
+ }
340
+
341
+ .collection - radio {
342
+ width: 80 % ;
328
343
margin- bottom: 10px ;
329
344
margin- left: 0px ;
330
345
}
@@ -340,12 +355,16 @@ export default {
340
355
display: flex;
341
356
width: 400px ;
342
357
justify- content: flex- start;
343
- margin- bottom: 5px ;
358
+ margin- bottom: 10px ;
344
359
345
360
.btn {
346
361
margin- left: 15px ;
347
362
}
348
363
}
364
+
365
+ .editor {
366
+ border: 1px solid lightgray
367
+ }
349
368
}
350
369
}
351
370
0 commit comments